Date: Mon, 27 Mar 1995 00:33:24 -0800 From: Tom Gray - DCA <dcasba@rain.org> Message-ID: <199503270833.AAA12424@coyote.rain.org>
next in thread | raw e-mail | index | archive | help
Here's patches for an improved version of tip, which I developed on and for FreeBSD. This effort makes tip a better FreeBSD citizen. For example, it uses the termios line discipline by default. The old, compiled in modem drivers are replaced by a configurable modem driver for more flexibility and a smaller executable. See the enclosed files "BLURB" and "README" for more details. John Poplett dcasba@pacrain.com #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 1 (of 3)." # Contents: BLURB MANIFEST README patches.etc patches.tip.3 preapply # Wrapped by john@grudunza on Mon Mar 27 00:09:38 1995 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'BLURB' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'BLURB'\" else echo shar: Extracting \"'BLURB'\" \(1060 characters\) sed "s/^X//" >'BLURB' <<'END_OF_FILE' XHere are patches for tip. These patches were developed on FreeBSD for XFreeBSD (though other *BSD*s should be able to use them). The patches were Xmade to the tip sources found in current as of March 22nd. It preserves Xearlier changes to these sources that upgraded them to use HoneyDanber-style Xuucp locks and place them in /var/spool/locks. X XThe significant changes are: X X 1) Configurable modem driver X 2) Conditional support for termios (default) X 3) Conditional support for HoneyDanber style-uucp locks (default) X 4) Entries in /etc/remote can specify login and logout scripts X 5) Revised / corrected man page X 6) Consolidation of common code in the ACU drivers X 7) Bug fix when FRAMESIZE > BUFSIZ in file transfer code. X 8) Conditional cu-interface (default: disabled) X 9) Source directory layout improved X 10) End-of-file handling improved in cu-style take command. X XSince the configurable modem driver replaces a number of compiled-in X(and out-of-date!) drivers, the new tip is more flexible and more Xcompact. X XJohn Poplett Xdcasba@pacrain.com END_OF_FILE if test 1060 -ne `wc -c <'BLURB'`; then echo shar: \"'BLURB'\" unpacked with wrong size! fi # end of 'BLURB' fi if test -f 'MANIFEST' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'MANIFEST'\" else echo shar: Extracting \"'MANIFEST'\" \(362 characters\) sed "s/^X//" >'MANIFEST' <<'END_OF_FILE' X File Name Archive # Description X----------------------------------------------------------- X BLURB 1 X MANIFEST 1 This shipping list X README 1 X patches.etc 1 X patches.tip.1 2 X patches.tip.2 3 X patches.tip.3 1 X preapply 1 END_OF_FILE if test 362 -ne `wc -c <'MANIFEST'`; then echo shar: \"'MANIFEST'\" unpacked with wrong size! fi # end of 'MANIFEST' fi if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(664 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' XBefore applying these patches to tip, run the included script "preapply" Xfrom your tip source directory (e.g. /usr/src/usr.bin/tip). This step Xreorganizes the tip directories so that the patches will work. X XThe following steps should accomplish the job: X X$ cd /usr/src/usr.bin/tip X$ preapply X$ patches < patches.tip.1 X$ patches < patches.tip.2 X$ patches < patches.tip.3 X XNote also that the new modem configuration data base file, "modems", must Xbe installed in /etc/modems. X XIf you are just upgrading tip, you can do this by hand. X XIf someone is updating the source tree, applying patches.etc in X/usr/src/etc should do the trick. X XJohn Poplett Xdcasba@pacrain.com END_OF_FILE if test 664 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'patches.etc' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patches.etc'\" else echo shar: Extracting \"'patches.etc'\" \(2557 characters\) sed "s/^X//" >'patches.etc' <<'END_OF_FILE' X*** /usr/src/etc/Makefile Sat Mar 18 01:02:50 1995 X--- ./Makefile Sun Mar 26 19:03:49 1995 X*************** X*** 7,13 **** X BINGRP= wheel X BIN1= aliases csh.cshrc csh.login csh.logout dm.conf \ X ftpusers gettytab group hosts host.conf hosts.equiv hosts.lpd \ X! inetd.conf login.access motd netstart \ X networks phones printcap profile protocols rc rc.local rc.serial \ X remote security services shells \ X syslog.conf ttys etc.${MACHINE}/disktab rpc make.conf \ X--- 7,13 ---- X BINGRP= wheel X BIN1= aliases csh.cshrc csh.login csh.logout dm.conf \ X ftpusers gettytab group hosts host.conf hosts.equiv hosts.lpd \ X! inetd.conf login.access modems motd netstart \ X networks phones printcap profile protocols rc rc.local rc.serial \ X remote security services shells \ X syslog.conf ttys etc.${MACHINE}/disktab rpc make.conf \ X*** /usr/src/etc/modems Sun Mar 26 19:05:03 1995 X--- ./modems Sun Mar 26 19:06:28 1995 X*************** X*** 0 **** X--- 1,33 ---- X+ # X+ # @(#)modems 3/24/95 X+ # X+ # modems -- modem configuration data base file X+ # see tip(1), modems(5) X+ # X+ # dial_command AT command to dial up remote X+ # echo_off_command AT command to turn off command echo X+ # escape_guard_time Shroud escape sequence with specified delay (ms) X+ # escape_sequence Return to command escape sequence X+ # hangup_command AT command to hangup modem X+ # hw_flow_control Enable RTS/CTS flow control between DTE/DCE X+ # intercharacter_delay Delay between characters sent to modem when issuing X+ # commands X+ # intercommand_delay Minimum delay between commands to modem X+ # init_string AT command to initialize modem before dialing out X+ # lock_baud Use fixed DTE / DCE bit rate X+ # reset_delay Delay required by modem for reset X+ # X+ X+ sportster|st|US Robotics Sportster 14.4K:dial_command=ATDT%s\r:hangup_command=ATH\r:\ X+ :echo_off_command=ATE0\r:reset_command=AT&F1\r:\ X+ :init_string=AT&B1&H1&R2&C1&D2\r:\ X+ :escape_sequence=+++:hw_flow_control:lock_baud:intercharacter_delay#50:\ X+ :intercommand_delay#250:escape_guard_time#500:reset_delay#2000: X+ X+ mt932|multitech|mt|Multitech 932:dial_command=ATDT%s\r:hangup_command=ATH\r:\ X+ :echo_off_command=ATE0\r:reset_command=ATZ\r:\ X+ :init_string=AT$BA0$SB38400&E1&E4&E13&E15Q0V1X4E0S0=0\r:\ X+ :escape_sequence=+++:hw_flow_control:lock_baud:intercharacter_delay#50:\ X+ :intercommand_delay#250:escape_guard_time#500:reset_delay#2000: X+ X+ generic|Generic AT command modem (use defaults): END_OF_FILE if test 2557 -ne `wc -c <'patches.etc'`; then echo shar: \"'patches.etc'\" unpacked with wrong size! fi # end of 'patches.etc' fi if test -f 'patches.tip.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patches.tip.3'\" else echo shar: Extracting \"'patches.tip.3'\" \(46448 characters\) sed "s/^X//" >'patches.tip.3' <<'END_OF_FILE' Xdiff -r -c ./tip/cmds.c tip/cmds.c X*** ./tip/cmds.c Sun Mar 26 18:47:02 1995 X--- tip/cmds.c Sat Mar 25 00:34:19 1995 X*************** X*** 35,43 **** X--- 35,46 ---- X static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include "tipconf.h" X #include "tip.h" X #include "pathnames.h" X X+ #include <stdio.h> X+ X /* X * tip X * X*************** X*** 54,59 **** X--- 57,100 ---- X void stopsnd(); /* SIGINT handler during file transfers */ X void intcopy(); /* interrupt routine for file transfers */ X X+ void X+ usedefchars () X+ { X+ #if HAVE_TERMIOS X+ int cnt; X+ struct termios ttermios; X+ ttermios = ctermios; X+ for (cnt = 0; cnt < NCCS; cnt++) X+ ttermios.c_cc [cnt] = otermios.c_cc [cnt]; X+ tcsetattr (0, TCSANOW, &ttermios); X+ #else X+ ioctl(0, TIOCSETC, &defchars); X+ #endif X+ } X+ X+ void X+ usetchars () X+ { X+ #if HAVE_TERMIOS X+ tcsetattr (0, TCSANOW, &ctermios); X+ #else X+ ioctl(0, TIOCSETC, &tchars); X+ #endif X+ } X+ X+ void X+ flush_remote () X+ { X+ #ifdef TIOCFLUSH X+ int cmd = 0; X+ ioctl (FD, TIOCFLUSH, &cmd); X+ #else X+ struct sgttyb buf; X+ ioctl (FD, TIOCGETP, &buf); /* this does a */ X+ ioctl (FD, TIOCSETP, &buf); /* wflushtty */ X+ #endif X+ } X+ X /* X * FTP - remote ==> local X * get a file from the remote host X*************** X*** 107,114 **** X printf("\r\n%s: cannot create\r\n", argv[1]); X return; X } X! sprintf(line, "cat %s;echo \01", argv[0]); X! transfer(line, fd, "\01"); X } X X static jmp_buf intbuf; X--- 148,238 ---- X printf("\r\n%s: cannot create\r\n", argv[1]); X return; X } X! (void)sprintf(line, "cat %s ; echo \"\" ; echo ___tip_end_of_file_marker___", argv[0]); X! xfer(line, fd, "\n___tip_end_of_file_marker___\n"); X! } X! X! extern jmp_buf intbuf; X! X! xfer(buf, fd, eofchars) X! char *buf, *eofchars; X! { X! register int ct; X! char c, *match; X! register int cnt, eof, v; X! time_t start; X! sig_t f; X! char r; X! FILE *ff; X! X! v = boolean(value(VERBOSE)); X! X! if ((ff = fdopen (fd, "w")) == NULL) { X! perror("file open"); X! return; X! } X! if ((cnt = number(value(FRAMESIZE))) != BUFSIZ) X! if (setvbuf(ff, NULL, _IOFBF, cnt) != 0) { X! perror("file allocation"); X! (void)fclose(ff); X! return; X! } X! X! pwrite(FD, buf, size(buf)); X! quit = 0; X! kill(pid, SIGIOT); X! read(repdes[0], (char *)&ccc, 1); /* Wait until read process stops */ X! X! /* X! * finish command X! */ X! r = '\r'; X! pwrite(FD, &r, 1); X! do X! read(FD, &c, 1); X! while ((c&0177) != '\n'); X! X! usedefchars (); X! X! (void) setjmp(intbuf); X! f = signal(SIGINT, intcopy); X! start = time(0); X! match = eofchars; X! for (ct = 0; !quit;) { X! eof = read(FD, &c, 1) <= 0; X! c &= 0177; X! if (quit) X! continue; X! if (eof) X! break; X! if (c == 0) X! continue; /* ignore nulls */ X! if (c == '\r') X! continue; X! if (c != *match && match > eofchars) { X! register char *p = eofchars; X! while (p < match) { X! if (*p == '\n'&& v) X! (void)printf("\r%d", ++ct); X! fputc(*p++, ff); X! } X! match = eofchars; X! } X! if (c == *match) { X! if (*++match == '\0') X! break; X! } else { X! if (c == '\n' && v) X! (void)printf("\r%d", ++ct); X! fputc(c, ff); X! } X! } X! if (v) X! prtime(" lines transferred in ", time(0)-start); X! usetchars (); X! write(fildes[1], (char *)&ccc, 1); X! signal(SIGINT, f); X! (void)fclose(ff); X } X X static jmp_buf intbuf; X*************** X*** 122,131 **** X register int ct; X char c, buffer[BUFSIZ]; X register char *p = buffer; X! register int cnt, eof; X time_t start; X sig_t f; X char r; X X pwrite(FD, buf, size(buf)); X quit = 0; X--- 246,269 ---- X register int ct; X char c, buffer[BUFSIZ]; X register char *p = buffer; X! register int cnt, eof, v; X time_t start; X sig_t f; X char r; X+ FILE *ff; X+ X+ v = boolean(value(VERBOSE)); X+ X+ if ((ff = fdopen (fd, "w")) == NULL) { X+ perror("file open"); X+ return; X+ } X+ if ((cnt = number(value(FRAMESIZE))) != BUFSIZ) X+ if (setvbuf(ff, NULL, _IOFBF, cnt) != 0) { X+ perror("file allocation"); X+ (void)fclose(ff); X+ return; X+ } X X pwrite(FD, buf, size(buf)); X quit = 0; X*************** X*** 140,147 **** X do X read(FD, &c, 1); X while ((c&0177) != '\n'); X! ioctl(0, TIOCSETC, &defchars); X! X (void) setjmp(intbuf); X f = signal(SIGINT, intcopy); X start = time(0); X--- 278,284 ---- X do X read(FD, &c, 1); X while ((c&0177) != '\n'); X! usedefchars (); X (void) setjmp(intbuf); X f = signal(SIGINT, intcopy); X start = time(0); X*************** X*** 156,183 **** X continue; /* ignore nulls */ X if (c == '\r') X continue; X! *p++ = c; X! X! if (c == '\n' && boolean(value(VERBOSE))) X printf("\r%d", ++ct); X! if ((cnt = (p-buffer)) == number(value(FRAMESIZE))) { X! if (write(fd, buffer, cnt) != cnt) { X! printf("\r\nwrite error\r\n"); X! quit = 1; X! } X! p = buffer; X! } X } X! if (cnt = (p-buffer)) X! if (write(fd, buffer, cnt) != cnt) X! printf("\r\nwrite error\r\n"); X! X! if (boolean(value(VERBOSE))) X prtime(" lines transferred in ", time(0)-start); X! ioctl(0, TIOCSETC, &tchars); X write(fildes[1], (char *)&ccc, 1); X signal(SIGINT, f); X! close(fd); X } X X /* X--- 293,308 ---- X continue; /* ignore nulls */ X if (c == '\r') X continue; X! if (c == '\n' && v) X printf("\r%d", ++ct); X! fputc(c, ff); X } X! if (v) X prtime(" lines transferred in ", time(0)-start); X! usetchars (); X write(fildes[1], (char *)&ccc, 1); X signal(SIGINT, f); X! (void)fclose(ff); X } X X /* X*************** X*** 267,276 **** X } X transmit(fd, value(EOFWRITE), NULL); X if (!boolean(value(ECHOCHECK))) { X! struct sgttyb buf; X! X! ioctl(FD, TIOCGETP, &buf); /* this does a */ X! ioctl(FD, TIOCSETP, &buf); /* wflushtty */ X } X } X X--- 392,398 ---- X } X transmit(fd, value(EOFWRITE), NULL); X if (!boolean(value(ECHOCHECK))) { X! flush_remote (); X } X } X X*************** X*** 290,296 **** X kill(pid, SIGIOT); /* put TIPOUT into a wait state */ X stop = 0; X f = signal(SIGINT, stopsnd); X! ioctl(0, TIOCSETC, &defchars); X read(repdes[0], (char *)&ccc, 1); X if (command != NULL) { X for (pc = command; *pc; pc++) X--- 412,418 ---- X kill(pid, SIGIOT); /* put TIPOUT into a wait state */ X stop = 0; X f = signal(SIGINT, stopsnd); X! usedefchars (); X read(repdes[0], (char *)&ccc, 1); X if (command != NULL) { X for (pc = command; *pc; pc++) X*************** X*** 298,307 **** X if (boolean(value(ECHOCHECK))) X read(FD, (char *)&c, 1); /* trailing \n */ X else { X! struct sgttyb buf; X! X! ioctl(FD, TIOCGETP, &buf); /* this does a */ X! ioctl(FD, TIOCSETP, &buf); /* wflushtty */ X sleep(5); /* wait for remote stty to take effect */ X } X } X--- 420,426 ---- X if (boolean(value(ECHOCHECK))) X read(FD, (char *)&c, 1); /* trailing \n */ X else { X! flush_remote (); X sleep(5); /* wait for remote stty to take effect */ X } X } X*************** X*** 370,376 **** X else X prtime(" lines transferred in ", stop_t-start_t); X write(fildes[1], (char *)&ccc, 1); X! ioctl(0, TIOCSETC, &tchars); X } X X /* X--- 489,495 ---- X else X prtime(" lines transferred in ", stop_t-start_t); X write(fildes[1], (char *)&ccc, 1); X! usetchars (); X } X X /* X*************** X*** 465,471 **** X kill(pid, SIGIOT); /* put TIPOUT into a wait state */ X signal(SIGINT, SIG_IGN); X signal(SIGQUIT, SIG_IGN); X! ioctl(0, TIOCSETC, &defchars); X read(repdes[0], (char *)&ccc, 1); X /* X * Set up file descriptors in the child and X--- 584,590 ---- X kill(pid, SIGIOT); /* put TIPOUT into a wait state */ X signal(SIGINT, SIG_IGN); X signal(SIGQUIT, SIG_IGN); X! usedefchars (); X read(repdes[0], (char *)&ccc, 1); X /* X * Set up file descriptors in the child and X*************** X*** 492,523 **** X if (boolean(value(VERBOSE))) X prtime("away for ", time(0)-start); X write(fildes[1], (char *)&ccc, 1); X! ioctl(0, TIOCSETC, &tchars); X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X } X X! #ifdef CONNECT X! /* X! * Fork a program with: X! * 0 <-> remote tty in X! * 1 <-> remote tty out X! * 2 <-> local tty out X! */ X! consh(c) X { X- char buf[256]; X int cpid, status, p; X time_t start; X X! putchar(c); X! if (prompt("Local command? ", buf)) X! return; X! kill(pid, SIGIOT); /* put TIPOUT into a wait state */ X! signal(SIGINT, SIG_IGN); X! signal(SIGQUIT, SIG_IGN); X! ioctl(0, TIOCSETC, &defchars); X! read(repdes[0], (char *)&ccc, 1); X /* X * Set up file descriptors in the child and X * let it go... X--- 611,637 ---- X if (boolean(value(VERBOSE))) X prtime("away for ", time(0)-start); X write(fildes[1], (char *)&ccc, 1); X! usetchars (); X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X } X X! #if CONNECT X! X! int X! tiplink (char *cmd, unsigned int flags) X { X int cpid, status, p; X time_t start; X X! if (flags & TL_SIGNAL_TIPOUT) { X! kill(pid, SIGIOT); /* put TIPOUT into a wait state */ X! signal(SIGINT, SIG_IGN); X! signal(SIGQUIT, SIG_IGN); X! usedefchars (); X! read(repdes[0], (char *)&ccc, 1); X! } X! X /* X * Set up file descriptors in the child and X * let it go... X*************** X*** 529,552 **** X while ((p = wait(&status)) > 0 && p != cpid) X ; X } else { X! register int i; X X dup2(FD, 0); X dup2(3, 1); X! for (i = 3; i < 20; i++) X! close(i); X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X! execute(buf); X! printf("can't find `%s'\r\n", buf); X exit(0); X } X! if (boolean(value(VERBOSE))) X prtime("away for ", time(0)-start); X! write(fildes[1], (char *)&ccc, 1); X! ioctl(0, TIOCSETC, &tchars); X! signal(SIGINT, SIG_DFL); X! signal(SIGQUIT, SIG_DFL); X } X #endif X X--- 643,687 ---- X while ((p = wait(&status)) > 0 && p != cpid) X ; X } else { X! register int fd; X X dup2(FD, 0); X dup2(3, 1); X! for (fd = 3; fd < 20; fd++) X! close (fd); X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X! execute (cmd); X! printf("can't find `%s'\r\n", cmd); X exit(0); X } X! X! if (flags & TL_VERBOSE && boolean(value(VERBOSE))) X prtime("away for ", time(0)-start); X! X! if (flags & TL_SIGNAL_TIPOUT) { X! write(fildes[1], (char *)&ccc, 1); X! usetchars (); X! signal(SIGINT, SIG_DFL); X! signal(SIGQUIT, SIG_DFL); X! } X! X! return 0; X! } X! X! /* X! * Fork a program with: X! * 0 <-> remote tty in X! * 1 <-> remote tty out X! * 2 <-> local tty out X! */ X! consh(c) X! { X! char buf[256]; X! putchar(c); X! if (prompt("Local command? ", buf)) X! return; X! tiplink (buf, TL_SIGNAL_TIPOUT | TL_VERBOSE); X } X #endif X X*************** X*** 642,654 **** X X finish() X { X! char *dismsg; X X if ((dismsg = value(DISCONNECT)) != NOSTR) { X write(FD, dismsg, strlen(dismsg)); X! sleep(5); X } X! tipabort(NOSTR); X } X X void X--- 777,793 ---- X X finish() X { X! char *abortmsg = NOSTR, *dismsg; X! X! if (LO != NOSTR && tiplink (LO, TL_SIGNAL_TIPOUT) != 0) { X! abortmsg = "logout failed"; X! } X X if ((dismsg = value(DISCONNECT)) != NOSTR) { X write(FD, dismsg, strlen(dismsg)); X! sleep (2); X } X! tipabort(abortmsg); X } X X void X*************** X*** 764,769 **** X--- 903,922 ---- X tandem(option) X char *option; X { X+ #if HAVE_TERMIOS X+ struct termios ttermios; X+ tcgetattr (FD, &ttermios); X+ if (strcmp(option,"on") == 0) { X+ ttermios.c_iflag |= IXOFF; X+ ctermios.c_iflag |= IXOFF; X+ } X+ else { X+ ttermios.c_iflag &= ~IXOFF; X+ ctermios.c_iflag &= ~IXOFF; X+ } X+ tcsetattr (FD, TCSANOW, &ttermios); X+ tcsetattr (0, TCSANOW, &ctermios); X+ #else /* HAVE_TERMIOS */ X struct sgttyb rmtty; X X ioctl(FD, TIOCGETP, &rmtty); X*************** X*** 776,781 **** X--- 929,935 ---- X } X ioctl(FD, TIOCSETP, &rmtty); X ioctl(0, TIOCSETP, &arg); X+ #endif /* HAVE_TERMIOS */ X } X X /* Xdiff -r -c ./tip/cmdtab.c tip/cmdtab.c X*** ./tip/cmdtab.c Sun Mar 26 18:47:02 1995 X--- tip/cmdtab.c Thu Mar 23 18:46:39 1995 X*************** X*** 35,40 **** X--- 35,41 ---- X static char sccsid[] = "@(#)cmdtab.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include "tipconf.h" X #include "tip.h" X X extern int shell(), getfl(), sendfile(), chdirectory(); X*************** X*** 49,55 **** X { 'p', NORM, "put file to remote UNIX", cu_put }, X { '|', NORM, "pipe remote file", pipefile }, X { '$', NORM, "pipe local command to remote host", pipeout }, X! #ifdef CONNECT X { 'C', NORM, "connect program to remote host",consh }, X #endif X { 'c', NORM, "change directory", chdirectory }, X--- 50,56 ---- X { 'p', NORM, "put file to remote UNIX", cu_put }, X { '|', NORM, "pipe remote file", pipefile }, X { '$', NORM, "pipe local command to remote host", pipeout }, X! #if CONNECT X { 'C', NORM, "connect program to remote host",consh }, X #endif X { 'c', NORM, "change directory", chdirectory }, Xdiff -r -c ./tip/cu.c tip/cu.c X*** ./tip/cu.c Sun Mar 26 18:47:02 1995 X--- tip/cu.c Sat Mar 25 16:03:32 1995 X*************** X*** 35,44 **** X--- 35,47 ---- X static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include "tipconf.h" X #include "tip.h" X X void cleanup(); X X+ #if INCLUDE_CU_INTERFACE X+ X /* X * Botch the interface to look like cu's X */ X*************** X*** 130,132 **** X--- 133,136 ---- X if (!HW) X ttysetup(speed(BR)); X } X+ #endif /* INCLUDE_CU_INTERFACE */ Xdiff -r -c ./tip/dial.sh tip/dial.sh X*** ./tip/dial.sh Sun Mar 26 18:47:10 1995 X--- tip/dial.sh Sun Mar 5 09:37:50 1995 X*************** X*** 0 **** X--- 1,21 ---- X+ #!/bin/sh X+ # X+ # @(#)dial.sh -- dialup remote using tip X+ # X+ X+ #set -x X+ X+ if [ $# -lt 1 ] ; then X+ echo "$0: not enough arguments" 1>&2 X+ exit 1 X+ fi X+ X+ x=0 X+ X+ while ! tip $* && test $x -lt 3 X+ do X+ sleep 5 X+ x=$(($x+1)) X+ done X+ X+ exit 0 Xdiff -r -c ./tip/hunt.c tip/hunt.c X*** ./tip/hunt.c Sun Mar 26 18:47:02 1995 X--- tip/hunt.c Fri Mar 24 00:19:40 1995 X*************** X*** 35,40 **** X--- 35,41 ---- X static char sccsid[] = "@(#)hunt.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include "tipconf.h" X #include "tip.h" X X extern char *getremote(); X*************** X*** 82,88 **** X--- 83,101 ---- X } X if (!deadfl) { X ioctl(FD, TIOCEXCL, 0); X+ #if HAVE_TERMIOS X+ { X+ struct termios t; X+ if (tcgetattr(FD, &t) == 0) { X+ t.c_cflag |= HUPCL; X+ (void)tcsetattr(FD, TCSANOW, &t); X+ } X+ } X+ #else /* HAVE_TERMIOS */ X+ #ifdef TIOCHPCL X ioctl(FD, TIOCHPCL, 0); X+ #endif X+ #endif /* HAVE_TERMIOS */ X signal(SIGALRM, SIG_DFL); X return ((int)cp); X } Xdiff -r -c ./tip/log.c tip/log.c X*** ./tip/log.c Sun Mar 26 18:47:02 1995 X--- tip/log.c Thu Mar 23 18:46:56 1995 X*************** X*** 35,43 **** X static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X #include "tip.h" X X! #ifdef ACULOG X static FILE *flog = NULL; X X /* X--- 35,44 ---- X static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include "tipconf.h" X #include "tip.h" X X! #if ACULOG X static FILE *flog = NULL; X X /* X*************** X*** 67,73 **** X timestamp[24] = '\0'; X fprintf(flog, "%s (%s) <%s, %s, %s> %s\n", X user, timestamp, group, X! #ifdef PRISTINE X "", X #else X num, X--- 68,74 ---- X timestamp[24] = '\0'; X fprintf(flog, "%s (%s) <%s, %s, %s> %s\n", X user, timestamp, group, X! #if PRISTINE X "", X #else X num, Xdiff -r -c ./tip/modems.5 tip/modems.5 X*** ./tip/modems.5 Sun Mar 26 18:47:11 1995 X--- tip/modems.5 Sun Mar 26 18:03:29 1995 X*************** X*** 0 **** X--- 1,140 ---- X+ .\" Copyright (c) 1983, 1991, 1993 X+ .\" The Regents of the University of California. All rights reserved. X+ .\" X+ .\" Redistribution and use in source and binary forms, with or without X+ .\" modification, are permitted provided that the following conditions X+ .\" are met: X+ .\" 1. Redistributions of source code must retain the above copyright X+ .\" notice, this list of conditions and the following disclaimer. X+ .\" 2. Redistributions in binary form must reproduce the above copyright X+ .\" notice, this list of conditions and the following disclaimer in the X+ .\" documentation and/or other materials provided with the distribution. X+ .\" 3. All advertising materials mentioning features or use of this software X+ .\" must display the following acknowledgement: X+ .\" This product includes software developed by the University of X+ .\" California, Berkeley and its contributors. X+ .\" 4. Neither the name of the University nor the names of its contributors X+ .\" may be used to endorse or promote products derived from this software X+ .\" without specific prior written permission. X+ .\" X+ .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND X+ .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE X+ .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ .\" SUCH DAMAGE. X+ .\" X+ .\" @(#)modems.5 3/24/95 X+ .\" X+ .Dd March 24, 1995 X+ .Dt MODEMS 5 X+ .Os BSD 4.4 X+ .Sh NAME X+ .Nm modems X+ .Nd modem configuration data base X+ .Sh DESCRIPTION X+ The modems known by X+ .Xr tip 1 X+ and their attributes are stored in an X+ .Tn ASCII X+ file which X+ is structured somewhat like the X+ .Xr termcap 5 X+ file. Each line in the file provides a description for a single X+ .Xr modem . X+ Fields are separated by a colon (``:''). X+ Lines ending in a \e character with an immediately following newline are X+ continued on the next line. X+ .Pp X+ The first entry is the name(s) of the modem. If there is more X+ than one name for a system, the names are separated by vertical bars. X+ After the name of the system comes the fields of the description. A X+ field name followed by an `=' sign indicates a string value follows. A field X+ name followed by a `#' sign indicates a following numeric value. X+ .Pp X+ When X+ .Xr tip X+ is invoked, an entry for a remote system is looked up in the X+ .Pa /etc/remote database. X+ If the entry includes an "ACU" type capability (abbreviated at), X+ .Xr tip X+ looks up the specified modem in X+ .Pa /etc/modems. X+ If a modem entry is found, X+ the corresponding capabilities determine how X+ .Xr tip X+ programs the modem when connecting to and disconnecting from the X+ remote system. X+ .Sh CAPABILITIES X+ Capabilities are either strings (str), numbers (num), or boolean X+ flags (bool). A string capability is specified by X+ .Em capability Ns Ar = Ns Em value ; X+ for example, ``reset_command=ATZ\\r''. A numeric capability is specified by X+ .Em capability Ns Ar # Ns Em value ; X+ for example, ``intercharacter_delay#50''. A boolean capability is specified X+ by simply listing the capability. X+ .Bl -tag -width intercharacter_delay indent X+ .It Cm \&dial_command X+ (str) X+ AT command used to dial remote system (typically, "ATDT") X+ .It Cm \&echo_off_command X+ (str) X+ AT command to turn off command echo. X+ .It Cm \&escape_guard_time X+ (num) X+ The delay, expressed in milliseconds, used to frame return-to-command X+ escape sequences. X+ .It Cm \&escape_sequence X+ (str) X+ The return-to-command escape sequence. X+ .It Cm \&hangup_command X+ (str) X+ AT command used to hangup modem. X+ .It Cm \&hw_flow_control X+ (bool) X+ Enable hardware (RTS/CTS) flow control between computer and modem (DTE/DCE). X+ .It Cm \&init_string X+ (str) X+ AT command used to initialize modem before dialing. X+ .It Cm \&intercharacter_delay X+ (num) X+ Delay value, expressed in milliseconds, between characters when sending commands X+ to the modem. X+ .It Cm \&intercommand_delay X+ (num) X+ Minimum delay value, expressed in milliseconds, to impose between commands X+ issued to the modem. X+ .It Cm \&lock_baud X+ (bool) X+ Use a fixed bit rate between the computer and the modem (DTE / DCE). The X+ bit rate is specified in X+ .Pa /etc/remote. X+ .It Cm \&reset_command X+ (str) X+ AT command to reset the modem. X+ .It Cm \&reset_delay X+ (num) X+ The time, expressed in milliseconds, required by the modem to complete X+ a reset and return to a ready condition. X+ .Sh FILES X+ .Bl -tag -width /etc/modems -compact X+ .It Pa /etc/modems X+ The X+ .Nm modems X+ configuration database file X+ resides in X+ .Pa /etc . X+ .El X+ .Sh SEE ALSO X+ .Xr tip 1 , X+ .Xr remote 5 X+ .Sh HISTORY X+ The X+ .Nm X+ file format appeared in X+ .Bx 4.4 . Xdiff -r -c ./tip/pathnames.h tip/pathnames.h X*** ./tip/pathnames.h Sun Mar 26 18:47:01 1995 X--- tip/pathnames.h Thu Mar 23 08:04:24 1995 X*************** X*** 35,44 **** X X #include <paths.h> X X #define _PATH_ACULOG "/var/log/aculog" X! #define _PATH_LOCKDIRNAME "/var/spool/lock/LCK..%s" X! #ifdef notdef X! #define _PATH_LOCKDIRNAME "/var/spool/uucp/LCK/LCK..%s" X! #endif X #define _PATH_PHONES "/etc/phones" X #define _PATH_REMOTE "/etc/remote" X--- 35,58 ---- X X #include <paths.h> X X+ /* X+ Specify path to ACU (modem) log X+ */ X #define _PATH_ACULOG "/var/log/aculog" X! X! /* X! Specify path and format of lock files X! */ X! /* #define _PATH_LOCKDIRNAME "/usr/spool/uucp/LCK..%s" */ X! /* #define _PATH_LOCKDIRNAME "/etc/locks/LCK..%s" */ X! /* #define _PATH_LOCKDIRNAME "/usr/spool/locks/LCK..%s" */ X! /* #define _PATH_LOCKDIRNAME "/usr/spool/uucp/LCK/LCK..%s" */ X! #define _PATH_LOCKDIRNAME "/var/spool/lock/LCK..%s" X! X! /* X! Specify location for system wide databases X! */ X! #define _PATH_MODEMS "/etc/modems" X #define _PATH_PHONES "/etc/phones" X #define _PATH_REMOTE "/etc/remote" X+ Xdiff -r -c ./tip/remote.c tip/remote.c X*** ./tip/remote.c Sun Mar 26 18:47:01 1995 X--- tip/remote.c Thu Mar 23 18:47:08 1995 X*************** X*** 42,52 **** X static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X #include <stdio.h> X #include <stdlib.h> X X! #include "pathnames.h" X #include "tip.h" X X /* X * Attributes to be gleened from remote host description X--- 42,54 ---- X static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include <sys/syslimits.h> X #include <stdio.h> X #include <stdlib.h> X X! #include "tipconf.h" X #include "tip.h" X+ #include "pathnames.h" X X /* X * Attributes to be gleened from remote host description X*************** X*** 54,71 **** X */ X static char **caps[] = { X &AT, &DV, &CM, &CU, &EL, &IE, &OE, &PN, &PR, &DI, X! &ES, &EX, &FO, &RC, &RE, &PA X }; X X static char *capstrings[] = { X "at", "dv", "cm", "cu", "el", "ie", "oe", "pn", "pr", X! "di", "es", "ex", "fo", "rc", "re", "pa", 0 X }; X X static char *db_array[3] = { _PATH_REMOTE, 0, 0 }; X X #define cgetflag(f) (cgetcap(bp, f, ':') != NULL) X X static X getremcap(host) X register char *host; X--- 56,106 ---- X */ X static char **caps[] = { X &AT, &DV, &CM, &CU, &EL, &IE, &OE, &PN, &PR, &DI, X! &ES, &EX, &FO, &RC, &RE, &PA, &LI, &LO X }; X X static char *capstrings[] = { X "at", "dv", "cm", "cu", "el", "ie", "oe", "pn", "pr", X! "di", "es", "ex", "fo", "rc", "re", "pa", "li", "lo", 0 X }; X X static char *db_array[3] = { _PATH_REMOTE, 0, 0 }; X X #define cgetflag(f) (cgetcap(bp, f, ':') != NULL) X X+ /* X+ Expand the start tilde sequence at the start of the X+ specified path. Optionally, free space allocated to X+ path before reinitializing it. X+ */ X+ static int X+ expand_tilde (char **path, void (*free) (char *p)) X+ { X+ int rc = 0; X+ char buffer [PATH_MAX]; X+ char *tailp; X+ if ((tailp = strchr (*path + 1, '/')) != NULL) X+ { X+ struct passwd *pwd; X+ *tailp++ = '\0'; X+ if (*(*path + 1) == '\0') X+ strcpy (buffer, getlogin ()); X+ else X+ strcpy (buffer, *path + 1); X+ if ((pwd = getpwnam (buffer)) != NULL) X+ { X+ strcpy (buffer, pwd->pw_dir); X+ strcat (buffer, "/"); X+ strcat (buffer, tailp); X+ if (free) X+ free (*path); X+ *path = strdup (buffer); X+ rc++; X+ } X+ return rc; X+ } X+ } X+ X static X getremcap(host) X register char *host; X*************** X*** 144,149 **** X--- 179,209 ---- X if (!HW) X HW = (CU == NOSTR) || (DU && equal(DV, CU)); X HO = host; X+ X+ /* X+ If login script, verify access X+ */ X+ if (LI != NOSTR) { X+ if (*LI == '~') X+ (void) expand_tilde (&LI, NULL); X+ if (access (LI, F_OK | X_OK) != 0) { X+ printf("tip (warning): can't open login script \"%s\"\n", LI); X+ LI = NOSTR; X+ } X+ } X+ X+ /* X+ If logout script, verify access X+ */ X+ if (LO != NOSTR) { X+ if (*LO == '~') X+ (void) expand_tilde (&LO, NULL); X+ if (access (LO, F_OK | X_OK) != 0) { X+ printf("tip (warning): can't open logout script \"%s\"\n", LO); X+ LO = NOSTR; X+ } X+ } X+ X /* X * see if uppercase mode should be turned on initially X */ Xdiff -r -c ./tip/tip.1 tip/tip.1 X*** ./tip/tip.1 Sun Mar 26 18:47:01 1995 X--- tip/tip.1 Sat Mar 25 15:53:18 1995 X*************** X*** 236,251 **** X must dial a phone number to connect to a system it will print X various messages indicating its actions. X .Nm Tip X! supports the X! .Tn DEC DN Ns-11 X! and X! Racal-Vadic 831 auto-call-units; X! the X! .Tn DEC DF Ns \&02 X! and X! .Tn DF Ns \&03 , X! Ventel 212+, Racal-Vadic 3451, and X! Bizcomp 1031 and 1032 integral call unit/modems. X .Ss VARIABLES X .Nm Tip X maintains a set of X--- 236,249 ---- X must dial a phone number to connect to a system it will print X various messages indicating its actions. X .Nm Tip X! supports modems that use the AT command set. X! .Nm Tip X! uses the file X! .Pa /etc/modems X! to find out how to operate with a particular X! modem; refer to X! .Xr modems 5 X! for a full description. X .Ss VARIABLES X .Nm Tip X maintains a set of X*************** X*** 331,336 **** X--- 329,344 ---- X .It Ar host X (str) The name of the host to which you are connected; abbreviated X .Ar ho . X+ .It Ar login X+ (str) Pathname of a login shell script to run once connected; standard input X+ and output are redirected to the remote host. Leading tildes in the pathname X+ are expanded expansion; abbreviated X+ .Ar li . X+ .It Ar logout X+ (str) Pathname of a shell script to run before disconnecting; standard input X+ and output are redirected to the remote host. Leading tildes in the pathname X+ are expanded expansion; abbreviated X+ .Ar lo . X .It Ar prompt X (char) The character which indicates an end-of-line on the remote X host; abbreviated X*************** X*** 417,423 **** X .Ev ${PHONES} X are also exported. X .Sh FILES X! .Bl -tag -width /var/spool/uucp/LCK..* -compact X .It Pa /etc/remote X Global system descriptions. X .It Pa /etc/phones X--- 425,433 ---- X .Ev ${PHONES} X are also exported. X .Sh FILES X! .Bl -tag -width /var/spool/lock/LCK..* -compact X! .It Pa /etc/modems X! Global modem configuration data base. X .It Pa /etc/remote X Global system descriptions. X .It Pa /etc/phones X*************** X*** 432,438 **** X Record file. X .It /var/log/aculog X Line access log. X! .It Pa /var/spool/uucp/LCK..* X Lock file to avoid conflicts with X .Xr uucp . X .El X--- 442,448 ---- X Record file. X .It /var/log/aculog X Line access log. X! .It Pa /var/spool/lock/LCK..* X Lock file to avoid conflicts with X .Xr uucp . X .El Xdiff -r -c ./tip/tip.c tip/tip.c X*** ./tip/tip.c Sun Mar 26 18:47:01 1995 X--- tip/tip.c Sat Mar 25 16:06:22 1995 X*************** X*** 42,64 **** X #endif /* not lint */ X X /* X * tip - UNIX link to other systems X * tip [-v] [-speed] system-name X * or X * cu phone-number [-s speed] [-l line] [-a acu] X */ X #include "tip.h" X #include "pathnames.h" X X /* X * Baud rate mapping table X */ X! int bauds[] = { X 0, 50, 75, 110, 134, 150, 200, 300, 600, X 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, -1 X }; X X int disc = OTTYDISC; /* tip normally runs this way */ X void intprompt(); X void timeout(); X void cleanup(); X--- 42,76 ---- X #endif /* not lint */ X X /* X+ Forward declarations X+ */ X+ void ttysetup (int speed); X+ X+ /* X * tip - UNIX link to other systems X * tip [-v] [-speed] system-name X * or X * cu phone-number [-s speed] [-l line] [-a acu] X */ X+ X+ #include "tipconf.h" X #include "tip.h" X #include "pathnames.h" X X /* X * Baud rate mapping table X */ X! #if !HAVE_TERMIOS X! CONST int bauds[] = { X 0, 50, 75, 110, 134, 150, 200, 300, 600, X 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, -1 X }; X+ #endif X X+ #if !HAVE_TERMIOS X int disc = OTTYDISC; /* tip normally runs this way */ X+ #endif X+ X void intprompt(); X void timeout(); X void cleanup(); X*************** X*** 66,71 **** X--- 78,84 ---- X char *sname(); X char PNbuf[256]; /* This limits the size of a number */ X X+ void X main(argc, argv) X char *argv[]; X { X*************** X*** 78,88 **** X--- 91,104 ---- X egid = getegid(); X uid = getuid(); X euid = geteuid(); X+ X+ #if INCLUDE_CU_INTERFACE X if (equal(sname(argv[0]), "cu")) { X cumode = 1; X cumain(argc, argv); X goto cucommon; X } X+ #endif /* INCLUDE_CU_INTERFACE */ X X if (argc > 4) { X fprintf(stderr, "usage: tip [-v] [-speed] [system-name]\n"); X*************** X*** 197,202 **** X--- 213,233 ---- X * the "cu" version of tip. X */ X X+ #if HAVE_TERMIOS X+ tcgetattr (0, &otermios); X+ ctermios = otermios; X+ #ifndef _POSIX_SOURCE X+ ctermios.c_iflag = (IMAXBEL|IXANY|ISTRIP|IXON|BRKINT); X+ ctermios.c_lflag = (PENDIN|IEXTEN|ISIG|ECHOCTL|ECHOE|ECHOKE); X+ #else X+ ctermios.c_iflag = (ISTRIP|IXON|BRKINT); X+ ctermios.c_lflag = (PENDIN|IEXTEN|ISIG|ECHOE); X+ #endif X+ ctermios.c_cflag = (CLOCAL|HUPCL|CREAD|CS8); X+ ctermios.c_cc[VINTR] = ctermios.c_cc[VQUIT] = -1; X+ ctermios.c_cc[VSUSP] = ctermios.c_cc[VDSUSP] = ctermios.c_cc[VDISCARD] = X+ ctermios.c_cc[VLNEXT] = -1; X+ #else /* HAVE_TERMIOS */ X ioctl(0, TIOCGETP, (char *)&defarg); X ioctl(0, TIOCGETC, (char *)&defchars); X ioctl(0, TIOCGLTC, (char *)&deflchars); X*************** X*** 208,213 **** X--- 239,245 ---- X ltchars = deflchars; X ltchars.t_suspc = ltchars.t_dsuspc = ltchars.t_flushc X = ltchars.t_lnextc = -1; X+ #endif /* HAVE_TERMIOS */ X raw(); X X pipe(fildes); pipe(repdes); X*************** X*** 221,226 **** X--- 253,263 ---- X * so, fork one process for local side and one for remote. X */ X printf(cumode ? "Connected\r\n" : "\07connected\r\n"); X+ X+ if (LI != NOSTR && tiplink (LI, 0) != 0) { X+ tipabort ("login failed"); X+ } X+ X if (pid = fork()) X tipin(); X else X*************** X*** 234,241 **** X--- 271,280 ---- X X daemon_uid(); X (void)uu_unlock(uucplock); X+ #if !HAVE_TERMIOS X if (odisc) X ioctl(0, TIOCSETD, (char *)&odisc); X+ #endif X exit(0); X } X X*************** X*** 280,292 **** X /* X * put the controlling keyboard into raw mode X */ X! raw() 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--- 319,336 ---- X /* X * put the controlling keyboard into raw mode X */ X! void X! raw () X { X+ #if HAVE_TERMIOS X+ tcsetattr (0, TCSANOW, &ctermios); X+ #else /* HAVE_TERMIOS */ X X ioctl(0, TIOCSETP, &arg); X ioctl(0, TIOCSETC, &tchars); X ioctl(0, TIOCSLTC, <chars); X ioctl(0, TIOCSETD, (char *)&disc); X+ #endif /* HAVE_TERMIOS */ X } X X X*************** X*** 295,305 **** X--- 339,353 ---- X */ X unraw() X { X+ #if HAVE_TERMIOS X+ tcsetattr (0, TCSANOW, &otermios); X+ #else /* HAVE_TERMIOS */ 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+ #endif /* HAVE_TERMIOS */ X } X X static jmp_buf promptbuf; X*************** X*** 419,430 **** X speed(n) X int 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 X any(c, p) X--- 467,482 ---- X speed(n) X int n; X { X! #if HAVE_TERMIOS X! return (n); X! #else X! register CONST int *p; X X for (p = bauds; *p != -1; p++) X if (*p == n) X return (p - bauds); X return (NULL); X+ #endif X } X X any(c, p) X*************** X*** 510,518 **** X /* X * Set up the "remote" tty's state X */ X! ttysetup(speed) X! int speed; X { X unsigned bits = LDECCTQ; X X arg.sg_ispeed = arg.sg_ospeed = speed; X--- 562,586 ---- X /* X * Set up the "remote" tty's state X */ X! void X! ttysetup (int speed) X { X+ #if HAVE_TERMIOS X+ struct termios termios; X+ tcgetattr (FD, &termios); X+ if (boolean(value(TAND))) X+ termios.c_iflag = IXOFF; X+ else X+ termios.c_iflag = 0; X+ #ifndef _POSIX_SOURCE X+ termios.c_lflag = (PENDIN|ECHOKE|ECHOE); X+ #else X+ termios.c_lflag = (PENDIN|ECHOE); X+ #endif X+ termios.c_cflag = (CLOCAL|HUPCL|CREAD|CS8); X+ termios.c_ispeed = termios.c_ospeed = speed; X+ tcsetattr (FD, TCSANOW, &termios); X+ #else /* HAVE_TERMIOS */ X unsigned bits = LDECCTQ; X X arg.sg_ispeed = arg.sg_ospeed = speed; X*************** X*** 521,526 **** X--- 589,595 ---- X arg.sg_flags |= TANDEM; X ioctl(FD, TIOCSETP, (char *)&arg); X ioctl(FD, TIOCLBIS, (char *)&bits); X+ #endif /* HAVE_TERMIOS */ X } X X /* Xdiff -r -c ./tip/tip.h tip/tip.h X*** ./tip/tip.h Sun Mar 26 18:47:01 1995 X--- tip/tip.h Sun Mar 26 12:01:49 1995 X*************** X*** 43,49 **** X--- 43,56 ---- X #include <sys/file.h> X #include <sys/time.h> X X+ #if HAVE_TERMIOS X+ #include <sys/ioctl.h> /* for TIOCHPCL */ X+ #include <sys/filio.h> /* for FIONREAD */ X+ #include <sys/termios.h> X+ #else X #include <sgtty.h> X+ #endif X+ X #include <signal.h> X #include <stdio.h> X #include <stdlib.h> X*************** X*** 72,77 **** X--- 79,87 ---- X char *RM; /* remote file name */ X char *HO; /* host name */ X X+ char *LI; /* login script */ X+ char *LO; /* logout script */ X+ X long BR; /* line speed for conversation */ X long FS; /* frame size for transfers */ X X*************** X*** 129,136 **** X struct { X char *acu_name; X int (*acu_dialer)(); X! int (*acu_disconnect)(); X! int (*acu_abort)(); X } X acu_t; X X--- 139,146 ---- X struct { X char *acu_name; X int (*acu_dialer)(); X! void (*acu_disconnect)(); X! void (*acu_abort)(); X } X acu_t; X X*************** X*** 189,195 **** X extern int vflag; /* verbose during reading of .tiprc file */ X extern value_t vtable[]; /* variable table */ X X! #ifndef ACULOG X #define logent(a, b, c, d) X #define loginit() X #endif X--- 199,205 ---- X extern int vflag; /* verbose during reading of .tiprc file */ X extern value_t vtable[]; /* variable table */ X X! #if !ACULOG X #define logent(a, b, c, d) X #define loginit() X #endif X*************** X*** 199,250 **** X * value(DEFINE) turns into a static address. X */ X X! #define BEAUTIFY 0 X! #define BAUDRATE 1 X! #define DIALTIMEOUT 2 X! #define EOFREAD 3 X! #define EOFWRITE 4 X! #define EOL 5 X! #define ESCAPE 6 X! #define EXCEPTIONS 7 X! #define FORCE 8 X! #define FRAMESIZE 9 X! #define HOST 10 X! #define LOG 11 X! #define PHONES 12 X! #define PROMPT 13 X! #define RAISE 14 X! #define RAISECHAR 15 X! #define RECORD 16 X! #define REMOTE 17 X! #define SCRIPT 18 X! #define TABEXPAND 19 X! #define VERBOSE 20 X! #define SHELL 21 X! #define HOME 22 X! #define ECHOCHECK 23 X! #define DISCONNECT 24 X! #define TAND 25 X! #define LDELAY 26 X! #define CDELAY 27 X! #define ETIMEOUT 28 X! #define RAWFTP 29 X! #define HALFDUPLEX 30 X! #define LECHO 31 X! #define PARITY 32 X X #define NOVAL ((value_t *)NULL) X #define NOACU ((acu_t *)NULL) X #define NOSTR ((char *)NULL) X #define NOFILE ((FILE *)NULL) X #define NOPWD ((struct passwd *)0) X X struct sgttyb arg; /* current mode of local terminal */ X struct sgttyb defarg; /* initial mode of local terminal */ X struct tchars tchars; /* current state of terminal */ X struct tchars defchars; /* initial state of terminal */ X struct ltchars ltchars; /* current local characters of terminal */ X struct ltchars deflchars; /* initial local characters of terminal */ X X FILE *fscript; /* FILE for scripting */ X X--- 209,270 ---- X * value(DEFINE) turns into a static address. X */ X X! /* X! 'a,.!awk '{ printf("\%s \%s \%d\n", $1, $2, NR - 1); }' X! */ X X+ #define BEAUTIFY 0 X+ #define BAUDRATE 1 X+ #define DIALTIMEOUT 2 X+ #define EOFREAD 3 X+ #define EOFWRITE 4 X+ #define EOL 5 X+ #define ESCAPE 6 X+ #define EXCEPTIONS 7 X+ #define FORCE 8 X+ #define FRAMESIZE 9 X+ #define HOST 10 X+ #define LOG 11 X+ #define LOGIN 12 X+ #define LOGOUT 13 X+ #define PHONES 14 X+ #define PROMPT 15 X+ #define RAISE 16 X+ #define RAISECHAR 17 X+ #define RECORD 18 X+ #define REMOTE 19 X+ #define SCRIPT 20 X+ #define TABEXPAND 21 X+ #define VERBOSE 22 X+ #define SHELL 23 X+ #define HOME 24 X+ #define ECHOCHECK 25 X+ #define DISCONNECT 26 X+ #define TAND 27 X+ #define LDELAY 28 X+ #define CDELAY 29 X+ #define ETIMEOUT 30 X+ #define RAWFTP 31 X+ #define HALFDUPLEX 32 X+ #define LECHO 33 X+ #define PARITY 34 X #define NOVAL ((value_t *)NULL) X #define NOACU ((acu_t *)NULL) X #define NOSTR ((char *)NULL) X #define NOFILE ((FILE *)NULL) X #define NOPWD ((struct passwd *)0) X X+ #if HAVE_TERMIOS X+ struct termios otermios; X+ struct termios ctermios; X+ #else /* HAVE_TERMIOS */ X struct sgttyb arg; /* current mode of local terminal */ X struct sgttyb defarg; /* initial mode of local terminal */ X struct tchars tchars; /* current state of terminal */ X struct tchars defchars; /* initial state of terminal */ X struct ltchars ltchars; /* current local characters of terminal */ X struct ltchars deflchars; /* initial local characters of terminal */ X+ #endif /* HAVE_TERMIOS */ X X FILE *fscript; /* FILE for scripting */ X X*************** X*** 278,280 **** X--- 298,308 ---- X extern char *connect(); X X int tipabort __P((char *)); X+ X+ #define TL_VERBOSE 0x00000001 X+ #define TL_SIGNAL_TIPOUT 0x00000002 X+ X+ int tiplink (char *cmd, unsigned int flags); X+ void raw (); X+ X+ /* end of tip.h */ Xdiff -r -c ./tip/tipconf.h tip/tipconf.h X*** ./tip/tipconf.h Sun Mar 26 18:47:11 1995 X--- tip/tipconf.h Sat Mar 25 16:37:42 1995 X*************** X*** 0 **** X--- 1,124 ---- X+ /* X+ * Copyright (c) 1989, 1993 X+ * The Regents of the University of California. All rights reserved. X+ * X+ * Redistribution and use in source and binary forms, with or without X+ * modification, are permitted provided that the following conditions X+ * are met: X+ * 1. Redistributions of source code must retain the above copyright X+ * notice, this list of conditions and the following disclaimer. X+ * 2. Redistributions in binary form must reproduce the above copyright X+ * notice, this list of conditions and the following disclaimer in the X+ * documentation and/or other materials provided with the distribution. X+ * 3. All advertising materials mentioning features or use of this software X+ * must display the following acknowledgement: X+ * This product includes software developed by the University of X+ * California, Berkeley and its contributors. X+ * 4. Neither the name of the University nor the names of its contributors X+ * may be used to endorse or promote products derived from this software X+ * without specific prior written permission. X+ * X+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND X+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE X+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE X+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE X+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL X+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS X+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) X+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT X+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY X+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF X+ * SUCH DAMAGE. X+ * X+ * @(#)tipconf.h 8.1 (Berkeley) 3/25/95 X+ */ X+ X+ #ifndef tipconf_h_included X+ #define tipconf_h_included X+ X+ /* X+ Define constness X+ */ X+ #define CONST const X+ X+ /* X+ Specify default bit rate for connections X+ */ X+ #define DEFBR 1200 X+ X+ /* X+ Default frame size for file transfer buffering of writes X+ on local side X+ */ X+ #ifndef BUFSIZ X+ #define DEFFS 1024 X+ #else X+ #define DEFFS BUFSIZ X+ #endif X+ X+ /* X+ Enable logging of ACU use X+ */ X+ #define ACULOG 1 X+ X+ /* X+ Strip phone #s from ACU log file X+ */ X+ #define PRISTINE 1 X+ X+ /* X+ Enable command to "connect" remote with local process X+ */ X+ #define CONNECT 1 X+ X+ /* X+ Specify style of UUCP lock files X+ */ X+ #define HAVE_V2_LOCKFILES 0 X+ #define HAVE_HDB_LOCKFILES 1 X+ X+ /* X+ System has a millisecond based sleep function X+ */ X+ #define HAVE_USLEEP 0 X+ X+ /* X+ System has select X+ */ X+ #define HAVE_SELECT 1 X+ X+ /* X+ System has termios tty interface X+ */ X+ #define HAVE_TERMIOS 1 X+ X+ /* X+ Include configurable modem driver X+ */ X+ #define UNIDIALER 1 X+ X+ /* X+ Specify builtin modem drivers to include X+ */ X+ #define BIZ1031 0 X+ #define BIZ1022 0 X+ #define COURIER 0 X+ #define DF02 0 X+ #define DF03 0 X+ #define DN11 0 X+ #define HAYES 0 X+ #define MULTITECH 0 X+ #define T3000 0 X+ #define V3451 0 X+ #define V831 0 X+ #define VENTEL 0 X+ X+ /* X+ Include cu interface so that, when tip is linked to cu and then X+ invoked as cu, it behaves like cu. X+ */ X+ #define INCLUDE_CU_INTERFACE 0 X+ X+ #endif X+ X+ /* end of tipconf.h */ Xdiff -r -c ./tip/uucplock.c tip/uucplock.c X*** ./tip/uucplock.c Sun Mar 26 18:47:01 1995 X--- tip/uucplock.c Thu Mar 23 18:47:47 1995 X*************** X*** 39,102 **** X #include <sys/file.h> X #include <sys/dir.h> X #include <errno.h> X! #include <unistd.h> X! #include <stdio.h> X #include "pathnames.h" X X /* X * uucp style locking routines X * return: 0 - success X * -1 - failure X */ X X! uu_lock(ttyname) X! char *ttyname; X { X int fd, pid; X char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; X! FILE *ff; X X (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname); X! fd = open(tbuf, O_WRONLY|O_CREAT|O_EXCL, 0644); X! if (fd >= 0) X! ff = fdopen(fd, "w"); X! if (fd < 0 || ff == NULL) { X /* X * file is already locked X * check to see if the process holding the lock still exists X */ X! ff = fopen(tbuf, "r+"); X! if (ff == NULL) { X perror("lock open"); X return(-1); X } X! if (fscanf(ff, "%10d\n", &pid) != 1) { X perror("lock read"); X- (void)fclose(ff); X return(-1); X } X X if (kill(pid, 0) == 0 || errno != ESRCH) { X! (void)fclose(ff); /* process is still running */ X return(-1); X } X /* X * The process that locked the file isn't running, so X * we'll lock it ourselves X */ X! rewind(ff); X /* fall out and finish the locking process */ X } X! (void)fprintf(ff, "%10d\n", getpid()); X! (void)fclose(ff); X return(0); X } X X! uu_unlock(ttyname) X! char *ttyname; X { X char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; X X (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname); X return(unlink(tbuf)); X } X--- 39,146 ---- X #include <sys/file.h> X #include <sys/dir.h> X #include <errno.h> X! X! #include "tipconf.h" X #include "pathnames.h" X X+ /* Forward declarations */ X+ static int put_pid (int fd, int pid); X+ static int get_pid (int fd); X+ X /* X * uucp style locking routines X * return: 0 - success X * -1 - failure X */ X X! uu_lock (char *ttyname) X { X int fd, pid; X char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; X! off_t lseek(); X X (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname); X! fd = open(tbuf, O_RDWR|O_CREAT|O_EXCL, 0660); X! if (fd < 0) { X /* X * file is already locked X * check to see if the process holding the lock still exists X */ X! fd = open(tbuf, O_RDWR, 0); X! if (fd < 0) { X perror("lock open"); X return(-1); X } X! if (get_pid (fd) == -1) { X! (void)close(fd); X perror("lock read"); X return(-1); X } X X if (kill(pid, 0) == 0 || errno != ESRCH) { X! (void)close(fd); /* process is still running */ X return(-1); X } X /* X * The process that locked the file isn't running, so X * we'll lock it ourselves X */ X! if (lseek(fd, 0L, L_SET) < 0) { X! (void)close(fd); X! perror("lock lseek"); X! return(-1); X! } X /* fall out and finish the locking process */ X } X! pid = getpid(); X! if (!put_pid (fd, pid)) { X! (void)close(fd); X! (void)unlink(tbuf); X! perror("lock write"); X! return(-1); X! } X! (void)close(fd); X return(0); X } X X! uu_unlock (char *ttyname) X { X char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; X X (void)sprintf(tbuf, _PATH_LOCKDIRNAME, ttyname); X return(unlink(tbuf)); X } X+ X+ static int put_pid (int fd, int pid) X+ { X+ #if HAVE_V2_LOCKFILES X+ return write (fd, (char *)&pid, sizeof (pid)) == sizeof (pid); X+ #else X+ char buf [32]; X+ int len; X+ len = sprintf (buf, "%10ld\n", (long) pid); X+ return write (fd, buf, len) == len; X+ #endif X+ } X+ X+ static int get_pid (int fd) X+ { X+ int bytes_read, pid; X+ #if HAVE_V2_LOCKFILES X+ bytes_read = read (fd, &pid, sizeof (pid)); X+ if (bytes_read != sizeof (pid)) X+ pid = -1; X+ #else X+ char buf [32]; X+ bytes_read = read (fd, buf, sizeof (buf) - 1); X+ if (bytes_read > 0) { X+ buf [bytes_read] = '\0'; X+ pid = strtol (buf, (char **) NULL, 10); X+ } X+ else X+ pid = -1; X+ #endif X+ return pid; X+ } X+ X+ /* end of uucplock.c */ Xdiff -r -c ./tip/vars.c tip/vars.c X*** ./tip/vars.c Sun Mar 26 18:47:02 1995 X--- tip/vars.c Sat Mar 25 17:07:34 1995 X*************** X*** 35,40 **** X--- 35,41 ---- X static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93"; X #endif /* not lint */ X X+ #include "tipconf.h" X #include "tip.h" X #include "pathnames.h" X X*************** X*** 66,71 **** X--- 67,76 ---- X "ho", (char *)&HO }, X { "log", STRING|INIT, (READ|WRITE)<<ROOT, X NOSTR, _PATH_ACULOG }, X+ { "login", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC, X+ "li", (char *)&LI }, X+ { "logout", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC, X+ "lo", (char *)&LO }, X { "phones", STRING|INIT|IREMOTE, READ<<PUBLIC, X NOSTR, (char *)&PH }, X { "prompt", CHAR, (READ|WRITE)<<PUBLIC, END_OF_FILE if test 46448 -ne `wc -c <'patches.tip.3'`; then echo shar: \"'patches.tip.3'\" unpacked with wrong size! fi # end of 'patches.tip.3' fi if test -f 'preapply' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'preapply'\" else echo shar: Extracting \"'preapply'\" \(212 characters\) sed "s/^X//" >'preapply' <<'END_OF_FILE' X#!/bin/sh Xmv aculib libacu Xmkdir tip libacu/RCS Xmv acu.c acutab.c cmds.c cmdtab.c cu.c hunt.c log.c partab.c pathnames.h remcap.c remote.c tip.c tip.h tipout.c uucplock.c value.c vars.c tip Xmv Makefile tip.1 tip END_OF_FILE if test 212 -ne `wc -c <'preapply'`; then echo shar: \"'preapply'\" unpacked with wrong size! fi chmod +x 'preapply' # end of 'preapply' fi echo shar: End of archive 1 \(of 3\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 3 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503270833.AAA12424>