added cdk to deps and building fileapprove

This commit is contained in:
Andrew Pamment
2017-03-20 21:40:32 +10:00
parent 2ec24ec5bb
commit 8ab2142ba1
265 changed files with 99585 additions and 18 deletions

116
deps/cdk-5.0-20161210/cli/samples/alphalist.sh vendored Executable file
View File

@@ -0,0 +1,116 @@
#!/bin/sh
# $Id: alphalist.sh,v 1.7 2005/12/27 16:04:57 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the alphalist widget.
#
#
# This gets the password file.
#
getPasswordFile()
{
system=$1
file=$2
#
# Depeding on the system, get the password file
# using nicat, ypcat, or just plain old /etc/passwd
#
if [ "$system" = "NIS" ]; then
niscat passwd.org_dir > $file
elif [ "$system" = "YP" ]; then
ypcat passwd > $file
else
cp /etc/passwd $file
fi
}
#
# This displays account information.
#
displayAccountInformation()
{
userAccount=$1
passwordFile=$2
#
# Get the user account information.
#
line=`grep "^${userAccount}" $passwordFile`
uid=`echo $line | cut -d: -f3`
gid=`echo $line | cut -d: -f4`
info=`echo $line | cut -d: -f5`
home=`echo $line | cut -d: -f6`
shell=`echo $line | cut -d: -f7`
#
# Create the label message information.
#
accountMessage="<C></U>Account
<C><#HL(30)>
Account: </U>${userAccount}
UID : </U>${uid}
GID : </U>${gid}
Info : </U>${info}
Home : </U>${home}
Shell : </U>${shell}
<C><#HL(30)>
<C>Hit </R>space<!R> to continue"
#
# Create the popup label.
#
${CDK_LABEL} -m "${accountMessage}" -p " "
}
#
# Create some global variables.
#
CDK_ALPHALIST="${CDK_BINDIR=..}/cdkalphalist"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
tmpPass="${TMPDIR=/tmp}/sl.$$"
output="${TMPDIR=/tmp}/alphalist.$$"
userAccounts="${TMPDIR=/tmp}/ua.$$"
#
# Create the message for the scrolling list.
#
title="<C>Pick an account
<C>you want to view."
#
# Get the password file and stick it into the temp file.
#
#getPasswordFile "YP" "$tmpPass"
#getPasswordFile "NIS" "$tmpPass"
getPasswordFile "Other" "$tmpPass"
#
# Get the user account from the password file.
#
awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts}
#
# Create the scrolling list.
#
${CDK_ALPHALIST} -T "${title}" -f ${userAccounts} -H -10 -W -20 2> ${output}
selected=$?
test $selected = 255 && exit 1
answer=`sed -e 's/^[ ]*//' -e 's/[ ]*$//' ${output}`
#
# Display the account information.
#
if [ -n "$answer" ]; then
displayAccountInformation $answer $tmpPass
fi
#
# Clean up.
#
rm -f ${output} ${tmpPass} ${userAccounts}

89
deps/cdk-5.0-20161210/cli/samples/calendar.sh vendored Executable file
View File

@@ -0,0 +1,89 @@
#!/bin/sh
# $Id: calendar.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the celendar widget.
#
#
# Create some global variables.
#
CDK_CALENDAR="${CDK_BINDIR=..}/cdkcalendar"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
date="${TMPDIR=/tmp}/cal.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
xpos=CENTER
ypos=CENTER
#
# Get today's date.
#
day=`date +%d`
month=`date +%m`
year=`date +%Y`
#
# Chop up the command line.
#
set -- `getopt d:m:y:X:Y: $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for c in $*
do
case $c in
-d) day=$2; shift 2;;
-m) month=$2; shift 2;;
-y) year=$2; shift 2;;
-X) xpos=$2; shift 2;;
-Y) ypos=$2; shift 2;;
--) shift; break;;
esac
done
#
# Create the title and buttons.
#
title="<C><#HL(22)>
<C>Select a date
<C><#HL(22)>"
buttons=" OK
Cancel "
#
# Create the calendar widget.
#
${CDK_CALENDAR} -B "${buttons}" -d ${day} -m ${month} -y ${year} -T "${title}" -X ${xpos} -Y ${ypos} -O ${date} -S
selected=$?
test $selected = 255 && exit 1
answer=`cat ${date}`
#
# Create the message for the label widget.
#
echo "<C>You chose the following date" > ${tmp}
echo " " >> ${tmp}
echo "<C><#HL(10)>" >> ${tmp}
echo "<C>${answer}" >> ${tmp}
echo "<C><#HL(10)>" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${date}

88
deps/cdk-5.0-20161210/cli/samples/dialog.sh vendored Executable file
View File

@@ -0,0 +1,88 @@
#!/bin/sh
# $Id: dialog.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the dialog widget.
#
#
# Create some global variables.
#
CDK_DIALOG="${CDK_BINDIR=..}/cdkdialog"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
output="${TMPDIR=/tmp}/dialog_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Create the message for the scrolling list.
#
message="<C>Pick which command
<C>you wish to run."
#
# Create the button labels.
#
commands="</B>who
</B>w
</B>uptime
</B>date
</B>pwd
</B>whoami
</B>df
</B>fortune"
#
# Create the dialog box.
#
${CDK_DIALOG} -m "${message}" -B "${commands}" 2> ${output}
selection=$?
if [ "$selection" -eq 255 ]; then
exit;
fi
#
# Create the message for the label widget.
#
echo "<C>Here is the result of the command" > ${tmp}
echo " " >> ${tmp}
#
# Determine which command to run.
#
if [ "${selection}" -eq 0 ]; then
who | awk '{printf "</B>%s\n", $0}' >> ${tmp}
elif [ "${selection}" -eq 1 ]; then
w | awk '{printf "</B>%s\n", $0}' >> ${tmp}
elif [ "${selection}" -eq 2 ]; then
uptime | awk '{printf "<C></B>%s\n", $0}' >> ${tmp}
elif [ "${selection}" -eq 3 ]; then
date | awk '{printf "<C></B>%s\n", $0}' >> ${tmp}
elif [ "${selection}" -eq 4 ]; then
pwd | awk '{printf "<C></B>%s\n", $0}' >> ${tmp}
elif [ "${selection}" -eq 5 ]; then
whoami | awk '{printf "<C></B>%s\n", $0}' >> ${tmp}
elif [ "${selection}" -eq 6 ]; then
#
# We will use the label demo to do this.
#
./label.sh
rm -f ${tmp} ${output} ${fileSystemList}
exit 0;
elif [ "${selection}" -eq 7 ]; then
fortune | awk '{printf "</B>%s\n", $0}' >> ${tmp}
fi
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output} ${fileSystemList}

54
deps/cdk-5.0-20161210/cli/samples/entry.sh vendored Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
# $Id: entry.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the entry widget.
#
#
# Create some global variables.
#
CDK_ENTRY="${CDK_BINDIR=..}/cdkentry"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
output="${TMPDIR=/tmp}/entry_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Create the title.
#
title="<C> Type a simple string. "
buttons=" OK
Cancel "
#
# Create the entry box.
#
${CDK_ENTRY} -f 20 -T "${title}" -B "${buttons}" -F "</5>_ " -O ${output} -S
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Create the message for the label widget.
#
echo "<C>Here is the string you typed in" > ${tmp}
echo " " >> ${tmp}
echo "<C></R>${answer}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output}

82
deps/cdk-5.0-20161210/cli/samples/fselect.sh vendored Executable file
View File

@@ -0,0 +1,82 @@
#!/bin/sh
# $Id: fselect.sh,v 1.4 2005/12/27 17:56:05 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the file selection widget.
#
#
# Create some global variables.
#
CDK_FSELECT="${CDK_BINDIR=..}/cdkfselect"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
directory="."
label="File: "
title="<C>Select a file"
buttons=" OK
Cancel "
xpos="CENTER"
ypos="CENTER"
width=0
height=-5
tmp="${TMPDIR=/tmp}/tmp.$$"
file="${TMPDIR=/tmp}/fs.$$"
#
# Chop up the command line.
#
set -- `getopt d:L:T:X:Y:W:H: $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for c in $*
do
case $c in
-d) directory=$2; shift 2;;
-T) title=$2; shift 2;;
-L) label=$2; shift 2;;
-X) xpos=$2; shift 2;;
-Y) ypos=$2; shift 2;;
-W) width=$2; shift 2;;
-H) height=$2; shift 2;;
--) shift; break;;
esac
done
#
# Create the CDK file selector.
#
${CDK_FSELECT} -d "${directory}" -T "${title}" -L "${label}" -X ${xpos} -Y ${ypos} -W ${width} -H ${height} -B "${buttons}" 2> ${file}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${file}`
#
# Diplay the file the user selected.
#
echo "<C>You selected the following file" > ${tmp}
echo " " >> ${tmp}
echo "<C><#HL(10)>" >> ${tmp}
echo "<C></B>${answer}" >> ${tmp}
echo "<C><#HL(10)>" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Press </R>space<!R> to continue." >> ${tmp}
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${file}

135
deps/cdk-5.0-20161210/cli/samples/itemlist.sh vendored Executable file
View File

@@ -0,0 +1,135 @@
#!/bin/sh
# $Id: itemlist.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the itemlist list widget.
#
#
# This gets the password file.
#
getPasswordFile()
{
system=$1
file=$2
#
# Depeding on the system, get the password file
# using nicat, ypcat, or just plain old /etc/passwd
#
if [ "$system" = "NIS" ]; then
niscat passwd.org_dir | sort > $file
elif [ "$system" = "YP" ]; then
ypcat passwd | sort > $file
else
sort /etc/passwd > $file
fi
}
#
# This displays account information.
#
displayAccountInformation()
{
userAccount=$1
passwordFile=$2
#
# Get the user account information.
#
line=`grep "^${userAccount}" $passwordFile`
uid=`echo $line | cut -d: -f3`
gid=`echo $line | cut -d: -f4`
info=`echo $line | cut -d: -f5`
home=`echo $line | cut -d: -f6`
shell=`echo $line | cut -d: -f7`
#
# Create the label message information.
#
accountMessage="<C></U>Account
<C><#HL(30)>
Account: </U>${userAccount}
UID : </U>${uid}
GID : </U>${gid}
Info : </U>${info}
Home : </U>${home}
Shell : </U>${shell}
<C><#HL(30)>
<C>Hit </R>space<!R> to continue"
#
# Create the popup label.
#
${CDK_LABEL} -m "${accountMessage}" -p " "
}
#
# Create some global variables.
#
CDK_ITEMLIST="${CDK_BINDIR=..}/cdkitemlist"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
tmpPass="${TMPDIR=/tmp}/sl.$$"
output="${TMPDIR=/tmp}/output.$$"
userAccounts="${TMPDIR=/tmp}/ua.$$"
TYPE="Other";
#
# Chop up the command line.
#
set -- `getopt nNh $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for c in $*
do
case $c in
-n) TYPE="YP"; shift;;
-N) TYPE="NIS"; shift;;
-h) echo "$0 [-n YP] [-N NIS+] [-h]"; exit 0;;
--) shift; break;;
esac
done
#
# Create the message for the item list.
#
title="<C>Pick an account you want to view."
label="Account Name "
buttons=" OK
Cancel "
#
# Get the password file and stick it into the temp file.
#
getPasswordFile "${TYPE}" "$tmpPass"
#
# Get the user account from the password file.
#
awk 'BEGIN {FS=":"} {printf "</R>%s\n", $1}' $tmpPass | sort > ${userAccounts}
#
# Create the item list.
#
${CDK_ITEMLIST} -d 3 -L "${label}" -T "${title}" -B "${buttons}" -f "${userAccounts}" 2> ${output}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Display the account information.
#
displayAccountInformation $answer $tmpPass
#
# Clean up.
#
rm -f ${output} ${tmpPass} ${userAccounts}

81
deps/cdk-5.0-20161210/cli/samples/label.sh vendored Executable file
View File

@@ -0,0 +1,81 @@
#!/bin/sh
# $Id: label.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the label widget.
#
#
# Create some global variables.
#
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
dfTmp="${TMPDIR=/tmp}/label.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
top="${TMPDIR=/tmp}/dfTop.$$"
bottom="${TMPDIR=/tmp}/dfBottom.$$"
#
# Get the filesystem information.
#
getDiskInfo()
{
fileName=$1;
command="df"
#
# Determine the type of operating system.
#
machine=`uname -s`
if [ "$machine" = "SunOS" ]; then
level=`uname -r`
if [ "$level" -gt 4 ]; then
command="df -kl"
fi
else
if [ "$machine" = "AIX" ]; then
command="df -i"
fi
fi
#
# Run the command.
#
${command} > ${fileName}
}
#
# Get the disk information.
#
getDiskInfo ${dfTmp}
#
# Bold the first line of the df command.
#
head -1 ${dfTmp} | awk '{printf "</B>%s\n", $0}' > ${top}
tail +2 ${dfTmp} > ${bottom}
#
# Create the message for the label widget.
#
echo "<C>This is the current" > ${tmp}
echo "<C>status of your local filesystems." >> ${tmp}
echo "<C><#HL(2)>" >> ${tmp}
cat ${top} >> ${tmp}
cat ${bottom} >> ${tmp}
echo "<C><#HL(2)>" >> ${tmp}
echo "" >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f "${tmp}" -p " " -c "ls" -S
#
# Clean up.
#
rm -f ${tmp} ${output} ${dfTmp} ${top} ${bottom}

123
deps/cdk-5.0-20161210/cli/samples/matrix.sh vendored Executable file
View File

@@ -0,0 +1,123 @@
#!/bin/sh
# $Id: matrix.sh,v 1.4 2005/12/27 17:07:00 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the matrix widget.
#
#
# Create some global variables.
#
CDK_MATRIX="${CDK_BINDIR=..}/cdkmatrix"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
fileSystemList="${TMPDIR=/tmp}/fsList.$$"
info="${TMPDIR=/tmp}/fsInfo.$$"
diskInfo="${TMPDIR=/tmp}/diskInfo.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Get the filesystem information.
#
getDiskInfo()
{
fileName=$1;
command="df"
#
# Determine the type of operating system.
#
machine=`uname -s`
if [ "$machine" = "SunOS" ]; then
level=`uname -r`
if [ "$level" -gt 4 ]; then
command="df -kl"
fi
else
if [ "$machine" = "AIX" ]; then
command="df -i"
fi
fi
#
# Run the command.
#
${command} > ${fileName}
}
#
# Get the disk information.
#
getDiskInfo ${diskInfo}
#
# Create the row titles.
#
rowTitles=`tail +2 ${diskInfo} | awk '{printf "%s\n", $1}'`
#
# Create the column titles.
#
colTitles="KBytes
Used
Avail
Capacity
Mounted on"
#
# Define the matrix title.
#
title="<C></U>Current Filesystem Information"
#
# Create the data file to fill in the matrix.
#
tail +2 ${diskInfo} | awk '{printf "%s%s%s%s%s\n", $2, $3, $4, $5, $6}' > ${info}
#
# Set the widths of the columns.
#
colWidths="5
5
5
5
5"
#
# Set the cells as uneditable.
#
types="VIEWONLY
VIEWONLY
VIEWONLY
VIEWONLY
VIEWONLY"
buttons=" OK
Cancel "
#
# Start the matrix.
#
${CDK_MATRIX} -r "${rowTitles}" -c "${colTitles}" -v 3 -w "${colWidths}" -d "${info}" -t "${types}" -T "${title}" -B "${buttons}" -O"$tmp"
selected=$?
test $selected = 255 && exit 1
#
# Create the message for the label widget.
#
echo "<C>You chose button #${selected}" > ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f "${tmp}" -p " "
#
# Clean up.
#
rm -f ${info} ${fileSystemList} ${tmp} ${diskInfo}

54
deps/cdk-5.0-20161210/cli/samples/mentry.sh vendored Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/sh
# $Id: mentry.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the multiple line entry widget.
#
#
# Create some global variables.
#
CDK_MENTRY="${CDK_BINDIR=..}/cdkmentry"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
output="${TMPDIR=/tmp}/mentry_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Create the title.
#
title="<C>Type in a short message."
buttons=" OK
Cancel "
#
# Create the mentry box.
#
${CDK_MENTRY} -s 5 -v 10 -f 20 -T "${title}" -B "${buttons}" -F '_' -O ${output}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Create the message for the label widget.
#
echo "<C>Here is the message you typed in" > ${tmp}
echo " " >> ${tmp}
echo "<C></R>${answer}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output}

95
deps/cdk-5.0-20161210/cli/samples/radio.sh vendored Executable file
View File

@@ -0,0 +1,95 @@
#!/bin/sh
# $Id: radio.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the radio widget.
#
#
# Create some global variables.
#
CDK_RADIO="${CDK_BINDIR=..}/cdkradio"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
fileSystemList="${TMPDIR=/tmp}/fsList.$$"
diskInfo="${TMPDIR=/tmp}/diskInfo.$$"
output="${TMPDIR=/tmp}/radio_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Get the filesystem information.
#
getDiskInfo()
{
fileName=$1;
command="df"
#
# Determine the type of operating system.
#
machine=`uname -s`
if [ "$machine" = "SunOS" ]; then
level=`uname -r`
if [ "$level" -gt 4 ]; then
command="df -kl"
fi
else
if [ "$machine" = "AIX" ]; then
command="df -i"
fi
fi
#
# Run the command.
#
${command} > ${fileName}
}
#
# Create the title for the scrolling list.
#
title="<C>Pick a filesystem to view."
buttons=" OK
Cancel "
#
# Get a list of the local filesystems.
#
getDiskInfo ${diskInfo}
#
# Create the file system list.
#
grep "^/" ${diskInfo} | awk '{printf "%s\n", $1}' > ${fileSystemList}
#
# Create the radio list.
#
${CDK_RADIO} -T "${title}" -f "${fileSystemList}" -c "</U>*" -B "${buttons}" 2> $output
selected=$?
test $selected = 255 && exit 1
#
# The selection is now in the file $output.
#
fs=`cat ${output}`
echo "<C></R>File Statistics on the filesystem ${fs}" > ${tmp}
echo " " >> ${tmp}
grep "${fs}" ${diskInfo} | awk '{printf "</B>%s\n", $0}' >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output} ${fileSystemList} ${diskInfo}

55
deps/cdk-5.0-20161210/cli/samples/scale.sh vendored Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
# $Id: scale.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the scale widget.
#
#
# Create some global variables.
#
CDK_SCALE="${CDK_BINDIR=..}/cdkscale"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
output="${TMPDIR=/tmp}/scale_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Create the title.
#
title="<C>Enter a value using the cursor keys."
label="</R>Value"
buttons=" OK
Cancel "
#
# Create the scale box.
#
${CDK_SCALE} -f 20 -l 0 -h 100 -i 5 -L "${label}" -T "${title}" -B "${buttons}" -O ${output}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Create the message for the label widget.
#
echo "<C>Here is the value you selected" > ${tmp}
echo " " >> ${tmp}
echo "<C></R>${answer}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output}

136
deps/cdk-5.0-20161210/cli/samples/scroll.sh vendored Executable file
View File

@@ -0,0 +1,136 @@
#!/bin/sh
# $Id: scroll.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the scrolling list widget.
#
#
# This gets the password file.
#
getPasswordFile()
{
system=$1
file=$2
#
# Depeding on the system, get the password file
# using nicat, ypcat, or just plain old /etc/passwd
#
if [ "$system" = "NIS" ]; then
niscat passwd.org_dir > $file
elif [ "$system" = "YP" ]; then
ypcat passwd > $file
else
cp /etc/passwd $file
fi
}
#
# This displays account information.
#
displayAccountInformation()
{
userAccount=$1
passwordFile=$2
#
# Get the user account information.
#
line=`grep "^${userAccount}" $passwordFile`
uid=`echo $line | cut -d: -f3`
gid=`echo $line | cut -d: -f4`
info=`echo $line | cut -d: -f5`
home=`echo $line | cut -d: -f6`
shell=`echo $line | cut -d: -f7`
#
# Create the label message information.
#
accountMessage="<C></U>Account
<C><#HL(30)>
Account: </U>${userAccount}
UID : </U>${uid}
GID : </U>${gid}
Info : </U>${info}
Home : </U>${home}
Shell : </U>${shell}
<C><#HL(30)>
<C>Hit </R>space<!R> to continue"
#
# Create the popup label.
#
${CDK_LABEL} -m "${accountMessage}" -p " "
}
#
# Create some global variables.
#
CDK_SCROLL="${CDK_BINDIR=..}/cdkscroll"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
tmpPass="${TMPDIR=/tmp}/sl.$$"
output="${TMPDIR=/tmp}/output.$$"
userAccounts="${TMPDIR=/tmp}/ua.$$"
TYPE="Other"
#
# Chop up the command line.
#
set -- `getopt nNh $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for c in $*
do
case $c in
-n) TYPE="YP"; shift;;
-N) TYPE="NIS"; shift;;
-h) echo "$0 [-n YP] [-N NIS+] [-h]"; exit 0;;
--) shift; break;;
esac
done
#
# Create the message for the scrolling list.
#
title="<C><#HL(30)>
<C>Pick an account you want to view.
<C><#HL(30)>"
buttons=" OK
Cancel "
#
# Get the password file and stick it into the temp file.
#
getPasswordFile "${TYPE}" "$tmpPass"
#
# Get the user account from the password file.
#
awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts}
#
# Create the scrolling list.
#
${CDK_SCROLL} -T "${title}" -f ${userAccounts} -n -B "${buttons}" 2> ${output}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Display the account information.
#
displayAccountInformation $answer $tmpPass
#
# Clean up.
#
rm -f ${output} ${tmpPass} ${userAccounts}

191
deps/cdk-5.0-20161210/cli/samples/selection.sh vendored Executable file
View File

@@ -0,0 +1,191 @@
#!/bin/sh
# $Id: selection.sh,v 1.4 2005/12/27 17:56:58 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the selection widget.
#
#
# This gets the password file.
#
getPasswordFile()
{
system=$1
file=$2
#
# Depending on the system, get the password file
# using nicat, ypcat, or just plain old /etc/passwd
#
if [ "$system" = "NIS" ]; then
niscat passwd.org_dir > $file
elif [ "$system" = "YP" ]; then
ypcat passwd > $file
else
cp /etc/passwd $file
fi
}
#
# This displays account information.
#
displayAccountInformation()
{
totalSelections=$1
currentSelection=$2
userAccount=$3
passwordFile=$4
#
# Get the user account information.
#
line=`grep "^${userAccount}" $passwordFile`
uid=`echo $line | cut -d: -f3`
gid=`echo $line | cut -d: -f4`
info=`echo $line | cut -d: -f5`
home=`echo $line | cut -d: -f6`
shell=`echo $line | cut -d: -f7`
#
# Create the label message information.
#
accountMessage="<C></U>Account ${currentSelection}/${totalSelections}
<C><#HL(30)>
Account: </U>${userAccount}
UID : </U>${uid}
GID : </U>${gid}
Info : </U>${info}
Home : </U>${home}
Shell : </U>${shell}
<C><#HL(30)>
<C>Hit </R>space<!R> to continue"
#
# Create the popup label.
#
${CDK_LABEL} -m "${accountMessage}" -p " "
}
#
# Define where the CDK widgets are.
#
CDK_SELECTION="${CDK_BINDIR=..}/cdkselection"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
TYPE="Other"
#
# Define the output files.
#
accountList="${TMPDIR=/tmp}/accList.$$"
userAccounts="${TMPDIR=/tmp}/userAccList.$$"
output="${TMPDIR=/tmp}/selection_output.$$"
tmpPass="${TMPDIR=/tmp}/ps.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Chop up the command line.
#
set -- `getopt nNh $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for c in $*
do
case $c in
-n) TYPE="YP"; shift;;
-N) TYPE="NIS"; shift;;
-h) echo "$0 [-n YP] [-N NIS+] [-h]"; exit 0;;
--) shift; break;;
esac
done
#
# Create the message for the selection list.
#
title="<C>Pick a user account to view."
#
# Get the password file and stick it into the temp file.
#
getPasswordFile "${TYPE}" "$tmpPass"
#
# Create the user account list.
#
awk 'BEGIN {FS=":"} {printf "%s\n", $1}' $tmpPass | sort > ${userAccounts}
awk '{printf "<C></B>%s\n", $1}' ${userAccounts} > ${accountList}
accounts=`cat ${userAccounts}`
#
# Create the choices list.
#
choices="<C></B>No
<C></B> Yes "
buttons=" OK
Cancel "
#
# Create the selection list.
#
${CDK_SELECTION} -T "${title}" -f "${accountList}" -c "${choices}" -B "${buttons}" 2> $output
selected=$?
test $selected = 255 && exit 1
#
# Initialize the variables.
#
selection=""
value=""
#
# Count how many were selected.
#
count=`grep -c "^1" ${output}`
current=0
#
# Create the label.
#
for i in `cat ${output}`
do
#
# Since every other variable is value/selection, we
# store every other value in the correct variable.
#
if [ "$value" = "" ]; then
value="$i"
else
selection="$i"
#
# Only display the selected accounts.
#
if [ "$value" -eq 1 ]; then
#
# Increment our counter.
#
current=`expr $current + 1`
#
# Display the account information.
#
displayAccountInformation $count $current $selection $tmpPass
fi
#
# Reset the variables.
#
value=""
selection=""
fi
done
#
# Clean up.
#
rm -f ${accountList} ${userAccounts} ${output} ${tmpPass} ${tmp}

55
deps/cdk-5.0-20161210/cli/samples/slider.sh vendored Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
# $Id: slider.sh,v 1.4 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the slider widget.
#
#
# Create some global variables.
#
CDK_SLIDER="${CDK_BINDIR=..}/cdkslider"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
output="${TMPDIR=/tmp}/slider_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Create the title.
#
title="<C>Enter a value using the cursor keys"
label="Value: "
buttons=" OK
Cancel "
#
# Create the slider box.
#
${CDK_SLIDER} -f 20 -l 0 -h 100 -i 5 -L "${label}" -T "${title}" -F "</R>*" -B "${buttons}" -O ${output}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Create the message for the label widget.
#
echo "<C>Here is the value you selected" > ${tmp}
echo " " >> ${tmp}
echo "<C></R>${answer}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output}

55
deps/cdk-5.0-20161210/cli/samples/template.sh vendored Executable file
View File

@@ -0,0 +1,55 @@
#!/bin/sh
# $Id: template.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the template widget.
#
#
# Create some global variables.
#
CDK_TEMPLATE="${CDK_BINDIR=..}/cdktemplate"
CDK_LABEL="${CDK_BINDIR=..}/cdklabel"
output="${TMPDIR=/tmp}/template_output.$$"
tmp="${TMPDIR=/tmp}/tmp.$$"
#
# Create the title.
#
title="<C> Type in the
<C>IP Address for this machine."
buttons=" OK
Cancel "
#
# Create the template box.
#
${CDK_TEMPLATE} -p "###.###.###.###" -o "___.___.___.___" -T "${title}" -P -B "${buttons}" 2> ${output}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${output}`
#
# Create the message for the label widget.
#
echo "<C>Here is the IP you typed in" > ${tmp}
echo " " >> ${tmp}
echo "<C></R>${answer}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>You chose button #${selected}" >> ${tmp}
echo " " >> ${tmp}
echo "<C>Hit </R>space<!R> to continue." >> ${tmp}
#
# Create the label widget to display the information.
#
${CDK_LABEL} -f ${tmp} -p " "
#
# Clean up.
#
rm -f ${tmp} ${output}

76
deps/cdk-5.0-20161210/cli/samples/viewer.sh vendored Executable file
View File

@@ -0,0 +1,76 @@
#!/bin/sh
# $Id: viewer.sh,v 1.3 2005/12/27 15:53:06 tom Exp $
#
# Description:
# This demonstrates the CDK command line
# interface to the viewer widget.
#
#
# Create some global variables.
#
CDK_FSELECT="${CDK_BINDIR=..}/cdkfselect"
CDK_VIEWER="${CDK_BINDIR=..}/cdkviewer"
tmp="${TMPDIR=/tmp}/tmp.$$"
file="${TMPDIR=/tmp}/fs.$$"
directory="."
xpos=CENTER
ypos=CENTER
width="-2"
height="0"
interpret=0
#
# Chop up the command line.
#
set -- `getopt d:x:y:w:h:i $*`
if [ $? != 0 ]
then
echo $USAGE
exit 2
fi
for c in $*
do
case $c in
-d) directory=$2; shift 2;;
-x) xpos=$2; shift 2;;
-y) ypos=$2; shift 2;;
-w) width=$2; shift 2;;
-h) height=$2; shift 2;;
-i) interpret=1; shift 1;;
--) shift; break;;
esac
done
#
# Create the CDK file selector.
#
${CDK_FSELECT} -T "<C>Select a file" -d "${directory}" 2> ${file}
selected=$?
test $selected = 255 && exit 1
answer=`cat ${file}`
#
# Create the title and buttons for the viewer.
#
title="<C>CDK File Viewer Widget
<C></U>${answer}"
buttons="OK"
#
# Create the file viewer.
#
if [ "$interpret" -eq 1 ]; then
${CDK_VIEWER} -f "${answer}" -T "${title}" -B "${buttons}" -i -X ${xpos} -Y ${ypos} -H "${height}" -W "${width}"
else
${CDK_VIEWER} -f "${answer}" -T "${title}" -B "${buttons}" -X ${xpos} -Y ${ypos} -H "${height}" -W "${width}" -B "${buttons}"
fi
#
# Clean up.
#
rm -f ${tmp} ${file}