home *** CD-ROM | disk | FTP | other *** search
- From: wht@n4hgf.atl.ga.us (Warren Tucker)
- Newsgroups: comp.sources.misc
- Subject: v42i115: ecu - ECU Asynchronous Communications v3.30, Part17/37
- Date: 24 May 1994 09:06:24 -0500
- Organization: Sterling Software
- Sender: kent@sparky.sterling.com
- Approved: kent@sparky.sterling.com
- Message-ID: <2rt1l0$d12@sparky.sterling.com>
- X-Md4-Signature: 0cba85edfc03b8db0bbd40e47860b592
-
- Submitted-by: wht@n4hgf.atl.ga.us (Warren Tucker)
- Posting-number: Volume 42, Issue 115
- Archive-name: ecu/part17
- Environment: SCO,SCOXENIX,MOTOROLA,HP-UX,LINUX,NetBSD,SUNOS,SYSVR4,SOLARIS2
- Supersedes: ecu: Volume 32, Issue 36-75
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: ecu330/models/funckeymap ecu330/pcmd.c
- # Wrapped by kent@sparky on Mon May 23 13:40:54 1994
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 17 (of 37)."'
- if test -f 'ecu330/models/funckeymap' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ecu330/models/funckeymap'\"
- else
- echo shar: Extracting \"'ecu330/models/funckeymap'\" \(28332 characters\)
- sed "s/^X//" >'ecu330/models/funckeymap' <<'END_OF_FILE'
- X#+------------------------------------------------------------------------
- X# ECU 3.30 funckeymap
- X#
- X# This file contains mapping information to convert non-ANSI
- X# keyboard function keys to an internal ECU function key
- X# representation.
- X#
- X# The format of an entry is shown below in the 'ansilike' example (used
- X# to ansilike ECU from the console by defining an ansi terminal type
- X# nevertheless equivalent to ansi).
- X#
- X# The first line(s) in a terminal keyboard description begin in
- X# column 1 and contain the terminal types (a la $TERM) for which
- X# the keyboard description are valid. The example entry contains
- X# several references to terminal types containing the substring
- X# 'ansi'. These are included only as an example of one keyboard
- X# description servicing multiple terminal types.
- X#
- X# ECU determines whether a terminal meets the ansi vs. ANSI
- X# distinction by searching for 'ansi' in the $TERM environment
- X# variable (without regard to case: 'AnSi' will match as well as
- X# 'ansi'). If your keyboard matches the ANSI specification even
- X# though your $TERM environment variable does not contain 'ansi'
- X# (such as 'sun'), then you may add the terminal type to the 'ansilike'
- X# entry rather than create a separate entry.
- X#
- X# Following the "first lines" are key definition entries, each
- X# preceded by at least one tab or space. Each entry is composed of
- X# three fields delimited by commas. The first field of an entry is
- X# the internal ECU function key name and must be chosen from the
- X# following strings (with no regard to case): "F1", "F2", "F3",
- X# "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "Home",
- X# "End", "PgUp", "PgDn", "CUP", "CUL", "CU5", "CUR" and "CUD" The
- X# second field contains the name of the key as it appears on the
- X# non-ANSI keyboard (such as "Send" for End on the Wyse 60). The
- X# third field is a description of the character sequence generated
- X# by the non-ANSI keyboard when the chosen key is pressed; it is a
- X# string of one or more tokens separated by spaces or tabs.
- X# The tokens are described in full in the ECU manual sections titled
- X# "Function Key Recognition" and "Function Key Mapping."
- X#
- X# << LOOK >> NOTE:
- X# Compile and run 'kbdtest3.c' (see the source file for information)
- X# to build a file containing the emitted sequences for each supported
- X# function key. Looking at the file, you will see it is a funckeymap
- X# formatted keyboard description complete with the TERM terminal type.
- X# I would appreciate your mailing me any files you
- X# create describing non-SCO/non-ISC main console keyboards.
- X#
- X# If you like, compile the older 'kbdtest.c' module released with 3.0
- X# and run it. Press any key you like and hex for the emitted
- X# sequence will appear on the screen. Press ^D to exit the program.
- X#
- X#-------------------------------------------------------------------------
- X#+:EDITS:
- X#:05-04-1994-04:39-wht@n4hgf-ECU release 3.30
- X#:04-24-1994-05:17-wht@n4hgf-clean up+add entries for release 3.30
- X#:03-13-1994-18:38-root@fep-add rterm entry
- X#:11-22-1993-23:46-wht@n4hgf-hpux
- X#:11-12-1993-10:51-wht@n4hgf-add Linux diffs
- X#:09-10-1992-13:59-wht@n4hgf-ECU release 3.20
- X#:08-22-1992-15:39-wht@n4hgf-ECU release 3.20 BETA
- X#:05-14-1992-02:07-wht@n4hgf-make note of Metro Link R5 compatibility
- X#:04-19-1992-01:37-wht@n4hgf-add ESIX SVR4 console
- X#:10-03-1991-04:56-wht@n4hgf-add X386 1.1b Roell X11R4 xterm entry
- X#:08-26-1991-05:06-wht@n4hgf2-add sun console and xterm entry
- X#:08-10-1991-16:07-wht@n4hgf-add new Metro Link server entry
- X#:05-06-1991-02:31-wht@n4hgf-add tandem terminal "ansi-terminal"
- X#:05-05-1991-17:37-root@n4hgf-add ISC at386 tnx to dug@kd4nc
- X#:05-02-1991-04:53-wht@n4hgf-document kbdtest3
- X#:03-26-1991-00:00-wht@n4hgf-more Metro Link work
- X#:03-19-1991-21:04-root@n4hgf-add Metro Link MetroX X11R4 xterm
- X#:12-20-1990-23:50-wht@n4hgf-"correct" wyse entry
- X#:12-18-1990-19:43-wht@n4hgf-add xterm and wy60
- X#:12-02-1990-13:34-wht@n4hgf-creation
- X
- X#+-------------------------------------------------------------------
- X# SCO multiscreen (and other ANSI for F1-F10, cursor keys)
- X#--------------------------------------------------------------------
- Xsco
- Xansi
- Xansi43
- Xmsdos
- Xdos
- Xdosansi
- Xtest
- X F1:F1: esc [ M
- X F2:F2: esc [ N
- X F3:F3: esc [ O
- X F4:F4: esc [ P
- X F5:F5: esc [ Q
- X F6:F6: esc [ R
- X F7:F7: esc [ S
- X F8:F8: esc [ T
- X F9:F9: esc [ U
- X F10:F10: esc [ V
- X F11:F11: esc [ W
- X F12:F12: esc [ X
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ I
- X PgDn:PgDn: esc [ G
- X CUU:CUU: esc [ A
- X CUL:CUL: esc [ D
- X CU5:CU5: esc [ E
- X CUR:CUR: esc [ C
- X CUD:CUD: esc [ B
- X Ins:Ins: esc [ L
- X BkTab:BackTab: esc [ Z
- X
- X#+-------------------------------------------------------------------
- X# ~wht/.Xdefaults on a networked SCO and Sun boxes
- X# has these xterm translations: allows
- X# me to be able to run ECU on n4hgf from
- X#
- X# a local xterm with the Roell X386 1.1b, Metro Link X11R4 and X11R5
- X# or SCO ODT servers or
- X# a remote Sparc IPX MIT X11R4 xterm running under
- X# news/open windows 2.0 or the MIT X11R4 server
- X#
- X# and vice versa on the Sun box
- X#
- X# This translation set demonstrates two different servers'
- X# keyboard-to-keysym mappings being accommodated by one 'xterm'
- X# funckey entry
- X#
- X#XTerm*VT100*Translations: #override\
- X# Shift <Key>Tab: string(0x1b) string("[Z") \n \
- X# <Key>Insert: string(0x1b) string("[L") \n \
- X# <Key>Home: string(0x1b) string("[H") \n \
- X# <Key>End: string(0x1b) string("[F") \n \
- X# <Key>Begin: string(0x1b) string("[E") \n \
- X# <Key>F27: string(0x1b) string("[H") \n \
- X# <Key>R13: string(0x1b) string("[F") \n \
- X# <Key>F29: string(0x1b) string("[I") \n \
- X# <Key>F31: string(0x1b) string("[E") \n \
- X# <Key>F35: string(0x1b) string("[G") \n
- X#
- X#--------------------------------------------------------------------
- Xxterm
- X BkTab:BkTab: esc [ Z
- X CU5:CU5: esc [ E
- X F1:F1: esc [ 1 1 ~
- X F2:F2: esc [ 1 2 ~
- X F3:F3: esc [ 1 3 ~
- X F4:F4: esc [ 1 4 ~
- X F5:F5: esc [ 1 5 ~
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X F11:F11: esc [ 2 3 ~
- X F12:F12: esc [ 2 4 ~
- X Ins:Ins: esc [ 2 ~
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ 5 ~
- X PgDn:PgDn: esc [ 6 ~
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-------------------------------------------------------------------
- X# Sun Sparc xterm using MIT X11R4 server (pl18)
- X#
- X# Place in .Xdefaults or whatever:
- X#
- X# XTerm*VT100*Translations: #override\
- X# Shift <Key>Tab: string(0x1b) string("[Z") \n \
- X# <Key>F27: string(0x1b) string("[H") \n \
- X# <Key>R13: string(0x1b) string("[F") \n \
- X# <Key>F29: string(0x1b) string("[I") \n \
- X# <Key>F31: string(0x1b) string("[E") \n \
- X# <Key>F35: string(0x1b) string("[G") \n \
- X# <Key>Insert: string(0x1b) string("[L") \n \
- X#
- X# funckeymap for 'xterm' under SunOS
- X# built by kbdtest3 1.02 Mon Aug 26 04:55:24 1991
- X# keyboard parity required = even
- X#--------------------------------------------------------------------
- Xxterm
- X BkTab:BkTab: esc [ Z
- X CU5:CU5: esc [ E
- X F1:F1: esc [ 1 1 ~
- X F2:F2: esc [ 1 2 ~
- X F3:F3: esc [ 1 3 ~
- X F4:F4: esc [ 1 4 ~
- X F5:F5: esc [ 1 5 ~
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X F11:F11: esc [ 2 3 ~
- X F12:F12: esc [ 2 4 ~
- X Ins:Ins: esc [ L # Ins generates Insert
- X Home:Home: esc [ H # Home generates F27
- X End:End: esc [ F # End generates R13
- X PgUp:PgUp: esc [ I # PgUp generates F29
- X PgDn:PgDn: esc [ G # PgDn generates F35
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-------------------------------------------------------------------
- X# SCO ODT 2.0 console xterm (with translations shown below)
- X#
- X#XTerm*VT100*Translations: #override\
- X# Shift <Key>Tab: string(0x1b) string("[Z") \n \
- X# <Key>KP_Insert: string(0x1b) string("[L") \n \
- X# <Key>KP_Home: string(0x1b) string("[H") \n \
- X# <Key>KP_End: string(0x1b) string("[F") \n \
- X# <Key>KP_Prior: string(0x1b) string("[I") \n \
- X# <Key>KP_Next: string(0x1b) string("[G") \n \
- X# <Key>KP_Begin: string(0x1b) string("[E") \n \
- X#
- X#--------------------------------------------------------------------
- Xxterm
- X BkTab:BkTab: esc [ Z
- X CU5:CU5: esc [ E
- X F1:F1: esc [ 1 1 ~
- X F2:F2: esc [ 1 2 ~
- X F3:F3: esc [ 1 3 ~
- X F4:F4: esc [ 1 4 ~
- X F5:F5: esc [ 1 5 ~
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X F11:F11: esc [ 2 3 ~
- X F12:F12: esc [ 2 4 ~
- X Ins:Ins: esc [ L
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ I
- X PgDn:PgDn: esc [ G
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-------------------------------------------------------------------
- X# Sun Console
- X#
- X# funckeymap for 'sun' (native console) under SunOS 4.1
- X# built by kbdtest3 1.02 Mon Aug 26 16:21:57 1991
- X# keyboard parity required = even
- X#--------------------------------------------------------------------
- Xsun
- X# BkTab:BkTab: ht # does not work
- X CU5:CU5: esc [ 2 1 8 z
- X F1:F1: esc [ 2 2 4 z
- X F2:F2: esc [ 2 2 5 z
- X F3:F3: esc [ 2 2 6 z
- X F4:F4: esc [ 2 2 7 z
- X F5:F5: esc [ 2 2 8 z
- X F6:F6: esc [ 2 2 9 z
- X F7:F7: esc [ 2 3 0 z
- X F8:F8: esc [ 2 3 1 z
- X F9:F9: esc [ 2 3 2 z
- X F10:F10: esc [ 2 3 3 z
- X F11:F11: esc [ 2 3 4 z
- X F12:F12: esc [ 2 3 5 z
- X Ins:Ins: esc [ 2 4 7 z
- X Home:Home: esc [ 2 1 4 z
- X End:End: esc [ 2 2 0 z
- X PgUp:PgUp: esc [ 2 1 6 z
- X PgDn:PgDn: esc [ 2 2 2 z
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-------------------------------------------------------------------
- X# ISC 'AT386' keyboard
- X#--------------------------------------------------------------------
- XAT386
- Xat386
- X F1:F1: esc O P
- X F2:F2: esc O Q
- X F3:F3: esc O R
- X F4:F4: esc O S
- X F5:F5: esc O T
- X F6:F6: esc O U
- X F7:F7: esc O V
- X F8:F8: esc O W
- X F9:F9: esc O X
- X F10:F10: esc O Y
- X F11:F11: esc O Z
- X F12:F12: esc O A
- X Home:Home: esc [ H
- X End:End: esc [ Y
- X PgUp:PgUp: esc [ V
- X PgDn:PgDn: esc [ U
- X CUU:CUU: esc [ A
- X CUL:CUL: esc [ D
- X CU5:CU5: esc [ G
- X CUR:CUR: esc [ C
- X CUD:CUD: esc [ B
- X Ins:Ins: esc [ @
- X BkTab:BackTab: gs
- X
- X#+-------------------------------------------------------------------
- X# ESIX SVR4 console
- X#
- X# funckeymap for 'AT386-M' under ESIX SVR4
- X# built by kbdtest3 3.20 Thu Apr 16 23:16:22 1992
- X# keyboard parity required = none
- X# stty -a at kbdtest3 execution time:
- X# speed 9600 baud;
- X# intr = DEL; quit = ^|; erase = ^h; kill = @;
- X# eof = ^d; eol = <undef>; eol2 = <undef>; swtch = <undef>;
- X# start = <undef>; stop = <undef>; susp = ^z; dsusp = <undef>;
- X# rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v;
- X# -parenb -parodd cs8 -cstopb -hupcl cread -clocal -loblk -parext
- X# -ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl -iuclc
- X# ixon ixany -ixoff -imaxbel
- X# isig icanon -xcase echo echoe echok -echonl -noflsh
- X# -tostop -echoctl -echoprt -echoke -defecho -flusho -pendin -iexten
- X# opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel tab3
- X#
- X# supplied by Joseph H Buehler <jhpb@sarto.budd-lake.nj.us>
- X#+-------------------------------------------------------------------
- XAT386-M
- X BkTab:BkTab: gs
- X CU5:CU5: esc [ G
- X F1:F1: esc O P
- X F2:F2: esc O Q
- X F3:F3: esc O R
- X F4:F4: esc O S
- X F5:F5: esc O T
- X F6:F6: esc O U
- X F7:F7: esc O V
- X F8:F8: esc O W
- X F9:F9: esc O X
- X F10:F10: esc O Y
- X F11:F11: esc O Z
- X F12:F12: esc O A
- X Ins:Ins: esc [ @
- X Home:Home: esc [ H
- X End:End: esc [ Y
- X PgUp:PgUp: esc [ V
- X PgDn:PgDn: esc [ U
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-------------------------------------------------------------------
- X# Wyse 60 Native Mode (no reprogrammed function keys)
- X# (matching the keyboard tops I have, anyway)
- X#
- X# The following is for native mode Wyse 60 with no function keys
- X# programmed for emitting alternate sequences. This is such a
- X# nice terminal in so many ways. Too bad they cocked up the left
- X# and down function keys by making them indistinguishable from
- X# backspace and newline. You may wish to study the SCO /etc/termcap
- X# 'wy60ak' entry for a way around this.
- X#
- X# Note there is a kludge in the terminal initialization code
- X# to force a Wyse 60's *arrow keys* to use ANSI sequences.
- X# This entry as shipped counts on this. If you don't have SCO, try
- X# the termcap entry in README.WY60
- X#
- X# If you really want to avoid this, comment out the IS strings below.
- X#--------------------------------------------------------------------
- Xwy60
- Xwyse60
- Xwy60ak
- Xwyse60ak
- Xwy60-43
- Xwyse60-43
- Xwyse60ak-43
- Xwy60ak-43
- X IS:1: esc Z 1 + esc [ A del
- X IS:2: esc Z 1 , esc [ B del
- X IS:3: esc Z 1 - esc [ D del
- X IS:4: esc Z 1 . esc [ C del
- X IS:5: esc Z 1 \ esc [ F del
- X IS:6: esc Z 1 q esc [ L del
- X F1:F1: soh @ cr
- X F2:F1: soh A cr
- X F3:F1: soh B cr
- X F4:F1: soh C cr
- X F5:F1: soh D cr
- X F6:F1: soh E cr
- X F7:F1: soh F cr
- X F8:F1: soh G cr
- X F9:F1: soh H cr
- X F10:F10: soh I cr
- X F11:F11: soh J cr
- X F12:F12: soh K cr
- X Home:Home: rs
- X PgUp:PrevPg: esc J
- X PgDn:NextPg: esc K
- X BkTab:F14: soh M cr
- X Ins:InsChar: esc Q
- X End:Send: esc 7
- X#comment these out if you DO comment the IS strings
- X CUU:CUU: esc [ A
- X CUL:CUL: esc [ D
- X CU5:CU5: esc [ E
- X CUR:CUR: esc [ C
- X CUD:CUD: esc [ B
- X# Home:Home: esc [ H
- X# End:End: esc [ F
- X#uncomment the if you DO NOT comment the IS strings
- X# CUU:CUU: vt
- X# CUR:CUR: ff
- X
- X#+-------------------------------------------------------------------
- X# Tandem Integrity S2
- X#
- X# From: rootk@tdmsou (Admin) [John Dashner]
- X# Date: Mon, 6 May 91 2:23:56 EDT
- X# funckeymap definition for TERM='ansi-tandem'
- X# built by kbdtest3.c Mon May 6 02:17:13 1991
- X#--------------------------------------------------------------------
- Xansi-tandem
- X BkTab:BkTab: esc [ Z
- X CU5:CU5: esc [ T
- X F1:F1: soh @ cr
- X F2:F2: soh A cr
- X F3:F3: soh B cr
- X F4:F4: soh C cr
- X F5:F5: soh D cr
- X F6:F6: soh E cr
- X F7:F7: soh F cr
- X F8:F8: soh G cr
- X F9:F9: soh H cr
- X F10:F10: soh I cr
- X F11:F11: soh J cr
- X F12:F12: soh K cr
- X Ins:Ins: esc [ @
- X Home:Home: esc [ H
- X End:End: esc [ 2 4 H
- X PgUp:PgUp: esc [ V
- X PgDn:PgDn: esc [ U
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-----------------------------------------------------------------------------
- X# "versatile" xterm - an example (works for me) -- wht
- X#------------------------------------------------------------------------------
- X# funckeymap definition for TERM='xterm'
- X# ODT 2.0 + Roell x386 1.1b + Sun OW2 + Sun MIT combined
- X# built by kbdtest3 3.21 Wed Sep 16 12:58:06 1992
- X# keyboard parity required = even
- X# stty -a at kbdtest3 execution time:
- X# speed 9600 baud; ispeed 9600 baud; ospeed 9600 baud;
- X# line = 0; intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D; eol = ^@;
- X# swtch = ^@;susp = ^Z;start = ^Q;stop = ^S;
- X# parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crtsfl -ctsflow -rtsflow
- X# -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc
- X# ixon -ixany -ixoff
- X# isig icanon -xcase echo echoe echok -echonl -noflsh -iexten -tostop -xclude
- X# opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel
- X# -isscancode
- X#------------------------------------------------------------------------------
- X# stock OW2/nEwS doesn't include F11 or F12; xev for both:
- X# state 0x0, keycode 16 (keysym 0x1005ff10, (no name)), same_screen YES,
- X# XLookupString gives 0 characters: ""
- X# (keycode 16 for F11, 18 for F12)
- X#------------------------------------------------------------------------------
- X# XTerm*VT100*Translations: #override\
- X# <Key>Home: string(0x1b) string("[H") \n \
- X# <Key>KP_Home: string(0x1b) string("[H") \n \
- X# <Key>F27: string(0x1b) string("[H") \n \
- X# <Key>End: string(0x1b) string("[F") \n \
- X# <Key>KP_End: string(0x1b) string("[F") \n \
- X# <Key>R13: string(0x1b) string("[F") \n \
- X# <Key>Prior: string(0x1b) string("[I") \n \
- X# <Key>F29: string(0x1b) string("[I") \n \
- X# <Key>Next: string(0x1b) string("[G") \n \
- X# <Key>KP_Next: string(0x1b) string("[G") \n \
- X# <Key>F35: string(0x1b) string("[G") \n \
- X# <Key>KP_Begin: string(0x1b) string("[E") \n \
- X# <Key>Begin: string(0x1b) string("[E") \n \
- X# <Key>F31: string(0x1b) string("[E") \n \
- X# <Key>KP_Insert: string(0x1b) string("[L") \n \
- X# <Key>Insert: string(0x1b) string("[L") \n \
- X# Shift <Key>Tab: string(0x1b) string("[Z") \n
- X#
- X#--------------------------------------------------------------------
- Xxterm
- X BkTab:BkTab: esc [ Z
- X CU5:CU5: esc [ E
- X F1:F1: esc [ 1 1 ~
- X F2:F2: esc [ 1 2 ~
- X F3:F3: esc [ 1 3 ~
- X F4:F4: esc [ 1 4 ~
- X F5:F5: esc [ 1 5 ~
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X F11:F11: esc [ 2 3 ~
- X F12:F12: esc [ 2 4 ~
- X Ins:Ins: esc [ L
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ I
- X PgDn:PgDn: esc [ G
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+---------------------------------------------------------------------
- X# Linux console
- X#----------------------------------------------------------------------
- Xconsole
- X F1:F1: esc [ [ A
- X F2:F2: esc [ [ B
- X F3:F3: esc [ [ C
- X F4:F4: esc [ [ D
- X F5:F5: esc [ [ E
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X F11:F11: esc [ 2 8 ~
- X F12:F12: esc [ 2 9 ~
- X Home:Home: esc [ 1 ~
- X End:End: esc [ 4 ~
- X PgUp:PgUp: esc [ 5 ~
- X PgDn:PgDn: esc [ 6 ~
- X CUU:CUU: esc [ A
- X CUL:CUL: esc [ D
- X CU5:CU5: esc [ G
- X CUR:CUR: esc [ C
- X CUD:CUD: esc [ B
- X Ins:Ins: esc [ 2 ~
- X
- X#+-----------------------------------------------------------------------------
- X# H P - U X hpterm
- X#------------------------------------------------------------------------------
- X# Date: Mon, 29 Nov 1993 14:09:53 -0800 (PST)
- X# From: "Robert E. Laughlin" <bel@nosc.mil>
- X# funckeymap for 'hpterm' under HP-UX
- X# built by kbdtest3 3.21 Wed Nov 24 10:26:29 1993
- X# keyboard parity required = even
- X# stty -a at kbdtest3 execution time:
- X# speed 9600 baud; line = 0; susp = ^Z; dsusp = ^@
- X# rows = 25; columns = 80
- X# intr = ^C; quit = ^\; erase = ^H; kill = ^U; swtch = ^@
- X# eof = ^D; eol = ^@; min = 4; time = 0; stop = ^S; start = ^Q
- X# parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crts
- X# -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc
- X# ixon -ixany ixoff -rtsxoff -ctsxon -ienqak
- X# isig icanon iexten -xcase echo echoe echok -echonl -noflsh
- X# opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel -tostop
- Xhpterm
- X# BkTab: dead key and no reasonable alternate
- X# CU5:CU5: 5
- X# the above entry is suspect
- X F1:F1: esc p cr
- X F2:F2: esc q cr
- X F3:F3: esc r cr
- X F4:F4: esc s cr
- X F5:F5: esc t cr
- X F6:F6: esc u cr
- X F7:F7: esc v cr
- X F8:F8: esc w cr
- X# F9: dead key and no reasonable alternate
- X# F10: dead key and no reasonable alternate
- X# F11: dead key and no reasonable alternate
- X# F12: dead key and no reasonable alternate
- X# Ins: dead key and no reasonable alternate
- X Home:Home: soh
- X End:End: enq
- X# PgUp: dead key and no reasonable alternate
- X# PgDn: dead key and no reasonable alternate
- X# CUU: dead key and no reasonable alternate
- X# CUD: dead key and no reasonable alternate
- X# CUL: dead key and no reasonable alternate
- X# CUR: dead key and no reasonable alternate
- X
- X#+-----------------------------------------------------------------------------
- X# funckeymap for 'rterm' for WHT
- X#------------------------------------------------------------------------------
- Xrterm
- X F1:F1: esc O q
- X F2:F2: esc O r
- X F3:F3: esc O s
- X F4:F4: esc O t
- X F5:F5: esc O u
- X F6:F6: esc O v
- X F7:F7: esc O w
- X F8:F8: esc O x
- X F9:F9: esc O y
- X F10:F10: esc O z
- X# F11:F11:
- X# F12:F12:
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ I
- X PgDn:PgDn: esc [ G
- X CUU:CUU: esc [ A
- X CUL:CUL: esc [ D
- X CU5:CU5: esc [ E
- X CUR:CUR: esc [ C
- X CUD:CUD: esc [ B
- X Ins:Ins: esc [ L
- X BkTab:BackTab: esc [ Z
- X
- X#+-----------------------------------------------------------------------------
- X# N e t B S D console (pc3)
- X#------------------------------------------------------------------------------
- X# From: Daniel Harris <daniel@reubio.apana.org.au>
- X# Date: Fri, 8 Apr 1994 23:18:27 +1000 (EST)
- X#
- X# Here's the funckeymap entries for the NetBSD console,
- X# and an arbitrary xterm.
- X#------------------------------------------------------------------------------
- X# funckeymap for 'pc3' under NetBSD OS
- X# From: Daniel Harris <daniel@reubio.apana.org.au>
- X# built by kbdtest3 3.30 Sun Mar 20 14:56:43 1994
- X# keyboard parity required = even
- X# stty -a at kbdtest3 execution time:
- X# speed 1200 baud; 0 rows; 0 columns;
- X# lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
- X# -echoprt -altwerase -noflsh -tostop -mdmbuf -flusho pendin
- X# -nokerninfo -extproc
- X# iflags: istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
- X# brkint -inpck -ignpar -parmrk
- X# oflags: opost onlcr oxtabs
- X# cflags: cread cs7 parenb -parodd hupcl -clocal -cstopb -crtscts
- X# cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
- X# eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
- X# quit = ^\; reprint = ^R; start = ^Q; status = <undef>; stop = ^S;
- X# susp = ^Z; werase = ^W;
- Xpc3
- X# BkTab:BkTab: del
- X CU5:CU5: esc [ E
- X F1:F1: esc [ M
- X F2:F2: esc [ N
- X F3:F3: esc [ O
- X F4:F4: esc [ P
- X F5:F5: esc [ Q
- X F6:F6: esc [ R
- X F7:F7: esc [ S
- X F8:F8: esc [ T
- X F9:F9: esc [ U
- X F10:F10: esc [ V
- X F11:F11: esc [ W
- X F12:F12: esc [ X
- X Ins:Ins: esc [ L
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ I
- X PgDn:PgDn: esc [ G
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#------------------------------------------------------------------------------
- X# N e t B S D xterm -- experimental
- X#------------------------------------------------------------------------------
- X# funckeymap for 'xterm' under NetBSD OS
- X# From: Daniel Harris <daniel@reubio.apana.org.au>
- X# built by kbdtest3 3.30 Sun Mar 20 15:06:20 1994
- X# keyboard parity required = even
- X# stty -a at kbdtest3 execution time:
- X# speed 9600 baud; 55 rows; 80 columns;
- X# lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
- X# -echoprt -altwerase -noflsh -tostop -mdmbuf -flusho pendin
- X# -nokerninfo -extproc
- X# iflags: istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel -ignbrk
- X# brkint -inpck -ignpar -parmrk
- X# oflags: opost onlcr -oxtabs
- X# cflags: cread cs7 parenb -parodd hupcl -clocal -cstopb -crtscts
- X# cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
- X# eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
- X# quit = ^\; reprint = ^R; start = ^Q; status = <undef>; stop = ^S;
- X# susp = ^Z; werase = ^W;
- X#------------------------------------------------------------------------------
- X# "The translations required for ECU in xterms to work are provided
- X# at the end of the file. (Of course, X support won't work with
- X# stock 0.9!)" -- Daniel Harris <daniel@reubio.apana.org.au>
- X#- required X resources -------------------------------------------------------
- X#XTerm*VT100*Translations: #override\
- X# Shift <Key>Tab: string(0x1b) string("[Z") \n \
- X# <Key>Home: string(0x1b) string("[H") \n \
- X# <Key>End: string(0x1b) string("[F") \n \
- X#------------------------------------------------------------------------------
- Xnetbsd-xterm
- X BkTab:BkTab: esc [ Z
- X CU5:CU5: esc [ nul
- X F1:F1: esc [ 1 1 ~
- X F2:F2: esc [ 1 2 ~
- X F3:F3: esc [ 1 3 ~
- X F4:F4: esc [ 1 4 ~
- X F5:F5: esc [ 1 5 ~
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X F11:F11: esc [ 2 3 ~
- X F12:F12: esc [ 2 4 ~
- X Ins:Ins: esc [ 2 ~
- X Home:Home: esc [ H
- X End:End: esc [ F
- X PgUp:PgUp: esc [ 5 ~
- X PgDn:PgDn: esc [ 6 ~
- X CUU:CUU: esc [ A
- X CUD:CUD: esc [ B
- X CUL:CUL: esc [ D
- X CUR:CUR: esc [ C
- X
- X#+-------------------------------------------------------------------
- X# SCO ODT 1.0/1.1 console xterm (as released, unmodified)
- X#--------------------------------------------------------------------
- Xxterm
- X F1:F1: esc [ 1 1 ~
- X F2:F2: esc [ 1 2 ~
- X F3:F3: esc [ 1 3 ~
- X F4:F4: esc [ 1 4 ~
- X F5:F5: esc [ 1 5 ~
- X F6:F6: esc [ 1 7 ~
- X F7:F7: esc [ 1 8 ~
- X F8:F8: esc [ 1 9 ~
- X F9:F9: esc [ 2 0 ~
- X F10:F10: esc [ 2 1 ~
- X# F11:F11: esc [ 2 3 ~ # decommitted to provide a CU5
- X# F12:F12: esc [ 2 4 ~ # decommitted to provide a BkTab
- X Home:Home: esc [ 8 ~
- X End:End: esc [ 7 ~
- X PgUp:PgUp: esc [ 5 ~
- X PgDn:PgDn: esc [ 6 ~
- X CUU:CUU: esc [ A
- X CUL:CUL: esc [ D
- X# CU5:CU5: esc [ 8 ~ # same as HOME unfortunately
- X CU5:F11: esc [ 2 3 ~
- X CUR:CUR: esc [ C
- X CUD:CUD: esc [ B
- X Ins:Ins: esc [ 2 ~
- X# BkTab:BackTab: tab # same as TAB unfortunately
- X BkTab:F12: esc [ 2 4 ~
- X
- X
- X
- END_OF_FILE
- if test 28332 -ne `wc -c <'ecu330/models/funckeymap'`; then
- echo shar: \"'ecu330/models/funckeymap'\" unpacked with wrong size!
- fi
- # end of 'ecu330/models/funckeymap'
- fi
- if test -f 'ecu330/pcmd.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ecu330/pcmd.c'\"
- else
- echo shar: Extracting \"'ecu330/pcmd.c'\" \(33339 characters\)
- sed "s/^X//" >'ecu330/pcmd.c' <<'END_OF_FILE'
- X/*+-------------------------------------------------------------------------
- X pcmd.c - ecu miscellaneous procedure commands
- X wht@n4hgf.atl.ga.us
- X
- X Defined functions:
- X get_big_endian_16(ptr)
- X get_big_endian_32(ptr)
- X pcmd_autorz(param)
- X pcmd_baud(param)
- X pcmd_cd(param)
- X pcmd_clrx(param)
- X pcmd_dcdwatch(param)
- X pcmd_dial(param)
- X pcmd_duplex(param)
- X pcmd_echo(param)
- X pcmd_exec(param)
- X pcmd_exit(param)
- X pcmd_flush(param)
- X pcmd_getf(param)
- X pcmd_hangup(param)
- X pcmd_hexdump(param)
- X pcmd_lbreak(param)
- X pcmd_lgets(param)
- X pcmd_logevent(param)
- X pcmd_lookfor(param)
- X pcmd_nap(param)
- X pcmd_nice(param)
- X pcmd_parity(param)
- X pcmd_popd(param)
- X pcmd_prompt(param)
- X pcmd_ptrace(param)
- X pcmd_pushd(param)
- X pcmd_putf(param)
- X pcmd_rname(param)
- X pcmd_rtscts(param)
- X pcmd_send(param)
- X pcmd_set(param)
- X pcmd_setline(param)
- X pcmd_system(param)
- X pcmd_xon(param)
- X
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:05-04-1994-04:39-wht@n4hgf-ECU release 3.30 */
- X/*:08-01-1993-02:39-wht@n4hgf-pass LRWT got_delim back to lgets caller in $i1 */
- X/*:09-10-1992-14:00-wht@n4hgf-ECU release 3.20 */
- X/*:09-06-1992-13:44-wht@n4hgf-rtscts would not accept a numeric argument */
- X/*:08-22-1992-15:39-wht@n4hgf-ECU release 3.20 BETA */
- X/*:01-12-1992-20:54-wht@n4hgf-add autorz command */
- X/*:12-12-1991-05:27-wht@n4hgf-proc_trace of intvar shows char value if 0-255 */
- X/*:11-11-1991-14:38-wht@n4hgf-add pcmd_dcdwatch code */
- X/*:10-09-1991-21:54-wht@n4hgf-add -p and -v switch to send */
- X/*:10-09-1991-20:32-wht@n4hgf-proc_trace code for send */
- X/*:09-01-1991-19:10-wht@n4hgf2-baud cmd can set rate even if no line open */
- X/*:09-01-1991-18:10-wht@n4hgf2-add setline */
- X/*:08-25-1991-14:39-wht@n4hgf-SVR4 port thanks to aega84!lh */
- X/*:08-06-1991-21:18-wht@n4hgf-nap -m test wrong sense ... old bug! */
- X/*:08-05-1991-16:22-wht@n4hgf-add nap -1 return and proc_trace */
- X/*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
- X/*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */
- X/*:06-05-1991-22:50-wht@n4hgf-fix parity cmd not taking alpha str */
- X/*:05-21-1991-18:52-wht@n4hgf-add pcmd_pushd and pcmd_popd */
- X/*:03-16-1991-15:12-wht@n4hgf-add pcmd_nice */
- X/*:01-09-1991-22:31-wht@n4hgf-ISC port */
- X/*:12-26-1990-02:34-wht@n4hgf-add cmd_rtscts */
- X/*:12-03-1990-04:59-wht@n4hgf-beef up pcmd_exit */
- X/*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */
- X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
- X
- X#include "ecu.h"
- X#include "ecuerror.h"
- X#include "termecu.h"
- X#include "ecukey.h"
- X#include "esd.h"
- X#include "var.h"
- X#include "proc.h"
- X
- X#define NAMED_VARIABLE_FLAG 0x1000L
- X
- X#if defined(SVR4)
- X#include <sys/termiox.h>
- Xextern int hx_flag;
- X
- X#endif
- X
- Xchar *get_time_plus_msec();
- X
- Xextern int rc_ep_has_run;
- Xextern ulong colors_current;
- Xextern char errmsg[];
- Xextern char curr_dir[CURR_DIRSIZ]; /* current working directory */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_autorz(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_autorz(param)
- XESD *param;
- X{
- X char s8[8];
- X
- X if (get_alpha_zstr(param, s8, sizeof(s8)))
- X return (eSyntaxError);
- X if (!strcmp(s8, "on"))
- X shm->autorz = 1;
- X else if (!strcmp(s8, "off"))
- X shm->autorz = 0;
- X else
- X return (eSyntaxError);
- X shm->autorz_pos = 0;
- X return (0);
- X} /* end of pcmd_autorz */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_baud(param) - set line or default baud rate
- X
- XThe command sets shm->Lbaud whether or not a line is open.
- XIf a line is open, the baud rate is actually set.
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_baud(param)
- XESD *param;
- X{
- X long new_baud;
- X int erc;
- X
- X if (erc = gint(param, &new_baud))
- X return (erc);
- X if (!valid_baud_rate((uint) new_baud))
- X {
- X pprintf("invalid baud rate: %lu\n", new_baud);
- X return (eFATAL_ALREADY);
- X }
- X shm->Lbaud = (uint) new_baud;
- X if (shm->Liofd >= 0)
- X lset_baud_rate(1);
- X if (proc_trace)
- X {
- X pprintf("baud rate set to %u\n", shm->Lbaud);
- X }
- X return (0);
- X
- X} /* end of pcmd_baud */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_cd(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_cd(param)
- XESD *param;
- X{
- X int erc;
- X ESD *tesd = esdalloc(ESD_NOMSZ);
- X
- X if (!tesd)
- X return (eNoMemory);
- X if (erc = gstr(param, tesd, 0))
- X goto FUNC_RETURN;
- X if (expand_dirname(tesd->pb, tesd->maxcb))
- X {
- X pprintf("%s\n", errmsg);
- X param->index = param->old_index;
- X erc = eFATAL_ALREADY;
- X goto FUNC_RETURN;
- X }
- X if (chdir(tesd->pb) < 0) /* now change to the new directory */
- X {
- X pperror(tesd->pb); /* print error if we get one */
- X pputs("\n");
- X erc = eFATAL_ALREADY;
- X goto FUNC_RETURN;
- X }
- X get_curr_dir(curr_dir, 256);
- X
- X FUNC_RETURN:
- X esdfree(tesd);
- X return (erc);
- X} /* end of pcmd_cd */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_pushd(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_pushd(param)
- XESD *param;
- X{
- X int erc = 0;
- X int arg_present;
- X ESD *tesd = (ESD *) 0;
- X
- X if (arg_present = !!end_of_cmd(param))
- X {
- X if (!(tesd = esdalloc(ESD_NOMSZ)))
- X return (eNoMemory);
- X if (erc = gstr(param, tesd, 0))
- X goto FUNC_RETURN;
- X }
- X
- X if (!push_directory((arg_present) ? tesd->pb : "", arg_present, 1))
- X {
- X param->index = param->old_index;
- X erc = eFATAL_ALREADY;
- X }
- X
- X FUNC_RETURN:
- X if (tesd)
- X esdfree(tesd);
- X return (erc);
- X
- X} /* end of pcmd_pushd */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_popd(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_popd(param)
- XESD *param;
- X{
- X int erc = 0;
- X int arg_present;
- X char allstr[8];
- X
- X allstr[0] = 0;
- X if (arg_present = !!end_of_cmd(param))
- X {
- X if (get_alpha_zstr(param, allstr, sizeof(allstr)))
- X {
- X param->index = param->old_index;
- X return (eSyntaxError);
- X }
- X }
- X
- X if (!pop_directory(allstr, arg_present, 1))
- X {
- X param->index = param->old_index;
- X erc = eFATAL_ALREADY;
- X }
- X
- X return (erc);
- X
- X} /* end of pcmd_popd */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_clrx(param)
- X--------------------------------------------------------------------------*/
- X/*ARGSUSED*/
- Xint
- Xpcmd_clrx(param)
- XESD *param;
- X{
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X lclear_xmtr_xoff();
- X if (proc_trace)
- X pputs("transmitter XOFF cleared\n");
- X return (0);
- X} /* end of pcmd_clrx */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_dcdwatch(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_dcdwatch(param)
- XESD *param;
- X{
- X int erc;
- X char s16[16];
- X char *cptr;
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X if (erc = get_alpha_zstr(param, s16, sizeof(s16)))
- X return (erc);
- X
- X erc = (ldcdwatch_str(s16)) ? eSyntaxError : 0;
- X if (!erc && proc_trace)
- X {
- X pputs("DCD watch set to ");
- X cptr = "???";
- X switch (shm->Ldcdwatch)
- X {
- X case DCDW_OFF:
- X cptr = "off";
- X break;
- X case DCDW_ON:
- X cptr = "on";
- X break;
- X case DCDW_TERMINATE:
- X cptr = "TERMINATE";
- X break;
- X }
- X pprintf("%s\n", cptr);
- X }
- X return (0);
- X
- X} /* end of pcmd_dcdwatch */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_dial(param) - connect to a remote DTE or to local DCE
- X
- X sets I0 to 0==connect,
- X 1==failed to connect,
- X 2==interrupted,
- X 3==modem error
- X sets S0 to modem result code
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_dial(param)
- XESD *param;
- X{
- X int erc;
- X ESD *tesd = (ESD *) 0;
- X
- X if (shm->Lconnected)
- X {
- X pprintf("Already connected (to %s)\n", shm->Llogical);
- X return (eFATAL_ALREADY);
- X }
- X
- X if (!(tesd = esdalloc(64)))
- X return (eNoMemory);
- X
- X if (erc = gstr(param, tesd, 0))
- X {
- X esdfree(tesd);
- X return (erc);
- X }
- X
- X if ((erc = call_logical_telno(tesd->pb)) && (erc == eConnectFailed))
- X erc = 0;
- X
- X if (!erc && (shm->Liofd < 0))
- X erc = eNoLineAttached;
- X
- X esdfree(tesd);
- X
- X return (erc);
- X} /* end of pcmd_dial */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_duplex(param)
- X
- Xduplex [f | h]
- Xduplex ['f' | 'h']
- Xduplex <int> 0 == half, non-0 == full
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_duplex(param)
- XESD *param;
- X{
- X int erc;
- X int new_duplex;
- X ESD *tesd;
- X
- X if (erc = skip_cmd_break(param))
- X return (erc);
- X if (!(tesd = esdalloc(64)))
- X return (eNoMemory);
- X erc = gstr(param, tesd, 0);
- X new_duplex = to_lower((erc) ? param->pb[param->index] : *tesd->pb);
- X esdfree(tesd);
- X erc = 0;
- X
- X switch (new_duplex)
- X {
- X case 'f':
- X shm->Lfull_duplex = 1;
- X break;
- X case 'h':
- X shm->Lfull_duplex = 0;
- X break;
- X default:
- X erc = eBadParameter;
- X }
- X if (proc_trace && !erc)
- X pprintf("duplex set to %s\n", (shm->Lfull_duplex) ? "full" : "half");
- X return (erc);
- X
- X} /* end of pcmd_duplex */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_echo(param)
- Xecho [-n] <str>
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_echo(param)
- XESD *param;
- X{
- X int erc;
- X ESD *tesd;
- X char switches[8];
- X
- X if (!(tesd = esdalloc(ESD_NOMSZ)))
- X return (eNoMemory);
- X
- X get_switches(param, switches, sizeof(switches));
- X
- X if (erc = gstr(param, tesd, 1))
- X {
- X esdfree(tesd);
- X return (erc);
- X }
- X pputs(tesd->pb);
- X if (!strchr(switches, 'n')) /* if no -n */
- X pputs("\n");
- X esdfree(tesd);
- X return (0);
- X
- X} /* end of pcmd_echo */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_exec(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_exec(param)
- XESD *param;
- X{
- X int erc = 0;
- X ESD *tesd = (ESD *) 0;
- X
- X if (!(tesd = esdalloc(64)))
- X return (eNoMemory);
- X if (erc = gstr(param, tesd, 1))
- X goto FUNC_RETURN;
- X
- X /* reset indices */
- X tesd->index = 0;
- X tesd->old_index = 0;
- X
- X if (proc_trace)
- X pprintf("executing: <%s>\n", tesd->pb);
- X if (erc = execute_esd(tesd))
- X {
- X esdshow(tesd, "error executing dynamic statement:");
- X proc_error(erc);
- X erc = eFATAL_ALREADY;
- X }
- X
- X FUNC_RETURN:
- X if (tesd)
- X esdfree(tesd);
- X return (erc);
- X
- X} /* end of pcmd_exec */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_exit(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_exit(param)
- XESD *param;
- X{
- X long int1;
- X ulong colors_at_entry = colors_current;
- X
- X if (!gint(param, &int1) && int1)
- X {
- X setcolor(colors_error);
- X pprintf("[procedure terminating ecu: user code %ld]\n", int1);
- X setcolor(colors_at_entry);
- X if ((int1 += TERMECU_USER1 - 1) > TERMECU_USERN)
- X {
- X int1 = TERMECU_USERN;
- X pprintf("user exit code too large, using %d\r\n",
- X TERMECU_USERN - TERMECU_USER1);
- X }
- X termecu((int)int1);
- X }
- X setcolor(colors_success);
- X pputs("[procedure terminating ecu: normal exit]\n");
- X setcolor(colors_at_entry);
- X termecu(0);
- X} /* end of pcmd_exit */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_lgets(param)
- X
- Xlgets [-er] <strvar> <int1> <int2> [<str>]
- X
- Xread string into string variable number <stvar>
- Xwaiting <int1> 1/10th secs for first char,
- Xwaiting <int2> 1/10th secs for subsequent chars,
- Xoptionally terminating read upon detection of <str>
- X-e echos to screen
- X-r completely raw, else strip CRs & NLs from either end of string
- X$i0 receives the length of the read
- X$i1 receives 1 if your specified delimiter was read, else zero
- X<strvar> receives the string
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_lgets(param)
- XESD *param;
- X{
- X int erc;
- X long int2;
- X long int3;
- X ESD *tesd1 = (ESD *) 0;
- X ESD *svptr;
- X LRWT lr;
- X char switches[8];
- X ESD *esdalloc();
- X char ctmp;
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X get_switches(param, switches, sizeof(switches));
- X
- X skip_cmd_char(param, '$');
- X if (erc = get_cmd_char(param, &ctmp))
- X return (erc);
- X if (to_lower(ctmp) != 's')
- X return (eIllegalVarType);
- X if (erc = get_svptr(param, &svptr, 1))
- X return (erc);
- X
- X if (erc = gint(param, &int2))
- X return (erc);
- X
- X if (erc = gint(param, &int3))
- X return (erc);
- X
- X if (!(tesd1 = esdalloc(64)))
- X return (eNoMemory);
- X if (gstr(param, tesd1, 1)) /* optional delimiter */
- X {
- X esdfree(tesd1);
- X tesd1 = (ESD *) 0;
- X }
- X
- X esdzero(svptr); /* no characters read yet */
- X iv[0] = 0; /* no characters read yet */
- X iv[1] = 0; /* no delim detected yet */
- X
- X lr.to1 = int2 * 100L;
- X lr.to2 = int3 * 100L;
- X /* allow interrupts + raw read per -r */
- X lr.raw_flag = (strchr(switches, 'r')) ? 0x81 : 0x80;
- X lr.buffer = svptr->pb;
- X lr.bufsize = svptr->maxcb;
- X lr.delim = (tesd1) ? tesd1->pb : (char *)0;
- X lr.echo_flag = (strchr(switches, 'e') != (char *)0);
- X
- X if (proc_trace)
- X {
- X pprintf("lgets (to1=%ld,to2=%ld) started at %s\n",
- X lr.to1, lr.to2,
- X get_time_plus_msec());
- X }
- X
- X (void)lgets_timeout(&lr);
- X if (tesd1)
- X esdfree(tesd1);
- X
- X svptr->cb = lr.count;
- X esd_null_terminate(svptr);
- X iv[0] = (long)lr.count;
- X iv[1] = (long)lr.got_delim;
- X if (zero_length_read_detected)
- X {
- X zero_length_read_detected = 0;
- X erc = eProcAttn_DCDloss;
- X }
- X if (proc_trace)
- X {
- X pprintf("lgets ended at %s (read %d chars)\n",
- X get_time_plus_msec(), lr.count);
- X }
- X return (erc);
- X
- X} /* end of pcmd_lgets */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_flush(param)
- X--------------------------------------------------------------------------*/
- X/*ARGSUSED*/
- Xint
- Xpcmd_flush(param)
- XESD *param;
- X{
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X lflush(2);
- X if (proc_trace)
- X pputs("line flushed\n");
- X return (0);
- X} /* end of pcmd_flush */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_hangup(param)
- X--------------------------------------------------------------------------*/
- X/*ARGSUSED*/
- Xint
- Xpcmd_hangup(param)
- XESD *param;
- X{
- X if (shm->Liofd < 0)
- X {
- X if (proc_trace)
- X pputs("no line attached ... hangup ignored\n");
- X DCE_now_on_hook();
- X return (0);
- X }
- X
- X if (proc_trace)
- X pputs("hanging up ... ");
- X DCE_hangup();
- X if (proc_trace)
- X pputs("line on hook\n");
- X return (0);
- X} /* end of pcmd_hangup */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_hexdump(param)
- X
- Xhexdump [-s] <str>
- Xhexdump -t[s] <str1> <str>
- X<str> buf to dump
- X<str1> title (if -t)
- X-s short (terse) dump
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_hexdump(param)
- XESD *param;
- X{
- X int erc;
- X ESD *title = 0;
- X ESD *tesd = 0;
- X char switches[8];
- X extern FILE *plog_fp;
- X
- X if (!(tesd = esdalloc(ESD_NOMSZ)))
- X return (eNoMemory);
- X
- X get_switches(param, switches, sizeof(switches));
- X
- X if (strchr(switches, 't')) /* if -t */
- X {
- X if (!(title = esdalloc(ESD_NOMSZ)))
- X {
- X erc = eNoMemory;
- X goto FUNC_RETURN;
- X }
- X if (erc = gstr(param, title, 0))
- X goto FUNC_RETURN;
- X }
- X
- X if (erc = gstr(param, tesd, 1))
- X goto FUNC_RETURN;
- X
- X hex_dump(tesd->pb, tesd->cb, (title) ? title->pb : "",
- X (strchr(switches, 's')) ? 1 : 0);
- X
- X if (plog_fp)
- X hex_dump_fp(plog_fp, tesd->pb, tesd->cb, (title) ? title->pb : "",
- X (strchr(switches, 's')) ? 1 : 0);
- X
- X FUNC_RETURN:
- X if (tesd)
- X esdfree(tesd);
- X if (title)
- X esdfree(title);
- X return (erc);
- X
- X} /* end of pcmd_hexdump */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_lbreak(param)
- X--------------------------------------------------------------------------*/
- X/*ARGSUSED*/
- Xint
- Xpcmd_lbreak(param)
- XESD *param;
- X{
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X lbreak();
- X return (0);
- X} /* end of pcmd_lbreak */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_logevent(param)
- X
- Xlogevent 'cmd'
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_logevent(param)
- XESD *param;
- X{
- X int erc;
- X ESD *eventstr;
- X char switches[8];
- X
- X if (!(eventstr = esdalloc(ESD_NOMSZ)))
- X return (eNoMemory);
- X
- X get_switches(param, switches, sizeof(switches));
- X
- X/* a hack */
- X strcpy(eventstr->pb, "PROC ");
- X eventstr->pb += 5;
- X eventstr->maxcb -= 5;
- X
- X if (erc = gstr(param, eventstr, 0))
- X {
- X eventstr->pb -= 5; /* be nice */
- X eventstr->maxcb += 5;/* or surely this will haunt us one day */
- X esdfree(eventstr);
- X return (erc);
- X }
- X
- X/* rehack */
- X eventstr->pb -= 5;
- X eventstr->maxcb += 5;
- X eventstr->cb += 5;
- X
- X ecu_log_event(getpid(), eventstr->pb);
- X esdfree(eventstr);
- X return (0);
- X
- X} /* end of eventstr_logevent */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_lookfor(param)
- X
- Xlookfor [-e] [quiet | <str>] [<int>]
- X
- X-e echo to screen while looking
- Xquiet means look for quiet
- X<str> means look for string
- X<int> number 1/10ths secs (default 5.0 second) for timeout
- X
- Xin case of lookfor <str>, $i0 plugged 1 if found, else 0
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_lookfor(param)
- XESD *param;
- X{
- X int erc;
- X char switches[8];
- X char *cptr = (char *)0;
- X ESD *tesd = (ESD *) 0;
- X ulong decisecs = 50; /* default wait is 5 seconds */
- X int echo_flag;
- X char s8[8];
- X long start_secs;
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X get_switches(param, switches, sizeof(switches));
- X echo_flag = (strchr(switches, 'e') != (char *)0);
- X
- X if (!get_alpha_zstr(param, s8, sizeof(s8)))
- X {
- X if (strcmp(s8, "quiet"))
- X return (eSyntaxError);
- X }
- X else
- X {
- X if (!(tesd = esdalloc(ESD_NOMSZ)))
- X return (eNoMemory);
- X if (erc = gstr(param, tesd, 0))
- X goto FUNC_RETURN;
- X if (!tesd->cb)
- X {
- X pputs("lookfor null string\n");
- X erc = eFATAL_ALREADY;
- X goto FUNC_RETURN;
- X }
- X cptr = tesd->pb;
- X }
- X
- X if (erc = gint(param, &decisecs))
- X {
- X /* if something there non-integer */
- X if (!end_of_cmd(param))
- X {
- X erc = eSyntaxError;
- X goto FUNC_RETURN;
- X }
- X }
- X erc = 0;
- X
- X if (proc_trace)
- X time(&start_secs);
- X
- X if (cptr)
- X {
- X iv[0] = (long)llookfor(cptr, decisecs * 100L, echo_flag);
- X if (proc_trace)
- X pprintf("lookfor set $i00 = %ld\n", iv[0]);
- X }
- X else
- X lquiet(decisecs * 100L, echo_flag);
- X
- X if (proc_trace)
- X pprintf("waited %ld secs\n", time((long *)0) - start_secs);
- X
- X FUNC_RETURN:
- X if (tesd)
- X esdfree(tesd);
- X if (zero_length_read_detected)
- X {
- X zero_length_read_detected = 0;
- X erc = eProcAttn_DCDloss;
- X }
- X return (erc);
- X
- X} /* end of pcmd_lookfor */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_nap(param)
- Xnap [-m] <int>
- X<int> number 1/10ths secs, except if -m, nap <int> milliseconds
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_nap(param)
- XESD *param;
- X{
- X int erc;
- X char switches[8];
- X ulong interval;
- X
- X get_switches(param, switches, sizeof(switches));
- X
- X if (erc = gint(param, &interval))
- X return (erc);
- X if (interval)
- X {
- X if (!strchr(switches, 'm'))
- X interval *= 100L;
- X if (interval < hzmsec) /* SCO nap bug */
- X interval = hzmsec; /* SCO nap bug */
- X if (proc_trace && (interval > 100)) /* short naps hurt by pprintf */
- X pprintf("nap %ld msec\n", interval);
- X if (Nap(interval) == -1) /* EINTR is the only error returned
- X * ... */
- X { /* but check anyway */
- X if (errno == EINTR)
- X erc = eCONINT;
- X }
- X }
- X return (erc);
- X} /* end of pcmd_nap */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_nice(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_nice(param)
- XESD *param;
- X{
- X long new_nice;
- X int erc;
- X int old_nice;
- X int nice();
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X if (erc = gint(param, &new_nice))
- X return (erc);
- X if ((new_nice < 0) || (new_nice > 39))
- X {
- X pprintf("warning: invalid nice %ld ignored (valid range 0-39)\n",
- X new_nice);
- X return (0);
- X }
- X
- X old_nice = nice(0) + 20;
- X nice(-old_nice + (int)new_nice);
- X
- X if (proc_trace)
- X pprintf("nice desired %u, set to %u\n", (uint) new_nice, nice(0) + 20);
- X return (0);
- X
- X} /* end of pcmd_nice */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_parity(param)
- Xparity [e | o | n]
- Xparity ['e' | 'o' | 'n']
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_parity(param)
- XESD *param;
- X{
- X int erc;
- X int new_parity = 0;
- X ESD *tesd;
- X char s64[64];
- X
- X if (erc = skip_cmd_break(param))
- X return (erc);
- X if (!(tesd = esdalloc(64)))
- X return (eNoMemory);
- X if (!gstr(param, tesd, 0))
- X new_parity = to_lower(*tesd->pb);
- X else if (!get_alpha_zstr(param, s64, sizeof(s64)))
- X new_parity = to_lower(s64[0]);
- X else
- X {
- X erc = eSyntaxError;
- X goto FUNC_RETURN;
- X }
- X esdfree(tesd);
- X
- X switch (new_parity)
- X {
- X case 'n':
- X new_parity = 0;
- X case 'e':
- X case 'o':
- X shm->Lparity = new_parity;
- X if (shm->Liofd < 0)
- X lset_parity(1);
- X break;
- X default:
- X erc = eBadParameter;
- X }
- X if (proc_trace && !erc)
- X {
- X pprintf("parity set to %s\n",
- X (shm->Lparity) ? ((shm->Lparity == 'e') ? "even" : "odd")
- X : "none");
- X }
- X
- X FUNC_RETURN:
- X esdfree(tesd);
- X return (erc);
- X
- X} /* end of pcmd_parity */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_prompt(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_prompt(param)
- XESD *param;
- X{
- X extern ESD *icmd_prompt;
- X
- X return (gstr(param, icmd_prompt, 0));
- X} /* end of pcmd_prompt */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_ptrace(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_ptrace(param)
- XESD *param;
- X{
- X char s8[8];
- X
- X if (get_alpha_zstr(param, s8, sizeof(s8)))
- X return (eSyntaxError);
- X if (isdigit(s8[0]))
- X proc_trace = atoi(s8);
- X if (!strcmp(s8, "on"))
- X proc_trace = 1;
- X else if (!strcmp(s8, "off"))
- X proc_trace = 0;
- X else
- X return (eSyntaxError);
- X return (0);
- X} /* end of pcmd_ptrace */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_rname(param) - set remote name
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_rname(param)
- XESD *param;
- X{
- X int itmp;
- X int erc = 0;
- X ESD *rname = 0;
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X if (!shm->Lconnected)
- X {
- X pputs("Not connected\n");
- X return (eFATAL_ALREADY);
- X }
- X
- X /*
- X * get temp for rname param (all exits after here must go through
- X * FUNC_RETURN)
- X */
- X if (!(rname = esdalloc(ESD_NOMSZ)))
- X return (eNoMemory);
- X
- X if (erc = gstr(param, rname, 0))
- X goto FUNC_RETURN;
- X
- X if (rname->cb > (itmp = sizeof(shm->Lrname) - 1))
- X {
- X pprintf("rname may only be %d characters long\n", itmp);
- X erc = eFATAL_ALREADY;
- X goto FUNC_RETURN;
- X }
- X
- X strcpy(shm->Lrname, rname->pb);
- X if (proc_trace)
- X pprintf("rname set to '%s'\n", rname->pb);
- X
- X FUNC_RETURN:
- X if (rname)
- X esdfree(rname);
- X return (erc);
- X
- X} /* end of pcmd_rname */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_send(param)
- Xsend [-n] <str>
- X-n do not send trailing CR
- X-v turn on proc_trace for just this statement
- X-p## pace characters ## msec apart
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_send(param)
- XESD *param;
- X{
- X int erc;
- X char *cptr;
- X ESD *buf;
- X char switches[32];
- X int send_cr;
- X int tell_it;
- X long pace_msec = 0L;
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X if ((buf = esdalloc(ESD_NOMSZ)) == (ESD *) 0)
- X return (eNoMemory);
- X
- X get_switches(param, switches, sizeof(switches));
- X send_cr = !strchr(switches, 'n');
- X tell_it = !!strchr(switches, 'v');
- X if (cptr = strchr(switches, 'p'))
- X sscanf(cptr + 1, "%ld", &pace_msec);
- X
- X if (erc = gstr(param, buf, 1))
- X {
- X esdfree(buf);
- X return (erc);
- X }
- X
- X if (proc_trace || tell_it)
- X {
- X hex_dump(buf->pb, buf->cb,
- X (send_cr) ? "send with CR" : "send w/o CR", 1);
- X }
- X
- X if (pace_msec)
- X lputs_paced(pace_msec, buf->pb);
- X else
- X lputs(buf->pb);
- X
- X if (send_cr)
- X lputc(CRET);
- X if (pace_msec)
- X Nap(pace_msec);
- X
- X esdfree(buf);
- X return (erc);
- X} /* end of pcmd_send */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_set(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_set(param)
- XESD *param;
- X{
- X int erc;
- X int itmp;
- X ulong varnum;
- X uint varmax;
- X char vartype;
- X char varstr[16];
- X int show_status;
- X long *ivptr;
- X ESD *svptr;
- X char *cptr;
- X char *make_char_graphic();
- X
- X if (erc = skip_cmd_break(param))
- X return (erc);
- X
- X do
- X {
- X
- X /* $ is optional */
- X if ((erc = skip_cmd_char(param, '$')) && (erc != eSyntaxError))
- X return (erc);
- X
- X /* get variable type */
- X if (get_cmd_char(param, &vartype))
- X return (eSyntaxError);
- X
- X /* validate variable type */
- X vartype = to_lower(vartype);
- X switch (vartype)
- X {
- X case 'i':
- X varmax = IVQUAN;
- X break;
- X case 's':
- X varmax = SVQUAN;
- X break;
- X default:
- X return (eIllegalVarType);
- X }
- X
- X if (!get_numeric_value(param, &varnum))
- X goto TEST_VARNUM;
- X else if (*(param->pb + param->index) == '[')
- X {
- X if (erc = get_subscript(param, &varnum))
- X return (erc);
- X TEST_VARNUM:
- X if ((int)varnum >= varmax)
- X return (eIllegalVarNumber);
- X switch (vartype)
- X {
- X case 'i':
- X ivptr = &iv[(int)varnum];
- X break;
- X default:
- X svptr = sv[(int)varnum];
- X }
- X }
- X else if (get_alphanum_zstr(param, varstr, sizeof(varstr)))
- X return (eInvalidVarName);
- X else
- X {
- X varnum = NAMED_VARIABLE_FLAG;
- X switch (vartype)
- X {
- X case 'i':
- X erc = find_mkvi(varstr, &ivptr, 1);
- X break;
- X default:
- X erc = find_mkvs(varstr, &svptr, 1);
- X }
- X if (erc)
- X return (erc);
- X }
- X
- X show_status = 1;
- X if (!skip_cmd_char(param, '=')) /* assignment */
- X {
- X switch (vartype)
- X {
- X case 'i':
- X if (erc = gint(param, ivptr))
- X return (erc);
- X break;
- X default:
- X if (erc = gstr(param, svptr, 1))
- X return (erc);
- X break;
- X }
- X if (!proc_trace)
- X show_status = 0;
- X }
- X if (show_status)
- X {
- X switch (vartype)
- X {
- X case 'i':
- X if (varnum != NAMED_VARIABLE_FLAG)
- X pprintf("$i%02ld = %7ld (0x%08lx,0%03lo", varnum,
- X *ivptr, *ivptr, *ivptr);
- X else
- X pprintf("$i%s = %ld (0x%08lx,0%03lo", varstr,
- X *ivptr, *ivptr, *ivptr);
- X if ((*ivptr >= 0) && (*ivptr <= 255))
- X pprintf(",'%s'", make_char_graphic((char)*ivptr, 1));
- X pputs(")\n");
- X break;
- X default:
- X if (varnum != NAMED_VARIABLE_FLAG)
- X pprintf("$s%02ld = '", varnum);
- X else
- X pprintf("$s%s = '", varstr);
- X itmp = svptr->cb;
- X cptr = svptr->pb;
- X while (itmp--)
- X pputs(make_char_graphic(*cptr++, 0));
- X pputs("'\n");
- X break;
- X }
- X }
- X }
- X while (!skip_comma(param));
- X
- X if (!end_of_cmd(param))
- X return (eSyntaxError);
- X
- X return (0);
- X} /* end of pcmd_set */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_system(param)
- X
- Xsystem [-l] 'cmd'
- X-l makes comm line stdin/stdout
- X-s keeps all fds the same
- X
- Xreturns $i0 set to exit status of program or 0x100 if interrupted
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_system(param)
- XESD *param;
- X{
- X int erc;
- X ESD *cmd;
- X extern int last_child_wait_status;
- X char switches[8];
- X
- X if ((cmd = esdalloc(ESD_NOMSZ)) == (ESD *) 0)
- X return (eNoMemory);
- X
- X get_switches(param, switches, sizeof(switches));
- X
- X/* a hack */
- X *cmd->pb++ = (strchr(switches, 's')) ? '>' :
- X ((strchr(switches, 'l')) ? '$' : '!');
- X
- X cmd->maxcb--;
- X
- X if (erc = gstr(param, cmd, 1))
- X {
- X cmd->pb--; /* be nice */
- X cmd->maxcb++; /* or surely this will haunt us one day */
- X esdfree(cmd);
- X return (erc);
- X }
- X
- X/* rehack */
- X cmd->pb--;
- X cmd->cb++;
- X cmd->maxcb++;
- X
- X if (proc_trace)
- X {
- X pputs(cmd->pb + 1);
- X pputs("\n");
- X }
- X
- X last_child_wait_status = 0xFF00;
- X shell(cmd->pb);
- X iv[0] = (last_child_wait_status & 0xFF)
- X ? 0x100L : (long)last_child_wait_status >> 8;
- X if (proc_trace)
- X pprintf("$i0 = %ld, (%s)\n", iv[0],
- X (iv[0] == 0x100L) ? "interrupted" : "program exit status");
- X
- X esdfree(cmd);
- X return (0);
- X} /* end of pcmd_system */
- X
- X/*+-------------------------------------------------------------------------
- X get_big_endian_16(ptr)
- X--------------------------------------------------------------------------*/
- Xushort
- Xget_big_endian_16(ptr)
- Xregister uchar *ptr;
- X{
- X register ushort uint16 = ((ushort) ptr[0] << 8) | ptr[1];
- X
- X return (uint16);
- X
- X} /* end of get_big_endian_16 */
- X
- X/*+-------------------------------------------------------------------------
- X get_big_endian_32(ptr)
- X--------------------------------------------------------------------------*/
- Xulong
- Xget_big_endian_32(ptr)
- Xregister uchar *ptr;
- X{
- X register ulong uint32 = ((ulong) * ptr++) << 24;
- X
- X uint32 |= ((ulong) * ptr++) << 16;
- X uint32 |= ((ulong) * ptr++) << 8;
- X uint32 |= (ulong) * ptr++;
- X return (uint32);
- X
- X} /* end of get_big_endian_32 */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_getf(param) - get friend memory
- X
- Xgetf -x <int-var-spec> <offset>
- Xwhere: -x ==
- X -b byte
- X -w word (little-endian)
- X -W word (big-endian)
- X -l 32-bits (little-endian)
- X -L 32-bits (big-endian)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_getf(param)
- XESD *param;
- X{
- X int erc;
- X char switches[8];
- X long *piv;
- X long offset;
- X int size;
- X int big_endian;
- X
- X if (erc = get_switches(param, switches, sizeof(switches)))
- X return (erc);
- X if ((strlen(switches) != 2) || !strchr("bwWlL", switches[1]))
- X {
- X pputs("invalid switch\n");
- X return (eFATAL_ALREADY);
- X }
- X size = to_lower(switches[1]);
- X big_endian = isupper(switches[1]);
- X
- X/*
- X if(!get_svptr(param,&psv))
- X return(eNotImplemented);
- X else
- X*/
- X if (!strncmp(param->pb + param->index, "$i", 2))
- X param->index += 2;
- X if (erc = get_ivptr(param, &piv, 1))
- X return (erc);
- X
- X if (erc = gint(param, &offset))
- X return (erc);
- X
- X if (proc_trace)
- X pprintf("getf %s offset=0x%lx", switches, offset);
- X
- X switch (size)
- X {
- X case 'b':
- X if (offset > ((long)sizeof(shm->friend_space) - 1))
- X goto OFFSET_TOO_LARGE;
- X *piv = *(((uchar *) shm->friend_space) + (int)offset) & 0xFF;
- X break;
- X case 'w':
- X if (offset > ((long)sizeof(shm->friend_space) - 2))
- X goto OFFSET_TOO_LARGE;
- X if (big_endian)
- X *piv = get_big_endian_16((uchar *) shm->friend_space +
- X (int)offset);
- X else
- X *piv = *(((ushort *) shm->friend_space) + (int)offset) & 0xFFFF;
- X break;
- X case 'l':
- X if (offset > ((long)sizeof(shm->friend_space) - 4))
- X goto OFFSET_TOO_LARGE;
- X if (big_endian)
- X {
- X *piv = get_big_endian_32((uchar *) shm->friend_space +
- X (int)offset);
- X }
- X else
- X *piv = *((long *)((char *)shm->friend_space + (int)offset));
- X break;
- X }
- X
- X if (proc_trace)
- X pprintf(" value=%ld (%08lx)\n", *piv, *piv);
- X return (0);
- X
- X OFFSET_TOO_LARGE:
- X if (proc_trace)
- X pputs("\n");
- X pprintf("offset 0x%02lx too large for -%c (0x%02x bytes available)\n",
- X offset, switches[1], sizeof(shm->friend_space));
- X return (eFATAL_ALREADY);
- X
- X} /* end of pcmd_getf */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_putf(param)
- X--------------------------------------------------------------------------*/
- X/*ARGSUSED*/
- Xint
- Xpcmd_putf(param)
- XESD *param;
- X{
- X return (eNotImplemented);
- X} /* end of pcmd_putf */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_xon(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_xon(param)
- XESD *param;
- X{
- X int erc;
- X char new_xonxoff[8];
- X char *xon_status();
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X if (erc = get_alpha_zstr(param, new_xonxoff, sizeof(new_xonxoff)))
- X return (erc);
- X
- X if (set_xon_xoff_by_arg(new_xonxoff))
- X return (eBadParameter);
- X
- X if (proc_trace)
- X pprintf("xon/xoff flow control set to %s\n", xon_status());
- X
- X return (erc);
- X
- X} /* end of pcmd_xon */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_rtscts(param)
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_rtscts(param)
- XESD *param;
- X{
- X int erc;
- X char new_rtscts[8];
- X
- X if (shm->Liofd < 0)
- X return (eNoLineAttached);
- X
- X if (erc = get_alphanum_zstr(param, new_rtscts, sizeof(new_rtscts)))
- X return (erc);
- X
- X#if defined(HW_FLOW_CONTROL) /* see ecu.h */
- X lRTSCTS_control(yes_or_no(new_rtscts));
- X
- X if (proc_trace)
- X display_hw_flow_config();
- X#else
- X if (proc_trace)
- X pprintf("hardware flow control not available .... rtscts ignored\n");
- X#endif /* RTSFLOW */
- X
- X return (erc);
- X} /* end of pcmd_rtscts */
- X
- X/*+-------------------------------------------------------------------------
- X pcmd_setline(param) - _rc.ep setline command
- X
- XThis command can be used to set the initial line in _rc.ep
- X--------------------------------------------------------------------------*/
- Xint
- Xpcmd_setline(param)
- XESD *param;
- X{
- X int erc;
- X ESD *tesd;
- X
- X if (rc_ep_has_run)
- X {
- X pprintf("command legal only in _rc.ep\n");
- X return (eFATAL_ALREADY);
- X }
- X
- X if (!(tesd = esdalloc(sizeof(shm->Lline))))
- X return (eNoMemory);
- X if (erc = gstr(param, tesd, 0))
- X goto FUNC_RETURN;
- X shm->Lline[0] = 0;
- X if (strncmp(tesd->pb, "/dev/", 5))
- X strcat(shm->Lline, "/dev/");
- X strncat(shm->Lline, tesd->pb, sizeof(shm->Lline) - strlen(shm->Lline));
- X shm->Lline[sizeof(shm->Lline) - 1] = 0;
- X if (proc_trace)
- X pprintf("line set to %s\n", shm->Lline);
- X
- X FUNC_RETURN:
- X esdfree(tesd);
- X return (erc);
- X} /* end of pcmd_setline */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- X/* end of pcmd.c */
- END_OF_FILE
- if test 33339 -ne `wc -c <'ecu330/pcmd.c'`; then
- echo shar: \"'ecu330/pcmd.c'\" unpacked with wrong size!
- fi
- # end of 'ecu330/pcmd.c'
- fi
- echo shar: End of archive 17 \(of 37\).
- cp /dev/null ark17isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 37 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-