home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-05-29 | 46.3 KB | 1,928 lines |
- Newsgroups: comp.sources.misc
- subject: v13i013: tipx (extended tip) part 01/04
- From: wht@gatech.edu@tridom.UUCP (Warren H. Tucker)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 13, Issue 13
- Submitted-by: wht@gatech.edu@tridom.UUCP (Warren H. Tucker)
- Archive-name: tipx/part01
-
- tipx is based on the 4.3 tip available from uunet's ftp communications
- subdirectory. Two changes were added, transparent mode (called rawthru
- in the code) and X/Y/ZMODEM file transfer.
-
- #!/bin/sh
- # This is tipx, a shell archive (shar 3.27)
- # made 05/27/1990 23:48 UTC by wht@tridom
- # Source directory /u4/src/tipx
- #
- # existing files WILL be overwritten
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 5339 -rw-r--r-- README.TIPX
- # 333 -rwxr-xr-x CONVERT2TIPX
- # 3596 -rw-r--r-- Makefile
- # 16181 -rw-r--r-- tip.c
- # 11976 -rw-r--r-- tipx.diff.01
- # 206 -rw-r--r-- tipx.diff.fls
- # 905 -rw-r--r-- tipx.diff.log
- # 2607 -rw-r--r-- xfer/Makefile
- # 39641 -rw-r--r-- xfer/tiprz.c
- # 40783 -rw-r--r-- xfer/tipsz.c
- # 15622 -rw-r--r-- xfer/zcommon.c
- # 28447 -rw-r--r-- xfer/zcurses.c
- # 180 -rw-r--r-- xfer/zdebug.c
- # 907 -rw-r--r-- xfer/zlint.h
- # 16500 -rw-r--r-- xfer/zmodem.c
- # 6734 -rw-r--r-- xfer/zmodem.h
- #
- if touch 2>&1 | fgrep 'mmdd' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= README.TIPX ==============
- echo "x - extracting README.TIPX (Text)"
- sed 's/^X//' << 'SHAR_EOF' > README.TIPX &&
- Xtipx is based on the 4.3 tip available from uunet's ftp
- Xcommunications subdirectory.
- X
- XTwo changes were added, transparent mode (called rawthru in
- Xthe code) and X/Y/ZMODEM file transfer.
- X
- XTo make tipx, first get the basic tip distribution working, then
- Xunshar this set on top of a copy of the distribution, type
- X sh CONVERT2TIPX
- Xedit the Makefile to your liking, then make. Leave -DTIPX in the CFLAGS
- Xto keep the tipx changes. Removing -DTIPX should cause the original tip
- Xto be produced.
- X
- XTyping make in the xfer subdirectory will make the two transfer programs.
- XPlace tipx, tiprz and tipsz together in reach of your $PATH to
- Xexecute. You may have to set u+s on tipx and chown to daemon,
- Xuucp or some other uid. I have not run tipx setuid, but the same
- Xsecurity precautions are taken with file transfer as are taken
- Xwith other pertinent paths, such as shell escape, etc.
- X
- XIf you do not want -DACULOG, remake in libacu. (-DACULOG is the
- Xonlything on our system which required setuid).
- X
- XI make no warranties: caveat emptor, carpe diem and all that stuff. You
- Xmay wish to remove the copyright notice on startup. It probably does
- Xnot need to be there, but I am a nervous wee hacker (old definition!)
- Xand tread lightly in the land of wizards.
- X
- XTransparent Pass-through
- X------------------------
- X
- XThe ~R and ~N commands were added to support transparent mode
- X(eight-bit transmission between local and remote tty).
- X
- X~R enables transparent mode, after which all characters are
- Xpassed byte-for-byte, bit for bit between the two tty ports.
- XThe sole exception is that if no input is sent by the local
- Xtty for one second, followed by three escape codes (usually
- Xtilde) within a second, followed by a second of silence, then
- Xthe tip command mode is entered. The side effect of this
- Xfeature is that the first escape character passed in this
- Xwindow of two seconds will delay transmission for up to two
- Xseconds. This has not been too much of a problem here.
- X
- XFile Transfer
- X-------------
- X
- XThe file transfer mode requires the control tty to have a
- Xvalid TERM environment variable since it uses a curses-based
- Xstatus display.
- X
- X~X enters the file transfer mode. Viz:
- X
- X~X
- Xfile transfer command? (? for help) ?
- Xfor send help, type ~Xs?; for receive help, type ~Xr?
- Xwhere ~ represents your escape character
- X
- XXMODEM (CHK, CRC) and XMODEM-1k/CRC
- Xsx [-ak] filename -a (ASCII) convert NL to CR/LF (default binary)
- X -k use 1024 blocks instead of 128 (XMODEM-1k)
- XYMODEM/CRC Batch
- Xsy [-af] filelist -a (ASCII) convert NL to CR/LF (default binary)
- X -f transfer using full pathanme (default simple)
- XZMODEM (CRC-16, CRC-32)
- Xsz [-af+nNyrwo] [-w #] [-L #] [-l #] filelist
- X -a (ASCII) convert NL to CR/LF (default binary)
- X not all ZMODEM -f transfer using full pathanme (default simple)
- X receivers accept -+ Append to existing destination file
- X all overwrite -n overwrite file if source newer
- X or append -N overwrite file if source newer or longer
- X options -y yes, absolutely overwrite existing file
- X -r Resume/Recover interrupted file transfer
- X -o use CRC-16 instead of CRC-32
- X -w # Window is # bytes (>= 256, multiple of 64)
- X -L # Limit subpacket length to # bytes
- X -l # Limit frame length to # bytes (l must >= L)
- X
- X~X
- Xfile transfer command? (? for help) r?
- XXMODEM (CHK, CRC) (rcvr tries CRC, then checksum)
- X rx [-ab] filename
- XYMODEM/CRC Batch ry [-abu]
- XZMODEM (CRC-16, CRC-32) rz [-abu]
- XSwitches: -a force ASCII translation on receive
- X -b force binary transfer
- X -u convert uppercase filenames to lower case
- X
- XAll of the switches are compatible with the rz/sz programs (1.44)
- Xby Chuck Forsberg from which these programs were derived.
- X
- XThe curses-based status display looks something like:
- X
- X .-[ tipsz 1.00 ]-- /u3/sd/wht -----------------------------.
- X | ZMODEM/CRC32 Transfer rate ~= 319 ch/sec (33%) |
- X | File 1 of 1: mail.log |
- X | File position: 1275 length: 1275 -rw------- |
- X | Sending 1275 bytes total time ~= 0:02 |
- X | tx: hdr ZFIN 0 rx: hdr ZFIN 0 |
- X | Comm I/O: rx 176 tx 1414 bytes |
- X | Baud rate: 9600 BINARY blklen: 1024 comm mode: NORMAL |
- X | Time: started: 18:03:04 this file: 18:03:06 window: |
- X | 18:03:12 elapsed: 00:00:08 00:00:00 +0 |
- X | Errors: this file: 0 total: 0 files skipped: 0 |
- X | Total file bytes transferred: 1275 |
- X | End of file |
- X | Remote: CRC32 y duplex y continuous stream y |
- X `----------------------------------------------------------'
- X
- Xaway for 11 seconds
- X!
- X
- X
- XEnjoy,
- X Warren Tucker <wht%n4hgf@gatech.edu>
- X 150 West Lake Drive
- X Mountain Park, GA 30075
- X (404) 587-5766
- X
- XTODO (from Doug Kingston <dpk@morgan.com> README.SLIP)
- X port back to SunOS 3.5/4.2BSD environment (line discipline version)
- X (code is there but untested)
- X work on header file includes and ioctl usage
- X to eliminate the redefine error messages
- X
- XTODO
- X update man pages
- SHAR_EOF
- $TOUCH -am 0527193690 README.TIPX &&
- chmod 0644 README.TIPX ||
- echo "restore of README.TIPX failed"
- set `wc -c README.TIPX`;Wc_c=$1
- if test "$Wc_c" != "5339"; then
- echo original size 5339, current size $Wc_c
- fi
- # ============= CONVERT2TIPX ==============
- echo "x - extracting CONVERT2TIPX (Text)"
- sed 's/^X//' << 'SHAR_EOF' > CONVERT2TIPX &&
- X#!/bin/sh
- Xif fgrep 'TIPX' hunt.c 2>&1 > /dev/null
- X then
- X echo 'diffs have already been applied';
- X exit 1;
- X else
- X echo 'applying patches to tip to make tipx';
- Xfi
- Xpatch -p < tipx.diff.01
- Xecho ''
- Xecho 'patches have been applied. if patch was successful,'
- Xecho 'then edit Makefile to your liking and make.'
- Xexit 0
- SHAR_EOF
- $TOUCH -am 0527190690 CONVERT2TIPX &&
- chmod 0755 CONVERT2TIPX ||
- echo "restore of CONVERT2TIPX failed"
- set `wc -c CONVERT2TIPX`;Wc_c=$1
- if test "$Wc_c" != "333"; then
- echo original size 333, current size $Wc_c
- fi
- # ============= Makefile ==============
- echo "x - extracting Makefile (Text)"
- sed 's/^X//' << 'SHAR_EOF' > Makefile &&
- X#
- X# Copyright (c) 1988 The Regents of the University of California.
- X# All rights reserved.
- X#
- X# Redistribution and use in source and binary forms are permitted
- X# provided that the above copyright notice and this paragraph are
- X# duplicated in all such forms and that any documentation,
- X# advertising materials, and other materials related to such
- X# distribution and use acknowledge that the software was developed
- X# by the University of California, Berkeley. The name of the
- X# University may not be used to endorse or promote products derived
- X# from this software without specific prior written permission.
- X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X#
- X# This makefile is for tip2, an enhanced tip based on the Berkeley
- X# 4.3 tip available from uunet's ftp communications directory.
- X#
- X# @(#)Makefile 5.6 (Berkeley) 9/28/88
- X#
- X# make file for intermachine communications package
- X#
- X# Files are:
- X# /etc/remote remote host description file
- X# /etc/phones phone number file, owned by ${OWNER} and
- X# mode 6??
- X# ${ADM}/aculog ACU accounting file, owned by ${OWNER} and
- X# mode 6?? {if ACULOG defined}
- X# Presently supports:
- X# BIZCOMP
- X# DEC DF02-AC, DF03-AC
- X# DEC DN-11/Able Quadracall
- X# HAYES and Hayes emulators
- X# USR COURIER (2400 baud)
- X# VENTEL 212+
- X# VADIC 831 RS232 adaptor
- X# VADIC 3451
- X# Hayes Smartmodem 2400
- X# Telebit Trailblazer
- X# (drivers are located in libacu.a)
- X#
- X# Configuration defines:
- X# DF02, DF03, DN11 ACU's supported
- X# BIZ1031, BIZ1022, VENTEL, V831, V3451, HAYES, COURIER
- X# SM2400, TELEBIT
- X# ACULOG turn on tip logging of ACU use
- X# PRISTINE no phone #'s put in ACU log file
- X# CONNECT worthless command
- X# DEFBR default baud rate to make connection at
- X# DEFFS default frame size for FTP buffering of
- X# writes on local side
- X# BUFSIZ buffer sizing from stdio, must be fed
- X# explicitly to remcap.c if not 1024
- X# STREAMS system has streams tty interface (SunOS 4.0)
- XADM= usr/adm
- XCONFIG= -DSM2400 -DTELEBIT
- XCFLAGS= -O -DDEFBR=19200 -DDEFFS=BUFSIZ -DCONNECT -DTIPX #-DSTREAMS
- XLIBC= /lib/libc.a
- XSRCS= acu.c acutab.c cmds.c cmdtab.c cu.c hunt.c log.c login.c partab.c \
- X remcap.c remote.c tip.c tipout.c uucplock.c value.c vars.c \
- X page.c slip.c
- XOBJS= acu.o acutab.o cmds.o cmdtab.o cu.o hunt.o log.o login.o partab.o \
- X remcap.o remote.o tip.o tipout.o uucplock.o value.o vars.o \
- X page.o slip.o
- XMAN= tip.1
- X
- Xall: libacu/libacu.a tipx
- X
- Xtipx: ${OBJS} ${LIBC}
- X ${CC} -o $@ ${OBJS} libacu/libacu.a
- X
- X# acutab is configuration dependent, and so depends on the makefile
- Xacutab.o: Makefile
- Xacutab.o: acutab.c
- X ${CC} -c ${CFLAGS} ${CONFIG} acutab.c
- X
- X# remote.o depends on the makefile because of DEFBR and DEFFS
- X# log.o depends on the makefile because of ACULOG
- Xlog.o remote.o: Makefile
- X
- Xlibacu/libacu.a: FRC
- X cd libacu; make ${MFLAGS}
- X
- Xclean:
- X rm -f ${OBJS} core tip
- X cd libacu; make ${MFLAGS} clean
- X
- Xcleandir: clean
- X rm -f ${MAN} tags .depend
- X cd libacu; make ${MFLAGS} cleandir
- X
- Xdepend:
- X mkdep ${CFLAGS} ${SRCS}
- X cd libacu; make ${MFLAGS} depend
- X
- Xinstall: ${MAN}
- X cd libacu; make ${MFLAGS} install
- X install -s -o root -g daemon -m 6711 tip ${DESTDIR}/usr/bin/tip
- X rm -f ${DESTDIR}/usr/bin/cu
- X ln ${DESTDIR}/usr/bin/tip ${DESTDIR}/usr/bin/cu
- X install -c -o bin -g bin -m 444 tip.1 ${DESTDIR}/usr/man/man1
- X rm -f ${DESTDIR}/usr/man/man1/cu.1
- X ln ${DESTDIR}/usr/man/tip1/tip.1 ${DESTDIR}/usr/man/cat1/cu.1
- X
- Xlint: ${SRCS}
- X lint ${CFLAGS} ${SRCS}
- X
- Xtags: ${SRCS}
- X ctags ${SRCS}
- X cd libacu; make ${MFLAGS} tags
- X
- XFRC:
- SHAR_EOF
- $TOUCH -am 0527181990 Makefile &&
- chmod 0644 Makefile ||
- echo "restore of Makefile failed"
- set `wc -c Makefile`;Wc_c=$1
- if test "$Wc_c" != "3596"; then
- echo original size 3596, current size $Wc_c
- fi
- # ============= tip.c ==============
- echo "x - extracting tip.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > tip.c &&
- Xchar *tipx_rev = "x1.20";
- X#define PATCHLEVEL 0 /* may it remain ever so */
- X/*
- X * Copyright (c) 1983 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms are permitted
- X * provided that the above copyright notice and this paragraph are
- X * duplicated in all such forms and that any documentation,
- X * advertising materials, and other materials related to such
- X * distribution and use acknowledge that the software was developed
- X * by the University of California, Berkeley. The name of the
- X * University may not be used to endorse or promote products derived
- X * from this software without specific prior written permission.
- X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X */
- X/*
- X * Modifications by Warren Tucker <wht%n4hgf.uucp@emory.mathcs.emory.edu>
- X * for eight-bit transparent pass through and file transfer protocols
- X * are unencumbered in any way. They are yours, ours, everybody's, nobody's.
- X */
- X/*+:EDITS:*/
- X/*:05-08-1990-15:05-wht@n4hgf-rawthru */
- X/*:05-08-1990-15:00-wht@n4hgf-move tip.c original to tip-orig.c */
- X
- X#ifndef lint
- Xchar copyright[] =
- X"@(#) Copyright(c) 1983 The Regents of the University of California.\n\
- X All rights reserved.\n";
- X#endif /* not lint */
- X
- X#ifndef lint
- Xstatic char sccsid[] = "@(#)tip.c 5.8 (Berkeley) 9/2/88 (mod by wht@n4hgf)";
- X#endif /* not lint */
- X
- X/*
- X * tip - UNIX link to other systems
- X * tip [-psv] [-speed] system-name [data]
- X * or
- X * cu phone-number [-s speed] [-l line] [-a acu]
- X */
- X#include "tip.h"
- X
- X/*
- X * Baud rate mapping table
- X */
- Xint bauds[] =
- X{
- X 0,50,75,110,134,150,200,300,600,
- X 1200,1800,2400,4800,9600,19200,38400,-1
- X};
- X
- X#ifdef TIPX
- Xint rawthru = 0;
- Xchar *rawthru_msg = "\r\n--> raw tip: 3 ~ rapidly for ~ equivalent\r\n";
- Xchar *no_rawthru_msg = "\r\n--> normal tip: 1 ~ == ~\r\n";
- Xextern char opened_tty[];
- X#endif
- X
- Xint page;
- Xint disc = OTTYDISC; /* tip normally runs this way */
- Xsigfunc_t intprompt();
- Xsigfunc_t timeout();
- Xsigfunc_t cleanup();
- Xchar *login();
- Xchar *sname();
- Xchar PNbuf[256]; /* This limits the size of a number */
- Xstruct sgttyb ttyarg;
- X
- X#ifdef TIPX
- Xtypedef struct b_to_br
- X{
- X char *baud_rate;
- X int B_code;
- X} B_TO_BR;
- X
- XB_TO_BR speeds[] = /* ordered to put less common rates later in table */
- X{ /* and the vagaries of baud rates above 9600 "handled" */
- X "2400", B2400,
- X "1200", B1200,
- X "9600", B9600,
- X#if defined(B19200)
- X "19200",B19200,
- X#endif
- X#if defined(B38400)
- X "38400",B38400,
- X#endif
- X "4800", B4800,
- X "300", B300,
- X "110", B110,
- X "600", B600,
- X "75", B75,
- X "50", B50,
- X "HUP", B0,
- X "EXTA", EXTA,
- X "EXTB", EXTB,
- X
- X (char *)0,0
- X};
- X#endif /* TIPX */
- X
- X/*+-------------------------------------------------------------------------
- X B_to_baud_rate(code) - convert CBAUD B_ code to baud rate string
- X--------------------------------------------------------------------------*/
- X#ifdef TIPX
- Xchar *
- XB_to_baud_rate(code)
- Xint code;
- X{
- Xregister int n;
- X
- X for(n=0; speeds[n].baud_rate; n++)
- X if(speeds[n].B_code == code)
- X return(speeds[n].baud_rate);
- X return("-----");
- X} /* end of B_to_baud_rate */
- X#endif /* TIPX */
- X
- Xmain(argc,argv)
- Xchar *argv[];
- X{
- X int uuid;
- X char *system = NOSTR;
- X char *data = NOSTR;
- X register int i;
- X register char *p;
- X char sbuf[12];
- X
- X uid = getuid();
- X gid = getgid();
- X euid = geteuid(); /* should be root */
- X egid = getegid();
- X uuid = getuucpuid();
- X
- X if(equal(sname(argv[0]),"cu"))
- X {
- X setreuid(uid,uuid);
- X cumode = 1;
- X cumain(argc,argv);
- X goto cucommon;
- X }
- X
- X if(argc < 2)
- X {
- X fprintf(stderr,"usage: tip [-psv] [-speed] [system-name] [data]\n");
- X exit(1);
- X }
- X
- X for(; argc > 1; argv++,argc--)
- X {
- X if(argv[1][0] != '-')
- X {
- X if(system)
- X data = argv[1];
- X else
- X system = argv[1];
- X }
- X else switch(argv[1][1])
- X {
- X
- X case 'p':
- X page++;
- X break;
- X case 's':
- X slip++;
- X break;
- X case 'v':
- X vflag++;
- X break;
- X
- X case '0':
- X case '1':
- X case '2':
- X case '3':
- X case '4':
- X case '5':
- X case '6':
- X case '7':
- X case '8':
- X case '9':
- X BR = atoi(&argv[1][1]);
- X break;
- X
- X default:
- X fprintf(stderr,"tip: %s, unknown option\n",argv[1]);
- X break;
- X }
- X }
- X if(!isatty(0) && !slip && !page)
- X {
- X fprintf(stderr,"tip: warning: input is not a tty\n");
- X }
- X if(slip)
- X {
- X setreuid(euid,uuid);
- X uid = 0;
- X }
- X else
- X {
- X setreuid(uid,uuid);
- X }
- X euid = uuid;
- X
- X if(system == NOSTR)
- X goto notnumber;
- X if(isalpha(*system))
- X goto notnumber;
- X /*
- X * System name is really a phone number...
- X * Copy the number then stomp on the original (in case the number
- X * is private, we don't want 'ps' or 'w' to find it).
- X */
- X if(strlen(system) > sizeof PNbuf - 1)
- X {
- X fprintf(stderr,"tip: phone number too long (max = %d bytes)\n",
- X sizeof PNbuf - 1);
- X exit(1);
- X }
- X strncpy( PNbuf,system,sizeof PNbuf - 1 );
- X for(p = system; *p; p++)
- X *p = '\0';
- X PN = PNbuf;
- X (void)sprintf(sbuf,"tip%d",BR);
- X system = sbuf;
- X
- Xnotnumber:
- X signal(SIGINT,cleanup);
- X signal(SIGQUIT,cleanup);
- X signal(SIGHUP,cleanup);
- X signal(SIGTERM,cleanup);
- X signal(SIGPIPE,cleanup);
- X
- X if((i = hunt(system)) == 0)
- X {
- X printf("all ports busy\n");
- X exit(3);
- X }
- X if(i == -1)
- X {
- X printf("link down\n");
- X (void)uu_unlock(uucplock);
- X exit(3);
- X }
- X setbuf(stdout,NULL);
- X loginit();
- X
- X /*
- X * Kludge, their's no easy way to get the initialization
- X * in the right order, so force it here
- X */
- X if((PH = getenv("PHONES")) == NOSTR)
- X PH = "/etc/phones";
- X vinit(); /* init variables */
- X setparity("none"); /* set the parity table */
- X if((i = speed(number(value(BAUDRATE)))) == NULL)
- X {
- X printf("tip: bad baud rate %d\n",number(value(BAUDRATE)));
- X (void)uu_unlock(uucplock);
- X exit(3);
- X }
- X
- X if(slip)
- X {
- X if(SA == NOSTR)
- X {
- X printf("tip: local addr not set\n");
- X uu_unlock(uucplock);
- X exit(3);
- X }
- X if(DA == NOSTR)
- X {
- X printf("tip: destination addr not set\n");
- X uu_unlock(uucplock);
- X exit(3);
- X }
- X if(SM == NOSTR)
- X {
- X printf("tip: slip netmask not set\n");
- X uu_unlock(uucplock);
- X exit(3);
- X }
- X }
- X
- X /*
- X * Now that we have the logfile and the ACU open
- X * return to the real uid and gid. These things will
- X * be closed on exit. Swap real and effective uid's
- X * so we can get the original permissions back
- X * for removing the uucp lock.
- X */
- X user_uid(); /* in the case of slip, we are now priviliged */
- X
- X /*
- X * Hardwired connections require the
- X * line speed set before they make any transmissions
- X * (this is particularly true of things like a DF03-AC)
- X */
- X if(HW)
- X ttysetup(i);
- X if(p = lconnect())
- X {
- X printf("\07%s\n[EOT]\n",p);
- X daemon_uid();
- X (void)uu_unlock(uucplock);
- X exit(1);
- X }
- X if(!HW)
- X ttysetup(i);
- X
- X
- X if(LS != NOSTR)
- X {
- X fprintf(stderr,"\07[Logging in...]\r\n");
- X if(p = login())
- X {
- X printf("\07%s\n[EOT]\n",p);
- X daemon_uid();
- X (void)uu_unlock(uucplock);
- X exit(1);
- X }
- X }
- X
- X if(page)
- X {
- X i = sendpage(data);
- X daemon_uid();
- X (void)uu_unlock(uucplock);
- X exit(i);
- X }
- X
- X if(slip)
- X {
- X i = runslip();
- X daemon_uid();
- X (void)uu_unlock(uucplock);
- X exit(i);
- X }
- X
- Xcucommon:
- X /*
- X * From here down the code is shared with
- X * the "cu" version of tip.
- X */
- X
- X ioctl(0,TIOCGETP,(char *)&defarg);
- X ioctl(0,TIOCGETC,(char *)&defchars);
- X ioctl(0,TIOCGLTC,(char *)&deflchars);
- X ioctl(0,TIOCGETD,(char *)&odisc);
- X arg = defarg;
- X#ifdef TIPX
- X arg.sg_flags = CBREAK;
- X#else
- X arg.sg_flags = ANYP | CBREAK;
- X#endif
- X tchars = defchars;
- X tchars.t_intrc = tchars.t_quitc = -1;
- X ltchars = deflchars;
- X ltchars.t_suspc = ltchars.t_dsuspc = ltchars.t_flushc
- X = ltchars.t_lnextc = -1;
- X raw();
- X
- X pipe(fildes);
- X pipe(repdes);
- X signal(SIGALRM,timeout);
- X
- X /*
- X * Everything's set up now:
- X * connection established (hardwired or dialup)
- X * line conditioned (baud rate, mode, etc.)
- X * internal data structures (variables)
- X * so, fork one process for local side and one for remote.
- X */
- X#ifdef TIPX
- X printf("tipx (tip 4.3 mod by wht@n4hgf %s.%02d) connected to %s\r\n",
- X tipx_rev,PATCHLEVEL,opened_tty);
- X fputs("Copyright (c) 1983 The Regents of the University of California.\r\n",
- X stdout);
- X printf("line speed = %s, tandem = %s\r\n",
- X B_to_baud_rate(ttyarg.sg_ospeed),
- X (ttyarg.sg_flags & TANDEM) ? "yes" : "no");
- X#else
- X printf(cumode ? "Connected\r\n" : "\07connected\r\n");
- X#endif
- X if(pid = fork())
- X tipin();
- X else
- X tipout();
- X /*NOTREACHED*/
- X}
- X
- Xsigfunc_t
- Xcleanup()
- X{
- X
- X daemon_uid();
- X (void)uu_unlock(uucplock);
- X if(pid)
- X {
- X (void) kill(pid,SIGTERM);
- X unraw();
- X }
- X else if(odisc)
- X ioctl(0,TIOCSETD,(char *)&odisc);
- X exit(0);
- X}
- X
- X/*
- X * Muck with user ID's. We are setuid to the owner of the lock
- X * directory when we start. user_uid() reverses real and effective
- X * ID's after startup, to run with the user's permissions.
- X * daemon_uid() switches back to the privileged uid for unlocking.
- X * Finally, to avoid running a shell with the wrong real uid,
- X * shell_uid() sets real and effective uid's to the user's real ID.
- X */
- Xstatic int uidswapped;
- X
- Xuser_uid()
- X{
- X if(uidswapped == 0)
- X {
- X setregid(egid,gid);
- X setreuid(euid,uid);
- X uidswapped = 1;
- X }
- X}
- X
- Xdaemon_uid()
- X{
- X if(uidswapped)
- X {
- X setreuid(uid,euid);
- X setregid(gid,egid);
- X uidswapped = 0;
- X }
- X}
- X
- Xshell_uid()
- X{
- X
- X setreuid(uid,uid);
- X setregid(gid,gid);
- X}
- X
- X/*
- X * put the controlling keyboard into raw mode
- X */
- Xraw()
- X{
- X
- X ioctl(0,TIOCSETP,&arg);
- X ioctl(0,TIOCSETC,&tchars);
- X ioctl(0,TIOCSLTC,<chars);
- X ioctl(0,TIOCSETD,(char *)&disc);
- X}
- X
- X
- X/*
- X * return keyboard to normal mode
- X */
- Xunraw()
- X{
- X
- X ioctl(0,TIOCSETD,(char *)&odisc);
- X ioctl(0,TIOCSETP,(char *)&defarg);
- X ioctl(0,TIOCSETC,(char *)&defchars);
- X ioctl(0,TIOCSLTC,(char *)&deflchars);
- X}
- X
- Xstatic jmp_buf promptbuf;
- X
- X/*
- X * Print string ``s'', then read a string
- X * in from the terminal. Handles signals & allows use of
- X * normal erase and kill characters.
- X */
- Xprompt(s,p)
- Xchar *s;
- Xregister char *p;
- X{
- X register char *b = p;
- X sigfunc_t(*oint)(),(*oquit)();
- X
- X stoprompt = 0;
- X oint = signal(SIGINT,intprompt);
- X oquit = signal(SIGQUIT,SIG_IGN);
- X unraw();
- X printf("%s",s);
- X if(setjmp(promptbuf) == 0)
- X while((*p = getchar()) != EOF && *p != '\n')
- X p++;
- X *p = '\0';
- X
- X raw();
- X signal(SIGINT,oint);
- X signal(SIGQUIT,oint);
- X return(stoprompt || p == b);
- X}
- X
- X/*
- X * Interrupt service routine during prompting
- X */
- Xsigfunc_t
- Xintprompt()
- X{
- X
- X signal(SIGINT,SIG_IGN);
- X stoprompt = 1;
- X printf("\r\n");
- X longjmp(promptbuf,1);
- X}
- X
- X/*
- X * ****TIPIN TIPIN****
- X */
- Xtipin()
- X{
- X char gch,bol = 1;
- X
- X /*
- X * Kinda klugey here...
- X * check for scripting being turned on from the .tiprc file,
- X * but be careful about just using setscript(), as we may
- X * send a SIGEMT before tipout has a chance to set up catching
- X * it; so wait a second, then setscript()
- X */
- X if(boolean(value(SCRIPT)))
- X {
- X sleep(1);
- X setscript();
- X }
- X
- X#ifdef TIPX
- X if(!rawthru)
- X goto NORMAL_TIP2;
- X
- XRAWTHRU_TIP:
- X printf(rawthru_msg);
- X while(1)
- X {
- X long count;
- X char chbuf[4];
- X read(0,&gch,1);
- X if((gch == character(value(ESCAPE))))
- X {
- X sleep(1);
- X ioctl(0,FIONREAD,&count);
- X if(count == 2)
- X { /* might have raw mode escape */
- X read(0,chbuf,2);
- X if((chbuf[0] == character(value(ESCAPE))) &&
- X (chbuf[1] == character(value(ESCAPE))))
- X {
- X printf("rawthru%s",ctrl(chbuf[0]));
- X if(!(gch = escape()))
- X {
- X if(!rawthru)
- X {
- X bol = 1;
- X goto NORMAL_TIP;
- X }
- X continue;
- X }
- X }
- X else
- X {
- X gch = character(value(ESCAPE));
- X write(FD,&gch,1);
- X write(FD,chbuf,2);
- X continue;
- X }
- X }
- X }
- X write(FD,&gch,1);
- X }
- X
- XNORMAL_TIP:
- X printf(no_rawthru_msg);
- XNORMAL_TIP2:
- X#endif /* TIPX */
- X while(1)
- X {
- X gch = getchar()&0177;
- X if((gch == character(value(ESCAPE))) && bol)
- X {
- X if(!(gch = escape()))
- X#ifdef TIPX
- X {
- X if(rawthru)
- X goto RAWTHRU_TIP;
- X continue;
- X }
- X#else /* TIPX */
- X continue;
- X#endif /* TIPX */
- X }
- X else if(!cumode && gch == character(value(RAISECHAR)))
- X {
- X boolean(value(RAISE)) = !boolean(value(RAISE));
- X continue;
- X }
- X else if(gch == '\r')
- X {
- X bol = 1;
- X pwrite(FD,&gch,1);
- X if(boolean(value(HALFDUPLEX)))
- X printf("\r\n");
- X continue;
- X }
- X else if(!cumode && gch == character(value(FORCE)))
- X gch = getchar()&0177;
- X bol = any(gch,value(EOL));
- X if(boolean(value(RAISE)) && islower(gch))
- X gch = toupper(gch);
- X pwrite(FD,&gch,1);
- X if(boolean(value(HALFDUPLEX)))
- X printf("%c",gch);
- X }
- X}
- X
- X/*
- X * Escape handler --
- X * called on recognition of ``escapec'' at the beginning of a line
- X */
- Xescape()
- X{
- X register char gch;
- X register esctable_t *p;
- X char c = character(value(ESCAPE));
- X extern esctable_t etable[];
- X
- X gch = (getchar()&0177);
- X for(p = etable; p->e_char; p++)
- X if(p->e_char == gch)
- X {
- X if((p->e_flags&PRIV) && uid)
- X continue;
- X#ifdef TIPX
- X if(!rawthru)
- X#endif
- X printf("%s",ctrl(c));
- X (*p->e_func)(gch);
- X return(0);
- X }
- X /* ESCAPE ESCAPE forces ESCAPE */
- X if(c != gch)
- X pwrite(FD,&c,1);
- X return(gch);
- X}
- X
- Xspeed(n)
- Xint n;
- X{
- X register int *p;
- X
- X for(p = bauds; *p != -1; p++)
- X if(*p == n)
- X return(p - bauds);
- X return(NULL);
- X}
- X
- Xany(c,p)
- Xregister char c,*p;
- X{
- X while(p && *p)
- X if(*p++ == c)
- X return(1);
- X return(0);
- X}
- X
- Xsize(s)
- Xregister char *s;
- X{
- X register int i = 0;
- X
- X while(s && *s++)
- X i++;
- X return(i);
- X}
- X
- Xchar *
- Xinterp(s)
- Xregister char *s;
- X{
- X static char buf[256];
- X register char *p = buf,c,*q;
- X
- X while(c = *s++)
- X {
- X for(q = "\nn\rr\tt\ff\033E\bb"; *q; q++)
- X if(*q++ == c)
- X {
- X *p++ = '\\';
- X *p++ = *q;
- X goto next;
- X }
- X if(c < 040)
- X {
- X *p++ = '^';
- X *p++ = c + 'A'-1;
- X }
- X else if(c == 0177)
- X {
- X *p++ = '^';
- X *p++ = '?';
- X }
- X else
- X *p++ = c;
- Xnext:
- X ;
- X }
- X *p = '\0';
- X return(buf);
- X}
- X
- Xchar *
- Xctrl(c)
- Xchar c;
- X{
- X static char s[3];
- X
- X if(c < 040 || c == 0177)
- X {
- X s[0] = '^';
- X s[1] = c == 0177 ? '?' : c+'A'-1;
- X s[2] = '\0';
- X }
- X else
- X {
- X s[0] = c;
- X s[1] = '\0';
- X }
- X return(s);
- X}
- X
- X/*
- X * Help command
- X */
- Xhelp(c)
- Xchar c;
- X{
- X register esctable_t *p;
- X extern esctable_t etable[];
- X
- X printf("%c\r\n",c);
- X for(p = etable; p->e_char; p++)
- X {
- X if((p->e_flags&PRIV) && uid)
- X continue;
- X printf("%2s",ctrl(character(value(ESCAPE))));
- X printf("%-2s %c %s\r\n",ctrl(p->e_char),
- X p->e_flags&EXP ? '*': ' ',p->e_help);
- X }
- X}
- X
- X/*
- X * Set up the "remote" tty's state
- X */
- Xttysetup(speed)
- Xint speed;
- X{
- X unsigned bits = LDECCTQ;
- X
- X ttyarg.sg_ispeed = ttyarg.sg_ospeed = speed;
- X ttyarg.sg_flags = RAW;
- X if(boolean(value(TAND)))
- X ttyarg.sg_flags |= TANDEM;
- X if(boolean(value(DTRHUP)))
- X {
- X ioctl(FD,TIOCSDTR,0);
- X ioctl(FD,TIOCHPCL,0);
- X }
- X ioctl(FD,TIOCSETP,(char *)&ttyarg);
- X ioctl(FD,TIOCLBIS,(char *)&bits);
- X}
- X
- X/*
- X * Return "simple" name from a file name,
- X * strip leading directories.
- X */
- Xchar *
- Xsname(s)
- Xregister char *s;
- X{
- X register char *p = s;
- X
- X while(*s)
- X if(*s++ == '/')
- X p = s;
- X return(p);
- X}
- X
- Xstatic char partab[0200];
- X
- X/*
- X * Do a write to the remote machine with the correct parity.
- X * We are doing 8 bit wide output, so we just generate a character
- X * with the right parity and output it.
- X */
- Xpwrite(fd,buf,n)
- Xint fd;
- Xchar *buf;
- Xregister int n;
- X{
- X register int i;
- X register char *bp;
- X extern int errno;
- X#ifdef TIPX
- X extern int rawthru;
- X
- X if(rawthru)
- X {
- X write(fd,buf,n);
- X return;
- X }
- X#endif /* TIPX */
- X
- X bp = buf;
- X for(i = 0; i < n; i++)
- X {
- X *bp = partab[(*bp) & 0177];
- X bp++;
- X }
- X if(write(fd,buf,n) < 0)
- X {
- X if(errno == EIO)
- X abort("Lost carrier.");
- X /* this is questionable */
- X perror("write");
- X }
- X}
- X
- X/*
- X * Build a parity table with appropriate high-order bit.
- X */
- Xsetparity(defparity)
- Xchar *defparity;
- X{
- X register int i;
- X char *parity;
- X extern char evenpartab[];
- X
- X if(value(PARITY) == NOSTR)
- X value(PARITY) = defparity;
- X parity = value(PARITY);
- X for(i = 0; i < 0200; i++)
- X partab[i] = evenpartab[i];
- X if(equal(parity,"even"))
- X return;
- X if(equal(parity,"odd"))
- X {
- X for(i = 0; i < 0200; i++)
- X partab[i] ^= 0200; /* reverse bit 7 */
- X return;
- X }
- X if(equal(parity,"none") || equal(parity,"zero"))
- X {
- X for(i = 0; i < 0200; i++)
- X partab[i] &= ~0200; /* turn off bit 7 */
- X return;
- X }
- X if(equal(parity,"one"))
- X {
- X for(i = 0; i < 0200; i++)
- X partab[i] |= 0200; /* turn on bit 7 */
- X return;
- X }
- X fprintf(stderr,"%s: unknown parity value\n",PA);
- X fflush(stderr);
- X}
- X
- X/* The uid could be determined by stat()-ing ACULOG */
- Xgetuucpuid()
- X{
- X struct passwd *pw;
- X
- X if((pw = getpwnam("uucp")) == NULL)
- X {
- X fprintf(stderr,"tip: unable to get uucp uid\n");
- X exit(1);
- X }
- X return(pw->pw_uid);
- X}
- SHAR_EOF
- $TOUCH -am 0527192890 tip.c &&
- chmod 0644 tip.c ||
- echo "restore of tip.c failed"
- set `wc -c tip.c`;Wc_c=$1
- if test "$Wc_c" != "16181"; then
- echo original size 16181, current size $Wc_c
- fi
- # ============= tipx.diff.01 ==============
- echo "x - extracting tipx.diff.01 (Text)"
- sed 's/^X//' << 'SHAR_EOF' > tipx.diff.01 &&
- X:
- X#-------------------------------------------------------
- X# tipx.diff.01
- X# tip to tipx diffs
- X# created by gendiff x1.03 on 27 May 1990 23:28 UTC
- X#-------------------------------------------------------
- X*** orig/cmds.c Sun May 28 12:58:00 1989
- X--- cmds.c Sun May 27 18:19:35 1990
- X***************
- X*** 537,542
- X }
- X #endif
- X
- X /*
- X * Escape to local shell
- X */
- X
- X--- 537,543 -----
- X }
- X #endif
- X
- X+ #ifdef TIPX
- X /*
- X * filexfer_help
- X *
- X***************
- X*** 538,543
- X #endif
- X
- X /*
- X * Escape to local shell
- X */
- X shell()
- X
- X--- 539,698 -----
- X
- X #ifdef TIPX
- X /*
- X+ * filexfer_help
- X+ *
- X+ * Display help for ~X
- X+ * type = 0, general help, 1 = send help, 2 = receive help
- X+ */
- X+ filexfer_help(type)
- X+ int type;
- X+ {
- X+ static char *ghelp[] =
- X+ {
- X+ "for send help, type ~Xs?; for receive help, type ~Xr?",
- X+ "where ~ represents your escape character",
- X+ (char *)0,
- X+ };
- X+ static char *shelp[] =
- X+ {
- X+ "XMODEM (CHK, CRC) and XMODEM-1k/CRC",
- X+ "sx [-ak] filename -a (ASCII) convert NL to CR/LF (default binary)",
- X+ " -k use 1024 blocks instead of 128 (XMODEM-1k)",
- X+ "YMODEM/CRC Batch",
- X+ "sy [-af] filelist -a (ASCII) convert NL to CR/LF (default binary)",
- X+ " -f transfer using full pathanme (default simple)",
- X+ "ZMODEM (CRC-16, CRC-32)",
- X+ "sz [-af+nNyrwo] [-w #] [-L #] [-l #] filelist",
- X+ " -a (ASCII) convert NL to CR/LF (default binary)",
- X+ " not all ZMODEM -f transfer using full pathanme (default simple)",
- X+ " receivers accept -+ Append to existing destination file",
- X+ " all overwrite -n overwrite file if source newer",
- X+ " or append -N overwrite file if source newer or longer",
- X+ " options -y yes, absolutely overwrite existing file",
- X+ " -r Resume/Recover interrupted file transfer",
- X+ " -o use CRC-16 instead of CRC-32",
- X+ " -w # Window is # bytes (>= 256, multiple of 64)",
- X+ " -L # Limit subpacket length to # bytes",
- X+ " -l # Limit frame length to # bytes (l must >= L)",
- X+ (char *)0
- X+ };
- X+ static char *rhelp[] =
- X+ {
- X+ "XMODEM (CHK, CRC) (rcvr tries CRC, then checksum)",
- X+ " rx [-ab] filename",
- X+ "YMODEM/CRC Batch ry [-abu]",
- X+ "ZMODEM (CRC-16, CRC-32) rz [-abu]",
- X+ "Switches: -a force ASCII translation on receive",
- X+ " -b force binary transfer",
- X+ " -u convert uppercase filenames to lower case",
- X+ (char *)0
- X+ };
- X+ char **hh;
- X+
- X+ switch(type)
- X+ {
- X+ case 0: hh = ghelp; break;
- X+ case 1: hh = shelp; break;
- X+ case 2: hh = rhelp; break;
- X+ }
- X+ while(*hh)
- X+ {
- X+ fputs(*hh++,stdout);
- X+ fputs("\r\n",stdout);
- X+ }
- X+ }
- X+ #endif /* TIPX */
- X+
- X+ #ifdef TIPX
- X+ /*
- X+ * filexfer
- X+ *
- X+ * Fork a file transfer with:
- X+ * 0 <-> local tty in
- X+ * 1 <-> local tty out
- X+ * 2 <-> local tty out
- X+ * FD <-> remote tty in/out
- X+ */
- X+ filexfer(c)
- X+ {
- X+ char buf[256];
- X+ char xcmd[256+24];
- X+ int cpid, status, p;
- X+ time_t start;
- X+
- X+ putchar(c);
- X+ if(prompt("\r\nfile transfer command? (? for help) ", buf))
- X+ return;
- X+ if(!strncmp(buf,"sz ",3))
- X+ sprintf(xcmd,"tipsz -Z -. %d ",FD);
- X+ else if(!strncmp(buf,"sy ",3))
- X+ sprintf(xcmd,"tipsz -Y -k -. %d ",FD);
- X+ else if(!strncmp(buf,"sx ",3))
- X+ sprintf(xcmd,"tipsz -X -. %d ",FD);
- X+ else if(!strncmp(buf,"rz ",3))
- X+ sprintf(xcmd,"tiprz -Z -. %d ",FD);
- X+ else if(!strncmp(buf,"ry ",3))
- X+ sprintf(xcmd,"tiprz -Y -. %d ",FD);
- X+ else if(!strncmp(buf,"rx ",3))
- X+ sprintf(xcmd,"tiprz -X -. %d ",FD);
- X+ else if(!strncmp(buf,"?",1))
- X+ {
- X+ filexfer_help(0);
- X+ return;
- X+ }
- X+ else if(!strncmp(buf,"s?",2))
- X+ {
- X+ filexfer_help(1);
- X+ return;
- X+ }
- X+ else if(!strncmp(buf,"r?",2))
- X+ {
- X+ filexfer_help(2);
- X+ return;
- X+ }
- X+ else
- X+ {
- X+ printf("unrecognized transfer command (use sz, rz, etc.)\r\n");
- X+ return;
- X+ }
- X+ strcat(xcmd,buf + 3);
- X+
- X+ kill(pid, SIGIOT); /* put TIPOUT into a wait state */
- X+ signal(SIGINT, SIG_IGN);
- X+ signal(SIGQUIT, SIG_IGN);
- X+ unraw();
- X+ read(repdes[0], (char *)&ccc, 1);
- X+ if ((cpid = vfork()) < 0)
- X+ printf("can't fork!\r\n");
- X+ else if (cpid) {
- X+ start = time(0);
- X+ while ((p = wait(&status)) > 0 && p != cpid)
- X+ ;
- X+ } else {
- X+ register int i;
- X+
- X+ for (i = 3; i < 20; i++)
- X+ {
- X+ if(i != FD)
- X+ close(i);
- X+ }
- X+ signal(SIGINT, SIG_DFL);
- X+ signal(SIGQUIT, SIG_DFL);
- X+ user_uid();
- X+ execl("/bin/sh", "sh", "-c", xcmd, (char *)0);
- X+ printf("can't execute `%s'\n", xcmd);
- X+ perror("execl");
- X+ exit(0);
- X+ }
- X+ prtime("away for ", time(0)-start);
- X+ write(fildes[1], (char *)&ccc, 1);
- X+ raw();
- X+ signal(SIGINT, SIG_DFL);
- X+ signal(SIGQUIT, SIG_DFL);
- X+ }
- X+ #endif
- X+
- X+ /*
- X * Escape to local shell
- X */
- X shell()
- X***************
- X*** 776,781
- X sleep(1);
- X ioctl(FD, TIOCCBRK, NULL);
- X }
- X
- X /*
- X * Suspend tip
- X
- X--- 931,985 -----
- X sleep(1);
- X ioctl(FD, TIOCCBRK, NULL);
- X }
- X+
- X+ /*
- X+ * Send a ^S.
- X+ */
- X+ #ifdef TIPX
- X+ genctls()
- X+ {
- X+ static char ctls = 0x13;
- X+
- X+ printf("^S");
- X+ write(FD, &ctls, 1);
- X+ }
- X+ #endif
- X+
- X+ /*
- X+ * Send a ^Q.
- X+ */
- X+ #ifdef TIPX
- X+ genctlq()
- X+ {
- X+ static char ctlq = 0x11;
- X+
- X+ printf("^Q");
- X+ write(FD, &ctlq, 1);
- X+ }
- X+ #endif
- X+
- X+ /*
- X+ * control rawthru mode
- X+ */
- X+ #ifdef TIPX
- X+ rawthru_control(gch)
- X+ char gch;
- X+ {
- X+ extern int rawthru;
- X+ gch &= 0177;
- X+ write(2,&gch,1);
- X+ if(gch == 'R')
- X+ {
- X+ rawthru = 1;
- X+ kill(pid,SIGUSR1);
- X+ }
- X+ else
- X+ {
- X+ rawthru = 0;
- X+ kill(pid,SIGUSR2);
- X+ }
- X+ }
- X+ #endif
- X
- X /*
- X * Suspend tip
- X*** orig/cmdtab.c Sun Oct 9 22:35:00 1988
- X--- cmdtab.c Sun May 27 18:19:35 1990
- X***************
- X*** 14,19
- X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X */
- X
- X #ifndef lint
- X static char sccsid[] = "@(#)cmdtab.c 5.5 (Berkeley) 9/2/88";
- X
- X--- 14,21 -----
- X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X */
- X+ /*+:EDITS:*/
- X+ /*:05-08-1990-15:55-wht@n4hgf-rawthru */
- X
- X #ifndef lint
- X static char sccsid[] = "@(#)cmdtab.c 5.5 (Berkeley) 9/2/88";
- X***************
- X*** 25,30
- X extern int finish(), help(), pipefile(), pipeout(), consh(), variable();
- X extern int cu_take(), cu_put(), dollar(), genbrk(), suspend();
- X
- X esctable_t etable[] = {
- X { '!', NORM, "shell", shell },
- X { '<', NORM, "receive file from remote host", getfl },
- X
- X--- 27,37 -----
- X extern int finish(), help(), pipefile(), pipeout(), consh(), variable();
- X extern int cu_take(), cu_put(), dollar(), genbrk(), suspend();
- X
- X+ #ifdef TIPX
- X+ extern int genctls(), genctlq(), rawthru_control();
- X+ extern int filexfer();
- X+ #endif
- X+
- X esctable_t etable[] = {
- X { '!', NORM, "shell", shell },
- X { '<', NORM, "receive file from remote host", getfl },
- X***************
- X*** 44,48
- X { 's', NORM, "set variable", variable },
- X { '?', NORM, "get this summary", help },
- X { '#', NORM, "send break", genbrk },
- X { 0, 0, 0 }
- X };
- X
- X--- 51,62 -----
- X { 's', NORM, "set variable", variable },
- X { '?', NORM, "get this summary", help },
- X { '#', NORM, "send break", genbrk },
- X+ #ifdef TIPX
- X+ { 'S', NORM, "send ^S (XOFF)", genctls },
- X+ { 'Q', NORM, "send ^Q (XON)", genctlq },
- X+ { 'R', NORM, "set rawthru mode", rawthru_control },
- X+ { 'N', NORM, "no rawthru mode", rawthru_control },
- X+ { 'X', NORM, "X/Y/ZMODEM send/receive",filexfer },
- X+ #endif
- X { 0, 0, 0 }
- X };
- X*** orig/hunt.c Sat May 13 14:43:00 1989
- X--- hunt.c Sun May 27 18:19:36 1990
- X***************
- X*** 28,33
- X static int deadfl;
- X
- X char uucplock[BUFSIZ];
- X
- X dead()
- X {
- X
- X--- 28,36 -----
- X static int deadfl;
- X
- X char uucplock[BUFSIZ];
- X+ #ifdef TIPX
- X+ char opened_tty[128];
- X+ #endif
- X
- X dead()
- X {
- X***************
- X*** 92,97
- X */
- X if (!HW)
- X break;
- X if (setjmp(deadline) == 0) {
- X alarm(10);
- X FD = open(cp, O_RDWR);
- X
- X--- 95,104 -----
- X */
- X if (!HW)
- X break;
- X+
- X+ #ifdef TIPX
- X+ strcpy(opened_tty,cp);
- X+ #endif
- X if (setjmp(deadline) == 0) {
- X alarm(10);
- X FD = open(cp, O_RDWR);
- X*** orig/tipout.c Sat May 13 14:43:00 1989
- X--- tipout.c Sun May 27 18:19:43 1990
- X***************
- X*** 14,19
- X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X */
- X
- X #ifndef lint
- X static char sccsid[] = "@(#)tipout.c 5.2 (Berkeley) 9/2/88";
- X
- X--- 14,22 -----
- X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X */
- X+ /*+:EDITS:*/
- X+ /*:05-08-1990-15:29-wht@n4hgf-rawthru */
- X+ /*:05-08-1990-15:28-wht@n4hgf-mv tipout.c tipout-orig.c */
- X
- X #ifndef lint
- X static char sccsid[] = "@(#)tipout.c 5.2 (Berkeley) 9/2/88";
- X***************
- X*** 93,98
- X longjmp(sigbuf, 1);
- X }
- X
- X /*
- X * ****TIPOUT TIPOUT****
- X */
- X
- X--- 96,115 -----
- X longjmp(sigbuf, 1);
- X }
- X
- X+ #ifdef TIPX
- X+ extern int rawthru;
- X+ sigfunc_t
- X+ int_tipout_rawthru_on()
- X+ {
- X+ rawthru = 1;
- X+ }
- X+ sigfunc_t
- X+ int_tipout_rawthru_off()
- X+ {
- X+ rawthru = 0;
- X+ }
- X+ #endif /* TIPX */
- X+
- X /*
- X * ****TIPOUT TIPOUT****
- X */
- X***************
- X*** 111,116
- X signal(SIGIOT, intIOT); /* scripting going on signal */
- X signal(SIGHUP, intTERM); /* for dial-ups */
- X signal(SIGSYS, intSYS); /* beautify toggle */
- X (void) setjmp(sigbuf);
- X for (omask = 0;; sigsetmask(omask)) {
- X cnt = read(FD, buf, BUFSIZ);
- X
- X--- 128,137 -----
- X signal(SIGIOT, intIOT); /* scripting going on signal */
- X signal(SIGHUP, intTERM); /* for dial-ups */
- X signal(SIGSYS, intSYS); /* beautify toggle */
- X+ #ifdef TIPX
- X+ signal(SIGUSR1, int_tipout_rawthru_on);
- X+ signal(SIGUSR2, int_tipout_rawthru_off);
- X+ #endif /* TIPX */
- X (void) setjmp(sigbuf);
- X for (omask = 0;; sigsetmask(omask)) {
- X cnt = read(FD, buf, BUFSIZ);
- X***************
- X*** 123,128
- X }
- X continue;
- X }
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- X omask = sigblock(ALLSIGS);
- X for (cp = buf; cp < buf + cnt; cp++)
- X
- X--- 144,152 -----
- X }
- X continue;
- X }
- X+ #ifdef TIPX
- X+ #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)|sigmask(SIGUSR1)|sigmask(SIGUSR2)
- X+ #else /* TIPX */
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- X #endif /* TIPX */
- X omask = sigblock(ALLSIGS);
- X***************
- X*** 124,129
- X continue;
- X }
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- X omask = sigblock(ALLSIGS);
- X for (cp = buf; cp < buf + cnt; cp++)
- X *cp &= 0177;
- X
- X--- 148,154 -----
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)|sigmask(SIGUSR1)|sigmask(SIGUSR2)
- X #else /* TIPX */
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- X+ #endif /* TIPX */
- X omask = sigblock(ALLSIGS);
- X #ifdef TIPX
- X if(!rawthru)
- X***************
- X*** 125,130
- X }
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- X omask = sigblock(ALLSIGS);
- X for (cp = buf; cp < buf + cnt; cp++)
- X *cp &= 0177;
- X write(1, buf, cnt);
- X
- X--- 150,158 -----
- X #define ALLSIGS sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
- X #endif /* TIPX */
- X omask = sigblock(ALLSIGS);
- X+ #ifdef TIPX
- X+ if(!rawthru)
- X+ #endif
- X for (cp = buf; cp < buf + cnt; cp++)
- X *cp &= 0177;
- X write(1, buf, cnt);
- X***************
- X*** 133,138
- X fwrite(buf, 1, cnt, fscript);
- X continue;
- X }
- X for (cp = buf; cp < buf + cnt; cp++)
- X if ((*cp >= ' ' && *cp <= '~') ||
- X any(*cp, value(EXCEPTIONS)))
- X
- X--- 161,171 -----
- X fwrite(buf, 1, cnt, fscript);
- X continue;
- X }
- X+ #ifdef TIPX
- X+ if(rawthru)
- X+ for (cp = buf; cp < buf + cnt; cp++)
- X+ *cp &= 0177;
- X+ #endif /* TIPX */
- X for (cp = buf; cp < buf + cnt; cp++)
- X if ((*cp >= ' ' && *cp <= '~') ||
- X any(*cp, value(EXCEPTIONS)))
- SHAR_EOF
- $TOUCH -am 0527192890 tipx.diff.01 &&
- chmod 0644 tipx.diff.01 ||
- echo "restore of tipx.diff.01 failed"
- set `wc -c tipx.diff.01`;Wc_c=$1
- if test "$Wc_c" != "11976"; then
- echo original size 11976, current size $Wc_c
- fi
- # ============= tipx.diff.fls ==============
- echo "x - extracting tipx.diff.fls (Text)"
- sed 's/^X//' << 'SHAR_EOF' > tipx.diff.fls &&
- XREADME.TIPX
- XCONVERT2TIPX
- XMakefile
- Xtip.c
- Xtipx.diff.01
- Xtipx.diff.fls
- Xtipx.diff.log
- Xxfer/Makefile
- Xxfer/tiprz.c
- Xxfer/tipsz.c
- Xxfer/zcommon.c
- Xxfer/zcurses.c
- Xxfer/zdebug.c
- Xxfer/zlint.h
- Xxfer/zmodem.c
- Xxfer/zmodem.h
- SHAR_EOF
- $TOUCH -am 0527194890 tipx.diff.fls &&
- chmod 0644 tipx.diff.fls ||
- echo "restore of tipx.diff.fls failed"
- set `wc -c tipx.diff.fls`;Wc_c=$1
- if test "$Wc_c" != "206"; then
- echo original size 206, current size $Wc_c
- fi
- # ============= tipx.diff.log ==============
- echo "x - extracting tipx.diff.log (Text)"
- sed 's/^X//' << 'SHAR_EOF' > tipx.diff.log &&
- Xbase diff name is tipx.diff
- Xdiff distribution manifest name is tipx.diff.fls
- X======> no differences generated: acu.c
- X======> no differences generated: acutab.c
- Xrouting diffs to tipx.diff.01
- Xcmds.c: diffs generated (size)
- Xcmdtab.c: diffs generated (size)
- X======> no differences generated: cu.c
- Xhunt.c: diffs generated (size)
- X======> no differences generated: log.c
- X======> no differences generated: login.c
- X======> no differences generated: page.c
- X======> no differences generated: partab.c
- X======> no differences generated: remcap.c
- X======> no differences generated: remote.c
- X======> no differences generated: slip.c
- X--> tip.c: diffs larger than file (size)
- X======> no differences generated: tip.h
- Xtipout.c: diffs generated (size)
- X======> no differences generated: uucplock.c
- X======> no differences generated: value.c
- X======> no differences generated: vars.c
- X# diff file tipx.diff.01 received 11976 bytes
- SHAR_EOF
- $TOUCH -am 0527192890 tipx.diff.log &&
- chmod 0644 tipx.diff.log ||
- echo "restore of tipx.diff.log failed"
- set `wc -c tipx.diff.log`;Wc_c=$1
- if test "$Wc_c" != "905"; then
- echo original size 905, current size $Wc_c
- fi
- # ============= xfer/Makefile ==============
- if test ! -d 'xfer'; then
- echo "x - creating directory xfer"
- mkdir 'xfer'
- fi
- echo "x - extracting xfer/Makefile (Text)"
- sed 's/^X//' << 'SHAR_EOF' > xfer/Makefile &&
- X# CHK=0x86C7
- X#+-------------------------------------------------------------------
- X# Makefile for tiprz/tipsz (tip file transfer)
- X#--------------------------------------------------------------------
- X#+:EDITS:*/
- X#:05-21-1990-16:00-wht@tridom-adapt ecu xfer protocols for tipwht
- X#:05-21-1990-15:57-wht@tridom-adapt tip file xfer protocols
- X
- XSHELL = /bin/sh
- X
- X.SUFFIXES: .o .c .h
- X
- XCOMFLAGS =
- XCFLAGS = -c -O -MD=2 -Dstrchr=index -DV7 $(COMFLAGS)
- X
- XLDFLAGS = -lcurses -ltermcap
- X
- XCOMMON_SRC = \
- X zcommon.c\
- X zmodem.c\
- X zcurses.c\
- X zdebug.c
- X
- XCOMMON_OBJ = \
- X zcommon.o\
- X zmodem.o\
- X zcurses.o
- X
- X.c.o:; cc $(CFLAGS) $*.c
- X
- Xall: tipsz tiprz
- X
- Xtipsz: tipsz.o $(COMMON_OBJ)
- X echo 'char *makedate="'`date` $(SYSTEM)'";' >tipszmake.c
- X cc $(CFLAGS) tipszmake.c ; rm tipszmake.c
- X cc $(COMFLAGS) tipsz.o tipszmake.o $(COMMON_OBJ) $(LDFLAGS) -o tipsz
- X rm -f tipszmake.o
- X
- Xtiprz: tiprz.o $(COMMON_OBJ)
- X echo 'char *makedate="'`date` $(SYSTEM)'";' >tiprzmake.c
- X cc $(CFLAGS) tiprzmake.c ; rm tiprzmake.c
- X cc $(COMFLAGS) tiprz.o tiprzmake.o $(COMMON_OBJ) $(LDFLAGS) -o tiprz
- X rm -f tiprzmake.o
- X
- Xcomsrc.fls: $(COMMON_SRC) Makefile
- X ls $(COMMON_SRC) > comsrc.fls
- X
- Xlint: zlint.h
- X
- Xzlint.h: comsrc.fls
- X echo ' ' > zlint.h
- X csh ../zgcc comsrc.fls zlint.h $(CFLAGS)
- X
- X#
- X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically
- X#
- Xdepend:
- X rm -f depend.tmp
- X if test '$(COMMON_SRC)' ;\
- X then (grep '^#include' $(COMMON_SRC) \
- X | sed -e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\
- X -e 's?:[^"]*"\([^"]*\)".*?: \1?'\
- X -e 's?\(.*\)\.c?\1.o?'\
- X >> depend.tmp) ;\
- X fi
- X
- X echo '/^# DO NOT DELETE THIS LINE' >exdep.tmp
- X echo '.+1,$$d' >>exdep.tmp
- X echo 'r depend.tmp' >> exdep.tmp
- X echo 'w' >> exdep.tmp
- X cp Makefile Makefile.new
- X ex Makefile.new < exdep.tmp
- X rm exdep.tmp depend.tmp
- X echo '# DEPENDENCIES MUST END AT END OF FILE' >>Makefile.new
- X echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new
- X echo '# see make depend above'>>Makefile.new
- X mv Makefile Makefile.bak
- X mv Makefile.new Makefile
- X
- X# DO NOT DELETE THIS LINE
- Xzcommon.o: /usr/include/stdio.h
- Xzcommon.o: /usr/include/signal.h
- Xzcommon.o: /usr/include/setjmp.h
- Xzcommon.o: /usr/include/ctype.h
- Xzcommon.o: /usr/include/pwd.h
- Xzcommon.o: zmodem.h
- Xzcommon.o: /usr/include/fcntl.h
- Xzmodem.o: zmodem.h
- Xzcurses.o: /usr/include/curses.h
- Xzcurses.o: /usr/include/sys/types.h
- Xzcurses.o: /usr/include/sys/stat.h
- Xzcurses.o: /usr/include/ctype.h
- Xzcurses.o: /usr/include/signal.h
- Xzcurses.o: /usr/include/time.h
- Xzcurses.o: /usr/include/sys/timeb.h
- X# DEPENDENCIES MUST END AT END OF FILE
- X# IF YOU PUT STUFF HERE IT WILL GO AWAY
- X# see make depend above
- SHAR_EOF
- $TOUCH -am 0521162190 xfer/Makefile &&
- chmod 0644 xfer/Makefile ||
- echo "restore of xfer/Makefile failed"
- set `wc -c xfer/Makefile`;Wc_c=$1
- if test "$Wc_c" != "2607"; then
- echo original size 2607, current size $Wc_c
- fi
- echo "End of part 1, continue with part 2"
- exit 0
-
- ------------------------------------------------------------------
- Warren Tucker, Tridom Corporation ...!gatech!emory!tridom!wht
- home address: ...!gatech!n4hgf!wht
-
-