home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume13 / tipx / part01 next >
Encoding:
Text File  |  1990-05-29  |  46.3 KB  |  1,928 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v13i013: tipx (extended tip) part 01/04
  3. From: wht@gatech.edu@tridom.UUCP (Warren H. Tucker)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 13, Issue 13
  7. Submitted-by: wht@gatech.edu@tridom.UUCP (Warren H. Tucker)
  8. Archive-name: tipx/part01
  9.  
  10. tipx is based on the 4.3 tip available from uunet's ftp communications
  11. subdirectory.  Two changes were added, transparent mode (called rawthru
  12. in the code) and X/Y/ZMODEM file transfer.
  13.  
  14. #!/bin/sh
  15. # This is tipx, a shell archive (shar 3.27)
  16. # made 05/27/1990 23:48 UTC by wht@tridom
  17. # Source directory /u4/src/tipx
  18. #
  19. # existing files WILL be overwritten
  20. #
  21. # This shar contains:
  22. # length  mode       name
  23. # ------ ---------- ------------------------------------------
  24. #   5339 -rw-r--r-- README.TIPX
  25. #    333 -rwxr-xr-x CONVERT2TIPX
  26. #   3596 -rw-r--r-- Makefile
  27. #  16181 -rw-r--r-- tip.c
  28. #  11976 -rw-r--r-- tipx.diff.01
  29. #    206 -rw-r--r-- tipx.diff.fls
  30. #    905 -rw-r--r-- tipx.diff.log
  31. #   2607 -rw-r--r-- xfer/Makefile
  32. #  39641 -rw-r--r-- xfer/tiprz.c
  33. #  40783 -rw-r--r-- xfer/tipsz.c
  34. #  15622 -rw-r--r-- xfer/zcommon.c
  35. #  28447 -rw-r--r-- xfer/zcurses.c
  36. #    180 -rw-r--r-- xfer/zdebug.c
  37. #    907 -rw-r--r-- xfer/zlint.h
  38. #  16500 -rw-r--r-- xfer/zmodem.c
  39. #   6734 -rw-r--r-- xfer/zmodem.h
  40. #
  41. if touch 2>&1 | fgrep 'mmdd' > /dev/null
  42.  then TOUCH=touch
  43.  else TOUCH=true
  44. fi
  45. # ============= README.TIPX ==============
  46. echo "x - extracting README.TIPX (Text)"
  47. sed 's/^X//' << 'SHAR_EOF' > README.TIPX &&
  48. Xtipx is based on the 4.3 tip available from uunet's ftp
  49. Xcommunications subdirectory.
  50. X
  51. XTwo changes were added, transparent mode (called rawthru in
  52. Xthe code) and X/Y/ZMODEM file transfer.
  53. X
  54. XTo make tipx, first get the basic tip distribution working, then
  55. Xunshar this set on top of a copy of the distribution, type
  56. X   sh CONVERT2TIPX
  57. Xedit the Makefile to your liking, then make.  Leave -DTIPX in the CFLAGS
  58. Xto keep the tipx changes.  Removing -DTIPX should cause the original tip
  59. Xto be produced.
  60. X
  61. XTyping make in the xfer subdirectory will make the two transfer programs.
  62. XPlace tipx, tiprz and tipsz together in reach of your $PATH to
  63. Xexecute.  You may have to set u+s on tipx and chown to daemon,
  64. Xuucp or some other uid.  I have not run tipx setuid, but the same
  65. Xsecurity precautions are taken with file transfer as are taken
  66. Xwith other pertinent paths, such as shell escape, etc.
  67. X
  68. XIf you do not want -DACULOG, remake in libacu.  (-DACULOG is the
  69. Xonlything on our system which required setuid).
  70. X
  71. XI make no warranties: caveat emptor, carpe diem and all that stuff.  You
  72. Xmay wish to remove the copyright notice on startup.  It probably does
  73. Xnot need to be there, but I am a nervous wee hacker (old definition!)
  74. Xand tread lightly in the land of wizards.
  75. X
  76. XTransparent Pass-through
  77. X------------------------
  78. X
  79. XThe ~R and ~N commands were added to support transparent mode
  80. X(eight-bit transmission between local and remote tty).
  81. X
  82. X~R enables transparent mode, after which all characters are
  83. Xpassed byte-for-byte, bit for bit between the two tty ports.
  84. XThe sole exception is that if no input is sent by the local
  85. Xtty for one second, followed by three escape codes (usually
  86. Xtilde) within a second, followed by a second of silence, then
  87. Xthe tip command mode is entered.  The side effect of this
  88. Xfeature is that the first escape character passed in this
  89. Xwindow of two seconds will delay transmission for up to two
  90. Xseconds.  This has not been too much of a problem here.
  91. X
  92. XFile Transfer
  93. X-------------
  94. X
  95. XThe file transfer mode requires the control tty to have a
  96. Xvalid TERM environment variable since it uses a curses-based
  97. Xstatus display.
  98. X
  99. X~X enters the file transfer mode.  Viz:
  100. X
  101. X~X
  102. Xfile transfer command? (? for help) ?
  103. Xfor send help, type ~Xs?; for receive help, type ~Xr?
  104. Xwhere ~ represents your escape character
  105. X
  106. XXMODEM (CHK, CRC) and XMODEM-1k/CRC
  107. Xsx [-ak] filename  -a (ASCII) convert NL to CR/LF (default binary)
  108. X                   -k use 1024 blocks instead of 128 (XMODEM-1k)
  109. XYMODEM/CRC Batch
  110. Xsy [-af] filelist  -a (ASCII) convert NL to CR/LF (default binary)
  111. X                   -f transfer using full pathanme (default simple)
  112. XZMODEM (CRC-16, CRC-32)
  113. Xsz [-af+nNyrwo] [-w #] [-L #] [-l #]  filelist
  114. X                   -a (ASCII) convert NL to CR/LF (default binary)
  115. X not all ZMODEM    -f transfer using full pathanme (default simple)
  116. X receivers accept  -+ Append to existing destination file
  117. X all overwrite     -n overwrite file if source newer
  118. X or append         -N overwrite file if source newer or longer
  119. X options           -y yes, absolutely overwrite existing file
  120. X                   -r Resume/Recover interrupted file transfer
  121. X                   -o use CRC-16 instead of CRC-32
  122. X                   -w # Window is # bytes (>= 256, multiple of 64)
  123. X                   -L # Limit subpacket length to # bytes
  124. X                   -l # Limit frame length to # bytes (l must >= L)
  125. X
  126. X~X
  127. Xfile transfer command? (? for help) r?
  128. XXMODEM (CHK, CRC) (rcvr tries CRC, then checksum)
  129. X                          rx [-ab] filename
  130. XYMODEM/CRC Batch          ry [-abu]
  131. XZMODEM (CRC-16, CRC-32)   rz [-abu]
  132. XSwitches:    -a force ASCII translation on receive
  133. X             -b force binary transfer
  134. X             -u convert uppercase filenames to lower case
  135. X
  136. XAll of the switches are compatible with the rz/sz programs (1.44)
  137. Xby Chuck Forsberg from which these programs were derived.
  138. X
  139. XThe curses-based status display looks something like:
  140. X
  141. X        .-[ tipsz 1.00 ]-- /u3/sd/wht -----------------------------.
  142. X        |  ZMODEM/CRC32  Transfer rate ~= 319 ch/sec (33%)         |
  143. X        |  File   1 of   1: mail.log                               |
  144. X        |  File position:      1275 length:     1275  -rw-------   |
  145. X        |  Sending 1275 bytes  total time ~=  0:02                 |
  146. X        |  tx: hdr ZFIN  0             rx: hdr ZFIN  0             |
  147. X        |  Comm I/O: rx      176  tx     1414 bytes                |
  148. X        |  Baud rate:  9600 BINARY blklen:  1024 comm mode: NORMAL |
  149. X        |  Time:    started: 18:03:04 this file: 18:03:06 window:  |
  150. X        |  18:03:12 elapsed: 00:00:08            00:00:00 +0       |
  151. X        |  Errors: this file:   0 total:    0 files skipped:   0   |
  152. X        |  Total file bytes transferred: 1275                      |
  153. X        |  End of file                                             |
  154. X        |  Remote: CRC32 y  duplex y  continuous stream y          |
  155. X        `----------------------------------------------------------'
  156. X
  157. Xaway for 11 seconds
  158. X!
  159. X
  160. X
  161. XEnjoy,
  162. X    Warren Tucker <wht%n4hgf@gatech.edu>
  163. X    150 West Lake Drive
  164. X    Mountain Park, GA  30075
  165. X    (404) 587-5766
  166. X
  167. XTODO (from Doug Kingston <dpk@morgan.com> README.SLIP)
  168. X    port back to SunOS 3.5/4.2BSD environment (line discipline version)
  169. X        (code is there but untested)
  170. X    work on header file includes and ioctl usage
  171. X        to eliminate the redefine error messages
  172. X
  173. XTODO
  174. X    update man pages
  175. SHAR_EOF
  176. $TOUCH -am 0527193690 README.TIPX &&
  177. chmod 0644 README.TIPX ||
  178. echo "restore of README.TIPX failed"
  179. set `wc -c README.TIPX`;Wc_c=$1
  180. if test "$Wc_c" != "5339"; then
  181.     echo original size 5339, current size $Wc_c
  182. fi
  183. # ============= CONVERT2TIPX ==============
  184. echo "x - extracting CONVERT2TIPX (Text)"
  185. sed 's/^X//' << 'SHAR_EOF' > CONVERT2TIPX &&
  186. X#!/bin/sh
  187. Xif fgrep 'TIPX' hunt.c 2>&1 > /dev/null
  188. X   then
  189. X       echo 'diffs have already been applied';
  190. X       exit 1;
  191. X   else
  192. X       echo 'applying patches to tip to make tipx';
  193. Xfi
  194. Xpatch -p < tipx.diff.01
  195. Xecho ''
  196. Xecho 'patches have been applied.  if patch was successful,'
  197. Xecho 'then edit Makefile to your liking and make.'
  198. Xexit 0
  199. SHAR_EOF
  200. $TOUCH -am 0527190690 CONVERT2TIPX &&
  201. chmod 0755 CONVERT2TIPX ||
  202. echo "restore of CONVERT2TIPX failed"
  203. set `wc -c CONVERT2TIPX`;Wc_c=$1
  204. if test "$Wc_c" != "333"; then
  205.     echo original size 333, current size $Wc_c
  206. fi
  207. # ============= Makefile ==============
  208. echo "x - extracting Makefile (Text)"
  209. sed 's/^X//' << 'SHAR_EOF' > Makefile &&
  210. X#
  211. X# Copyright (c) 1988 The Regents of the University of California.
  212. X# All rights reserved.
  213. X#
  214. X# Redistribution and use in source and binary forms are permitted
  215. X# provided that the above copyright notice and this paragraph are
  216. X# duplicated in all such forms and that any documentation,
  217. X# advertising materials, and other materials related to such
  218. X# distribution and use acknowledge that the software was developed
  219. X# by the University of California, Berkeley.  The name of the
  220. X# University may not be used to endorse or promote products derived
  221. X# from this software without specific prior written permission.
  222. X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  223. X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  224. X# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  225. X#
  226. X# This makefile is for tip2, an enhanced tip based on the Berkeley
  227. X# 4.3 tip available from uunet's ftp communications directory.
  228. X#
  229. X#    @(#)Makefile    5.6 (Berkeley) 9/28/88
  230. X#
  231. X# make file for intermachine communications package
  232. X#
  233. X# Files are:
  234. X#    /etc/remote        remote host description file
  235. X#    /etc/phones        phone number file, owned by ${OWNER} and
  236. X#                  mode 6??
  237. X#    ${ADM}/aculog        ACU accounting file, owned by ${OWNER} and
  238. X#                  mode 6?? {if ACULOG defined}
  239. X# Presently supports:
  240. X#    BIZCOMP
  241. X#    DEC DF02-AC, DF03-AC
  242. X#    DEC DN-11/Able Quadracall
  243. X#    HAYES and Hayes emulators
  244. X#    USR COURIER (2400 baud)
  245. X#    VENTEL 212+
  246. X#    VADIC 831 RS232 adaptor
  247. X#    VADIC 3451
  248. X#    Hayes Smartmodem 2400
  249. X#    Telebit Trailblazer
  250. X# (drivers are located in libacu.a)
  251. X#
  252. X# Configuration defines:
  253. X#    DF02, DF03, DN11    ACU's supported
  254. X#      BIZ1031, BIZ1022, VENTEL, V831, V3451, HAYES, COURIER
  255. X#      SM2400, TELEBIT
  256. X#    ACULOG            turn on tip logging of ACU use
  257. X#    PRISTINE        no phone #'s put in ACU log file
  258. X#    CONNECT            worthless command
  259. X#    DEFBR            default baud rate to make connection at
  260. X#    DEFFS            default frame size for FTP buffering of
  261. X#                writes on local side
  262. X#    BUFSIZ            buffer sizing from stdio, must be fed
  263. X#                explicitly to remcap.c if not 1024
  264. X#    STREAMS            system has streams tty interface (SunOS 4.0)
  265. XADM=    usr/adm
  266. XCONFIG=    -DSM2400 -DTELEBIT
  267. XCFLAGS=    -O -DDEFBR=19200 -DDEFFS=BUFSIZ -DCONNECT -DTIPX #-DSTREAMS
  268. XLIBC=    /lib/libc.a
  269. XSRCS=    acu.c acutab.c cmds.c cmdtab.c cu.c hunt.c log.c login.c partab.c \
  270. X    remcap.c remote.c tip.c tipout.c uucplock.c value.c vars.c \
  271. X    page.c slip.c
  272. XOBJS=    acu.o acutab.o cmds.o cmdtab.o cu.o hunt.o log.o login.o partab.o \
  273. X    remcap.o remote.o tip.o tipout.o uucplock.o value.o vars.o \
  274. X    page.o slip.o
  275. XMAN=    tip.1
  276. X
  277. Xall: libacu/libacu.a tipx
  278. X
  279. Xtipx: ${OBJS} ${LIBC}
  280. X    ${CC} -o $@ ${OBJS} libacu/libacu.a
  281. X
  282. X# acutab is configuration dependent, and so depends on the makefile
  283. Xacutab.o: Makefile
  284. Xacutab.o: acutab.c
  285. X    ${CC} -c ${CFLAGS} ${CONFIG} acutab.c
  286. X
  287. X# remote.o depends on the makefile because of DEFBR and DEFFS
  288. X# log.o depends on the makefile because of ACULOG
  289. Xlog.o remote.o: Makefile
  290. X
  291. Xlibacu/libacu.a: FRC
  292. X    cd libacu; make ${MFLAGS}
  293. X
  294. Xclean:
  295. X    rm -f ${OBJS} core tip
  296. X    cd libacu; make ${MFLAGS} clean
  297. X
  298. Xcleandir: clean
  299. X    rm -f ${MAN} tags .depend
  300. X    cd libacu; make ${MFLAGS} cleandir
  301. X
  302. Xdepend:
  303. X    mkdep ${CFLAGS} ${SRCS}
  304. X    cd libacu; make ${MFLAGS} depend
  305. X
  306. Xinstall: ${MAN}
  307. X    cd libacu; make ${MFLAGS} install
  308. X    install -s -o root -g daemon -m 6711 tip ${DESTDIR}/usr/bin/tip
  309. X    rm -f ${DESTDIR}/usr/bin/cu
  310. X    ln ${DESTDIR}/usr/bin/tip ${DESTDIR}/usr/bin/cu
  311. X    install -c -o bin -g bin -m 444 tip.1 ${DESTDIR}/usr/man/man1
  312. X    rm -f ${DESTDIR}/usr/man/man1/cu.1
  313. X    ln ${DESTDIR}/usr/man/tip1/tip.1 ${DESTDIR}/usr/man/cat1/cu.1
  314. X
  315. Xlint: ${SRCS}
  316. X    lint ${CFLAGS} ${SRCS}
  317. X
  318. Xtags: ${SRCS}
  319. X    ctags ${SRCS}
  320. X    cd libacu; make ${MFLAGS} tags
  321. X
  322. XFRC:
  323. SHAR_EOF
  324. $TOUCH -am 0527181990 Makefile &&
  325. chmod 0644 Makefile ||
  326. echo "restore of Makefile failed"
  327. set `wc -c Makefile`;Wc_c=$1
  328. if test "$Wc_c" != "3596"; then
  329.     echo original size 3596, current size $Wc_c
  330. fi
  331. # ============= tip.c ==============
  332. echo "x - extracting tip.c (Text)"
  333. sed 's/^X//' << 'SHAR_EOF' > tip.c &&
  334. Xchar *tipx_rev = "x1.20";
  335. X#define PATCHLEVEL 0 /* may it remain ever so */
  336. X/*
  337. X * Copyright (c) 1983 The Regents of the University of California.
  338. X * All rights reserved.
  339. X *
  340. X * Redistribution and use in source and binary forms are permitted
  341. X * provided that the above copyright notice and this paragraph are
  342. X * duplicated in all such forms and that any documentation,
  343. X * advertising materials, and other materials related to such
  344. X * distribution and use acknowledge that the software was developed
  345. X * by the University of California, Berkeley.  The name of the
  346. X * University may not be used to endorse or promote products derived
  347. X * from this software without specific prior written permission.
  348. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  349. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  350. X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  351. X */
  352. X/*
  353. X * Modifications by Warren Tucker <wht%n4hgf.uucp@emory.mathcs.emory.edu>
  354. X * for eight-bit transparent pass through and file transfer protocols
  355. X * are unencumbered in any way. They are yours, ours, everybody's, nobody's.
  356. X */
  357. X/*+:EDITS:*/
  358. X/*:05-08-1990-15:05-wht@n4hgf-rawthru */
  359. X/*:05-08-1990-15:00-wht@n4hgf-move tip.c original to tip-orig.c */
  360. X
  361. X#ifndef lint
  362. Xchar copyright[] =
  363. X"@(#) Copyright(c) 1983 The Regents of the University of California.\n\
  364. X All rights reserved.\n";
  365. X#endif /* not lint */
  366. X
  367. X#ifndef lint
  368. Xstatic char sccsid[] = "@(#)tip.c 5.8 (Berkeley) 9/2/88 (mod by wht@n4hgf)";
  369. X#endif /* not lint */
  370. X
  371. X/*
  372. X * tip - UNIX link to other systems
  373. X *  tip [-psv] [-speed] system-name [data]
  374. X * or
  375. X *  cu phone-number [-s speed] [-l line] [-a acu]
  376. X */
  377. X#include "tip.h"
  378. X
  379. X/*
  380. X * Baud rate mapping table
  381. X */
  382. Xint bauds[] = 
  383. X{
  384. X    0,50,75,110,134,150,200,300,600,
  385. X    1200,1800,2400,4800,9600,19200,38400,-1
  386. X};
  387. X
  388. X#ifdef TIPX
  389. Xint rawthru = 0;
  390. Xchar *rawthru_msg = "\r\n--> raw tip:  3 ~ rapidly for ~ equivalent\r\n";
  391. Xchar *no_rawthru_msg = "\r\n--> normal tip: 1 ~ == ~\r\n";
  392. Xextern char opened_tty[];
  393. X#endif
  394. X
  395. Xint page;
  396. Xint disc = OTTYDISC;        /* tip normally runs this way */
  397. Xsigfunc_t    intprompt();
  398. Xsigfunc_t    timeout();
  399. Xsigfunc_t    cleanup();
  400. Xchar *login();
  401. Xchar *sname();
  402. Xchar PNbuf[256];            /* This limits the size of a number */
  403. Xstruct sgttyb ttyarg;
  404. X
  405. X#ifdef TIPX
  406. Xtypedef struct b_to_br
  407. X{
  408. X    char *baud_rate;
  409. X    int B_code;
  410. X} B_TO_BR;
  411. X
  412. XB_TO_BR speeds[] =     /* ordered to put less common rates later in table */
  413. X{                    /* and the vagaries of baud rates above 9600 "handled" */
  414. X    "2400",    B2400,
  415. X    "1200",    B1200,
  416. X    "9600",    B9600,
  417. X#if defined(B19200)
  418. X    "19200",B19200,
  419. X#endif
  420. X#if defined(B38400)
  421. X    "38400",B38400,
  422. X#endif
  423. X    "4800",    B4800,
  424. X    "300",    B300,
  425. X    "110",    B110,
  426. X    "600",    B600,
  427. X    "75",    B75,
  428. X    "50",    B50,
  429. X    "HUP",    B0,
  430. X    "EXTA",    EXTA,
  431. X    "EXTB",    EXTB,
  432. X
  433. X    (char *)0,0
  434. X};
  435. X#endif /* TIPX */
  436. X
  437. X/*+-------------------------------------------------------------------------
  438. X    B_to_baud_rate(code) - convert CBAUD B_ code to baud rate string
  439. X--------------------------------------------------------------------------*/
  440. X#ifdef TIPX
  441. Xchar *
  442. XB_to_baud_rate(code)
  443. Xint code;
  444. X{
  445. Xregister int n;
  446. X
  447. X    for(n=0; speeds[n].baud_rate; n++)
  448. X        if(speeds[n].B_code == code)
  449. X            return(speeds[n].baud_rate);
  450. X    return("-----");
  451. X}    /* end of B_to_baud_rate */
  452. X#endif /* TIPX */
  453. X
  454. Xmain(argc,argv)
  455. Xchar *argv[];
  456. X{
  457. X    int uuid;
  458. X    char *system = NOSTR;
  459. X    char *data = NOSTR;
  460. X    register int i;
  461. X    register char *p;
  462. X    char sbuf[12];
  463. X
  464. X    uid = getuid();
  465. X    gid = getgid();
  466. X    euid = geteuid();    /* should be root */
  467. X    egid = getegid();
  468. X    uuid = getuucpuid();
  469. X
  470. X    if(equal(sname(argv[0]),"cu"))
  471. X    {
  472. X        setreuid(uid,uuid);
  473. X        cumode = 1;
  474. X        cumain(argc,argv);
  475. X        goto cucommon;
  476. X    }
  477. X
  478. X    if(argc < 2)
  479. X    {
  480. X        fprintf(stderr,"usage: tip [-psv] [-speed] [system-name] [data]\n");
  481. X        exit(1);
  482. X    }
  483. X
  484. X    for(; argc > 1; argv++,argc--)
  485. X    {
  486. X        if(argv[1][0] != '-')
  487. X        {
  488. X            if(system)
  489. X                data = argv[1];
  490. X            else
  491. X                system = argv[1];
  492. X        }
  493. X        else switch(argv[1][1])
  494. X        {
  495. X
  496. X        case 'p':
  497. X            page++;
  498. X            break;
  499. X        case 's':
  500. X            slip++;
  501. X            break;
  502. X        case 'v':
  503. X            vflag++;
  504. X            break;
  505. X
  506. X        case '0':
  507. X        case '1':
  508. X        case '2':
  509. X        case '3':
  510. X        case '4':
  511. X        case '5':
  512. X        case '6':
  513. X        case '7':
  514. X        case '8':
  515. X        case '9':
  516. X            BR = atoi(&argv[1][1]);
  517. X            break;
  518. X
  519. X        default:
  520. X            fprintf(stderr,"tip: %s, unknown option\n",argv[1]);
  521. X            break;
  522. X        }
  523. X    }
  524. X    if(!isatty(0) && !slip && !page)
  525. X    {
  526. X        fprintf(stderr,"tip: warning: input is not a tty\n");
  527. X    }
  528. X    if(slip)
  529. X    {
  530. X        setreuid(euid,uuid);
  531. X        uid = 0;
  532. X    }
  533. X    else 
  534. X    {
  535. X        setreuid(uid,uuid);
  536. X    }
  537. X    euid = uuid;
  538. X
  539. X    if(system == NOSTR)
  540. X        goto notnumber;
  541. X    if(isalpha(*system))
  542. X        goto notnumber;
  543. X    /*
  544. X     * System name is really a phone number...
  545. X     * Copy the number then stomp on the original (in case the number
  546. X     *    is private, we don't want 'ps' or 'w' to find it).
  547. X     */
  548. X    if(strlen(system) > sizeof PNbuf - 1)
  549. X    {
  550. X        fprintf(stderr,"tip: phone number too long (max = %d bytes)\n",
  551. X            sizeof PNbuf - 1);
  552. X        exit(1);
  553. X    }
  554. X    strncpy( PNbuf,system,sizeof PNbuf - 1 );
  555. X    for(p = system; *p; p++)
  556. X        *p = '\0';
  557. X    PN = PNbuf;
  558. X    (void)sprintf(sbuf,"tip%d",BR);
  559. X    system = sbuf;
  560. X
  561. Xnotnumber:
  562. X    signal(SIGINT,cleanup);
  563. X    signal(SIGQUIT,cleanup);
  564. X    signal(SIGHUP,cleanup);
  565. X    signal(SIGTERM,cleanup);
  566. X    signal(SIGPIPE,cleanup);
  567. X
  568. X    if((i = hunt(system)) == 0)
  569. X    {
  570. X        printf("all ports busy\n");
  571. X        exit(3);
  572. X    }
  573. X    if(i == -1)
  574. X    {
  575. X        printf("link down\n");
  576. X        (void)uu_unlock(uucplock);
  577. X        exit(3);
  578. X    }
  579. X    setbuf(stdout,NULL);
  580. X    loginit();
  581. X
  582. X    /*
  583. X     * Kludge, their's no easy way to get the initialization
  584. X     *   in the right order, so force it here
  585. X     */
  586. X    if((PH = getenv("PHONES")) == NOSTR)
  587. X        PH = "/etc/phones";
  588. X    vinit();                /* init variables */
  589. X    setparity("none");            /* set the parity table */
  590. X    if((i = speed(number(value(BAUDRATE)))) == NULL)
  591. X    {
  592. X        printf("tip: bad baud rate %d\n",number(value(BAUDRATE)));
  593. X        (void)uu_unlock(uucplock);
  594. X        exit(3);
  595. X    }
  596. X
  597. X    if(slip)
  598. X    {
  599. X        if(SA == NOSTR)
  600. X        {
  601. X            printf("tip: local addr not set\n");
  602. X            uu_unlock(uucplock);
  603. X            exit(3);
  604. X        }
  605. X        if(DA == NOSTR)
  606. X        {
  607. X            printf("tip: destination addr not set\n");
  608. X            uu_unlock(uucplock);
  609. X            exit(3);
  610. X        }
  611. X        if(SM == NOSTR)
  612. X        {
  613. X            printf("tip: slip netmask not set\n");
  614. X            uu_unlock(uucplock);
  615. X            exit(3);
  616. X        }
  617. X    }
  618. X
  619. X    /*
  620. X     * Now that we have the logfile and the ACU open
  621. X     *  return to the real uid and gid.  These things will
  622. X     *  be closed on exit.  Swap real and effective uid's
  623. X     *  so we can get the original permissions back
  624. X     *  for removing the uucp lock.
  625. X     */
  626. X    user_uid();    /* in the case of slip, we are now priviliged */
  627. X
  628. X    /*
  629. X     * Hardwired connections require the
  630. X     *  line speed set before they make any transmissions
  631. X     *  (this is particularly true of things like a DF03-AC)
  632. X     */
  633. X    if(HW)
  634. X        ttysetup(i);
  635. X    if(p = lconnect())
  636. X    {
  637. X        printf("\07%s\n[EOT]\n",p);
  638. X        daemon_uid();
  639. X        (void)uu_unlock(uucplock);
  640. X        exit(1);
  641. X    }
  642. X    if(!HW)
  643. X        ttysetup(i);
  644. X
  645. X
  646. X    if(LS != NOSTR)
  647. X    {
  648. X        fprintf(stderr,"\07[Logging in...]\r\n");
  649. X        if(p = login())
  650. X        {
  651. X            printf("\07%s\n[EOT]\n",p);
  652. X            daemon_uid();
  653. X            (void)uu_unlock(uucplock);
  654. X            exit(1);
  655. X        }
  656. X    }
  657. X
  658. X    if(page)
  659. X    {
  660. X        i = sendpage(data);
  661. X        daemon_uid();
  662. X        (void)uu_unlock(uucplock);
  663. X        exit(i);
  664. X    }
  665. X
  666. X    if(slip)
  667. X    {
  668. X        i = runslip();
  669. X        daemon_uid();
  670. X        (void)uu_unlock(uucplock);
  671. X        exit(i);
  672. X    }
  673. X
  674. Xcucommon:
  675. X    /*
  676. X     * From here down the code is shared with
  677. X     * the "cu" version of tip.
  678. X     */
  679. X
  680. X    ioctl(0,TIOCGETP,(char *)&defarg);
  681. X    ioctl(0,TIOCGETC,(char *)&defchars);
  682. X    ioctl(0,TIOCGLTC,(char *)&deflchars);
  683. X    ioctl(0,TIOCGETD,(char *)&odisc);
  684. X    arg = defarg;
  685. X#ifdef TIPX
  686. X    arg.sg_flags = CBREAK;
  687. X#else
  688. X    arg.sg_flags = ANYP | CBREAK;
  689. X#endif
  690. X    tchars = defchars;
  691. X    tchars.t_intrc = tchars.t_quitc = -1;
  692. X    ltchars = deflchars;
  693. X    ltchars.t_suspc = ltchars.t_dsuspc = ltchars.t_flushc
  694. X        = ltchars.t_lnextc = -1;
  695. X    raw();
  696. X
  697. X    pipe(fildes);
  698. X    pipe(repdes);
  699. X    signal(SIGALRM,timeout);
  700. X
  701. X    /*
  702. X     * Everything's set up now:
  703. X     *    connection established (hardwired or dialup)
  704. X     *    line conditioned (baud rate, mode, etc.)
  705. X     *    internal data structures (variables)
  706. X     * so, fork one process for local side and one for remote.
  707. X     */
  708. X#ifdef TIPX
  709. X    printf("tipx (tip 4.3 mod by wht@n4hgf %s.%02d) connected to %s\r\n",
  710. X        tipx_rev,PATCHLEVEL,opened_tty);
  711. X    fputs("Copyright (c) 1983 The Regents of the University of California.\r\n",
  712. X        stdout);
  713. X    printf("line speed = %s, tandem = %s\r\n",
  714. X        B_to_baud_rate(ttyarg.sg_ospeed),
  715. X        (ttyarg.sg_flags & TANDEM) ? "yes" : "no");
  716. X#else
  717. X    printf(cumode ? "Connected\r\n" : "\07connected\r\n");
  718. X#endif
  719. X    if(pid = fork())
  720. X        tipin();
  721. X    else
  722. X        tipout();
  723. X    /*NOTREACHED*/
  724. X}
  725. X
  726. Xsigfunc_t
  727. Xcleanup()
  728. X{
  729. X
  730. X    daemon_uid();
  731. X    (void)uu_unlock(uucplock);
  732. X    if(pid)
  733. X    {
  734. X        (void) kill(pid,SIGTERM);
  735. X        unraw();
  736. X    }
  737. X    else if(odisc)
  738. X        ioctl(0,TIOCSETD,(char *)&odisc);
  739. X    exit(0);
  740. X}
  741. X
  742. X/*
  743. X * Muck with user ID's.  We are setuid to the owner of the lock
  744. X * directory when we start.  user_uid() reverses real and effective
  745. X * ID's after startup, to run with the user's permissions.
  746. X * daemon_uid() switches back to the privileged uid for unlocking.
  747. X * Finally, to avoid running a shell with the wrong real uid,
  748. X * shell_uid() sets real and effective uid's to the user's real ID.
  749. X */
  750. Xstatic int uidswapped;
  751. X
  752. Xuser_uid()
  753. X{
  754. X    if(uidswapped == 0)
  755. X    {
  756. X        setregid(egid,gid);
  757. X        setreuid(euid,uid);
  758. X        uidswapped = 1;
  759. X    }
  760. X}
  761. X
  762. Xdaemon_uid()
  763. X{
  764. X    if(uidswapped)
  765. X    {
  766. X        setreuid(uid,euid);
  767. X        setregid(gid,egid);
  768. X        uidswapped = 0;
  769. X    }
  770. X}
  771. X
  772. Xshell_uid()
  773. X{
  774. X
  775. X    setreuid(uid,uid);
  776. X    setregid(gid,gid);
  777. X}
  778. X
  779. X/*
  780. X * put the controlling keyboard into raw mode
  781. X */
  782. Xraw()
  783. X{
  784. X
  785. X    ioctl(0,TIOCSETP,&arg);
  786. X    ioctl(0,TIOCSETC,&tchars);
  787. X    ioctl(0,TIOCSLTC,<chars);
  788. X    ioctl(0,TIOCSETD,(char *)&disc);
  789. X}
  790. X
  791. X
  792. X/*
  793. X * return keyboard to normal mode
  794. X */
  795. Xunraw()
  796. X{
  797. X
  798. X    ioctl(0,TIOCSETD,(char *)&odisc);
  799. X    ioctl(0,TIOCSETP,(char *)&defarg);
  800. X    ioctl(0,TIOCSETC,(char *)&defchars);
  801. X    ioctl(0,TIOCSLTC,(char *)&deflchars);
  802. X}
  803. X
  804. Xstatic jmp_buf promptbuf;
  805. X
  806. X/*
  807. X * Print string ``s'', then read a string
  808. X *  in from the terminal.  Handles signals & allows use of
  809. X *  normal erase and kill characters.
  810. X */
  811. Xprompt(s,p)
  812. Xchar *s;
  813. Xregister char *p;
  814. X{
  815. X    register char *b = p;
  816. X    sigfunc_t(*oint)(),(*oquit)();
  817. X
  818. X    stoprompt = 0;
  819. X    oint = signal(SIGINT,intprompt);
  820. X    oquit = signal(SIGQUIT,SIG_IGN);
  821. X    unraw();
  822. X    printf("%s",s);
  823. X    if(setjmp(promptbuf) == 0)
  824. X        while((*p = getchar()) != EOF && *p != '\n')
  825. X            p++;
  826. X    *p = '\0';
  827. X
  828. X    raw();
  829. X    signal(SIGINT,oint);
  830. X    signal(SIGQUIT,oint);
  831. X    return(stoprompt || p == b);
  832. X}
  833. X
  834. X/*
  835. X * Interrupt service routine during prompting
  836. X */
  837. Xsigfunc_t
  838. Xintprompt()
  839. X{
  840. X
  841. X    signal(SIGINT,SIG_IGN);
  842. X    stoprompt = 1;
  843. X    printf("\r\n");
  844. X    longjmp(promptbuf,1);
  845. X}
  846. X
  847. X/*
  848. X * ****TIPIN   TIPIN****
  849. X */
  850. Xtipin()
  851. X{
  852. X    char gch,bol = 1;
  853. X
  854. X    /*
  855. X     * Kinda klugey here...
  856. X     *   check for scripting being turned on from the .tiprc file,
  857. X     *   but be careful about just using setscript(), as we may
  858. X     *   send a SIGEMT before tipout has a chance to set up catching
  859. X     *   it; so wait a second, then setscript()
  860. X     */
  861. X    if(boolean(value(SCRIPT)))
  862. X    {
  863. X        sleep(1);
  864. X        setscript();
  865. X    }
  866. X
  867. X#ifdef TIPX
  868. X    if(!rawthru)
  869. X        goto NORMAL_TIP2;
  870. X
  871. XRAWTHRU_TIP:
  872. X    printf(rawthru_msg);
  873. X    while(1)
  874. X    {
  875. X        long count;
  876. X        char chbuf[4];
  877. X        read(0,&gch,1);
  878. X        if((gch == character(value(ESCAPE))))
  879. X        {
  880. X            sleep(1);
  881. X            ioctl(0,FIONREAD,&count);
  882. X            if(count == 2)
  883. X            {    /* might have raw mode escape */
  884. X                read(0,chbuf,2);
  885. X                if((chbuf[0] == character(value(ESCAPE))) &&
  886. X                    (chbuf[1] == character(value(ESCAPE))))
  887. X                {
  888. X                    printf("rawthru%s",ctrl(chbuf[0]));
  889. X                    if(!(gch = escape()))
  890. X                    {
  891. X                        if(!rawthru)
  892. X                        {
  893. X                            bol = 1;
  894. X                            goto NORMAL_TIP;
  895. X                        }
  896. X                        continue;
  897. X                    }
  898. X                }
  899. X                else
  900. X                {
  901. X                    gch = character(value(ESCAPE));
  902. X                    write(FD,&gch,1);
  903. X                    write(FD,chbuf,2);
  904. X                    continue;
  905. X                }
  906. X            }
  907. X        }
  908. X        write(FD,&gch,1);
  909. X    }
  910. X
  911. XNORMAL_TIP:
  912. X    printf(no_rawthru_msg);
  913. XNORMAL_TIP2:
  914. X#endif /* TIPX */
  915. X    while(1)
  916. X    {
  917. X        gch = getchar()&0177;
  918. X        if((gch == character(value(ESCAPE))) && bol)
  919. X        {
  920. X            if(!(gch = escape()))
  921. X#ifdef TIPX
  922. X            {
  923. X                if(rawthru)
  924. X                    goto RAWTHRU_TIP;
  925. X                continue;
  926. X            }
  927. X#else /* TIPX */
  928. X            continue;
  929. X#endif /* TIPX */
  930. X        }
  931. X        else if(!cumode && gch == character(value(RAISECHAR)))
  932. X        {
  933. X            boolean(value(RAISE)) = !boolean(value(RAISE));
  934. X            continue;
  935. X        }
  936. X        else if(gch == '\r')
  937. X        {
  938. X            bol = 1;
  939. X            pwrite(FD,&gch,1);
  940. X            if(boolean(value(HALFDUPLEX)))
  941. X                printf("\r\n");
  942. X            continue;
  943. X        }
  944. X        else if(!cumode && gch == character(value(FORCE)))
  945. X            gch = getchar()&0177;
  946. X        bol = any(gch,value(EOL));
  947. X        if(boolean(value(RAISE)) && islower(gch))
  948. X            gch = toupper(gch);
  949. X        pwrite(FD,&gch,1);
  950. X        if(boolean(value(HALFDUPLEX)))
  951. X            printf("%c",gch);
  952. X    }
  953. X}
  954. X
  955. X/*
  956. X * Escape handler --
  957. X *  called on recognition of ``escapec'' at the beginning of a line
  958. X */
  959. Xescape()
  960. X{
  961. X    register char gch;
  962. X    register esctable_t *p;
  963. X    char c = character(value(ESCAPE));
  964. X    extern esctable_t etable[];
  965. X
  966. X    gch = (getchar()&0177);
  967. X    for(p = etable; p->e_char; p++)
  968. X        if(p->e_char == gch)
  969. X        {
  970. X            if((p->e_flags&PRIV) && uid)
  971. X                continue;
  972. X#ifdef TIPX
  973. X            if(!rawthru)
  974. X#endif
  975. X                printf("%s",ctrl(c));
  976. X            (*p->e_func)(gch);
  977. X            return(0);
  978. X        }
  979. X    /* ESCAPE ESCAPE forces ESCAPE */
  980. X    if(c != gch)
  981. X        pwrite(FD,&c,1);
  982. X    return(gch);
  983. X}
  984. X
  985. Xspeed(n)
  986. Xint n;
  987. X{
  988. X    register int *p;
  989. X
  990. X    for(p = bauds; *p != -1;  p++)
  991. X        if(*p == n)
  992. X            return(p - bauds);
  993. X    return(NULL);
  994. X}
  995. X
  996. Xany(c,p)
  997. Xregister char c,*p;
  998. X{
  999. X    while(p && *p)
  1000. X        if(*p++ == c)
  1001. X            return(1);
  1002. X    return(0);
  1003. X}
  1004. X
  1005. Xsize(s)
  1006. Xregister char *s;
  1007. X{
  1008. X    register int i = 0;
  1009. X
  1010. X    while(s && *s++)
  1011. X        i++;
  1012. X    return(i);
  1013. X}
  1014. X
  1015. Xchar *
  1016. Xinterp(s)
  1017. Xregister char *s;
  1018. X{
  1019. X    static char buf[256];
  1020. X    register char *p = buf,c,*q;
  1021. X
  1022. X    while(c = *s++)
  1023. X    {
  1024. X        for(q = "\nn\rr\tt\ff\033E\bb"; *q; q++)
  1025. X            if(*q++ == c)
  1026. X            {
  1027. X                *p++ = '\\';
  1028. X                *p++ = *q;
  1029. X                goto next;
  1030. X            }
  1031. X        if(c < 040)
  1032. X        {
  1033. X            *p++ = '^';
  1034. X            *p++ = c + 'A'-1;
  1035. X        }
  1036. X        else if(c == 0177)
  1037. X        {
  1038. X            *p++ = '^';
  1039. X            *p++ = '?';
  1040. X        }
  1041. X        else
  1042. X            *p++ = c;
  1043. Xnext:
  1044. X        ;
  1045. X    }
  1046. X    *p = '\0';
  1047. X    return(buf);
  1048. X}
  1049. X
  1050. Xchar *
  1051. Xctrl(c)
  1052. Xchar c;
  1053. X{
  1054. X    static char s[3];
  1055. X
  1056. X    if(c < 040 || c == 0177)
  1057. X    {
  1058. X        s[0] = '^';
  1059. X        s[1] = c == 0177 ? '?' : c+'A'-1;
  1060. X        s[2] = '\0';
  1061. X    }
  1062. X    else 
  1063. X    {
  1064. X        s[0] = c;
  1065. X        s[1] = '\0';
  1066. X    }
  1067. X    return(s);
  1068. X}
  1069. X
  1070. X/*
  1071. X * Help command
  1072. X */
  1073. Xhelp(c)
  1074. Xchar c;
  1075. X{
  1076. X    register esctable_t *p;
  1077. X    extern esctable_t etable[];
  1078. X
  1079. X    printf("%c\r\n",c);
  1080. X    for(p = etable; p->e_char; p++)
  1081. X    {
  1082. X        if((p->e_flags&PRIV) && uid)
  1083. X            continue;
  1084. X        printf("%2s",ctrl(character(value(ESCAPE))));
  1085. X        printf("%-2s %c   %s\r\n",ctrl(p->e_char),
  1086. X            p->e_flags&EXP ? '*': ' ',p->e_help);
  1087. X    }
  1088. X}
  1089. X
  1090. X/*
  1091. X * Set up the "remote" tty's state
  1092. X */
  1093. Xttysetup(speed)
  1094. Xint speed;
  1095. X{
  1096. X    unsigned bits = LDECCTQ;
  1097. X
  1098. X    ttyarg.sg_ispeed = ttyarg.sg_ospeed = speed;
  1099. X    ttyarg.sg_flags = RAW;
  1100. X    if(boolean(value(TAND)))
  1101. X        ttyarg.sg_flags |= TANDEM;
  1102. X    if(boolean(value(DTRHUP)))
  1103. X    {
  1104. X        ioctl(FD,TIOCSDTR,0);
  1105. X        ioctl(FD,TIOCHPCL,0);
  1106. X    }
  1107. X    ioctl(FD,TIOCSETP,(char *)&ttyarg);
  1108. X    ioctl(FD,TIOCLBIS,(char *)&bits);
  1109. X}
  1110. X
  1111. X/*
  1112. X * Return "simple" name from a file name,
  1113. X * strip leading directories.
  1114. X */
  1115. Xchar *
  1116. Xsname(s)
  1117. Xregister char *s;
  1118. X{
  1119. X    register char *p = s;
  1120. X
  1121. X    while(*s)
  1122. X        if(*s++ == '/')
  1123. X            p = s;
  1124. X    return(p);
  1125. X}
  1126. X
  1127. Xstatic char partab[0200];
  1128. X
  1129. X/*
  1130. X * Do a write to the remote machine with the correct parity.
  1131. X * We are doing 8 bit wide output, so we just generate a character
  1132. X * with the right parity and output it.
  1133. X */
  1134. Xpwrite(fd,buf,n)
  1135. Xint fd;
  1136. Xchar *buf;
  1137. Xregister int n;
  1138. X{
  1139. X    register int i;
  1140. X    register char *bp;
  1141. X    extern int errno;
  1142. X#ifdef TIPX
  1143. X    extern int rawthru;
  1144. X
  1145. X    if(rawthru)
  1146. X    {
  1147. X        write(fd,buf,n);
  1148. X        return;
  1149. X    }
  1150. X#endif /* TIPX */
  1151. X
  1152. X    bp = buf;
  1153. X    for(i = 0; i < n; i++)
  1154. X    {
  1155. X        *bp = partab[(*bp) & 0177];
  1156. X        bp++;
  1157. X    }
  1158. X    if(write(fd,buf,n) < 0)
  1159. X    {
  1160. X        if(errno == EIO)
  1161. X            abort("Lost carrier.");
  1162. X        /* this is questionable */
  1163. X        perror("write");
  1164. X    }
  1165. X}
  1166. X
  1167. X/*
  1168. X * Build a parity table with appropriate high-order bit.
  1169. X */
  1170. Xsetparity(defparity)
  1171. Xchar *defparity;
  1172. X{
  1173. X    register int i;
  1174. X    char *parity;
  1175. X    extern char evenpartab[];
  1176. X
  1177. X    if(value(PARITY) == NOSTR)
  1178. X        value(PARITY) = defparity;
  1179. X    parity = value(PARITY);
  1180. X    for(i = 0; i < 0200; i++)
  1181. X        partab[i] = evenpartab[i];
  1182. X    if(equal(parity,"even"))
  1183. X        return;
  1184. X    if(equal(parity,"odd"))
  1185. X    {
  1186. X        for(i = 0; i < 0200; i++)
  1187. X            partab[i] ^= 0200;    /* reverse bit 7 */
  1188. X        return;
  1189. X    }
  1190. X    if(equal(parity,"none") || equal(parity,"zero"))
  1191. X    {
  1192. X        for(i = 0; i < 0200; i++)
  1193. X            partab[i] &= ~0200;    /* turn off bit 7 */
  1194. X        return;
  1195. X    }
  1196. X    if(equal(parity,"one"))
  1197. X    {
  1198. X        for(i = 0; i < 0200; i++)
  1199. X            partab[i] |= 0200;    /* turn on bit 7 */
  1200. X        return;
  1201. X    }
  1202. X    fprintf(stderr,"%s: unknown parity value\n",PA);
  1203. X    fflush(stderr);
  1204. X}
  1205. X
  1206. X/* The uid could be determined by stat()-ing ACULOG */
  1207. Xgetuucpuid()
  1208. X{
  1209. X    struct passwd *pw;
  1210. X
  1211. X    if((pw = getpwnam("uucp")) == NULL)
  1212. X    {
  1213. X        fprintf(stderr,"tip: unable to get uucp uid\n");
  1214. X        exit(1);
  1215. X    }
  1216. X    return(pw->pw_uid);
  1217. X}
  1218. SHAR_EOF
  1219. $TOUCH -am 0527192890 tip.c &&
  1220. chmod 0644 tip.c ||
  1221. echo "restore of tip.c failed"
  1222. set `wc -c tip.c`;Wc_c=$1
  1223. if test "$Wc_c" != "16181"; then
  1224.     echo original size 16181, current size $Wc_c
  1225. fi
  1226. # ============= tipx.diff.01 ==============
  1227. echo "x - extracting tipx.diff.01 (Text)"
  1228. sed 's/^X//' << 'SHAR_EOF' > tipx.diff.01 &&
  1229. X:
  1230. X#-------------------------------------------------------
  1231. X# tipx.diff.01
  1232. X# tip to tipx diffs
  1233. X# created by gendiff x1.03 on 27 May 1990 23:28 UTC
  1234. X#-------------------------------------------------------
  1235. X*** orig/cmds.c    Sun May 28 12:58:00 1989
  1236. X--- cmds.c    Sun May 27 18:19:35 1990
  1237. X***************
  1238. X*** 537,542
  1239. X  }
  1240. X  #endif
  1241. X  
  1242. X  /*
  1243. X   * Escape to local shell
  1244. X   */
  1245. X
  1246. X--- 537,543 -----
  1247. X  }
  1248. X  #endif
  1249. X  
  1250. X+ #ifdef TIPX
  1251. X  /*
  1252. X   * filexfer_help
  1253. X   *
  1254. X***************
  1255. X*** 538,543
  1256. X  #endif
  1257. X  
  1258. X  /*
  1259. X   * Escape to local shell
  1260. X   */
  1261. X  shell()
  1262. X
  1263. X--- 539,698 -----
  1264. X  
  1265. X  #ifdef TIPX
  1266. X  /*
  1267. X+  * filexfer_help
  1268. X+  *
  1269. X+  * Display help for ~X
  1270. X+  *   type = 0, general help, 1 = send help, 2 = receive help
  1271. X+  */
  1272. X+ filexfer_help(type)
  1273. X+ int type;
  1274. X+ {
  1275. X+ static char *ghelp[] =
  1276. X+ {
  1277. X+     "for send help, type ~Xs?; for receive help, type ~Xr?",
  1278. X+     "where ~ represents your escape character",
  1279. X+     (char *)0,
  1280. X+ };
  1281. X+ static char *shelp[] =
  1282. X+ {
  1283. X+     "XMODEM (CHK, CRC) and XMODEM-1k/CRC",
  1284. X+     "sx [-ak] filename  -a (ASCII) convert NL to CR/LF (default binary)",
  1285. X+     "                   -k use 1024 blocks instead of 128 (XMODEM-1k)",
  1286. X+     "YMODEM/CRC Batch",
  1287. X+     "sy [-af] filelist  -a (ASCII) convert NL to CR/LF (default binary)",
  1288. X+     "                   -f transfer using full pathanme (default simple)",
  1289. X+     "ZMODEM (CRC-16, CRC-32)",
  1290. X+     "sz [-af+nNyrwo] [-w #] [-L #] [-l #]  filelist",
  1291. X+     "                   -a (ASCII) convert NL to CR/LF (default binary)",
  1292. X+     " not all ZMODEM    -f transfer using full pathanme (default simple)",
  1293. X+     " receivers accept  -+ Append to existing destination file",
  1294. X+     " all overwrite     -n overwrite file if source newer",
  1295. X+     " or append         -N overwrite file if source newer or longer",
  1296. X+     " options           -y yes, absolutely overwrite existing file",
  1297. X+     "                   -r Resume/Recover interrupted file transfer",
  1298. X+     "                   -o use CRC-16 instead of CRC-32",
  1299. X+     "                   -w # Window is # bytes (>= 256, multiple of 64)",
  1300. X+     "                   -L # Limit subpacket length to # bytes",
  1301. X+     "                   -l # Limit frame length to # bytes (l must >= L)",
  1302. X+     (char *)0
  1303. X+ };
  1304. X+ static char *rhelp[] =
  1305. X+ {
  1306. X+     "XMODEM (CHK, CRC) (rcvr tries CRC, then checksum)",
  1307. X+     "                          rx [-ab] filename",
  1308. X+     "YMODEM/CRC Batch          ry [-abu]",
  1309. X+     "ZMODEM (CRC-16, CRC-32)   rz [-abu]",
  1310. X+     "Switches:    -a force ASCII translation on receive",
  1311. X+     "             -b force binary transfer",
  1312. X+     "             -u convert uppercase filenames to lower case",
  1313. X+     (char *)0
  1314. X+ };
  1315. X+ char **hh;
  1316. X+ 
  1317. X+     switch(type)
  1318. X+     {
  1319. X+         case 0:  hh = ghelp; break;
  1320. X+         case 1:  hh = shelp; break;
  1321. X+         case 2:  hh = rhelp; break;
  1322. X+     }
  1323. X+     while(*hh)
  1324. X+     {
  1325. X+         fputs(*hh++,stdout);
  1326. X+         fputs("\r\n",stdout);
  1327. X+     }
  1328. X+ }
  1329. X+ #endif /* TIPX */
  1330. X+ 
  1331. X+ #ifdef TIPX
  1332. X+ /*
  1333. X+  * filexfer
  1334. X+  *
  1335. X+  * Fork a file transfer with:
  1336. X+  *  0 <-> local tty in
  1337. X+  *  1 <-> local tty out
  1338. X+  *  2 <-> local tty out
  1339. X+  *  FD <-> remote tty in/out
  1340. X+  */
  1341. X+ filexfer(c)
  1342. X+ {
  1343. X+     char buf[256];
  1344. X+     char xcmd[256+24];
  1345. X+     int cpid, status, p;
  1346. X+     time_t start;
  1347. X+ 
  1348. X+     putchar(c);
  1349. X+     if(prompt("\r\nfile transfer command? (? for help) ", buf))
  1350. X+         return;
  1351. X+     if(!strncmp(buf,"sz ",3))
  1352. X+         sprintf(xcmd,"tipsz -Z -. %d ",FD);
  1353. X+     else if(!strncmp(buf,"sy ",3))
  1354. X+         sprintf(xcmd,"tipsz -Y -k -. %d ",FD);
  1355. X+     else if(!strncmp(buf,"sx ",3))
  1356. X+         sprintf(xcmd,"tipsz -X -. %d ",FD);
  1357. X+     else if(!strncmp(buf,"rz ",3))
  1358. X+         sprintf(xcmd,"tiprz -Z -. %d ",FD);
  1359. X+     else if(!strncmp(buf,"ry ",3))
  1360. X+         sprintf(xcmd,"tiprz -Y -. %d ",FD);
  1361. X+     else if(!strncmp(buf,"rx ",3))
  1362. X+         sprintf(xcmd,"tiprz -X -. %d ",FD);
  1363. X+     else if(!strncmp(buf,"?",1))
  1364. X+     {
  1365. X+         filexfer_help(0);
  1366. X+         return;
  1367. X+     }
  1368. X+     else if(!strncmp(buf,"s?",2))
  1369. X+     {
  1370. X+         filexfer_help(1);
  1371. X+         return;
  1372. X+     }
  1373. X+     else if(!strncmp(buf,"r?",2))
  1374. X+     {
  1375. X+         filexfer_help(2);
  1376. X+         return;
  1377. X+     }
  1378. X+     else
  1379. X+     {
  1380. X+         printf("unrecognized transfer command (use sz, rz, etc.)\r\n");
  1381. X+         return;
  1382. X+     }
  1383. X+     strcat(xcmd,buf + 3);
  1384. X+ 
  1385. X+     kill(pid, SIGIOT);    /* put TIPOUT into a wait state */
  1386. X+     signal(SIGINT, SIG_IGN);
  1387. X+     signal(SIGQUIT, SIG_IGN);
  1388. X+     unraw();
  1389. X+     read(repdes[0], (char *)&ccc, 1);
  1390. X+     if ((cpid = vfork()) < 0)
  1391. X+         printf("can't fork!\r\n");
  1392. X+     else if (cpid) {
  1393. X+         start = time(0);
  1394. X+         while ((p = wait(&status)) > 0 && p != cpid)
  1395. X+             ;
  1396. X+     } else {
  1397. X+         register int i;
  1398. X+ 
  1399. X+         for (i = 3; i < 20; i++)
  1400. X+         {
  1401. X+             if(i != FD)
  1402. X+                 close(i);
  1403. X+         }
  1404. X+         signal(SIGINT, SIG_DFL);
  1405. X+         signal(SIGQUIT, SIG_DFL);
  1406. X+         user_uid();
  1407. X+         execl("/bin/sh", "sh", "-c", xcmd, (char *)0);
  1408. X+         printf("can't execute `%s'\n", xcmd);
  1409. X+         perror("execl");
  1410. X+         exit(0);
  1411. X+     }
  1412. X+     prtime("away for ", time(0)-start);
  1413. X+     write(fildes[1], (char *)&ccc, 1);
  1414. X+     raw();
  1415. X+     signal(SIGINT, SIG_DFL);
  1416. X+     signal(SIGQUIT, SIG_DFL);
  1417. X+ }
  1418. X+ #endif
  1419. X+ 
  1420. X+ /*
  1421. X   * Escape to local shell
  1422. X   */
  1423. X  shell()
  1424. X***************
  1425. X*** 776,781
  1426. X      sleep(1);
  1427. X      ioctl(FD, TIOCCBRK, NULL);
  1428. X  }
  1429. X  
  1430. X  /*
  1431. X   * Suspend tip
  1432. X
  1433. X--- 931,985 -----
  1434. X      sleep(1);
  1435. X      ioctl(FD, TIOCCBRK, NULL);
  1436. X  }
  1437. X+ 
  1438. X+ /*
  1439. X+  * Send a ^S.
  1440. X+  */
  1441. X+ #ifdef TIPX
  1442. X+ genctls()
  1443. X+ {
  1444. X+ static char ctls = 0x13;
  1445. X+ 
  1446. X+     printf("^S");
  1447. X+     write(FD, &ctls, 1);
  1448. X+ }
  1449. X+ #endif
  1450. X+ 
  1451. X+ /*
  1452. X+  * Send a ^Q.
  1453. X+  */
  1454. X+ #ifdef TIPX
  1455. X+ genctlq()
  1456. X+ {
  1457. X+ static char ctlq = 0x11;
  1458. X+ 
  1459. X+     printf("^Q");
  1460. X+     write(FD, &ctlq, 1);
  1461. X+ }
  1462. X+ #endif
  1463. X+ 
  1464. X+ /*
  1465. X+  * control rawthru mode
  1466. X+  */
  1467. X+ #ifdef TIPX
  1468. X+ rawthru_control(gch)
  1469. X+ char gch;
  1470. X+ {
  1471. X+ extern int rawthru;
  1472. X+     gch &= 0177;
  1473. X+     write(2,&gch,1);
  1474. X+     if(gch == 'R')
  1475. X+     {
  1476. X+         rawthru = 1;
  1477. X+         kill(pid,SIGUSR1);
  1478. X+     }
  1479. X+     else
  1480. X+     {
  1481. X+         rawthru = 0;
  1482. X+         kill(pid,SIGUSR2);
  1483. X+     }
  1484. X+ }
  1485. X+ #endif
  1486. X  
  1487. X  /*
  1488. X   * Suspend tip
  1489. X*** orig/cmdtab.c    Sun Oct  9 22:35:00 1988
  1490. X--- cmdtab.c    Sun May 27 18:19:35 1990
  1491. X***************
  1492. X*** 14,19
  1493. X   * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1494. X   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1495. X   */
  1496. X  
  1497. X  #ifndef lint
  1498. X  static char sccsid[] = "@(#)cmdtab.c    5.5 (Berkeley) 9/2/88";
  1499. X
  1500. X--- 14,21 -----
  1501. X   * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1502. X   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1503. X   */
  1504. X+ /*+:EDITS:*/
  1505. X+ /*:05-08-1990-15:55-wht@n4hgf-rawthru */
  1506. X  
  1507. X  #ifndef lint
  1508. X  static char sccsid[] = "@(#)cmdtab.c    5.5 (Berkeley) 9/2/88";
  1509. X***************
  1510. X*** 25,30
  1511. X  extern    int finish(), help(), pipefile(), pipeout(), consh(), variable();
  1512. X  extern    int cu_take(), cu_put(), dollar(), genbrk(), suspend();
  1513. X  
  1514. X  esctable_t etable[] = {
  1515. X      { '!',    NORM,    "shell",             shell },
  1516. X      { '<',    NORM,    "receive file from remote host", getfl },
  1517. X
  1518. X--- 27,37 -----
  1519. X  extern    int finish(), help(), pipefile(), pipeout(), consh(), variable();
  1520. X  extern    int cu_take(), cu_put(), dollar(), genbrk(), suspend();
  1521. X  
  1522. X+ #ifdef TIPX
  1523. X+ extern int genctls(), genctlq(), rawthru_control();
  1524. X+ extern int filexfer();
  1525. X+ #endif
  1526. X+ 
  1527. X  esctable_t etable[] = {
  1528. X      { '!',    NORM,    "shell",             shell },
  1529. X      { '<',    NORM,    "receive file from remote host", getfl },
  1530. X***************
  1531. X*** 44,48
  1532. X      { 's',    NORM,    "set variable",             variable },
  1533. X      { '?',    NORM,    "get this summary",         help },
  1534. X      { '#',    NORM,    "send break",             genbrk },
  1535. X      { 0, 0, 0 }
  1536. X  };
  1537. X
  1538. X--- 51,62 -----
  1539. X      { 's',    NORM,    "set variable",             variable },
  1540. X      { '?',    NORM,    "get this summary",         help },
  1541. X      { '#',    NORM,    "send break",             genbrk },
  1542. X+ #ifdef TIPX
  1543. X+     { 'S',    NORM,    "send ^S (XOFF)",         genctls },
  1544. X+     { 'Q',    NORM,    "send ^Q (XON)",         genctlq },
  1545. X+     { 'R',    NORM,    "set rawthru mode",         rawthru_control },
  1546. X+     { 'N',    NORM,    "no rawthru mode",         rawthru_control },
  1547. X+     { 'X',  NORM,    "X/Y/ZMODEM send/receive",filexfer },
  1548. X+ #endif
  1549. X      { 0, 0, 0 }
  1550. X  };
  1551. X*** orig/hunt.c    Sat May 13 14:43:00 1989
  1552. X--- hunt.c    Sun May 27 18:19:36 1990
  1553. X***************
  1554. X*** 28,33
  1555. X  static    int deadfl;
  1556. X  
  1557. X  char uucplock[BUFSIZ];
  1558. X  
  1559. X  dead()
  1560. X  {
  1561. X
  1562. X--- 28,36 -----
  1563. X  static    int deadfl;
  1564. X  
  1565. X  char uucplock[BUFSIZ];
  1566. X+ #ifdef TIPX
  1567. X+ char opened_tty[128];
  1568. X+ #endif
  1569. X  
  1570. X  dead()
  1571. X  {
  1572. X***************
  1573. X*** 92,97
  1574. X           */
  1575. X          if (!HW)
  1576. X              break;
  1577. X          if (setjmp(deadline) == 0) {
  1578. X              alarm(10);
  1579. X              FD = open(cp, O_RDWR);
  1580. X
  1581. X--- 95,104 -----
  1582. X           */
  1583. X          if (!HW)
  1584. X              break;
  1585. X+ 
  1586. X+ #ifdef TIPX
  1587. X+         strcpy(opened_tty,cp);
  1588. X+ #endif
  1589. X          if (setjmp(deadline) == 0) {
  1590. X              alarm(10);
  1591. X              FD = open(cp, O_RDWR);
  1592. X*** orig/tipout.c    Sat May 13 14:43:00 1989
  1593. X--- tipout.c    Sun May 27 18:19:43 1990
  1594. X***************
  1595. X*** 14,19
  1596. X   * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1597. X   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1598. X   */
  1599. X  
  1600. X  #ifndef lint
  1601. X  static char sccsid[] = "@(#)tipout.c    5.2 (Berkeley) 9/2/88";
  1602. X
  1603. X--- 14,22 -----
  1604. X   * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1605. X   * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1606. X   */
  1607. X+ /*+:EDITS:*/
  1608. X+ /*:05-08-1990-15:29-wht@n4hgf-rawthru */
  1609. X+ /*:05-08-1990-15:28-wht@n4hgf-mv tipout.c tipout-orig.c */
  1610. X  
  1611. X  #ifndef lint
  1612. X  static char sccsid[] = "@(#)tipout.c    5.2 (Berkeley) 9/2/88";
  1613. X***************
  1614. X*** 93,98
  1615. X      longjmp(sigbuf, 1);
  1616. X  }
  1617. X  
  1618. X  /*
  1619. X   * ****TIPOUT   TIPOUT****
  1620. X   */
  1621. X
  1622. X--- 96,115 -----
  1623. X      longjmp(sigbuf, 1);
  1624. X  }
  1625. X  
  1626. X+ #ifdef TIPX
  1627. X+ extern int rawthru;
  1628. X+ sigfunc_t
  1629. X+ int_tipout_rawthru_on()
  1630. X+ {
  1631. X+     rawthru = 1;
  1632. X+ }
  1633. X+ sigfunc_t
  1634. X+ int_tipout_rawthru_off()
  1635. X+ {
  1636. X+     rawthru = 0;
  1637. X+ }
  1638. X+ #endif /* TIPX */
  1639. X+ 
  1640. X  /*
  1641. X   * ****TIPOUT   TIPOUT****
  1642. X   */
  1643. X***************
  1644. X*** 111,116
  1645. X      signal(SIGIOT, intIOT);        /* scripting going on signal */
  1646. X      signal(SIGHUP, intTERM);    /* for dial-ups */
  1647. X      signal(SIGSYS, intSYS);        /* beautify toggle */
  1648. X      (void) setjmp(sigbuf);
  1649. X      for (omask = 0;; sigsetmask(omask)) {
  1650. X          cnt = read(FD, buf, BUFSIZ);
  1651. X
  1652. X--- 128,137 -----
  1653. X      signal(SIGIOT, intIOT);        /* scripting going on signal */
  1654. X      signal(SIGHUP, intTERM);    /* for dial-ups */
  1655. X      signal(SIGSYS, intSYS);        /* beautify toggle */
  1656. X+ #ifdef TIPX
  1657. X+     signal(SIGUSR1, int_tipout_rawthru_on);
  1658. X+     signal(SIGUSR2, int_tipout_rawthru_off);
  1659. X+ #endif /* TIPX */
  1660. X      (void) setjmp(sigbuf);
  1661. X      for (omask = 0;; sigsetmask(omask)) {
  1662. X          cnt = read(FD, buf, BUFSIZ);
  1663. X***************
  1664. X*** 123,128
  1665. X              }
  1666. X              continue;
  1667. X          }
  1668. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  1669. X          omask = sigblock(ALLSIGS);
  1670. X          for (cp = buf; cp < buf + cnt; cp++)
  1671. X
  1672. X--- 144,152 -----
  1673. X              }
  1674. X              continue;
  1675. X          }
  1676. X+ #ifdef TIPX
  1677. X+ #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)|sigmask(SIGUSR1)|sigmask(SIGUSR2)
  1678. X+ #else /* TIPX */
  1679. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  1680. X  #endif /* TIPX */
  1681. X          omask = sigblock(ALLSIGS);
  1682. X***************
  1683. X*** 124,129
  1684. X              continue;
  1685. X          }
  1686. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  1687. X          omask = sigblock(ALLSIGS);
  1688. X          for (cp = buf; cp < buf + cnt; cp++)
  1689. X              *cp &= 0177;
  1690. X
  1691. X--- 148,154 -----
  1692. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)|sigmask(SIGUSR1)|sigmask(SIGUSR2)
  1693. X  #else /* TIPX */
  1694. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  1695. X+ #endif /* TIPX */
  1696. X          omask = sigblock(ALLSIGS);
  1697. X  #ifdef TIPX
  1698. X          if(!rawthru)
  1699. X***************
  1700. X*** 125,130
  1701. X          }
  1702. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  1703. X          omask = sigblock(ALLSIGS);
  1704. X          for (cp = buf; cp < buf + cnt; cp++)
  1705. X              *cp &= 0177;
  1706. X          write(1, buf, cnt);
  1707. X
  1708. X--- 150,158 -----
  1709. X  #define    ALLSIGS    sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  1710. X  #endif /* TIPX */
  1711. X          omask = sigblock(ALLSIGS);
  1712. X+ #ifdef TIPX
  1713. X+         if(!rawthru)
  1714. X+ #endif
  1715. X          for (cp = buf; cp < buf + cnt; cp++)
  1716. X              *cp &= 0177;
  1717. X          write(1, buf, cnt);
  1718. X***************
  1719. X*** 133,138
  1720. X                  fwrite(buf, 1, cnt, fscript);
  1721. X                  continue;
  1722. X              }
  1723. X              for (cp = buf; cp < buf + cnt; cp++)
  1724. X                  if ((*cp >= ' ' && *cp <= '~') ||
  1725. X                      any(*cp, value(EXCEPTIONS)))
  1726. X
  1727. X--- 161,171 -----
  1728. X                  fwrite(buf, 1, cnt, fscript);
  1729. X                  continue;
  1730. X              }
  1731. X+ #ifdef TIPX
  1732. X+             if(rawthru)
  1733. X+                 for (cp = buf; cp < buf + cnt; cp++)
  1734. X+                     *cp &= 0177;
  1735. X+ #endif /* TIPX */
  1736. X              for (cp = buf; cp < buf + cnt; cp++)
  1737. X                  if ((*cp >= ' ' && *cp <= '~') ||
  1738. X                      any(*cp, value(EXCEPTIONS)))
  1739. SHAR_EOF
  1740. $TOUCH -am 0527192890 tipx.diff.01 &&
  1741. chmod 0644 tipx.diff.01 ||
  1742. echo "restore of tipx.diff.01 failed"
  1743. set `wc -c tipx.diff.01`;Wc_c=$1
  1744. if test "$Wc_c" != "11976"; then
  1745.     echo original size 11976, current size $Wc_c
  1746. fi
  1747. # ============= tipx.diff.fls ==============
  1748. echo "x - extracting tipx.diff.fls (Text)"
  1749. sed 's/^X//' << 'SHAR_EOF' > tipx.diff.fls &&
  1750. XREADME.TIPX
  1751. XCONVERT2TIPX
  1752. XMakefile
  1753. Xtip.c
  1754. Xtipx.diff.01
  1755. Xtipx.diff.fls
  1756. Xtipx.diff.log
  1757. Xxfer/Makefile
  1758. Xxfer/tiprz.c
  1759. Xxfer/tipsz.c
  1760. Xxfer/zcommon.c
  1761. Xxfer/zcurses.c
  1762. Xxfer/zdebug.c
  1763. Xxfer/zlint.h
  1764. Xxfer/zmodem.c
  1765. Xxfer/zmodem.h
  1766. SHAR_EOF
  1767. $TOUCH -am 0527194890 tipx.diff.fls &&
  1768. chmod 0644 tipx.diff.fls ||
  1769. echo "restore of tipx.diff.fls failed"
  1770. set `wc -c tipx.diff.fls`;Wc_c=$1
  1771. if test "$Wc_c" != "206"; then
  1772.     echo original size 206, current size $Wc_c
  1773. fi
  1774. # ============= tipx.diff.log ==============
  1775. echo "x - extracting tipx.diff.log (Text)"
  1776. sed 's/^X//' << 'SHAR_EOF' > tipx.diff.log &&
  1777. Xbase diff name is tipx.diff
  1778. Xdiff distribution manifest name is tipx.diff.fls
  1779. X======> no differences generated: acu.c
  1780. X======> no differences generated: acutab.c
  1781. Xrouting diffs to tipx.diff.01
  1782. Xcmds.c: diffs generated (size)
  1783. Xcmdtab.c: diffs generated (size)
  1784. X======> no differences generated: cu.c
  1785. Xhunt.c: diffs generated (size)
  1786. X======> no differences generated: log.c
  1787. X======> no differences generated: login.c
  1788. X======> no differences generated: page.c
  1789. X======> no differences generated: partab.c
  1790. X======> no differences generated: remcap.c
  1791. X======> no differences generated: remote.c
  1792. X======> no differences generated: slip.c
  1793. X--> tip.c: diffs larger than file (size)
  1794. X======> no differences generated: tip.h
  1795. Xtipout.c: diffs generated (size)
  1796. X======> no differences generated: uucplock.c
  1797. X======> no differences generated: value.c
  1798. X======> no differences generated: vars.c
  1799. X# diff file tipx.diff.01 received 11976 bytes
  1800. SHAR_EOF
  1801. $TOUCH -am 0527192890 tipx.diff.log &&
  1802. chmod 0644 tipx.diff.log ||
  1803. echo "restore of tipx.diff.log failed"
  1804. set `wc -c tipx.diff.log`;Wc_c=$1
  1805. if test "$Wc_c" != "905"; then
  1806.     echo original size 905, current size $Wc_c
  1807. fi
  1808. # ============= xfer/Makefile ==============
  1809. if test ! -d 'xfer'; then
  1810.     echo "x - creating directory xfer"
  1811.     mkdir 'xfer'
  1812. fi
  1813. echo "x - extracting xfer/Makefile (Text)"
  1814. sed 's/^X//' << 'SHAR_EOF' > xfer/Makefile &&
  1815. X#  CHK=0x86C7
  1816. X#+-------------------------------------------------------------------
  1817. X# Makefile for tiprz/tipsz (tip file transfer)
  1818. X#--------------------------------------------------------------------
  1819. X#+:EDITS:*/
  1820. X#:05-21-1990-16:00-wht@tridom-adapt ecu xfer protocols for tipwht
  1821. X#:05-21-1990-15:57-wht@tridom-adapt tip file xfer protocols
  1822. X
  1823. XSHELL = /bin/sh
  1824. X
  1825. X.SUFFIXES: .o .c .h  
  1826. X
  1827. XCOMFLAGS = 
  1828. XCFLAGS = -c -O -MD=2 -Dstrchr=index -DV7 $(COMFLAGS)
  1829. X
  1830. XLDFLAGS = -lcurses -ltermcap
  1831. X
  1832. XCOMMON_SRC = \
  1833. X    zcommon.c\
  1834. X    zmodem.c\
  1835. X    zcurses.c\
  1836. X    zdebug.c
  1837. X
  1838. XCOMMON_OBJ = \
  1839. X    zcommon.o\
  1840. X    zmodem.o\
  1841. X    zcurses.o
  1842. X
  1843. X.c.o:;    cc $(CFLAGS) $*.c
  1844. X
  1845. Xall: tipsz tiprz
  1846. X
  1847. Xtipsz: tipsz.o $(COMMON_OBJ)
  1848. X    echo 'char *makedate="'`date` $(SYSTEM)'";'  >tipszmake.c
  1849. X    cc $(CFLAGS) tipszmake.c ; rm tipszmake.c
  1850. X    cc $(COMFLAGS) tipsz.o tipszmake.o $(COMMON_OBJ) $(LDFLAGS) -o tipsz
  1851. X    rm -f tipszmake.o
  1852. X
  1853. Xtiprz: tiprz.o $(COMMON_OBJ)
  1854. X    echo 'char *makedate="'`date` $(SYSTEM)'";'  >tiprzmake.c
  1855. X    cc $(CFLAGS) tiprzmake.c ; rm tiprzmake.c
  1856. X    cc $(COMFLAGS) tiprz.o tiprzmake.o $(COMMON_OBJ) $(LDFLAGS) -o tiprz 
  1857. X    rm -f tiprzmake.o
  1858. X
  1859. Xcomsrc.fls: $(COMMON_SRC) Makefile
  1860. X    ls $(COMMON_SRC) > comsrc.fls
  1861. X
  1862. Xlint: zlint.h
  1863. X
  1864. Xzlint.h: comsrc.fls 
  1865. X    echo ' ' > zlint.h
  1866. X    csh ../zgcc comsrc.fls zlint.h $(CFLAGS)
  1867. X
  1868. X#
  1869. X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
  1870. X#
  1871. Xdepend:
  1872. X        rm -f depend.tmp
  1873. X        if test '$(COMMON_SRC)' ;\
  1874. X        then (grep '^#include' $(COMMON_SRC) \
  1875. X        | sed    -e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
  1876. X            -e 's?:[^"]*"\([^"]*\)".*?: \1?'\
  1877. X            -e 's?\(.*\)\.c?\1.o?'\
  1878. X         >> depend.tmp) ;\
  1879. X        fi
  1880. X
  1881. X        echo '/^# DO NOT DELETE THIS LINE' >exdep.tmp
  1882. X        echo '.+1,$$d' >>exdep.tmp
  1883. X        echo 'r depend.tmp' >> exdep.tmp
  1884. X        echo 'w' >> exdep.tmp
  1885. X        cp Makefile Makefile.new
  1886. X        ex Makefile.new < exdep.tmp
  1887. X        rm exdep.tmp depend.tmp
  1888. X        echo '#    DEPENDENCIES MUST END AT END OF    FILE' >>Makefile.new
  1889. X        echo '#    IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
  1890. X        echo '#    see make depend    above'>>Makefile.new
  1891. X        mv Makefile Makefile.bak
  1892. X        mv Makefile.new Makefile
  1893. X
  1894. X# DO NOT DELETE THIS LINE
  1895. Xzcommon.o: /usr/include/stdio.h
  1896. Xzcommon.o: /usr/include/signal.h
  1897. Xzcommon.o: /usr/include/setjmp.h
  1898. Xzcommon.o: /usr/include/ctype.h
  1899. Xzcommon.o: /usr/include/pwd.h
  1900. Xzcommon.o: zmodem.h
  1901. Xzcommon.o: /usr/include/fcntl.h
  1902. Xzmodem.o: zmodem.h
  1903. Xzcurses.o: /usr/include/curses.h
  1904. Xzcurses.o: /usr/include/sys/types.h
  1905. Xzcurses.o: /usr/include/sys/stat.h
  1906. Xzcurses.o: /usr/include/ctype.h
  1907. Xzcurses.o: /usr/include/signal.h
  1908. Xzcurses.o: /usr/include/time.h
  1909. Xzcurses.o: /usr/include/sys/timeb.h
  1910. X#    DEPENDENCIES MUST END AT END OF    FILE
  1911. X#    IF YOU PUT STUFF HERE IT WILL GO AWAY
  1912. X#    see make depend    above
  1913. SHAR_EOF
  1914. $TOUCH -am 0521162190 xfer/Makefile &&
  1915. chmod 0644 xfer/Makefile ||
  1916. echo "restore of xfer/Makefile failed"
  1917. set `wc -c xfer/Makefile`;Wc_c=$1
  1918. if test "$Wc_c" != "2607"; then
  1919.     echo original size 2607, current size $Wc_c
  1920. fi
  1921. echo "End of part 1, continue with part 2"
  1922. exit 0
  1923.  
  1924. ------------------------------------------------------------------
  1925. Warren Tucker, Tridom Corporation      ...!gatech!emory!tridom!wht
  1926. home address:                                 ...!gatech!n4hgf!wht
  1927.  
  1928.