[comp.sources.misc] v16i041: ECU async comm package rev 3.0, Part17/35

wht@n4hgf.uucp (Warren Tucker) (01/06/91)

Submitted-by: wht@n4hgf.uucp (Warren Tucker)
Posting-number: Volume 16, Issue 41
Archive-name: ecu3/part17

---- Cut Here and feed the following to sh ----
#!/bin/sh
# This is part 17 of ecu3
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= help/Makefile ==============
if test ! -d 'help'; then
    echo 'x - creating directory help'
    mkdir 'help'
fi
echo 'x - extracting help/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/Makefile' &&
X#  CHK=0xFF6D
X# Makefile for helpgen (ecu help system)
X#
X#+:EDITS:*/
X#:05-07-1990-21:21-wht@n4hgf-omit fcrc usage in release makes
X#:01-03-1990-15:30-wht-quit using -Ox --- Oi screws up too much
X#:11-23-1989-02:37-wht-start support for UNIX V/386
X#:10-11-1989-18:46-wht-needed more work to get makes to work away from my system
X#:07-03-1989-22:58-wht------ x2.00 -----
X#:05-08-1989-15:35-wht-creation
X
XSHELL = /bin/sh
X.SUFFIXES: .o .c .h  
X
XCOMFLAGS = -s
XCFLAGS  = -c `sysdep =M_UNIX -O -DLINT_ARGS =M_XENIX -Ox -DLINT_ARGS =pyr -O` $(COMFLAGS)
XLDFLAGS = # -m helpgen.map
X
X.c.o:;	cc $(CFLAGS) $*.c 
X
XSRC	= \
X	helpgen.c\
X	util.c
X
XOBJ	= \
X	helpgen.o\
X	util.o
X
Xall: helpgen ecuhelp.data # ecuhelp.doc ecuhelp.txt
X
Xhelpgen.fls: $(SRC)
X	ls $(SRC) >helpgen.fls
X
Xhelpgen: $(OBJ)
X	cc $(COMFLAGS) $(OBJ) $(LDFLAGS) -o helpgen 
X
Xecuhelp.data: ecuhelp.src helpgen
X	./helpgen -b
X
Xecuhelp.doc: ecuhelp.src helpgen
X	./helpgen -d
X
Xecuhelp.txt: ecuhelp.data helpgen
X	./helpgen -n
X
Xlint: lint_args.h
X
Xlint_args.h: helpgen.fls
X	echo > lint_args.h
X	csh ../zgcc helpgen.fls lint_args.h $(CFLAGS)
X
X#
X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
X#
Xdepend: Makefile
X
XMakefile: $(SRC)
X		rm -f depend.tmp
X		if test '$(SRC)' ;\
X		then (grep '^#include' $(SRC) \
X		| sed	-e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
X			-e 's?:[^"]*"\([^"]*\)".*?: \1?'\
X			-e 's?\(.*\)\.c?\1.o?'\
X		 >> depend.tmp) ;\
X		fi
X
X		echo '/^# DO NOT DELETE THIS LINE' >exdep.tmp
X		echo '.+1,$$d' >>exdep.tmp
X		echo 'r depend.tmp' >> exdep.tmp
X		echo 'w' >> exdep.tmp
X		cp Makefile Makefile.new
X		ex Makefile.new < exdep.tmp
X		rm exdep.tmp depend.tmp
X		echo '#	DEPENDENCIES MUST END AT END OF	FILE' >>Makefile.new
X		echo '#	IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
X		echo '#	see make depend	above'>>Makefile.new
X		mv Makefile Makefile.bak
X		mv Makefile.new Makefile
X
X# DO NOT DELETE THIS LINE
Xhelpgen.o: /usr/include/stdio.h
Xhelpgen.o: /usr/include/ctype.h
Xhelpgen.o: ../ecucmd.h
Xhelpgen.o: ../esd.h
Xhelpgen.o: ../stdio_lint.h
X#	DEPENDENCIES MUST END AT END OF	FILE
X#	IF YOU PUT STUFF HERE IT WILL GO AWAY
X#	see make depend	above
SHAR_EOF
$TOUCH -am 0813184890 'help/Makefile' &&
chmod 0644 help/Makefile ||
echo 'restore of help/Makefile failed'
Wc_c="`wc -c < 'help/Makefile'`"
test 2124 -eq "$Wc_c" ||
	echo 'help/Makefile: original size 2124, current size' "$Wc_c"
# ============= help/ecuhelp.src ==============
echo 'x - extracting help/ecuhelp.src (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/ecuhelp.src' &&
X# ecu help source file
X#+:EDITS:
X#:11-03-1989-16:21-wht------ unet2 -----
X#:06-17-1988-11:10-wht-add 'exit' command
X#:06-13-1988-15:38-wht-creation
X#--------------------------------------------------------------------
X%ax
XUsage: ax [<param>]
X
X<param> may be a single ASCII character, a standard ASCII identifier
X(such as ETX), or a two-character control character identifier (such as
X^C, typed as a caret followed by a C).
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%xa
XUsage: xa [<hex-val>]
X
X<hex-val> is a hexadecimal value between 0 and FF; the parity (sign) bit
Xis stripped and the equivalent ASCII character value is displayed.
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%oa
XUsage: oa [<octal-val>]
X
X<octal-val> is a octal value between 0 and 0377; the parity (sign) bit
Xis stripped and the equivalent ASCII character value is displayed.
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%da
XUsage: da [<decimal-val>]
X
X<decimal-val> is a decimal value between 0 and 0377; the parity (sign)
Xbit is stripped and the equivalent ASCII character value is displayed.
X
XIf no parameter is supplied, a table of control characters is printed
Xcontaining decimal, octal, hex, ASCII identifiers and two-character
Xcontrol character identifier.
X#--------------------------------------------------------------------
X%baud
XUsage: baud [<baud-rate>]
X
X<baud-rate>, if specified, must be taken from the values 110, 300, 600,
X1200, 2400, 4800, 9600, 19200 and 38400.  On some systems, 19200 and
X38400 may not be supported.  If baud rate 110 is selected, 2 stop bits
Xare automatically specified; other baud rates set 1 stop bit.  If
X<baud-rate> is not supplied, the current baud rate is displayed.
X
XThe setting may be automatically changed as the result of a 'dial'
Xcommand.  See also the 'dial' and 'parity' command descriptions.
X#--------------------------------------------------------------------
X%bn
XUsage: bn [ 0 | 1 | 2 ]
X
X"bell notify": This command is only available under XENIX.  If no
Xparameter is supplied, the current setting is displayed.  Specifying 0
Xdisables the facility; 1 causes an audible alarm to be sounded on all of
Xthe XENIX virtual consoles upon receipt of a bell (0x07) character from
Xthe remote system; 2 causes an audible alarm to be sent to all consoles
Xupon receipt of ANY characters from the remote system.  A non-zero value
Xalso causes an audible alarm to be sent to all console upon the
Xsuccessful completion of a 'redial' command which must retry more than
Xone redial attempt or upon completion of a file transfer operation.
X
XDifferent alarms are sent depending upon the the type of event causing
Xthe alarms.
X#--------------------------------------------------------------------
X%break
XUsage: break
X
XThis command sends a break signal to the remote system.
X#--------------------------------------------------------------------
X%cd
XUsage: cd [<dir-path>]
X
XThis command allows you to change the working directory of the ecu
Xprocess.  If <dir-path> is supplied, the previous working directory is
Xdisplayed, and <dir-path> is made the new working directory.  A history
Xof previous directory changes is maintained.  Entering the 'cd' command
Xshows the numbered history list and allows you to select a new directory
Xby entering the number.  Other commands allow deletion of directories
Xfrom the list or saving the list to file ~/.ecu/phone.  This file is
Xautomatically read at ecu startup, providing a convenient list of
Xdirectories available for quick selection.
X#--------------------------------------------------------------------
X%dial
XUsage: dial [<dial-param>]
X
X<dial-param> may take one of two forms, a telephone number to dial or a
Xlogical name which can be found in the user phone directory (in file
X~/.ecu/phone).
X
XIf a telephone number is supplied, the phone number is dialed; you must
Xfirst have set the desired baud rate and parity using the 'baud' and
X'parity' commands.  If a logical name is entered, the phone directory is
Xsearched; if the entry is found, the baud rate and parity is
Xautomatically set and the number dialed.
X
XIf <dial-param> is not supplied, then a screen-oriented self-documenting
Xdirectory manager is executed; you may scan the the directory to select
Xa number to dial, as well as add, remove and edit entries.  See also
X'baud' and 'parity'.
X#--------------------------------------------------------------------
X%do
XUsage: do <procname> [<arg> ... ]
X
XPerform ecu procedure.  Ecu searches for <procname>.ep in the current
Xdirectory.  If the file is not found, the program looks for the file in
Xthe ~/.ecu directory.  One or more arguments may be passed to the
Xprocedure.
X#--------------------------------------------------------------------
X%duplex
XUsage: duplex [ Full | Half ]
X
XThis command specifies whether or not ecu is to locally echo characters
Xtyped by you at the keyboard.  The overwhelming majority of remote
Xsystems provide the echo function, in which case full duplex must be
Xused.  For the rare occasions when the remote system does not echo your
Xkeyboard input, setting half duplex will allow you to see what you are
Xtyping.
X
XWhen communicating with another terminal in a "teletype conver- sation",
Xsetting half duplex is generally required.  In such cases, use of the
X'nl', 'nlin' and 'nlout' commands may also be required.
X
XThe default setting for duplex is full.
X#--------------------------------------------------------------------
X#%esc
X#Usage esc <hex-constant>
X#"command escape ": This command is used only on non-XENIX systems.
X#It specifies the equivalent character for the HOME key used
X#by XENIX versions of ecu to enter the commands being described
X#by this help function.  The default setting for this command escape
X#s '%'.  To change the value, you must enter the hexadecimal value
X#of the desired character; it must be in the range 01 through 7F.
X#You may use the 'ax' command to aid in converting an ASCII
X#character to the appropriate hexadecimal value.
X#--------------------------------------------------------------------
X%fi
XUsage: fi [<filename>]
X
X"file insert": This command causes file characters to be inserted into
Xthe transmit data stream as though they had been entered at the
Xkeyboard.  If <filename> is not entered on the command line, a prompt
Xfor the filename is made.  Once the filename has been entered and file
Xhas been opened, you are asked whether the file should be transmitted at
Xfull speed, by "echo pacing" or by a single line at a time.  You may
Xalso append an 'f', 'e' or 's' argument to the command line.  If your
Xremote can tolerate it, full speed transmission is the fastest.
XPressing the interrupt key (DEL) stops a full speed transmission.  By
Xspecifying echo pacing, it is possible to increase the likelihood of
Xproper receipt.  Pressing the interrupt key (DEL) stops an echo paced
Xtransmission.  As a last resort, if echo pacing is not working for you,
X(i.e., you are using the command in an environment where the remote does
Xnot echo your characters), use single line at a time transmission.  You
Xmust press the space key to initiate sending each line.  Pressing 'ESC'
Xor 's' stops the transfer.
X#--------------------------------------------------------------------
X%fkey
XUsage: fkey [<keyset_name>]
X
XThis command allows the mapping of function keys F1-F12, PgUp, PgDn, End
Xand Ins and the cursor up, down, left and right keys to emit a desired
Xsequence of characters when a function key is pressed.  <keyset_name>
Xspecifies which key set in ~/.ecu/keys is to be selected: Sample entry
Xin ~/.ecu/keys:
X
Xhayes
X	F1:escape:+ + +
X	F2:autoans:A T S 0 = 1 cr
X	F3:dial:A T D T
Xbbs
X	F1:cancel:^K
X	F2:yes:y cr
X
XIf a keyset_name matches a logical dial directory name, it is loaded
Xwhen the number is dialed.
X#--------------------------------------------------------------------
X%hangup
XUsage: hangup
X
XThis causes DTR to be momentarily interrupted, terminating any
Xoutstanding connection.  Your DCE (modem) must be able to drop carrier
Xupon loss of DTR.
X#--------------------------------------------------------------------
X%help
XUsage: help [<cmd-name>]
X
XIssuing this command with no argument displays a list of commands
Xfollowed by a request for a command for further information.
X#--------------------------------------------------------------------
X%llp
XUsage: llp
X
XThis command is a shorthand version of 'log /dev/lp'.
X/dev/lp must not be under the control of a print spooler.
X#--------------------------------------------------------------------
X%loff
XUsage: loff
X
XThis command is shorthand for 'log off'.  If session logging
Xis active, it is turned off.
X#--------------------------------------------------------------------
X%log
XUsage: log [-s] [-r] [ | off | filename ]
X       -s "scratch" previous file contents; otherwise append
X       -r "raw" logging; otherwise non-printable characters
X          other than tab and newline are omitted from the log
X
XThis command controls session logging; issuing the command with no
Xargument causes the status of session logging to be displayed.  The
Xspecial argument 'off' causes active logging to be terminated.  Other
Xargument values cause logging to start using the argument as a filename.
XIssuing a 'log filename' command when logging is already active causes
Xthe previous file to be closed and the new file to be opened.  Switches
Xare meaningful only when used in conjunction with a filename to start
Xlogging.
X#--------------------------------------------------------------------
X%nl
XUsage: nl
X
XDisplay the current setting of CR/LF mapping.  For more information,
Xrefer to the 'nlin' and 'nlout' command descriptions.
X#--------------------------------------------------------------------
X%nlin
XUsage: nlin [<y-n>]
X
XThis command controls whether or not a newline (NL/LF) character is sent
Xto the screen upon receipt of a carriage return (CR) from the remote
Xsystem.  Most remote computers supply a NL after CR.  When communicating
Xwith another terminal in a "teletype conversation", this is generally
Xnot the case (see also the 'duplex' command).
X
XIssuing the command without <y-n> causes the current setting to be
Xdisplayed.  The format of <y-n> is flexible: 'y' or '1' enables
Xappending NL to CR, 'n' or '0' causes the feature to be disabled.
X#--------------------------------------------------------------------
X%nlout
XUsage: nlout [<y-n>]
X
XThis command controls whether or not a newline (NL/LF) character is sent
Xto the remote system upon transmission of a carriage return (CR) entered
Xby the keyboard.  Most remote computers do not require (indeed
X"dislike") a NL after CR.  When communicating with another terminal in a
X"teletype conversation", this is generally not the case (see also the
X'duplex' command).
X
XIssuing the command without <y-n> causes the current setting to be
Xdisplayed.  The format of <y-n> is flexible: 'y' or '1' enables
Xappending NL to CR, 'n' or '0' causes the feature to be disabled.
X#--------------------------------------------------------------------
X%parity
XUsage: parity [ None | Even | Odd ]
X
XThis command controls the parity of characters transmitted by the
Xkeyboard.  Issuing the command with no parameter displays the current
Xsetting.  When the parameter is supplied, only the first character is
Xrequired.  Even or odd parity implies seven data bits; no parity implies
Xeight data bits.  Parity of incoming characters is not checked.
X
XThe setting may be automatically changed as the result of a 'dial'
Xcommand.  See also the 'baud' and 'dial' command descriptions.
X#--------------------------------------------------------------------
X%pid
XUsage: pid
X
XThis command displays the process id of the ecu transmitter process, the
Xecu receiver process and the process ids of ecu's parent and group.
X#--------------------------------------------------------------------
X%ptrace
XUsage: ptrace [ 0 | 1 | on | off]
X
XThis command controls whether or not procedure execution is to be
Xtraced.
X#--------------------------------------------------------------------
X%pwd
XUsage: pwd
X
XThis command prints the current working directory of the ecu process.
X#--------------------------------------------------------------------
X%rk
XUsage: rk
X
XThis command searches the PATH list for 'ckermit' (Columbia University
XC-Kermit) and invokes it to receive files.  See the ecu documentation
Xfor modifications necessary to ckermit for ecu operation.  The file
X~/.kermrc must be set up to have any desired initialization paraeters
Xyou desire.  Refer to C-Kermit documentation for more information.
X#--------------------------------------------------------------------
X%rs
XUsage: rs
X
XThis command invokes a SEAlink receive protocol.
X#--------------------------------------------------------------------
X%redial
XUsage: redial [<retry-count> [<pause-interval>]]
X
XThis command redials a number previously dialed with the 'dial' command.
XModem status is tested and multiple retries may be made.  <retry-count>
Xspecifies how many retries are to be made.  <pause-interval> specifies
Xhow many seconds the program pauses after a failure to connect.  You
Xmust specify <retry-count> in order to specify <pause-interval>.  The
Xdefault value for <retry-count> is 10, for <pause-interval> is 60.
X
XYou should know that in some jurisdictions, it is ILLEGAL to dial the
Xsame telephone number more than a specified number of times during some
Xinterval of time.  In any case, specifying <pause-interval> less than 15
Xseconds is silently changed to 15 seconds.
X#--------------------------------------------------------------------
X%rev
XUsage: rev
X
XThis command displays ecu's revision, the transmitter process id and the
Xdate and time ecu was made.
X#--------------------------------------------------------------------
X%rx
XUsage: rx
X
XThis command invokes a modified version of Chuck Forsberg's rz program
X(version 1.31) to receive files from the remote system using XMODEM/CRC.
X
XAfter entering the command, you are prompted as to whether or not file
XCR/LF characters are to be converted to newlines.  If you are
Xtransferring text files from a system which contain CR/LF line
Xterminators, you must answer yes to this question.  You should answer no
Xwhen transferring binary files, such as executables, .arc files and the
Xlike.  File transfer progress is presented on a visual display.  To
Xabort the transfer, press your interrupt key (usually DEL unless reset
Xwith stty(C)).
X#--------------------------------------------------------------------
X%ry
XUsage: ry
X
XThis command invokes a modified version of Chuck Forsberg's rz program
X(version 1.31) to receive files from the remote system using YMODEM
Xbatch with CRC-16 error correction.  The YMODEM is "true YMODEM", not
XXMODEM-1k.  File transfer progress is presented on a visual display.  To
Xabort the transfer, press your interrupt key (usually DEL unless reset
Xwith stty(C)).
X#--------------------------------------------------------------------
X%rz
XUsage: rz
X
XThis command invokes a modified version of Chuck Forsberg's rz program
X(version 1.44) to receive files from the remote system using
XZMODEM/CRC32.  File transfer progress is presented on a visual display.
XTo abort the transfer, press your interrupt key (usually DEL unless
Xreset with stty(C)).
X#--------------------------------------------------------------------
X%sk
XUsage: sk [<file-list>]
X
XThis command searches the PATH list for 'ckermit' (Columbia University
XC-Kermit) and invokes it to send files.  The file ~/.kermrc must be set
Xup to have any desired initialization paraeters you desire.  See the ecu
Xdocumentation for modifications necessary to ckermit for ecu operation.
X
XAfter entering the command, you are prompted as to whether or not file
Xnewline characters are to be converted to CR/LF.  If you are
Xtransferring text files to a system which requires CR/LF line
Xterminators, you must answer yes to this question.  You should answer no
Xwhen transferring binary files, such as executables, .arc files and the
Xlike.  You are prompted to enter a list of files to send, which may
Xcontain one or more wildcard specifications.
X
XThe file ~/.kermrc must be set up to have any desired initialization
Xparameters you desire.  Refer to C-Kermit documentation for more
Xinformation.
X#--------------------------------------------------------------------
X%ss
XUsage: ss [<file-list>]
X
XThis command invokes a SEAlink file transmission protocol.
X#--------------------------------------------------------------------
X%stat
XUsage: stat
X
XThis command displays statistics about ecu usage.
X
XExample display when not connected to a remote system:
XDate/time: 06-14-1988 11:40:35 (UTC 15:40)
XTotal chars transmitted: 178
XTotal chars received:    3681
X
XDate/time: 06-14-1988 14:41:24 (UTC 18:41)
XConnected to CompuHost (555-1234) at 14:40:57
XParameters: 2400-N-1 Connect time: 00:01:27
XTotal chars transmitted: 234 (since CONNECT 142)
XTotal chars received:    2278 (since CONNECT 1478)
X#--------------------------------------------------------------------
X%sx
XUsage: sx [<file-name>]
X
XThis command invokes a modified version of Chuck Forsberg's sz program
X(version 1.44) to send a file to the remote system using XMODEM/CRC.
X
XAfter entering the command, you are prompted as to whether or not file
XCR/LF characters are to be converted to newlines.  If you are
Xtransferring text files from a system which contain CR/LF line termi-
Xnators, you must answer yes to this question.  You should answer no when
Xtransferring binary files, such as executables, .arc files and the like.
X
XYou are prompted to enter a filename to send.  File transfer progress is
Xpresented on a visual display.  To abort the transfer, press your
Xinterrupt key (usually DEL unless reset with stty(C)).
X#--------------------------------------------------------------------
X%sy
XUsage: sy [<file-list>]
X
XThis command invokes a modified version of Chuck Forsberg's sz program
X(version 1.44) to send file(s) to the remote system using YMODEM/CRC.
X
XYou are prompted to enter filename(s) to send, which may consist of one
Xor more wildcard specifications.  File transfer progress is presented on
Xa visual display.  To abort the transfer, press your interrupt key
X(usually DEL unless reset with stty(C)).
X#--------------------------------------------------------------------
X%sz
XUsage: sz [<file-list>]
X
XThis command invokes a modified version of Chuck Forsberg's sz program
X(version 1.44) to send file(s) to the remote system using ZMODEM/CRC32.
X
XYou are prompted to enter filename(s) to send, which may consist of one
Xor more wildcard specifications.  File transfer progress is presented on
Xa visual display.  To abort the transfer, press your interrupt key
X(usually DEL unless reset with stty(C)).
X
XNote: if you specify sending only newer files and the remote receiver
Xdoes not support the feature, it may skip (reject) all your files.
XRetry the transfer specifying 'N' to 'Transfer only newer files'.
X#--------------------------------------------------------------------
X%time
XUsage: time
X
XThis command displays the local date and time as well as the current UTC.
X#--------------------------------------------------------------------
X%tty
XUsage: tty
X
XThis command displays the current console tty name.
X#--------------------------------------------------------------------
X%exit
XUsage: exit
X
XThis command terminates ecu promptly.  If your modem does not drop
Xcarrier upon loss of Data Terminal Ready (DTR), you must use the
X'hangup' command prior to issuing the 'exit' command.  It is strongly
Xrecommended that you configure your modem to hang up the phone line when
XDTR drops.  A shorthand version of this command exists: '.' is
Xequivalent to 'exit'.
X#--------------------------------------------------------------------
X%xon
XUsage: xon [<arg>]
Xwhere <arg> is on    input and output flow control
X               off   no flow control
X               in    input flow control
X               out   output flow control
X
XThis command enables or disables xon/xoff flow control.  If the
Xargument is omitted, the current flow control state is displayed.
X#--------------------------------------------------------------------
X%!
XUsage: !
X       !<command>
X
XThe '!' command is a shell escape.  The environment variable SHELL is
Xread to determine what shell program to execute (e.g., /bin/sh, etc).
XIf '!' is entered by itself, an interactive shell is started; press ^D
Xto exit back to ecu.  If <command> is supplied, it is executed by the
Xshell with an immediate return to ecu.
X
XSimilarly,
X  '$' causes the communications line to be stdin and stdout
X      for the spawned shell
X  '-' is similar to '>', except the command is executed directly
X      without going through a shell.
X#--------------------------------------------------------------------
X%$
XUsage: $
X       $<command>
X
XThe '$' command is a shell escape causing the communications line to be
Xthe stand input and output.  The environment variable SHELL is read to
Xdetermine what shell program to execute (e.g., /bin/sh, etc).  If '$' is
Xentered by itself, an interactive shell is started; a ^D received from
Xthe communications line causes the shell to terminate and control to be
Xpassed back to ecu.  If <command> is supplied, it is executed by the
Xshell with an immediate return to ecu.
X#--------------------------------------------------------------------
X%-
XUsage: -<command>
X
XThe '-' command causes <command> to be executed directly without
Xpassing through a shell (no wildcard expansion or other shell
Xprocessing occurs).  Standard input, output and error all are
Xopened to the console.  In addition, all other files (including
Xthe communications line) opened by ecu remain open.
X#--------------------------------------------------------------------
X%?
XUsage: ?
X
XThis is an alias for the help command.
X#--------------------------------------------------------------------
X%clrx
XUsage: clrx
X
XThe 'clrx' command simulates receipt of an XON by ECU.  It is useful
Xin the rare circumstances that an XOFF is received by ECU from a 
Xremote system and no later XON is received.
X#--------------------------------------------------------------------
X%pcmd
XUsage: pcmd <procedure command>
X
XThe 'pcmd' command allows a procedure command to be issued from the
Xinteractive command prompt.  It is primarily intended for debugging
Xprocedure commands, but it is available for any use.
X#--------------------------------------------------------------------
X%plog
XUsage: plog [<filename> | off | ]
X
XThe 'plog' command turns on or off procedure logging.  If the
Xargument to the command is 'off', logging is turned off, otherwise
Xlogging is started on the specified file.  If no argument is specified,
Xthe status of procedure logging is displayed.
X#--------------------------------------------------------------------
X%rtscts
XUsage: rtscts [ y | n | ]
X
XThis experimental command turns on or off the driver RTS and CTS
Xflow control.  As of this writing, the driver does not properly
Xhandle RTS/CTS flow control.
X#--------------------------------------------------------------------
X%sdname
XUsage: sdname [<filename> | ]
X
XThis command sets or displays the current screen dump filename.
XUntil the command is issued, screen dump data is placed in
X~/.ecu/screen.dump.
X#--------------------------------------------------------------------
X%sgr
XUsage: sgr mode cmd
X
XThis experimental command is used to test the timed read primitive
Xused by ECU.  The command <cmd> is sent to the line and a timed
Xread is performed.  The data returned is displayed in hexadecimal
Xformat on the console. Refer to source module ecuxenix.c, function
Xsend_get_response() for details.
X#--------------------------------------------------------------------
X%ts
XUsage: ts
X
XThis experimental command displays raw termio structure information
Xfor the console and the tty.  It is primarily used in debugging ECU.
X#--------------------------------------------------------------------
X%xlog
XUsage: xlog [y | n]
X
XThis experimental command controls exhaustive logging by the X, Y, and
XZMODEM file transfer protocols to files named /tmp/szNNNNN.log or
X/tmp/rzNNNNN.log where NNNNN is the process id of the transfer process.
SHAR_EOF
$TOUCH -am 0521014190 'help/ecuhelp.src' &&
chmod 0644 help/ecuhelp.src ||
echo 'restore of help/ecuhelp.src failed'
Wc_c="`wc -c < 'help/ecuhelp.src'`"
test 24593 -eq "$Wc_c" ||
	echo 'help/ecuhelp.src: original size 24593, current size' "$Wc_c"
# ============= help/helpgen.c ==============
echo 'x - extracting help/helpgen.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/helpgen.c' &&
X/*+-------------------------------------------------------------------------
X	helpgen.c -- ecu command help file maker
X	wht%n4hgf@gatech.edu
X
X  Defined functions:
X	build_ecudoc()
X	build_ecuhelp()
X	main(argc,argv,envp)
X	search_cmd_list(cmd)
X	show_cmds()
X	test_help()
X	to_lower(ch)
X	to_upper(ch)
X	usage()
X
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include <stdio.h>
X#include <ctype.h>
X
X#if defined(M_SYS5)
X#if !defined(LINT_ARGS)
X#define LINT_ARGS
X#endif
X#endif
X# include "lint_args.h"
X
X#define DECLARE_P_CMD
X#define HELPGEN
X#include "../ecucmd.h"
X
X#include "../esd.h"
X#include "../stdio_lint.h"
X
X#define PSRC	"ecuhelp.src"
X#define PDAT	"ecuhelp.data"
X#define PDOC	"ecuhelp.doc"
X#define PTXT	"ecuhelp.txt"
X#define PFITXT	"../doc/ecufi.txt"
X#define PFSTXT	"../doc/ecufs.txt"
X
Xlong start_pos[TOKEN_QUAN];
Xint token_line[TOKEN_QUAN];
XFILE	*fpsrc;		/* help source file */
XFILE	*fpdat;		/* help data file */
XFILE	*fpdoc;		/* help doc file */
XFILE	*fptxt;		/* help nroff file */
XP_CMD	*pcmd;
Xint src_line = 0;
Xchar buf[128];
X
X/*+-------------------------------------------------------------------------
X	usage()
X--------------------------------------------------------------------------*/
Xusage()
X{
X	fprintf(stderr,"usage: helpgen [-b] [-d] [-s] [-t]\n");
X	fprintf(stderr," -b build %s from %s\n",PDAT,PSRC);
X	fprintf(stderr," -d build %s from %s\n",PDOC,PDAT);
X	fprintf(stderr," -n build nroff %s from %s\n",PTXT,PDAT);
X	fprintf(stderr," -s show list of commands\n");
X	fprintf(stderr," -t test help\n");
X	fprintf(stderr,"At least one switch must be issued.  They are executed\n");
X	fprintf(stderr,"in the order shown on the usage line.\n");
X	exit(1);
X}	/* end of usage */
X
X/*+-------------------------------------------------------------------------
X	search_cmd_list(cmd)
X--------------------------------------------------------------------------*/
XP_CMD *
Xsearch_cmd_list(cmd)
Xregister char *cmd;
X{
Xregister P_CMD	*cmd_list = icmd_cmds;
X
X	while(cmd_list->token != -1)
X	{
X		if(strcmp(cmd_list->cmd,cmd) == 0)
X			break;
X		cmd_list++;
X	}
X	if(cmd_list->token == -1)
X		return((P_CMD *)0);
X	else
X		return(cmd_list);
X
X}	/* end of search_cmd_list */
X
X/*+-------------------------------------------------------------------------
X	show_cmds()
Xcommands with null descriptions are "undocumented"
X--------------------------------------------------------------------------*/
Xvoid
Xshow_cmds()
X{
Xregister int itmp;
Xregister P_CMD *pcmd = icmd_cmds;
Xregister int longest_cmd = 0;
Xregister int longest_descr = 0;
Xregister int cmd_count = 0;
Xregister int nl_flag = 0;
Xchar s80[80];
XP_CMD *longest_cmd_p = 0;
XP_CMD *longest_descr_p = 0;
X
X	while(pcmd->token != -1)
X	{
X		if(!*pcmd->descr)
X		{
X			pcmd++;
X			continue;
X		}
X		itmp = strlen(pcmd->cmd);
X		if(itmp > longest_cmd)
X		{
X			longest_cmd = itmp;
X			longest_cmd_p = pcmd;
X		}
X		itmp = strlen(pcmd->descr);
X		if(itmp > longest_descr)
X		{
X			longest_descr = itmp;
X			longest_descr_p = pcmd;
X		}
X		pcmd++;
X	}
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if((!pcmd->min) || (!*pcmd->descr))
X		{
X			pcmd++;
X			continue;
X		}
X		strcpy(s80,pcmd->cmd);
X		pad_zstr_to_len(s80,longest_cmd + 2);
X		for(itmp = 0; itmp < pcmd->min; itmp++)
X			s80[itmp] = to_upper(s80[itmp]);
X		fputs(s80,stderr);
X
X		strcpy(s80,pcmd->descr);
X		pad_zstr_to_len(s80,longest_descr + 1);
X		fputs(s80,stderr);
X
X		if(nl_flag)
X			fputs("\r\n",stderr);
X		else
X			fputs("| ",stderr);
X		nl_flag = (nl_flag) ? 0 : 1;
X
X		pcmd++;
X	}
X	if(nl_flag)
X		fputs("\r\n",stderr);
X
X	itmp = longest_cmd + longest_descr + 5;
X	sprintf(s80,"recwidth = %d\r\n",itmp);
X	fprintf(stderr,s80);
X	pcmd = longest_cmd_p;
X	sprintf(s80,"longest cmd: %s: %s\r\n",pcmd->cmd,pcmd->descr);
X	fprintf(stderr,s80);
X	pcmd = longest_descr_p;
X	sprintf(s80,"longest dsc: %s: %s\r\n",pcmd->cmd,pcmd->descr);
X	fprintf(stderr,s80);
X
X}	/* end of show_cmds */
X
X/*+-------------------------------------------------------------------------
X	build_ecuhelp()
X--------------------------------------------------------------------------*/
Xvoid
Xbuild_ecuhelp()
X{
Xregister int itmp;
Xregister char *cptr;
X
X	printf("\nBuilding %s\n",PDAT);
X
X/* use proc cmd entry for flag */
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		pcmd->proc = (PFI)0;
X		pcmd++;
X	}
X
X	for(itmp = 0; itmp < TOKEN_QUAN; itmp++)
X	{
X		start_pos[itmp] = 0L;
X		token_line[itmp] = 0;
X	}
X
X	if((fpsrc = fopen(PSRC,"r")) == NULL)
X	{
X		perror(PSRC);
X		exit(1);
X	}
X
X	if((fpdat = fopen(PDAT,"w")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X
X	fwrite((char *)start_pos,sizeof(long),	/* write null table */
X			TOKEN_QUAN,fpdat);
X
X	while(fgets(buf,sizeof(buf),fpsrc) != NULL)
X	{
X		src_line++;
X		itmp = strlen(buf);
X		buf[--itmp] = 0;						/* kill trailing nl */
X		if((buf[0] == '#') || (buf[0] == '/'))	/* ignore comments */
X			continue;
X		if(buf[0] == '%')		/* command indication */
X		{
XSEARCH_CMD_LIST:
X			if(!(pcmd = search_cmd_list(&buf[1])))
X			{
X				printf("line %d: '%s' not in command table\n",
X						src_line,&buf[1]);
X				while(fgets(buf,sizeof(buf),fpsrc) != NULL)
X				{
X					src_line++;
X					itmp = strlen(buf);
X					buf[--itmp] = 0;					/* kill trailing nl */
X					if(buf[0] == '%')		/* command indication */
X						goto SEARCH_CMD_LIST;
X				}
X				break;
X			}
X			if(start_pos[pcmd->token])
X			{
X				printf("line %d: '%s' already found on line %d\n",
X						src_line,&buf[1],token_line[pcmd->token]);
X				exit(1);
X			}
X			fputs("\n",fpdat);	/* terminate previous command description */
X			start_pos[pcmd->token] = ftell(fpdat);
X			token_line[pcmd->token] = src_line;
X			fputs("   ",fpdat);
X			cptr = &buf[1];	/* command text */
X			itmp = 0;
X			pcmd->proc = (PFI)1;	/* indicate we save command info */
X			while(*cptr)		/* show cmd and min chars required */
X			{
X				if(itmp < pcmd->min)
X					fputc(to_upper(*cptr++),fpdat);
X				else
X					fputc(to_lower(*cptr++),fpdat);
X				itmp++;
X			}
X			if(*pcmd->descr)		/* if description present */
X				fprintf(fpdat," : %s\n \n",pcmd->descr);
X			else
X				fputs("\n \n",fpdat);
X			continue;
X		}
X		fprintf(fpdat," %s\n",buf);
X	}
X
X	fseek(fpdat,0L,0);	/* back to position table */
X	fwrite((char *)start_pos,sizeof(long),	/* write actual table */
X		TOKEN_QUAN,fpdat);
X	fclose(fpsrc);
X	fputs("\n",fpdat);	/* terminate last command */
X	fclose(fpdat);
X
X/* say which commands weren't in the help source */
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if(pcmd->min && !pcmd->proc)
X			fprintf(stderr,"'%s' not in help source\n",pcmd->cmd);
X		pcmd++;
X	}
X
X
X}	/* end of build_ecuhelp */
X
X/*+-------------------------------------------------------------------------
X	build_ecudoc()
X--------------------------------------------------------------------------*/
Xvoid
Xbuild_ecudoc()
X{
Xregister int itmp;
Xregister char *cptr;
X
X	printf("\nBuilding %s\n",PDOC);
X	if((fpdat = fopen(PDAT,"r")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X	if((fpdoc = fopen(PDOC,"w")) == NULL)
X	{
X		perror(PDOC);
X		exit(1);
X	}
X	fprintf(fpdoc,
X		"\n     ECU  Command  Help  Documentation  (PRELIMINARY)\n\n");
X	fprintf(fpdoc,
X		"Commands are accessed by pressing the HOME key followed by one\n");
X	fprintf(fpdoc,
X		"of the following commands (capitalized portions are sufficient\n");
X	fprintf(fpdoc,
X		"to invoke the command):\n");
X	fprintf(fpdoc,"\n");
X	fprintf(fpdoc,
X"---------------------------------------------------------------------\n");
X	fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat);
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if(!pcmd->token)
X		{
X			pcmd++;
X			continue;
X		}
X		if(pcmd->min && !start_pos[pcmd->token])
X		{
X			printf("no help available for '%s'\n",pcmd->cmd);
X			pcmd++;
X			continue;
X		}
X		fseek(fpdat,start_pos[pcmd->token],0);
X		while(fgets(buf,sizeof(buf),fpdat) != NULL)
X		{
X			itmp = strlen(buf);
X			buf[--itmp] = 0;
X			if(itmp == 0)
X				break;
X			fprintf(fpdoc,"%s\n",buf);
X		}
X		fprintf(fpdoc,
X"---------------------------------------------------------------------\n");
X		pcmd++;
X	}
X	fclose(fpdat);
X	fclose(fpdoc);
X}	/* end of build_ecudoc */
X
X/*+-------------------------------------------------------------------------
X	build_ecutxt()
X--------------------------------------------------------------------------*/
Xvoid
Xbuild_ecutxt()
X{
Xregister int itmp;
Xregister char *cptr;
X
X	printf("\nBuilding %s\n",PTXT);
X	if((fpdat = fopen(PDAT,"r")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X	if((fptxt = fopen(PTXT,"w")) == NULL)
X	{
X		perror(PTXT);
X		exit(1);
X	}
X
X	fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat);
X	pcmd = icmd_cmds;
X	while(pcmd->token != -1)
X	{
X		if(!pcmd->token)
X		{
X			pcmd++;
X			continue;
X		}
X		if(pcmd->min && !start_pos[pcmd->token])
X		{
X			printf("no help available for '%s'\n",pcmd->cmd);
X			pcmd++;
X			continue;
X		}
X		fseek(fpdat,start_pos[pcmd->token],0);
X		if(fgets(buf,sizeof(buf),fpdat) != NULL)
X		itmp = strlen(buf);
X		buf[--itmp] = 0;
X		cptr = buf;
X		while(*cptr)
X			if(*cptr == ' ')
X				cptr++;
X			else
X				break;
X		fprintf(fptxt,".*s 2 \"%s\"\n.(b L",cptr);
X		while(fgets(buf,sizeof(buf),fpdat) != NULL)
X		{
X			itmp = strlen(buf);
X			buf[--itmp] = 0;
X			if(itmp == 0)
X				break;
X			fprintf(fptxt,"%s\n",buf);
X		}
X		fprintf(fptxt,"\n.)b\n\n");
X		pcmd++;
X	}
X	fclose(fpdat);
X	fclose(fptxt);
X}	/* end of build_ecutxt */
X
X/*+-------------------------------------------------------------------------
X	test_help()
X--------------------------------------------------------------------------*/
Xvoid
Xtest_help()
X{
Xregister int itmp;
Xregister char *cptr;
X
X/* test code */
X	printf("\nNow to test\n");
X	if((fpdat = fopen(PDAT,"r")) == NULL)
X	{
X		perror(PDAT);
X		exit(1);
X	}
X	fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat);
X	while(1)
X	{
X		printf("\ncommand: ");
X		fgets(buf,sizeof(buf),stdin);
X		itmp = strlen(buf);
X		buf[--itmp] = 0;
X		if(itmp == 0)
X			break;
X		if(!(pcmd = search_cmd_list(buf)))
X		{
X			printf("'%s' not found in ecu cmd table\n",buf);
X			continue;
X		}
X		if(pcmd->min && !start_pos[pcmd->token])
X		{
X			printf("no help available for '%s'\n",buf);
X			continue;
X		}
X		fseek(fpdat,start_pos[pcmd->token],0);
X		while(fgets(buf,sizeof(buf),fpdat) != NULL)
X		{
X			itmp = strlen(buf);
X			buf[--itmp] = 0;
X			if(itmp == 0)
X				break;
X			printf("%s\n",buf);
X		}
X	}
X}	/* end of test_help */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xregister int itmp;
Xregister char *cptr;
Xint iargv;
Xint b_flag = 0;
Xint s_flag = 0;
Xint t_flag = 0;
Xint f_flag = 0;
Xint d_flag = 0;
Xint n_flag = 0;
X
X	setbuf(stdout,NULL);
X	setbuf(stderr,NULL);
X
X	if(argc < 1)
X		usage();
X	for(iargv = 1; iargv < argc; iargv++)
X	{
X		if(argv[iargv][0] == '-')
X		{
X			switch(itmp = (argv[iargv][1]))
X			{
X				case 'b': b_flag = 1; break;
X				case 's': s_flag = 1; break;
X				case 't': t_flag = 1; break;
X				case 'd': d_flag = 1; break;
X				case 'n': n_flag = 1; break;
X				default:
X					usage();
X					break;
X			}
X		}
X		else
X			usage();
X	}
X	if(!b_flag && !s_flag && !t_flag && !d_flag && !n_flag && !f_flag)
X		usage();
X
X	if(b_flag)
X		build_ecuhelp();
X	if(d_flag)
X		build_ecudoc();
X	if(n_flag)
X		build_ecutxt();
X	if(s_flag)
X		show_cmds();
X	if(t_flag)
X		test_help();
X
X	exit(0);
X}	/* end of main */
X/* end of helpgen.c */
X/* vi: set tabstop=4 shiftwidth=4: */
SHAR_EOF
$TOUCH -am 0814204290 'help/helpgen.c' &&
chmod 0644 help/helpgen.c ||
echo 'restore of help/helpgen.c failed'
Wc_c="`wc -c < 'help/helpgen.c'`"
test 11307 -eq "$Wc_c" ||
	echo 'help/helpgen.c: original size 11307, current size' "$Wc_c"
# ============= help/lint_args.h ==============
echo 'x - extracting help/lint_args.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/lint_args.h' &&
X/*+-----------------------------------------------------------------------
X	lint_args.h
X------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#ifndef BUILDING_LINT_ARGS
X#ifdef LINT_ARGS
X
X/* helpgen.c */
Xint cmd_baud(void );
Xint cmd_break(void );
Xint cmd_cd(void );
Xint cmd_clrx(void );
Xint cmd_cls(void );
Xint cmd_color(void );
Xint cmd_continue(void );
Xint cmd_cursor(void );
Xint cmd_delline(void );
Xint cmd_dial(void );
Xint cmd_do(void );
Xint cmd_duplex(void );
Xint cmd_echo(void );
Xint cmd_eeol(void );
Xint cmd_else(void );
Xint cmd_exit(void );
Xint cmd_expresp(void );
Xint cmd_fchmod(void );
Xint cmd_fclose(void );
Xint cmd_fdel(void );
Xint cmd_fgetc(void );
Xint cmd_fgets(void );
Xint cmd_fkey(void );
Xint cmd_flush(void );
Xint cmd_fopen(void );
Xint cmd_fputc(void );
Xint cmd_fputs(void );
Xint cmd_fread(void );
Xint cmd_fseek(void );
Xint cmd_fwrite(void );
Xint cmd_getf(void );
Xint cmd_goto(void );
Xint cmd_gotob(void );
Xint cmd_hangup(void );
Xint cmd_hexdump(void );
Xint cmd_home(void );
Xint cmd_icolor(void );
Xint cmd_ifi(void );
Xint cmd_ifs(void );
Xint cmd_insline(void );
Xint cmd_lbreak(void );
Xint cmd_lgets(void );
Xint cmd_logevent(void );
Xint cmd_lookfor(void );
Xint cmd_mkvar(void );
Xint cmd_nap(void );
Xint cmd_parity(void );
Xint cmd_pclose(void );
Xint cmd_plog(void );
Xint cmd_popen(void );
Xint cmd_prompt(void );
Xint cmd_ptrace(void );
Xint cmd_putf(void );
Xint cmd_return(void );
Xint cmd_rk(void );
Xint cmd_rname(void );
Xint cmd_rs(void );
Xint cmd_rx(void );
Xint cmd_ry(void );
Xint cmd_rz(void );
Xint cmd_scrdump(void );
Xint cmd_send(void );
Xint cmd_set(void );
Xint cmd_sk(void );
Xint cmd_ss(void );
Xint cmd_sx(void );
Xint cmd_sy(void );
Xint cmd_system(void );
Xint cmd_sz(void );
Xint cmd_vidcolor(void );
Xint cmd_vidnorm(void );
Xint cmd_vidrev(void );
Xint cmd_whilei(void );
Xint cmd_whiles(void );
Xint cmd_xon(void );
Xint main(int ,char **,char **);
Xint usage(void );
Xstruct p_cmd *search_cmd_list(char *);
Xvoid build_ecudoc(void );
Xvoid build_ecuhelp(void );
Xvoid build_ecutxt(void );
Xvoid show_cmds(void );
Xvoid test_help(void );
X/* util.c */
Xchar to_lower(char );
Xchar to_upper(char );
Xvoid pad_zstr_to_len(char *,int );
X
X#else		/* compiler doesn't know about prototyping */
X
X/* helpgen.c */
Xstruct p_cmd *search_cmd_list();
Xvoid build_ecudoc();
Xvoid build_ecuhelp();
Xvoid build_ecutxt();
Xvoid show_cmds();
Xvoid test_help();
X/* util.c */
Xchar to_lower();
Xchar to_upper();
Xvoid pad_zstr_to_len();
X
X#endif /* LINT_ARGS */
X#endif /* BUILDING_LINT_ARGS */
X
X/* end of lint_args.h */
SHAR_EOF
$TOUCH -am 0919224990 'help/lint_args.h' &&
chmod 0644 help/lint_args.h ||
echo 'restore of help/lint_args.h failed'
Wc_c="`wc -c < 'help/lint_args.h'`"
test 2592 -eq "$Wc_c" ||
	echo 'help/lint_args.h: original size 2592, current size' "$Wc_c"
# ============= help/util.c ==============
echo 'x - extracting help/util.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'help/util.c' &&
X/*+-------------------------------------------------------------------------
X	util.c
X	wht%n4hgf@gatech.edu
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X# include "lint_args.h"
X
X/*+-------------------------------------------------------------------------
X	all touuper/tolower not created equally, so this works!
X--------------------------------------------------------------------------*/
Xchar to_upper(ch)
Xregister char    ch;
X{ return( ((ch >= 'a') && (ch <= 'z')) ? ch - 0x20 : ch);
X}   /* end of to_upper() */
X
Xchar to_lower(ch)
Xregister char    ch;
X{ return( ((ch >= 'A') && (ch <= 'Z')) ? ch + 0x20 : ch);
X}   /* end of to_lower() */
X
X
X/*+-----------------------------------------------------------------------
X	pad_zstr_to_len(zstr,len)
X
X  pads with spaces to specified length, unless already longer than
X  len in which case the string is truncated to 'len' characters.
X------------------------------------------------------------------------*/
Xvoid
Xpad_zstr_to_len(zstr,len)
Xchar	*zstr;
Xint		len;
X{
Xregister int	izstr;
X
X	izstr = strlen(zstr);
X	if(izstr >= len)
X		zstr[len] = 0;
X	else
X	{
X		while(izstr < len)
X			zstr[izstr++] = 0x20;
X		zstr[izstr] = 0;
X	}
X}	/* end of pad_zstr_to_len */
X
SHAR_EOF
$TOUCH -am 0814204290 'help/util.c' &&
chmod 0644 help/util.c ||
echo 'restore of help/util.c failed'
Wc_c="`wc -c < 'help/util.c'`"
test 1304 -eq "$Wc_c" ||
	echo 'help/util.c: original size 1304, current size' "$Wc_c"
# ============= ecufriend/Makefile ==============
if test ! -d 'ecufriend'; then
    echo 'x - creating directory ecufriend'
    mkdir 'ecufriend'
fi
echo 'x - extracting ecufriend/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecufriend/Makefile' &&
X#  CHK=0x8D0A
X#----------------------------------------------------------------
X# Makefile for sample ecufriend
X# wht%n4hgf@gatech.edu
X#----------------------------------------------------------------
X#+:EDITS:*/
X#:05-07-1990-21:21-wht@n4hgf-omit fcrc usage in release makes
X#:01-03-1990-15:30-wht-quit using -Ox --- Oi screws up too much
X#:11-23-1989-02:37-wht-start support for UNIX V/386
X#:11-19-1989-18:06-wht-creation
X
Xecufriend: ecufriend.c
X	cc -O `sysdep =M_I286 -M2e =M_I386` ecufriend.c -o $@
SHAR_EOF
$TOUCH -am 0813184890 'ecufriend/Makefile' &&
chmod 0644 ecufriend/Makefile ||
echo 'restore of ecufriend/Makefile failed'
Wc_c="`wc -c < 'ecufriend/Makefile'`"
test 502 -eq "$Wc_c" ||
	echo 'ecufriend/Makefile: original size 502, current size' "$Wc_c"
# ============= ecufriend/ecufriend.c ==============
echo 'x - extracting ecufriend/ecufriend.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecufriend/ecufriend.c' &&
X#define DUMP_SCREEN
X/*+-------------------------------------------------------------------------
X	ecufriend.c -- example of using ecu shared memory access
X	wht%n4hgf@gatech.edu
X
XExecute by ecu procedure command:  system -s 'ecufriend '+%itos(%shmid)
XTo manually execute for perusal, do an ipcs command to find the
Xshared memory id or HOME pc echo 'shmid='+%itos(%shmid)
XThen HOME >ecufriend # where # is replaced by the shmid
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
X
X#include <stdio.h>
X#include <signal.h>
X#include <termio.h>
X#include <sys/errno.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X#include <time.h>
X#include <sys/ipc.h>
X#include <sys/msg.h>
X#include <sys/shm.h>
X#include "../ecushm.h"
X
XECU_SDS FAR *shm;		/* shared segment pointer */
Xint shmid;				/* sharged segment id */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xregister itmp;
X#ifdef DUMP_SCREEN
Xint row,col;
Xunsigned char sch;
X#endif
X
X	if(argc < 2)
X	{
X		printf("usage: ecufriend <ecu-shmid>\n");
X			exit(255);
X	}
X	shmid = atoi(argv[1]);
X
X	if((shm = (ECU_SDS FAR *)shmat(shmid,(char FAR *)0,SHM_RDONLY))
X			== (ECU_SDS FAR *)-1)
X	{
X		perror("shmat");
X		exit(1);
X	}
X
X	printf("ecu shm address = %08lx shmid=%d revision=%08lx\n",
X		shm,shmid,shm->shm_revision);
X
X	if(shm->shm_revision != SHM_REV)
X	{
X		printf("incompatible shared memory revision (compiled with %08lx)\n",
X			SHM_REV);
X		exit(1);
X	}
X
X	printf("xmit chars=%lu rcvd chars=%lu\n",
X		shm->xmit_chars,shm->rcvd_chars);
X	printf("The receive cursor position is at column %d row %d\n",
X		shm->cursor_y,shm->cursor_x);
X
X	printf("If this program was not executed by a shell that closed it,\n");
X	printf("then fd %d is available to us to write and read from the line.\n",
X		shm->Liofd);
X
X	if(isatty(shm->Liofd))
X		printf("It is available.\n");
X	else
X		printf("It is not available. Even so, we could re-open %s here\n",
X			shm->Lline);
X
X	if(shm->Lmodem_off_hook)
X		printf("Hmmm.. we seem to be connected to %s at %s\n",
X			shm->Ldescr,shm->Ltelno);
X
X#ifdef DUMP_SCREEN
X	printf("screen dump\n");
X	printf("-----------\n");
X	for(row = 0; row < 43; row++)
X	{
X		for(col = 0; col < 79; col++)
X		{
X			sch = shm->screen[row][col];
X			if((sch < 0x20) && (sch > 0x7E))
X				putc('.',stdout);
X			else
X				putc(sch,stdout);
X		}
X		putc('\n',stdout);
X	}
X#endif
X
X	exit(0);
X}	/* end of main */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of ecufriend.c */
SHAR_EOF
$TOUCH -am 0814204290 'ecufriend/ecufriend.c' &&
chmod 0644 ecufriend/ecufriend.c ||
echo 'restore of ecufriend/ecufriend.c failed'
Wc_c="`wc -c < 'ecufriend/ecufriend.c'`"
test 2665 -eq "$Wc_c" ||
	echo 'ecufriend/ecufriend.c: original size 2665, current size' "$Wc_c"
# ============= ecuungetty/Makefile ==============
if test ! -d 'ecuungetty'; then
    echo 'x - creating directory ecuungetty'
    mkdir 'ecuungetty'
fi
echo 'x - extracting ecuungetty/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ecuungetty/Makefile' &&
X#  CHK=0xC221
X#+---------------------------------------------------------------
X# makefile for ecuungetty
X# must be root to run make install
X# this make file should be run only by the master ecu Makefile,
X# or else you must define LCRYPT as needed herein
X#----------------------------------------------------------------
X#+:EDITS:*/
X#:10-20-1990-14:30-wht@n4hgf-fix bugs found by tbetz@upaya
X#:07-07-1990-02:06-wht@n4hgf-use ECULIBDIR
X#:05-07-1990-21:21-wht@n4hgf-omit fcrc usage in release makes
X#:01-03-1990-15:30-wht-quit using -Ox --- Oi screws up too much
X#:11-23-1989-02:37-wht-start support for UNIX V/386
X#:11-02-1989-16:00-wht-unet2 release
X
XCFLAGS = `sysdep =M_I386 -O =M_I286 -O -M2le`
X
XOBJ = \
X	../ecuuclc.o\
X	../ecuLCK.o\
X	../utmpstat.o\
X	../bamboozle.o\
X	ecuungetty.o
X
X#overriden by master make file
XECULIBDIR = /usr/lib/ecu
X#ECULIBDIR = /usr/local/lib/ecu
X
Xall: ecuungetty
X
Xecuungetty: $(OBJ)
X	cc $(CFLAGS) $(OBJ) -o ecuungetty $(LCRYPT) -lx
X
Xinstall: ecuungetty
X	-mkdir $(ECULIBDIR)
X	-chmod 755 $(ECULIBDIR)
X	cp ecuungetty $(ECULIBDIR)
X	chown root $(ECULIBDIR)/ecuungetty
X	chmod 4711 $(ECULIBDIR)/ecuungetty
X
X../bamboozle.o: ../bamboozle.c
X	cd ..;make bamboozle.o
X
X../utmpstat.o: ../utmpstat.c
X	cd ..;make utmpstat.o
X
X../ecuuclc.o: ../ecuuclc.c
X	cd ..;make ecuuclc.o
X
X../ecuLCK.o: ../ecuLCK.c
X	cd ..;make ecuLCK.o
X
SHAR_EOF
$TOUCH -am 1020143090 'ecuungetty/Makefile' &&
chmod 0644 ecuungetty/Makefile ||
echo 'restore of ecuungetty/Makefile failed'
Wc_c="`wc -c < 'ecuungetty/Makefile'`"
test 1331 -eq "$Wc_c" ||
	echo 'ecuungetty/Makefile: original size 1331, current size' "$Wc_c"
true || echo 'restore of ecuungetty/ecuungetty.c failed'
echo End of part 17, continue with part 18
exit 0
--------------------------------------------------------------------
Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
Hacker Extraordinaire  d' async PADs,  pods,  proteins and protocols

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.