[comp.sys.handhelds] pf-bootstrap-v1.1a part 3 of 9

dan@i10s7.ira.uka.de (Dan Mosedale) (05/17/91)

#! /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 3 (of 9)."
# Contents:  pf-bootstrap-v1.1a/pf-cmds/xterm2.doc
#   pf-bootstrap-v1.1a/pf-cmds/xterm2.hex
#   pf-bootstrap-v1.1a/tipx-p1/README.TIPX
#   pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c
#   pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c
#   pf-bootstrap-v1.1a/tipx-p1/login.c
#   pf-bootstrap-v1.1a/tipx-p1/slip.c
#   pf-bootstrap-v1.1a/tipx-p1/value.c
#   pf-bootstrap-v1.1a/xmodem-3.9/batch.c
# Wrapped by dan@nostromo on Fri May 17 02:31:41 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc'\" \(5622 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc' <<'END_OF_FILE'
XXTerm2.COM - The next generation Terminal with XModem and
XText File Transfer for the Atari/DIP Portfolio.
X
Xby Jim Straus							January 17, 1990
X(c) 1990 by Jim Straus					All rights reserved
XCertain portions of the code are (c) 1989 by Atari and DIP.
XProgram in public domain.  Not for sale.
X
XNo warranty is given or implied for this program.
XIn no event shall the author of this work be liable for any
Xdirect, indirect, special, incidental, or consequential
Xdamages (including lost profit) whether based on warranty,
Xcontract, tort, or any other legal theory.
X
XThis program will only work on the Atari/DIP Portfolio
XPalmTop computer.  It is a simple terminal program for the
XSerial Interface.  It  allows files to be sent or received
Xusing the XModem protocol.  It also allows files to be sent
Xwith no translation and files to be captured.
X
XTo use the program, select serial port parameters from the
Xbuilt-in Setup program.  The Initialize! command does not
Xneed to be given as the program will attempt to initialize
Xthe serial port itself.  You may also want to set the External
XDisplay to Tracked (80x25).  Then start the program by typing:
X	XTerm2
Xat the DIP-DOS prompt.  You will see a greeting, and anything
Xyou type is sent out the serial port.  F1 may be used to exit
Xthe program (Note that the Atari key also generates an F1 key
Xcode).  If you can't see what you are typing on the Portfolio
X(most probably, when talking to another local computer), use
XF0 to enable Echo.  If you need to turn Echo off, use F0 again,
Xas it is a toggle.
X
XDuring the session, F2 may be used to start receiving a file
Xusing the XModem protocol.  You will be prompted for a file
Xname, and then the program will wait for the file to be
Xtransferred.  Each block successfully received will cause a
Xperiod to be displayed.  When the file is done, "Done" will
Xbe displayed and you will be back in the terminal portion.
XWhile the program is transferring, the F1 key may be used to
Xabort the transfer.
X
XSending a file is started with the F3 key and proceeds in a
Xsimilar fashion.  If the file was not found, you will just see
X"Done" displayed.
X
XNote that XModem always transfers files in 128 byte blocks,
Xso files will tend to be rounded up to the nearest 128 byte
Xlength.  When receiving text files, you may also see extra
Xspace on the end, depending on whether or not the sending end
Xput in a Control-Z terminating character.  XTerm2 does not put
Xin such characters and just pads with zeros.
X
XThe XModem time out values in this program have not been
Xtested with a packet network (such as that used by Compuserve),
Xbut have been adjusted to Compuserve's suggested values.
X
XCapturing text is controlled with the SHIFT-F2 key.  The first
Xtime it is pressed, you will be prompted for a file name.  From
Xthen on anything received is also saved in the file.  To stop
Xcapturing, use the SHIFT-F1 key again.  It will tell you it is
X"Done".  Text may be captured through XModem transfers and text
Xsending, but only received text that is displayed will be saved
Xin the capture file.
X
XSHIFT-F3 is used to send a text file.  It prompts for a file
Xname and the file is sent.  When the file is done, you will
Xagain see "Done".
X
XSHIFT-F1 will display the introduction again as help.
X
XAlso, CTRL-F0 through CTRL-F9 will cause the files "0.XTM"
Xthrough "9.XTM" to be sent.  This can be used to easily send
Xdialing commands, log on sequences and passwords.  It does not
Xhandle complicated log on procedures, but should simplify
Xyour life some.  As an added bonus, since these keys look for
Xthe files in the current directory, you could create different
Xdirectories containing different sets of macro keys.  Then a
Xsimple batch file could take you to the correct directory and
Xstart up XTerm2.  As an example, say I had a set of macros for
XCompuserve and had these stored in a directory called CIS.
XThen a batch file like:
X	c:
X	cd CIS
X	XTerm2
Xwould start up XTerm2 with my CIS macro keys available.
X
XAs an experimental feature, XTerm2 will also take command line
Xoptions.  The three forms are:
X	XTerm2 -r filename
X	XTerm2 -s filename
X	Xterm2 -h
XThe -r option will enter the XModem receive state, and when it
Xis done receiving the file, the program will exit.  The -s
Xoption enters the XModem send state.  The -h option will display
Xa short summary as a help.
X
XThe reason for putting these in, was to try and come up with
Xa semi-automatic method to back up the Portfolio through the
Xserial port.  In my case, to a Macintosh running the Red
XRyder (tm of FreeSoft Inc.) terminal program.  On the Portfolio
XI have a BACKUP.BAT file that looks like:
X	echo RECX filename.txt>aux
X	XTerm2 -s filename.txt
Xwith the above lines repeated for each file to be backed up.
XRed Ryder is left in HOST mode, so the above sequence should
Xautomatically send FILENAME.TXT to the Macintosh.  A similar
Xprocess is used to restore the files:
X	echo SENDX filename.txt>aux
X	XTerm2 -r filename.txt
X
XThe above sequences have not been thoroughly tested.  There
Xmay still be some timing problems in them (I occasionally hang
Xrestoring.  It can be alleviated by stopping the transfer on
Xthe Macintosh and sending two Control-Xs to cancel that file).
XThis is not considered a final solution, but I thought people
Xmight be interested.  Others might want to try build scripts
Xto drive other host machine terminal programs too.
X
XThe length of the file is 2897 bytes (if transfered with XModem
Xit will be 2944 bytes) and the checksum (as determined by
XCHKSUM.COM) is 99F3.
if test 5622 -ne `wc -c <'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc'`; then
    echo shar: \"'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/pf-cmds/xterm2.doc'
fi
if test -f 'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex'\" \(5888 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex' <<'END_OF_FILE'
XB44ABB600EB90400D3EBCD21730CB409BA5C01CD21B8004CCD21BC510EB409BA7801CD21FA5306B80C35CD21891EBB038C06BD03075BBAFF02B80C25CD21FBE87101E8A201E8C402A0230B0AC07405E8CA01CD20E8BC00E83E01EBF84661696C656420546F20416C6C6F63617465204D656D6F72790D0A24585465726D20322E3020202863292031393930204A696D205374726175730D0A202020202046313D517569742046323D526563656976652046333D53656E642046303D4563686F0D0A53484946542B2046313D48656C702046323D436170747572652046333D546578742053656E640D0A4354524C2B2020463020746F2046393D53656E642022







302E58544D2220746F2022392E58544D220D0A24E8A901B401CD1674F7B400CD160AC07410803E9702007408508AD0B402CD2158C380FC3B744680FC3C742880FC3D742880FC44744880FC54742D80FC55741E80FC56741E80FC5E7CB780FC677FB2E8A504EBADE82F02EBA8E82303EBA3E85404EB9EE8B704EB99E80D05EB94E89A008B1E1D0B0BDB7404B43ECD21CD20F6169702E97CFF005257508B3EB903BA050003D7ECA82074FB58BA000003D7EE5F5AC35056525733C01E8ED88B3E00041F893EB903E82B00E81606E8B800B80C00E86600BA040003D7B003EEE808008BD7EC5F5A5E58C3BA01002E0316B903B001EEC3BA01002E0316B903B000EEC







35X05257BA00002E0316B903EC2E8B3E450A2E88052EFF06450A5F5A58CF505352E8D1FF1E8E1EBD038B16BB03B80C25CD211FB048E804005A5B58C35053515250B103FEC180F90B741DB8011C8AF9CD6181FA7F8075EC588AD88AF9BA7F80B8001CCD61EB1D90B103FEC180F90B740EB8011C8AF9CD6183FA0075EDEBD958BA7F80EE5A595B58C350B105D2E874088AC8B506D3E9EB03B917048B16B90383C203B080EE8B16B9038AC1EE428AC5EE58241F8B16B90383C203EEC300000000000050535152813E450A450975055A595B58C3A04509247FA245098B1E1D0B0BDB7421B440BA4509B90100CD217315B43E8B1E1D0BCD21B409BA490BCD21C7061







D0B0000E833048AD0B402CD21EBB75053515257BB8000B4008A0703D843C60700BB80003C00745943E86100803F2D7550438A07A2230B43E85200BFCB0A8A07880543470AC075F6A0230B3C68742F3C48742BBBCB0A8A070AC07425A0230B3C72740F3C52740B3C7374103C53740CEB1090BA2400E87403EB3890E92D01E92603C606230B00905F5A595B58C3803F007408803F20770343EBF3C35053515257B409BA240BCD21E8E2033D00007503E9D200B900008BD3B43CCD217303E9C400A31B0BC6061F0B0190C606220B0090BA1200E8170372063C18741DEBF2B015E8B9FDFE06220B803E220B0A7603E98C00BA6C01E8F60272D73C047503EB79903C







0174X133C1875E9BA3700E8DF0272E13C1875ECEB6790BB470ABAB600E8CD0272AE88074381FBCA0A72EFBB490AB98000E890023A06C90A7596A0470A38061F0B758DF6D03A06480A7585B006E84CFDFE061F0BC606220B0090B22EB406CD21B4408B1E1B0BBA490AB98000CD21720D3D80007508E979FFB006E81FFDB43E8B1E1B0BCD21B409BA490BCD21E841025F5A595B58C35053515257B409BA380BCD21E8E9023D00007503E90F01B900008BD3B8003DCD217303E90001A31B0BC6061F0B0190C606220B0090B98400BF470AB000FCF3AAB43F8B1E1B0BB98000BA4A0ACD217303E9AF003D00007503E9A700A01F0BA2480AF6D0A2490AC606470A01







90BB4A0AB98000E8BA01A2CA0ABA2202EB6590FE061F0BC606220B0090B22EB406CD21B98400BF470AB000FCF3AAB43F8B1E1B0BB98000BA4A0ACD2172593D00007454A01F0BA2480AF6D0A2490AC606470A0190BB4A0AB98000E86701A2CA0AFE06220B803E220B0A7748BB470AB98400E84101BA6C01E8730172E43C0674933C1574DC3C1875EFBA3700E85F0172E73C1875E3EB1D90FE06220B803E220B0A7711B004E8F5FBBA6C01E8400172E83C0675E4B43E8B1E1B0BCD21B409BA490BCD21E80B015F5A595B58C3505351528B1E1D0B0BDB7414B43ECD21B409BA490BCD21C7061D0B0000EB1E90B409BA240BCD21E898013D0000740EB900008BD3B







43CCD2X17203A31D0B5A595B58C35053515280EC2D80FC3A750380EC0A88264B0CBA4B0CB90000B8003DCD217259A31B0BEB239050535152B409BA380BCD21E84C013D00007439B900008BD3B8003DCD21722DA31B0BB43F8B1E1B0BB98000BA470ACD2172123D0000740D8BC8BB470AE84300E84EFCEBDEB43E8B1E1B0BCD21B409BA490BCD21E847005A595B58C35052B409BA480CCD21B409BA7801CD21B409BAB20BCD215A58C3B409BA670BCD215F5A595B58C35053518A0743E8DEFAE2F8595B58C35153B000020743E2FB5B59C350B401CD1674143D003B750FB400CD16B018E8B7FAE8B4FAE8B1FA58C35352B401CD1674123D003B7407B400CD16E







B0790B018F8EB32908BDAB400CD1A8916200B813E450A4509751BB401CD1674053D003B74DDB400CD1A2B16200B3BD37EE1F9EB0590E80400F85A5BC35257B80000813E450A4509740BBF45098A05BA0100E803005F5AC351525657B9450903CA3B0E450A76088B16450A81EA4509FAFC8B0E450A81E945092BCABE450903F2BF4509F3A42916450AFB5F5E5A59C352BBCB0AB401CD1674FAB400CD160AC074F23C08740F3C0D74268807438AD0B402CD21EBDF81FBCB0A74D94BB208B402CD21B220B402CD21B208B402CD21EBC4B20DB402CD
if test 5888 -ne `wc -c <'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex'`; then
    echo shar: \"'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/pf-cmds/xterm2.hex'
fi
if test -f 'pf-bootstrap-v1.1a/tipx-p1/README.TIPX' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/tipx-p1/README.TIPX'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/tipx-p1/README.TIPX'\" \(5339 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/tipx-p1/README.TIPX' <<'END_OF_FILE'
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
END_OF_FILE
if test 5339 -ne `wc -c <'pf-bootstrap-v1.1a/tipx-p1/README.TIPX'`; then
    echo shar: \"'pf-bootstrap-v1.1a/tipx-p1/README.TIPX'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/tipx-p1/README.TIPX'
fi
if test -f 'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c'\" \(5901 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c' <<'END_OF_FILE'
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#ifndef lint
Xstatic char sccsid[] = "@(#)v831.c	5.2 (Berkeley) 9/13/88";
X#endif /* not lint */
X
X/*
X * Routines for dialing up on Vadic 831
X */
X#include <sys/time.h>
X
X#include "tip.h"
X
Xint	v831_abort();
Xstatic	int alarmtr();
Xextern	errno;
X
Xstatic jmp_buf jmpbuf;
Xstatic int child = -1;
X
Xv831_dialer(num, acu)
X        char *num, *acu;
X{
X        int status, pid, connected = 1;
X        register int timelim;
X
X        if (boolean(value(VERBOSE)))
X                printf("\nstarting call...");
X#ifdef DEBUG
X        printf ("(acu=%s)\n", acu);
X#endif
X        if ((AC = open(acu, O_RDWR)) < 0) {
X                if (errno == EBUSY)
X                        printf("line busy...");
X                else
X                        printf("acu open error...");
X                return (0);
X        }
X        if (setjmp(jmpbuf)) {
X                kill(child, SIGKILL);
X                close(AC);
X                return (0);
X        }
X        signal(SIGALRM, alarmtr);
X        timelim = 5 * strlen(num);
X        alarm(timelim < 30 ? 30 : timelim);
X        if ((child = fork()) == 0) {
X                /*
X                 * ignore this stuff for aborts
X                 */
X                signal(SIGALRM, SIG_IGN);
X		signal(SIGINT, SIG_IGN);
X                signal(SIGQUIT, SIG_IGN);
X                sleep(2);
X                exit(dialit(num, acu) != 'A');
X        }
X        /*
X         * open line - will return on carrier
X         */
X        if ((FD = open(DV, O_RDWR)) < 0) {
X#ifdef DEBUG
X                printf("(after open, errno=%d)\n", errno);
X#endif
X                if (errno == EIO)
X                        printf("lost carrier...");
X                else
X                        printf("dialup line open failed...");
X                alarm(0);
X                kill(child, SIGKILL);
X                close(AC);
X                return (0);
X        }
X        alarm(0);
X#ifdef notdef
X        ioctl(AC, TIOCHPCL, 0);
X#endif
X        signal(SIGALRM, SIG_DFL);
X        while ((pid = wait(&status)) != child && pid != -1)
X                ;
X        if (status) {
X                close(AC);
X                return (0);
X        }
X        return (1);
X}
X
Xstatic
Xalarmtr()
X{
X
X        alarm(0);
X        longjmp(jmpbuf, 1);
X}
X
X/*
X * Insurance, for some reason we don't seem to be
X *  hanging up...
X */
Xv831_disconnect()
X{
X        struct sgttyb cntrl;
X
X        sleep(2);
X#ifdef DEBUG
X        printf("[disconnect: FD=%d]\n", FD);
X#endif
X        if (FD > 0) {
X                ioctl(FD, TIOCCDTR, 0);
X                ioctl(FD, TIOCGETP, &cntrl);
X                cntrl.sg_ispeed = cntrl.sg_ospeed = 0;
X                ioctl(FD, TIOCSETP, &cntrl);
X                ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
X        }
X        close(FD);
X}
X
Xv831_abort()
X{
X
X#ifdef DEBUG
X        printf("[abort: AC=%d]\n", AC);
X#endif
X        sleep(2);
X        if (child > 0)
X                kill(child, SIGKILL);
X        if (AC > 0)
X                ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
X                close(AC);
X        if (FD > 0)
X                ioctl(FD, TIOCCDTR, 0);
X        close(FD);
X}
X
X/*
X * Sigh, this probably must be changed at each site.
X */
Xstruct vaconfig {
X	char	*vc_name;
X	char	vc_rack;
X	char	vc_modem;
X} vaconfig[] = {
X	{ "/dev/cua0",'4','0' },
X	{ "/dev/cua1",'4','1' },
X	{ 0 }
X};
X
X#define pc(x)	(c = x, write(AC,&c,1))
X#define ABORT	01
X#define SI	017
X#define STX	02
X#define ETX	03
X
Xstatic
Xdialit(phonenum, acu)
X	register char *phonenum;
X	char *acu;
X{
X        register struct vaconfig *vp;
X	struct sgttyb cntrl;
X        char c, *sanitize();
X        int i, two = 2;
X
X        phonenum = sanitize(phonenum);
X#ifdef DEBUG
X        printf ("(dial phonenum=%s)\n", phonenum);
X#endif
X        if (*phonenum == '<' && phonenum[1] == 0)
X                return ('Z');
X	for (vp = vaconfig; vp->vc_name; vp++)
X		if (strcmp(vp->vc_name, acu) == 0)
X			break;
X	if (vp->vc_name == 0) {
X		printf("Unable to locate dialer (%s)\n", acu);
X		return ('K');
X	}
X        ioctl(AC, TIOCGETP, &cntrl);
X        cntrl.sg_ispeed = cntrl.sg_ospeed = B2400;
X        cntrl.sg_flags = RAW | EVENP | ODDP;
X        ioctl(AC, TIOCSETP, &cntrl);
X	ioctl(AC, TIOCFLUSH, &two);
X        pc(STX);
X	pc(vp->vc_rack);
X	pc(vp->vc_modem);
X	while (*phonenum && *phonenum != '<')
X		pc(*phonenum++);
X        pc(SI);
X	pc(ETX);
X        sleep(1);
X        i = read(AC, &c, 1);
X#ifdef DEBUG
X        printf("read %d chars, char=%c, errno %d\n", i, c, errno);
X#endif
X        if (i != 1)
X		c = 'M';
X        if (c == 'B' || c == 'G') {
X                char cc, oc = c;
X
X                pc(ABORT);
X                read(AC, &cc, 1);
X#ifdef DEBUG
X                printf("abort response=%c\n", cc);
X#endif
X                c = oc;
X                v831_disconnect();
X        }
X        close(AC);
X#ifdef DEBUG
X        printf("dialit: returns %c\n", c);
X#endif
X        return (c);
X}
X
Xstatic char *
Xsanitize(s)
X	register char *s;
X{
X        static char buf[128];
X        register char *cp;
X
X        for (cp = buf; *s; s++) {
X		if (!isdigit(*s) && *s == '<' && *s != '_')
X			continue;
X		if (*s == '_')
X			*s = '=';
X		*cp++ = *s;
X	}
X        *cp++ = 0;
X        return (buf);
X}
END_OF_FILE
if test 5901 -ne `wc -c <'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c'`; then
    echo shar: \"'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/tipx-p1/libacu/v831.c'
fi
if test -f 'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c'\" \(4922 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c' <<'END_OF_FILE'
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#ifndef lint
Xstatic char sccsid[] = "@(#)ventel.c	5.2 (Berkeley) 9/13/88";
X#endif /* not lint */
X
X/*
X * Routines for calling up on a Ventel Modem
X * The Ventel is expected to be strapped for local echo (just like uucp)
X */
X#include "tip.h"
X
X#define	MAXRETRY	5
X
Xstatic	int sigALRM();
Xstatic	int timeout = 0;
Xstatic	jmp_buf timeoutbuf;
X
X/*
X * some sleep calls have been replaced by this macro
X * because some ventel modems require two <cr>s in less than
X * a second in order to 'wake up'... yes, it is dirty...
X */
X#define delay(num,denom) busyloop(CPUSPEED*num/denom)
X#define CPUSPEED 1000000	/* VAX 780 is 1MIPS */
X#define	DELAY(n)	{ register long N = (n); while (--N > 0); }
Xbusyloop(n) { DELAY(n); }
X
Xven_dialer(num, acu)
X	register char *num;
X	char *acu;
X{
X	register char *cp;
X	register int connected = 0;
X	char *msg, *index(), line[80];
X
X	/*
X	 * Get in synch with a couple of carriage returns
X	 */
X	if (!vensync(FD)) {
X		printf("can't synchronize with ventel\n");
X#ifdef ACULOG
X		logent(value(HOST), num, "ventel", "can't synch up");
X#endif
X		return (0);
X	}
X	if (boolean(value(VERBOSE)))
X		printf("\ndialing...");
X	fflush(stdout);
X	ioctl(FD, TIOCHPCL, 0);
X	echo("#k$\r$\n$D$I$A$L$:$ ");
X	for (cp = num; *cp; cp++) {
X		delay(1, 10);
X		write(FD, cp, 1);
X	}
X	delay(1, 10);
X	write(FD, "\r", 1);
X	gobble('\n', line);
X	if (gobble('\n', line))
X		connected = gobble('!', line);
X	ioctl(FD, TIOCFLUSH);
X#ifdef ACULOG
X	if (timeout) {
X		sprintf(line, "%d second dial timeout",
X			number(value(DIALTIMEOUT)));
X		logent(value(HOST), num, "ventel", line);
X	}
X#endif
X	if (timeout)
X		ven_disconnect();	/* insurance */
X	if (connected || timeout || !boolean(value(VERBOSE)))
X		return (connected);
X	/* call failed, parse response for user */
X	cp = index(line, '\r');
X	if (cp)
X		*cp = '\0';
X	for (cp = line; cp = index(cp, ' '); cp++)
X		if (cp[1] == ' ')
X			break;
X	if (cp) {
X		while (*cp == ' ')
X			cp++;
X		msg = cp;
X		while (*cp) {
X			if (isupper(*cp))
X				*cp = tolower(*cp);
X			cp++;
X		}
X		printf("%s...", msg);
X	}
X	return (connected);
X}
X
Xven_disconnect()
X{
X
X	close(FD);
X}
X
Xven_abort()
X{
X
X	write(FD, "\03", 1);
X	close(FD);
X}
X
Xstatic int
Xecho(s)
X	register char *s;
X{
X	char c;
X
X	while (c = *s++) switch (c) {
X
X	case '$':
X		read(FD, &c, 1);
X		s++;
X		break;
X
X	case '#':
X		c = *s++;
X		write(FD, &c, 1);
X		break;
X
X	default:
X		write(FD, &c, 1);
X		read(FD, &c, 1);
X	}
X}
X
Xstatic int
XsigALRM()
X{
X
X	printf("\07timeout waiting for reply\n");
X	timeout = 1;
X	longjmp(timeoutbuf, 1);
X}
X
Xstatic int
Xgobble(match, response)
X	register char match;
X	char response[];
X{
X	register char *cp = response;
X	char c;
X	int (*f)();
X
X	signal(SIGALRM, sigALRM);
X	timeout = 0;
X	do {
X		if (setjmp(timeoutbuf)) {
X			signal(SIGALRM, f);
X			*cp = '\0';
X			return (0);
X		}
X		alarm(number(value(DIALTIMEOUT)));
X		read(FD, cp, 1);
X		alarm(0);
X		c = (*cp++ &= 0177);
X#ifdef notdef
X		if (boolean(value(VERBOSE)))
X			putchar(c);
X#endif
X	} while (c != '\n' && c != match);
X	signal(SIGALRM, SIG_DFL);
X	*cp = '\0';
X	return (c == match);
X}
X
X#define min(a,b)	((a)>(b)?(b):(a))
X/*
X * This convoluted piece of code attempts to get
X * the ventel in sync.  If you don't have FIONREAD
X * there are gory ways to simulate this.
X */
Xstatic int
Xvensync(fd)
X{
X	int already = 0, nread;
X	char buf[60];
X
X	/*
X	 * Toggle DTR to force anyone off that might have left
X	 * the modem connected, and insure a consistent state
X	 * to start from.
X	 *
X	 * If you don't have the ioctl calls to diddle directly
X	 * with DTR, you can always try setting the baud rate to 0.
X	 */
X	ioctl(FD, TIOCCDTR, 0);
X	sleep(1);
X	ioctl(FD, TIOCSDTR, 0);
X	while (already < MAXRETRY) {
X		/*
X		 * After reseting the modem, send it two \r's to
X		 * autobaud on. Make sure to delay between them
X		 * so the modem can frame the incoming characters.
X		 */
X		write(fd, "\r", 1);
X		delay(1,10);
X		write(fd, "\r", 1);
X		sleep(2);
X		if (ioctl(fd, FIONREAD, (caddr_t)&nread) < 0) {
X			perror("tip: ioctl");
X			continue;
X		}
X		while (nread > 0) {
X			read(fd, buf, min(nread, 60));
X			if ((buf[nread - 1] & 0177) == '$')
X				return (1);
X			nread -= min(nread, 60);
X		}
X		sleep(1);
X		already++;
X	}
X	return (0);
X}
X
END_OF_FILE
if test 4922 -ne `wc -c <'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c'`; then
    echo shar: \"'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/tipx-p1/libacu/ventel.c'
fi
if test -f 'pf-bootstrap-v1.1a/tipx-p1/login.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/tipx-p1/login.c'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/tipx-p1/login.c'\" \(4988 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/tipx-p1/login.c' <<'END_OF_FILE'
X#include "tip.h"
X#include <sys/time.h>
X
Xstatic FILE *fp;
Xstatic int line;
X
Xchar *dosend();
Xchar *dorecv();
Xint naptimeout();
X
Xchar *
Xlogin()
X{
X	static char errmsg[128];
X	char buf[512];
X	char cmd[32], fmt[80];
X	char arg1[128],arg2[128];
X	register char *cp;
X	int n;
X
X	if (LS == NOSTR)
X		return(0);
X	if ((fp = fopen(LS, "r")) == NULL) {
X		perror(LS);
X		return("cannot open login script");
X	}
X
X	line = 0;
X	(void) sprintf(fmt, "%%%ds%%*[ \t]%%%ds%%*[ \t]%%%ds\\n",
X			    (sizeof cmd)-1, (sizeof arg1)-1, (sizeof arg2)-1);
X	while(fgets(buf, sizeof(buf), fp) != NULL)  {
X		line++;
X		if (isblank(buf))
X			continue;
X		if ((n = sscanf(buf, fmt, cmd, arg1, arg2)) <= 0)
X			goto err;
X		else if (cmd[0] == '#')
X			continue;
X		else if (equal(cmd, "done"))
X			return(0);
X		else if (equal(cmd, "fail"))
X			return("login failed");
X		else if(equal(cmd, "send") && n == 2) {
X			if (cp = dosend(arg1))
X				return(cp);
X		} else if(equal(cmd, "recv") && n == 3) {
X			if (cp = dorecv(arg1, arg2))
X				return(cp);
X		} else if(equal(cmd, "label"))
X			continue;
X		else if(equal(cmd, "goto") && n == 2) {
X			if (dogoto(arg1))
X				goto err;
X		} else
X			goto err;
X	}
X	if(ferror(fp)) {
X		perror(LS);
X		return("error reading script file");
X	}
X	return("premature EOF in script file");
X
Xerr:	sprintf(errmsg, "format error in %.80s at line %d", LS, line);
X	return(errmsg);
X}
X
Xchar *
Xdosend(cp)
Xchar *cp;
X{
X	char c;
X
X	if(vflag)
X		fprintf(stderr, "send: %s: ", cp);
X	while(*cp) {
X		c = *cp++;
X		if (c == '\\') {
X			switch(*cp) {
X			case 0:
X				return("send format error");
X			case 'b':
X				c = '\b'; cp++; break;
X			case 'd':
X				sleep(1); cp++;
X				continue;
X			case 'f':
X				c = '\f'; cp++; break;
X			case 'n':
X				c = '\n'; cp++; break;
X			case 'r':
X				c = '\r'; cp++; break;
X			case 's':
X				c = ' '; cp++; break;
X			case 't':
X				c = '\t'; cp++; break;
X			case 'x':
X				genbrk(); cp++;
X				continue;
X			case '?':
X				c = 0177; cp++; break;
X			default:
X				c = octalnum(&cp);
X			}
X		}
X		if (write(FD, &c, 1) != 1)
X			return("write error to remote site");
X		if (vflag)
X			show(&c, 1);
X		nap(20);
X	}
X	if (vflag)
X		putc('\n', stderr);
X	return(0);
X	
X}
X
Xnap(ms)
Xint ms;
X{
X	struct itimerval itv;
X
X	signal(SIGALRM, naptimeout);
X	itv.it_interval.tv_sec = 0;
X	itv.it_interval.tv_usec = 0;
X	itv.it_value.tv_sec = 0;
X	itv.it_value.tv_usec = ms*1000;
X	setitimer(ITIMER_REAL, &itv, (struct itimerval *)0);
X	sigpause(0);
X}
X
Xnaptimeout()
X{
X	return(0);
X}
X
Xjmp_buf jmpbuf;
X/* sigfunc_t recvtimeout();  */
X
Xsigfunc_t recvtimeout()
X{
X	longjmp(jmpbuf, 1);
X	return;
X}
X
Xchar *
Xdorecv(control, want)
Xchar *control, *want;
X{
X	char buf[128];
X	char *label;
X	int secs = atoi(control);
X	int i, n, size;
X	
X	if (label = strchr(control, '/'))
X		label++;
X	if (setjmp(jmpbuf)) {
X		if(vflag)
X			fprintf(stderr, "\nrecv: timeout, going to %s\n", label);
X		dogoto(label);
X		return(0);
X	}
X	signal(SIGALRM, recvtimeout);
X	alarm(secs);
X	strfix(want);
X	size = strlen(want);
X	if(vflag)
X		fprintf(stderr, "recv (want %s): ", want);
X	for (i = 0; i < size; ) {
X		if ((n = read(FD, &buf[i], size - i)) <= 0)
X			goto readerror;
X		if(vflag)
X			show(&buf[i], n);
X		i += n;
X	}
X	for (i = 0; i < size; i++)
X		buf[i] &= 0177;
X	i = size-1;
X	while (strncmp(buf, want, size)) {
X		for (n = 0; n < i; n++)
X			buf[n] = buf[n+1];
X		if ((n = read(FD, &buf[i], 1)) != 1)
X			goto readerror;
X		buf[i] &= 0177;
X		if(vflag)
X			show(&buf[i], 1);
X	}
X	alarm(0);
X	if (vflag)
X		putc('\n', stderr);
X	return(0);
Xreaderror:
X	alarm(0);
X	return("read error from remote");
X}
X
Xstrfix(cp)
Xchar *cp;
X{
X	char c;
X	char *np = cp;
X
X	while(*cp) {
X		c = *cp++;
X		if (c == '\\') {
X			switch(*cp) {
X			case 'b':
X				c = '\b'; cp++; break;
X			case 'f':
X				c = '\f'; cp++; break;
X			case 'n':
X				c = '\n'; cp++; break;
X			case 'r':
X				c = '\r'; cp++; break;
X			case 's':
X				c = ' '; cp++; break;
X			case 't':
X				c = '\t'; cp++; break;
X			case '?':
X				c = 0177; cp++; break;
X			default:
X				c = octalnum(&cp);
X			}
X		}
X		*np++ = c; 
X	}
X	*np = 0;
X}
X
X#define isoctal(c) ((c) >= '0' && (c) <= '7')
X
Xoctalnum(cpp)
Xchar **cpp;
X{
X	int n = 0;
X	char c = *((*cpp)++);
X
X	if (isoctal(c)) {
X		n = (c-'0');
X		c = *((*cpp)++);
X		if (isoctal(c)) {
X			n = (n<<3)+(c-'0');
X			c = *((*cpp)++);
X			if (isoctal(c))
X				n = (n<<3)+(c-'0');
X		}
X		c = n;
X	}
X	return(c);
X}
X
Xshow(cp, n)
Xchar *cp;
X{
X	register int i;
X	char c;
X
X	for(i = 0; i < n; i++) {
X		c = cp[i]&0177;
X		if(isprint(c))
X			fputc(c, stderr);
X		else
X			fprintf(stderr, "\\%03o", c);
X	}
X}
X
X
Xdogoto(label)
Xchar *label;
X{			
X	char buf[512];
X	char fmt[80], cmd[32], arg1[128];
X	int n;
X
X	if(vflag)
X		fprintf(stderr, "goto: %s\n", label);
X	rewind(fp);
X	line = 0;
X	(void) sprintf(fmt, "%%%ds%%*[ \t]%%%ds\\n",
X			    (sizeof cmd)-1, (sizeof arg1)-1);
X	while(fgets(buf, sizeof(buf), fp) != NULL) {
X		line++;
X		if (buf[0] == '#' || isblank(buf))
X			continue;
X		n = sscanf(buf, fmt, cmd, arg1);
X		if(n == 2 && equal(cmd, "label") && equal(arg1, label))
X			break;
X	}
X	return(feof(fp) || ferror(fp));
X}
X
Xisblank(s)
Xchar *s;
X{
X	while(isspace(*s)) s++;
X	return(*s == '\0');
X}
END_OF_FILE
if test 4988 -ne `wc -c <'pf-bootstrap-v1.1a/tipx-p1/login.c'`; then
    echo shar: \"'pf-bootstrap-v1.1a/tipx-p1/login.c'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/tipx-p1/login.c'
fi
if test -f 'pf-bootstrap-v1.1a/tipx-p1/slip.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/tipx-p1/slip.c'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/tipx-p1/slip.c'\" \(5367 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/tipx-p1/slip.c' <<'END_OF_FILE'
X#ifndef lint
Xstatic char *sccsid = "%W%	MS/ACF	%E%";
X#endif
X/*
X *  tip/slip.c
X *
X *  This file contains the SLIP specific startup code.  It is designed
X *  with both BSD sockets and Sun Streams in mind, though the socket
X *  version has not been tested lately (but it SHOULD work).  The Streams
X *  code is for SunOS 4.0[.1].
X *
X *  The code to set the route (basically an internal shell script) may
X *  need tweeking on other systems, though it works on any of the
X *  systems I have run into.
X *
X *  The alarm/DCD code is a HACK to detect loss of the line in the
X *  absense of proper modems status signaling (broken in SunOS when
X *  using the dialout device, serial line minor devices 128-255).
X *  This has been reported, but I suspect that a fix will have to
X *  wait for SunOS 4.2 or maybe 4.1.?.
X *
X *  Doug Kingston <dpk@morgan.com>
X *  880219
X */
X
X#include "tip.h"
X
X#include <sys/socket.h>
X#ifdef STREAMS
X#include <sys/stropts.h>
X#include <sys/sockio.h>
X#include <sys/termios.h>	/* has defines that clash with ioctl.h */
X/* #include <sys/slip.h>  */
X#include "slip.h"
X#endif STREAMS
X#include <netinet/in.h>
X#include <net/if.h>
X
X#include <arpa/inet.h>
X
X#define	DCD_SETTLING_TIME 1	/* time between DCD change and status check */
X#define	DCD_CHECK_INTERVAL 15	/* if > 0, time between automatic DCD checks */
X
Xint gotsig = 0;
Xsigfunc_t dcd_handler();
X
Xrunslip()
X{
X	int unit, s;
X	struct ifreq ifr;
X#ifdef I_POP /* Using streams */
X	struct termios tios;
X
X	/* pop all streams modules */
X	while (ioctl(FD, I_POP, 0) == 0)
X		continue;
X
X	/* set up the line parameters */
X	if (ioctl(FD, TCGETS, (caddr_t)&tios) < 0) {
X		perror("ioctl (TCGETS)");
X		return(1);
X	}
X	tios.c_cflag = (tios.c_cflag&(CBAUD|CIBAUD))|CS8|CREAD|HUPCL;
X	tios.c_iflag = IGNBRK;
X	if (ioctl(FD, TCSETS, (caddr_t)&tios) < 0) {
X		perror("ioctl (TCSETS)");
X		return(1);
X	}
X
X	/* push the SLIP module */
X	if (ioctl(FD, I_PUSH, "slip") < 0) {
X		perror("ioctl (I_PUSH)");
X		return(1);
X	}
X
X	/* find out what unit number we were assigned */
X	if (ioctl(FD, SLIOGUNIT, (caddr_t)&unit) < 0) {
X		perror("ioctl (SLIOGUNIT)");
X		return(1);
X	}
X#else /* not streams */
X	int ldisc = SLIPDISC;
X	if (ioctl(FD, TIOCSETD, &ldisc) < 0) {
X		perror("slipd: TIOCSETD");
X		return(1);
X	}
X	if (ioctl(FD, TIOCGETD, &unit) < 0) {	/* Hack to get slip number */
X		perror("slipd: TIOCGETD");
X		return(1);
X	}
X#endif I_POP
X
X	/* set the local and remote interface addresses */
X	s = socket(AF_INET, SOCK_DGRAM, 0);
X
X	(void) sprintf(ifr.ifr_name, "slip%d", unit);
X	if (in_getaddr(DA, &ifr.ifr_addr) != 0 ||
X	    ioctl(s, SIOCSIFDSTADDR, (caddr_t)&ifr) < 0) {
X		perror("ioctl (SIOCSIFDSTADDR)");
X		return(1);
X	}
X
X	/* this has the side-effect of marking the interface up */
X	if (in_getaddr(SA, &ifr.ifr_addr) != 0 ||
X	    ioctl(s, SIOCSIFADDR, (caddr_t)&ifr) < 0) {
X		perror("ioctl (SIOCSIFADDR)");
X		return(1);
X	}
X
X	if (in_getaddr(SM, &ifr.ifr_addr) != 0) {
X		if (ioctl(s, SIOCSIFNETMASK, (caddr_t)&ifr) < 0) {
X			perror("ioctl (SIOCSIFADDR)");
X			return(1);
X		}
X	}
X
X	/* Set up default route if desired and not already present */
X	if (boolean(value(SETROUTE))) {
X		char buf[256];
X		char *argv[4];
X		char *envp[2];
X		int status;
X
X		sprintf(buf, "if eval 'netstat -r|grep -s \"^default\"';\
X			      then echo default route already installed;\
X			      else route add 0 %s 3; fi", SA);
X		argv[0] = "/bin/sh";
X		argv[1] = "-c";
X		argv[2] = buf;
X		argv[3] = (char *)0;
X
X		envp[0] = "PATH=/bin:/usr/bin:/usr/ucb:/etc:/usr/etc";
X		envp[1] = (char *)0;
X
X		switch (fork()) {
X		case 0:		/* Child */
X			execve(argv[0], argv, envp);
X			exit(1);
X		case -1:
X			perror("tip: route add: fork");
X			break;
X		default:	/* Parent */
X			wait(&status);
X		}
X	}
X
X	fprintf(stderr, "\07[SLIP running]\r\n");
X
X	/* set up signal handlers */
X	(void) sigblock(sigmask(SIGALRM));
X	(void) signal(SIGALRM, dcd_handler);
X#if defined(SIGDCD) && SIGDCD > 0
X	(void) signal(SIGDCD, dcd_handler);
X#endif
X
X	/* twiddle thumbs until we get a signal */
X	while (1) {
X		alarm(DCD_CHECK_INTERVAL);
X		sigpause(0);
X#if defined(SIGDCD) && SIGDCD > 0
X		(void) sigblock(sigmask(SIGALRM)|sigmask(SIGDCD));
X#else
X		(void) sigblock(sigmask(SIGALRM));
X#endif SIGDCD
X		if (gotsig && lowdcd(FD)) {
X			sleep(DCD_SETTLING_TIME);
X			if (lowdcd(FD))
X				break;
X		}
X		gotsig = 0;
X	}
X	return(0);
X}
X
Xabort_slip()
X{
X#ifdef STREAMS
X	/* pop the SLIP stream module */
X	while(ioctl(FD, I_POP, 0) == 0);
X#else
X	int ldisc = 0;
X	(void)ioctl(FD, TIOCSETD, &ldisc);
X#endif
X}
X
Xsigfunc_t
Xdcd_handler()
X{
X	gotsig = 1;
X}
X
X/* Use TIOCMGET to test if DCD is low on the port of the passed descriptor */
Xint
Xlowdcd(fd)
X	int fd;
X{
X	int mbits;
X
X	if (ioctl(fd, TIOCMGET, (caddr_t)&mbits) < 0)
X		return 1;	/* port is dead, we die */
X	return !(mbits & TIOCM_CAR);
X}
X
Xin_getaddr(s, saddr)
X	char *s;
X	struct sockaddr *saddr;
X{
X	register struct sockaddr_in *sin = (struct sockaddr_in *)saddr;
X	struct hostent *hp;
X	struct netent *np;
X	int val;
X 
X	sin->sin_family = AF_INET;
X	val = inet_addr(s);
X	if (val != -1) {
X		sin->sin_addr.s_addr = val;
X		return(0);
X	}
X	hp = gethostbyname(s);
X	if (hp) {
X		sin->sin_family = hp->h_addrtype;
X		bcopy(hp->h_addr, (char *)&sin->sin_addr, hp->h_length);
X		return(0);
X	}
X	np = getnetbyname(s);
X	if (np) {
X		sin->sin_family = np->n_addrtype;
X		sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
X		return(0);
X	}
X	fprintf(stderr, "tip: in_getaddr: can't parse/lookup '%s'\n", s);
X	return(1);
X}
END_OF_FILE
if test 5367 -ne `wc -c <'pf-bootstrap-v1.1a/tipx-p1/slip.c'`; then
    echo shar: \"'pf-bootstrap-v1.1a/tipx-p1/slip.c'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/tipx-p1/slip.c'
fi
if test -f 'pf-bootstrap-v1.1a/tipx-p1/value.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/tipx-p1/value.c'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/tipx-p1/value.c'\" \(5890 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/tipx-p1/value.c' <<'END_OF_FILE'
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#ifndef lint
Xstatic char sccsid[] = "@(#)value.c	5.2 (Berkeley) 9/2/88";
X#endif /* not lint */
X
X#include "tip.h"
X
X#define MIDDLE	35
X
Xstatic value_t *vlookup();
Xstatic int col = 0;
X
X/*
X * Variable manipulation
X */
Xvinit()
X{
X	register value_t *p;
X	register char *cp;
X	FILE *f;
X	char file[256];
X
X	for (p = vtable; p->v_name != NULL; p++) {
X		if (p->v_type&ENVIRON)
X			if (cp = getenv(p->v_name))
X				p->v_value = cp;
X		if (p->v_type&IREMOTE)
X			number(p->v_value) = *address(p->v_value);
X	}
X	/*
X	 * Read the .tiprc file in the HOME directory
X	 *  for sets
X	 */
X	strcpy(file, value(HOME));
X	strcat(file, "/.tiprc");
X	if ((f = fopen(file, "r")) != NULL) {
X		register char *tp;
X
X		while (fgets(file, sizeof(file)-1, f) != NULL) {
X			if (vflag)
X				printf("set %s", file);
X			if (tp = rindex(file, '\n'))
X				*tp = '\0';
X			vlex(file);
X		}
X		fclose(f);
X	}
X	/*
X	 * To allow definition of exception prior to fork
X	 */
X	vtable[EXCEPTIONS].v_access &= ~(WRITE<<PUBLIC);
X}
X
X/*VARARGS1*/
Xvassign(p, v)
X	register value_t *p;
X	char *v;
X{
X
X	if (!vaccess(p->v_access, WRITE)) {
X		printf("access denied\r\n");
X		return;
X	}
X	switch (p->v_type&TMASK) {
X
X	case STRING:
X		if (equal(p->v_value, v))
X			return;
X		if (!(p->v_type&(ENVIRON|INIT)))
X			free(p->v_value);
X		if ((p->v_value = malloc(size(v)+1)) == NOSTR) {
X			printf("out of core\r\n");
X			return;
X		}
X		p->v_type &= ~(ENVIRON|INIT);
X		strcpy(p->v_value, v);
X		break;
X
X	case NUMBER:
X		if (number(p->v_value) == number(v))
X			return;
X		number(p->v_value) = number(v);
X		break;
X
X	case BOOL:
X		if (boolean(p->v_value) == (*v != '!'))
X			return;
X		boolean(p->v_value) = (*v != '!');
X		break;
X
X	case CHAR:
X		if (character(p->v_value) == *v)
X			return;
X		character(p->v_value) = *v;
X	}
X	p->v_access |= CHANGED;
X}
X
Xvlex(s)
X	register char *s;
X{
X	register value_t *p;
X
X	if (equal(s, "all")) {
X		for (p = vtable; p->v_name; p++)
X			if (vaccess(p->v_access, READ))
X				vprint(p);
X	} else {
X		register char *cp;
X
X		do {
X			if (cp = vinterp(s, ' '))
X				cp++;
X			vtoken(s);
X			s = cp;
X		} while (s);
X	}
X	if (col > 0) {
X		printf("\r\n");
X		col = 0;
X	}
X}
X
Xstatic int
Xvtoken(s)
X	register char *s;
X{
X	register value_t *p;
X	register char *cp;
X	char *expand();
X
X	if (cp = index(s, '=')) {
X		*cp = '\0';
X		if (p = vlookup(s)) {
X			cp++;
X			if (p->v_type&NUMBER)
X				vassign(p, atoi(cp));
X			else {
X				if (strcmp(s, "record") == 0)
X					cp = expand(cp);
X				vassign(p, cp);
X			}
X			return;
X		}
X	} else if (cp = index(s, '?')) {
X		*cp = '\0';
X		if ((p = vlookup(s)) && vaccess(p->v_access, READ)) {
X			vprint(p);
X			return;
X		}
X	} else {
X		if (*s != '!')
X			p = vlookup(s);
X		else
X			p = vlookup(s+1);
X		if (p != NOVAL) {
X			vassign(p, s);
X			return;
X		}
X	}
X	printf("%s: unknown variable\r\n", s);
X}
X
Xstatic int
Xvprint(p)
X	register value_t *p;
X{
X	register char *cp;
X	extern char *interp(), *ctrl();
X
X	if (col > 0 && col < MIDDLE)
X		while (col++ < MIDDLE)
X			putchar(' ');
X	col += size(p->v_name);
X	switch (p->v_type&TMASK) {
X
X	case BOOL:
X		if (boolean(p->v_value) == FALSE) {
X			col++;
X			putchar('!');
X		}
X		printf("%s", p->v_name);
X		break;
X
X	case STRING:
X		printf("%s=", p->v_name);
X		col++;
X		if (p->v_value) {
X			cp = interp(p->v_value, NULL);
X			col += size(cp);
X			printf("%s", cp);
X		}
X		break;
X
X	case NUMBER:
X		col += 6;
X		printf("%s=%-5d", p->v_name, number(p->v_value));
X		break;
X
X	case CHAR:
X		printf("%s=", p->v_name);
X		col++;
X		if (p->v_value) {
X			cp = ctrl(character(p->v_value));
X			col += size(cp);
X			printf("%s", cp);
X		}
X		break;
X	}
X	if (col >= MIDDLE) {
X		col = 0;
X		printf("\r\n");
X		return;
X	}
X}
X
X
Xstatic int
Xvaccess(mode, rw)
X	register unsigned mode, rw;
X{
X	if (mode & (rw<<PUBLIC))
X		return (1);
X	if (mode & (rw<<PRIVATE))
X		return (1);
X	return ((mode & (rw<<ROOT)) && getuid() == 0);
X}
X
Xstatic value_t *
Xvlookup(s)
X	register char *s;
X{
X	register value_t *p;
X
X	for (p = vtable; p->v_name; p++)
X		if (equal(p->v_name, s) || (p->v_abrev && equal(p->v_abrev, s)))
X			return (p);
X	return (NULL);
X}
X
Xchar *
Xvinterp(s, stop)
X	register char *s;
X	char stop;
X{
X	register char *p = s, c;
X	int num;
X
X	while ((c = *s++) && c != stop)
X		switch (c) {
X
X		case '^':
X			if (*s)
X				*p++ = *s++ - 0100;
X			else
X				*p++ = c;
X			break;
X
X		case '\\':
X			num = 0;
X			c = *s++;
X			if (c >= '0' && c <= '7')
X				num = (num<<3)+(c-'0');
X			else {
X				register char *q = "n\nr\rt\tb\bf\f";
X
X				for (; *q; q++)
X					if (c == *q++) {
X						*p++ = *q;
X						goto cont;
X					}
X				*p++ = c;
X			cont:
X				break;
X			}
X			if ((c = *s++) >= '0' && c <= '7') {
X				num = (num<<3)+(c-'0');
X				if ((c = *s++) >= '0' && c <= '7')
X					num = (num<<3)+(c-'0');
X				else
X					s--;
X			} else
X				s--;
X			*p++ = num;
X			break;
X
X		default:
X			*p++ = c;
X		}
X	*p = '\0';
X	return (c == stop ? s-1 : NULL);
X}
X
X/*
X * assign variable s with value v (for NUMBER or STRING or CHAR types)
X */
X
Xvstring(s,v)
X	register char *s;
X	register char *v;
X{
X	register value_t *p;
X	char *expand();
X
X	p = vlookup(s); 
X	if (p == 0)
X		return (1);
X	if (p->v_type&NUMBER)
X		vassign(p, atoi(v));
X	else {
X		if (strcmp(s, "record") == 0)
X			v = expand(v);
X		vassign(p, v);
X	}
X	return (0);
X}
END_OF_FILE
if test 5890 -ne `wc -c <'pf-bootstrap-v1.1a/tipx-p1/value.c'`; then
    echo shar: \"'pf-bootstrap-v1.1a/tipx-p1/value.c'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/tipx-p1/value.c'
fi
if test -f 'pf-bootstrap-v1.1a/xmodem-3.9/batch.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pf-bootstrap-v1.1a/xmodem-3.9/batch.c'\"
else
echo shar: Extracting \"'pf-bootstrap-v1.1a/xmodem-3.9/batch.c'\" \(4901 characters\)
sed "s/^X//" >'pf-bootstrap-v1.1a/xmodem-3.9/batch.c' <<'END_OF_FILE'
X/*
X *  Various routines for batch transfer
X */
X
X#include "xmodem.h"
X
X/* make sure filename sent or received in YMODEM batch is canonical. */
X
X/* Incoming: Turn Unix '/' into CP/M ':' and translate to all lower case.
X * Remove trailing dot.
X */
X
Xunixify (name)
Xchar *name;
X	{
X	char *ptr;
X
X	/* change '/' to ':' and convert to lower case */
X	for (ptr=name; *ptr; ++ptr)
X		{
X		if (*ptr == '/')
X			*ptr = ':';
X		if (isupper (*ptr))
X			*ptr |= 040;
X		}
X
X	/* remove trailing dot if present */
X	ptr--;
X	if (*ptr == '.')
X		*ptr = '\0';
X	}
X
X/* make sure filename sent or received in YMODEM batch is canonical. */
X
X/* Outgoing: Turn ':' into '/' (for symmetry!) and turn into all lower case.
X * Remove everything before last '/'.  Use "filename" to hold final name.
X */
X
Xchar *
Xcpmify (name)
Xchar *name;
X	{
X	char *ptr, *slash;
X	char *strcpy();
X
X	/* find last '/' and copy rest of name */
X
X	slash = name;
X	for (ptr=name; *ptr; ++ptr)
X		if (*ptr == '/')
X			slash = ptr + 1;
X	strcpy (filename, slash);
X
X	/* change ':' to '/' and covert to all lower case */
X
X	for (ptr=filename; *ptr; ++ptr)
X		{
X		if (*ptr == ':')
X			*ptr = '/';
X		if (isupper (*ptr))
X			*ptr |= 040;
X		}
X	return (filename);
X	}
X
X
X/* convert a CP/M file name received in a MODEM7 batch transfer
X * into a unix file name mapping '/' into ':', converting to all
X * upper case and adding dot in proper place.  
X * Use "filename" to hold name.
X * Code stolen from D. Thompson's (IRTF) xmodem.c
X */
X
Xchar *
Xcpm_unix (string)
Xunsigned char *string;
X{
X	register int i;
X	unsigned char *iptr, temp;
X	register char *optr;
X
X	if (*string == '\0')
X		error("Null file name in MODEM7 batch receive", TRUE);
X
X	for (iptr=string; (temp = *iptr) ; ) {
X		temp &= 0177;			/* strips bit 7 */
X		if (isupper(temp))
X			temp |= 040;		/* set bit 5 for lower case */
X		if (temp == '/') 
X			temp=':';		/* map / into : */
X		*iptr++ = temp;
X	}
X
X	/* put in main part of name */
X	iptr=string;
X	optr=filename;
X	for (i=0; i<8; i++) {
X		if (*iptr != ' ')
X			*optr++ = *iptr++;
X	}
X
X	/* add dot if necessary */
X	if (string[8] != ' ' || string[9] != ' ' || string[10] != ' ')
X		*optr++ = '.';
X
X	/* put in extension */
X	iptr = &string[8];
X	for (i=0; i<3; i++) {
X		if (*iptr != ' ')
X			*optr++ = *iptr++;
X	}
X
X	*optr++ = '\000';
X	return (filename);
X}
X
X/* Send 11 character CP/M filename for MODEM7 batch transmission
X * Returns -1 for a protocol error; 0 if successful
X * NOTE: we tromp a little on the argument string!
X * code stolen from D. Thompson's (IRTF) xmodem.c
X */
X
Xsend_name(name)
Xchar *name;
X{
X	register int cksum;
X	register char *ptr;
X
X	xmdebug("send_name");
X
X	/* append cp/m EOF */
X	name[NAMSIZ] = CTRLZ;
X	name[NAMSIZ+1] = '\000';
X
X	/* create checksum */
X	ptr = name;
X	cksum = 0;
X	while (*ptr)
X		cksum += *ptr++;
X	cksum &= 0x00FF;
X
X	/* send filename */
X
X	sendbyte(ACK);
X	ptr = name;
X	sendbyte(*ptr++);
X
X	while (*ptr) {
X
X			switch (readbyte(15)) {
X
X			case ACK: break;
X
X			case TIMEOUT: {
X				logit("Timeout while sending MODEM7 filename\n");
X				tlogit("Timeout while sending MODEM7 filename\n");
X				sendbyte(BAD_NAME);
X				return (-1);
X			}
X
X			default: {
X				logit("Error while sending MODEM7 filename\n");
X				tlogit("Error while sending MODEM7 filename\n");
X				sendbyte(BAD_NAME);
X				return (-1);
X			}
X		}	
X
X		sendbyte (*ptr++);
X	}
X
X	/* Check checksum returned by other side against my value */
X	if (readbyte(16) != cksum) {
X		logit("Bad checksum while sending MODEM7 filename\n");
X		tlogit("Bad checksum while sending MODEM7 filename\n");
X		sendbyte(BAD_NAME);
X		return (-1);
X	}
X
X	sendbyte(ACK);
X	return (0);
X}
X
X/* Convert Unix filename to 11 character CP/M file name (8 char name,
X * 3 char extension, dot in between is not included).
X * map ':' into '/'; Use filename to hold name.
X * code stolen from D. Thompson's (IRTF) xmodem.c
X */
X
Xchar *
Xunix_cpm(string)
Xchar *string;
X{
X	register char *iptr, *optr, temp;
X	int i;
X
X	char *rindex();
X	char *strcpy();
X
X	/* blank 11 character name */
X	(void) strcpy (filename,"           ");
X
X	/* strip off any path name */
X	if ((iptr = rindex(string,'/')))
X		iptr++;
X	else
X		iptr=string;
X
X	/* skip leading '.'s */
X	while (*iptr == '.')
X		iptr++;
X
X	/* copy main part of name */
X	optr = filename;
X	i = 8;
X	while ((i--) && (*iptr) && (*iptr != '.'))
X		*optr++ = *iptr++;
X
X	/* advance to unix extension, or end of unix name */
X	while ((*iptr != '.') && (*iptr))
X		iptr++;
X
X	/* skip over the  '.' */
X	while (*iptr == '.')
X		iptr++;
X
X	/* copy extension */
X	optr = &filename[8];
X	i=3;
X	while ((i--) && (*iptr) && (*iptr != '.'))
X		*optr++ = *iptr++;
X
X	filename[NAMSIZ] = '\000';
X
X	/* Fuss with name */
X	for (iptr=filename; (temp = *iptr) ;) {
X		temp &= 0177;			/* strip bit 7 (parity bit) */
X		if (islower(temp))
X			temp &= ~040;		/* make upper case */
X		if (temp == ':')
X			temp ='/';		/* map ':' into '/' */
X		*iptr++ = temp;
X	}
X
X	if (DEBUG)
X		fprintf (LOGFP, "DEBUG: File %s sent as %s\n", string, filename);
X
X	return(filename);
X}
END_OF_FILE
if test 4901 -ne `wc -c <'pf-bootstrap-v1.1a/xmodem-3.9/batch.c'`; then
    echo shar: \"'pf-bootstrap-v1.1a/xmodem-3.9/batch.c'\" unpacked with wrong size!
fi
# end of 'pf-bootstrap-v1.1a/xmodem-3.9/batch.c'
fi
echo shar: End of archive 3 \(of 9\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 9 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

akcs.nt1g@hpcvbbs.UUCP (Skip Flem) (06/12/91)

This has to be the biggest use of ATT time I've ever beenseenm. 
conference or lecture??? Worse than home movies; i.e. I like to 
'READ"' the mail. sooryrry but I'm real bored.