home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / pcomm202 / part01 < prev    next >
Encoding:
Text File  |  1993-04-13  |  104.1 KB  |  4,085 lines

  1. Newsgroups: comp.sources.unix
  2. From: fthood!egray@uxc.cso.uiuc.edu (Emmet Gray)
  3. Subject: v26i153: pcomm-2.0.2 - a serial communications program (clone of ProComm), Part01/06
  4. Sender: unix-sources-moderator@vix.com
  5. Approved: paul@vix.com
  6.  
  7. Submitted-By: fthood!egray@uxc.cso.uiuc.edu (Emmet Gray)
  8. Posting-Number: Volume 26, Issue 153
  9. Archive-Name: pcomm-2.0.2/part01
  10.  
  11. This package will supercede Pcomm v1.2.4 that appeared in comp.sources.unix
  12. as v20i067 thru v20i075 around the 27th of October 1989.
  13.  
  14. Pcomm is a public domain, menu driven, telecommunication program for Unix
  15. designed to operate similarily to the popular MSDOS program, ProComm.  Some
  16. of its features are:
  17.  
  18.     o Large dialing directory
  19.     o Full scripting feature
  20.     o Automatic redial feature
  21.     o Six built-in file transfer protocols
  22.     o External file transfer program support
  23.     o Data logging (log of the terminal session)
  24.     o Printer logging
  25.     o Screen dump to file
  26.     o Shell escapes to Unix
  27.     o Help screen
  28.     o Keyboard macros
  29.     o User customization
  30.     o Optional modem configuration per dialing directory entry
  31.     o Administrative logging of phone calls
  32.     o Administrative limits on long distance access
  33.  
  34. The following is a copy of the Pcomm help screen:
  35.  
  36.      Major Functions        Utility Functions        File Functions
  37.  
  38.     Dialing Directory. ^A-D  Program Info .... ^A-I  Send Files .... ^A-<up>
  39.     Auto Redial ...... ^A-R  Setup Screen .... ^A-S  Receive Files . ^A-<down>
  40.     Keyboard Macros .. ^A-M  Change Directory. ^A-B  Pass Thru Mode. ^A-T
  41.     Line Settings .... ^A-P  Clear Screen .... ^A-C  Directory ..... ^A-F
  42.     Exit Pcomm ....... ^A-X  Toggle Duplex ... ^A-E  Screen Dump ... ^A-G
  43.     Unix Gateway ..... ^A-4  Hang Up Phone ... ^A-H  Start Data Log. ^A-1
  44.     Script Commands .. ^A-5  Printer On/Off .. ^A-L  Toggle Log .... ^A-2
  45.                  Toggle CR-CR/LF . ^A-3
  46.                  Break Key ....... ^A-7
  47.  
  48. New in this release...
  49.  
  50.         1) Uses poll() or select() for faster operation with lower
  51.         CPU overhead.
  52.  
  53.         2) Configure.sh shell script that will glean information about
  54.         your system.
  55.  
  56.         3) New Q_and_A (questions and answers) file to provide help on
  57.         diagnosing common problems.
  58.  
  59.         4) "True" scripting capabilities.  Anything you can do from
  60.         inside Pcomm, you can also do from a script.
  61.  
  62.         5) Modem configuration per dialing directory entry.  This allows
  63.         you to tailor the modem to match what is expected at the other
  64.         end of the connection.
  65.  
  66.         6) Pcomm now supports DTE baud rates up to 38400 plus "connected"
  67.         baud rates for V.32bis (7200, 12000, and 14400).
  68.  
  69. Emmet P. Gray                US Army, HQ III Corps & Fort Hood
  70. ...!uunet!uiucuxc!fthood!egray        Attn: AFZF-DE-ENV
  71. fthood!egray@uxc.cso.uiuc.edu        Directorate of Engineering & Housing
  72.                     Environmental Management Office
  73.                     Fort Hood, TX 76544-5057
  74.  
  75. #! /bin/sh
  76. # This is a shell archive.  Remove anything before this line, then unpack
  77. # it by saving it into a file and typing "sh file".  To overwrite existing
  78. # files, type "sh file -c".  You can also feed this as standard input via
  79. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  80. # will see the following message at the end:
  81. #        "End of archive 1 (of 6)."
  82. # Contents:  Convert.sh MANIFEST Matches.1 Pcomm.dial_dir Pcomm.extrnl
  83. #   Pcomm.modem Pcomm.param README Release.notes Sample Waitfor.1
  84. #   chg_dir.c cmd.h config.h d_delete.c d_manual.c data_log.c
  85. #   di_delay.c dial_dir.h expand.c extrnl.h getcwd.c getopt.c help.c
  86. #   info.c init.c ipc.h ipc_att.c ipc_ucb.c list_dir.c matches.c
  87. #   misc.h modem.h n_shell.c param.h passthru.c patchlevel.h pexit.c
  88. #   redial.c screen.c st_line.c status.h vcs.h waitfor.c x_extrnl.c
  89. #   x_win.c xmodem.h
  90. # Wrapped by vixie@gw.home.vix.com on Wed Apr 14 00:38:40 1993
  91. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  92. if test -f 'Convert.sh' -a "${1}" != "-c" ; then 
  93.   echo shar: Will not clobber existing file \"'Convert.sh'\"
  94. else
  95. echo shar: Extracting \"'Convert.sh'\" \(778 characters\)
  96. sed "s/^X//" >'Convert.sh' <<'END_OF_FILE'
  97. X:
  98. echo This shell script will convert your pre-v2.0 Pcomm support files.
  99. echo You obviously must have write permissions on the files.
  100. echo 
  101. echo "Enter the directory where the files are found : \c"
  102. read DIR
  103. if [ ! -d "$DIR" ] ;then
  104. X    echo oops... \"$DIR\" is not a directory
  105. X    exit
  106. fi
  107. if [ ! -f "$DIR/pcomm.param" ] ;then
  108. X    echo humm... no pcomm.param support file found in \"$DIR\"
  109. X    exit
  110. fi
  111. cd $DIR
  112. echo editing pcomm.param...
  113. ex - pcomm.param << "EOF"
  114. X1,$s/D_DBITS=/D_DATA_BITS=/
  115. X1,$s/D_SBITS=/D_STOP_BITS=/
  116. X1,$s/^HOT=/HOT_KEY=/
  117. X1,$s/FLOW=/FLOW_CTRL=/
  118. X1,$s/LECHO=/LOCAL_ECHO=/
  119. w
  120. q
  121. XEOF
  122. if [ ! -f "$DIR/pcomm.modem" ] ;then
  123. X    echo humm... no pcomm.modem support file found in \"$DIR\"
  124. X    exit
  125. fi
  126. echo editing pcomm.modem...
  127. ex - pcomm.modem << "EOF"
  128. X1,$g/MODEM_[1-9]b=/s/$/;/
  129. w
  130. q
  131. XEOF
  132. END_OF_FILE
  133. if test 778 -ne `wc -c <'Convert.sh'`; then
  134.     echo shar: \"'Convert.sh'\" unpacked with wrong size!
  135. fi
  136. # end of 'Convert.sh'
  137. fi
  138. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  139.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  140. else
  141. echo shar: Extracting \"'MANIFEST'\" \(2997 characters\)
  142. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  143. X   File Name        Archive #    Description
  144. X-----------------------------------------------------------
  145. X Configure.sh               2    
  146. X Convert.sh                 1    
  147. X Doc.me                     6    
  148. X MANIFEST                   1    This shipping list
  149. X Makefile                   3    
  150. X Matches.1                  1    
  151. X Pcomm.1                    4    
  152. X Pcomm.dial_dir             1    
  153. X Pcomm.extrnl               1    
  154. X Pcomm.modem                1    
  155. X Pcomm.param                1    
  156. X Pcomm_cmd.1                2    
  157. X Q_and_A                    2    
  158. X README                     1    
  159. X Release.notes              1    
  160. X Sample                     1    
  161. X Unixpc.shar                5    
  162. X Waitfor.1                  1    
  163. X admin.c                    2    
  164. X chg_dir.c                  1    
  165. X cmd.c                      3    
  166. X cmd.h                      1    
  167. X config.h                   1    
  168. X curses.c                   4    
  169. X d_delete.c                 1    
  170. X d_lib.c                    3    
  171. X d_manual.c                 1    
  172. X d_menu.c                   3    
  173. X d_print.c                  2    
  174. X d_prompt.c                 2    
  175. X d_revise.c                 2    
  176. X data_log.c                 1    
  177. X di_delay.c                 1    
  178. X di_win.c                   4    
  179. X dial.c                     4    
  180. X dial_dir.h                 1    
  181. X e_lib.c                    2    
  182. X expand.c                   1    
  183. X extrnl.h                   1    
  184. X getcwd.c                   1    
  185. X getopt.c                   1    
  186. X help.c                     1    
  187. X info.c                     1    
  188. X init.c                     1    
  189. X input.c                    3    
  190. X ipc.h                      1    
  191. X ipc_att.c                  1    
  192. X ipc_ucb.c                  1    
  193. X list_dir.c                 1    
  194. X ls_menu.c                  2    
  195. X m_lib.c                    4    
  196. X macro.c                    2    
  197. X main.c                     4    
  198. X matches.c                  1    
  199. X misc.h                     1    
  200. X modem.h                    1    
  201. X n_shell.c                  1    
  202. X p_lib.c                    3    
  203. X param.h                    1    
  204. X passthru.c                 1    
  205. X patchlevel.h               1    
  206. X pcomm_cmd.c                5    
  207. X pexit.c                    1    
  208. X port.c                     5    
  209. X redial.c                   1    
  210. X s_axfer.c                  2    
  211. X s_extrnl.c                 2    
  212. X s_gen.c                    2    
  213. X s_menu.c                   2    
  214. X s_modem.c                  3    
  215. X s_prompt.c                 2    
  216. X s_term.c                   2    
  217. X s_tty.c                    2    
  218. X screen.c                   1    
  219. X script.c                   2    
  220. X st_line.c                  1    
  221. X status.h                   1    
  222. X strings.c                  2    
  223. X terminal.c                 3    
  224. X tty_att.c                  2    
  225. X tty_ucb.c                  2    
  226. X vcs.c                      4    
  227. X vcs.h                      1    
  228. X waitfor.c                  1    
  229. X x_ascii.c                  3    
  230. X x_batch.c                  3    
  231. X x_extrnl.c                 1    
  232. X x_menu.c                   3    
  233. X x_rcv.c                    4    
  234. X x_send.c                   4    
  235. X x_win.c                    1    
  236. X xmodem.c                   3    
  237. X xmodem.h                   1    
  238. END_OF_FILE
  239. if test 2997 -ne `wc -c <'MANIFEST'`; then
  240.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  241. fi
  242. # end of 'MANIFEST'
  243. fi
  244. if test -f 'Matches.1' -a "${1}" != "-c" ; then 
  245.   echo shar: Will not clobber existing file \"'Matches.1'\"
  246. else
  247. echo shar: Extracting \"'Matches.1'\" \(651 characters\)
  248. sed "s/^X//" >'Matches.1' <<'END_OF_FILE'
  249. X.TH matches L
  250. X.SH NAME
  251. matches \- test if string2 is contained in string1
  252. X.SH SYNOPSIS
  253. X.B matches string1 string2
  254. X.SH DESCRIPTION
  255. X.I Matches
  256. returns a 0 if string2 is contained in string1, otherwise it returns a 1.
  257. X.PP
  258. X.I Matches
  259. is designed to be used by
  260. X.I Pcomm
  261. inside a shell script for automating keyboard input to log user onto a
  262. remote system.
  263. X.PP
  264. X.SH EXAMPLE
  265. X.nf
  266. X.RS 5
  267. X# read some input
  268. read junk
  269. X# test to see the string matches 'login failed'
  270. matches $junk 'login failed'
  271. X# test the exit code of the matches command
  272. if [ $? \-eq 0 ]
  273. then
  274. X.RS 5
  275. X    exit 1
  276. X.RE
  277. fi
  278. X.RE
  279. X.fi
  280. X.SH "SEE ALSO"
  281. pcomm(1), pcomm_cmd(1), waitfor(1), Pcomm Reference Manual
  282. END_OF_FILE
  283. if test 651 -ne `wc -c <'Matches.1'`; then
  284.     echo shar: \"'Matches.1'\" unpacked with wrong size!
  285. fi
  286. # end of 'Matches.1'
  287. fi
  288. if test -f 'Pcomm.dial_dir' -a "${1}" != "-c" ; then 
  289.   echo shar: Will not clobber existing file \"'Pcomm.dial_dir'\"
  290. else
  291. echo shar: Extracting \"'Pcomm.dial_dir'\" \(333 characters\)
  292. sed "s/^X//" >'Pcomm.dial_dir' <<'END_OF_FILE'
  293. DIR_1=Abbey Road;1 (512) 590-6036;2400-N-8-1;F;
  294. DIR_2=Tel-Med-Com;555-8686;9600-E-7-1;F;TELEBIT_V.32
  295. DIR_3=C Board;1 (619) 722-8724;2400-N-8-1;F;
  296. DIR_4=Crest;1 (213) 471-2518;2400-N-8-1;F;Sample
  297. DIR_5=Last Chance;1 (219) 762-8411;2400-E-7-1;F;
  298. DIR_6=Killer;1 (214) 827-1994;1200-E-7-1;F;
  299. DIR_7=System A (direct);;19200-E-7-1;F;tty12
  300. END_OF_FILE
  301. if test 333 -ne `wc -c <'Pcomm.dial_dir'`; then
  302.     echo shar: \"'Pcomm.dial_dir'\" unpacked with wrong size!
  303. fi
  304. # end of 'Pcomm.dial_dir'
  305. fi
  306. if test -f 'Pcomm.extrnl' -a "${1}" != "-c" ; then 
  307.   echo shar: Will not clobber existing file \"'Pcomm.extrnl'\"
  308. else
  309. echo shar: Extracting \"'Pcomm.extrnl'\" \(113 characters\)
  310. sed "s/^X//" >'Pcomm.extrnl' <<'END_OF_FILE'
  311. SEND_1=zmodem;sz;Y
  312. SEND_2=kermit;kermit -ivs;Y
  313. SEND_3=;;N
  314. RCV_1=zmodem;rz;N
  315. RCV_2=kermit;kermit -ivr;Y
  316. RCV_3=;;N
  317. END_OF_FILE
  318. if test 113 -ne `wc -c <'Pcomm.extrnl'`; then
  319.     echo shar: \"'Pcomm.extrnl'\" unpacked with wrong size!
  320. fi
  321. # end of 'Pcomm.extrnl'
  322. fi
  323. if test -f 'Pcomm.modem' -a "${1}" != "-c" ; then 
  324.   echo shar: Will not clobber existing file \"'Pcomm.modem'\"
  325. else
  326. echo shar: Extracting \"'Pcomm.modem'\" \(826 characters\)
  327. sed "s/^X//" >'Pcomm.modem' <<'END_OF_FILE'
  328. TTY_1=tty10;HAYES;0
  329. TTY_2=tty11;HAYES;0
  330. TTY_3=tty12;DIRECT;0
  331. TTY_4=tty13;TELEBIT;38400
  332. TTY_5=tty13;TELEBIT_V.32;38400
  333. TTY_6=tty13;TELEBIT_PEP;38400
  334. MODEM_1a=HAYES;ATS7=60S11=70E0Q0V1X4&D2!;ATDT;!;~~+++~~ATH0!
  335. MODEM_1b=Y;CONNECT!;CONNECT 1200;CONNECT 2400;;;;
  336. MODEM_1c=BUSY;VOICE;NO CARRIER;
  337. MODEM_2a=DIRECT;;;;
  338. MODEM_2b=N;;;;;;;
  339. MODEM_2c=;;;
  340. MODEM_3a=TELEBIT;ATZ!~~;ATDT;!;~~+++~~ATH0!
  341. MODEM_3b=Y;CONNECT 300;CONNECT 1200;CONNECT 2400;CONNECT 4800;CONNECT 9600;CONNECT FAST;
  342. MODEM_3c=BUSY;ERROR;NO CARRIER;NO DIALTONE
  343. MODEM_4a=TELEBIT_V.32;ATZ!~~;ATS180=0S50=6DT;!;~~+++~~ATH0!
  344. MODEM_4b=Y;CONNECT 300;CONNECT 1200;CONNECT 2400;CONNECT 4800;CONNECT 9600;;
  345. MODEM_4c=BUSY;ERROR;NO CARRIER;NO DIALTONE
  346. MODEM_5a=TELEBIT_PEP;ATZ!~~;ATS50=255DT;!;~~+++~~ATH0!
  347. MODEM_5b=Y;;;;;;CONNECT FAST;
  348. MODEM_5c=BUSY;ERROR;NO CARRIER;NO DIALTONE
  349. END_OF_FILE
  350. if test 826 -ne `wc -c <'Pcomm.modem'`; then
  351.     echo shar: \"'Pcomm.modem'\" unpacked with wrong size!
  352. fi
  353. # end of 'Pcomm.modem'
  354. fi
  355. if test -f 'Pcomm.param' -a "${1}" != "-c" ; then 
  356.   echo shar: Will not clobber existing file \"'Pcomm.param'\"
  357. else
  358. echo shar: Extracting \"'Pcomm.param'\" \(487 characters\)
  359. sed "s/^X//" >'Pcomm.param' <<'END_OF_FILE'
  360. D_BAUD=1200
  361. D_PARITY=E
  362. D_DATA_BITS=7
  363. D_STOP_BITS=1
  364. HOT_KEY=1
  365. ASCII_HOT=^A
  366. D_DUPLEX=FULL
  367. XFLOW_CTRL=XON/XOFF
  368. CR_IN=CR
  369. CR_OUT=CR
  370. LOGFILE=pcomm.log
  371. DUMPFILE=pcomm.dump
  372. STRIP=YES
  373. PAUSE_CHAR=~
  374. CR_CHAR=!
  375. CTRL_CHAR=^
  376. XESC_CHAR=|
  377. BRK_CHAR=%
  378. ABORT=KEEP
  379. C_DELAY=35
  380. R_DELAY=5
  381. LOCAL_ECHO=NO
  382. XEXPAND=NO
  383. CR_DELAY=0
  384. PACE=NO
  385. CR_UP=NONE
  386. LF_UP=ADD CR
  387. TIMER=5
  388. CR_DN=STRIP
  389. LF_DN=NONE
  390. LD_PLUS=
  391. LD_MINUS=
  392. LD_AT=8,
  393. LD_POUND=9
  394. MAC_1=ls -alRF \| more!
  395. MAC_2=
  396. MAC_3=
  397. MAC_4=
  398. MAC_5=
  399. MAC_6=
  400. MAC_7=
  401. MAC_8=
  402. MAC_9=
  403. MAC_0=
  404. END_OF_FILE
  405. if test 487 -ne `wc -c <'Pcomm.param'`; then
  406.     echo shar: \"'Pcomm.param'\" unpacked with wrong size!
  407. fi
  408. # end of 'Pcomm.param'
  409. fi
  410. if test -f 'README' -a "${1}" != "-c" ; then 
  411.   echo shar: Will not clobber existing file \"'README'\"
  412. else
  413. echo shar: Extracting \"'README'\" \(14243 characters\)
  414. sed "s/^X//" >'README' <<'END_OF_FILE'
  415. X
  416. X                  Pcomm
  417. X              A Unix Telecommunication Program
  418. X
  419. Things to do first:
  420. X
  421. X    1) Figure out what files you need.  There is a shell archive
  422. X    called "Unixpc.shar" that contains additional (and replacement)
  423. X    files for users of the AT&T Unix PC 7300/3b1.
  424. X
  425. X    2) Create a default directory where the Pcomm support files will
  426. X    go.  A good location might be /usr/local/lib/pcomm.
  427. X
  428. X    3) Edit the Makefile to reflect the location of the default
  429. X    directory (PCOMM_LIB), the location of the executable programs
  430. X    (BIN_DIR), and the location and file extension of the on-line
  431. X    manuals (MAN_DIR) and (MAN_EXT).
  432. X
  433. X    4) Install the four sample support files Pcomm.dial_dir,
  434. X    Pcomm.extrnl, Pcomm.modem, and Pcomm.param to the default
  435. X    directory by typing "make install_support".  Please remember
  436. X    these are just sample files...
  437. X
  438. X    5) Install the on-line manual pages Pcomm.1, Pcomm_cmd.1,
  439. X    Matches.1, and Waitfor.1 to the proper /usr/man directory by
  440. X    typing "make install_man".  For those without access to nroff,
  441. X    I've included the output files called Pcomm.out, Pcomm_cmd.out,
  442. X    Matches.out, and Waitfor.out in the last shell archive.
  443. X
  444. X[ moderator's note: comp.sources.unix does not publish pre-formatted man pages;
  445. X  if you need a man-page-formatter we suggest "groff" or henry spencer's cute
  446. X  awk script that does a credible "nroff -man" imitation.        --vix ]
  447. X
  448. X    6) Print the Pcomm Reference Manual.  The Doc.me file is the
  449. X    nroff input which should be run thru tbl and the "me" macro
  450. X    package, as in:
  451. X
  452. X        tbl Doc.me | nroff -me -Twhatever | lp
  453. X
  454. X    For those without access to nroff, I've included the output file
  455. X    called Doc.out in the last shell archive.
  456. X
  457. X[ moderator's note: see above.                        --vix ]
  458. X
  459. X    The "me" macro package appears to be freely available and is
  460. X    included in the Berkeley 4.3 public distribution.
  461. X
  462. How to compile Pcomm:
  463. X
  464. X    1) There is a shell script called "Configure.sh" that should
  465. X    provide some information about your system.  It does *not* edit
  466. X    the "Makefile" or" config.h" files...
  467. X
  468. X    2) Edit the "config.h" file to suit your system's needs and your
  469. X    personal taste.  Sites running HoneyDanBer (HDB) UUCP should pay
  470. X    particular attention to the LOCK_DIR and ASCII_PID definitions.
  471. X    The definitions in config.h are:
  472. X
  473. X    BSD        Define if you're using a Berkeley flavor of Unix.
  474. X            You will also have to edit the Makefile in
  475. X            several places.
  476. X
  477. X    UNIXPC        If defined, use the dial(3) routines specific
  478. X            to the AT&T Unix PC 7300/3b1.  Useful only if
  479. X            the On Board Modem (OBM) is to be used.
  480. X
  481. X    OLDCURSES    If defined, use the older version of curses(3).
  482. X            (uses termcap in lieu of terminfo).
  483. X
  484. X    NOPROMOTE    If defined, do not promote missing video
  485. X            attributes to standout.  Normally, curses(3)
  486. X            attempts to compensate for missing attributes.
  487. X
  488. X    LOG_CALLS    If defined, Pcomm will keep an administrative log
  489. X            of all calls.  The log contains the name of the
  490. X            person making the call, the phone number, and a
  491. X            date/time stamp.  Useful for verifying long
  492. X            distance phone bills.
  493. X
  494. X    LOGFILE        The path to the log file (if LOG_CALLS is
  495. X            defined).  It should have write permission to
  496. X            all or be writeable under set-user/group-id
  497. X            conditions.
  498. X
  499. X    LIMIT_LD    If defined, Pcomm will limit long distance
  500. X            (toll) calls to a privileged group.  The file
  501. X            "admin.c" may require tweaking to detect long
  502. X            distance numbers.
  503. X
  504. X    GROUP_NAME    The name of the group that is allowed to make
  505. X            long distance calls (if LIMIT_LD is defined).
  506. X
  507. X    LPR        The path to the line printer program (this is
  508. X            not the name of the device).
  509. X
  510. X    LPRINT        The path to the "pretty" line printer program.
  511. X            If none exist, use "pr | lp".
  512. X
  513. X    DEFAULT_DIR    The path to the directory that contains the
  514. X            default Pcomm support files.
  515. X
  516. X    LOCK_DIR    The path to the directory where the UUCP lock
  517. X            files are found.  On HDB systems this would
  518. X            probably be /usr/spool/locks.
  519. X
  520. X    ASCII_PID    If defined, the lock files will contain an ASCII
  521. X            encoded process id (PID).  On HDB systems this
  522. X            is the default.
  523. X
  524. X    XENIX_LOCKS    If defined, the last letter of the device name
  525. X            is folded to lower case when creating the lock
  526. X            file.  Newer version of XENIX may require this.
  527. X
  528. X    SVR4_LOCKS    If defined, the new UUCP lockfile format
  529. X            introduced in SVR4 will be used.
  530. X
  531. X    XMC_BROKE    Does the status line scroll up when using "magic
  532. X            cookie" terminals?  Some Pyramid and AT&T
  533. X            systems may require this to be defined.  Find a
  534. X            magic cookie terminal (a Wyse 50 for example),
  535. X            and see what happens.
  536. X
  537. X    WGETCH_BROKE    Does the alarm() system call work correctly with
  538. X            the wgetch() function?  Symptom:  the initial
  539. X            screen doesn't go away by itself after 5
  540. X            seconds.
  541. X
  542. X    O_NDELAY_BROKE    Does the fnctl() to turn off the O_NDELAY mode
  543. X            sometimes fail to work?  Symptom: no response
  544. X            from the modem.
  545. X
  546. X    CLIST_SIZ    The size of the serial port character buffer.
  547. X            The default is 64.
  548. X
  549. X    INPUT_BUF    The size of the input buffer (should be about the
  550. X            same size as CLIST_SIZ).  The default is 64.
  551. X
  552. X    OUTPUT_BUF    The size of the output buffer (should be about
  553. X            one half INPUT_BUF).  The default is 32.  Systems
  554. X            without dedicated I/O processors may require a
  555. X            small INPUT_BUF value to avoid the problem of a
  556. X            "choppy" display.
  557. X
  558. X    MEMMOVE        The name of the memory copy routine. The default
  559. X            is memmove(), although memcpy() or bcopy() will
  560. X            work (if they correctly handle target and source
  561. X            overlap).
  562. X
  563. X    SETUID_BROKE    Does your version of Unix allow you to flip-flop
  564. X            back and forth between the real and effective
  565. X            user (or group) ID?  Some Masscomp systems will
  566. X            require this to be set.
  567. X
  568. X    HAVE_STRSTR    Does your system have the strstr() function?
  569. X            Most Berkeley systems will require this to be
  570. X            #undef.
  571. X
  572. X    HAVE_USLEEP    Does your system have the usleep() function?
  573. X            Most non-Sun system will require this to be
  574. X            #undef.
  575. X
  576. X    HAVE_TRUNCATE    Does your system have the truncate() system call?
  577. X            Most modern systems do.
  578. X
  579. X    3) Edit the Makefile.  There are provisions in the Makefile to
  580. X    include getcwd(3) and getopt(3) routines if they are missing
  581. X    from your system.  You may want to customize the CFLAGS and
  582. X    LDFLAGS assignments to suit your needs.
  583. X
  584. X    If compiling under Berkeley Unix, you will have to edit the
  585. X    Makefile on the following lines:
  586. X
  587. X        #for old curses(3) or Berkeley systems
  588. X        CURSES = -lcurses -ltermcap
  589. X        #CURSES = -lcurses
  590. X
  591. X        #for System V or Berkeley TTY interface
  592. X        TTY.C = tty_ucb.c
  593. X        TTY.O = tty_ucb.o
  594. X        #TTY.C = tty_att.c
  595. X        #TTY.O = tty_att.o
  596. X
  597. X        #for System V poll() or Berkeley select()
  598. X        IPC.C = ipc_ucb.c
  599. X        IPC.O = ipc_ucb.o
  600. X        #IPC.C = ipc_att.c
  601. X        #IPC.O = ipc_att.o
  602. X
  603. X    All the defaults in config.h assume a AT&T flavor of Unix, sorry
  604. X    about that...
  605. X
  606. X    4) Compile pcomm.  Type "make".  The "make install" option will
  607. X    attempt to copy "pcomm" into the BIN_DIR directory given in the
  608. X    Makefile.  However, those sites running HDB UUCP software may
  609. X    require that you to change the mode of "pcomm" to be set-user-id
  610. X    to uucp.
  611. X
  612. X    Three external programs (pcomm_cmd, waitfor, and matches) are
  613. X    included in the distribution to help in creating auto-login
  614. X    shell scripts.
  615. X
  616. How to configure Pcomm:
  617. X
  618. X    Please remember that the Pcomm support files provided are just
  619. X    examples.  They must be modification by you.
  620. X
  621. X        1) Determine the names of the devices that Pcomm will be using.
  622. X        Pcomm must use the same device names that UUCP uses.  For
  623. X        example, if your system has two names for the same device such
  624. X        as "ttya" and "cua0", then use the one that UUCP uses, not the
  625. X        one that getty uses.  Some systems use "tty01h" to designate a
  626. X        bi-directional tty line used by both getty and UUCP.
  627. X
  628. X    2) Get out the books that came with your modems.  You're gonna
  629. X    have to know a lot about your modems in order to configure them
  630. X    correctly to suit both Pcomm's needs and the needs of your
  631. X    getty/UUCP settings.
  632. X
  633. X    3) Here are the "real life" settings for my Telebit Worldblazer
  634. X    on a Dell SVR4 box running uugetty.
  635. X
  636. X        My Telebit WorldBlazer modem for my dialin/dialout port is set
  637. X        with the following commands.
  638. X
  639. X        &F     Restores factory settings
  640. X        L1    Low speaker volume
  641. X        X2    Detailed result codes (connect speeds)
  642. X        Q2    Turns on result codes only when dialing out
  643. X        &C1    DCD follows the carrier
  644. X        &D3    Hard reset on loss of DTR
  645. X        S0=1    Answer on first ring
  646. X        S7=60    60 second wait for carrier
  647. X        S51=6    Interface speed set to 38400 bps
  648. X        S58=2    Full duplex RTS/CTS flow control
  649. X        S59=15    Result code extensions
  650. X        S61=0    Pass modem breaks to the other end
  651. X        &W    Save in NVM
  652. X
  653. X    AT&V
  654. X    WorldBlazer - SA - Version LA5.00W- Active Configuration
  655. X     B1  E1  L1  M1  P   Q2  V1  X2  Y0 
  656. X    &C1 &D3 &G0 &J0 &L0 &Q0 &R3 &S0 &T4 &X0 
  657. X    S000:1   S001=0   S002=43  S003=13  S004=10  S005=8   S006=2   S007:60 
  658. X    S008=2   S009=6   S010=14  S011=70  S012=50  S018=0   S025=5   S026=1  
  659. X    S038=0   S041=0   S045=0   S046=0   S047=4   S048=0   S050=0   S051:6  
  660. X    S056=17  S057=19  S058:2   S059:15  S060=0   S061:0   S062=15  S063=0  
  661. X    S064=0   S068=255 S069=0   S090=0   S092=0   S093=8   S094=1   S100=0  
  662. X    S104=0   S105=1   S111=255 S112=1   S151=4   S155=0   S180=2   S181=1  
  663. X    S183=25  S190=1   S191=7   S253=10  S254=255 S255=255 
  664. X
  665. X    /usr/local/lib/pcomm/pcomm.modem:
  666. X
  667. X    TTY_1=tty01h;TELEBIT;38400
  668. X    MODEM_1a=TELEBIT;ATZ!~~!;ATDT;!;~~+++~~ATH0!
  669. X    MODEM_1b=Y;CONNECT 300;CONNECT 1200;CONNECT 2400;CONNECT 4800;CONNECT 9600;CONNECT FAST;
  670. X    MODEM_1c=BUSY;NO CARRIER;NO DIALTONE;ERROR
  671. X
  672. X    /etc/uucp/Dialers:
  673. X
  674. X    wblazer   =W-,    "" \M\dATZ OK ATDT\T CONNECT \m\c
  675. X
  676. X    /etc/uucp/Devices:
  677. X
  678. X    ACU tty01h,M - 38400 wblazer
  679. X
  680. X    /etc/uucp/Systems:
  681. X
  682. X    system Any ACU 38400 5551212 "" \r ogin: mylogin assword: mypassword
  683. X
  684. X    /etc/inittab:
  685. X
  686. X    01h:23:respawn:/usr/lib/uucp/uugetty -t60 tty01h wblazer
  687. X
  688. X    /etc/gettydefs:
  689. X
  690. X    wblazer# B38400 SANE HUPCL # B38400 SANE IXANY TAB3 #login: #wblazer
  691. X
  692. X    4) Update the sample modem/TTY database.  I know I'm asking the
  693. X    impossible, but...  Read section 3 and the Appendices of the Doc
  694. X    file first.  Then run Pcomm to update the modem/TTY database by
  695. X    using the TTY Setup and the Modem Setup menues.
  696. X
  697. X    5) There is a Question and Answer file (called Q_and_A) that may
  698. X    help diagnose problems.
  699. X
  700. Portability considerations:
  701. X
  702. X    1) Pcomm makes use of the bold, blinking and standout video
  703. X    attributes.  My concept of "standout" and "reverse" might be
  704. X    different than yours (I like "standout" to be a brighter version
  705. X    of "reverse").  Some very old versions of curses will ignore the
  706. X    standout mode if you're on a magic cookie terminal.
  707. X
  708. X    2) The "port.c" file has a place where you can include your own
  709. X    routine to toggle the getty process on a port (if required).
  710. X
  711. X    3) If you compile Pcomm with LOG_CALLS defined, you'll have to
  712. X    look at the code in "admin.c" to see if the long distance
  713. X    detection routine is correct for your site.
  714. X
  715. X    4) There is a "typedef SIG_TYPE" in the config.h file to help
  716. X    silence the compiler's warning messages about the signal()
  717. X    return value.
  718. X
  719. Notes for Sun users...  There are several problems that apparently only
  720. surface with SunOS 4.x.  Here are some notes to help out.
  721. X
  722. X        1) Pcomm was really designed to work in an AT&T world.  If you
  723. X        compile the code with the /usr/5bin/cc compiler, you'll end up
  724. X        with a better product.  To do so, you'll need to use default
  725. X        AT&T parameters in config.h (undef OLDCURSES and undef BSD, etc)
  726. X        plus the default AT&T parameters in Makefile for (CURSES, TTY.C,
  727. X        and TTY.O).  You'll also have to change the CC and LD variables
  728. X        in the Makefile to reflect /usr/5bin/cc.
  729. X
  730. X        However, SunOS 4.x doesn't like the AT&T versions of IPC.C and
  731. X        IPC.O, so use the Berkely ones.  This is contrary to what the
  732. X        Configure.sh script will tell you!  Perhaps SunOS 5.0 will fix
  733. X        all this...
  734. X
  735. X        2) SunOS 4.x no longer supports the AT&T version of the times()
  736. X        system call, so usleep() should be used to generate the delay.
  737. X    Edit config.h to #define HAVE_USLEEP.
  738. X
  739. Notes for some 4.2BSD and Ultrix 1.2 systems:
  740. X
  741. X    Apparently, there is a bug in the /usr/include/curses.h file on
  742. X    some systems that does not define the nl() and nonl() macros
  743. X    correctly.  If this is the case with your system, edit
  744. X    /usr/include/curses.h to include the following:
  745. X
  746. X    #undef nl
  747. X    #undef nonl
  748. X    #define nl()    (_tty.sg_flags |= CRMOD,_pfast = _rawmode,stty(_tty_ch, &_tty))
  749. X    #define nonl()    (_tty.sg_flags &= ~CRMOD, _pfast = TRUE, stty(_tty_ch, &_tty))
  750. X
  751. Notes for some 386 versions of Unix:
  752. X
  753. X        It seems that a lot of the early versions of Unix for "DOS
  754. X        boxes" have bugs in their terminfo database for AT386 (the
  755. X        default terminal type).  Here is one that works:
  756. X
  757. AT386|at386|386AT|386at|at/386 console,
  758. X    am, eo, xon,
  759. X    colors#8, cols#80, lines#25, ncv#3, pairs#64,
  760. X    acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~,
  761. X        bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[2J\E[H,
  762. X        cr=\r, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B,
  763. X        cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%02d;%p2%02dH,
  764. X        cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[8;1m,
  765. X        dl=\E[%p1%dM, dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, el=\E[K,
  766. X        el1=\E[1K\E[X, flash=^G, home=\E[H, hpa=\E[%i%p1%dG,
  767. X        ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=\E[S,
  768. X        indn=\E[%p1%dS, invis=\E[8m, is2=\E[0;10, kbs=\b, kcbt=^],
  769. X        kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
  770. X        kdch1=^?, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA,
  771. X        kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV,
  772. X        kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, knp=\E[U, kpp=\E[V,
  773. X        krmir=\E0, op=\E[0m, pfx=\EQ%p1%{1}%-%d'%p2%s', rev=\E[7;1m,
  774. X        ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, rmso=\E[m, rs1=\E[0;10m,
  775. X        setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
  776. X        setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
  777. X        setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
  778. X        sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%?%p9%t;12%;%?%p7%t;9%;m,
  779. X        sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m,
  780. X
  781. XEmmet P. Gray                US Army, HQ III Corps & Fort Hood
  782. X...!uunet!uiucuxc!fthood!egray        Attn: AFZF-DE-ENV
  783. fthood!egray@uxc.cso.uiuc.edu        Directorate of Engineering & Housing
  784. X                    Environmental Management Office
  785. X                    Fort Hood, TX 76544-5057
  786. END_OF_FILE
  787. if test 14243 -ne `wc -c <'README'`; then
  788.     echo shar: \"'README'\" unpacked with wrong size!
  789. fi
  790. # end of 'README'
  791. fi
  792. if test -f 'Release.notes' -a "${1}" != "-c" ; then 
  793.   echo shar: Will not clobber existing file \"'Release.notes'\"
  794. else
  795. echo shar: Extracting \"'Release.notes'\" \(2639 characters\)
  796. sed "s/^X//" >'Release.notes' <<'END_OF_FILE'
  797. Patch #2, 6 Nov 92
  798. X
  799. This patch will fix a few problems with possible loss of the inherited
  800. environment for child processes, and a bug in the data and print logging
  801. when used during scripts.
  802. X
  803. X-----------------------------------------------------------------------------
  804. Patch #1, 6 Sep 92
  805. X
  806. This patch will correct a minor bug with the external protocol option
  807. X(when running under SVR3.2) that prevented Pcomm from detecting the
  808. death of the child process.
  809. X
  810. The rather large size of this patch is do to the numerous changes to the
  811. Doc.me file.
  812. X
  813. X------------------------------------------------------------------------------
  814. X                 Pcomm version 2.0
  815. X                 18 Jul 92
  816. X
  817. Compatibilities with v1.2:
  818. X
  819. X    The pcomm.modem and pcomm.param support files under v1.2 are not
  820. X    compatible with the new release.  There is a shell script called
  821. X    Convert.sh that will convert these files to the new format.
  822. X
  823. X    The Script/TTY field of the dialing directory is now called
  824. X    the Auxiliary field.  It now has one of three functions...
  825. X        1) to specify a script to be played
  826. X        2) to force a particular TTY to be selected
  827. X        3) to select a modem configuration
  828. X
  829. Things that have changed:
  830. X
  831. X        This version of Pcomm requires a pseudo-tty driver and System V
  832. X        poll() or Berkeley select().  Pre-SRV3.2 versions of AT&T Unix
  833. X        are out-of-luck...  sorry.
  834. X
  835. X    There is a shell script called Configure.sh that will help you
  836. X    to configure Pcomm correctly for your system.  I've added a
  837. X    Q_and_A file to provide help on diagnosing common problems.
  838. X    
  839. X    There is no longer a "pcomm_input" program, those functions are
  840. X    now supported by the use of multiplexed I/O within the "pcomm"
  841. X    program.  The external "modem_break" command has been removed.
  842. X    You might want to "search and destroy" those binaries.
  843. X
  844. X    A new external command called "pcomm_cmd" has been added to
  845. X    allow "true" scripting capabilities.  There is a manual page for
  846. X    pcomm_cmd that further describes its features.
  847. X
  848. X        Each dialing directory entry can specify a modem configuration
  849. X        via the newly renamed Auxiliary field.  This allows you to
  850. X        tailor the modem to match what is expected at the other end of
  851. X        the connection.
  852. X
  853. X        Pcomm now supports DTE baud rates up to 38400 plus "connected"
  854. X        baud rates for V.32bis (7200, 12000, and 14400).
  855. X
  856. XFuture directions:
  857. X
  858. X    Add zmodem as an internal protocol, since Omen Technologies
  859. X    deliberately broke sz/rz so that it wouldn't work from inside 
  860. X    another program.
  861. X
  862. X        Add the ability to "dial into" a machine via a network LAN
  863. X        rather than the serial port.
  864. X
  865. X    xpcomm - a version of Pcomm using the X window toolkits.
  866. END_OF_FILE
  867. if test 2639 -ne `wc -c <'Release.notes'`; then
  868.     echo shar: \"'Release.notes'\" unpacked with wrong size!
  869. fi
  870. # end of 'Release.notes'
  871. fi
  872. if test -f 'Sample' -a "${1}" != "-c" ; then 
  873.   echo shar: Will not clobber existing file \"'Sample'\"
  874. else
  875. echo shar: Extracting \"'Sample'\" \(1004 characters\)
  876. sed "s/^X//" >'Sample' <<'END_OF_FILE'
  877. X:
  878. X#
  879. X# This is a sample Bourne shell script to log a user onto a remote system.
  880. X# Things to remember:
  881. X#    1) Script files should have permissions of 700, to prevent others
  882. X#    from gaining access to your passwords to remote systems.
  883. X#    2) The return codes for waitfor are: 0=success, 1=timed out, and
  884. X#    -1=error.
  885. X#
  886. echo ""
  887. try=0
  888. X# loop until done
  889. while true
  890. do
  891. X    # wait 5 seconds for the login prompt
  892. X    waitfor -5 ogin:
  893. X    # test the exit code of the waitfor command
  894. X    if [ "$?" -eq 0 ]
  895. X    then
  896. X        # send my user ID and exit the loop
  897. X        echo "egray"
  898. X        break
  899. X    fi
  900. X
  901. X    # increment the number of attempts
  902. X    try=`expr $try + 1`
  903. X    # test to see if we should give up
  904. X    if [ "$try" -eq 5 ]
  905. X    then
  906. X        exit 1
  907. X    fi
  908. X
  909. X    # send a modem break and loop again
  910. X    pcomm_cmd modem_break
  911. X    echo ""
  912. done
  913. X# wait 5 seconds for the password prompt
  914. waitfor -5 assword:
  915. X# test the return code from waifor
  916. if [ "$?" -eq 0 ]
  917. then
  918. X    # send my password (you're crazy if you think that's my real password)
  919. X    echo "abcdefg"
  920. else
  921. X    exit 1
  922. fi
  923. X# return to Pcomm
  924. exit 0
  925. END_OF_FILE
  926. if test 1004 -ne `wc -c <'Sample'`; then
  927.     echo shar: \"'Sample'\" unpacked with wrong size!
  928. fi
  929. # end of 'Sample'
  930. fi
  931. if test -f 'Waitfor.1' -a "${1}" != "-c" ; then 
  932.   echo shar: Will not clobber existing file \"'Waitfor.1'\"
  933. else
  934. echo shar: Extracting \"'Waitfor.1'\" \(888 characters\)
  935. sed "s/^X//" >'Waitfor.1' <<'END_OF_FILE'
  936. X.TH waitfor L
  937. X.SH NAME
  938. waitfor \- wait for a string to appear on the stdin
  939. X.SH SYNOPSIS
  940. X.B waitfor
  941. X[
  942. X.B \-n
  943. X]
  944. X.B string
  945. X.SH DESCRIPTION
  946. X.I Waitfor
  947. reads the standard input and returns a 0 if the string argument is
  948. found, returns a 1 if the strings did not appear within the allotted
  949. time, or returns a \-1 on error.  If the string is found,
  950. X.I waitfor
  951. returns immediately.
  952. X.PP
  953. X.I Waitfor
  954. is designed to be used by
  955. X.I Pcomm
  956. inside a shell script for automating keyboard input to log a user onto a
  957. remote system.
  958. X.PP
  959. The
  960. X.I \-n
  961. option is used to specify the length of time in seconds to wait.  The
  962. default is 10 seconds.
  963. X.SH EXAMPLE
  964. X.nf
  965. X.RS 5
  966. X# wait 5 seconds for the login prompt
  967. waitfor \-5 login:
  968. X# test the exit code of the waitfor command
  969. if [ $? \-eq 0 ]
  970. then
  971. X.RS 5
  972. X# send my user ID
  973. echo egray
  974. X.RE
  975. fi
  976. X.RE
  977. X.fi
  978. X.SH "SEE ALSO"
  979. pcomm(1), pcomm_cmd(1), matches(1), Pcomm Reference Manual
  980. END_OF_FILE
  981. if test 888 -ne `wc -c <'Waitfor.1'`; then
  982.     echo shar: \"'Waitfor.1'\" unpacked with wrong size!
  983. fi
  984. # end of 'Waitfor.1'
  985. fi
  986. if test -f 'chg_dir.c' -a "${1}" != "-c" ; then 
  987.   echo shar: Will not clobber existing file \"'chg_dir.c'\"
  988. else
  989. echo shar: Extracting \"'chg_dir.c'\" \(1514 characters\)
  990. sed "s/^X//" >'chg_dir.c' <<'END_OF_FILE'
  991. X/*
  992. X * Open a window to prompt for a new directory.  Checks to see you have
  993. X * search permission.
  994. X */
  995. X
  996. X#include <curses.h>
  997. X#include "config.h"
  998. X#include "misc.h"
  999. X
  1000. void
  1001. chg_dir()
  1002. X{
  1003. X    extern int fd;
  1004. X    WINDOW *ch_win, *newwin();
  1005. X    char *ans, *dir, *expand(), *cwd, *getcwd(), cwdbuf[200];
  1006. X    char *get_str();
  1007. X
  1008. X    cwd = getcwd(cwdbuf, 200);
  1009. X
  1010. X    ch_win = newwin(6, 70, 5, 5);
  1011. X
  1012. X    mvwprintw(ch_win, 2, 4, "Current directory: %s", cwd);
  1013. X    mvwaddstr(ch_win, 3, 4, "New directory: ");
  1014. X    box(ch_win, VERT, HORZ);
  1015. X
  1016. X    mvwattrstr(ch_win, 0, 3, A_BOLD, " Change Directory ");
  1017. X    wmove(ch_win, 3, 19);
  1018. X    wrefresh(ch_win);
  1019. X                    /* get the answer */
  1020. X    while ((ans = get_str(ch_win, 80, "", " \t\n")) != NULL) {
  1021. X                    /* a CR means no change */
  1022. X        if (*ans == '\0')
  1023. X            break;
  1024. X                    /* expand the input */
  1025. X        dir = expand(ans);
  1026. X                    /* if you have search permission */
  1027. X        if (!access(dir, 1)) {
  1028. X            if (!chdir(dir))
  1029. X                break;
  1030. X        }
  1031. X        beep();
  1032. X        mvwattrstr(ch_win, 4, 15, A_BOLD, "No such directory or no access permission");
  1033. X        wrefresh(ch_win);
  1034. X        wait_key(ch_win, 3);
  1035. X                    /* clean up the mess */
  1036. X        clear_line(ch_win, 3, 19, TRUE);
  1037. X        clear_line(ch_win, 4, 14, TRUE);
  1038. X        wmove(ch_win, 3, 19);
  1039. X        wrefresh(ch_win);
  1040. X    }
  1041. X    if (fd == -1) {
  1042. X        werase(ch_win);
  1043. X        wrefresh(ch_win);
  1044. X    }
  1045. X    delwin(ch_win);
  1046. X    return;
  1047. X}
  1048. X
  1049. X#ifdef BSD
  1050. X/*
  1051. X * Get the current working directory, AT&T style.  Well... not really, it
  1052. X * doesn't handle a NULL pointer for the buffer.
  1053. X */
  1054. X
  1055. X/* ARGSUSED */
  1056. char *
  1057. getcwd(buf, len)
  1058. char *buf;
  1059. int len;
  1060. X{
  1061. X    char *getwd();
  1062. X
  1063. X    return(getwd(buf));
  1064. X}
  1065. X#endif /* BSD */
  1066. END_OF_FILE
  1067. if test 1514 -ne `wc -c <'chg_dir.c'`; then
  1068.     echo shar: \"'chg_dir.c'\" unpacked with wrong size!
  1069. fi
  1070. # end of 'chg_dir.c'
  1071. fi
  1072. if test -f 'cmd.h' -a "${1}" != "-c" ; then 
  1073.   echo shar: Will not clobber existing file \"'cmd.h'\"
  1074. else
  1075. echo shar: Extracting \"'cmd.h'\" \(2290 characters\)
  1076. sed "s/^X//" >'cmd.h' <<'END_OF_FILE'
  1077. X/*
  1078. X * Definitions for the pcomm_cmd program used inside script files.
  1079. X */
  1080. X
  1081. X/* the commands */
  1082. X
  1083. X#define SET        0    /* set a parameter */
  1084. X#define QUERY        1    /* ask a "string" question */
  1085. X#define IF        2    /* ask a binary question */
  1086. X#define DIAL        3    /* dial */
  1087. X#define REDIAL        4    /* redial queue */
  1088. X#define EXIT        5    /* exit Pcomm */
  1089. X#define CLEAR_SCREEN    6    /* clear the local screen */
  1090. X#define CHG_DIR        7    /* change the local directory */
  1091. X#define HANG_UP        8    /* hang up the phone */
  1092. X#define PRINTER        9    /* control printer logging */
  1093. X#define MODEM_BREAK    10    /* send a modem break */
  1094. X#define SEND        11    /* send a file */
  1095. X#define RECEIVE        12    /* recieve a file */
  1096. X#define SCREEN_DUMP    13    /* dump the screen contents to a file */
  1097. X#define DATA_LOG    14    /* control data logging */
  1098. X
  1099. X/* the SET arguments */
  1100. X
  1101. X#define BAUD        0    /* baud rate */
  1102. X#define PARITY        1    /* parity (EVEN, ODD, or NONE) */
  1103. X#define DATA_BITS    2    /* data bits (7 or 8) */
  1104. X#define STOP_BITS    3    /* stop bits (1 or 2) */
  1105. X#define DUPLEX        4    /* duplex mode (FULL or HALF) */
  1106. X#define AUX        5    /* the name of the auxiliary file */
  1107. X#define HOT_KEY        6    /* the "hot" key (numeric) */
  1108. X#define ASCII_HOT    7    /* ascii representation of hot key */
  1109. X#define FLOW_CTRL    8    /* flow control (XON/XOFF or NONE) */
  1110. X#define CR_IN        9    /* send as carriage return */
  1111. X#define CR_OUT        10    /* receive carriage return as */
  1112. X#define LOGFILE        11    /* default log file */
  1113. X#define DUMPFILE    12    /* default screen dump file */
  1114. X#define STRIP        13    /* strip high bit (translate table) */
  1115. X#define LOCAL_ECHO    14    /* ASCII xfer - echo locally? */
  1116. X#define EXPAND        15    /* ASCII xfer - expand blank lines? */
  1117. X#define CR_DELAY    16    /* ASCII xfer - carriage return delay (ms) */
  1118. X#define PACE        17    /* ASCII xfer - pace the output? */
  1119. X#define CR_UP        18    /* ASCII xfer - send carriage return as */
  1120. X#define LF_UP        19    /* ASCII xfer - send line feed as */
  1121. X#define TIMER        20    /* ASCII xfer - transfer timeout */
  1122. X#define CR_DN        21    /* ASCII xfer - receive carriage return as */
  1123. X#define LF_DN        22    /* ASCII xfer - receive line feed as */
  1124. X
  1125. X/* the QUERY arguments */
  1126. X#define TTY_NAME    0    /* what is the current tty? */
  1127. X#define MODEM_NAME    1    /* what modem do we have? */
  1128. X
  1129. X/* the IF arguments */
  1130. X
  1131. X#define CONNECTED    0    /* are we connected? */
  1132. X#define LOG_STATUS    1    /* status of log option */
  1133. X#define PRINTER_STATUS    2    /* status of print option */
  1134. X
  1135. END_OF_FILE
  1136. if test 2290 -ne `wc -c <'cmd.h'`; then
  1137.     echo shar: \"'cmd.h'\" unpacked with wrong size!
  1138. fi
  1139. # end of 'cmd.h'
  1140. fi
  1141. if test -f 'config.h' -a "${1}" != "-c" ; then 
  1142.   echo shar: Will not clobber existing file \"'config.h'\"
  1143. else
  1144. echo shar: Extracting \"'config.h'\" \(2452 characters\)
  1145. sed "s/^X//" >'config.h' <<'END_OF_FILE'
  1146. X/*
  1147. X * Various tunable parameters.  This should appear before any other local
  1148. X * header file.
  1149. X */
  1150. X
  1151. X/* Are you using a Berkeley flavor of Unix? */
  1152. X#undef    BSD
  1153. X
  1154. X/* Use the dialing routines specific to the AT&T Unix PC 7300/3b1 */
  1155. X#undef    UNIXPC
  1156. X
  1157. X/* Older versions of curses(3) use termcap in lieu of terminfo */
  1158. X#undef    OLDCURSES
  1159. X
  1160. X/* Should a missing video attribute be promoted to standout? */
  1161. X#define    NOPROMOTE
  1162. X
  1163. X/* Should Pcomm make a log of all phone calls? */
  1164. X#undef    LOG_CALLS
  1165. X
  1166. X/* The name of the log file (if used).  */
  1167. X#define    LOG_FILE    "/usr/adm/phone.calls"
  1168. X
  1169. X/* Should long distance (toll) calls be limited to a specific group? */
  1170. X#undef    LIMIT_LD
  1171. X
  1172. X/* The name of the privileged group for limiting long distance calls */
  1173. X#define    GROUP_NAME    "uucp"
  1174. X
  1175. X/* The path to the line printer program */
  1176. X#define    LPR        "lp -s"
  1177. X
  1178. X/* The path to the "pretty" printer program (if none, use "pr | lp") */
  1179. X#define    LPRINT        "pr | lp -s"
  1180. X
  1181. X/* The path to the default directory containing the Pcomm support files */
  1182. X#define    DEFAULT_DIR    "/usr/local/lib/pcomm"
  1183. X
  1184. X/* The path to the directory where UUCP locks are found */
  1185. X#define    LOCK_DIR    "/var/spool/locks"
  1186. X
  1187. X/* Do the lock files use ASCII encoded PID's? */
  1188. X#define    ASCII_PID
  1189. X
  1190. X/* Fold the last character of the lock to lower case? */
  1191. X#undef    XENIX_LOCKS
  1192. X
  1193. X/* Use the new SVR4 lock format? */
  1194. X#define    SVR4_LOCKS
  1195. X
  1196. X/* Does the status line scroll up on "magic cookie" terminals? */
  1197. X#undef    XMC_BROKE
  1198. X
  1199. X/* Does the alarm() system call work correctly with the wgetch() function? */
  1200. X#undef    WGETCH_BROKE
  1201. X
  1202. X/* Does the O_NDELAY mode tend to stick around when asked to leave? */
  1203. X#undef    O_NDELAY_BROKE
  1204. X
  1205. X/* The size of the serial port character buffer (or Stream buffer) */
  1206. X#define    CLIST_SIZ    64
  1207. X
  1208. X/* The size of the input buffer (should be about the same as CLIST_SIZ) */
  1209. X#define    INPUT_BUF    64
  1210. X
  1211. X/* The size of the output buffer (should be about one half INPUT_BUF) */
  1212. X#define    OUTPUT_BUF    32
  1213. X
  1214. X/* Does memmove() exist or is memcpy() well behaved when overlapping? */
  1215. X#define    MEMMOVE(a,b,c)    memmove(a,b,c)
  1216. X/* #define    MEMMOVE(a,b,c)    memcpy(a,b,c) */
  1217. X/* #define    MEMMOVE(a,b,c)    bcopy(b,a,c) */
  1218. X
  1219. X/* Does your Unix allow flip-flop between real and effective user IDs? */
  1220. X#undef    SETUID_BROKE
  1221. X
  1222. X/* Does your system have the strstr() function? */
  1223. X#define    HAVE_STRSTR
  1224. X
  1225. X/* Does your system have the usleep() function? */
  1226. X#undef    HAVE_USLEEP
  1227. X
  1228. typedef void SIG_TYPE;
  1229. X/* typedef int SIG_TYPE; */
  1230. X
  1231. X#ifdef BSD
  1232. X#define    strchr    index
  1233. X#define    strrchr    rindex
  1234. X#endif /* BSD */
  1235. END_OF_FILE
  1236. if test 2452 -ne `wc -c <'config.h'`; then
  1237.     echo shar: \"'config.h'\" unpacked with wrong size!
  1238. fi
  1239. # end of 'config.h'
  1240. fi
  1241. if test -f 'd_delete.c' -a "${1}" != "-c" ; then 
  1242.   echo shar: Will not clobber existing file \"'d_delete.c'\"
  1243. else
  1244. echo shar: Extracting \"'d_delete.c'\" \(2005 characters\)
  1245. sed "s/^X//" >'d_delete.c' <<'END_OF_FILE'
  1246. X/*
  1247. X * The delete option of the dialing directory.  Prompts for saving
  1248. X * changes to disk.  A non-zero return code means that entries were deleted.
  1249. X */
  1250. X
  1251. X#include <stdio.h>
  1252. X#include <curses.h>
  1253. X#include "dial_dir.h"
  1254. X#include "misc.h"
  1255. X#include "param.h"
  1256. X
  1257. int
  1258. delete()
  1259. X{
  1260. X    extern char *null_ptr;
  1261. X    WINDOW *d_win, *newwin();
  1262. X    int i, first, last;
  1263. X    void free_ptr();
  1264. X
  1265. X    d_win = newwin(6, 32, 10, 15);
  1266. X
  1267. X    mvwaddstr(d_win, 2, 2, "Delete entry:     thru:");
  1268. X    box(d_win, VERT, HORZ);
  1269. X    wmove(d_win, 2, 16);
  1270. X    wrefresh(d_win);
  1271. X                    /* get the first of the range */
  1272. X    while ((first = get_num(d_win, 3)) != -1) {
  1273. X        if (first > 0 && first <= NUM_DIR)
  1274. X            break;
  1275. X        mvwaddstr(d_win, 2, 16, "   ");
  1276. X        wmove(d_win, 2, 16);
  1277. X        beep();
  1278. X        wrefresh(d_win);
  1279. X    }
  1280. X    if (first == -1) {
  1281. X        delwin(d_win);
  1282. X        return(0);
  1283. X    }
  1284. X                    /* get the last of the range */
  1285. X    wmove(d_win, 2, 26);
  1286. X    wrefresh(d_win);
  1287. X    while ((last = get_num(d_win, 3)) != -1) {
  1288. X        if ((first <= last && last <= NUM_DIR) || last == 0)
  1289. X            break;
  1290. X        mvwaddstr(d_win, 2, 26, "   ");
  1291. X        wmove(d_win, 2, 26);
  1292. X        beep();
  1293. X        wrefresh(d_win);
  1294. X    }
  1295. X    if (last == -1) {
  1296. X        delwin(d_win);
  1297. X        return(0);
  1298. X    }
  1299. X                    /* if "last" omitted, echo "first" */
  1300. X    if (!last) {
  1301. X        last = first;
  1302. X        mvwprintw(d_win, 2, 26, "%d", first);
  1303. X        wrefresh(d_win);
  1304. X    }
  1305. X                    /* save to disk? */
  1306. X    if (yes_prompt(d_win, 3, 2, A_BOLD, "Are you sure")) {
  1307. X                    /* delete from the physical file */
  1308. X        if (del_dir(first, last)) {
  1309. X            touchwin(d_win);
  1310. X            wrefresh(d_win);
  1311. X        }
  1312. X        /*
  1313. X         * We don't really care if del_dir() fails because we still
  1314. X         * change the version in memory.
  1315. X         */
  1316. X        for (i=first; i<=last; i++) {
  1317. X            free_ptr(dir->name[i]);
  1318. X            free_ptr(dir->number[i]);
  1319. X            free_ptr(dir->aux[i]);
  1320. X            dir->name[i] = null_ptr;
  1321. X            dir->number[i] = null_ptr;
  1322. X            dir->baud[i] = param->d_baud;
  1323. X            dir->parity[i] = param->d_parity;
  1324. X            dir->data_bits[i] = param->d_data_bits;
  1325. X            dir->stop_bits[i] = param->d_stop_bits;
  1326. X            dir->duplex[i] = *param->d_duplex;
  1327. X            dir->aux[i] = null_ptr;
  1328. X        }
  1329. X        delwin(d_win);
  1330. X        return(1);
  1331. X    }
  1332. X    delwin(d_win);
  1333. X    return(0);
  1334. X}
  1335. END_OF_FILE
  1336. if test 2005 -ne `wc -c <'d_delete.c'`; then
  1337.     echo shar: \"'d_delete.c'\" unpacked with wrong size!
  1338. fi
  1339. # end of 'd_delete.c'
  1340. fi
  1341. if test -f 'd_manual.c' -a "${1}" != "-c" ; then 
  1342.   echo shar: Will not clobber existing file \"'d_manual.c'\"
  1343. else
  1344. echo shar: Extracting \"'d_manual.c'\" \(1951 characters\)
  1345. sed "s/^X//" >'d_manual.c' <<'END_OF_FILE'
  1346. X/*
  1347. X * The manual dial option of the dialing directory.  A non-zero return code
  1348. X * means we're ready to dial.  Dialing directory entry 0 is reserved
  1349. X * for the manual dial option.  No sanity checking is done on the input.
  1350. X */
  1351. X
  1352. X#include <stdio.h>
  1353. X#include <curses.h>
  1354. X#include "config.h"
  1355. X#include "dial_dir.h"
  1356. X#include "misc.h"
  1357. X
  1358. static void fix_xmc();
  1359. X
  1360. int
  1361. manual()
  1362. X{
  1363. X    extern int xmc;
  1364. X    extern char *null_ptr;
  1365. X    WINDOW *m_win, *newwin();
  1366. X    char *number, *str_rep(), *get_str(), *strchr();
  1367. X    void free_ptr();
  1368. X
  1369. X    m_win = newwin(5, 50, 0, 20);
  1370. X
  1371. X    box(m_win, VERT, HORZ);
  1372. X    mvwaddstr(m_win, 2, 3, "Phone Number: ");
  1373. X    wrefresh(m_win);
  1374. X                    /* get a phone number */
  1375. X    if ((number = get_str(m_win, 30, "", "\n")) == NULL) {
  1376. X        werase(m_win);
  1377. X        wrefresh(m_win);
  1378. X        delwin(m_win);
  1379. X        if (xmc > 0)
  1380. X            fix_xmc();
  1381. X        return(0);
  1382. X    }
  1383. X                    /* is first char an LD code? */
  1384. X    dir->q_ld[0] = '\0';
  1385. X    if (strchr("+-@#", *number)) {
  1386. X        dir->q_ld[0] = *number;
  1387. X        number++;
  1388. X    }
  1389. X                    /* put it in the queue */
  1390. X    dir->q_num[0] = 0;
  1391. X    dir->q_num[1] = -1;
  1392. X    dir->d_cur = 0;
  1393. X                    /* build the entry zero */
  1394. X    dir->name[0] = str_rep(dir->name[0], number);
  1395. X    free_ptr(dir->aux[0]);
  1396. X    dir->aux[0] = null_ptr;
  1397. X                    /* if space, change to null_ptr */
  1398. X    if (!strcmp(number, " ")) {
  1399. X        free_ptr(dir->number[0]);
  1400. X        dir->number[0] = null_ptr;
  1401. X    }
  1402. X    else
  1403. X        dir->number[0] = str_rep(dir->number[0], number);
  1404. X                    /* it overlaps dm_win, so erase it */
  1405. X    werase(m_win);
  1406. X    wrefresh(m_win);
  1407. X    delwin(m_win);
  1408. X    if (xmc > 0)
  1409. X        fix_xmc();
  1410. X    return(1);
  1411. X}
  1412. X
  1413. X/*
  1414. X * Clear the end of the physical screen where the magic cookie got shifted
  1415. X * Geez, I hate magic cookie terminals...  Wyse, are you listening?
  1416. X */
  1417. X
  1418. static void
  1419. fix_xmc()
  1420. X{
  1421. X    WINDOW *cl_win, *newwin();
  1422. X
  1423. X    /*
  1424. X     * Since the cookie got shifted off the window, we have to
  1425. X     * create a new window to cover where the cookie ended up.
  1426. X     */
  1427. X    cl_win = newwin(1, 2, 4, 78);
  1428. X                    /* have to touch, otherwise nothing! */
  1429. X    touchwin(cl_win);
  1430. X    wrefresh(cl_win);
  1431. X    delwin(cl_win);
  1432. X
  1433. X    return;
  1434. X}
  1435. END_OF_FILE
  1436. if test 1951 -ne `wc -c <'d_manual.c'`; then
  1437.     echo shar: \"'d_manual.c'\" unpacked with wrong size!
  1438. fi
  1439. # end of 'd_manual.c'
  1440. fi
  1441. if test -f 'data_log.c' -a "${1}" != "-c" ; then 
  1442.   echo shar: Will not clobber existing file \"'data_log.c'\"
  1443. else
  1444. echo shar: Extracting \"'data_log.c'\" \(1475 characters\)
  1445. sed "s/^X//" >'data_log.c' <<'END_OF_FILE'
  1446. X/*
  1447. X * Open a window to prompt for a path name to be used for the data logging
  1448. X * feature.  Also turns on the data logging.
  1449. X */
  1450. X
  1451. X#include <stdio.h>
  1452. X#include <curses.h>
  1453. X#include "misc.h"
  1454. X#include "param.h"
  1455. X#include "status.h"
  1456. X
  1457. void
  1458. data_logging()
  1459. X{
  1460. X    extern int fd;
  1461. X    WINDOW *dl_win, *newwin();
  1462. X    char *ans, *path, *expand(), *get_str(), *str_rep();
  1463. X    void log_toggle();
  1464. X
  1465. X    dl_win = newwin(6, 70, 5, 5);
  1466. X
  1467. X    mvwprintw(dl_win, 2, 4, "Default log file: %s", param->logfile);
  1468. X    mvwaddstr(dl_win, 3, 4, "New log file: ");
  1469. X    box(dl_win, VERT, HORZ);
  1470. X
  1471. X    mvwattrstr(dl_win, 0, 3, A_BOLD, " Start Data Logging ");
  1472. X    wmove(dl_win, 3, 18);
  1473. X    wrefresh(dl_win);
  1474. X                    /* get the path */
  1475. X    while ((ans = get_str(dl_win, 128, "", " \t\n")) != NULL) {
  1476. X                    /* give 'em the default */
  1477. X        if (*ans == '\0')
  1478. X            path = param->logfile;
  1479. X        else
  1480. X            path = expand(ans);
  1481. X
  1482. X                    /* test write permission */
  1483. X        if (can_write(path)) {
  1484. X            status->log_path = str_rep(status->log_path, path);
  1485. X            /* 
  1486. X             * If already on, then cycle it off to close
  1487. X             * the old (and perhaps different) logfile.
  1488. X             */
  1489. X            if (status->log_status)
  1490. X                log_toggle();
  1491. X            log_toggle();
  1492. X            break;
  1493. X        }
  1494. X
  1495. X        beep();
  1496. X        mvwattrstr(dl_win, 4, 24, A_BOLD, "No write permission");
  1497. X        wrefresh(dl_win);
  1498. X        wait_key(dl_win, 3);
  1499. X                    /* clean up the mess */
  1500. X        clear_line(dl_win, 3, 18, TRUE);
  1501. X        clear_line(dl_win, 4, 24, TRUE);
  1502. X        wmove(dl_win, 3, 18);
  1503. X        wrefresh(dl_win);
  1504. X    }
  1505. X    if (fd == -1) {
  1506. X        werase(dl_win);
  1507. X        wrefresh(dl_win);
  1508. X    }
  1509. X    delwin(dl_win);
  1510. X
  1511. X    return;
  1512. X}
  1513. END_OF_FILE
  1514. if test 1475 -ne `wc -c <'data_log.c'`; then
  1515.     echo shar: \"'data_log.c'\" unpacked with wrong size!
  1516. fi
  1517. # end of 'data_log.c'
  1518. fi
  1519. if test -f 'di_delay.c' -a "${1}" != "-c" ; then 
  1520.   echo shar: Will not clobber existing file \"'di_delay.c'\"
  1521. else
  1522. echo shar: Extracting \"'di_delay.c'\" \(1958 characters\)
  1523. sed "s/^X//" >'di_delay.c' <<'END_OF_FILE'
  1524. X/*
  1525. X * Prompt for new delay times during a dialing session.  Also, prompts
  1526. X * if changes should be saved to disk.  Dialing is suspended during
  1527. X * this routine.
  1528. X */
  1529. X
  1530. X#include <stdio.h>
  1531. X#include <curses.h>
  1532. X#include "misc.h"
  1533. X#include "param.h"
  1534. X
  1535. void
  1536. delay_times()
  1537. X{
  1538. X    WINDOW *dt_win, *newwin();
  1539. X    int cdelay, rdelay;
  1540. X
  1541. X    dt_win = newwin(9, 45, 7, 15);
  1542. X
  1543. X    mvwprintw(dt_win, 2, 4, "Current connect delay time: %d", param->c_delay);
  1544. X    mvwprintw(dt_win, 3, 4, "Current redial delay time: %d", param->r_delay);
  1545. X    mvwaddstr(dt_win, 5, 4, "New connect delay: ");
  1546. X    mvwaddstr(dt_win, 6, 4, "New redial delay: ");
  1547. X    box(dt_win, VERT, HORZ);
  1548. X
  1549. X    mvwattrstr(dt_win, 0, 3, A_BOLD, " Change Delay Times ");
  1550. X    wmove(dt_win, 5, 23);
  1551. X    wrefresh(dt_win);
  1552. X                    /* get the cdelay number */
  1553. X    if ((cdelay = get_num(dt_win, 3)) == -1) {
  1554. X        delwin(dt_win);
  1555. X        return;
  1556. X    }
  1557. X                    /* give 'em the current settings */
  1558. X    if (!cdelay) {
  1559. X        cdelay = param->c_delay;
  1560. X        wprintw(dt_win, "%-3d", cdelay);
  1561. X    }
  1562. X    else {
  1563. X                    /* some reasonable limit */
  1564. X        if (cdelay > MAX_CDELAY || cdelay < MIN_CDELAY) {
  1565. X            beep();
  1566. X            if (cdelay > MAX_CDELAY)
  1567. X                cdelay = MAX_CDELAY;
  1568. X            else
  1569. X                cdelay = MIN_CDELAY;
  1570. X            mvwprintw(dt_win, 5, 23, "%-3d", cdelay);
  1571. X        }
  1572. X    }
  1573. X                    /* get the rdelay number */
  1574. X    wmove(dt_win, 6, 22);
  1575. X    wrefresh(dt_win);
  1576. X    if ((rdelay = get_num(dt_win, 3)) == -1) {
  1577. X        delwin(dt_win);
  1578. X        return;
  1579. X    }
  1580. X                    /* give 'em the current settings */
  1581. X    if (!rdelay) {
  1582. X        rdelay = param->r_delay;
  1583. X        wprintw(dt_win, "%-3d", rdelay);
  1584. X    }
  1585. X    else {
  1586. X                    /* some reasonable limit */
  1587. X        if (rdelay > MAX_PAUSE || rdelay < MIN_PAUSE) {
  1588. X            beep();
  1589. X            if (rdelay > MAX_PAUSE)
  1590. X                rdelay = MAX_PAUSE;
  1591. X            else
  1592. X                rdelay = MIN_PAUSE;
  1593. X            mvwprintw(dt_win, 6, 22, "%-3d", rdelay);
  1594. X        }
  1595. X    }
  1596. X                    /* set 'em */
  1597. X    param->c_delay = cdelay;
  1598. X    param->r_delay = rdelay;
  1599. X                    /* save 'em to disk? */
  1600. X    if (yes_prompt(dt_win, 7, 12, A_BOLD, "Save to disk")) {
  1601. X        if (up_param()) {
  1602. X            touchwin(dt_win);
  1603. X            wrefresh(dt_win);
  1604. X        }
  1605. X    }
  1606. X
  1607. X    delwin(dt_win);
  1608. X    return;
  1609. X}
  1610. END_OF_FILE
  1611. if test 1958 -ne `wc -c <'di_delay.c'`; then
  1612.     echo shar: \"'di_delay.c'\" unpacked with wrong size!
  1613. fi
  1614. # end of 'di_delay.c'
  1615. fi
  1616. if test -f 'dial_dir.h' -a "${1}" != "-c" ; then 
  1617.   echo shar: Will not clobber existing file \"'dial_dir.h'\"
  1618. else
  1619. echo shar: Extracting \"'dial_dir.h'\" \(958 characters\)
  1620. sed "s/^X//" >'dial_dir.h' <<'END_OF_FILE'
  1621. X/*
  1622. X * The dialing directory structure.  The first eight elements are
  1623. X * contained in the pcomm.dial_dir file.
  1624. X */
  1625. X
  1626. X#define NUM_DIR        100
  1627. X#define NUM_QUEUE    10
  1628. X#define FAST        0
  1629. X#define SLOW        1
  1630. X#define QUIET        0
  1631. X#define VERBOSE        1
  1632. X
  1633. struct DIAL_DIR {
  1634. X    char    *name[NUM_DIR+1];    /* name of system being called */
  1635. X    char    *number[NUM_DIR+1];    /* phone number */
  1636. X    unsigned int    baud[NUM_DIR+1];/* baud rate */
  1637. X    char    parity[NUM_DIR+1];    /* parity */
  1638. X    int    data_bits[NUM_DIR+1];    /* data bits */
  1639. X    int    stop_bits[NUM_DIR+1];    /* stop bits */
  1640. X    char    duplex[NUM_DIR+1];    /* duplex (F = full, H = half) */
  1641. X    char    *aux[NUM_DIR+1];    /* auxiliary (script, TTY, or modem) */
  1642. X
  1643. X    int    q_num[NUM_QUEUE];    /* entry numbers in the queue */
  1644. X    char    q_ld[NUM_QUEUE];    /* LD codes in the queue */
  1645. X
  1646. X    int    d_entries;        /* number of entries in the file */
  1647. X    int    d_cur;            /* the current entry */
  1648. X
  1649. X    char    *d_path;        /* path to the pcomm.dial_dir file */
  1650. X};
  1651. X
  1652. X#ifndef MAIN
  1653. extern struct DIAL_DIR *dir;
  1654. X#endif /* MAIN */
  1655. END_OF_FILE
  1656. if test 958 -ne `wc -c <'dial_dir.h'`; then
  1657.     echo shar: \"'dial_dir.h'\" unpacked with wrong size!
  1658. fi
  1659. # end of 'dial_dir.h'
  1660. fi
  1661. if test -f 'expand.c' -a "${1}" != "-c" ; then 
  1662.   echo shar: Will not clobber existing file \"'expand.c'\"
  1663. else
  1664. echo shar: Extracting \"'expand.c'\" \(2891 characters\)
  1665. sed "s/^X//" >'expand.c' <<'END_OF_FILE'
  1666. X/*
  1667. X * Do file name expansion with "native" shell.  Using the native shell
  1668. X * (as described in the SHELL environmental variable) allows for csh or
  1669. X * ksh abbreviations that sh doesn't recognize.  Returns a pointer to
  1670. X * a static area.
  1671. X */
  1672. X
  1673. X#define EXPAND_BUF    2048
  1674. X
  1675. X#include <stdio.h>
  1676. X#include <signal.h>
  1677. X#include <fcntl.h>
  1678. X#include "config.h"
  1679. X
  1680. X#ifdef BSD
  1681. X#include <sys/file.h>
  1682. X#endif /* BSD */
  1683. X
  1684. char *
  1685. expand(input)
  1686. char *input;
  1687. X{
  1688. X    extern char *null_ptr;
  1689. X    FILE *pfp, *n_popen();
  1690. X    int last;
  1691. X    char buf[1024], *strpbrk(), *strcpy();
  1692. X    static char ans[EXPAND_BUF];
  1693. X
  1694. X                    /* same rules as str_dup() */
  1695. X    if (input == NULL)
  1696. X        return(NULL);
  1697. X    if (*input == '\0')
  1698. X        return(null_ptr);
  1699. X                    /* any thing to expand? */
  1700. X    if (!strpbrk(input, "$*{}[]\\?~")) {
  1701. X        strcpy(ans, input);
  1702. X        return(ans);
  1703. X    }
  1704. X                    /* popen an echo */
  1705. X    sprintf(buf, "echo %s", input);
  1706. X
  1707. X    pfp = n_popen(buf, "r");
  1708. X    fgets(ans, EXPAND_BUF, pfp);
  1709. X    n_pclose(pfp);
  1710. X
  1711. X    if (!strlen(ans)) {
  1712. X        strcpy(ans, input);
  1713. X        return(ans);
  1714. X    }
  1715. X    /*
  1716. X     * A horrible kludge...  if the last character is not a line
  1717. X     * feed, then the csh has returned an error message.  Otherwise
  1718. X     * zap the line feed.
  1719. X     */
  1720. X    last = strlen(ans) -1;
  1721. X    if (ans[last] != '\n') {
  1722. X        strcpy(ans, input);
  1723. X        return(ans);
  1724. X    }
  1725. X    else
  1726. X        ans[last] = '\0';
  1727. X
  1728. X    return(ans);
  1729. X}
  1730. X
  1731. X#define    tst(a,b) (*mode == 'r'? (b) : (a))
  1732. X#define    RDR    0
  1733. X#define    WTR    1
  1734. static int popen_pid[20];
  1735. X
  1736. XFILE *
  1737. n_popen(cmd, mode)
  1738. char *cmd, *mode;
  1739. X{
  1740. X    int myside, hisside, ppid, p[2];
  1741. X    char *shellpath, *shell, *flags, *getenv(), *strrchr();
  1742. X    void _exit();
  1743. X
  1744. X    if (pipe(p) < 0)
  1745. X        return NULL;
  1746. X
  1747. X    myside = tst(p[WTR], p[RDR]);
  1748. X    hisside = tst(p[RDR], p[WTR]);
  1749. X                    /* get the environmental variable */
  1750. X    shellpath = getenv("SHELL");
  1751. X    if (shellpath == NULL || *shellpath == '\0')
  1752. X        shellpath = "/bin/sh";
  1753. X
  1754. X    if (shell = strrchr(shellpath, '/'))
  1755. X        shell++;
  1756. X    else {
  1757. X        shellpath = "/bin/sh";
  1758. X        shell = "sh";
  1759. X    }
  1760. X                    /* fix up the flags */
  1761. X    if (!strcmp(shell, "csh"))
  1762. X        flags = "-fc";
  1763. X    else
  1764. X        flags = "-c";        /* Korn shell too */
  1765. X
  1766. X    if (!(ppid = fork())) {
  1767. X        int stdio;
  1768. X                    /* no error messages please */
  1769. X        close(2);
  1770. X        open("/dev/null", O_WRONLY);
  1771. X
  1772. X        setgid(getgid());
  1773. X        setuid(getuid());
  1774. X
  1775. X        stdio = tst(0, 1);
  1776. X        close(myside);
  1777. X        close(stdio);
  1778. X        fcntl(hisside, F_DUPFD, stdio);
  1779. X        close(hisside);
  1780. X
  1781. X        execl(shellpath, shell, flags, cmd, (char *) 0);
  1782. X        _exit(1);
  1783. X    }
  1784. X    if (ppid == -1) {
  1785. X        close(myside);
  1786. X        close(hisside);
  1787. X        return NULL;
  1788. X    }
  1789. X
  1790. X    popen_pid[myside] = ppid;
  1791. X
  1792. X    close(hisside);
  1793. X    return(fdopen(myside, mode));
  1794. X}
  1795. X
  1796. n_pclose(ptr)
  1797. XFILE *ptr;
  1798. X{
  1799. X    SIG_TYPE (*hstat)(), (*istat)(), (*qstat)();
  1800. X    int f, r, sig_status;
  1801. X
  1802. X    f = fileno(ptr);
  1803. X    fclose(ptr);
  1804. X    istat = signal(SIGINT, SIG_IGN);
  1805. X    qstat = signal(SIGQUIT, SIG_IGN);
  1806. X    hstat = signal(SIGHUP, SIG_IGN);
  1807. X
  1808. X    while ((r = wait(&sig_status)) != popen_pid[f] && r != -1)
  1809. X        ;
  1810. X
  1811. X    if (r == -1)
  1812. X        sig_status = -1;
  1813. X
  1814. X    signal(SIGINT, istat);
  1815. X    signal(SIGQUIT, qstat);
  1816. X    signal(SIGHUP, hstat);
  1817. X    return(sig_status);
  1818. X}
  1819. END_OF_FILE
  1820. if test 2891 -ne `wc -c <'expand.c'`; then
  1821.     echo shar: \"'expand.c'\" unpacked with wrong size!
  1822. fi
  1823. # end of 'expand.c'
  1824. fi
  1825. if test -f 'extrnl.h' -a "${1}" != "-c" ; then 
  1826.   echo shar: Will not clobber existing file \"'extrnl.h'\"
  1827. else
  1828. echo shar: Extracting \"'extrnl.h'\" \(623 characters\)
  1829. sed "s/^X//" >'extrnl.h' <<'END_OF_FILE'
  1830. X/*
  1831. X * The external file transfer program database.  The list is limited to
  1832. X * 3 uploads and 3 downloads because the xfer_menu() routine uses single
  1833. X * character input (and these selections become 7, 8, and 9).
  1834. X */
  1835. X
  1836. struct EXTRNL {
  1837. X    char    *name[2][3];        /* program name (for display only) */
  1838. X    char    *command[2][3];        /* the command line */
  1839. X    char    prompt[2][3];        /* need to prompt for names? */
  1840. X
  1841. X    int    up_entries;        /* number of up entries in the file */
  1842. X    int    dn_entries;        /* number of down entries in the file */
  1843. X
  1844. X    char    *e_path;        /* path to the pcomm.extrnl file */
  1845. X};
  1846. X
  1847. X#ifndef MAIN
  1848. extern struct EXTRNL *extrnl;
  1849. X#endif /* MAIN */
  1850. END_OF_FILE
  1851. if test 623 -ne `wc -c <'extrnl.h'`; then
  1852.     echo shar: \"'extrnl.h'\" unpacked with wrong size!
  1853. fi
  1854. # end of 'extrnl.h'
  1855. fi
  1856. if test -f 'getcwd.c' -a "${1}" != "-c" ; then 
  1857.   echo shar: Will not clobber existing file \"'getcwd.c'\"
  1858. else
  1859. echo shar: Extracting \"'getcwd.c'\" \(393 characters\)
  1860. sed "s/^X//" >'getcwd.c' <<'END_OF_FILE'
  1861. X/*
  1862. X * Can you believe it???  Masscomps don't have a function to return the
  1863. X * current working directory while in the AT&T universe!
  1864. X */
  1865. X
  1866. X#include <stdio.h>
  1867. X
  1868. char *
  1869. getcwd(buf, size)
  1870. char *buf;
  1871. int size;
  1872. X{
  1873. X    FILE *pfp, *n_popen();
  1874. X
  1875. X    if (!(pfp = n_popen("pwd", "r")))
  1876. X        return(".");
  1877. X
  1878. X    fgets(buf, size, pfp);
  1879. X    n_pclose(pfp);
  1880. X                    /* zap the new line */
  1881. X    buf[strlen(buf)-1] = '\0';
  1882. X    return(buf);
  1883. X}
  1884. END_OF_FILE
  1885. if test 393 -ne `wc -c <'getcwd.c'`; then
  1886.     echo shar: \"'getcwd.c'\" unpacked with wrong size!
  1887. fi
  1888. # end of 'getcwd.c'
  1889. fi
  1890. if test -f 'getopt.c' -a "${1}" != "-c" ; then 
  1891.   echo shar: Will not clobber existing file \"'getopt.c'\"
  1892. else
  1893. echo shar: Extracting \"'getopt.c'\" \(1055 characters\)
  1894. sed "s/^X//" >'getopt.c' <<'END_OF_FILE'
  1895. X/*
  1896. X * Parse the command line and return option flags and arguments
  1897. X */
  1898. X
  1899. X#include <stdio.h>
  1900. X#include "config.h"
  1901. X
  1902. int optind = 1;
  1903. char *optarg;
  1904. X
  1905. int
  1906. getopt(argc, argv, opts)
  1907. int argc;
  1908. char *argv[];
  1909. char *opts;
  1910. X{
  1911. X    static int sp = 1;
  1912. X    int c, strcmp();
  1913. X    char *cp, *strchr();
  1914. X
  1915. X    if (sp == 1) {
  1916. X        if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')
  1917. X            return(EOF);
  1918. X        else if (strcmp(argv[optind], "--") == 0) {
  1919. X            optind++;
  1920. X            return(EOF);
  1921. X        }
  1922. X    }
  1923. X    c = argv[optind][sp];
  1924. X    if (c == ':' || (cp=strchr(opts, c)) == NULL) {
  1925. X        fprintf(stderr, "%s: illegal option \"%c\"\n", argv[0], c);
  1926. X        if (argv[optind][++sp] == '\0') {
  1927. X            optind++;
  1928. X            sp = 1;
  1929. X        }
  1930. X        return('?');
  1931. X    }
  1932. X    if (*++cp == ':') {
  1933. X        if (argv[optind][sp+1] != '\0')
  1934. X            optarg = &argv[optind++][sp+1];
  1935. X        else if (++optind >= argc) {
  1936. X            fprintf(stderr, "%s: option \"%c\" requires an argument\n", argv[0], c);
  1937. X            sp = 1;
  1938. X            return('?');
  1939. X        } else
  1940. X            optarg = argv[optind++];
  1941. X        sp = 1;
  1942. X    } else {
  1943. X        if (argv[optind][++sp] == '\0') {
  1944. X            sp = 1;
  1945. X            optind++;
  1946. X        }
  1947. X        optarg = NULL;
  1948. X    }
  1949. X    return(c);
  1950. X}
  1951. END_OF_FILE
  1952. if test 1055 -ne `wc -c <'getopt.c'`; then
  1953.     echo shar: \"'getopt.c'\" unpacked with wrong size!
  1954. fi
  1955. # end of 'getopt.c'
  1956. fi
  1957. if test -f 'help.c' -a "${1}" != "-c" ; then 
  1958.   echo shar: Will not clobber existing file \"'help.c'\"
  1959. else
  1960. echo shar: Extracting \"'help.c'\" \(2115 characters\)
  1961. sed "s/^X//" >'help.c' <<'END_OF_FILE'
  1962. X/*
  1963. X * Display the help screen.  Press any key to continue.  If the ascii_hot
  1964. X * string is more than 4 characters wide, this screen will look silly.
  1965. X * Maybe one day, this will also contain full page descriptions of each
  1966. X * command.
  1967. X */
  1968. X
  1969. X#include <stdio.h>
  1970. X#include <curses.h>
  1971. X#include "config.h"
  1972. X#include "misc.h"
  1973. X
  1974. void
  1975. help_screen(hot)
  1976. char *hot;
  1977. X{
  1978. X    extern int fd;
  1979. X    WINDOW *h_win, *newwin();
  1980. X
  1981. X    h_win = newwin(17, 80, 0, 0);
  1982. X
  1983. X    mvwattrstr(h_win, 1, 29, A_BOLD, "P C O M M       H E L P\n");
  1984. X    horizontal(h_win, 2, 0, 80);
  1985. X    mvwattrstr(h_win, 4, 0, A_BOLD, "       Major Functions          Utility Functions         File Functions\n\n");
  1986. X#ifdef OLDCURSES
  1987. X    mvwprintw(h_win,  6,  2, "Dialing Directory.%4.4s-D  Program Info ....%4.4s-I  Send Files ....%4.4s-U", hot, hot, hot);
  1988. X    mvwprintw(h_win,  7,  2, "Auto Redial ......%4.4s-R  Setup Screen ....%4.4s-S  Receive Files .%4.4s-N", hot, hot, hot);
  1989. X#else /* OLDCURSES */
  1990. X    mvwprintw(h_win,  6,  2, "Dialing Directory.%4.4s-D  Program Info ....%4.4s-I  Send Files ....%4.4s-<up>", hot, hot, hot);
  1991. X    mvwprintw(h_win,  7,  2, "Auto Redial ......%4.4s-R  Setup Screen ....%4.4s-S  Receive Files .%4.4s-<down>", hot, hot, hot);
  1992. X#endif /* OLDCURSES */
  1993. X    mvwprintw(h_win,  8,  2, "Keyboard Macros ..%4.4s-M  Change Directory.%4.4s-B  Pass Thru Mode.%4.4s-T", hot, hot, hot);
  1994. X    mvwprintw(h_win,  9,  2, "Line Settings ....%4.4s-P  Clear Screen ....%4.4s-C  Directory .....%4.4s-F", hot, hot, hot);
  1995. X    mvwprintw(h_win, 10,  2, "Exit Pcomm .......%4.4s-X  Toggle Duplex ...%4.4s-E  Screen Dump ...%4.4s-G", hot, hot, hot);
  1996. X    mvwprintw(h_win, 11,  2, "Unix Gateway .....%4.4s-4  Hang Up Phone ...%4.4s-H  Start Data Log.%4.4s-1", hot, hot, hot);
  1997. X    mvwprintw(h_win, 12,  2, "Command Files ....%4.4s-5  Printer On/Off ..%4.4s-L  Toggle Log ....%4.4s-2", hot, hot, hot);
  1998. X    mvwprintw(h_win, 13, 28, "Toggle CR-CR/LF .%4.4s-3", hot);
  1999. X    mvwprintw(h_win, 14, 28, "Break Key .......%4.4s-7", hot);
  2000. X
  2001. X    box(h_win, VERT, HORZ);
  2002. X    mvwaddstr(h_win, 16, 26, " Press any key to continue ");
  2003. X    wrefresh(h_win);
  2004. X
  2005. X    wgetch(h_win);
  2006. X    if (fd == -1) {
  2007. X        werase(h_win);
  2008. X        wrefresh(h_win);
  2009. X    }
  2010. X    delwin(h_win);
  2011. X    return;
  2012. X}
  2013. END_OF_FILE
  2014. if test 2115 -ne `wc -c <'help.c'`; then
  2015.     echo shar: \"'help.c'\" unpacked with wrong size!
  2016. fi
  2017. # end of 'help.c'
  2018. fi
  2019. if test -f 'info.c' -a "${1}" != "-c" ; then 
  2020.   echo shar: Will not clobber existing file \"'info.c'\"
  2021. else
  2022. echo shar: Extracting \"'info.c'\" \(1585 characters\)
  2023. sed "s/^X//" >'info.c' <<'END_OF_FILE'
  2024. X/*
  2025. X * Display the initial welcome screen (to include all of the proper
  2026. X * acknowledgements).  Press any key to continue.
  2027. X */
  2028. X
  2029. X#include <stdio.h>
  2030. X#include <curses.h>
  2031. X#include "patchlevel.h"
  2032. X
  2033. void
  2034. info(auto_clear)
  2035. int auto_clear;
  2036. X{
  2037. X    extern int fd;
  2038. X    WINDOW *w_win, *newwin();
  2039. X    char buf[80];
  2040. X                    /* display the welcome screen */
  2041. X    w_win = newwin(23, 80, 0, 0);
  2042. X    mvwaddstr(w_win, 3, 18, "PPPPPP    CCCC    OOOO    MM   MM   MM   MM");
  2043. X    mvwaddstr(w_win, 4, 18, "P    P   C       O    O   M M M M   M M M M");
  2044. X    mvwaddstr(w_win, 5, 18, "PPPPPP   C       O    O   M  M  M   M  M  M");
  2045. X    mvwaddstr(w_win, 6, 18, "P        C       O    O   M     M   M     M");
  2046. X    mvwaddstr(w_win, 7, 18, "P         CCCC    OOOO    M     M   M     M");
  2047. X
  2048. X    sprintf(buf, ">>> Pcomm Version %s <<<", VERSION);
  2049. X    mvwaddstr(w_win, 10, (80-strlen(buf))/2, buf);
  2050. X    sprintf(buf, "Release date: %s", DATE);
  2051. X    mvwaddstr(w_win, 11, (80-strlen(buf))/2, buf);
  2052. X
  2053. X    mvwaddstr(w_win, 13, 8, "Pcomm is a public domain telecommunication program for Unix that");
  2054. X    mvwaddstr(w_win, 14, 8, "is designed to operate similarly to the MSDOS program, ProComm.");
  2055. X    mvwaddstr(w_win, 15, 8, "ProComm (TM) is copyrighted by Datastorm Technologies, Inc.");
  2056. X    mvwaddstr(w_win, 19, 45, "Emmet P. Gray");
  2057. X    mvwaddstr(w_win, 20, 45, "...!uunet!uiucuxc!fthood!egray");
  2058. X    mvwaddstr(w_win, 21, 45, "fthood!egray@uxc.cso.uiuc.edu");
  2059. X    wmove(w_win, 22, 79);
  2060. X    wrefresh(w_win);
  2061. X                    /* delay so you can read the herald */
  2062. X    if (auto_clear)
  2063. X        wait_key(w_win, 5);
  2064. X    else
  2065. X        wgetch(w_win);
  2066. X
  2067. X    if (fd == -1) {
  2068. X        werase(w_win);
  2069. X        wrefresh(w_win);
  2070. X    }
  2071. X    delwin(w_win);
  2072. X    return;
  2073. X}
  2074. END_OF_FILE
  2075. if test 1585 -ne `wc -c <'info.c'`; then
  2076.     echo shar: \"'info.c'\" unpacked with wrong size!
  2077. fi
  2078. # end of 'info.c'
  2079. fi
  2080. if test -f 'init.c' -a "${1}" != "-c" ; then 
  2081.   echo shar: Will not clobber existing file \"'init.c'\"
  2082. else
  2083. echo shar: Extracting \"'init.c'\" \(1911 characters\)
  2084. sed "s/^X//" >'init.c' <<'END_OF_FILE'
  2085. X/*
  2086. X * Display the welcome screen and find the Pcomm support files.  Returns a
  2087. X * pointer to a static area containing the STATUS structure.
  2088. X */
  2089. X
  2090. X#include <stdio.h>
  2091. X#include <curses.h>
  2092. X#include "config.h"
  2093. X#include "misc.h"
  2094. X#include "status.h"
  2095. X
  2096. static char *extra_dir;
  2097. X
  2098. struct STATUS *
  2099. init(extra)
  2100. char *extra;
  2101. X{
  2102. X    int i;
  2103. X    char *memset(), *str_dup();
  2104. X    static struct STATUS s;
  2105. X                    /* some defaults */
  2106. X    s.dup_fd = -1;
  2107. X    s.cmd_ipc = -1;
  2108. X    s.connected = 0;
  2109. X    s.log_status = 0;
  2110. X    s.log_path = str_dup("NOT_DEFINED");
  2111. X    s.print_status = 0;
  2112. X    s.row = 0;
  2113. X    s.col = 0;
  2114. X    for (i=0; i<MAX_ROW; i++)
  2115. X        memset(s.vs[i], '\0', MAX_COL);
  2116. X    s.max_row = (LINES > MAX_ROW) ? MAX_ROW : LINES; 
  2117. X    s.max_col = (COLS >= MAX_COL) ? MAX_COL -1 : COLS; 
  2118. X
  2119. X    extra_dir = str_dup(extra);
  2120. X    return(&s);
  2121. X}
  2122. X
  2123. X/*
  2124. X * Search the extra directory (supplied on the command line), then the
  2125. X * directory in the PCOMM environmental variable, then the current working
  2126. X * directory, and lastly, the default directory.
  2127. X */
  2128. X
  2129. char *
  2130. findfile(name)
  2131. char *name;
  2132. X{
  2133. X    int i;
  2134. X    char *pcomm, *getenv(), *path, pbuf[200], *getcwd(), *str_dup();
  2135. X    char temp[200];
  2136. X
  2137. X                    /* see if PCOMM variable is set */
  2138. X    pcomm = getenv("PCOMM");
  2139. X    if (pcomm == NULL || *pcomm == '\0')
  2140. X        pcomm = NULL;
  2141. X    else {
  2142. X                    /* zap the trailing separator */
  2143. X        if (pcomm[strlen(pcomm)-1] == '/')
  2144. X            pcomm[strlen(pcomm)-1] = '\0';
  2145. X    }
  2146. X
  2147. X    for (i=0; i<4; i++) {
  2148. X                    /* directory search order */
  2149. X        switch (i) {
  2150. X            case 0:        /* extra directory from command line */
  2151. X                path = extra_dir;
  2152. X                break;
  2153. X            case 1:        /* PCOMM environmental variable */
  2154. X                path = pcomm;
  2155. X                break;
  2156. X            case 2:        /* current working directory */
  2157. X                path = getcwd(pbuf, 200);
  2158. X                break;
  2159. X            case 3:        /* Pcomm's default directory */
  2160. X                path = DEFAULT_DIR;
  2161. X                break;
  2162. X        }
  2163. X        if (path == NULL)
  2164. X            continue;
  2165. X
  2166. X        sprintf(temp, "%s/%s", path, name);
  2167. X                    /* read permission checked */
  2168. X        if (!access(temp, 4))
  2169. X            return(str_dup(temp));
  2170. X    }
  2171. X    return(NULL);
  2172. X}
  2173. END_OF_FILE
  2174. if test 1911 -ne `wc -c <'init.c'`; then
  2175.     echo shar: \"'init.c'\" unpacked with wrong size!
  2176. fi
  2177. # end of 'init.c'
  2178. fi
  2179. if test -f 'ipc.h' -a "${1}" != "-c" ; then 
  2180.   echo shar: Will not clobber existing file \"'ipc.h'\"
  2181. else
  2182. echo shar: Extracting \"'ipc.h'\" \(108 characters\)
  2183. sed "s/^X//" >'ipc.h' <<'END_OF_FILE'
  2184. X/*
  2185. X * Header for the mupliplexed I/O stuff
  2186. X */
  2187. X
  2188. X#define KEY_READY    1
  2189. X#define TTY_READY    2
  2190. X#define CMD_READY    4
  2191. END_OF_FILE
  2192. if test 108 -ne `wc -c <'ipc.h'`; then
  2193.     echo shar: \"'ipc.h'\" unpacked with wrong size!
  2194. fi
  2195. # end of 'ipc.h'
  2196. fi
  2197. if test -f 'ipc_att.c' -a "${1}" != "-c" ; then 
  2198.   echo shar: Will not clobber existing file \"'ipc_att.c'\"
  2199. else
  2200. echo shar: Extracting \"'ipc_att.c'\" \(2183 characters\)
  2201. sed "s/^X//" >'ipc_att.c' <<'END_OF_FILE'
  2202. X/*
  2203. X * The IPC and multiplexed I/O routines for AT&T flavors of Unix
  2204. X */
  2205. X
  2206. X#include <stdio.h>
  2207. X#ifndef MAIN
  2208. X#include <stropts.h>
  2209. X#include <poll.h>
  2210. X#include <fcntl.h>
  2211. X#include <sys/stream.h>
  2212. X#include "ipc.h"
  2213. X
  2214. X#define PSEUDO_TTY    "/dev/ptmx"
  2215. X
  2216. static struct pollfd fds[3];
  2217. static int time_out;
  2218. X
  2219. void
  2220. ipc_init(tty_fd, cmd_fd)
  2221. int tty_fd, cmd_fd;
  2222. X{
  2223. X    fds[0].fd = 0;            /* the keyboard */
  2224. X    fds[0].events = POLLIN;
  2225. X    fds[0].revents = 0;
  2226. X    fds[1].fd = tty_fd;        /* the TTY */
  2227. X    fds[1].events = POLLIN;
  2228. X    fds[1].revents = 0;
  2229. X    fds[2].fd = cmd_fd;        /* the shell script */
  2230. X    fds[2].events = POLLIN;
  2231. X    fds[2].revents = 0;
  2232. X                    /* 1 sec loop, or wait forever */
  2233. X    if (cmd_fd != -1)
  2234. X        time_out = 1000000;
  2235. X    else
  2236. X        time_out = -1;
  2237. X    return;
  2238. X}
  2239. X
  2240. X/* ARGSUSED */
  2241. int
  2242. ipc_poll(tty_fd, cmd_fd)
  2243. int tty_fd, cmd_fd;
  2244. X{
  2245. X    int ret_code;
  2246. X
  2247. X    poll(fds, 3, time_out);
  2248. X
  2249. X    ret_code = 0;
  2250. X    if (fds[0].revents & POLLIN)
  2251. X        ret_code |= KEY_READY;
  2252. X
  2253. X    if (fds[1].revents & POLLIN)
  2254. X        ret_code |= TTY_READY;
  2255. X
  2256. X    if (fds[2].revents & POLLIN)
  2257. X        ret_code |= CMD_READY;
  2258. X
  2259. X    return(ret_code);
  2260. X}
  2261. X
  2262. X/*
  2263. X * Update the file descriptors for poll()/select() that might have changed.
  2264. X */
  2265. X
  2266. void
  2267. ipc_update(tty_fd, cmd_fd)
  2268. int tty_fd, cmd_fd;
  2269. X{
  2270. X    fds[1].fd = tty_fd;
  2271. X    fds[2].fd = cmd_fd;
  2272. X
  2273. X    if (cmd_fd != -1)
  2274. X        time_out = 1000000;
  2275. X    else
  2276. X        time_out = -1;
  2277. X    return;
  2278. X}
  2279. X
  2280. X/*
  2281. X * Open an IPC "channel"
  2282. X */
  2283. X
  2284. int
  2285. ipc_open()
  2286. X{
  2287. X    int fd;
  2288. X
  2289. X    if ((fd = open(PSEUDO_TTY, O_RDWR)) < 0)
  2290. X        return(-1);
  2291. X
  2292. X    grantpt(fd);
  2293. X    unlockpt(fd);
  2294. X    return(fd);
  2295. X}
  2296. X
  2297. X/*
  2298. X * Close an IPC channel
  2299. X */
  2300. X
  2301. int
  2302. ipc_close(fd)
  2303. int fd;
  2304. X{
  2305. X    return(close(fd));
  2306. X}
  2307. X
  2308. X/*
  2309. X * Return a unique "key" to pass to the child process 
  2310. X */
  2311. X
  2312. char *
  2313. ipc_key(fd)
  2314. int fd;
  2315. X{
  2316. X    char *ptsname();
  2317. X
  2318. X    return(ptsname(fd));
  2319. X}
  2320. X#endif /* MAIN */
  2321. X
  2322. X/*
  2323. X * Attach to an existing IPC channel
  2324. X */
  2325. X
  2326. int
  2327. ipc_attach(dev, mode)
  2328. char *dev;
  2329. int mode;
  2330. X{
  2331. X    return(open(dev, mode));
  2332. X}
  2333. X
  2334. X/*
  2335. X * Detach from an IPC channel
  2336. X */
  2337. X
  2338. int
  2339. ipc_detach(fd)
  2340. int fd;
  2341. X{
  2342. X    return(close(fd));
  2343. X}
  2344. X
  2345. X/*
  2346. X * Read from an IPC channel
  2347. X */
  2348. X
  2349. int
  2350. ipc_read(fd, buf, n)
  2351. int fd;
  2352. char *buf;
  2353. int n;
  2354. X{
  2355. X    if (read(fd, buf, n) != n)
  2356. X        return(1);
  2357. X    return(0);
  2358. X}
  2359. X
  2360. X/*
  2361. X * Write to an IPC channel
  2362. X */
  2363. X
  2364. int
  2365. ipc_write(fd, buf, n)
  2366. int fd;
  2367. char *buf;
  2368. int n;
  2369. X{
  2370. X    if (write(fd, buf, n) != n)
  2371. X        return(1);
  2372. X    return(0);
  2373. X}
  2374. END_OF_FILE
  2375. if test 2183 -ne `wc -c <'ipc_att.c'`; then
  2376.     echo shar: \"'ipc_att.c'\" unpacked with wrong size!
  2377. fi
  2378. # end of 'ipc_att.c'
  2379. fi
  2380. if test -f 'ipc_ucb.c' -a "${1}" != "-c" ; then 
  2381.   echo shar: Will not clobber existing file \"'ipc_ucb.c'\"
  2382. else
  2383. echo shar: Extracting \"'ipc_ucb.c'\" \(2903 characters\)
  2384. sed "s/^X//" >'ipc_ucb.c' <<'END_OF_FILE'
  2385. X/*
  2386. X * The IPC and multiplexed I/O routines for Berkeley flavors of Unix
  2387. X */
  2388. X
  2389. X#include <stdio.h>
  2390. X#ifndef MAIN
  2391. X#include <fcntl.h>
  2392. X#include <sys/time.h>
  2393. X#include <sys/types.h>
  2394. X#include <sys/stat.h>
  2395. X#include <sys/file.h>
  2396. X#include "ipc.h"
  2397. X
  2398. static char pty_name[12];
  2399. static int fdin_mask, num_fds;
  2400. static struct timeval time_out = {1L, 0L};
  2401. static struct timeval *tp;
  2402. X
  2403. void
  2404. ipc_init(tty_fd, cmd_fd)
  2405. int tty_fd, cmd_fd;
  2406. X{
  2407. X    int fdout, fdin, fdex;
  2408. X
  2409. X    fdout = 0;
  2410. X    fdex = 0;
  2411. X    fdin_mask = 1;            /* the keyboard */
  2412. X    num_fds = 1;
  2413. X    if (tty_fd != -1) {        /* the TTY */
  2414. X        fdin_mask |= (1 << tty_fd);
  2415. X        num_fds = tty_fd +1;
  2416. X    }
  2417. X    if (cmd_fd != -1) {        /* the shell script */
  2418. X        fdin_mask |= (1 << cmd_fd);
  2419. X        if (cmd_fd > tty_fd)
  2420. X            num_fds = cmd_fd +1;
  2421. X        tp = &time_out;
  2422. X    }
  2423. X    else
  2424. X        tp = (struct timeval *) NULL;
  2425. X    return;
  2426. X}
  2427. X
  2428. int
  2429. ipc_poll(tty_fd, cmd_fd)
  2430. int tty_fd, cmd_fd;
  2431. X{
  2432. X    int ret_code, fdout, fdin, fdex;
  2433. X
  2434. X    ret_code = 0;
  2435. X    fdin = fdin_mask;
  2436. X    select(num_fds, &fdin, &fdout, &fdex, tp);
  2437. X
  2438. X    if (fdin & 1)
  2439. X        ret_code |= KEY_READY;
  2440. X
  2441. X    if (tty_fd != -1 && (fdin & (1 << tty_fd)))
  2442. X        ret_code |= TTY_READY;
  2443. X
  2444. X    if (cmd_fd != -1 && (fdin & (1 << cmd_fd)))
  2445. X        ret_code |= CMD_READY;
  2446. X
  2447. X    return(ret_code);
  2448. X}
  2449. X
  2450. X/*
  2451. X * Update the file descriptors for poll()/select() that might have changed.
  2452. X */
  2453. X
  2454. void
  2455. ipc_update(tty_fd, cmd_fd)
  2456. int tty_fd, cmd_fd;
  2457. X{
  2458. X    fdin_mask = 1;
  2459. X    num_fds = 1;
  2460. X    if (tty_fd != -1) {
  2461. X        fdin_mask |= (1 << tty_fd);
  2462. X        num_fds = tty_fd +1;
  2463. X    }
  2464. X    if (cmd_fd != -1) {
  2465. X        fdin_mask |= (1 << cmd_fd);
  2466. X        if (cmd_fd > tty_fd)
  2467. X            num_fds = cmd_fd +1;
  2468. X        tp = &time_out;
  2469. X    }
  2470. X    else
  2471. X        tp = (struct timeval *) NULL;
  2472. X    return;
  2473. X}
  2474. X
  2475. X/*
  2476. X * Open an IPC "channel"
  2477. X */
  2478. X
  2479. int
  2480. ipc_open()
  2481. X{
  2482. X    int fd, i, j;
  2483. X    char *p, *strcpy();
  2484. X    struct stat sbuf;
  2485. X    static char letters[] = "pqrs";
  2486. X    static char hex_num[] = "0123456789abcdef";
  2487. X
  2488. X    strcpy(pty_name, "/dev/ptyxx");
  2489. X
  2490. X    for (i=0; i<4; i++) {
  2491. X        pty_name[8] = letters[i];
  2492. X        for (j=0; j<16; j++) {
  2493. X            pty_name[9] = hex_num[j];
  2494. X                    /* if it doesn't exist, quit */
  2495. X            if (stat(pty_name, &sbuf) < 0)
  2496. X                return(-1);
  2497. X
  2498. X            if ((fd = open(pty_name, O_RDWR)) >= 0)
  2499. X                return(fd);
  2500. X        }
  2501. X    }
  2502. X    return(-1);
  2503. X}
  2504. X
  2505. X/*
  2506. X * Close an IPC channel
  2507. X */
  2508. X
  2509. int
  2510. ipc_close(fd)
  2511. int fd;
  2512. X{
  2513. X    return(close(fd));
  2514. X}
  2515. X
  2516. X/*
  2517. X * Return a unique "key" to pass to the child process 
  2518. X */
  2519. X
  2520. X/* ARGSUSED */
  2521. char *
  2522. ipc_key(fd)
  2523. int fd;
  2524. X{
  2525. X    static char tty_name[12];
  2526. X    char *strcpy();
  2527. X
  2528. X    strcpy(tty_name, pty_name);
  2529. X    tty_name[5] = 't';
  2530. X    return(tty_name);
  2531. X}
  2532. X#endif /* MAIN */
  2533. X
  2534. X/*
  2535. X * Attach to an existing IPC channel
  2536. X */
  2537. X
  2538. int
  2539. ipc_attach(dev, mode)
  2540. char *dev;
  2541. int mode;
  2542. X{
  2543. X    return(open(dev, mode));
  2544. X}
  2545. X
  2546. X/*
  2547. X * Detach from an IPC channel
  2548. X */
  2549. X
  2550. int
  2551. ipc_detach(fd)
  2552. int fd;
  2553. X{
  2554. X    return(close(fd));
  2555. X}
  2556. X
  2557. X/*
  2558. X * Read from an IPC channel
  2559. X */
  2560. X
  2561. int
  2562. ipc_read(fd, buf, n)
  2563. int fd;
  2564. char *buf;
  2565. int n;
  2566. X{
  2567. X    if (read(fd, buf, n) != n)
  2568. X        return(1);
  2569. X    return(0);
  2570. X}
  2571. X
  2572. X/*
  2573. X * Write to an IPC channel
  2574. X */
  2575. X
  2576. int
  2577. ipc_write(fd, buf, n)
  2578. int fd;
  2579. char *buf;
  2580. int n;
  2581. X{
  2582. X    if (write(fd, buf, n) != n)
  2583. X        return(1);
  2584. X    return(0);
  2585. X}
  2586. END_OF_FILE
  2587. if test 2903 -ne `wc -c <'ipc_ucb.c'`; then
  2588.     echo shar: \"'ipc_ucb.c'\" unpacked with wrong size!
  2589. fi
  2590. # end of 'ipc_ucb.c'
  2591. fi
  2592. if test -f 'list_dir.c' -a "${1}" != "-c" ; then 
  2593.   echo shar: Will not clobber existing file \"'list_dir.c'\"
  2594. else
  2595. echo shar: Extracting \"'list_dir.c'\" \(1615 characters\)
  2596. sed "s/^X//" >'list_dir.c' <<'END_OF_FILE'
  2597. X/*
  2598. X * Do a shell escape with the "ls" command.  Additional command line options
  2599. X * are allowed at run time.
  2600. X */
  2601. X
  2602. X#define LS_CMD "ls -aC"
  2603. X
  2604. X#include <stdio.h>
  2605. X#include <curses.h>
  2606. X#include "misc.h"
  2607. X
  2608. void
  2609. list_dir()
  2610. X{
  2611. X    extern int fd;
  2612. X    WINDOW *ls_win, *newwin();
  2613. X    FILE *pfp, *n_popen();
  2614. X    int lines, oops;
  2615. X    char *ans, *cwd, *getcwd(), buf[200], *get_str();
  2616. X
  2617. X    ls_win = newwin(6, 70, 8, 5);
  2618. X
  2619. X    cwd = getcwd(buf, 200);
  2620. X
  2621. X    mvwprintw(ls_win, 2, 4, "Current directory: %s", cwd);
  2622. X    mvwaddstr(ls_win, 3, 4, "File spec (wildcards allowed): ");
  2623. X    box(ls_win, VERT, HORZ);
  2624. X
  2625. X    mvwattrstr(ls_win, 0, 3, A_BOLD, " List Directory ");
  2626. X    wmove(ls_win, 3, 35);
  2627. X    wrefresh(ls_win);
  2628. X
  2629. X    if ((ans = get_str(ls_win, 80, "", "\n")) == NULL) {
  2630. X        if (fd == -1) {
  2631. X            werase(ls_win);
  2632. X            wrefresh(ls_win);
  2633. X        }
  2634. X        delwin(ls_win);
  2635. X        return;
  2636. X    }
  2637. X                    /* popen() an ls */
  2638. X    sprintf(buf, "%s %s", LS_CMD, ans);
  2639. X    pfp = n_popen(buf, "r");
  2640. X                    /* make a bigger window */
  2641. X    werase(ls_win);
  2642. X    wrefresh(ls_win);
  2643. X    delwin(ls_win);
  2644. X    ls_win = newwin(LINES-1, COLS, 0, 0);
  2645. X    touchwin(ls_win);
  2646. X                    /* a crude kind of paging */
  2647. X    oops = 0;
  2648. X    lines = 0;
  2649. X    while (fgets(buf, BUFSIZ, pfp) != NULL) {
  2650. X        waddstr(ls_win, buf);
  2651. X        lines++;
  2652. X        if (lines == LINES-2) {
  2653. X            lines = 0;
  2654. X            mvwaddstr(ls_win, LINES-2, 28, "Press any key for more");
  2655. X            wrefresh(ls_win);
  2656. X            if (wgetch(ls_win) == ESC) {
  2657. X                oops++;
  2658. X                break;
  2659. X            }
  2660. X            werase(ls_win);
  2661. X            wrefresh(ls_win);
  2662. X        }
  2663. X    }
  2664. X    n_pclose(pfp);
  2665. X
  2666. X    if (!oops) {
  2667. X        mvwaddstr(ls_win, LINES-2, 25, "Press any key to continue");
  2668. X        wrefresh(ls_win);
  2669. X        wgetch(ls_win);
  2670. X    }
  2671. X    if (fd == -1) {
  2672. X        werase(ls_win);
  2673. X        wrefresh(ls_win);
  2674. X    }
  2675. X    delwin(ls_win);
  2676. X    return;
  2677. X}
  2678. END_OF_FILE
  2679. if test 1615 -ne `wc -c <'list_dir.c'`; then
  2680.     echo shar: \"'list_dir.c'\" unpacked with wrong size!
  2681. fi
  2682. # end of 'list_dir.c'
  2683. fi
  2684. if test -f 'matches.c' -a "${1}" != "-c" ; then 
  2685.   echo shar: Will not clobber existing file \"'matches.c'\"
  2686. else
  2687. echo shar: Extracting \"'matches.c'\" \(770 characters\)
  2688. sed "s/^X//" >'matches.c' <<'END_OF_FILE'
  2689. X/*
  2690. X * See if two strings match.  Returns a 0 on success, and a 1 on failure.
  2691. X * This is an external program to be used in shell scripts.
  2692. X */
  2693. X
  2694. X#include <stdio.h>
  2695. X#include "config.h"
  2696. X
  2697. main(argc, argv)
  2698. int argc;
  2699. char *argv[];
  2700. X{
  2701. X    char *strstr();
  2702. X    void exit();
  2703. X
  2704. X    if (argc != 3) {
  2705. X        fprintf(stderr, "Usage: matches string1 string2\n");
  2706. X        exit(-1);
  2707. X    }
  2708. X
  2709. X    if (strstr(argv[1], argv[2]))
  2710. X        exit(0);
  2711. X    exit(1);
  2712. X}
  2713. X
  2714. X#ifndef HAVE_STRSTR
  2715. X/*
  2716. X * Return a pointer to the first occurrence of string str2 in str1.
  2717. X * Returns a NULL if str2 is not in str1.
  2718. X */
  2719. X
  2720. char *
  2721. strstr(str1, str2)
  2722. char *str1, *str2;
  2723. X{
  2724. X    int len;
  2725. X
  2726. X    len = strlen(str2);
  2727. X    while (*str1) {
  2728. X        if (*str2 == *str1) {
  2729. X            if (!strncmp(str2, str1, len))
  2730. X                return(str1);
  2731. X        }
  2732. X        str1++;
  2733. X    }
  2734. X    return(NULL);
  2735. X}
  2736. X#endif /* HAVE_STRSTR */
  2737. END_OF_FILE
  2738. if test 770 -ne `wc -c <'matches.c'`; then
  2739.     echo shar: \"'matches.c'\" unpacked with wrong size!
  2740. fi
  2741. # end of 'matches.c'
  2742. fi
  2743. if test -f 'misc.h' -a "${1}" != "-c" ; then 
  2744.   echo shar: Will not clobber existing file \"'misc.h'\"
  2745. else
  2746. echo shar: Extracting \"'misc.h'\" \(1465 characters\)
  2747. sed "s/^X//" >'misc.h' <<'END_OF_FILE'
  2748. X/*
  2749. X * Definitions to support the home-grown curses(3) functions and to make
  2750. X * the old curses(3) routines happy.
  2751. X */
  2752. X
  2753. X#define mvwattrstr(w,y,x,a,s)    (wmove(w,y,x)==ERR?ERR:wattrstr(w,a,s))
  2754. X#define mvwattrch(w,y,x,a,c)    (wmove(w,y,x)==ERR?ERR:wattrch(w,a,c))
  2755. X#define mvwattrnum(w,y,x,a,n)    (wmove(w,y,x)==ERR?ERR:wattrnum(w,a,n))
  2756. X#define mvattrstr(y,x,a,s)    (wmove(stdscr,y,x)==ERR?ERR:wattrstr(stdscr,a,s))
  2757. X#define mvattrch(y,x,a,c)    (wmove(stdscr,y,x)==ERR?ERR:wattrch(stdscr,a,c))
  2758. X#define mvattrnum(y,x,a,n)    (wmove(stdscr,y,x)==ERR?ERR:wattrnum(stdscr,a,n))
  2759. X#define attrstr(a,s)        wattrstr(stdscr,a,s)
  2760. X#define attrch(a,c)        wattrch(stdscr,a,c)
  2761. X#define attrnum(a,n)        wattrnum(stdscr,a,n)
  2762. X
  2763. X#ifndef A_BOLD
  2764. X#ifdef NOPROMOTE
  2765. X#define A_BOLD        0
  2766. X#define A_BLINK        0
  2767. X#define A_REVERSE    1
  2768. X#define A_DIM        0
  2769. X#define A_STANDOUT    1
  2770. X#define A_UNDERLINE    0
  2771. X#else /* NOPROMOTE */
  2772. X#define A_BOLD        1
  2773. X#define A_BLINK        1
  2774. X#define A_REVERSE    1
  2775. X#define A_DIM        1
  2776. X#define A_STANDOUT    1
  2777. X#define A_UNDERLINE    1
  2778. X#endif /* NOPROMOTE */
  2779. typedef char chtype;
  2780. X#endif /* A_BOLD */
  2781. X
  2782. X#ifdef ACS_HLINE
  2783. X#define VERT        (chtype)0
  2784. X#define HORZ        (chtype)0
  2785. X#else /* ACS_HLINE */
  2786. X#define VERT        (chtype)'|'
  2787. X#define HORZ        (chtype)'-'
  2788. X#define ACS_VLINE    (chtype)'|'
  2789. X#define ACS_HLINE    (chtype)'-'
  2790. X#endif /* ACS_HLINE */
  2791. X
  2792. X/*
  2793. X * Other miscellaneous stuff
  2794. X */
  2795. X
  2796. X#define BEL        7
  2797. X#define BS        8
  2798. X#define ESC        27
  2799. X#define DEL        127
  2800. X
  2801. X#define MANUAL_CLEAR    0
  2802. X#define AUTO_CLEAR    1
  2803. X
  2804. X#define DENIED        0
  2805. X#define WRITE_OK    1
  2806. X#define OK_BUT_EXISTS    2
  2807. END_OF_FILE
  2808. if test 1465 -ne `wc -c <'misc.h'`; then
  2809.     echo shar: \"'misc.h'\" unpacked with wrong size!
  2810. fi
  2811. # end of 'misc.h'
  2812. fi
  2813. if test -f 'modem.h' -a "${1}" != "-c" ; then 
  2814.   echo shar: Will not clobber existing file \"'modem.h'\"
  2815. else
  2816. echo shar: Extracting \"'modem.h'\" \(1652 characters\)
  2817. sed "s/^X//" >'modem.h' <<'END_OF_FILE'
  2818. X/*
  2819. X * The modem and TTY databases.  The first 3 elements make up the TTY
  2820. X * database, the next 16 make up the modem database.  A "tname" in common
  2821. X * with a "mname" link the two together.
  2822. X */
  2823. X
  2824. X#define NUM_TTY        10
  2825. X#define NUM_MODEM    10
  2826. X
  2827. X#define IS_SCRIPT    0
  2828. X#define IS_TTY        1
  2829. X#define IS_MODEM    2
  2830. X
  2831. struct MODEM {
  2832. X    char    *tty[NUM_TTY];        /* TTY names */
  2833. X    char    *tname[NUM_TTY];    /* modem name */
  2834. X    int    lock_sp[NUM_TTY];    /* DTE locked baud rate */
  2835. X
  2836. X    char    *mname[NUM_MODEM];    /* modem name (matches tname above) */
  2837. X    char    *init[NUM_MODEM];    /* initialization */
  2838. X    char    *dial[NUM_MODEM];    /* dial command */
  2839. X    char    *suffix[NUM_MODEM];    /* dialing command suffix */
  2840. X    char    *hang_up[NUM_MODEM];    /* hang up the modem */
  2841. X    char    auto_baud[NUM_MODEM];    /* should we sync baud rates? */
  2842. X    char    *con_3[NUM_MODEM];    /* 300 baud connect message */
  2843. X    char    *con_12[NUM_MODEM];    /* 1200 baud connect message */
  2844. X    char    *con_24[NUM_MODEM];    /* 2400 baud connect message */
  2845. X    char    *con_48[NUM_MODEM];    /* 4800 baud connect message */
  2846. X    char    *con_96[NUM_MODEM];    /* 9600 baud connect message */
  2847. X    char    *con_192[NUM_MODEM];    /* 19200 baud connect message */
  2848. X    char    *con_384[NUM_MODEM];    /* 38400 baud connect message */
  2849. X    char    *no_con1[NUM_MODEM];    /* no connect #1 */
  2850. X    char    *no_con2[NUM_MODEM];    /* no connect #2 */
  2851. X    char    *no_con3[NUM_MODEM];    /* no connect #3 */
  2852. X    char    *no_con4[NUM_MODEM];    /* no connect #4 */
  2853. X
  2854. X    int    t_entries;        /* number of TTY entries */
  2855. X    int    m_entries;        /* number of modem entries */
  2856. X    int    t_cur;            /* current TTY entry number */
  2857. X    int    m_cur;            /* current modem entry number */
  2858. X
  2859. X    char    *m_path;        /* path to the pcomm.modem file */
  2860. X};
  2861. X
  2862. X#ifndef MAIN
  2863. extern struct MODEM *modem;
  2864. X#endif /* MAIN */
  2865. END_OF_FILE
  2866. if test 1652 -ne `wc -c <'modem.h'`; then
  2867.     echo shar: \"'modem.h'\" unpacked with wrong size!
  2868. fi
  2869. # end of 'modem.h'
  2870. fi
  2871. if test -f 'n_shell.c' -a "${1}" != "-c" ; then 
  2872.   echo shar: Will not clobber existing file \"'n_shell.c'\"
  2873. else
  2874. echo shar: Extracting \"'n_shell.c'\" \(1302 characters\)
  2875. sed "s/^X//" >'n_shell.c' <<'END_OF_FILE'
  2876. X/*
  2877. X * Spawn a "native" shell.  Native means the shell found in the SHELL
  2878. X * environmental variable.
  2879. X */
  2880. X
  2881. X#include <stdio.h>
  2882. X#include <signal.h>
  2883. X#include <curses.h>
  2884. X#include "config.h"
  2885. X
  2886. void
  2887. n_shell()
  2888. X{
  2889. X    WINDOW *sh_win, *newwin();
  2890. X    SIG_TYPE (*istat)(), (*qstat)();
  2891. X    int sig_status, spid, w;
  2892. X    char *shell, *shellpath, *getenv(), *strrchr();
  2893. X    unsigned int sleep();
  2894. X    void _exit();
  2895. X                    /* a full window */
  2896. X    sh_win = newwin(LINES, COLS, 0, 0);
  2897. X
  2898. X    touchwin(sh_win);
  2899. X    waddstr(sh_win, "Pcomm <=> Unix gateway, use ^D or 'exit' to return\n");
  2900. X    wrefresh(sh_win);
  2901. X                    /* out of curses mode */
  2902. X    resetterm();
  2903. X
  2904. X    shellpath = getenv("SHELL");
  2905. X    if (shellpath == NULL || *shellpath == '\0')
  2906. X        shellpath = "/bin/sh";
  2907. X
  2908. X    if (shell = strrchr(shellpath, '/'))
  2909. X        shell++;
  2910. X    else {
  2911. X        shellpath = "/bin/sh";
  2912. X        shell = "sh";
  2913. X    }
  2914. X
  2915. X    if (!(spid = fork())) {
  2916. X        signal(SIGINT, SIG_DFL);
  2917. X        signal(SIGQUIT, SIG_DFL);
  2918. X
  2919. X        setgid(getgid());
  2920. X        setuid(getuid());
  2921. X
  2922. X        execl(shellpath, shell, "-i", (char *) 0);
  2923. X        _exit(1);
  2924. X    }
  2925. X    istat = signal(SIGINT, SIG_IGN);
  2926. X    qstat = signal(SIGQUIT, SIG_IGN);
  2927. X
  2928. X    while ((w = wait(&sig_status)) != spid && w != -1)
  2929. X        ;
  2930. X
  2931. X    signal(SIGINT, istat);
  2932. X    signal(SIGQUIT, qstat);
  2933. X                    /* back to curses mode */
  2934. X    sleep(1);
  2935. X    fixterm();
  2936. X
  2937. X    clearok(curscr, TRUE);
  2938. X    werase(sh_win);
  2939. X    wrefresh(sh_win);
  2940. X    delwin(sh_win);
  2941. X    return;
  2942. X}
  2943. END_OF_FILE
  2944. if test 1302 -ne `wc -c <'n_shell.c'`; then
  2945.     echo shar: \"'n_shell.c'\" unpacked with wrong size!
  2946. fi
  2947. # end of 'n_shell.c'
  2948. fi
  2949. if test -f 'param.h' -a "${1}" != "-c" ; then 
  2950.   echo shar: Will not clobber existing file \"'param.h'\"
  2951. else
  2952. echo shar: Extracting \"'param.h'\" \(2784 characters\)
  2953. sed "s/^X//" >'param.h' <<'END_OF_FILE'
  2954. X/*
  2955. X * The standard Pcomm parameters.  Everything can be altered by using one
  2956. X * of Pcomm's menus.  Although editing by hand is not encouraged, the
  2957. X * pcomm.param file is just an ASCII file.
  2958. X */
  2959. X
  2960. X#define MAX_CDELAY    120
  2961. X#define MIN_CDELAY    10
  2962. X#define MAX_PAUSE    120
  2963. X#define MIN_PAUSE    1
  2964. X#define MAX_TIMER    20
  2965. X#define MIN_TIMER    2
  2966. X
  2967. X#define NUM_PARAM    44
  2968. X#define LINE_SET    0
  2969. X#define TERM_SETUP    4
  2970. X#define GEN_SETUP    10
  2971. X#define DELAY_TIMES    19
  2972. X#define ASCII_SETUP    21
  2973. X#define LD_CODES    30
  2974. X#define MACROS        34
  2975. X
  2976. struct PARAM {
  2977. X                /* 0-3 used in ls_menu() */
  2978. X    unsigned int    d_baud;        /* default baud rate */
  2979. X    char    d_parity;        /* default parity */
  2980. X    int    d_data_bits;        /* default data bits */
  2981. X    int    d_stop_bits;        /* default stop bits */
  2982. X
  2983. X                /* 4-9 used in term_setup() */
  2984. X    int    hot_key;        /* the decimal code for the hot key */
  2985. X    char    *ascii_hot;        /* ascii representation of hot key */
  2986. X    char    *d_duplex;        /* default duplex */
  2987. X    char    *flow_ctrl;        /* flow control */
  2988. X    char    *cr_in;            /* send as carriage return */
  2989. X    char    *cr_out;        /* receive carriage return as */
  2990. X
  2991. X                /* 10-18 used in gen_setup() */
  2992. X    char    *logfile;        /* default log file */
  2993. X    char    *dumpfile;        /* default screen dump file */
  2994. X    char    *strip;            /* strip high bit (translate table) */
  2995. X    char    pause_char;        /* pause char synonym */
  2996. X    char    cr_char;        /* carriage return char synonym */
  2997. X    char    ctrl_char;        /* ctrl char synonym */
  2998. X    char    esc_char;        /* escape char synonym */
  2999. X    char    brk_char;        /* modem break synonym */
  3000. X    char    *abort;            /* destination of aborted downloads */
  3001. X
  3002. X                /* 19-20 used in gen_setup() & delay_times() */
  3003. X    int    c_delay;        /* connect delay time */
  3004. X    int    r_delay;        /* redial delay time */
  3005. X
  3006. X                /* 21-29 used in axfer_setup() */
  3007. X    char    *local_echo;        /* echo locally? */
  3008. X    char    *expand;        /* expand blank lines? */
  3009. X    int    cr_delay;        /* carriage return delay (ms) */
  3010. X    char    *pace;            /* pace the output? */
  3011. X    char    *cr_up;            /* send carriage return as */
  3012. X    char    *lf_up;            /* send line feed as */
  3013. X    int    timer;            /* transfer timeout */
  3014. X    char    *cr_dn;            /* receive carriage return as */
  3015. X    char    *lf_dn;            /* receive line feed as */
  3016. X
  3017. X                /* 30-33 used in d_revise() */
  3018. X    char    *ld_plus;        /* + long distance code */
  3019. X    char    *ld_minus;        /* - long distance code */
  3020. X    char    *ld_at;            /* @ long distance code */
  3021. X    char    *ld_pound;        /* # long distance code */
  3022. X
  3023. X                /* 34-43 used in macro() */
  3024. X    char    *mac_1;            /* shifted 1 macro */
  3025. X    char    *mac_2;            /* shifted 2 macro */
  3026. X    char    *mac_3;            /* shifted 3 macro */
  3027. X    char    *mac_4;            /* shifted 4 macro */
  3028. X    char    *mac_5;            /* shifted 5 macro */
  3029. X    char    *mac_6;            /* shifted 6 macro */
  3030. X    char    *mac_7;            /* shifted 7 macro */
  3031. X    char    *mac_8;            /* shifted 8 macro */
  3032. X    char    *mac_9;            /* shifted 9 macro */
  3033. X    char    *mac_0;            /* shifted 0 macro */
  3034. X
  3035. X    char    *p_path;        /* path to the pcomm.param file */
  3036. X};
  3037. X
  3038. X#ifndef MAIN
  3039. extern struct PARAM *param;
  3040. X#endif /* MAIN */
  3041. END_OF_FILE
  3042. if test 2784 -ne `wc -c <'param.h'`; then
  3043.     echo shar: \"'param.h'\" unpacked with wrong size!
  3044. fi
  3045. # end of 'param.h'
  3046. fi
  3047. if test -f 'passthru.c' -a "${1}" != "-c" ; then 
  3048.   echo shar: Will not clobber existing file \"'passthru.c'\"
  3049. else
  3050. echo shar: Extracting \"'passthru.c'\" \(2488 characters\)
  3051. sed "s/^X//" >'passthru.c' <<'END_OF_FILE'
  3052. X/*
  3053. X * A transparent "pass-thru" mode, designed to allow binary transfers
  3054. X * between 3 machines (with the middle machine in the pass-thru mode).
  3055. X */
  3056. X
  3057. X#include <stdio.h>
  3058. X#include <signal.h>
  3059. X#include <curses.h>
  3060. X#include "config.h"
  3061. X#include "misc.h"
  3062. X
  3063. X#ifdef BSD
  3064. X#include <setjmp.h>
  3065. jmp_buf cp_buf;
  3066. X#endif /* BSD */
  3067. X
  3068. static void cpio();
  3069. X
  3070. void
  3071. pass_thru()
  3072. X{
  3073. X    extern int fd;
  3074. X    WINDOW *pt_win, *newwin();
  3075. X    int num;
  3076. X    void error_win();
  3077. X
  3078. X    pt_win = newwin(5, 70, 5, 5);
  3079. X
  3080. X    mvwaddstr(pt_win, 2, 4, "Enter the expiration time (5-60 sec): ");
  3081. X    box(pt_win, VERT, HORZ);
  3082. X
  3083. X    mvwattrstr(pt_win, 0, 3, A_BOLD, " Pass Through Mode ");
  3084. X    wmove(pt_win, 2, 43);
  3085. X    wrefresh(pt_win);
  3086. X                    /* get the answer */
  3087. X    while ((num = get_num(pt_win, 2)) != -1) {
  3088. X                    /* out of bounds */
  3089. X        if (num < 5 || num > 60) {
  3090. X            beep();
  3091. X            clear_line(pt_win, 2, 43, TRUE);
  3092. X            wmove(pt_win, 2, 43);
  3093. X            wrefresh(pt_win);
  3094. X        }
  3095. X        else {
  3096. X            werase(pt_win);
  3097. X            wrefresh(pt_win);
  3098. X            delwin(pt_win);
  3099. X
  3100. X            if (fd == -1) {
  3101. X                error_win(0, "Not currently connected to any host", "");
  3102. X                return;
  3103. X            }
  3104. X
  3105. X            touchwin(stdscr);
  3106. X            refresh();
  3107. X
  3108. X            cpio((unsigned int) num);
  3109. X            return;
  3110. X        }
  3111. X    }
  3112. X    if (fd == -1) {
  3113. X        werase(pt_win);
  3114. X        wrefresh(pt_win);
  3115. X    }
  3116. X    delwin(pt_win);
  3117. X    return;
  3118. X}
  3119. X
  3120. X/*
  3121. X * Copy the stdin to the TTYout and copy the TTYin to the stdout.  Uses
  3122. X * multi character reads.  I'm not too concerned about the excess baggage
  3123. X * caused by the entire image being forked... this feature won't be used
  3124. X * that often.
  3125. X */
  3126. X
  3127. static int cp_flag;
  3128. static int cp_force();
  3129. X
  3130. static void
  3131. cpio(num)
  3132. unsigned int num;
  3133. X{
  3134. X    extern int fd;
  3135. X    int cpid, n;
  3136. X    char buf[CLIST_SIZ];
  3137. X    unsigned int alarm(), sleep();
  3138. X    void line_set(), xmodem_mode();
  3139. X
  3140. X                    /* out of curses mode */
  3141. X    resetterm();
  3142. X
  3143. X    xmodem_mode(0);
  3144. X    xmodem_mode(fd);
  3145. X
  3146. X                    /* copy the TTYin to stdout */
  3147. X    if (!(cpid = fork())) {
  3148. X        /* CONSTCOND */
  3149. X        while (1) {
  3150. X            n = read(fd, buf, CLIST_SIZ);
  3151. X            write(1, buf, n);
  3152. X        }
  3153. X    }
  3154. X
  3155. X    cp_flag = 0;
  3156. X    signal(SIGALRM, (SIG_TYPE(*) ()) cp_force);
  3157. X                    /* copy the stdin to TTYout */
  3158. X    /* CONSTCOND */
  3159. X    while (1) {
  3160. X        alarm(num);
  3161. X#ifdef BSD
  3162. X        if (setjmp(cp_buf))
  3163. X            break;
  3164. X#endif /* BSD */
  3165. X        n = read(0, buf, CLIST_SIZ);
  3166. X        if (cp_flag)
  3167. X            break;
  3168. X        write(fd, buf, n);
  3169. X    }
  3170. X    kill(cpid, SIGKILL);
  3171. X                    /* back to curses mode */
  3172. X    sleep(1);
  3173. X    fixterm();
  3174. X    beep();
  3175. X    line_set();
  3176. X    clearok(curscr, TRUE);
  3177. X    return;
  3178. X}
  3179. X
  3180. X/* ARGSUSED */
  3181. static int
  3182. cp_force(dummy)
  3183. X{
  3184. X#ifdef BSD
  3185. X    longjmp(cp_buf, 1);
  3186. X#else /* BSD */
  3187. X    signal(SIGALRM, (SIG_TYPE(*) ()) cp_force);
  3188. X    cp_flag = 1;
  3189. X    return(0);
  3190. X#endif /* BSD */
  3191. X}
  3192. END_OF_FILE
  3193. if test 2488 -ne `wc -c <'passthru.c'`; then
  3194.     echo shar: \"'passthru.c'\" unpacked with wrong size!
  3195. fi
  3196. # end of 'passthru.c'
  3197. fi
  3198. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  3199.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  3200. else
  3201. echo shar: Extracting \"'patchlevel.h'\" \(48 characters\)
  3202. sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  3203. X#define VERSION "2.0.2"
  3204. X#define DATE "6 Nov 92"
  3205. END_OF_FILE
  3206. if test 48 -ne `wc -c <'patchlevel.h'`; then
  3207.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  3208. fi
  3209. # end of 'patchlevel.h'
  3210. fi
  3211. if test -f 'pexit.c' -a "${1}" != "-c" ; then 
  3212.   echo shar: Will not clobber existing file \"'pexit.c'\"
  3213. else
  3214. echo shar: Extracting \"'pexit.c'\" \(2176 characters\)
  3215. sed "s/^X//" >'pexit.c' <<'END_OF_FILE'
  3216. X/*
  3217. X * Exit Pcomm.  A user requested abort.  There are a lot of things to do
  3218. X * before we exit!
  3219. X */
  3220. X
  3221. X#include <stdio.h>
  3222. X#include <curses.h>
  3223. X#include "dial_dir.h"
  3224. X#include "misc.h"
  3225. X#include "param.h"
  3226. X#include "status.h"
  3227. X
  3228. void
  3229. pexit()
  3230. X{
  3231. X    extern int fd;
  3232. X    WINDOW *ex_win, *newwin();
  3233. X    void cleanup(), st_line();
  3234. X
  3235. X    ex_win = newwin(5, 33, 3, 7);
  3236. X
  3237. X    box(ex_win, VERT, HORZ);
  3238. X    mvwattrstr(ex_win, 0, 3, A_BOLD, " Exit ");
  3239. X    if (yes_prompt(ex_win, 2, 4, A_BLINK, "Exit to Unix")) {
  3240. X        st_line("   exiting");
  3241. X        cleanup(0);
  3242. X    }
  3243. X    if (fd == -1) {
  3244. X        werase(ex_win);
  3245. X        wrefresh(ex_win);
  3246. X    }
  3247. X    delwin(ex_win);
  3248. X    return;
  3249. X}
  3250. X
  3251. X/*
  3252. X * Do the clean up detail before we exit.  Only the status structure
  3253. X * is guaranteed to exit.
  3254. X */
  3255. X
  3256. void
  3257. cleanup(val)
  3258. int val;
  3259. X{
  3260. X    extern int msg_status;
  3261. X    void release_port(), exit();
  3262. X    char *mytty, *ttyname();
  3263. X                    /* release the port */
  3264. X    release_port(QUIET);
  3265. X
  3266. X    /*
  3267. X     * If we die an un-natural death (such as a SIGHUP on the loss of
  3268. X     * the controlling terminal) we won't have a terminal to mess with.
  3269. X     */
  3270. X    if (isatty(0)) {
  3271. X        touchwin(stdscr);
  3272. X        clear();
  3273. X        refresh();
  3274. X        endwin();
  3275. X                    /* return the TTY chmod */
  3276. X        if (mytty = ttyname(0))
  3277. X            chmod(mytty, msg_status);
  3278. X    }
  3279. X    exit(val);
  3280. X}
  3281. X
  3282. X/*
  3283. X * Open a window to display an error message.  Handles both fatal and
  3284. X * non-fatal errors
  3285. X */
  3286. X
  3287. void
  3288. error_win(code, line_one, line_two)
  3289. int code;
  3290. char *line_one, *line_two;
  3291. X{
  3292. X    WINDOW *e_win, *newwin();
  3293. X    void cleanup(), st_line();
  3294. X
  3295. X                    /* make sure we're in curses mode */
  3296. X    fixterm();
  3297. X    e_win = newwin(7, 70, 9, 5);
  3298. X                    /* display the nasty note */
  3299. X    mvwaddstr(e_win, 2, 4, line_one);
  3300. X    mvwaddstr(e_win, 3, 4, line_two);
  3301. X    box(e_win, VERT, HORZ);
  3302. X
  3303. X    if (code) {
  3304. X        mvwattrstr(e_win, 0, 4, A_BOLD, " Error ");
  3305. X        mvwattrstr(e_win, 5, 24, A_BLINK, "Press any key to exit");
  3306. X        wmove(e_win, 5, 46);
  3307. X    }
  3308. X    else {
  3309. X        mvwattrstr(e_win, 0, 4, A_BOLD, " Warning ");
  3310. X        mvwattrstr(e_win, 5, 22, A_BLINK, "Press any key to continue");
  3311. X        wmove(e_win, 5, 48);
  3312. X    }
  3313. X    beep();
  3314. X    wrefresh(e_win);
  3315. X                    /* if inside a script */
  3316. X    if (status->dup_fd != -1)
  3317. X        wait_key(e_win, 5);
  3318. X    else
  3319. X        wgetch(e_win);
  3320. X    werase(e_win);
  3321. X    wrefresh(e_win);
  3322. X    delwin(e_win);
  3323. X
  3324. X    if (code) {
  3325. X        st_line("   exiting");
  3326. X        cleanup(code);
  3327. X    }
  3328. X    return;
  3329. X}
  3330. END_OF_FILE
  3331. if test 2176 -ne `wc -c <'pexit.c'`; then
  3332.     echo shar: \"'pexit.c'\" unpacked with wrong size!
  3333. fi
  3334. # end of 'pexit.c'
  3335. fi
  3336. if test -f 'redial.c' -a "${1}" != "-c" ; then 
  3337.   echo shar: Will not clobber existing file \"'redial.c'\"
  3338. else
  3339. echo shar: Extracting \"'redial.c'\" \(2378 characters\)
  3340. sed "s/^X//" >'redial.c' <<'END_OF_FILE'
  3341. X/*
  3342. X * The redial option (actually a misnomer, it's really a queuing system).
  3343. X * We expect a space-separated list of dialing directory entries (although
  3344. X * new users always try to put in a phone number).  A non-zero return code
  3345. X * means we're ready to dial.
  3346. X */
  3347. X
  3348. X#include <stdio.h>
  3349. X#include <curses.h>
  3350. X#include "config.h"
  3351. X#include "dial_dir.h"
  3352. X#include "misc.h"
  3353. X
  3354. int
  3355. redial()
  3356. X{
  3357. X    extern int fd;
  3358. X    WINDOW *rd_win, *newwin();
  3359. X    char *ans, *entry, *get_str(), *strchr(), *strtok(), ld_code, buf[256];
  3360. X    int i, oops, number, ret_code;
  3361. X
  3362. X    rd_win = newwin(6, 70, 5, 5);
  3363. X
  3364. X    mvwaddstr(rd_win, 4, 23, "(<CR> for previous numbers)");
  3365. X    mvwaddstr(rd_win, 2, 4, "Directory Entry Number(s): ");
  3366. X    box(rd_win, VERT, HORZ);
  3367. X
  3368. X    mvwattrstr(rd_win, 0, 3, A_BOLD, " Redial Queue ");
  3369. X    wmove(rd_win, 2, 31);
  3370. X    wrefresh(rd_win);
  3371. X                    /* get the string of numbers */
  3372. X    ret_code = 0;
  3373. X    while ((ans = get_str(rd_win, 35, "0123456789+-@# ", "")) != NULL) {
  3374. X        oops = 0;
  3375. X        if (*ans == '\0') {
  3376. X                    /* use previous queue */
  3377. X            if (dir->q_num[0] != -1) {
  3378. X                ret_code++;
  3379. X                break;
  3380. X            }
  3381. X                    /* there is no previous queue */
  3382. X            beep();
  3383. X            mvwattrstr(rd_win, 3, 4, A_BOLD, "No previous numbers");
  3384. X            wrefresh(rd_win);
  3385. X            wait_key(rd_win, 3);
  3386. X            clear_line(rd_win, 3, 4, TRUE);
  3387. X            wmove(rd_win, 2, 31);
  3388. X            wrefresh(rd_win);
  3389. X            continue;
  3390. X        }
  3391. X                    /* parse the queue values */
  3392. X        entry = strtok(ans, " \t");
  3393. X        for (i=0; i<NUM_QUEUE; i++) {
  3394. X            if (entry == NULL) {
  3395. X                dir->q_num[i] = -1;
  3396. X                continue;
  3397. X            }
  3398. X                    /* is there a LD code? */
  3399. X            ld_code = '\0';
  3400. X            if (strchr("+-@#", *entry)) {
  3401. X                ld_code = *entry;
  3402. X                entry++;
  3403. X            }
  3404. X
  3405. X            /*
  3406. X             * Zero is valid here, because it means use
  3407. X             * the current entry information.
  3408. X             */
  3409. X            number = atoi(entry);
  3410. X            if (number > NUM_DIR || *dir->number[number] == '\0') {
  3411. X                beep();
  3412. X                sprintf(buf, "Invalid or empty directory entry number %d", number);
  3413. X                mvwattrstr(rd_win, 3, 14, A_BOLD, buf);
  3414. X                wrefresh(rd_win);
  3415. X                wait_key(rd_win, 3);
  3416. X                clear_line(rd_win, 3, 4, TRUE);
  3417. X                clear_line(rd_win, 2, 31, TRUE);
  3418. X                wrefresh(rd_win);
  3419. X                oops++;
  3420. X                break;
  3421. X            }
  3422. X                    /* store the number in the queue */
  3423. X            dir->q_ld[i] = ld_code;
  3424. X            dir->q_num[i] = number;
  3425. X            entry = strtok((char *) NULL, " \t");
  3426. X        }
  3427. X        if (oops) {
  3428. X            dir->q_num[0] = -1;
  3429. X            continue;
  3430. X        }
  3431. X        ret_code++;
  3432. X        break;
  3433. X    }
  3434. X    if (fd == -1) {
  3435. X        werase(rd_win);
  3436. X        wrefresh(rd_win);
  3437. X    }
  3438. X    delwin(rd_win);
  3439. X    return(ret_code);
  3440. X}
  3441. END_OF_FILE
  3442. if test 2378 -ne `wc -c <'redial.c'`; then
  3443.     echo shar: \"'redial.c'\" unpacked with wrong size!
  3444. fi
  3445. # end of 'redial.c'
  3446. fi
  3447. if test -f 'screen.c' -a "${1}" != "-c" ; then 
  3448.   echo shar: Will not clobber existing file \"'screen.c'\"
  3449. else
  3450. echo shar: Extracting \"'screen.c'\" \(1213 characters\)
  3451. sed "s/^X//" >'screen.c' <<'END_OF_FILE'
  3452. X/*
  3453. X * Routines to read and copy the virtual screen image file.
  3454. X */
  3455. X
  3456. X#include <stdio.h>
  3457. X#include <curses.h>
  3458. X#include "param.h"
  3459. X#include "status.h"
  3460. X
  3461. X/*
  3462. X * Do a screen dump.  Actually, the screen is already dumped, all we
  3463. X * do is copy the file.
  3464. X */
  3465. X
  3466. void
  3467. screen_dump()
  3468. X{
  3469. X    FILE *fp_out, *uid_fopen();
  3470. X    char buf[128];
  3471. X    void error_win();
  3472. X    int i;
  3473. X                    /* open for append */
  3474. X    if (!(fp_out = uid_fopen(param->dumpfile, "a"))) {
  3475. X        sprintf(buf, "\"%s\" for write", param->dumpfile);
  3476. X        error_win(0, "Can't open screen dump file", buf);
  3477. X        return;
  3478. X    }
  3479. X    for (i=0; i<status->max_row; i++)
  3480. X        fprintf(fp_out, "%s\n", status->vs[i]);
  3481. X
  3482. X    fclose(fp_out);
  3483. X
  3484. X    return;
  3485. X}
  3486. X
  3487. X/*
  3488. X * Read the virtual screen and paint its contents to the stdscr using
  3489. X * curses(3).  Move the cursor where it belongs.
  3490. X */
  3491. X
  3492. void
  3493. load_vs()
  3494. X{
  3495. X    register int i;
  3496. X
  3497. X    clearok(curscr, TRUE);
  3498. X    erase();
  3499. X
  3500. X    for (i=0; i<status->max_row; i++)
  3501. X        mvaddstr(i, 0, status->vs[i]);
  3502. X
  3503. X    move(status->row, status->col);
  3504. X
  3505. X    refresh();
  3506. X    return;
  3507. X}
  3508. X
  3509. X/*
  3510. X * Clear the virtual screen.
  3511. X */
  3512. X
  3513. void
  3514. vs_clear(start_row)
  3515. int start_row;
  3516. X{
  3517. X    int i;
  3518. X    char *memset();
  3519. X
  3520. X    for (i=0; i<status->max_row; i++)
  3521. X        memset(status->vs[i], ' ', status->max_col);
  3522. X
  3523. X    status->row = start_row;
  3524. X    status->col = 0;
  3525. X    return;
  3526. X}
  3527. END_OF_FILE
  3528. if test 1213 -ne `wc -c <'screen.c'`; then
  3529.     echo shar: \"'screen.c'\" unpacked with wrong size!
  3530. fi
  3531. # end of 'screen.c'
  3532. fi
  3533. if test -f 'st_line.c' -a "${1}" != "-c" ; then 
  3534.   echo shar: Will not clobber existing file \"'st_line.c'\"
  3535. else
  3536. echo shar: Extracting \"'st_line.c'\" \(2072 characters\)
  3537. sed "s/^X//" >'st_line.c' <<'END_OF_FILE'
  3538. X/*
  3539. X * Display the status line.  Up to now, we've never really cared how
  3540. X * large the physical screen was... but now we want the status line
  3541. X * on the bottom.
  3542. X */
  3543. X
  3544. X#include <curses.h>
  3545. X#include "config.h"
  3546. X#include "dial_dir.h"
  3547. X#include "misc.h"
  3548. X#include "modem.h"
  3549. X#include "param.h"
  3550. X#include "status.h"
  3551. X
  3552. void
  3553. st_line(message)
  3554. char *message;
  3555. X{
  3556. X    extern int xmc;
  3557. X    WINDOW *sl_win, *newwin();
  3558. X    int d, x, y;
  3559. X    static char *dn[2] = {"FDX", "HDX"};
  3560. X    static char *ln[2] = {"LOG OFF", "LOG ON"};
  3561. X    static char *pn[2] = {"PTR OFF", "PTR ON "};
  3562. X    char buf[80], field_one[15], *cur_tty;
  3563. X
  3564. X                    /* is anybody missing? */
  3565. X    if (dir == NULL || modem == NULL || param == NULL)
  3566. X        return;
  3567. X                    /* remember where we parked the car.. */
  3568. X    getyx(stdscr, y, x);
  3569. X
  3570. X    sl_win = newwin(1, 80, LINES-1, 0);
  3571. X                    /* duplex message */
  3572. X    d = 0;
  3573. X    if (dir->duplex[0] == 'H')
  3574. X        d++;
  3575. X                    /* the current TTY */
  3576. X    cur_tty = "No TTY";
  3577. X    if (modem->t_cur != -1)
  3578. X        cur_tty = modem->tty[modem->t_cur];
  3579. X
  3580. X    /*
  3581. X     * The philosophy is:  If you press a command sequence that
  3582. X     * doesn't generate a window on the screen, then show the user
  3583. X     * what's going on in the status line.
  3584. X     */
  3585. X    if (*message == '\0')
  3586. X        sprintf(field_one, " %4.4s-0 HELP  ", param->ascii_hot);
  3587. X    else
  3588. X        sprintf(field_one, " %-13.13s", message);
  3589. X
  3590. X#ifdef XMC_BROKE
  3591. X    if (xmc > 0)
  3592. X        sprintf(buf, "%s | %-9.9s| %s | %5d %c%d%d | %-7.7s | %-7.7s | %-5.5s|%-5.5s",
  3593. X         field_one, cur_tty, dn[d], dir->baud[0], dir->parity[0],
  3594. X         dir->data_bits[0], dir->stop_bits[0], ln[status->log_status],
  3595. X         pn[status->print_status], param->cr_in, param->cr_out);
  3596. X    else
  3597. X#endif /* XMC_BROKE */
  3598. X        sprintf(buf, "%s | %-9.9s| %s | %5d %c%d%d | %-7.7s | %-7.7s | %-5.5s| %-5.5s",
  3599. X         field_one, cur_tty, dn[d], dir->baud[0], dir->parity[0],
  3600. X         dir->data_bits[0], dir->stop_bits[0], ln[status->log_status],
  3601. X         pn[status->print_status], param->cr_in, param->cr_out);
  3602. X
  3603. X    if (xmc > 0) {
  3604. X        touchwin(sl_win);
  3605. X        werase(sl_win);
  3606. X        wrefresh(sl_win);
  3607. X    }
  3608. X    wattrstr(sl_win, A_STANDOUT, buf);
  3609. X    wrefresh(sl_win);
  3610. X                    /* go ahead and delete it now */
  3611. X    delwin(sl_win);
  3612. X    move(y, x);
  3613. X    refresh();
  3614. X    return;
  3615. X}
  3616. END_OF_FILE
  3617. if test 2072 -ne `wc -c <'st_line.c'`; then
  3618.     echo shar: \"'st_line.c'\" unpacked with wrong size!
  3619. fi
  3620. # end of 'st_line.c'
  3621. fi
  3622. if test -f 'status.h' -a "${1}" != "-c" ; then 
  3623.   echo shar: Will not clobber existing file \"'status.h'\"
  3624. else
  3625. echo shar: Extracting \"'status.h'\" \(701 characters\)
  3626. sed "s/^X//" >'status.h' <<'END_OF_FILE'
  3627. X/*
  3628. X * The status flags, and other various changeable things.
  3629. X */
  3630. X
  3631. X#define MAX_ROW        64
  3632. X#define MAX_COL        133
  3633. X
  3634. struct STATUS {
  3635. X    int    dup_fd;            /* fd for duplicating input */
  3636. X    int    cmd_ipc;        /* IPC for shell scripts */
  3637. X    int    connected;        /* are we connected to a remote? */
  3638. X    int    log_status;        /* status of log option */
  3639. X    char    *log_path;        /* data logging file */
  3640. X    int    print_status;        /* status of print option */
  3641. X    int    row;            /* cursor row position */
  3642. X    int    col;            /* cursor column position */
  3643. X    char    vs[MAX_ROW][MAX_COL];    /* the virtual screen */
  3644. X    int    max_row;        /* the virtual screen demensions */
  3645. X    int    max_col;        /* the virtual screen demensions */
  3646. X};
  3647. X
  3648. X#ifndef MAIN
  3649. extern struct STATUS *status;
  3650. X#endif /* MAIN */
  3651. END_OF_FILE
  3652. if test 701 -ne `wc -c <'status.h'`; then
  3653.     echo shar: \"'status.h'\" unpacked with wrong size!
  3654. fi
  3655. # end of 'status.h'
  3656. fi
  3657. if test -f 'vcs.h' -a "${1}" != "-c" ; then 
  3658.   echo shar: Will not clobber existing file \"'vcs.h'\"
  3659. else
  3660. echo shar: Extracting \"'vcs.h'\" \(330 characters\)
  3661. sed "s/^X//" >'vcs.h' <<'END_OF_FILE'
  3662. X/*
  3663. X * Definitions to support the detection of video command sequences
  3664. X */
  3665. X
  3666. X#define VCS_SIZE    25
  3667. X#define NUM_VCS        9
  3668. X
  3669. X#define HOME        0
  3670. X#define CLR_EOL        1
  3671. X#define CLR_EOS        2
  3672. X#define CLEAR        3
  3673. X#define MV_UP        4
  3674. X#define MV_DOWN        5
  3675. X#define MV_RIGHT    6
  3676. X#define MV_LEFT        7
  3677. X#define MV_DIRECT    8
  3678. X
  3679. X#define YES        1
  3680. X#define NO        0
  3681. X#define MAYBE        (-1)
  3682. END_OF_FILE
  3683. if test 330 -ne `wc -c <'vcs.h'`; then
  3684.     echo shar: \"'vcs.h'\" unpacked with wrong size!
  3685. fi
  3686. # end of 'vcs.h'
  3687. fi
  3688. if test -f 'waitfor.c' -a "${1}" != "-c" ; then 
  3689.   echo shar: Will not clobber existing file \"'waitfor.c'\"
  3690. else
  3691. echo shar: Extracting \"'waitfor.c'\" \(1891 characters\)
  3692. sed "s/^X//" >'waitfor.c' <<'END_OF_FILE'
  3693. X/*
  3694. X * Wait for a string on the stdin.  Returns a 0 on success, 1 on failure
  3695. X * and -1 on error.  This is an external program designed to be used in
  3696. X * shell scripts.
  3697. X */
  3698. X
  3699. X#define TIMEOUT    10
  3700. X#define BUF_SIZ    1024
  3701. X
  3702. X#include <stdio.h>
  3703. X#include <signal.h>
  3704. X#include "config.h"
  3705. X
  3706. X#ifdef BSD
  3707. X#include <setjmp.h>
  3708. jmp_buf wf_buf;
  3709. X#endif /* BSD */
  3710. X
  3711. main(argc, argv)
  3712. int argc;
  3713. char *argv[];
  3714. X{
  3715. X    int i, j, timeout, diff, length;
  3716. X    char c, buf[BUF_SIZ], *string, *strcmp(), *strncpy();
  3717. X    long t, time();
  3718. X    void exit();
  3719. X
  3720. X    if (argc < 2 || argc > 3) {
  3721. X        fprintf(stderr, "Usage: waitfor -n string\n");
  3722. X        exit(-1);
  3723. X    }
  3724. X
  3725. X    if (argv[1][0] == '-') {
  3726. X        timeout = atoi(&argv[1][1]);
  3727. X        if (argc != 3) {
  3728. X            fprintf(stderr, "Usage: waitfor -n string\n");
  3729. X            exit(-1);
  3730. X        }
  3731. X        string = argv[2];
  3732. X    }
  3733. X    else {
  3734. X        timeout = TIMEOUT;
  3735. X        string = argv[1];
  3736. X    }
  3737. X                    /* here we go.. */
  3738. X    i = 0;
  3739. X    length = strlen(string);
  3740. X    time(&t);
  3741. X    while ((time((long *) 0) - t) < timeout) {
  3742. X        if ((j = getc_line()) != -1) {
  3743. X            c = j & 0x7f;
  3744. X                    /* no NULLs please */
  3745. X            if (c == '\0')
  3746. X                continue;
  3747. X
  3748. X            buf[i++] = c;
  3749. X            buf[i] = '\0';
  3750. X                    /* roll the buffer over */
  3751. X            if (i == BUF_SIZ -1) {
  3752. X                strncpy(buf, &buf[BUF_SIZ/2], BUF_SIZ/2);
  3753. X                i = BUF_SIZ/2;
  3754. X            }
  3755. X                    /* is it possible? */
  3756. X            diff = i - length;
  3757. X            if (diff < 0)
  3758. X                continue;
  3759. X
  3760. X            if (!strcmp(&buf[diff], string))
  3761. X                exit(0);
  3762. X        }
  3763. X    }
  3764. X    exit(1);
  3765. X}
  3766. X
  3767. static int wf_flag;
  3768. static int wf_force();
  3769. X
  3770. int
  3771. getc_line()
  3772. X{
  3773. X    char c;
  3774. X    unsigned int alarm();
  3775. X
  3776. X    signal(SIGALRM, (SIG_TYPE(*) ()) wf_force);
  3777. X    wf_flag = 0;
  3778. X
  3779. X    alarm(1);
  3780. X
  3781. X#ifdef BSD
  3782. X    if (setjmp(wf_buf))
  3783. X        return(-1);
  3784. X#endif /* BSD */
  3785. X
  3786. X    if (read(0, &c, 1) <= 0) {
  3787. X        alarm(0);
  3788. X        return(-1);
  3789. X    }
  3790. X    if (wf_flag)
  3791. X        return(-1);
  3792. X    alarm(0);
  3793. X    return(c & 0xff);
  3794. X}
  3795. X
  3796. X/* ARGSUSED */
  3797. static int
  3798. wf_force(dummy)
  3799. int dummy;
  3800. X{
  3801. X#ifdef BSD
  3802. X    longjmp(wf_buf, 1);
  3803. X#else /* BSD */
  3804. X    signal(SIGALRM, (SIG_TYPE(*) ()) wf_force);
  3805. X    wf_flag = 1;
  3806. X    return(0);
  3807. X#endif /* BSD */
  3808. X}
  3809. END_OF_FILE
  3810. if test 1891 -ne `wc -c <'waitfor.c'`; then
  3811.     echo shar: \"'waitfor.c'\" unpacked with wrong size!
  3812. fi
  3813. # end of 'waitfor.c'
  3814. fi
  3815. if test -f 'x_extrnl.c' -a "${1}" != "-c" ; then 
  3816.   echo shar: Will not clobber existing file \"'x_extrnl.c'\"
  3817. else
  3818. echo shar: Extracting \"'x_extrnl.c'\" \(2107 characters\)
  3819. sed "s/^X//" >'x_extrnl.c' <<'END_OF_FILE'
  3820. X/*
  3821. X * Spawn a shell with the stdin and stdout swapped with the remote
  3822. X * system, ie:
  3823. X *                               +----------+
  3824. X *    TTYin ------------> stdin  |          |
  3825. X *                               |  shell   |
  3826. X *    TTYout <---------- stdout  |          |
  3827. X *                               +----------+
  3828. X *
  3829. X * An undocumented feature:  The external protocol gateway
  3830. X * can be used to pipe the output of a normal Unix command to the
  3831. X * remote system.
  3832. X */
  3833. X
  3834. X#include <stdio.h>
  3835. X#include <curses.h>
  3836. X#include <signal.h>
  3837. X#include <errno.h>
  3838. X#include "config.h"
  3839. X
  3840. void
  3841. do_extrnl(cmd)
  3842. char *cmd;
  3843. X{
  3844. X    extern int fd, errno;
  3845. X    WINDOW *xt_win, *newwin();
  3846. X    int epid, want_out, dummy;
  3847. X    unsigned int sleep();
  3848. X    void _exit(), line_set();
  3849. X
  3850. X                    /* a full window */
  3851. X    xt_win = newwin(LINES, COLS, 0, 0);
  3852. X    nl();
  3853. X    touchwin(xt_win);
  3854. X    wrefresh(xt_win);
  3855. X
  3856. X    if (!(epid = fork())) {
  3857. X                    /* create a new process group ID */
  3858. X#ifdef BSD
  3859. X        setpgrp(0, getpid());
  3860. X#else /* BSD */
  3861. X        setpgrp();
  3862. X#endif /* BSD */
  3863. X                    /* swap the stdin and stdout */
  3864. X        close(0);
  3865. X        dup(fd);
  3866. X        close(1);
  3867. X        dup(fd);
  3868. X
  3869. X        setgid(getgid());
  3870. X        setuid(getuid());
  3871. X
  3872. X        execl("/bin/sh", "sh", "-c", cmd, (char *) 0);
  3873. X        _exit(1);
  3874. X    }
  3875. X
  3876. X    /*
  3877. X     * Check the keyboard while the external program is running.  If
  3878. X     * the user hits the <ESC> key, then kill the entire process
  3879. X     * group associated with the new shell.
  3880. X     */
  3881. X    want_out = 0;
  3882. X    /* CONSTCOND */
  3883. X    while(1) {
  3884. X        switch(wait_key(stdscr, 1)) {
  3885. X            case -1:    /* timed out */
  3886. X                break;
  3887. X            case 27:    /* a user abort */
  3888. X#ifdef BSD
  3889. X                killpg(epid, SIGKILL);
  3890. X#else /* BSD */
  3891. X                kill(-epid, SIGKILL);
  3892. X#endif /* BSD */
  3893. X                want_out++;
  3894. X                break;
  3895. X            default:
  3896. X                beep();
  3897. X                break;
  3898. X        }
  3899. X        if (want_out)
  3900. X            break;
  3901. X                    /* see if the process it still active */
  3902. X#ifdef BSD
  3903. X        if ((kill(epid, 0) == -1) && errno == ESRCH) 
  3904. X#else /* BSD */
  3905. X        if ((kill(-epid, 0) == -1) && errno == ESRCH) 
  3906. X#endif /* BSD */
  3907. X            break;
  3908. X    }
  3909. X                    /* no zombies please */
  3910. X    wait(&dummy);
  3911. X                    /* the tty may have been clobbered */
  3912. X    sleep(1);
  3913. X    fixterm();
  3914. X    line_set();
  3915. X    nonl();
  3916. X
  3917. X    clearok(curscr, TRUE);
  3918. X    werase(xt_win);
  3919. X    wrefresh(xt_win);
  3920. X    delwin(xt_win);
  3921. X    return;
  3922. X}
  3923. END_OF_FILE
  3924. if test 2107 -ne `wc -c <'x_extrnl.c'`; then
  3925.     echo shar: \"'x_extrnl.c'\" unpacked with wrong size!
  3926. fi
  3927. # end of 'x_extrnl.c'
  3928. fi
  3929. if test -f 'x_win.c' -a "${1}" != "-c" ; then 
  3930.   echo shar: Will not clobber existing file \"'x_win.c'\"
  3931. else
  3932. echo shar: Extracting \"'x_win.c'\" \(1944 characters\)
  3933. sed "s/^X//" >'x_win.c' <<'END_OF_FILE'
  3934. X/*
  3935. X * Display the file transfer window, and invoke the transfer protocol.
  3936. X */
  3937. X
  3938. X#include <stdio.h>
  3939. X#include <curses.h>
  3940. X#include "dial_dir.h"
  3941. X#include "misc.h"
  3942. X#include "status.h"
  3943. X#include "xmodem.h"
  3944. X
  3945. void
  3946. xfer_win(list, up, type)
  3947. char *list;
  3948. int up, type;
  3949. X{
  3950. X    extern int fd;
  3951. X    WINDOW *xf_win, *newwin();
  3952. X    int ack_error;
  3953. X    void xmodem_mode(), line_set(), st_line();
  3954. X
  3955. X    touchwin(stdscr);
  3956. X    refresh();
  3957. X    st_line("");
  3958. X
  3959. X    xf_win = newwin(15, 44, 2, 30);
  3960. X    /*
  3961. X     * This window should be in the non-blocking mode, so we can
  3962. X     * scan the keyboard for input while transferring a file.
  3963. X     */
  3964. X    tty_noblock(0, TRUE);
  3965. X                    /* basic window stuff */
  3966. X    mvwaddstr(xf_win, 2, 14, "Protocol:");
  3967. X    mvwaddstr(xf_win, 3, 13, "File name:");
  3968. X    mvwaddstr(xf_win, 4, 13, "File size:");
  3969. X    mvwaddstr(xf_win, 5, 4, "Error check method:");
  3970. X    mvwaddstr(xf_win, 6, 5, "Est transfer time:");
  3971. X    mvwaddstr(xf_win, 7, 11, "Block count:");
  3972. X    mvwaddstr(xf_win, 8, 6, "Percent complete:");
  3973. X    mvwaddstr(xf_win, 9, 5, "Bytes transferred:");
  3974. X    mvwaddstr(xf_win, 10, 5, "Errors this block:");
  3975. X    mvwaddstr(xf_win, 11, 5, "Total error count:");
  3976. X    mvwaddstr(xf_win, 12, 10, "Last message: NONE");
  3977. X    box(xf_win, VERT, HORZ);
  3978. X
  3979. X    if (up)
  3980. X        mvwattrstr(xf_win, 0, 17, A_BOLD, " Uploading ");
  3981. X    else
  3982. X        mvwattrstr(xf_win, 0, 16, A_BOLD, " Downloading ");
  3983. X
  3984. X    mvwaddstr(xf_win, 14, 11, " Press <ESC> to abort ");
  3985. X    wrefresh(xf_win);
  3986. X                    /* fix up the terminal mode */
  3987. X    xmodem_mode(fd);
  3988. X
  3989. X    if (up)
  3990. X        ack_error = send_xmodem(xf_win, list, type);
  3991. X    else
  3992. X        ack_error = rcv_xmodem(xf_win, list, type);
  3993. X
  3994. X    tty_noblock(0, FALSE);
  3995. X                    /* prompt for a key on errors */
  3996. X    if (ack_error) {
  3997. X        beep();
  3998. X        clear_line(xf_win, 13, 9, TRUE);
  3999. X        wattrstr(xf_win, A_BOLD, "Press any key to continue");
  4000. X        wrefresh(xf_win);
  4001. X                    /* if inside a script */
  4002. X        if (status->dup_fd != -1)
  4003. X            wait_key(xf_win, 5);
  4004. X        else
  4005. X            wgetch(xf_win);
  4006. X    }
  4007. X    werase(xf_win);
  4008. X    wrefresh(xf_win);
  4009. X    delwin(xf_win);
  4010. X                    /* undo what xmodem_mode() did */
  4011. X    line_set();
  4012. X    return;
  4013. X}
  4014. END_OF_FILE
  4015. if test 1944 -ne `wc -c <'x_win.c'`; then
  4016.     echo shar: \"'x_win.c'\" unpacked with wrong size!
  4017. fi
  4018. # end of 'x_win.c'
  4019. fi
  4020. if test -f 'xmodem.h' -a "${1}" != "-c" ; then 
  4021.   echo shar: Will not clobber existing file \"'xmodem.h'\"
  4022. else
  4023. echo shar: Extracting \"'xmodem.h'\" \(562 characters\)
  4024. sed "s/^X//" >'xmodem.h' <<'END_OF_FILE'
  4025. X/*
  4026. X * Definitions for the xmodem stuff.
  4027. X */
  4028. X
  4029. X#define MAX_ERRORS    10
  4030. X
  4031. X#define SOH        1
  4032. X#define STX        2
  4033. X#define EOT        4
  4034. X#define ACK        6
  4035. X#define NAK        21
  4036. X#define CAN        24
  4037. X#define CTRLZ        26
  4038. X
  4039. X#define NUM_INTERNAL    6
  4040. X#define XMODEM        1
  4041. X#define XMODEM_1k    2
  4042. X#define MODEM7        3
  4043. X#define YMODEM        4
  4044. X#define YMODEM_G    5
  4045. X#define XASCII        6
  4046. X#define EXT_1        7
  4047. X#define EXT_2        8
  4048. X#define EXT_3        9
  4049. X#define EXT_MANUAL    10
  4050. X
  4051. X#define ABORT        (-1)
  4052. X#define ERROR        (-2)
  4053. X#define CANCEL        (-3)
  4054. X
  4055. X#define CHECKSUM    0
  4056. X#define CRC_CHECKSUM    1
  4057. X#define CRC        2
  4058. X#define NONE        3
  4059. X
  4060. X#define DOWN_LOAD    0
  4061. X#define UP_LOAD        1
  4062. END_OF_FILE
  4063. if test 562 -ne `wc -c <'xmodem.h'`; then
  4064.     echo shar: \"'xmodem.h'\" unpacked with wrong size!
  4065. fi
  4066. # end of 'xmodem.h'
  4067. fi
  4068. echo shar: End of archive 1 \(of 6\).
  4069. cp /dev/null ark1isdone
  4070. MISSING=""
  4071. for I in 1 2 3 4 5 6 ; do
  4072.     if test ! -f ark${I}isdone ; then
  4073.     MISSING="${MISSING} ${I}"
  4074.     fi
  4075. done
  4076. if test "${MISSING}" = "" ; then
  4077.     echo You have unpacked all 6 archives.
  4078.     rm -f ark[1-9]isdone
  4079. else
  4080.     echo You still need to unpack the following archives:
  4081.     echo "        " ${MISSING}
  4082. fi
  4083. ##  End of shell archive.
  4084. exit 0
  4085.