DataMuseum.dk

Presents historical artifacts from the history of:

RC9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: @ F T

⟦669b268c0⟧ TextFile

    Length: 2897 (0xb51)
    Types: TextFile
    Notes: @(#)Form.add 13.2 (RC International) 91/08/23
    Names: »Form.add«

Derivation

└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
    └─⟦bbf173f5c⟧ »0004« 
        └─⟦this⟧ »./usr/sadm/sysadm/add-ons/lp/printers/classes/Form.add« 

TextFile

#	@(#)Form.add	13.2 (RC International) 91/08/23

form='Add a New Class'

help=OPEN TEXT $INTFBASE/Text.itemhelp $LININFO

init=`indicator -w;
      set -l name_2="/tmp/lp.n2$VPID";
      set -l error="/tmp/lp.error$VPID"`

done=`message -w "Adding class(es) $F1";

	if /usr/bin/lpstat -r | grep not > /dev/null;
	then
		message "The printer scheduler is not running.";
	else
		message "Stopping the printer scheduler, please wait ...";
		/usr/lib/lpshut;
		message "Line printer scheduler stopped.";
	fi;

	message -w "Creating the new class $F1";  
	if [ $F2 = "all" ];
	then
		lpdata -p | tr "\012" " " | set -l list;
	else
		echo "$F2" | tr -s "," " " | set -l list;
	fi;

	shell "
	for p in $list
	do
		/usr/lib/lpadmin -p\$p -c$F1 2>>$error >/dev/null;
	done
	";

	if [ -s $error ];
	then 
		echo "OPEN TEXT /usr/sadm/sysadm/add-ons/lp/printers/classes/Text.error $error ";
	else
		message -w "Class $F1 added. Starting the scheduler, please wait ...";
		rm -f /usr/spool/lp/SCHEDLOCK;
		/usr/lib/lpsched;
		message -w "Start $F1 to accept requests, please wait ...";
		shell "/usr/lib/accept $F1 2>&1 >/dev/null";
		message "Class $F1 added and ready to accept requsts.";
	fi;
`close

close=`rm -f $name_2 $error;
	unset -l badval -l name_2 -l name_valid -l bad_one -l error;`

#F1
name='New class:'
lininfo="add:F1"
nrow=1
ncol=1
frow=1
fcol=12
rows=1
columns=14
fieldmsg='Enter the name for the new class.'
valid=`
	regex -v "$F1"
	    '^[Aa][Ll][Ll]$'		'"all" is a reserved word'
	    '^[Aa][Nn][Yy]$'		'"any" is a reserved word'
	    '^[Nn][Oo][Nn][Ee]$'	'"none" is a reserved word'
	    '^([_A-Za-z0-9]){1,14}$'	'ok'
	    '.*'  'It must consist of 1-14 letters, digits, and "_"'
	| set -l badval;
	if [ "$badval" != "ok" ];
	then
	     set -l name_valid=false;
	elif lpdata -c | grep $F1 > /dev/null;
	then
	    set -l badval="\"$F1\" already exists";
	    set -l name_valid=false;
	elif lpdata -p | grep $F1 > /dev/null;
	then
	    set -l badval="\"$F1\" is the name of a printer";
	    set -l name_valid=false;
	else
	    set -l name_valid=true;
	fi;
`$name_valid
invalidmsg="Class name invalid:  $badval."

#F2
name='Printers:'
lininfo="add:F2"
nrow=2
ncol=1
frow=2
fcol=12
rows=1
columns=42
scroll=true
fieldmsg='Enter the printers in the class then press [SAVE]'
choicemsg='MARK printers then press [ENTER]'
rmenu=OPEN MENU $OBJ_DIR/Menu.pr.ch 

valid=`indicator -w;
	unset -l bad_one;
	lpdata -p > $name_2;
	if [ -z "$F2" ];
	then
		set -l no_value=true -l name_valid=false;
	else
		echo "all" >> $name_2;
		set -l no_value=false -l name_valid=true;
	fi;
	echo "$F2" | tr " ," "[\012*]" | regex -e '^(.*)$0$'
	'`fmlgrep "^$m0$" $name_2 || set -l bad_one="$m0" -l name_valid=false`' > /dev/null`$name_valid
invalidmsg=`if [ "$no_value" = "true" ];
	then
		echo "You must enter a value for this field.";
	else
		echo "$bad_one invalid printer - press [CHOICES] for selection";
	fi`