more changes from rick adams.
authorRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Thu, 11 Apr 1985 06:24:01 +0000 (22:24 -0800)
committerRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Thu, 11 Apr 1985 06:24:01 +0000 (22:24 -0800)
SCCS-vsn: usr.bin/uucp/DOC/CHANGES 5.2
SCCS-vsn: usr.bin/uucp/Makefile 5.8
SCCS-vsn: usr.bin/uucp/DOC/README 5.5
SCCS-vsn: usr.bin/uucp/acucntrl/acucntrl.c 5.2
SCCS-vsn: usr.bin/uucp/libuu/anlwrk.c 5.4
SCCS-vsn: usr.bin/uucp/libuu/anyread.c 5.3
SCCS-vsn: usr.bin/uucp/assert.c 5.4
SCCS-vsn: usr.bin/uucp/libuu/chkpth.c 5.3
SCCS-vsn: usr.bin/uucp/uucico/cico.c 5.6
SCCS-vsn: usr.bin/uucp/uucico/cntrl.c 5.5
SCCS-vsn: usr.bin/uucp/uucico/condevs.c 5.9
SCCS-vsn: usr.bin/uucp/includes/condevs.h 4.2
SCCS-vsn: usr.bin/uucp/uucico/conn.c 5.5
SCCS-vsn: usr.bin/uucp/libuu/expfile.c 5.4
SCCS-vsn: usr.bin/uucp/uucico/gio.c 5.3
SCCS-vsn: usr.bin/uucp/libuu/logent.c 5.4
SCCS-vsn: usr.bin/uucp/libuu/mailst.c 5.4
SCCS-vsn: usr.bin/uucp/uucico/pk.h 5.3
SCCS-vsn: usr.bin/uucp/uucico/pk0.c 5.3
SCCS-vsn: usr.bin/uucp/uucico/pk1.c 5.3
SCCS-vsn: usr.bin/uucp/libuu/subdir.c 5.3
SCCS-vsn: usr.bin/uucp/libuu/systat.c 5.3
SCCS-vsn: usr.bin/uucp/uucico/tio.c 4.2
SCCS-vsn: usr.bin/uucp/libuu/ulockf.c 5.3
SCCS-vsn: usr.bin/uucp/uuclean/uuclean.c 5.4
SCCS-vsn: usr.bin/uucp/uucp/uucp.c 5.3
SCCS-vsn: usr.bin/uucp/includes/uucp.h 5.6
SCCS-vsn: libexec/uucpd/uucpd.c 5.3
SCCS-vsn: usr.bin/uucp/libuu/uucpdefs.c 5.3
SCCS-vsn: usr.bin/uucp/libuu/uucpname.c 5.3
SCCS-vsn: usr.bin/uudecode/uudecode.c 5.3
SCCS-vsn: usr.bin/uucp/uulog/uulog.c 5.3
SCCS-vsn: usr.bin/uucp/uupoll/uupoll.c 5.3
SCCS-vsn: usr.bin/uucp/uuq/uuq.c 4.2
SCCS-vsn: usr.bin/uucp/uusnap/uusnap.c 5.4
SCCS-vsn: usr.bin/uucp/uux/uux.c 5.3
SCCS-vsn: usr.bin/uucp/uuxqt/uuxqt.c 5.5
SCCS-vsn: usr.bin/uucp/libuu/versys.c 5.3

38 files changed:
usr/src/libexec/uucpd/uucpd.c
usr/src/usr.bin/uucp/DOC/CHANGES
usr/src/usr.bin/uucp/DOC/README
usr/src/usr.bin/uucp/Makefile
usr/src/usr.bin/uucp/acucntrl/acucntrl.c
usr/src/usr.bin/uucp/assert.c
usr/src/usr.bin/uucp/includes/condevs.h
usr/src/usr.bin/uucp/includes/uucp.h
usr/src/usr.bin/uucp/libuu/anlwrk.c
usr/src/usr.bin/uucp/libuu/anyread.c
usr/src/usr.bin/uucp/libuu/chkpth.c
usr/src/usr.bin/uucp/libuu/expfile.c
usr/src/usr.bin/uucp/libuu/logent.c
usr/src/usr.bin/uucp/libuu/mailst.c
usr/src/usr.bin/uucp/libuu/subdir.c
usr/src/usr.bin/uucp/libuu/systat.c
usr/src/usr.bin/uucp/libuu/ulockf.c
usr/src/usr.bin/uucp/libuu/uucpdefs.c
usr/src/usr.bin/uucp/libuu/uucpname.c
usr/src/usr.bin/uucp/libuu/versys.c
usr/src/usr.bin/uucp/uucico/cico.c
usr/src/usr.bin/uucp/uucico/cntrl.c
usr/src/usr.bin/uucp/uucico/condevs.c
usr/src/usr.bin/uucp/uucico/conn.c
usr/src/usr.bin/uucp/uucico/gio.c
usr/src/usr.bin/uucp/uucico/pk.h
usr/src/usr.bin/uucp/uucico/pk0.c
usr/src/usr.bin/uucp/uucico/pk1.c
usr/src/usr.bin/uucp/uucico/tio.c
usr/src/usr.bin/uucp/uuclean/uuclean.c
usr/src/usr.bin/uucp/uucp/uucp.c
usr/src/usr.bin/uucp/uulog/uulog.c
usr/src/usr.bin/uucp/uupoll/uupoll.c
usr/src/usr.bin/uucp/uuq/uuq.c
usr/src/usr.bin/uucp/uusnap/uusnap.c
usr/src/usr.bin/uucp/uux/uux.c
usr/src/usr.bin/uucp/uuxqt/uuxqt.c
usr/src/usr.bin/uudecode/uudecode.c

index d56b1a5..03123b8 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uucpd.c    5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uucpd.c    5.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -10,7 +10,6 @@ static char sccsid[] = "@(#)uucpd.c   5.2 (Berkeley) %G%";
 #include "uucp.h"
 #include <signal.h>
 #include <errno.h>
 #include "uucp.h"
 #include <signal.h>
 #include <errno.h>
-#include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <netinet/in.h>
@@ -29,8 +28,10 @@ main(argc, argv)
 int argc;
 char **argv;
 {
 int argc;
 char **argv;
 {
+#ifndef BSDINETD
        register int s, tcp_socket;
        struct servent *sp;
        register int s, tcp_socket;
        struct servent *sp;
+#endif !BSDINETD
        extern int errno;
        int dologout();
 
        extern int errno;
        int dologout();
 
@@ -95,13 +96,13 @@ char **argv;
 doit(sinp)
 struct sockaddr_in *sinp;
 {
 doit(sinp)
 struct sockaddr_in *sinp;
 {
-       char ebuf[32];
        char user[64];
        char passwd[64];
        char *xpasswd, *crypt();
        struct passwd *pw, *getpwnam();
 
        alarm(60);
        char user[64];
        char passwd[64];
        char *xpasswd, *crypt();
        struct passwd *pw, *getpwnam();
 
        alarm(60);
+       printf("login: "); fflush(stdout);
        if (readline(user, sizeof user) < 0) {
                fprintf(stderr, "user read\n");
                return;
        if (readline(user, sizeof user) < 0) {
                fprintf(stderr, "user read\n");
                return;
@@ -118,6 +119,7 @@ struct sockaddr_in *sinp;
                return;
        }
        if (pw->pw_passwd && *pw->pw_passwd != '\0') {
                return;
        }
        if (pw->pw_passwd && *pw->pw_passwd != '\0') {
+               printf("Password: "); fflush(stdout);
                if (readline(passwd, sizeof passwd) < 0) {
                        fprintf(stderr, "passwd read\n");
                        return;
                if (readline(passwd, sizeof passwd) < 0) {
                        fprintf(stderr, "passwd read\n");
                        return;
@@ -139,8 +141,8 @@ struct sockaddr_in *sinp;
 }
 
 readline(p, n)
 }
 
 readline(p, n)
-       register char *p;
-       register int n;
+register char *p;
+register int n;
 {
        char c;
 
 {
        char c;
 
index 5bad69b..6de80e7 100644 (file)
 List of Changes to UUCP
 List of Changes to UUCP
-CHANGES        5.1     83/07/02
-This is a list of changes made to the base version of uucp.
-An attempt is made to justify the changes made.
-This list may be useful to those implementing yet better versions.
-       Tom Truscott
-
-anlwrk.c: lots of changes. See the comments at the top.
-       Main efficiency improvement: eliminate stat(II)s.
-       Main bug fix: avoid sending files to wrong system.
-
-Uses Berkeley 4.2bsd directory reading subroutines.
-       Useful if someone wants to run this uucp under 4.2bsd.
-
-Added uucp subdirectories.  See 'README' or 'INSTALL' for details.
-       Subdirectories are enabled by #define-ing UUDIR in uucp.h.
-       No more assembler code needed.
-       grep UUDIR *.[hc]  to see how it is implemented.
-
-Times of form 'hh:mm' are uniformly printf-ed with "%d:%02d".
-       The %02d guarantees a 2 digit number w/ leading zero if needed.
-
-uucp work files (e.g. spool files) are created with umask==WFMASK (uucp.h).
-WFMASK can disable reading by 'others'.  In fact that is the default,
-which might be annoying, but you can change it.
-LOG files (LOGFILE, SYSLOG, ERRLOG) are created with umask=LOGMASK (uucp.h),
-which as distributed permits general read access to avoid loud user screams.
-User files are created with mode (not umask!) at least BASEMODE (uucp.h)
-and possibly with more permissions if the user so specified.
-To avoid loud user screams, BASEMODE should probably be 666
-since uucp-created files are owned by uucp.
-
-chkpth.c: uses dynamic allocation due to Doug Kingston.
-       chkpth() and chkperm() are no longer called for vanilla
-       Spool area requests, so they can be made 'tougher'.
-       These routines, and how they are used, is a bleak area
-       of uucp that should be scrapped and redone coherently.
-
-#define for SYSIII added.  The idea is to have code that runs
-on SYSIII etc. as well as v7, 32V, 4.1bsd, etc.
-However it has never been tested and surely won't work.
-
-cntrl.c: lots off changes here.  Mostly performance enhancements.
-       Bypasses chkpth/chkperm/anyread checks for vanilla spool files.
-       No longer logs 'COPY SUCCEEDED' in LOGFILE, only failures.
-       (Still logs request data. And SYSLOG still logs file transfers.)
-       Has 'PATIENCE' when shipping huge files (this partially works,
-       the huge file gets over okay, and is signed off, but the
-       next attempted transfer fails.  Not catastrophic, but not nice.)
-       Cranks up a uuxqt each time ten 'X' files have gone past
-       (to avoid collecting 100+ X files before uuxqt starts!)
-       ultouch() is called only rarely.  A missing chmod after an 'xmv'
-       has been added.  Due to the extra diligence in chkperm, etc.
-       the old 'put files in /usr/spool/uucppublic' may no longer
-       work "right".  Sorry, but I am not sure how it is supposed to work.
-       I will look into this someday, sooner if it is an actual problem.
-
-vectors/buffers for L.sys lines increased in versys.c and conn.c
-to permit 1000 char lines and 100 'fields' on a line.
-
-conn.c:        obscure changes here, mostly in the send/expect sequence.
-       File descriptor prediction implemented (not tested!),
-       extremely obscure problem apparently first noted by Steve Bellovin.
-       Default end of 'send' string is \r, not \n.
-       PAUSE5 pauses 5 seconds.  \d pauses 1 second (\d\d\d\d\d pauses 5).
-       foo\c  sends 'foo' with no ending \r.  \05 sends control-e.
-       \s sends a space (so does \40). CR sends a \r, LF sends \n.
-       "" sends a \r.  Output is in even parity, changable with send strings
-       P_ZERO, P_EVEN, P_ODD, P_ONE.  BREAK sends a break (or simulates one).
-       And expect string of "" expects nothing, just returns, so
-       to send an initial \r one can just do
-               "" ""   ogin:--ogin:
-       to poke the remote site into sending a login message.
-       Send strings are only printed in debug if uid <= PRIV_UIDS (uucp.h).
-
-       Alan Watt's date changes were in decvax, but should mentioned here.
-       Except I am not sure how they work.  Look near the end of conn.c.
-
-expfile() returns 0 if the expanded file is a vanilla spool file.
-       That way chkpth/chkperm can be bypassed, and those routines
-       can have several huge loopholes removed.
-
-gename.c has Alan Watt's (a) base 62 sequence numbering and (b)
-       greatly reduced locking rate.
-       The comments at the top describe it fairly well.
-       It looks awful, but just use it.  It works.
-
-gio.c: ultouch() is called occasionally (kludge!)
-       IO errors are checked for.
-gnsys.c        calls each system only once in a uucico session.
-       Also, calls callok() only once for each system.
-       I forget how that works.
-
-imsg.c:        strips parity bits, in case the incoming chars have some.
-
-logent.c:      greatly simplified!  Justs opens LOGFILE for append
-       and then seeks to end and writes each new entry.
-       Can cause scrambling on systems w/o guaranteed append-to-end,
-       but is too good a speedup to pass up.
-
-pk.c:  check-summing is done correctly on machines which do not
-       sign-extend characters.  Time-outs made more generous.
-
-lint:  The code has been de-linted as best I could.
-       uucp.h contains lots of declarations of functions which
-       return non-int, like strcpy(), etc.
+CHANGES        5.2     85/04/10
 
 
-uucplock.c:
-       ultouch() changed to be done only occasionally.
-       Only changes st_ctime, not atime or mtime,
-       so programs can be written to display time spent locked.
+Added support for Eunice.
 
 
-uucp:  uucp x foo!y  causes a uucico to call only system foo,
-       not a uucico to try to call everyone with spooled work.
-
-uucp.h:        unused #defines have been removed.
+Added new dialers:
+       Racal Vadic 212
+       Racal Vadic 811 dialer with 831 adaptor
+       Racal Vadic 820 dialer with 831 adaptor
+       Racal Vadic MACS, 811 dialer with 831 adaptor
+       Racal Vadic MACS, 820 dialer with 831 adaptor
+       4.2BSD style networking on top of tcp/ip ('t' protocol)
+       X.25/PAD support ('f' protocol)
+       Novation
 
 
-uulog.c:       greatly simplied, since logent.c is greatly simplied.
-       Only used in forms 'uulog -u user' and 'uulog -s system'.
-       Also, 'uulog -uuser' and 'uulog -ssystem' are permitted.
-       And both options may be specifed. None is an error.
+Running uucico with debugging on requires read access to L.sys.
+
+If "NOSTRANGERS" is defined in uucp.h, the remote site
+must be in you L.sys or the call will be rejected.
 
 
-uux:   -g<g> option added to specify priority grade.
-       -c option does not copy.  -l is a synonym.
-       'X' files use local system name to avoid possible name conflict.
-       uucico cranked up calls only target system, not everyone.
+Lock files may be kept in a subdirectory if desired.
 
 
-uuxqt: reads commands from /usr/lib/uucp/L.cmds.
-       A line of form 'PATH=...' changes the command search path.
+STST files are kept in a subdirectory.
 
 
-uucpname.c:    A real kludge went here.
-       On some UNIX systems, a program's set-user-id bit is ignored
-       if the invoker is root.  But then uucp would create files
-       owned by root, and if not generally writable uucp
-       would later be unable to write on them (e.g. LOGFILE).
-       So uucpname, since it is called at the start of
-       every relevant uucp program, checks for getuid()==geteuid()==0
-       in which case it changes its uid/gid to that of the owner of
-       the file /usr/lib/uucp/uucico.
+CORRUPT subdirectory contains corrupted C. and X. files that could
+not be processed. (Instead of just exiting)
 
 
-Debugging mode is permitted only to invokers with uid <= PRIV_UIDS.
+You can specify a maximum grade to send either on the command line (-gX)
+or in the L.sys file (Any@C|Evening will only send class C [usually
+mail] or higher during the day and will send everything in the evening)
+See UUAIDS/L.sys for examples.
 
 
-dialout.c routine has dialend() routine which is called to hang up.
-Tue Mar 29 16:25:01 EST 1983
+L.sys (and any of the files in lib/uucp) can contain comments by
+putting a # as the first character on a line. Lines may be
+continued by placing a \ as the last character of the line.
 
 
-Makefile: GROUP variable added so file OWNER and GROUP are both set correctly.
-uuxqt/uucico/uuclean are no longer executable by 'others'.
+-R flag reverses role. (Lets the remote system be master first instead
+of slave)
 
 
-uucp.h: PRIV_UIDS reduced to 3 to reduce security danger.
+-L flag only calls "local" sites. Local sites are those sites having
+one of LOCAL,TCP or DIRECT in the ACU field of L.sys.
 
 
-cico.c: cleanup() ioctl(II)s changed to avoid hang-up on Gould/SEL machine.
+If /etc/nologin is present (usually created by a graceful shutdown),
+uucico and uuxqt will gracefully exit instead of getting killed
+off when the system goes down.
 
 
-anlwrk.c: Infinite loop check was buggy, causing occasional,
-sometimes persistent, 'NO WORK' messages.  Simpler method now used.
+Does an exponential backoff on retry time if call fails instead
+of always waiting the default 5 minutes. The default may be
+overridden by adding ",TIME" to the time field in L.sys. e.g.
+"seismo Any,2" will use a default retry time of 2 minutes.
 
 
-conn.c: dialout() argument format changed to support variant dialers.
-Also, #defines added to support different UNIX-es understanding
-of different baud rates.
+If uucico receives a SIGFPE while running, it will toggle debugging
+on and off.
 
 
-Compatibility mods:
-#include <ascii.h> in dialout.c now deleted.  ncsu!mcm
-       (Mike Mitchell)
+Better status messages provided for uustat.
 
 
-System V compatibility mods.  burl!lda, Larry Auton
-PATH=... in Makefile changed to APATH=... .
+New program uuq to give more decriptive information on status of
+jobs in uucp queue.
 
 
-FIOCLEX added to prevent ACU/communication files being inherited by children.
+Don't send files to remote system if it is returning out of
+temp space error.
 
 
-Files cleaned up (register variables added) by Mike Mitchell (ncsu!mcm).
+Correctly does the closing hangup sequence.
 
 
-u[bs]_sst.c, us_rrs.c: "a+" fopen mode changed to "r+".  NOTE:
-       uusub, uustat are not claimed to work in this version.
-       Further, "r+" does not work in 4.1bsd or 32V.
+condevs.c was broken into a file for each dialer in the
+directory aculib for much easier maintenance.
 
 
-cntrl.c calls wait(II) after uuxqt()s are started, to avoid
-filling the proc table with zombies.
+Only try at most TRYCALLS to dial a site instead of one try
+for each dialer (lost big on systems with many dialers)
 
 
-uuxqt now sorts "X" files to keep execution in order.
+Add ABORT sequence to the expect/send sequence so don't have
+to wait for timeout if can't get through dataswitch. e.g.
+       noao Evening ACU 1200 6021234565 "" \d\r CLASS NOAOUUCP ABORT Down GO \d\r ogin:-\b-ogin: uucplogin word: uucppassword
+will only call noao in the evening (evening is defined by the phone rates).
+It will expect nothing and then wait 1 second (\d) and send a carriage return.
+Look for CLASS, then send NOAOUUCP. From then on, if it sees the word Down
+before finishing logging in, it will hang up immediately. In the mean time,
+it looks for GO and if it sees it, delays 1 second and sends a CR. Looks
+for ogin:, etc. This abort sequence is very useful if you must go through a 
+dataswitch to get to the computer.
 
 
-setline.c: fixes for 'system III' sites.  NOT TESTED.
+The time field in L.sys now handles "Evening" and "Night" in addition
+to Any, Mo,Tu,We,Th,Fr,Sa,Su. Evening and Night are defined to
+be when the phone rates are cheaper.
+       Evening = Wk1700-0800|Sa|Su
+       Night = Any2300-0800|Sa|Su0800-1700
 
 
-gwd.c: The pwd(I) is run with effective uid reverted to the real uid.
+The expect/send code now supports:
+       \s      space
+       \d      delay 1 second
+       \r      carriage return with no linefeed
+       \b      break
+       \c      don't send a CR after these characters
+       \xxx    the octal character xxx (e.g. \s == \040
 
 
-logent also prints to stderr if debugging is on
+L-devices now handles "chat" scripts (like HoneyDanber) to get
+through local port selectors and smart modems more easily
+without mucking up every line of L.sys. See UUAIDs/L-devices for
+details.
 
 
-UNET channel added.  Still running slowly, though.
+The 'g'  protocol code was clean up a lot and is now almost
+readable.
 
 
-Changed XQTDIR from /usr/lib/uucp/.XQTDIR to /usr/spool/uucp/XTMP.
+If you need a parity other than even (the default) to login to
+another system, you can change it in L.sys by putting in a
+sequence like "" P_ZERO (expect nothing, send zero parity).
+       Odd Parity      P_ODD
+       Even Parity     P_EVEN
+       Zero Parity     P_ZERO
+       One Parity      P_ONE
 
 
-Add gethostname().
+If DONTCOPY is defined in uucp.h, uucp will not make a copy
+of the source file by default. (This is the way System 3 does it).
 
 
-Add SYSFILECR.
+If an X. request fails, the notification is returned to the
+originator of the request instead of "uucp" on the previous
+system. 
 
 
-sysexits.h added
+The man pages are actually accurate!
+
+If LOGBYSITE is defined, uucp logging is done with
+a log file per site instead of one LOGFILE. (Like Honey DanBer does)
+
+There is a new file (optional) L.aliases that makes life simpler when
+a site changes it's name. uucp, uux, uucico, etc all check it so 
+when a site is renamed (e.g convex <- parsec) all you have to do is add
+an entry in L.aliases of the form:
+newname oldname
+
+uucico will not try and resend files it has already sent (when the
+files are specified in one C. file)
+
+Incorporated Bill Sebok's code to dial in and out on the same modem.
index af1782e..c77d2eb 100644 (file)
@@ -1,5 +1,5 @@
 INSTALLATION GUIDE
 INSTALLATION GUIDE
-README 5.4     85/01/28
+README 5.5     85/04/10
 
 This version is based on the "rti uucp" that was on the 4.2BSD tape.
 It contains many additional  features and fixes from Usenet,
 
 This version is based on the "rti uucp" that was on the 4.2BSD tape.
 It contains many additional  features and fixes from Usenet,
@@ -15,20 +15,21 @@ to something like:
        #       A=uux - -r $h!rmail ($u)
        Muucp, P=/usr/bin/uux, F=sDFMhuU, S=13, R=23, M=100000,
                A=uux - -r -z -a$f -gC $h!rmail ($u)
        #       A=uux - -r $h!rmail ($u)
        Muucp, P=/usr/bin/uux, F=sDFMhuU, S=13, R=23, M=100000,
                A=uux - -r -z -a$f -gC $h!rmail ($u)
+
 The -a$f provides a return address in case mail fails (So It
 won't go to yourmachine!uucp anymore.) The -gC specifies a grade
 for mail. C is a good choice for mail. News should run at 'd'. This
 way, mail gets sent before news.
 
 The man pages now describe all the options for the various commands.
 The -a$f provides a return address in case mail fails (So It
 won't go to yourmachine!uucp anymore.) The -gC specifies a grade
 for mail. C is a good choice for mail. News should run at 'd'. This
 way, mail gets sent before news.
 
 The man pages now describe all the options for the various commands.
-make sure you read them. A complete list of differences is too big to consider.
+Make sure you read them. A list of the functional differences is in "Changes".
 
 You should also look through the UUAIDS directory. There are some useful
 programs and hints therein.
 
 Rick Adams
 rick@seismo.ARPA
 
 You should also look through the UUAIDS directory. There are some useful
 programs and hints therein.
 
 Rick Adams
 rick@seismo.ARPA
-January 14, 1985
+March 4, 1985
 
 Tom Truscott, rti!trt,decvax!duke!trt (919)541-6488 Research Triangle Institute
 Bob Gray, gray@berkeley, duke!adiron!bob (315) 336-4989
 
 Tom Truscott, rti!trt,decvax!duke!trt (919)541-6488 Research Triangle Institute
 Bob Gray, gray@berkeley, duke!adiron!bob (315) 336-4989
index 0c9e755..e896039 100644 (file)
@@ -1,4 +1,4 @@
-#      Makefile        5.7     85/01/22
+#      Makefile        5.8     85/04/10
 #
 # This version expects the 4.2BSD directory reading routines to
 # located in libc.a.  If they aren't, augment LIBS.  Also, LIBS
 #
 # This version expects the 4.2BSD directory reading routines to
 # located in libc.a.  If they aren't, augment LIBS.  Also, LIBS
@@ -7,14 +7,14 @@
 #
 # Common object files are assembled into a library {uulib.a}
 #
 #
 # Common object files are assembled into a library {uulib.a}
 #
-ALL=   uucp uux uuxqt uucico uulog uuclean uuname uupoll uusnap \
-       uuencode uudecode uusend uucpd uuq
+ALL=   uucico uucp uux uuxqt uulog uuclean uuname uupoll uusnap \
+       uuencode uudecode uusend uucpd uuq acucntrl
 # Common object files placed in uulib.a
 COMMON=        anlwrk.o anyread.o assert.o cfgets.o chkpth.o \
        cpmv.o expfile.o gename.o getargs.o getprm.o \
        getpwinfo.o gio.o gnamef.o gnxseq.o gwd.o imsg.o \
        lastpart.o logent.o mailst.o pk0.o chksum.o pk1.o prefix.o \
 # Common object files placed in uulib.a
 COMMON=        anlwrk.o anyread.o assert.o cfgets.o chkpth.o \
        cpmv.o expfile.o gename.o getargs.o getprm.o \
        getpwinfo.o gio.o gnamef.o gnxseq.o gwd.o imsg.o \
        lastpart.o logent.o mailst.o pk0.o chksum.o pk1.o prefix.o \
-       setline.o shio.o subdir.o sysacct.o systat.o \
+       setline.o subdir.o sysacct.o systat.o \
        ulockf.o \
        uucpname.o versys.o xqt.o uucpdefs.o tio.o fio.o
 
        ulockf.o \
        uucpname.o versys.o xqt.o uucpdefs.o tio.o fio.o
 
@@ -24,14 +24,14 @@ SRCS=       anlwrk.c anyread.c assert.c cfgets.c chkpth.c chksum.c \
        gio.c gnamef.c gnsys.c gnxseq.c gwd.c imsg.c \
        ioctl.c lastpart.c logent.c mailst.c ndir.h \
        pk.h pk0.c pk1.c pkon.c prefix.c \
        gio.c gnamef.c gnsys.c gnxseq.c gwd.c imsg.c \
        ioctl.c lastpart.c logent.c mailst.c ndir.h \
        pk.h pk0.c pk1.c pkon.c prefix.c \
-       setline.c shio.c subdir.c sysacct.c systat.c tio.c fio.c\
+       setline.c subdir.c sysacct.c systat.c tio.c fio.c\
        ulockf.c \
        uuclean.c uucp.c uucp.h uucpdefs.c uucpname.c uudecode.c \
        uuencode.c uulog.c uuname.c uupoll.c uusend.c uusnap.c \
        uux.c uuxqt.c \
        ulockf.c \
        uuclean.c uucp.c uucp.h uucpdefs.c uucpname.c uudecode.c \
        uuencode.c uulog.c uuname.c uupoll.c uusend.c uusnap.c \
        uux.c uuxqt.c \
-       versys.c xqt.c uuq.c
+       versys.c xqt.c uuq.c acucntrl.c
 #These might be useful on non 4.2bsd systems.
 #These might be useful on non 4.2bsd systems.
-MISC= htonl.c ioctl.c index.c
+MISC= htonl.c ioctl.c index.c mkdir.c
 
 DESTDIR=
 OWNER= uucp
 
 DESTDIR=
 OWNER= uucp
@@ -46,13 +46,14 @@ SPOOL=      ${DESTDIR}/usr/spool/uucp
 XQTDIR=        ${SPOOL}/XTMP
 CORRUPT= ${SPOOL}/CORRUPT
 AUDIT= ${SPOOL}/AUDIT
 XQTDIR=        ${SPOOL}/XTMP
 CORRUPT= ${SPOOL}/CORRUPT
 AUDIT= ${SPOOL}/AUDIT
-LCK=   #${SPOOL}/LCK.
+LCK=   ${SPOOL}/LCK
+LOG=   ${SPOOL}/LOG
 STST=  ${SPOOL}/STST
 STST=  ${SPOOL}/STST
-# The six subdirs {not counting XTMP}.  The order of the D. files is crucial!
+# The six subdirs {not counting XTMP}.
 SUBDIRS=C. D.`uuname -l`X D.`uuname -l` D. X. TM.
 # for make depend
 UNDEF= -UNDIR -UUNET -USYSIII -UUNAME -UCCWHOAMI -UGETMYHNAME -UDATAKIT \
 SUBDIRS=C. D.`uuname -l`X D.`uuname -l` D. X. TM.
 # for make depend
 UNDEF= -UNDIR -UUNET -USYSIII -UUNAME -UCCWHOAMI -UGETMYHNAME -UDATAKIT \
-       -UBSD4_2
+       -UBSD4_2 -UUSG -UVMS
 
 all:   ${ALL} 
 
 
 all:   ${ALL} 
 
@@ -104,16 +105,23 @@ uucpd: uucpd.o uucp.h
 uuq: uuq.o uulib.a
        ${CC} -o uuq ${LDFLAGS} uuq.o uulib.a
 
 uuq: uuq.o uulib.a
        ${CC} -o uuq ${LDFLAGS} uuq.o uulib.a
 
+acucntrl: acucntrl.o
+       ${CC} -o acucntrl ${LDFLAGS} acucntrl.o
+
 # Note: mode 700 on ${LIBDIR} would be safer.
 # Also,  L.sys etc should be 600.
 
 mkdirs:
        -for i in ${LIBDIR} ${SPOOL} ${PUBDIR} ${XQTDIR} ${CORRUPT} \
 # Note: mode 700 on ${LIBDIR} would be safer.
 # Also,  L.sys etc should be 600.
 
 mkdirs:
        -for i in ${LIBDIR} ${SPOOL} ${PUBDIR} ${XQTDIR} ${CORRUPT} \
-               ${AUDIT} ${LCK} ${STST} ; do \
+               ${AUDIT} ${LCK} ${LOG} ${STST} ; do \
                rm -f $$i ; mkdir $$i ; \
                chmod 755 $$i; chown ${OWNER} $$i; chgrp ${GROUP} $$i ; \
        done
        chmod 777 ${PUBDIR} ${LCK}
                rm -f $$i ; mkdir $$i ; \
                chmod 755 $$i; chown ${OWNER} $$i; chgrp ${GROUP} $$i ; \
        done
        chmod 777 ${PUBDIR} ${LCK}
+       -cd ${LOG}; for i in uucico uux uuxqt uucp xferstats; do\
+               rm -f $$i ; mkdir $$i ; \
+               chmod 755 $$i; chown ${OWNER} $$i; chgrp ${GROUP} $$i ; \
+       done
        -cd ${SPOOL}; for i in ${SUBDIRS} ; do \
                mkdir $$i; \
                chown ${OWNER} $$i; chgrp ${GROUP} $$i; chmod 755 $$i; \
        -cd ${SPOOL}; for i in ${SUBDIRS} ; do \
                mkdir $$i; \
                chown ${OWNER} $$i; chgrp ${GROUP} $$i; chmod 755 $$i; \
@@ -127,9 +135,9 @@ uulib.a: ${COMMON}
        ranlib $@
 
 aculib/aculib.a:
        ranlib $@
 
 aculib/aculib.a:
-       cd aculib; make
+       cd aculib; make ${MFLAGS} "CFLAGS=${CFLAGS}"
 
 
-install:
+install: ${ALL}
        chown ${OWNER} ${LIBDIR}
        chgrp ${GROUP} ${LIBDIR}
        chmod 755 ${LIBDIR}
        chown ${OWNER} ${LIBDIR}
        chgrp ${GROUP} ${LIBDIR}
        chmod 755 ${LIBDIR}
@@ -142,14 +150,14 @@ install:
        rm -f ${BIN}/ruusend
        ln ${BIN}/uusend ${BIN}/ruusend
        install -s -m 6110 -o ${OWNER} -g ${GROUP} uuxqt ${LIBDIR}
        rm -f ${BIN}/ruusend
        ln ${BIN}/uusend ${BIN}/ruusend
        install -s -m 6110 -o ${OWNER} -g ${GROUP} uuxqt ${LIBDIR}
+       install -s -m 6110 -o root -g ${GROUP} acucntrl ${LIBDIR}
        install -s -m 700 -o root uucpd /etc/uucpd
        install -s -m 700 -o root uucpd /etc/uucpd
-       @echo Dont forget to fork off /etc/uucpd in /etc/rc.local
        install -s uuencode ${BIN}
        install -s uudecode ${BIN}
 
 clean:
        rm -f *.o ${ALL} uulib.a
        install -s uuencode ${BIN}
        install -s uudecode ${BIN}
 
 clean:
        rm -f *.o ${ALL} uulib.a
-       cd aculib; make clean
+       cd aculib; make ${MFLAGS} clean
 
 depend:
        for i in *.c; do \
 
 depend:
        for i in *.c; do \
@@ -172,6 +180,8 @@ depend:
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 # DEPENDENCIES MUST END AT END OF FILE
 
 # DO NOT DELETE THIS LINE -- make depend uses it
 # DEPENDENCIES MUST END AT END OF FILE
+acucntrl.o: acucntrl.c
+acucntrl.o: uucp.h
 anlwrk.o: anlwrk.c
 anlwrk.o: uucp.h
 anlwrk.o: uust.h
 anlwrk.o: anlwrk.c
 anlwrk.o: uucp.h
 anlwrk.o: uust.h
@@ -191,7 +201,7 @@ cntrl.o: cntrl.c
 cntrl.o: uucp.h
 cntrl.o: uust.h
 condevs.o: condevs.c
 cntrl.o: uucp.h
 cntrl.o: uust.h
 condevs.o: condevs.c
-condevs.o: uucp.h
+condevs.o: condevs.h
 conn.o: conn.c
 conn.o: uucp.h
 cpmv.o: cpmv.c
 conn.o: conn.c
 conn.o: uucp.h
 cpmv.o: cpmv.c
@@ -203,13 +213,13 @@ fio.o: uucp.h
 gename.o: gename.c
 gename.o: uucp.h
 getargs.o: getargs.c
 gename.o: gename.c
 gename.o: uucp.h
 getargs.o: getargs.c
-getopt.o: getopt.c
+getargs.o: uucp.h
 getprm.o: getprm.c
 getpwinfo.o: getpwinfo.c
 getpwinfo.o: uucp.h
 gio.o: gio.c
 getprm.o: getprm.c
 getpwinfo.o: getpwinfo.c
 getpwinfo.o: uucp.h
 gio.o: gio.c
-gio.o: pk.h
 gio.o: uucp.h
 gio.o: uucp.h
+gio.o: pk.h
 gnamef.o: gnamef.c
 gnamef.o: uucp.h
 gnsys.o: gnsys.c
 gnamef.o: gnamef.c
 gnamef.o: uucp.h
 gnsys.o: gnsys.c
@@ -220,6 +230,7 @@ gwd.o: gwd.c
 gwd.o: uucp.h
 imsg.o: imsg.c
 imsg.o: uucp.h
 gwd.o: uucp.h
 imsg.o: imsg.c
 imsg.o: uucp.h
+index.o: index.c
 ioctl.o: ioctl.c
 ioctl.o: uucp.h
 lastpart.o: lastpart.c
 ioctl.o: ioctl.c
 ioctl.o: uucp.h
 lastpart.o: lastpart.c
@@ -227,16 +238,16 @@ logent.o: logent.c
 logent.o: uucp.h
 mailst.o: mailst.c
 mailst.o: uucp.h
 logent.o: uucp.h
 mailst.o: mailst.c
 mailst.o: uucp.h
+mkdir.o: mkdir.c
 pk0.o: pk0.c
 pk0.o: pk0.c
+pk0.o: uucp.h
 pk0.o: pk.h
 pk1.o: pk1.c
 pk0.o: pk.h
 pk1.o: pk1.c
-pk1.o: pk.h
 pk1.o: uucp.h
 pk1.o: uucp.h
+pk1.o: pk.h
 prefix.o: prefix.c
 setline.o: setline.c
 setline.o: uucp.h
 prefix.o: prefix.c
 setline.o: setline.c
 setline.o: uucp.h
-shio.o: shio.c
-shio.o: uucp.h
 subdir.o: subdir.c
 subdir.o: uucp.h
 sysacct.o: sysacct.c
 subdir.o: subdir.c
 subdir.o: uucp.h
 sysacct.o: sysacct.c
index be55b1e..4451c98 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)acucntrl.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)acucntrl.c 5.2 (Berkeley) %G%";
 #endif
 
 /*  acucntrl - turn around tty line between dialin and dialout
 #endif
 
 /*  acucntrl - turn around tty line between dialin and dialout
@@ -46,14 +46,14 @@ static char sccsid[] = "@(#)acucntrl.c      5.1 (Berkeley) %G%";
 /* #define SENSECARRIER */
 
 #include "uucp.h"
 /* #define SENSECARRIER */
 
 #include "uucp.h"
-#include <sys/param.h>
 #include <sys/buf.h>
 #include <sys/buf.h>
+#include <signal.h>
 #include <sys/conf.h>
 #ifdef BSD4_2
 #include "/sys/vaxuba/ubavar.h"
 #include <sys/conf.h>
 #ifdef BSD4_2
 #include "/sys/vaxuba/ubavar.h"
-#else !BSD4_2
+#else
 #include <sys/ubavar.h>
 #include <sys/ubavar.h>
-#endif !BSD4_2
+#endif
 #include <sys/stat.h>
 #include <nlist.h>
 #include <sgtty.h>
 #include <sys/stat.h>
 #include <nlist.h>
 #include <sgtty.h>
@@ -117,8 +117,8 @@ char usage[] = "Usage: acucntrl {dis|en}able ttydX\n";
 struct utmp utmp;
 char resettty, resetmodem;
 int etcutmp;
 struct utmp utmp;
 char resettty, resetmodem;
 int etcutmp;
-int utmploc;
-int ttyslnbeg;
+off_t utmploc;
+off_t ttyslnbeg;
 
 #define NAMSIZ sizeof(utmp.ut_name)
 #define        LINSIZ  sizeof(utmp.ut_line)
 
 #define NAMSIZ sizeof(utmp.ut_name)
 #define        LINSIZ  sizeof(utmp.ut_line)
@@ -133,7 +133,7 @@ int argc; char *argv[];
        char *device;
        int devfile;
        int uid, gid;
        char *device;
        int devfile;
        int uid, gid;
-       long lseek();
+       off_t lseek();
        struct passwd *getpwuid();
        char *rindex();
        extern int errno;
        struct passwd *getpwuid();
        char *rindex();
        extern int errno;
@@ -204,7 +204,7 @@ int argc; char *argv[];
 
        (void)lseek(etcutmp,utmploc, 0);
 
 
        (void)lseek(etcutmp,utmploc, 0);
 
-       i = read(etcutmp,&utmp,sizeof(struct utmp));
+       i = read(etcutmp,(char *)&utmp,sizeof(struct utmp));
 
        if(
                i == sizeof(struct utmp) &&
 
        if(
                i == sizeof(struct utmp) &&
@@ -236,16 +236,16 @@ int argc; char *argv[];
                        exit(1);
                }
                /* Try one last time to hang up */
                        exit(1);
                }
                /* Try one last time to hang up */
-               if (ioctl(devfile,TIOCCDTR,0) < 0)
+               if (ioctl(devfile,(int)TIOCCDTR,(char *)0) < 0)
                        fprintf(stderr,"On TIOCCDTR ioctl: %s\n",
                                sys_errlist[errno]);
 
                        fprintf(stderr,"On TIOCCDTR ioctl: %s\n",
                                sys_errlist[errno]);
 
-               if (ioctl(devfile, TIOCNXCL,0) < 0)
+               if (ioctl(devfile, (int)TIOCNXCL,(char *)0) < 0)
                        fprintf(stderr,
                            "Cannot clear Exclusive Use on %s: %s\n",
                                device, sys_errlist[errno]);
 
                        fprintf(stderr,
                            "Cannot clear Exclusive Use on %s: %s\n",
                                device, sys_errlist[errno]);
 
-               if (ioctl(devfile, TIOCHPCL,0) < 0)
+               if (ioctl(devfile, (int)TIOCHPCL,(char *)0) < 0)
                        fprintf(stderr,
                            "Cannot set hangup on close on %s: %s\n",
                                device, sys_errlist[errno]);
                        fprintf(stderr,
                            "Cannot set hangup on close on %s: %s\n",
                                device, sys_errlist[errno]);
@@ -259,9 +259,11 @@ int argc; char *argv[];
                }
                resetmodem=i;
 
                }
                resetmodem=i;
 
-               settys(ENABLE);
-
-               pokeinit(device,Uname,enable);
+               if (settys(ENABLE)) {
+                       fprintf(stderr,"%s already enabled\n",device);
+               } else {
+                       pokeinit(device,Uname,enable);
+               }
                post(device,"");
 
        } else {
                post(device,"");
 
        } else {
@@ -297,14 +299,17 @@ int argc; char *argv[];
 
 
                /* poke init */
 
 
                /* poke init */
-               settys(DISABLE);
-               pokeinit(device,Uname,enable);
+               if(settys(DISABLE)) {
+                       fprintf(stderr,"%s already disabled\n",device);
+               } else {
+                       pokeinit(device,Uname,enable);
+               }
                post(device,Uname);
                if((devfile = open(device, 1)) < 0) {
                        fprintf(stderr, "On %s open: %s\n",
                                device, sys_errlist[errno]);
                } else {
                post(device,Uname);
                if((devfile = open(device, 1)) < 0) {
                        fprintf(stderr, "On %s open: %s\n",
                                device, sys_errlist[errno]);
                } else {
-                       if(ioctl(devfile, TIOCSDTR, 0) < 0)
+                       if(ioctl(devfile, (int)TIOCSDTR, (char *)0) < 0)
                                fprintf(stderr,
                                    "Cannot set DTR on %s: %s\n",
                                        device, sys_errlist[errno]);
                                fprintf(stderr,
                                    "Cannot set DTR on %s: %s\n",
                                        device, sys_errlist[errno]);
@@ -329,7 +334,7 @@ register int len;
 post(device,name)
 char *device, *name;
 {
 post(device,name)
 char *device, *name;
 {
-       (void)time(&utmp.ut_time);
+       (void)time((time_t *)&utmp.ut_time);
        strcpyn(utmp.ut_line, device, LINSIZ);
        strcpyn(utmp.ut_name, name,  NAMSIZ);
        if (lseek(etcutmp, utmploc, 0)<0)
        strcpyn(utmp.ut_line, device, LINSIZ);
        strcpyn(utmp.ut_name, name,  NAMSIZ);
        if (lseek(etcutmp, utmploc, 0)<0)
@@ -345,6 +350,7 @@ pokeinit(device,uname,enable)
 char *uname, *device; int enable;
 {
        struct utmp utmp;
 char *uname, *device; int enable;
 {
        struct utmp utmp;
+       register int i;
 
        post(device, uname);
 
 
        post(device, uname);
 
@@ -353,7 +359,7 @@ char *uname, *device; int enable;
                fprintf(stderr,
                    "Cannot send hangup to init process: %s\n",
                        sys_errlist[errno]);
                fprintf(stderr,
                    "Cannot send hangup to init process: %s\n",
                        sys_errlist[errno]);
-               settys(resettty);
+               (void)settys(resettty);
                (void)setmodem(device,resetmodem);
                exit(1);
        }
                (void)setmodem(device,resetmodem);
                exit(1);
        }
@@ -362,15 +368,16 @@ char *uname, *device; int enable;
                return;
 
        /* wait till init has responded, clearing the utmp entry */
                return;
 
        /* wait till init has responded, clearing the utmp entry */
+       i=100;
        do {
                sleep(1);
                if (lseek(etcutmp,utmploc,0)<0)
                        fprintf(stderr,"On lseek in /etc/utmp: %s",
                                sys_errlist[errno]);
        do {
                sleep(1);
                if (lseek(etcutmp,utmploc,0)<0)
                        fprintf(stderr,"On lseek in /etc/utmp: %s",
                                sys_errlist[errno]);
-               if (read(etcutmp,&utmp,sizeof utmp)<0)
+               if (read(etcutmp,(char *)&utmp,sizeof utmp)<0)
                        fprintf(stderr,"On read from /etc/utmp: %s",
                                sys_errlist[errno]);
                        fprintf(stderr,"On read from /etc/utmp: %s",
                                sys_errlist[errno]);
-       } while (utmp.ut_name[0] !='\0');
+       } while (utmp.ut_name[0] != '\0' && --i > 0);
 }
 
 /* identify terminal line in ttys */
 }
 
 /* identify terminal line in ttys */
@@ -414,7 +421,6 @@ settys(enable)
 int enable;
 {
        int ittysfil;
 int enable;
 {
        int ittysfil;
-       int  lnbeg, foundit, ndevice; 
        char out,in;
 
        ittysfil = open(Etcttys, 2);
        char out,in;
 
        ittysfil = open(Etcttys, 2);
@@ -423,7 +429,7 @@ int enable;
                        Etcttys, sys_errlist[errno]);
                exit(1);
        }
                        Etcttys, sys_errlist[errno]);
                exit(1);
        }
-       (void)lseek(ittysfil,(long)ttyslnbeg,0);
+       (void)lseek(ittysfil,ttyslnbeg,0);
        if(read(ittysfil,&in,1)<0) {
                fprintf(stderr,"On %s write: %s\n",
                        Etcttys, sys_errlist[errno]);
        if(read(ittysfil,&in,1)<0) {
                fprintf(stderr,"On %s write: %s\n",
                        Etcttys, sys_errlist[errno]);
@@ -431,13 +437,14 @@ int enable;
        }
        resettty = (in == '1');
        out = enable ? '1' : '0';
        }
        resettty = (in == '1');
        out = enable ? '1' : '0';
-       (void)lseek(ittysfil,(long)ttyslnbeg,0);
+       (void)lseek(ittysfil,ttyslnbeg,0);
        if(write(ittysfil,&out,1)<0) {
                fprintf(stderr,"On %s write: %s\n",
                        Etcttys, sys_errlist[errno]);
                exit(1);
        }
        (void)close(ittysfil);
        if(write(ittysfil,&out,1)<0) {
                fprintf(stderr,"On %s write: %s\n",
                        Etcttys, sys_errlist[errno]);
                exit(1);
        }
        (void)close(ittysfil);
+       return(in==out);
 }
 
 /*
 }
 
 /*
@@ -456,9 +463,15 @@ char *ttyline; int enable;
        dev_t dev;
        int kmem;
        int unit,line,nlines,addr,tflags;
        dev_t dev;
        int kmem;
        int unit,line,nlines,addr,tflags;
+       int devtype=0;
+       char cflags; short sflags;
+#ifdef BSD4_2
+       int flags;
+#else
+       short flags;
+#endif
        struct uba_device *ubinfo;
        struct stat statb;
        struct uba_device *ubinfo;
        struct stat statb;
-       short flags,devtype=0;
        struct cdevsw cdevsw;
 
        if(nl[CDEVSW].n_type == 0) {
        struct cdevsw cdevsw;
 
        if(nl[CDEVSW].n_type == 0) {
@@ -476,14 +489,14 @@ char *ttyline; int enable;
                return(-1);
        }
 
                return(-1);
        }
 
-       if(statb.st_mode&S_IFMT != S_IFCHR) {
+       if((statb.st_mode&S_IFMT) != S_IFCHR) {
                fprintf(stderr,"%s is not a character device.\n",ttyline);
                return(-1);
        }
 
        dev = statb.st_rdev;
        (void)lseek(kmem,
                fprintf(stderr,"%s is not a character device.\n",ttyline);
                return(-1);
        }
 
        dev = statb.st_rdev;
        (void)lseek(kmem,
-               (int) &(((struct cdevsw *)NLVALUE(CDEVSW))[major(dev)]),0);
+               (off_t) &(((struct cdevsw *)NLVALUE(CDEVSW))[major(dev)]),0);
        (void)read(kmem,(char *) &cdevsw,sizeof cdevsw);
 
        if((int)(cdevsw.d_open) == NLVALUE(DZOPEN)) {
        (void)read(kmem,(char *) &cdevsw,sizeof cdevsw);
 
        if((int)(cdevsw.d_open) == NLVALUE(DZOPEN)) {
@@ -491,19 +504,19 @@ char *ttyline; int enable;
                unit = minor(dev) / NDZLINE;
                line = minor(dev) % NDZLINE;
                addr = (int) &(((int *)NLVALUE(DZINFO))[unit]);
                unit = minor(dev) / NDZLINE;
                line = minor(dev) % NDZLINE;
                addr = (int) &(((int *)NLVALUE(DZINFO))[unit]);
-               (void)lseek(kmem,(int) NLVALUE(NDZ11),0);
+               (void)lseek(kmem,(off_t) NLVALUE(NDZ11),0);
        } else if((int)(cdevsw.d_open) == NLVALUE(DHOPEN)) {
                devtype = DH11;
                unit = minor(dev) / NDHLINE;
                line = minor(dev) % NDHLINE;
                addr = (int) &(((int *)NLVALUE(DHINFO))[unit]);
        } else if((int)(cdevsw.d_open) == NLVALUE(DHOPEN)) {
                devtype = DH11;
                unit = minor(dev) / NDHLINE;
                line = minor(dev) % NDHLINE;
                addr = (int) &(((int *)NLVALUE(DHINFO))[unit]);
-               (void)lseek(kmem,(int) NLVALUE(NDH11),0);
+               (void)lseek(kmem,(off_t) NLVALUE(NDH11),0);
        } else if((int)(cdevsw.d_open) == NLVALUE(DMFOPEN)) {
                devtype = DMF;
                unit = minor(dev) / NDMFLINE;
                line = minor(dev) % NDMFLINE;
                addr = (int) &(((int *)NLVALUE(DMFINFO))[unit]);
        } else if((int)(cdevsw.d_open) == NLVALUE(DMFOPEN)) {
                devtype = DMF;
                unit = minor(dev) / NDMFLINE;
                line = minor(dev) % NDMFLINE;
                addr = (int) &(((int *)NLVALUE(DMFINFO))[unit]);
-               (void)lseek(kmem,(int) NLVALUE(NDMF),0);
+               (void)lseek(kmem,(off_t) NLVALUE(NDMF),0);
        } else {
                fprintf(stderr,"Device %s (%d/%d) unknown.\n",ttyline,
                    major(dev),minor(dev));
        } else {
                fprintf(stderr,"Device %s (%d/%d) unknown.\n",ttyline,
                    major(dev),minor(dev));
@@ -517,15 +530,15 @@ char *ttyline; int enable;
                return(-1);
        }
 
                return(-1);
        }
 
-       (void)lseek(kmem,addr,0);
+       (void)lseek(kmem,(off_t)addr,0);
        (void)read(kmem,(char *) &ubinfo,sizeof ubinfo);
        (void)read(kmem,(char *) &ubinfo,sizeof ubinfo);
-       (void)lseek(kmem,(int) &(ubinfo->ui_flags),0);
+       (void)lseek(kmem,(off_t) &(ubinfo->ui_flags),0);
        (void)read(kmem,(char *) &flags,sizeof flags);
 
        tflags = 1<<line;
        resetmodem = ((flags&tflags) == 0);
        flags = enable ? (flags & ~tflags) : (flags | tflags);
        (void)read(kmem,(char *) &flags,sizeof flags);
 
        tflags = 1<<line;
        resetmodem = ((flags&tflags) == 0);
        flags = enable ? (flags & ~tflags) : (flags | tflags);
-       (void)lseek(kmem,(int) &(ubinfo->ui_flags),0);
+       (void)lseek(kmem,(off_t) &(ubinfo->ui_flags),0);
        (void)write(kmem,(char *) &flags, sizeof flags);
        switch(devtype) {
                case DZ11:
        (void)write(kmem,(char *) &flags, sizeof flags);
        switch(devtype) {
                case DZ11:
@@ -533,24 +546,27 @@ char *ttyline; int enable;
                                fprintf(stderr,"No dzsoftCAR.\n");
                                return(-1);
                        }
                                fprintf(stderr,"No dzsoftCAR.\n");
                                return(-1);
                        }
-                       (void)lseek(kmem,(int) &(((char *)addr)[unit]),0);
-                       (void)write(kmem,(char *) &flags, sizeof flags);
+                       cflags = flags;
+                       (void)lseek(kmem,(off_t) &(((char *)addr)[unit]),0);
+                       (void)write(kmem,(char *) &cflags, sizeof cflags);
                        break;
                case DH11:
                        if((addr = NLVALUE(DHSCAR)) == 0) {
                                fprintf(stderr,"No dhsoftCAR.\n");
                                return(-1);
                        }
                        break;
                case DH11:
                        if((addr = NLVALUE(DHSCAR)) == 0) {
                                fprintf(stderr,"No dhsoftCAR.\n");
                                return(-1);
                        }
-                       (void)lseek(kmem,(int) &(((short *)addr)[unit]),0);
-                       (void)write(kmem,(char *) &flags, sizeof flags);
+                       sflags = flags;
+                       (void)lseek(kmem,(off_t) &(((short *)addr)[unit]),0);
+                       (void)write(kmem,(char *) &sflags, sizeof sflags);
                        break;
                case DMF:
                        if((addr = NLVALUE(DMFSCAR)) == 0) {
                                fprintf(stderr,"No dmfsoftCAR.\n");
                                return(-1);
                        }
                        break;
                case DMF:
                        if((addr = NLVALUE(DMFSCAR)) == 0) {
                                fprintf(stderr,"No dmfsoftCAR.\n");
                                return(-1);
                        }
-                       (void)lseek(kmem,(int) &(((short *)addr)[unit]),0);
-                       (void)write(kmem,(char *) &flags,2);
+                       cflags = flags;
+                       (void)lseek(kmem,(off_t) &(((char *)addr)[unit]),0);
+                       (void)write(kmem,(char *) &flags, sizeof cflags);
                        break;
                default:
                        fprintf(stderr,"Unknown device type\n");
                        break;
                default:
                        fprintf(stderr,"Unknown device type\n");
index 4f84400..a932d24 100644 (file)
@@ -1,10 +1,9 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)assert.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)assert.c   5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #include <sys/time.h>
 #endif
 
 #include "uucp.h"
 #include <sys/time.h>
-#include <sys/types.h>
 #include <errno.h>
 
 /*******
 #include <errno.h>
 
 /*******
index 258ab8e..b29f167 100644 (file)
@@ -1,11 +1,10 @@
-/*     condevs.h       4.1     85/01/22        */
+/*     condevs.h       4.2     85/04/10        */
 
 
-#include <sys/types.h>
+#include "uucp.h"
 #include <errno.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <sgtty.h>
 #include <errno.h>
 #include <setjmp.h>
 #include <signal.h>
 #include <sgtty.h>
-#include "uucp.h"
 #ifdef VMSDTR  /* Modem control on vms(works dtr) */
 #include <eunice/eunice.h>
 #define TT$M_MODEM     0x00200000 /* These should be in a '.h' somewhere */
 #ifdef VMSDTR  /* Modem control on vms(works dtr) */
 #include <eunice/eunice.h>
 #define TT$M_MODEM     0x00200000 /* These should be in a '.h' somewhere */
@@ -44,6 +43,10 @@ int novopn(), novcls();
 int df2opn(), df2cls();
 #endif DF02
 
 int df2opn(), df2cls();
 #endif DF02
 
+#ifdef DF112
+int df12popn(), df12topn(), df12cls();
+#endif DF112
+
 #ifdef PNET
 int pnetopn();
 #endif PNET
 #ifdef PNET
 int pnetopn();
 #endif PNET
@@ -52,6 +55,10 @@ int pnetopn();
 int ventopn(), ventcls();
 #endif VENTEL
 
 int ventopn(), ventcls();
 #endif VENTEL
 
+#ifdef PENRIL
+int penopn(), pencls();
+#endif PENRIL
+
 #ifdef UNETTCP
 #define TO_ACTIVE      0
 int unetopn(), unetcls();
 #ifdef UNETTCP
 #define TO_ACTIVE      0
 int unetopn(), unetcls();
index 2461c5a..f0e1b10 100644 (file)
@@ -1,6 +1,6 @@
-/*     uucp.h  5.5     85/01/28        */
+/*     uucp.h  5.6     85/04/10        */
 
 
-#include "stdio.h"
+#include <stdio.h>
 
 /*
  * Determine local uucp name of this machine.
 
 /*
  * Determine local uucp name of this machine.
 /*#define DATAKIT      /* ATT's datakit */
 /*#define PNET         /* Purdue network */
 #define DF02           /* Dec's DF02/DF03 */
 /*#define DATAKIT      /* ATT's datakit */
 /*#define PNET         /* Purdue network */
 #define DF02           /* Dec's DF02/DF03 */
+#define DF112          /* Dec's DF112 */
 #define HAYES          /* Hayes' Smartmodem */
 #define VENTEL         /* ventel dialer */
 #define HAYES          /* Hayes' Smartmodem */
 #define VENTEL         /* ventel dialer */
+#define PENRIL         /* PENRIL Dialer */
 #define VADIC          /* Racal-Vadic 345x */
 #define VA212          /* Racal-Vadic 212 */
 #define VA811S         /* Racal-Vadic 811S dialer, 831 adaptor */
 #define VADIC          /* Racal-Vadic 345x */
 #define VA212          /* Racal-Vadic 212 */
 #define VA811S         /* Racal-Vadic 811S dialer, 831 adaptor */
@@ -75,7 +77,7 @@
 #define TCPIP
 #endif
 
 #define TCPIP
 #endif
 
-#ifdef VENTEL
+#if defined(VENTEL) || defined(NOVATION) || defined(DF112) || defined(PENRIL)
 /*
  * We need a timer to write slowly to ventels.
  * define INTERVALTIMER to use 4.2 bsd interval timer.
 /*
  * We need a timer to write slowly to ventels.
  * define INTERVALTIMER to use 4.2 bsd interval timer.
@@ -85,7 +87,7 @@
  * Look at uucpdelay() in condevs.c for details.
  */
 #define        FTIME
  * Look at uucpdelay() in condevs.c for details.
  */
 #define        FTIME
-#endif
+#endif VENTEL || NOVATION || DF112 || PENRIL
 
 /*
  * If your site is using "ndir.h" to retrofit the Berkeley
 
 /*
  * If your site is using "ndir.h" to retrofit the Berkeley
 
 /*#define VMSDTR       /* Turn on modem control on vms(works DTR) for
                           develcon and gandalf ports to gain access */
 
 /*#define VMSDTR       /* Turn on modem control on vms(works DTR) for
                           develcon and gandalf ports to gain access */
+/*
+ *     If you want to use the same modem for dialing in and out define
+ *     DIALINOUT to be the localtion of the acucntrl program
+ */
+/* #define DIALINOUT   "/usr/lib/uucp/acucntrl" */
 
 /* define the last characters for ACU */
 #define ACULAST "-<"
 
 /* define the last characters for ACU */
 #define ACULAST "-<"
  * know where the LCK files are kept, and you have to change your /etc/rc
  * if your rc cleans out the lock files (as it should).
  */
  * know where the LCK files are kept, and you have to change your /etc/rc
  * if your rc cleans out the lock files (as it should).
  */
-/*#define      LOCKDIR "LCK." */
+/*#define      LOCKDIR "LCK" */
 #define        LOCKDIR "."
 
 /* 
 #define        LOCKDIR "."
 
 /* 
 #define DONTCOPY
 
 /*
 #define DONTCOPY
 
 /*
- * Very few (none I know of) systems use the sequence checking feature.
+ * Very few (that I know of) systems use the sequence checking feature.
  * If you are not going to use it (hint: you are not),
  * do not define GNXSEQ.  This saves precious room on PDP11s.
  */
 /*#define      GNXSEQ/* comment this out to save space */
 
  * If you are not going to use it (hint: you are not),
  * do not define GNXSEQ.  This saves precious room on PDP11s.
  */
 /*#define      GNXSEQ/* comment this out to save space */
 
+/*
+ * If you want the logfile stored in a file for each site instead
+ * of one file
+ * define LOGBYSITE as the directory to put the files in
+ */
+/*#define LOGBYSITE    "/usr/spool/uucp/LOG"   */
+
 #define XQTDIR         "/usr/spool/uucp/XTMP"
 #define SQFILE         "/usr/lib/uucp/SQFILE"
 #define SQTMP          "/usr/lib/uucp/SQTMP"
 #define XQTDIR         "/usr/spool/uucp/XTMP"
 #define SQFILE         "/usr/lib/uucp/SQFILE"
 #define SQTMP          "/usr/lib/uucp/SQTMP"
 #define DIALFILE       "/usr/lib/uucp/L-dialcodes"
 #define USERFILE       "/usr/lib/uucp/USERFILE"
 #define        CMDFILE         "/usr/lib/uucp/L.cmds"
 #define DIALFILE       "/usr/lib/uucp/L-dialcodes"
 #define USERFILE       "/usr/lib/uucp/USERFILE"
 #define        CMDFILE         "/usr/lib/uucp/L.cmds"
+#define        ALIASFILE       "/usr/lib/uucp/L.aliases"
 
 #define SPOOL          "/usr/spool/uucp"
 #define SQLOCK         "LCK.SQ"
 
 #define SPOOL          "/usr/spool/uucp"
 #define SQLOCK         "LCK.SQ"
@@ -297,8 +312,23 @@ struct Devices {
 
 #define WKDSIZE 100    /*  size of work dir name  */
 
 
 #define WKDSIZE 100    /*  size of work dir name  */
 
+#include <sys/types.h>
+#ifndef USG
+#include <sys/timeb.h>
+#else USG
+struct timeb
+{
+       time_t  time;
+       unsigned short millitm;
+       short   timezone;
+       short   dstflag;
+};
+#endif USG
+
+extern struct timeb Now;
+
 extern int Ifn, Ofn;
 extern int Ifn, Ofn;
-extern char Rmtname[];
+extern char *Rmtname;
 extern char User[];
 extern char Loginuser[];
 extern char *Spool;
 extern char User[];
 extern char Loginuser[];
 extern char *Spool;
index 53d6dd2..38da508 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)anlwrk.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)anlwrk.c   5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #include "uust.h"
 #ifdef NDIR
 #include <sys/stat.h>
 #include "uust.h"
 #ifdef NDIR
@@ -11,55 +10,18 @@ static char sccsid[] = "@(#)anlwrk.c        5.3 (Berkeley) %G%";
 #else
 #include <sys/dir.h>
 #endif
 #else
 #include <sys/dir.h>
 #endif
-
-/* Re-written to be reasonable
- * Mon Nov 15 17:19:52 EST 1982
- * Alan S. Watt (ittvax!swatt)
- *
- * Tom Truscott (rti!trt):
- * Priority ordering cleaned up.  New 'pcompar' subroutine.
- * 'stat' removed (speeds things up).
- * Possible infinite loop in gtwvec defended against.
- * Feb 23, 1983
- *
- * Changes:
- *
- *  1) The check for work is much faster; the first filename
- *     that matches the prefix causes a "yes" return.
- *
- *  2) The filename is not "stat" ed , so
- *     there is no massive delay while the list of potential
- *     names is built.
- *
- *  3) Requesting work for a new system is now detected so
- *     internal variables are re-initialized properly.  In
- *     particular, the stream pointer for the current work
- *     file is properly closed so work for a system which
- *     hangs up will not be sent to the next system called.
- *
- * Fri Dec  3 09:31:45 EST 1982
- *
- *  5) As new work files are requested, a check is made
- *     every TLIMIT seconds (5 minutes at present) to see
- *     if new files have entered the spool area.  Since
- *     work file names are now cached up to LLEN, this can
- *     represent a very long transmission time before new
- *     work enters the list to be processed.  If people want
- *     to use the "grade" character to specify a higher
- *     priority, the list must be re-built and re-sorted for
- *     higher priority stuff to have an immediate effect.
- */
-
+#include <ctype.h>
 
 #define TLIMIT (5*60L)
 #define NITEMS(X)      (sizeof (X) / sizeof ((X)[0]))
 
 int Nfiles = 0;
 char Filent[LLEN][NAMESIZE];
 
 #define TLIMIT (5*60L)
 #define NITEMS(X)      (sizeof (X) / sizeof ((X)[0]))
 
 int Nfiles = 0;
 char Filent[LLEN][NAMESIZE];
+long fseek(), ftell();
+extern int TransferSucceeded;
 
 
-/*******
- *     anlwrk(file, wvec)      create a vector of command arguments
- *     char *file, **wvec;
+/*
+ *     create a vector of command arguments
  *
  *     return codes:
  *             0  -  no more work in this file
  *
  *     return codes:
  *             0  -  no more work in this file
@@ -71,8 +33,9 @@ int
 anlwrk(file, wvec)
 register char *file, **wvec;
 {
 anlwrk(file, wvec)
 register char *file, **wvec;
 {
-       static char str[MAXRQST];
+       static char str[MAXRQST], nstr[MAXRQST];
        static FILE *fp = NULL;
        static FILE *fp = NULL;
+       static long nextread, nextwrite;
 
        /*
         * If called with a null string, force a shutdown
 
        /*
         * If called with a null string, force a shutdown
@@ -85,46 +48,54 @@ register char *file, **wvec;
                return 0;
        }
        if (fp == NULL) {
                return 0;
        }
        if (fp == NULL) {
-               fp = fopen(subfile(file), "r");
+               fp = fopen(subfile(file), "r+w");
                if (fp == NULL) {
                if (fp == NULL) {
+                       char *bnp, rqstr[MAXFULLNAME];
+                       bnp = rindex(file, '/');
+                       sprintf(rqstr, "%s/%s", CORRUPT, bnp ? bnp + 1 : file);
+                       xmv(file, rqstr);
+                       logent(file, "CMD FILE UNREADABLE");
                        unlink(subfile(file));
                        return 0;
                }
                Usrf = 0;
                        unlink(subfile(file));
                        return 0;
                }
                Usrf = 0;
+               nstr[0] = '\0';
+               nextread = nextwrite = 0L;
        }
 
        }
 
-       /* This is what deletes the current work file when EOF
-        * is reached.  As this is called from gtwvec, which is
-        * in turn called externally, it is not possible to save
-        * "C." files in case of error, except for line errors,
-        * which shuts down the whole system.
-        */
-       if (fgets(str, MAXRQST, fp) == NULL) {
-               fclose(fp);
-               unlink(subfile(file));
-               USRF(USR_COMP);
-               US_RRS(file, Usrf);
-               Usrf = 0;
-               file[0] = '\0';
-               fp = NULL;
-               return 0;
+       if (nstr[0] != '\0' && TransferSucceeded) {
+               fseek(fp, nextwrite, 0);
+               fputs(nstr, fp);
+               fseek(fp, nextread, 0);
        }
        }
+
+       do {
+               nextwrite = ftell(fp);
+               if (fgets(str, MAXRQST, fp) == NULL) {
+                       fclose(fp);
+                       if (TransferSucceeded)
+                               unlink(subfile(file));
+                       USRF(USR_COMP);
+                       US_RRS(file, Usrf);
+                       Usrf = 0;
+                       file[0] = '\0';
+                       fp = NULL;
+                       return 0;
+               }
+       } while (!isupper(str[0]));
+
+       nextread = ftell(fp);
+       strncpy(nstr, str, MAXRQST);
+       nstr[0] = tolower(nstr[0]);
        return getargs(str, wvec, 20);
 }
 
 
        return getargs(str, wvec, 20);
 }
 
 
-/***
- *     bldflst - build list of work files for given system
- *      Nfiles, Filent are global
+/*
+ *     build list of work files for given system
  *
  *     return value - 1 if work was found, else 0
  *
  *
  *     return value - 1 if work was found, else 0
  *
- * Jul 26 19:17 1982 (ittvax!swatt). fixed this obnoxious
- * routine to NOT read all the way through the damned directory
- * "stat"'ing every file in sight just to get 10 names!!!
- *
- * It still reads through the directory from the beginning until
- * the list is filled, but this is only once every LLEN names.
  */
 
 /* LOCAL only */
  */
 
 /* LOCAL only */
@@ -174,12 +145,9 @@ register char *dir, *pre;
        return  nfound? 1: 0;
 }
 
        return  nfound? 1: 0;
 }
 
-/***
- *     entflst - put new name if list is not full
- *               or new name is less than the MAX
+/*
+ *     put new name if list is not full  or new name is less than the MAX
  *               now in the list.
  *               now in the list.
- *     Nfiles, Filent[] are modified.
- *     return value - none
  *
  */
 
  *
  */
 
@@ -192,7 +160,7 @@ register char *file;
 
        /* locate position for the new file and make room for it */
        for (i = Nfiles; i > 0; i--) {
 
        /* locate position for the new file and make room for it */
        for (i = Nfiles; i > 0; i--) {
-               if (pcompar(file, Filent[i-1]) >= 0)
+               if (pcompar(file, Filent[i-1]) <= 0)
                        break;
                if (i <LLEN)
                        strcpy(Filent[i], Filent[i-1]);
                        break;
                if (i <LLEN)
                        strcpy(Filent[i], Filent[i-1]);
@@ -239,9 +207,8 @@ register char *p1, *p2;
        return strcmp(p2, p1);
 }
 
        return strcmp(p2, p1);
 }
 
-/***
- *     gtwrkf - get next work file
- *      Nfiles, Filent[] are modified.
+/*
+ *     get next work file
  *
  *     return value:
  *
  *
  *     return value:
  *
@@ -254,15 +221,20 @@ register char *p1, *p2;
 gtwrkf(dir, file)
 char *file, *dir;
 {
 gtwrkf(dir, file)
 char *file, *dir;
 {
-       if (Nfiles <= 0)
+       register int i;
+
+       if (Nfiles-- <= 0) {
+               Nfiles = 0;
                return 0;
                return 0;
-       sprintf(file, "%s/%s", dir, Filent[--Nfiles]);
+       }
+       sprintf(file, "%s/%s", dir, Filent[0]);
+       for (i=0; i<Nfiles;i++)
+               strcpy(Filent[i], Filent[i+1]);
        return 1;
 }
 
        return 1;
 }
 
-/***
- *     gtwvec(file, dir, wkpre, wrkvec)        get work vector
- *     char *file, *dir, *wkpre, **wrkvec;
+/*
+ *     get work vector
  *
  *     return codes:
  *             positive number  -  number of arguments
  *
  *     return codes:
  *             positive number  -  number of arguments
@@ -285,10 +257,7 @@ register char *file;
        return nargs;
 }
 
        return nargs;
 }
 
-/***
- *     iswrk(file, reqst, dir, pre)
- *     char *file, *reqst, *dir, *pre;
- *
+/*
  *     iswrk  -  this routine will check the work list (list).
  *     If it is empty or the present work is exhausted, it
  *     will call bldflst to generate a new list.
  *     iswrk  -  this routine will check the work list (list).
  *     If it is empty or the present work is exhausted, it
  *     will call bldflst to generate a new list.
@@ -334,7 +303,7 @@ register char *file, *reqst, *dir, *pre;
         */
        for (;;) {
                ret = 0;
         */
        for (;;) {
                ret = 0;
-               if (Nfiles == 0 || newspool((time_t)TLIMIT)) {
+               if (Nfiles <= 0 || newspool((time_t)TLIMIT)) {
                        ret = bldflst (reqst, dir, pre);
                        DEBUG(99,"bldflst returns %d\n",ret);
                }
                        ret = bldflst (reqst, dir, pre);
                        DEBUG(99,"bldflst returns %d\n",ret);
                }
@@ -347,7 +316,7 @@ register char *file, *reqst, *dir, *pre;
                if (*reqst == 'c')
                        return ret;
 
                if (*reqst == 'c')
                        return ret;
 
-               if (Nfiles == 0)
+               if (Nfiles <= 0)
                        return 0;
 
                if (gtwrkf(dir, file))
                        return 0;
 
                if (gtwrkf(dir, file))
index 8afbf83..9c6f145 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)anyread.c  5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)anyread.c  5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 
 /*
 #include <sys/stat.h>
 
 /*
index 38a051e..eda20e1 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)chkpth.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)chkpth.c   5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 
 struct userpath {
 #include <sys/stat.h>
 
 struct userpath {
@@ -37,8 +36,10 @@ char *path, *logname, *mchname;
        register char **p, *s;
 
        /* Allow only rooted pathnames.  Security wish.  rti!trt */
        register char **p, *s;
 
        /* Allow only rooted pathnames.  Security wish.  rti!trt */
-       if (*path != '/')
+       if (*path != '/') {
+               DEBUG(4, "filename doesn't begin with /\n", CNULL);
                return FAIL;
                return FAIL;
+       }
 
        if (Uptfirst) {
                rdpth();
 
        if (Uptfirst) {
                rdpth();
@@ -63,14 +64,17 @@ char *path, *logname, *mchname;
 
        /*  check for /../ in path name  */
        for (s = path; *s != '\0'; s++) {
 
        /*  check for /../ in path name  */
        for (s = path; *s != '\0'; s++) {
-               if (prefix("/../",s))
+               if (prefix("/../",s)) {
+                       DEBUG(4, "filename has /../ in it\n", CNULL);
                        return FAIL;
                        return FAIL;
+               }
        }
 
        /* Check for access permission */
        for (p = u->us_path; *p != NULL; p++)
                if (prefix(*p, path))
                        return SUCCESS;
        }
 
        /* Check for access permission */
        for (p = u->us_path; *p != NULL; p++)
                if (prefix(*p, path))
                        return SUCCESS;
+       DEBUG(4, "filename not in list\n", CNULL);
 
        /* path name not valid */
        return FAIL;
 
        /* path name not valid */
        return FAIL;
@@ -209,16 +213,19 @@ char *file, *mopt;
        extern char *lastpart();
 
        if (stat(subfile(file), &s) == 0) {
        extern char *lastpart();
 
        if (stat(subfile(file), &s) == 0) {
-               if ((s.st_mode & ANYWRITE) == 0)
+               if ((s.st_mode & ANYWRITE) == 0) {
+                       DEBUG(4,"file is not writable: mode %o\n", s.st_mode);
                        return FAIL;
                        return FAIL;
+               }
                return SUCCESS;
        }
 
        strcpy(dir, file);
        *lastpart(dir) = '\0';
                return SUCCESS;
        }
 
        strcpy(dir, file);
        *lastpart(dir) = '\0';
-       if ((ret = stat(subfile(dir), &s)) == -1
-         && mopt == NULL)
+       if ((ret = stat(subfile(dir), &s)) == -1 && mopt == NULL) {
+               DEBUG(4, "can't stat directory %s\n", subfile(dir));
                return FAIL;
                return FAIL;
+       }
 
        if (ret != -1) {
                if ((s.st_mode & ANYWRITE) == 0)
 
        if (ret != -1) {
                if ((s.st_mode & ANYWRITE) == 0)
index e67339b..62aea16 100644 (file)
@@ -1,14 +1,12 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)expfile.c  5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)expfile.c  5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 
 #include <sys/stat.h>
 
-/*******
- *     expfile(file)   expand file name
- *     char *file;
+/*
+ *     expand file name
  *
  *     return codes: 0 - Ordinary spool area file
  *                   1 - Other normal file
  *
  *     return codes: 0 - Ordinary spool area file
  *                   1 - Other normal file
@@ -25,10 +23,10 @@ char *file;
 
        switch(file[0]) {
        case '/':
 
        switch(file[0]) {
        case '/':
-               return(1);
+               return 1;
        case '~':
                for (fpart = file + 1, up = user; *fpart != '\0'
        case '~':
                for (fpart = file + 1, up = user; *fpart != '\0'
-                       && *fpart != '/'; fpart++)
+                       && *fpart != '/' && up < user+sizeof(user)-1; fpart++)
                                *up++ = *fpart;
                *up = '\0';
                if (!*user || gninfo(user, &uid, full) != 0) {
                                *up++ = *fpart;
                *up = '\0';
                if (!*user || gninfo(user, &uid, full) != 0) {
@@ -53,9 +51,8 @@ char *file;
 }
 
 
 }
 
 
-/***
- *     isdir(name)     check if directory name
- *     char *name;
+/*
+ *     check if directory name
  *
  *     return codes:  0 - not directory  |  1 - is directory
  */
  *
  *     return codes:  0 - not directory  |  1 - is directory
  */
@@ -75,32 +72,30 @@ char *name;
 }
 
 
 }
 
 
-/***
- *     mkdirs(name)    make all necessary directories
- *     char *name;
+/*
+ *     make all necessary directories
  *
  *
- *     return 0  |  FAIL
+ *     return SUCCESS  |  FAIL
  */
 
 mkdirs(name)
 char *name;
 {
        int ret, mask;
  */
 
 mkdirs(name)
 char *name;
 {
        int ret, mask;
-       char cmd[MAXFULLNAME], dir[MAXFULLNAME];
+       char dir[MAXFULLNAME];
        register char *p;
 
        for (p = dir + 1;; p++) {
                strcpy(dir, name);
                if ((p = index(p, '/')) == NULL)
        register char *p;
 
        for (p = dir + 1;; p++) {
                strcpy(dir, name);
                if ((p = index(p, '/')) == NULL)
-                       return 0;
+                       return SUCCESS;
                *p = '\0';
                if (isdir(dir))
                        continue;
 
                *p = '\0';
                if (isdir(dir))
                        continue;
 
-               sprintf(cmd, "mkdir %s;chmod 0777 %s", dir, dir);
                DEBUG(4, "mkdir - %s\n", dir);
                mask = umask(0);
                DEBUG(4, "mkdir - %s\n", dir);
                mask = umask(0);
-               ret = shio(cmd, CNULL, CNULL, User);
+               ret = mkdir(dir, 0777);
                umask(mask);
                if (ret != 0)
                        return FAIL;
                umask(mask);
                if (ret != 0)
                        return FAIL;
@@ -108,11 +103,11 @@ char *name;
        /* NOTREACHED */
 }
 
        /* NOTREACHED */
 }
 
-/***
- *     ckexpf - expfile and check return
+/*
+ *     expfile and check return
  *             print error if it failed.
  *
  *             print error if it failed.
  *
- *     return code - 0 - ok; FAIL if expfile failed
+ *     return code - SUCCESS - ok; FAIL if expfile failed
  */
 
 ckexpf(file)
  */
 
 ckexpf(file)
@@ -120,7 +115,7 @@ register char *file;
 {
 
        if (expfile(file) != FAIL)
 {
 
        if (expfile(file) != FAIL)
-               return 0;
+               return SUCCESS;
 
        /*  could not expand file name */
        /* the gwd routine failed */
 
        /*  could not expand file name */
        /* the gwd routine failed */
index 45de7e1..241c8e0 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)logent.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)logent.c   5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #ifdef BSD4_2
 #include <sys/time.h>
 #else
 #ifdef BSD4_2
 #include <sys/time.h>
 #else
@@ -15,46 +14,48 @@ static char sccsid[] = "@(#)logent.c        5.3 (Berkeley) %G%";
 
 extern time_t  time();
 
 
 extern time_t  time();
 
-/* This logfile stuff was awful -- it did output to an
- * unbuffered stream.
- *
- * This new version just open the single logfile and writes
- * the record in the stdio buffer.  Once that's done, it
- * positions itself at the end of the file (lseek), and
- * writes the buffer out.  This could mangle things but
- * it isn't likely. -- ittvax!swatt
- *
- * Under USG UNIX & 4.2BSD, the files are opened with "guaranteed append to end"
- * and the lseeks are removed.
- */
-
-
 static FILE *Lp = NULL;
 static FILE *Sp = NULL;
 static Ltried = 0;
 static Stried = 0;
 
 static FILE *Lp = NULL;
 static FILE *Sp = NULL;
 static Ltried = 0;
 static Stried = 0;
 
-/*******
- *     logent(text, status)    make log entry
- *     char *text, *status;
- *
- *     return code - none
+/*
+ *     make log entry
  */
  */
-
 logent(text, status)
 char *text, *status;
 {
 logent(text, status)
 char *text, *status;
 {
+#ifdef LOGBYSITE
+       char lfile[MAXFULLNAME];
+       static char LogRmtname[64];
+#endif LOGBYSITE
+       if (Rmtname[0] == '\0')
+               strcpy(Rmtname, Myname);
        /* Open the log file if necessary */
        /* Open the log file if necessary */
+#ifdef LOGBYSITE
+       if (strcmp(Rmtname, LogRmtname)) {
+               if (Lp != NULL)
+                       fclose(Lp);
+               Lp = NULL;
+               Ltried = 0;
+       }
+#endif LOGBYSITE
        if (Lp == NULL) {
                if (!Ltried) {
                        int savemask;
        if (Lp == NULL) {
                if (!Ltried) {
                        int savemask;
-#if defined(USG) || defined(BSD4_2)
+#ifdef F_SETFL
                        int flags;
 #endif
                        savemask = umask(LOGMASK);
                        int flags;
 #endif
                        savemask = umask(LOGMASK);
+#ifdef LOGBYSITE
+                       (void) sprintf(lfile, "%s/%s/%s", LOGBYSITE, Progname, Rmtname);
+                       strcpy(LogRmtname, Rmtname);
+                       Lp = fopen (lfile, "a");
+#else !LOGBYSITE
                        Lp = fopen (LOGFILE, "a");
                        Lp = fopen (LOGFILE, "a");
+#endif LOGBYSITE
                        umask(savemask);
                        umask(savemask);
-#if defined(USG) || defined(BSD4_2)
+#ifdef F_SETFL
                        flags = fcntl(fileno(Lp), F_GETFL, 0);
                        fcntl(fileno(Lp), F_SETFL, flags|O_APPEND);
 #endif
                        flags = fcntl(fileno(Lp), F_GETFL, 0);
                        fcntl(fileno(Lp), F_SETFL, flags|O_APPEND);
 #endif
@@ -69,8 +70,8 @@ char *text, *status;
        mlogent(Lp, status, text);
 }
 
        mlogent(Lp, status, text);
 }
 
-/***
- *     mlogent(fp, status, text)  - make a log entry
+/*
+ *     make a log entry
  */
 
 mlogent(fp, status, text)
  */
 
 mlogent(fp, status, text)
@@ -88,46 +89,39 @@ register FILE *fp;
                status = "";
        if (!pid)
                pid = getpid();
                status = "";
        if (!pid)
                pid = getpid();
-       if (Rmtname[0] == '\0')
-               strcpy(Rmtname, Myname);
        time(&clock);
        tp = localtime(&clock);
        fprintf(fp, "%s %s ", User, Rmtname);
 #ifdef USG
        fprintf(fp, "(%d/%d-%2.2d:%2.2d-%d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
        time(&clock);
        tp = localtime(&clock);
        fprintf(fp, "%s %s ", User, Rmtname);
 #ifdef USG
        fprintf(fp, "(%d/%d-%2.2d:%2.2d-%d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
-#endif
-#ifndef USG
+#else !USG
        fprintf(fp, "(%d/%d-%02d:%02d-%d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
        fprintf(fp, "(%d/%d-%02d:%02d-%d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
-#endif
+#endif !USG
        fprintf(fp, "%s (%s)\n", status, text);
 
        /* Since it's buffered */
        fprintf(fp, "%s (%s)\n", status, text);
 
        /* Since it's buffered */
-#ifndef USG
+#ifndef F_SETFL
        lseek (fileno(fp), (long)0, 2);
        lseek (fileno(fp), (long)0, 2);
-#endif
+#endif !F_SETFL
        fflush (fp);
        if (Debug) {
                fprintf(stderr, "%s %s ", User, Rmtname);
 #ifdef USG
                fprintf(stderr, "(%d/%d-%2.2d:%2.2d-%d) ", tp->tm_mon + 1,
                        tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
        fflush (fp);
        if (Debug) {
                fprintf(stderr, "%s %s ", User, Rmtname);
 #ifdef USG
                fprintf(stderr, "(%d/%d-%2.2d:%2.2d-%d) ", tp->tm_mon + 1,
                        tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
-#endif
-#ifndef USG
+#else !USG
                fprintf(stderr, "(%d/%d-%02d:%02d-%d) ", tp->tm_mon + 1,
                        tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
                fprintf(stderr, "(%d/%d-%02d:%02d-%d) ", tp->tm_mon + 1,
                        tp->tm_mday, tp->tm_hour, tp->tm_min, pid);
-#endif
+#endif !USG
                fprintf(stderr, "%s (%s)\n", status, text);
        }
 }
 
                fprintf(stderr, "%s (%s)\n", status, text);
        }
 }
 
-/***
- *     logcls()        close log file
- *
- *     return codes:  none
+/*
+ *     close log file
  */
  */
-
 logcls()
 {
        if (Lp != NULL)
 logcls()
 {
        if (Lp != NULL)
@@ -142,33 +136,46 @@ logcls()
 }
 
 
 }
 
 
-/***
- *     syslog(text)    make system log entry
- *     char *text;
- *
- *     return codes - none
+/*
+ *     make system log entry
  */
  */
-
 syslog(text)
 char *text;
 {
        register struct tm *tp;
        extern struct tm *localtime();
 syslog(text)
 char *text;
 {
        register struct tm *tp;
        extern struct tm *localtime();
-       time_t clock;
-
+       struct timeb clock;
+#ifdef LOGBYSITE
+       char lfile[MAXFULLNAME];
+       static char SLogRmtname[64];
+
+       if (strcmp(Rmtname, SLogRmtname)) {
+               if (Sp != NULL)
+                       fclose(Sp);
+               Sp = NULL;
+               Stried = 0;
+       }
+#endif LOGBYSITE
        if (Sp == NULL) {
                if (!Stried) {
                        int savemask;
        if (Sp == NULL) {
                if (!Stried) {
                        int savemask;
-#if defined(USG) || defined(BSD4_2)
+#ifdef F_SETFL
                        int flags;
                        int flags;
-#endif
+#endif F_SETFL
                        savemask = umask(LOGMASK);
                        savemask = umask(LOGMASK);
-                       Sp = fopen(SYSLOG, "a");
+#ifdef LOGBYSITE
+                       (void) sprintf(lfile, "%s/xferstats/%s", LOGBYSITE, Rmtname);
+                       strcpy(SLogRmtname, Rmtname);
+                       Sp = fopen (lfile, "a");
+#else !LOGBYSITE
+                       Sp = fopen (SYSLOG, "a");
+#endif LOGBYSITE
                        umask(savemask);
                        umask(savemask);
-#if defined(USG) || defined(BSD4_2)
+#ifdef F_SETFL
                        flags = fcntl(fileno(Sp), F_GETFL, 0);
                        fcntl(fileno(Sp), F_SETFL, flags|O_APPEND);
                        flags = fcntl(fileno(Sp), F_GETFL, 0);
                        fcntl(fileno(Sp), F_SETFL, flags|O_APPEND);
-#endif
+#endif F_SETFL
+
                }
                Stried = 1;
                if (Sp == NULL)
                }
                Stried = 1;
                if (Sp == NULL)
@@ -176,22 +183,29 @@ char *text;
                fioclex(fileno(Sp));
        }
 
                fioclex(fileno(Sp));
        }
 
-       time(&clock);
-       tp = localtime(&clock);
+#ifdef USG
+       time(&clock.time);
+       clock.millitm = 0;
+#else !USG
+       ftime(&clock);
+#endif !USG
+       tp = localtime(&clock.time);
 
        fprintf(Sp, "%s %s ", User, Rmtname);
 #ifdef USG
        fprintf(Sp, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min);
 
        fprintf(Sp, "%s %s ", User, Rmtname);
 #ifdef USG
        fprintf(Sp, "(%d/%d-%2.2d:%2.2d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min);
-#endif
-#ifndef USG
+       fprintf(Sp, "(%ld) %s\n", clock.time, text);
+#else !USG
        fprintf(Sp, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min);
        fprintf(Sp, "(%d/%d-%02d:%02d) ", tp->tm_mon + 1,
                tp->tm_mday, tp->tm_hour, tp->tm_min);
-#endif
-       fprintf(Sp, "(%ld) %s\n", clock, text);
+       fprintf(Sp, "(%ld.%02d) %s\n", clock.time, clock.millitm/10, text);
+#endif !USG
 
        /* Position at end and flush */
 
        /* Position at end and flush */
+#ifndef F_SETFL
        lseek (fileno(Sp), (long)0, 2);
        lseek (fileno(Sp), (long)0, 2);
+#endif F_SETFL
        fflush (Sp);
 }
 
        fflush (Sp);
 }
 
index 9fc02ff..3eaa06e 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)mailst.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)mailst.c   5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
@@ -18,7 +18,7 @@ char *user, *str, *file;
        char buf[BUFSIZ];
        register int c;
 
        char buf[BUFSIZ];
        register int c;
 
-       sprintf(buf, "%s %s", MAIL, user);
+       sprintf(buf, "%s '%s'", MAIL, user);
        if ((fp = rpopen(buf, "w")) != NULL) {
                fprintf(fp, "From: uucp\nTo: %s\nSubject: %s\n\n", user, str);
                if (file && *file != '\0' && (fi = fopen(subfile(file), "r")) != NULL) {
        if ((fp = rpopen(buf, "w")) != NULL) {
                fprintf(fp, "From: uucp\nTo: %s\nSubject: %s\n\n", user, str);
                if (file && *file != '\0' && (fi = fopen(subfile(file), "r")) != NULL) {
index 7d92358..e4539dc 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)subdir.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)subdir.c   5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
@@ -13,7 +13,7 @@ static char sccsid[] = "@(#)subdir.c  5.2 (Berkeley) %G%";
  *
  * Each prefix must be a subdirectory of Spool, owned by uucp!
  * Remember: use cron to uuclean these directories daily,
  *
  * Each prefix must be a subdirectory of Spool, owned by uucp!
  * Remember: use cron to uuclean these directories daily,
- * and check them manual every now and then.  Beware complacency!
+ * and check them manually every now and then.  Beware complacency!
  */
 
 static char *prefix[] = {
  */
 
 static char *prefix[] = {
@@ -65,7 +65,7 @@ char *as;
        }
        else
                if (!inspool)
        }
        else
                if (!inspool)
-                       return(as);
+                       return as;
 
        /* look for first prefix which matches, and make subdirectory */
        for (p = &prefix[0]; *p; p++) {
 
        /* look for first prefix which matches, and make subdirectory */
        for (p = &prefix[0]; *p; p++) {
@@ -73,10 +73,10 @@ char *as;
                        strcat(tptr, *p);
                        strcat(tptr, "/");
                        strcat(tptr, s);
                        strcat(tptr, *p);
                        strcat(tptr, "/");
                        strcat(tptr, s);
-                       return(tptr);
+                       return tptr;
                }
        }
                }
        }
-       return(as);
+       return as;
 }
 
 /*
 }
 
 /*
@@ -86,7 +86,7 @@ subchdir(s)
 register char *s;
 {
        inspool = (strcmp(s, Spool) == 0);
 register char *s;
 {
        inspool = (strcmp(s, Spool) == 0);
-       return(chdir(s));
+       return chdir(s);
 }
 
 /*
 }
 
 /*
@@ -98,8 +98,8 @@ register char *d, pre;
 {
        if (strcmp(d, Spool) == 0)
                if (pre == CMDPRE)
 {
        if (strcmp(d, Spool) == 0)
                if (pre == CMDPRE)
-                       return(CMDSDIR);
+                       return CMDSDIR;
                else if (pre == XQTPRE)
                else if (pre == XQTPRE)
-                       return(XEQTDIR);
-       return(d);
+                       return XEQTDIR;
+       return d;
 }
 }
index 16439c3..1738b02 100644 (file)
@@ -1,23 +1,18 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)systat.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)systat.c   5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 
 extern time_t  time();
 
 #define STATNAME(f, n) sprintf(f, "%s/%s/%.7s", Spool, "STST", n)
 #define S_SIZE 100
 
 
 extern time_t  time();
 
 #define STATNAME(f, n) sprintf(f, "%s/%s/%.7s", Spool, "STST", n)
 #define S_SIZE 100
 
-/*******
- *     systat(name, type, text)        make system status entry
- *     char *name, *text;
- *     int type.
- *
+/*
+ *     make system status entry
  *     return codes:  none
  */
  *     return codes:  none
  */
-
 systat(name, type, text)
 char *name, *text;
 int type;
 systat(name, type, text)
 char *name, *text;
 int type;
index a110334..0a62e19 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)ulockf.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)ulockf.c   5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 
 extern time_t  time();
 #include <sys/stat.h>
 
 extern time_t  time();
@@ -21,8 +20,8 @@ extern time_t time();
  *     return codes:  0  |  FAIL
  */
 
  *     return codes:  0  |  FAIL
  */
 
-ulockf(file, atime)
-register char *file;
+ulockf(hfile, atime)
+char *hfile;
 time_t atime;
 {
        struct stat stbuf;
 time_t atime;
 {
        struct stat stbuf;
@@ -30,11 +29,13 @@ time_t atime;
        register int ret;
        static int pid = -1;
        static char tempfile[NAMESIZE];
        register int ret;
        static int pid = -1;
        static char tempfile[NAMESIZE];
+       char file[NAMESIZE];
 
        if (pid < 0) {
                pid = getpid();
                sprintf(tempfile, "%s/LTMP.%d", LOCKDIR, pid);
        }
 
        if (pid < 0) {
                pid = getpid();
                sprintf(tempfile, "%s/LTMP.%d", LOCKDIR, pid);
        }
+       sprintf(file, "%s/%s", LOCKDIR, hfile);
        if (onelock(pid, tempfile, file) == -1) {
                /* lock file exists */
                /* get status to check age of the lock file */
        if (onelock(pid, tempfile, file) == -1) {
                /* lock file exists */
                /* get status to check age of the lock file */
@@ -203,7 +204,7 @@ char *sys;
 {
        char lname[NAMESIZE];
 
 {
        char lname[NAMESIZE];
 
-       sprintf(lname, "%s/%s.%s", LOCKDIR, LOCKPRE, sys);
+       sprintf(lname, "%s.%s", LOCKPRE, sys);
        return ulockf(lname, (time_t) SLCKTIME ) < 0 ? FAIL : SUCCESS;
 }
 
        return ulockf(lname, (time_t) SLCKTIME ) < 0 ? FAIL : SUCCESS;
 }
 
index 8e87a1e..123d761 100644 (file)
@@ -1,12 +1,13 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uucpdefs.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uucpdefs.c 5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 
 char Progname[64];
 int Ifn, Ofn;
 #endif
 
 #include "uucp.h"
 
 char Progname[64];
 int Ifn, Ofn;
-char Rmtname[64];
+char RRmtname[64];
+char *Rmtname = RRmtname;
 char User[128];
 char Loginuser[16];
 char Myname[16];
 char User[128];
 char Loginuser[16];
 char Myname[16];
@@ -23,6 +24,7 @@ long Retrytime;
 short Usrf = 0;                        /* Uustat global flag */
 int IsTcpIp = 0;       /* 1 == TCP/IP connection, else 0.  kludge to suppress ioctl */
 char MaxGrade = '\177';
 short Usrf = 0;                        /* Uustat global flag */
 int IsTcpIp = 0;       /* 1 == TCP/IP connection, else 0.  kludge to suppress ioctl */
 char MaxGrade = '\177';
+char DefMaxGrade = '\177';
 int nologinflag = 0;
 char NOLOGIN[] = "/etc/nologin";
 
 int nologinflag = 0;
 char NOLOGIN[] = "/etc/nologin";
 
index 62f5f32..42a6993 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uucpname.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uucpname.c 5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 
 #ifdef GETMYHNAME
 #include <sys/stat.h>
 
 #ifdef GETMYHNAME
index ecad378..93a83bb 100644 (file)
@@ -1,29 +1,36 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)versys.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)versys.c   5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
+#include <stdio.h>
+#include <ctype.h>
 
 #define SNAMESIZE 7
 
 
 #define SNAMESIZE 7
 
-/*******
- *     versys(name)    verify system names n1 and n2
- *     char *name;
+/*
+ *     verify system names n1 and n2
+ *     return codes:  SUCCESS  |  FAIL
  *
  *
- *     return codes:  0  |  FAIL
+ *     NOTE:
+ *             the old calling sequence was versys(name) but is
+ *     now versys(&name) so that we can perform aliasing!!!!
+ *     See accompanying changes in uucp.c and uux.c
+ *             -- Ray Essick, April 27, 1984
  */
  */
-
-versys(name)
-register char *name;
+versys(nameptr)
+register char **nameptr;
 {
        register FILE *fp;
 {
        register FILE *fp;
-       char line[1000];
-       char s1[SNAMESIZE + 1];
-       char myname[SNAMESIZE + 1];
+       char line[BUFSIZ];
+       char *name;
+
+       DEBUG (11, "Before Alias: %s\n", *nameptr);
+       uualias(nameptr);                       /* alias expansion */
+       DEBUG (11, "After Alias: %s\n", *nameptr);
+       name = *nameptr;                        /* dereference */
 
 
-       sprintf(myname, "%.7s", Myname);
-       sprintf(s1, "%.7s", name);
-       if (strcmp(s1, myname) == 0)
+       if (strncmp(name, Myname, 7) == 0)
                return SUCCESS;
 
        fp = fopen(SYSFILE, "r");
                return SUCCESS;
 
        fp = fopen(SYSFILE, "r");
@@ -32,8 +39,7 @@ register char *name;
                char *targs[100];
 
                getargs(line, targs, 100);
                char *targs[100];
 
                getargs(line, targs, 100);
-               targs[0][7] = '\0';
-               if (strcmp(s1, targs[0]) == SAME) {
+               if (strncmp(name, targs[0], 7) == SAME) {
                        fclose(fp);
                        return SUCCESS;
                }
                        fclose(fp);
                        return SUCCESS;
                }
@@ -41,3 +47,66 @@ register char *name;
        fclose(fp);
        return FAIL;
 }
        fclose(fp);
        return FAIL;
 }
+
+/*
+ *     Works (sort of) like rhost(3) on 4.1[abc] Bsd systems.
+ *
+ *     Looks for the host in the L.aliases file and returns the
+ *     "standard" name by modifying the pointer. The returned
+ *     value is saved with malloc(3) so it isn't zapped by
+ *     subsequent calls.
+ *
+ *     Returns:
+ *             FAIL            No L.aliases file
+ *             SUCCESS         Anything else
+ */
+
+uualias(hostptr)
+char  **hostptr;                         /* we change it */
+{
+       FILE * Aliases;                   /* list of aliases */
+       char buf[BUFSIZ];
+       int atend;
+       char *p, *q;
+       char *koshername;                /* "official" name */
+
+       if ((Aliases = fopen(ALIASFILE, "r")) == NULL) {
+               DEBUG(11, "No %s file\n", ALIASFILE);
+               return FAIL;                      /* no alias file */
+       }
+
+       DEBUG (11, "Alias expansion for %s\n", *hostptr);
+       while (fgets(buf, sizeof (buf), Aliases)) {
+               if (buf[0] == '#')                /* comment line */
+                       continue;
+               p = &buf[0];
+               atend = 0;
+               DEBUG(11, "Alias line: %s\n", buf);
+
+               while (!atend) {
+                       while (isspace(*p) && *p != '\n')
+                               p++;                      /* skip white space */
+                       q = p;
+                       while (!isspace(*q) && *q != '\n')
+                               q++;                      /* find end */
+                       if (*q == '\n')
+                               atend++;                  /* last entry */
+                       *q = '\0';
+                       DEBUG(11, "Compare against: %s\n", p);
+                       if (strcmp(*hostptr, p) == 0)/* match? */ {
+                               koshername = malloc(strlen(buf) + 1);
+                               strcpy(koshername, buf); /* save it */
+                               fclose(Aliases);
+                               DEBUG(4, "Alias: %s to ", *hostptr);
+                               DEBUG(4, "%s\n", koshername);
+                               *hostptr = koshername;    /* correct one */
+                               return SUCCESS;           /* all is well */
+                       }
+                       p = q + 1;                        /* try next entry */
+               }
+
+       }
+       fclose(Aliases);
+       DEBUG(11, "Alias doesn't match %s, remains unchanged\n", *hostptr);
+       return SUCCESS;                           /* unchanged host */
+}
index c7036b3..16e7b03 100644 (file)
@@ -1,11 +1,10 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)cico.c     5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)cico.c     5.6 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #include <signal.h>
 #include <setjmp.h>
 #endif
 
 #include "uucp.h"
 #include <signal.h>
 #include <setjmp.h>
-#include <sys/types.h>
 #ifdef USG
 #include <termio.h>
 #endif
 #ifdef USG
 #include <termio.h>
 #endif
@@ -54,8 +53,10 @@ int ReverseRole = 0;
 int StdErrIsTty = 0;
 int Role = SLAVE;
 int onesys = 0;
 int StdErrIsTty = 0;
 int Role = SLAVE;
 int onesys = 0;
+int turntime = 30 * 60;        /* 30 minutes expressed in seconds */
 extern int LocalOnly;
 extern int LocalOnly;
-extern char MaxGrade;
+extern char MaxGrade, DefMaxGrade;
+extern char Myfullname[];
 
 #ifdef USG
 struct termio Savettyb;
 
 #ifdef USG
 struct termio Savettyb;
@@ -111,7 +112,8 @@ register char *argv[];
                        Spool = &argv[1][2];
                        break;
                case 'g':
                        Spool = &argv[1][2];
                        break;
                case 'g':
-                       MaxGrade = argv[1][2];
+               case 'p':
+                       MaxGrade = DefMaxGrade = argv[1][2];
                        break;
                case 'r':
                        Role = atoi(&argv[1][2]);
                        break;
                case 'r':
                        Role = atoi(&argv[1][2]);
@@ -133,6 +135,9 @@ register char *argv[];
                        strcat(rflags, argv[1]);
                        logent("ENABLED", "DEBUG");
                        break;
                        strcat(rflags, argv[1]);
                        logent("ENABLED", "DEBUG");
                        break;
+               case 't':
+                       turntime = atoi(&argv[1][2])*60;/* minutes to seconds */
+                       break;
                case 'L':       /* local calls only */
                        LocalOnly++;
                        break;
                case 'L':       /* local calls only */
                        LocalOnly++;
                        break;
@@ -223,7 +228,7 @@ register char *argv[];
 #else  !BSD4_2
                setbuf(stderr, NULL);
 #endif !BSD4_2
 #else  !BSD4_2
                setbuf(stderr, NULL);
 #endif !BSD4_2
-               sprintf(msg, "here=%s", Myname);
+               sprintf(msg, "here=%s", Myfullname);
                omsg('S', msg, Ofn);
                signal(SIGALRM, timeout);
                alarm(MAXMSGTIME);
                omsg('S', msg, Ofn);
                signal(SIGALRM, timeout);
                alarm(MAXMSGTIME);
@@ -329,7 +334,7 @@ register char *argv[];
 
 #ifdef NOSTRANGERS
                /* If we don't know them, we won't talk to them... */
 
 #ifdef NOSTRANGERS
                /* If we don't know them, we won't talk to them... */
-               if (versys(Rmtname)) {
+               if (versys(&Rmtname)) {
                        logent(Rmtname, "UNKNOWN HOST");
                        omsg('R', "You are unknown to me", Ofn);
                        cleanup(0);
                        logent(Rmtname, "UNKNOWN HOST");
                        omsg('R', "You are unknown to me", Ofn);
                        cleanup(0);
@@ -363,6 +368,10 @@ register char *argv[];
                        case 'Q':
                                seq = atoi(++p);
                                break;
                        case 'Q':
                                seq = atoi(++p);
                                break;
+                       case 'p':
+                               MaxGrade = DefMaxGrade = *++p;
+                               DEBUG(4, "MaxGrade set to %c\n", MaxGrade);
+                               break;
                        default:
                                break;
                        }
                        default:
                                break;
                        }
@@ -446,6 +455,7 @@ loop:
                }
                /*  master part */
                signal(SIGHUP, SIG_IGN);
                }
                /*  master part */
                signal(SIGHUP, SIG_IGN);
+               MaxGrade = DefMaxGrade;
                if (!iswrk(file, "chk", Spool, wkpre) && !onesys) {
                        logent(Rmtname, "NO WORK");
                        goto next;
                if (!iswrk(file, "chk", Spool, wkpre) && !onesys) {
                        logent(Rmtname, "NO WORK");
                        goto next;
@@ -511,6 +521,12 @@ loop:
 #else !GNXSEQ
                seq = 0;
 #endif !GNXSEQ
 #else !GNXSEQ
                seq = 0;
 #endif !GNXSEQ
+               if (MaxGrade != '\177') {
+                       char buf[10];
+                       sprintf(buf, " -p%c", MaxGrade);
+                       strcat(rflags, buf);
+               }
+
                sprintf(msg, "%.7s -Q%d %s", Myname, seq, rflags);
                omsg('S', msg, Ofn);
                for (;;) {
                sprintf(msg, "%.7s -Q%d %s", Myname, seq, rflags);
                omsg('S', msg, Ofn);
                for (;;) {
@@ -559,7 +575,7 @@ loop:
        DEBUG(1, "Loginuser - %s\n", Loginuser);
 
        alarm(MAXMSGTIME);
        DEBUG(1, "Loginuser - %s\n", Loginuser);
 
        alarm(MAXMSGTIME);
-       if (setjmp(Sjbuf))
+       if (ret=setjmp(Sjbuf))
                goto Failure;
        ret = startup(Role);
        alarm(0);
                goto Failure;
        ret = startup(Role);
        alarm(0);
@@ -567,7 +583,8 @@ loop:
                logent("startup", _FAILED);
 Failure:
                US_SST(us_s_start);
                logent("startup", _FAILED);
 Failure:
                US_SST(us_s_start);
-               systat(Rmtname, SS_FAIL, "STARTUP FAILED");
+               systat(Rmtname, SS_FAIL, ret > 0 ? "CONVERSATION FAILED" :
+                       "STARTUP FAILED");
                goto next;
        } else {
                logent("startup", "OK");
                goto next;
        } else {
                logent("startup", "OK");
@@ -640,7 +657,13 @@ register int code;
                        ret = ioctl(0, TCSETA, &Savettyb);
 #else !USG
                        ret = ioctl(0, TIOCHPCL, STBNULL);
                        ret = ioctl(0, TCSETA, &Savettyb);
 #else !USG
                        ret = ioctl(0, TIOCHPCL, STBNULL);
+#ifdef TIOCSDTR
+                       ret = ioctl(0, TIOCCDTR, STBNULL);
+                       sleep(2);
+                       ret = ioctl(0, TIOCSDTR, STBNULL);
+#else !TIOCSDTR
                        ret = ioctl(0, TIOCGETP, &Hupvec);
                        ret = ioctl(0, TIOCGETP, &Hupvec);
+#endif !TIOCSDTR
                        Hupvec.sg_ispeed = B0;
                        Hupvec.sg_ospeed = B0;
                        ret = ioctl(0, TIOCSETP, &Hupvec);
                        Hupvec.sg_ispeed = B0;
                        Hupvec.sg_ospeed = B0;
                        ret = ioctl(0, TIOCSETP, &Hupvec);
@@ -661,6 +684,10 @@ register int code;
                close(Ifn);
                close(Ofn);
        }
                close(Ifn);
                close(Ofn);
        }
+#ifdef DIALINOUT
+       /* reenable logins on dialout */
+       reenable();
+#endif DIALINOUT
        if (code == 0)
                xuuxqt();
        else
        if (code == 0)
                xuuxqt();
        else
@@ -685,7 +712,7 @@ register int inter;
        sprintf(str, "SIGNAL %d", inter);
        logent(str, "CAUGHT");
        US_SST(us_s_intr);
        sprintf(str, "SIGNAL %d", inter);
        logent(str, "CAUGHT");
        US_SST(us_s_intr);
-       if (*Rmtname && strcmp(Rmtname, Myname))
+       if (*Rmtname && strncmp(Rmtname, Myname, 7))
                systat(Rmtname, SS_FAIL, str);
        if (inter == SIGPIPE && !onesys)
                longjmp(Pipebuf, 1);
                systat(Rmtname, SS_FAIL, str);
        if (inter == SIGPIPE && !onesys)
                longjmp(Pipebuf, 1);
@@ -768,7 +795,7 @@ register int tty;
 timeout()
 {
        logent(Rmtname, "TIMEOUT");
 timeout()
 {
        logent(Rmtname, "TIMEOUT");
-       if (*Rmtname && strcmp(Rmtname, Myname)) {
+       if (*Rmtname && strncmp(Rmtname, Myname, 7)) {
                US_SST(us_s_tmot);
                systat(Rmtname, SS_FAIL, "TIMEOUT");
        }
                US_SST(us_s_tmot);
                systat(Rmtname, SS_FAIL, "TIMEOUT");
        }
index 33a4331..be75009 100644 (file)
@@ -1,13 +1,14 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)cntrl.c    5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)cntrl.c    5.5 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #include "uust.h"
 
 extern int errno;
 #include <sys/stat.h>
 #include "uust.h"
 
 extern int errno;
+extern int turntime;
+int willturn;
 
 struct Proto {
        char P_id;
 
 struct Proto {
        char P_id;
@@ -51,10 +52,13 @@ int (*Rdmsg)()=imsg, (*Rddata)();
 int (*Wrmsg)()=omsg, (*Wrdata)();
 int (*Turnon)(), (*Turnoff)();
 
 int (*Wrmsg)()=omsg, (*Wrdata)();
 int (*Turnon)(), (*Turnoff)();
 
+struct timeb Now, LastTurned;
 
 static char *YES = "Y";
 static char *NO = "N";
 
 
 static char *YES = "Y";
 static char *NO = "N";
 
+int TransferSucceeded = 1;
+
 /*  failure messages  */
 #define EM_MAX         6
 #define EM_LOCACC      "N1"    /* local access to file denied */
 /*  failure messages  */
 #define EM_MAX         6
 #define EM_LOCACC      "N1"    /* local access to file denied */
@@ -138,12 +142,30 @@ char *wkpre;
 
        pnum = getpid();
        Wfile[0] = '\0';
 
        pnum = getpid();
        Wfile[0] = '\0';
+       willturn = turntime > 0;
+remaster:
+#ifdef USG
+       time(&LastTurned.time);
+       LastTurned.millitm = 0;
+#else !USG
+       ftime(&LastTurned);
+#endif !USG
+       send_or_receive = RESET;
 top:
        for (i = 0; i < sizeof wrkvec / sizeof wrkvec[0]; i++)
                wrkvec[i] = 0;
        DEBUG(4, "*** TOP ***  -  role=%s\n", role ? "MASTER" : "SLAVE");
        setline(RESET);
 top:
        for (i = 0; i < sizeof wrkvec / sizeof wrkvec[0]; i++)
                wrkvec[i] = 0;
        DEBUG(4, "*** TOP ***  -  role=%s\n", role ? "MASTER" : "SLAVE");
        setline(RESET);
-       send_or_receive = RESET;
+       if (nologinflag) {
+               logent(NOLOGIN, "UUCICO SHUTDOWN");
+               if (Debug)
+                       logent("DEBUGGING", "continuing anyway");
+               else {
+                       WMESG(HUP, YES);
+                       RMESG(HUP, msg, 1);
+                       goto process;
+               }
+       }
        if (role == MASTER) {
                /* get work */
                if (ReverseRole || (narg = gtwvec(Wfile, Spool, wkpre, wrkvec)) == 0) {
        if (role == MASTER) {
                /* get work */
                if (ReverseRole || (narg = gtwvec(Wfile, Spool, wkpre, wrkvec)) == 0) {
@@ -250,14 +272,16 @@ sendmsg:
 
        /* role is slave */
        RAMESG(msg, 1);
 
        /* role is slave */
        RAMESG(msg, 1);
-       goto process;
-
+       if (willturn < 0)
+               willturn = msg[0] == HUP;
+                       
 process:
        DEBUG(4, "PROCESS: msg - %s\n", msg);
        switch (msg[0]) {
 
        case RQSTCMPT:
                DEBUG(4, "RQSTCMPT:\n", CNULL);
 process:
        DEBUG(4, "PROCESS: msg - %s\n", msg);
        switch (msg[0]) {
 
        case RQSTCMPT:
                DEBUG(4, "RQSTCMPT:\n", CNULL);
+               TransferSucceeded = msg[1] == 'Y';
                if (msg[1] == 'N') {
                        i = atoi(&msg[2]);
                        if (i<0 || i>EM_MAX) i=0;
                if (msg[1] == 'N') {
                        i = atoi(&msg[2]);
                        if (i<0 || i>EM_MAX) i=0;
@@ -276,6 +300,20 @@ process:
                if (role == MASTER) {
                        notify(mailopt, W_USER, W_FILE1, Rmtname, &msg[1]);
                }
                if (role == MASTER) {
                        notify(mailopt, W_USER, W_FILE1, Rmtname, &msg[1]);
                }
+               if (msg[2] == 'M') {
+                       extern int Nfiles;
+                       WMESG(HUP, "");
+                       RMESG(HUP, msg, 1);
+                       logent(Rmtname, "TURNAROUND");
+#ifdef USG
+                               time(&LastTurned.time);
+                               LastTurned.millitm = 0;
+#else !USG
+                               ftime(&LastTurned);
+#endif !USG
+                       Nfiles = 0; /* force rescan of queue for work */
+                       goto process;
+               }
                goto top;
 
        case HUP:
                goto top;
 
        case HUP:
@@ -292,7 +330,7 @@ process:
                if (msg[1] == 'N') {
                        ASSERT(role == MASTER, "WRONG ROLE - HUP", CNULL, role);
                        role = SLAVE;
                if (msg[1] == 'N') {
                        ASSERT(role == MASTER, "WRONG ROLE - HUP", CNULL, role);
                        role = SLAVE;
-                       goto top;
+                       goto remaster;
                }
 
                /* get work */
                }
 
                /* get work */
@@ -304,7 +342,7 @@ process:
 
                WMESG(HUP, NO);
                role = MASTER;
 
                WMESG(HUP, NO);
                role = MASTER;
-               goto top;
+               goto remaster;
 
        case XUUCP:
                if (role == MASTER) {
 
        case XUUCP:
                if (role == MASTER) {
@@ -455,6 +493,7 @@ process:
                fflush(fp);
                if (ferror(fp) || fclose(fp))
                        ret = FAIL;
                fflush(fp);
                if (ferror(fp) || fclose(fp))
                        ret = FAIL;
+
                if (ret != SUCCESS) {
                        (void) unlinkdf(Dfile);
                        (*Turnoff)();
                if (ret != SUCCESS) {
                        (void) unlinkdf(Dfile);
                        (*Turnoff)();
@@ -463,7 +502,13 @@ process:
                /* copy to user directory */
                ntfyopt = index(W_OPTNS, 'n') != NULL;
                status = xmv(Dfile, filename);
                /* copy to user directory */
                ntfyopt = index(W_OPTNS, 'n') != NULL;
                status = xmv(Dfile, filename);
-               WMESG(RQSTCMPT, status ? EM_RMTCP : YES);
+
+               if (willturn && Now.time > (LastTurned.time+turntime)
+                       && iswrk(Wfile, "chk", Spool, wkpre)) {
+                               WMESG(RQSTCMPT, status ? EM_RMTCP : "YM");
+                               willturn = -1;
+               } else
+                       WMESG(RQSTCMPT, status ? EM_RMTCP : YES);
                if (i == 0)
                        ;       /* vanilla file, nothing to do */
                else if (status == 0) {
                if (i == 0)
                        ;       /* vanilla file, nothing to do */
                else if (status == 0) {
@@ -528,7 +573,12 @@ process:
                                strcat(filename, lastpart(W_FILE1));
                        }
                        status = xmv(Dfile, filename);
                                strcat(filename, lastpart(W_FILE1));
                        }
                        status = xmv(Dfile, filename);
-                       WMESG(RQSTCMPT, status ? EM_RMTCP : YES);
+                       if (willturn && Now.time > (LastTurned.time+turntime)
+                               && iswrk(Wfile, "chk", Spool, wkpre)) {
+                                       WMESG(RQSTCMPT, status ? EM_RMTCP : "YM");
+                                       willturn = -1;
+                       } else
+                               WMESG(RQSTCMPT, status ? EM_RMTCP : YES);
                        notify(mailopt, W_USER, filename, Rmtname,
                          status ? EM_LOCCP : YES);
                        if (status == 0) {
                        notify(mailopt, W_USER, filename, Rmtname,
                          status ? EM_LOCCP : YES);
                        if (status == 0) {
index 131d39b..1fc19d3 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)condevs.c  5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)condevs.c  5.9 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -58,9 +58,16 @@ struct condev condevs[] = {
 #ifdef DF02
        { "ACU", "DF02", Acuopn, df2opn, df2cls },
 #endif DF02
 #ifdef DF02
        { "ACU", "DF02", Acuopn, df2opn, df2cls },
 #endif DF02
+#ifdef DF112
+       { "ACU", "DF112P", Acuopn, df12popn, df12cls },
+       { "ACU", "DF112T", Acuopn, df12topn, df12cls },
+#endif DF112
 #ifdef VENTEL
        { "ACU", "ventel", Acuopn, ventopn, ventcls },
 #endif VENTEL
 #ifdef VENTEL
        { "ACU", "ventel", Acuopn, ventopn, ventcls },
 #endif VENTEL
+#ifdef PENRIL
+       { "ACU", "penril", Acuopn, penopn, pencls },
+#endif PENRIL
 #ifdef VADIC
        { "ACU", "vadic", Acuopn, vadopn, vadcls },
 #endif VADIC
 #ifdef VADIC
        { "ACU", "vadic", Acuopn, vadopn, vadcls },
 #endif VADIC
@@ -222,10 +229,9 @@ register int fd;
        }
 }
 
        }
 }
 
-/***
- *     Acuopn - open an ACU and dial the number.  The condevs table
- *             will be searched until a dialing unit is found that is
- *             free.
+/*
+ *     open an ACU and dial the number.  The condevs table
+ *     will be searched until a dialing unit is found that is free.
  *
  *     return codes:   >0 - file number - o.k.
  *                     FAIL - failed
  *
  *     return codes:   >0 - file number - o.k.
  *                     FAIL - failed
@@ -235,72 +241,89 @@ char devSel[20];  /* used for later unlock() */
 Acuopn(flds)
 register char *flds[];
 {
 Acuopn(flds)
 register char *flds[];
 {
-    char phone[MAXPH+1];
-    register struct condev *cd;
-    register int fd, acustatus;
-    register FILE *dfp;
-    struct Devices dev;
-    int retval = CF_NODEV;
-
-    exphone(flds[F_PHONE], phone);
-    devSel[0] = '\0';
-    DEBUG(4, "Dialing %s\n", phone);
-    dfp = fopen(DEVFILE, "r");
-    ASSERT(dfp != NULL, "Can't open", DEVFILE, 0);
-
-    acustatus = 0;     /* none found, none locked */
-    for(cd = condevs; cd->CU_meth != NULL; cd++) {
-       if (snccmp(flds[F_LINE], cd->CU_meth) == SAME) {
-           rewind(dfp);
-           while(rddev(dfp, &dev) != FAIL) {
-               /*
-                * for each ACU L.sys line, try at most twice
-                * (TRYCALLS) to establish carrier.  The old way tried every
-                * available dialer, which on big sites takes forever!
-                * Sites with a single auto-dialer get one try.
-                * Sites with multiple dialers get a try on each of two
-                * different dialers.
-                * To try 'harder' to connect to a remote site,
-                * use multiple L.sys entries.
-                */
-               if (acustatus > TRYCALLS)
-                       continue;
-               if (strcmp(flds[F_CLASS], dev.D_class) != SAME)
-                   continue;
-               if (snccmp(flds[F_LINE], dev.D_type) != SAME)
-                   continue;
-               if (dev.D_brand[0] == '\0')
-                   logent("Acuopn","No 'brand' name on ACU");
-               else if (snccmp(dev.D_brand, cd->CU_brand) != SAME)
-                   continue;
-               if (acustatus < 1)
-                       acustatus = 1;  /* has been found */
-               if (mlock(dev.D_line) == FAIL)
-                   continue;
-
-               DEBUG(4, "Using %s\n", cd->CU_brand);
-               acustatus++;
-               fd = (*(cd->CU_open))(phone, flds, &dev);
-               if (fd > 0) {
-                   CU_end = cd->CU_clos;   /* point CU_end at close func */
-                   fclose(dfp);
-                   strcpy(devSel, dev.D_line);   /* save for later unlock() */
-                   return fd;
-                   }
-               delock(dev.D_line);
-               retval = CF_DIAL;
+       char phone[MAXPH+1];
+       register struct condev *cd;
+       register int fd, acustatus;
+       register FILE *dfp;
+       struct Devices dev;
+       int retval = CF_NODEV;
+
+       exphone(flds[F_PHONE], phone);
+       devSel[0] = '\0';
+       DEBUG(4, "Dialing %s\n", phone);
+       dfp = fopen(DEVFILE, "r");
+       ASSERT(dfp != NULL, "Can't open", DEVFILE, 0);
+
+       acustatus = 0;  /* none found, none locked */
+       for(cd = condevs; cd->CU_meth != NULL; cd++) {
+               if (snccmp(flds[F_LINE], cd->CU_meth) == SAME) {
+                       rewind(dfp);
+                       while(rddev(dfp, &dev) != FAIL) {
+                       /*
+                        * for each ACU L.sys line, try at most twice
+                        * (TRYCALLS) to establish carrier.  The old way tried every
+                        * available dialer, which on big sites takes forever!
+                        * Sites with a single auto-dialer get one try.
+                        * Sites with multiple dialers get a try on each of two
+                        * different dialers.
+                        * To try 'harder' to connect to a remote site,
+                        * use multiple L.sys entries.
+                        */
+                       if (acustatus > TRYCALLS)
+                               continue;
+                       if (strcmp(flds[F_CLASS], dev.D_class) != SAME)
+                               continue;
+                       if (snccmp(flds[F_LINE], dev.D_type) != SAME)
+                               continue;
+                       if (dev.D_brand[0] == '\0') {
+                               logent("Acuopn","No 'brand' name on ACU");
+                               continue;
+                       }
+                       for(cd = condevs; cd->CU_meth != NULL; cd++) {
+                               if (snccmp(flds[F_LINE], cd->CU_meth) == SAME
+                                       && snccmp(dev.D_brand, cd->CU_brand) == SAME)
+                                       break;
+                       }
+                       if (cd->CU_meth == NULL) {
+                               logent(dev.D_brand,"unsupported ACU type");
+                               continue;
+                       }
+
+                       if (acustatus < 1)
+                               acustatus = 1;  /* has been found */
+                       if (mlock(dev.D_line) == FAIL)
+                               continue;
+#ifdef DIALINOUT
+                       if (snccmp("inout", dev.D_calldev) == SAME
+                               && disable(dev.D_line) == FAIL) {
+                                       delock(dev.D_line);
+                                       continue;
+                       }
+#endif DIALINOUT
+
+                       DEBUG(4, "Using %s\n", cd->CU_brand);
+                       acustatus++;
+                       fd = (*(cd->CU_open))(phone, flds, &dev);
+                       if (fd > 0) {
+                               CU_end = cd->CU_clos;   /* point CU_end at close func */
+                               fclose(dfp);
+                               strcpy(devSel, dev.D_line);   /* save for later unlock() */
+                               return fd;
+                       } else
+                               delock(dev.D_line);
+                       retval = CF_DIAL;
+                       }
                }
                }
-           }
        }
        }
-    fclose(dfp);
-    if (acustatus == 0)
-       logent("L-devices", "No appropriate ACU");
-    if (acustatus == 1)
-       logent("DEVICE", "NO");
-    return retval;
+       fclose(dfp);
+       if (acustatus == 0)
+               logent("L-devices", "No appropriate ACU");
+       if (acustatus == 1)
+               logent("DEVICE", "NO");
+       return retval;
 }
 
 }
 
-#if defined(VENTEL) || defined(NOVATION)
+#if defined(VENTEL) || defined(NOVATION) || defined(DF112)
 /*
  * uucpdelay:  delay execution for numerator/denominator seconds.
  */
 /*
  * uucpdelay:  delay execution for numerator/denominator seconds.
  */
@@ -324,7 +347,7 @@ turn off timer.
 #define uucpdelay(num,denom) nap(60*num/denom)
 /*     Sleep in increments of 60ths of second. */
 nap (time)
 #define uucpdelay(num,denom) nap(60*num/denom)
 /*     Sleep in increments of 60ths of second. */
 nap (time)
-       register int time;
+register int time;
 {
        static int fd;
 
 {
        static int fd;
 
@@ -337,7 +360,6 @@ nap (time)
 
 #ifdef FTIME
 #define uucpdelay(num,denom) ftimedelay(1000*num/denom)
 
 #ifdef FTIME
 #define uucpdelay(num,denom) ftimedelay(1000*num/denom)
-#include <sys/timeb.h>
 ftimedelay(n)
 {
        static struct timeb loctime;
 ftimedelay(n)
 {
        static struct timeb loctime;
@@ -371,4 +393,96 @@ register char *str;
        }
        DEBUG(6, "\n", CNULL);
 }
        }
        DEBUG(6, "\n", CNULL);
 }
-#endif VENTEL || NOVATION
+#endif VENTEL || NOVATION || DF112
+
+#ifdef DIALINOUT
+/* DIALIN/OUT CODE (WLS) */
+/*
+ * disable and reenable:  allow a single line to be use for dialin/dialout
+ *
+ */
+
+char enbdev[16];
+
+disable(dev)
+register char *dev;
+{
+       register char *rdev;
+
+       /* strip off directory prefixes */
+       rdev = dev;
+       while (*rdev)
+               rdev++;
+       while (--rdev >= dev && *rdev != '/')
+               ;
+       rdev++;
+
+       if (enbdev[0]) {
+               if (strcmp(enbdev, rdev) == SAME)
+                       return SUCCESS; /* already disabled */
+               delock(enbdev);
+               reenable();             /* else, reenable the old one */
+       }
+       DEBUG(4, "Disable %s\n", rdev);
+       if (enbcall("disable", rdev) == FAIL)
+               return FAIL;
+       logent(rdev, "DISABLED LOGIN");
+       strcpy(enbdev, rdev);
+       return SUCCESS;
+}
+
+reenable()
+{
+       if (enbdev[0] == NULL)
+               return;
+       DEBUG(4, "Reenable %s\n", enbdev);
+       (void) enbcall("enable", enbdev);
+       logent(enbdev, "REENABLED LOGIN");
+       enbdev[0] = '\0';
+}
+
+enbcall(type, dev)
+char *type, *dev;
+{
+       int pid;
+       register char *p;
+       int fildes[2];
+       int status;
+       FILE *fil;
+       char buf[80];
+       
+       fflush(stderr);
+       fflush(stdout);
+       pipe(fildes);
+       if ((pid = fork()) == 0) {
+               DEBUG(4, DIALINOUT, CNULL);
+               DEBUG(4, " %s", type);
+               DEBUG(4, " %s\n", dev);
+               close(fildes[0]);
+               close(0); close(1); close(2);
+               open("/dev/null",0);
+               dup(fildes[1]); dup(fildes[1]);
+               setuid(geteuid());      /* for chown(uid()) in acu program */
+               execl(DIALINOUT, "acu", type, dev, 0);
+               exit(-1);
+       }
+       if (pid<0)
+               return FAIL;
+
+       close(fildes[1]);
+       fil = fdopen(fildes[0],"r");
+       if (fil!=NULL) {
+               setlinebuf(fil);
+               while (fgets(buf, sizeof buf, fil) != NULL) {
+                       p = buf + strlen(buf) - 1;
+                       if (*p == '\n')
+                               *p = '\0';
+                       logent(buf,"ACUCNTRL:");
+               }
+       }
+       while(wait(&status) != pid)
+               ;
+       fclose(fil);
+       return status ? FAIL : SUCCESS;
+}
+#endif DIALINOUT
index 08e5155..24ccf59 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)conn.c     5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)conn.c     5.5 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #include <signal.h>
 #include <setjmp.h>
 #include <ctype.h>
 #endif
 
 #include "uucp.h"
 #include <signal.h>
 #include <setjmp.h>
 #include <ctype.h>
-#include <sys/types.h>
 #include <errno.h>
 #ifdef USG
 #include <termio.h>
 #include <errno.h>
 #ifdef USG
 #include <termio.h>
@@ -25,8 +24,9 @@ static char sccsid[] = "@(#)conn.c    5.4 (Berkeley) %G%";
 
 extern jmp_buf Sjbuf;
 jmp_buf Cjbuf;
 
 extern jmp_buf Sjbuf;
 jmp_buf Cjbuf;
-extern int errno;
+extern int errno, onesys;
 extern char *sys_errlist[];
 extern char *sys_errlist[];
+extern char MaxGrade, DefMaxGrade;
 
 /* Parity control during login procedure */
 #define        P_ZERO  0
 
 /* Parity control during login procedure */
 #define        P_ZERO  0
@@ -55,12 +55,8 @@ alarmtr()
        longjmp(Sjbuf, 1);
 }
 
        longjmp(Sjbuf, 1);
 }
 
-/*******
- *     conn(system)
- *     char *system;
- *
- *     conn - place a telephone call to system and
- *     login, etc.
+/*
+ *     place a telephone call to system and login, etc.
  *
  *     return codes:
  *             CF_SYSTEM: don't know system
  *
  *     return codes:
  *             CF_SYSTEM: don't know system
@@ -70,7 +66,6 @@ alarmtr()
  *             CF_LOGIN: login/password dialog failed
  *
  *             >0  - file no.  -  connect ok
  *             CF_LOGIN: login/password dialog failed
  *
  *             >0  - file no.  -  connect ok
- *
  */
 
 int Dcf = -1;
  */
 
 int Dcf = -1;
@@ -82,7 +77,7 @@ char *system;
 {
        int ret, nf;
        register int fn = 0;
 {
        int ret, nf;
        register int fn = 0;
-       char info[MAXC];
+       char info[MAXC], wkpre[NAMESIZE], file[NAMESIZE];
        register FILE *fsys;
        int fcode = 0;
 
        register FILE *fsys;
        int fcode = 0;
 
@@ -99,6 +94,10 @@ char *system;
                                && strcmp("LOCAL", Flds[F_LINE]) )
                                        fn = CF_TIME;
                }
                                && strcmp("LOCAL", Flds[F_LINE]) )
                                        fn = CF_TIME;
                }
+               sprintf(wkpre, "%c.%.7s", CMDPRE, Rmtname);
+               if (!onesys && MaxGrade != DefMaxGrade &&
+                       !iswrk(file, "chk", Spool, wkpre)) 
+                               fn = CF_TIME;
                if (fn != CF_TIME && (fn = getto(Flds)) > 0) {
                        Dcf = fn;
                        break;
                if (fn != CF_TIME && (fn = getto(Flds)) > 0) {
                        Dcf = fn;
                        break;
@@ -232,8 +231,8 @@ register char *in, *out;
        strcat(out, npart);
 }
 
        strcat(out, npart);
 }
 
-/***
- *     rddev - read and decode a line from device file
+/*
+ *     read and decode a line from device file
  *
  *     return code - FAIL at end-of file; 0 otherwise
  */
  *
  *     return code - FAIL at end-of file; 0 otherwise
  */
@@ -257,8 +256,8 @@ FILE *fp;
        return 0;
 }
 
        return 0;
 }
 
-/***
- *     finds(fsys, sysnam, info, flds) set system attribute vector
+/*
+ *     set system attribute vector
  *
  *     return codes:
  *             >0  -  number of arguments in vector - succeeded
  *
  *     return codes:
  *             >0  -  number of arguments in vector - succeeded
@@ -270,7 +269,6 @@ finds(fsys, sysnam, info, flds)
 char *sysnam, info[], *flds[];
 FILE *fsys;
 {
 char *sysnam, info[], *flds[];
 FILE *fsys;
 {
-       char sysn[8];
        int na;
        int fcode = 0;
 
        int na;
        int fcode = 0;
 
@@ -283,10 +281,9 @@ FILE *fsys;
         */
        while (cfgets(info, MAXC, fsys) != NULL) {
                na = getargs(info, flds, MAXC/10);
         */
        while (cfgets(info, MAXC, fsys) != NULL) {
                na = getargs(info, flds, MAXC/10);
-               sprintf(sysn, "%.7s", flds[F_NAME]);
-               if (strcmp(sysnam, sysn) != SAME)
+               if (strncmp(sysnam, flds[F_NAME], 7) != SAME)
                        continue;
                        continue;
-               if (ifdate(flds[F_TIME]))
+               if (ifdate(flds[F_TIME]) != FAIL)
                        /*  found a good entry  */
                        return na;
                DEBUG(2, "Wrong time ('%s') to call\n", flds[F_TIME]);
                        /*  found a good entry  */
                        return na;
                DEBUG(2, "Wrong time ('%s') to call\n", flds[F_TIME]);
@@ -295,10 +292,8 @@ FILE *fsys;
        return fcode ? fcode : CF_SYSTEM;
 }
 
        return fcode ? fcode : CF_SYSTEM;
 }
 
-/***
- *     login(nf, flds, dcr)            do login conversation
- *     char *flds[];
- *     int nf;
+/*
+ *     do login conversation
  *
  *     return codes:  0  |  FAIL
  */
  *
  *     return codes:  0  |  FAIL
  */
@@ -410,9 +405,8 @@ struct sg_spds {int sp_val, sp_name;} spds[] = {
        {0, 0}
 };
 
        {0, 0}
 };
 
-/***
- *     fixline(tty, spwant)    set speed/echo/mode...
- *     int tty, spwant;
+/*
+ *     set speed/echo/mode...
  *
  *     return codes:  none
  */
  *
  *     return codes:  none
  */
@@ -461,9 +455,8 @@ int tty, spwant;
 
 #define MR 100
 
 
 #define MR 100
 
-/***
- *     expect(str, fn) look for expected string
- *     char *str;
+/*
+ *     look for expected string
  *
  *     return codes:
  *             0  -  found
  *
  *     return codes:
  *             0  -  found
@@ -715,8 +708,8 @@ int type;
 
 #define BSPEED B150
 
 
 #define BSPEED B150
 
-/***
- *     genbrk          send a break
+/*
+ *     send a break
  *
  *     return codes;  none
  */
  *
  *     return codes;  none
  */
@@ -763,9 +756,8 @@ badbreak:
 #endif !USG
 }
 
 #endif !USG
 }
 
-/***
- *     notin(sh, lg)   check for occurrence of substring "sh"
- *     char *sh, *lg;
+/*
+ *     check for occurrence of substring "sh"
  *
  *     return codes:
  *             0  -  found the string
  *
  *     return codes:
  *             0  -  found the string
@@ -776,69 +768,60 @@ register char *sh, *lg;
 {
        while (*lg != '\0') {
                if (wprefix(sh, lg))
 {
        while (*lg != '\0') {
                if (wprefix(sh, lg))
-                       return(0);
+                       return 0;
                else
                        lg++;
        }
                else
                        lg++;
        }
-       return(1);
+       return 1;
 }
 
 }
 
-/*******
- *     ifdate(s)
- *     char *s;
- *
- *     ittvax!swatt
+/*
  *     Allow multiple date specifications separated by '|'.
  *     Allow multiple date specifications separated by '|'.
- *     Calls ifadate, formerly "ifdate".
- *
- *     return codes:
- *             see ifadate
  */
  */
-
-ifdate(s)
-char *s;
+ifdate(p)
+register char *p;
 {
 {
-       register char *p;
-       register int ret;
-
-       for (p = s; p && (*p == '|' ? *++p : *p); p = index(p, '|'))
-               if (ret = ifadate(p))
-                       return ret;
-       return 0;
+       register int ret, g;
+
+       ret = FAIL;
+       MaxGrade = '\0';
+       do {
+               g = ifadate(p);
+               DEBUG(11,"ifadate returns %o\n", g);
+               if (g != FAIL) {
+                       ret = SUCCESS;
+                       if (g > MaxGrade)
+                               MaxGrade = g;
+               }
+               p = index(p, '|');
+       } while (p++ && *p);
+       return ret;
 }
 
 }
 
-/*******
- *     ifadate(s)
- *     char *s;
- *
- *     ifadate  -  this routine will check a string (s)
+/*
+ *     this routine will check a string (string)
  *     like "MoTu0800-1730" to see if the present
  *     time is within the given limits.
  *     SIDE EFFECT - Retrytime is set
  *
  *     like "MoTu0800-1730" to see if the present
  *     time is within the given limits.
  *     SIDE EFFECT - Retrytime is set
  *
- *     String alternatives:
- *             Wk - Mo thru Fr
- *             zero or one time means all day
- *             Any - any day
- *
  *     return codes:
  *             0  -  not within limits
  *             1  -  within limits
  */
 
  *     return codes:
  *             0  -  not within limits
  *             1  -  within limits
  */
 
-ifadate(s)
-char *s;
+ifadate(string)
+char *string;
 {
        static char *days[]={
                "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", 0
        };
        time_t clock;
 {
        static char *days[]={
                "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", 0
        };
        time_t clock;
+       register char *s = string;
        int rtime;
        int i, tl, th, tn, dayok=0;
        struct tm *localtime();
        struct tm *tp;
        int rtime;
        int i, tl, th, tn, dayok=0;
        struct tm *localtime();
        struct tm *tp;
-       char *index();
-       char *p;
+       char *p, MGrade;
 
        /*  pick up retry time for failures  */
        /*  global variable Retrytime is set here  */
 
        /*  pick up retry time for failures  */
        /*  global variable Retrytime is set here  */
@@ -851,6 +834,11 @@ char *s;
                Retrytime  = rtime * 60;
        }
 
                Retrytime  = rtime * 60;
        }
 
+       if ((p = index(s, '@')) == NULL)
+               MGrade = DefMaxGrade;
+       else
+               MGrade = p[1];
+
        time(&clock);
        tp = localtime(&clock);
        while (isascii(*s) && isalpha(*s)) {
        time(&clock);
        tp = localtime(&clock);
        while (isascii(*s) && isalpha(*s)) {
@@ -873,46 +861,38 @@ char *s;
                }
                if (prefix("Night", s)) {
                        if (tp->tm_wday == 6  /* Sat */
                }
                if (prefix("Night", s)) {
                        if (tp->tm_wday == 6  /* Sat */
-                               || tp->tm_hour > 23 || tp->tm_hour < 8)
+                               || tp->tm_hour >= 23 || tp->tm_hour < 8
+                                       /* Sunday before 5pm */
+                               || (tp->tm_wday == 0 && tp->tm_hour < 17))
                                        dayok = 1;
                }
                s++;
        }
 
                                        dayok = 1;
                }
                s++;
        }
 
-       if (dayok == 0)
-               return(0);
+       if (dayok == 0 && s != string)
+               return FAIL;
        i = sscanf(s, "%d-%d", &tl, &th);
        i = sscanf(s, "%d-%d", &tl, &th);
-       if (i < 2)
-               return(1);
+       if (i < 2)
+               return MGrade;
        tn = tp->tm_hour * 100 + tp->tm_min;
        tn = tp->tm_hour * 100 + tp->tm_min;
-       if (th < tl) {          /* crosses midnight */
+       if (th < tl) {          /* crosses midnight */
+               if (tl <= tn || tn < th)
+                       return MGrade;
+       } else
+
+       if (i < 2)
+               return MGrade;
+       if (th < tl) {  /* crosses midnight */
                if (tl <= tn || tn < th)
                if (tl <= tn || tn < th)
-                       return(1);
+                       return MGrade;
        } else
                if (tl <= tn && tn < th)
        } else
                if (tl <= tn && tn < th)
-                       return(1);
-       return(0);
-}
-
-
-/***
- *     char *
- *     lastc(s)        return pointer to last character
- *     char *s;
- *
- */
-char *
-lastc(s)
-register char *s;
-{
-       while (*s != '\0')
-               s++;
-       return s;
+                       return MGrade;
+       return FAIL;
 }
 
 }
 
-/***
- *     char *
- *     fdig(cp)        find first digit in string
+/*
+ *     find first digit in string
  *
  *     return - pointer to first digit in string or end of string
  */
  *
  *     return - pointer to first digit in string or end of string
  */
index bf956cd..8890a08 100644 (file)
@@ -1,16 +1,10 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)gio.c      5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)gio.c      5.3 (Berkeley) %G%";
 #endif
 
 #endif
 
-#include <sys/types.h>
+#include "uucp.h"
 #include "pk.h"
 #include <setjmp.h>
 #include "pk.h"
 #include <setjmp.h>
-#include "uucp.h"
-#ifdef USG
-#define ftime time
-#else V7
-#include <sys/timeb.h>
-#endif V7
 
 extern time_t  time();
 
 
 extern time_t  time();
 
@@ -96,18 +90,19 @@ FILE *fp1;
        char bufr[BUFSIZ];
        register int len;
        int ret, mil;
        char bufr[BUFSIZ];
        register int len;
        int ret, mil;
-#ifdef USG
-       time_t t1, t2;
-#else v7
        struct timeb t1, t2;
        struct timeb t1, t2;
-#endif v7
        long bytes;
        char text[BUFSIZ];
 
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
        long bytes;
        char text[BUFSIZ];
 
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
+#ifdef USG
+       time(&t1.time);
+       t1.millitm = 0;
+#else !USG
        ftime(&t1);
        ftime(&t1);
+#endif !USG
        while ((len = read(fileno(fp1), bufr, BUFSIZ)) > 0) {
                bytes += len;
                ret = gwrblk(bufr, len, fn);
        while ((len = read(fileno(fp1), bufr, BUFSIZ)) > 0) {
                bytes += len;
                ret = gwrblk(bufr, len, fn);
@@ -118,45 +113,46 @@ FILE *fp1;
                        break;
        }
        ret = gwrblk(bufr, 0, fn);
                        break;
        }
        ret = gwrblk(bufr, 0, fn);
+#ifdef USG
+       time(&t2.time);
+       t2.millitm = 0;
+#else !USG
        ftime(&t2);
        ftime(&t2);
-#ifndef USG
+#endif !USG
+       Now = t2;
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
-       sprintf(text, "sent data %ld bytes %ld.%03d secs",
-                               bytes, (long)t2.time, mil);
+       sprintf(text, "sent data %ld bytes %ld.%02d secs",
+                               bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
        sysacct(bytes, t2.time - t1.time);
-#else USG
-       sprintf(text, "sent data %ld bytes %ld secs", bytes, t2 - t1);
-       sysacct(bytes, t2 - t1);
-#endif USG
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
 }
 
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
 }
 
-
 grddata(fn, fp2)
 FILE *fp2;
 {
        register int len;
        char bufr[BUFSIZ];
 grddata(fn, fp2)
 FILE *fp2;
 {
        register int len;
        char bufr[BUFSIZ];
-#ifdef USG
-       time_t t1, t2;
-#else v7
        struct timeb t1, t2;
        int mil;
        struct timeb t1, t2;
        int mil;
-#endif v7
        long bytes;
        char text[BUFSIZ];
 
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
        long bytes;
        char text[BUFSIZ];
 
        if(setjmp(Failbuf))
                return FAIL;
        bytes = 0L;
+#ifdef USG
+       time(&t1.time);
+       t1.millitm = 0;
+#else !USG
        ftime(&t1);
        ftime(&t1);
+#endif !USG
        for (;;) {
                len = grdblk(bufr, BUFSIZ, fn);
                if (len < 0) {
        for (;;) {
                len = grdblk(bufr, BUFSIZ, fn);
                if (len < 0) {
@@ -168,27 +164,27 @@ FILE *fp2;
                if (len < BUFSIZ)
                        break;
        }
                if (len < BUFSIZ)
                        break;
        }
+#ifdef USG
+       time(&t2.time);
+       t2.millitm = 0;
+#else !USG
        ftime(&t2);
        ftime(&t2);
-#ifndef USG
+#endif !USG
+       Now = t2;
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
-       sprintf(text, "received data %ld bytes %ld.%03d secs",
-                               bytes, (long)t2.time, mil);
+       sprintf(text, "received data %ld bytes %ld.%02d secs",
+                               bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
        sysacct(bytes, t2.time - t1.time);
-#else USG
-       sprintf(text, "received data %ld bytes %ld secs", bytes, t2 - t1);
-       sysacct(bytes, t2 - t1);
-#endif USG
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
 }
 
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
 }
 
-
 /* call ultouch every TC calls to either grdblk or gwrblk -- rti!trt */
 #define        TC      20
 static int tc = TC;
 /* call ultouch every TC calls to either grdblk or gwrblk -- rti!trt */
 #define        TC      20
 static int tc = TC;
index 609be74..99b7275 100644 (file)
@@ -1,4 +1,4 @@
-/*     pk.h    5.2     85/01/22        */
+/*     pk.h    5.3     85/04/10        */
 
 struct header {
        char    sync;
 
 struct header {
        char    sync;
@@ -89,6 +89,11 @@ extern int   pkactive;
 #define        B_MARK  040
 #define        B_SHORT 0100
 
 #define        B_MARK  040
 #define        B_SHORT 0100
 
+/* read or write */
+
+#define B_WRITE        0
+#define B_READ 1
+
 /*
  * control messages
  */
 /*
  * control messages
  */
index b70ed62..f9afd6f 100644 (file)
@@ -1,16 +1,9 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)pk0.c      5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)pk0.c      5.3 (Berkeley) %G%";
 #endif
 
 #endif
 
-extern char    *malloc();
-
-#include <stdio.h>
-#ifdef USG
-#include <sys/types.h>
-#endif USG
-#include <sys/param.h>
+#include "uucp.h"
 #include "pk.h"
 #include "pk.h"
-#include <sys/buf.h>
 
 /*
  * packet driver
 
 /*
  * packet driver
@@ -469,9 +462,9 @@ char *ibuf;
 int icount;
 {
        register struct pack *pk;
 int icount;
 {
        register struct pack *pk;
-       register i, rbits;
+       register i;
        char **bp;
        char **bp;
-       int rcheck;
+       int rcheck = 0;
 
        pk = ipk;
        pk->p_state |= DRAINO;
 
        pk = ipk;
        pk->p_state |= DRAINO;
@@ -508,7 +501,6 @@ int icount;
        /*
         * free space
         */
        /*
         * free space
         */
-       rbits = 1;
        rcheck = 0;
        for (i=0;i<8;i++) {
                if (pk->p_os[i] != B_NULL) {
        rcheck = 0;
        for (i=0;i<8;i++) {
                if (pk->p_os[i] != B_NULL) {
index fe984af..77b424f 100644 (file)
@@ -1,14 +1,9 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)pk1.c      5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)pk1.c      5.3 (Berkeley) %G%";
 #endif
 
 #endif
 
-#ifdef USG
-#include <sys/types.h>
-#endif USG
-#include <sys/param.h>
-#include "pk.h"
 #include "uucp.h"
 #include "uucp.h"
-#include <sys/buf.h>
+#include "pk.h"
 #include <setjmp.h>
 #include <signal.h>
 #ifdef BSD4_2
 #include <setjmp.h>
 #include <signal.h>
 #ifdef BSD4_2
@@ -330,8 +325,7 @@ int count, flag;
        if (flag == B_WRITE) {
                s = p2;
                d = p1;
        if (flag == B_WRITE) {
                s = p2;
                d = p1;
-       }
-       else {
+       } else {
                s = p1;
                d = p2;
        }
                s = p1;
                d = p2;
        }
@@ -358,13 +352,15 @@ cgalarm()
 }
 
 pkcget(fn, b, n)
 }
 
 pkcget(fn, b, n)
-int fn, n;
+int fn;
+register int n;
 register char *b;
 {
 register char *b;
 {
-       register int nchars, ret;
+       register int ret;
        extern int linebaudrate;
 #ifdef BSD4_2
        extern int linebaudrate;
 #ifdef BSD4_2
-       long r, itime = 0;
+       long r, itime = 100000L; /* guess it's been 1/10th second since we
+                                   last read the line */
        struct timeval tv;
 #endif BSD4_2
 #ifdef VMS
        struct timeval tv;
 #endif BSD4_2
 #ifdef VMS
@@ -380,14 +376,32 @@ register char *b;
        signal(SIGALRM, cgalarm);
 
        alarm(PKTIME);
        signal(SIGALRM, cgalarm);
 
        alarm(PKTIME);
-       for (nchars = 0; nchars < n; ) {
+       while (n > 0) {
+#ifdef BSD4_2
+               if (linebaudrate > 0) {
+                       r = n  * 100000L;
+                       r = r / linebaudrate;
+                       r = (r * 100) - itime;
+                       itime = 0;
+                       /* we predict that more than 1/50th of a
+                          second will go by before the read will
+                          give back all that we want. */
+                       if (r > 20000) {
+                               tv.tv_sec = r / 1000000L;
+                               tv.tv_usec = r % 1000000L;
+                               DEBUG(11, "PKCGET stall for %d", tv.tv_sec);
+                               DEBUG(11, ".%06d sec\n", tv.tv_usec);
+                               (void) select (0, (int *)0, (int *)0, (int *)0, &tv);
+                       }
+               }
+#endif BSD4_2
 #ifndef VMS
 #ifndef VMS
-               ret = read(fn, b, n - nchars);
+               ret = read(fn, b, n);
 #else VMS
                _$Cancel_IO_On_Signal = FD_FAB_Pointer[fn];
                ret = SYS$QioW(_$EFN,(FD_FAB_Pointer[fn]->fab).fab$l_stv,
                                IO$_READVBLK|IO$M_NOFILTR|IO$M_NOECHO,
 #else VMS
                _$Cancel_IO_On_Signal = FD_FAB_Pointer[fn];
                ret = SYS$QioW(_$EFN,(FD_FAB_Pointer[fn]->fab).fab$l_stv,
                                IO$_READVBLK|IO$M_NOFILTR|IO$M_NOECHO,
-                               iosb,0,0,b,n-nchars,0,
+                               iosb,0,0,b,n,0,
                                iomask,0,0);
                _$Cancel_IO_On_Signal = 0;
                if (ret == SS$_NORMAL)
                                iomask,0,0);
                _$Cancel_IO_On_Signal = 0;
                if (ret == SS$_NORMAL)
@@ -401,33 +415,11 @@ register char *b;
                }
                if (ret <= 0) {
                        alarm(0);
                }
                if (ret <= 0) {
                        alarm(0);
-                       logent("PKCGET read failed", sys_errlist[errno]);
+                       logent(sys_errlist[errno],"FAILED pkcget Read");
                        longjmp(Sjbuf, 6);
                }
                b += ret;
                        longjmp(Sjbuf, 6);
                }
                b += ret;
-               nchars += ret;
-               if (nchars < n)
-#ifndef BSD4_2
-                       if (linebaudrate > 0 && linebaudrate < 4800)
-                               sleep(1);
-#else BSD4_2
-                       if (linebaudrate > 0) {
-                               r = (n - nchars) * 100000;
-                               r = r / linebaudrate;
-                               r = (r * 100) - itime;
-                               itime = 0;
-                               /* we predict that more than 1/50th of a
-                                  second will go by before the read will
-                                  give back all that we want. */
-                               if (r > 20000) {
-                                       tv.tv_sec = r / 1000000L;
-                                       tv.tv_usec = r % 1000000L;
-                                       DEBUG(11, "PKCGET stall for %d", tv.tv_sec);
-                                       DEBUG(11, ".%06d sec\n", tv.tv_usec);
-                                       (void) select (fn, (int *)0, (int *)0, (int *)0, &tv);
-                               }
-                       }
-#endif BSD4_2
+               n -= ret;
        }
        alarm(0);
        return SUCCESS;
        }
        alarm(0);
        return SUCCESS;
index f3d0518..c3de390 100644 (file)
@@ -1,17 +1,11 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)tio.c      4.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)tio.c      4.2 (Berkeley) %G%";
 #endif
 
 #endif
 
-#include <sys/types.h>
-#include <setjmp.h>
 #include "uucp.h"
 #include "uucp.h"
+#include <setjmp.h>
 #include <signal.h>
 #include <sys/stat.h>
 #include <signal.h>
 #include <sys/stat.h>
-#ifdef USG
-#define ftime time
-#else V7
-#include <sys/timeb.h>
-#endif V7
 
 extern int pkfail();
 extern time_t  time();
 
 extern int pkfail();
 extern time_t  time();
@@ -105,11 +99,7 @@ FILE *fp1;
        struct tbuf bufr;
        register int len;
        int ret, mil;
        struct tbuf bufr;
        register int len;
        int ret, mil;
-#ifdef USG
-       time_t t1, t2;
-#else v7
        struct timeb t1, t2;
        struct timeb t1, t2;
-#endif v7
        long bytes;
        char text[TBUFSIZE];
 
        long bytes;
        char text[TBUFSIZE];
 
@@ -117,7 +107,12 @@ FILE *fp1;
                return FAIL;
        signal(SIGALRM, pkfail);
        bytes = 0L;
                return FAIL;
        signal(SIGALRM, pkfail);
        bytes = 0L;
+#ifdef USG
+       time(&t1.time);
+       t1.millitm = 0;
+#else !USG
        ftime(&t1);
        ftime(&t1);
+#endif !USG
        while ((len = read(fileno(fp1), bufr.t_data, TBUFSIZE)) > 0) {
                bytes += len;
 #if defined(vax) || defined(pdp11)
        while ((len = read(fileno(fp1), bufr.t_data, TBUFSIZE)) > 0) {
                bytes += len;
 #if defined(vax) || defined(pdp11)
@@ -142,21 +137,22 @@ FILE *fp1;
        alarm(0);
        if (ret != len)
                return FAIL;
        alarm(0);
        if (ret != len)
                return FAIL;
+#ifdef USG
+       time(&t2.time);
+       t2.millitm = 0;
+#else !USG
        ftime(&t2);
        ftime(&t2);
-#ifndef USG
+#endif !USG
+       Now = t2;
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
-       sprintf(text, "sent data %ld bytes %ld.%03d secs",
-                               bytes, (long)t2.time, mil);
+       sprintf(text, "sent data %ld bytes %ld.%02d secs",
+                               bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
        sysacct(bytes, t2.time - t1.time);
-#else USG
-       sprintf(text, "sent data %ld bytes %ld secs", bytes, t2 - t1);
-       sysacct(bytes, t2 - t1);
-#endif USG
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
        DEBUG(1, "%s\n", text);
        syslog(text);
        return SUCCESS;
@@ -168,18 +164,19 @@ FILE *fp2;
 {
        register int len, nread;
        char bufr[TBUFSIZE];
 {
        register int len, nread;
        char bufr[TBUFSIZE];
-#ifdef USG
-       time_t t1, t2;
-#else V7
        struct timeb t1, t2;
        int mil;
        struct timeb t1, t2;
        int mil;
-#endif V7
        long bytes, Nbytes;
 
        if(setjmp(Failbuf))
                return FAIL;
        signal(SIGALRM, pkfail);
        long bytes, Nbytes;
 
        if(setjmp(Failbuf))
                return FAIL;
        signal(SIGALRM, pkfail);
+#ifdef USG
+       time(&t1.time);
+       t1.millitm = 0;
+#else !USG
        ftime(&t1);
        ftime(&t1);
+#endif !USG
        bytes = 0L;
        for (;;) {
                alarm(MAXMSGTIME);
        bytes = 0L;
        for (;;) {
                alarm(MAXMSGTIME);
@@ -207,27 +204,27 @@ FILE *fp2;
                        return FAIL;
                }
        }
                        return FAIL;
                }
        }
+#ifdef USG
+       time(&t2.time);
+       t2.millitm = 0;
+#else !USG
        ftime(&t2);
        ftime(&t2);
-#ifndef USG
+#endif !USG
+       Now = t2;
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
        t2.time -= t1.time;
        mil = t2.millitm - t1.millitm;
        if (mil < 0) {
                --t2.time;
                mil += 1000;
        }
-       sprintf(bufr, "received data %ld bytes %ld.%03d secs",
-                               bytes, (long)t2.time, mil);
+       sprintf(bufr, "received data %ld bytes %ld.%02d secs",
+                               bytes, (long)t2.time, mil/10);
        sysacct(bytes, t2.time - t1.time);
        sysacct(bytes, t2.time - t1.time);
-#else USG
-       sprintf(bufr, "received data %ld bytes %ld secs", bytes, t2 - t1);
-       sysacct(bytes, t2 - t1);
-#endif USG
        DEBUG(1, "%s\n", bufr);
        syslog(bufr);
        return SUCCESS;
 }
 
        DEBUG(1, "%s\n", bufr);
        syslog(bufr);
        return SUCCESS;
 }
 
-
 #define        TC      1024
 static int tc = TC;
 
 #define        TC      1024
 static int tc = TC;
 
index 224493f..d6dcc6b 100644 (file)
@@ -1,11 +1,10 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uuclean.c  5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)uuclean.c  5.4 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #include <signal.h>
 #include <pwd.h>
 #endif
 
 #include "uucp.h"
 #include <signal.h>
 #include <pwd.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #ifdef NDIR
 #include "ndir.h"
 #include <sys/stat.h>
 #ifdef NDIR
 #include "ndir.h"
index 708c1fa..705ccbe 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uucp.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uucp.c     5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #include "uust.h"
 
 #include <sys/stat.h>
 #include "uust.h"
 
@@ -33,7 +32,8 @@ main(argc, argv)
 char *argv[];
 {
        int ret;
 char *argv[];
 {
        int ret;
-       register char *sysfile1, *sysfl2, *cp;
+       char *sysfile1, *sysfl2;
+       register char *cp;
        char file1[MAXFULLNAME], file2[MAXFULLNAME];
        int avoidgwd = 0;
 
        char file1[MAXFULLNAME], file2[MAXFULLNAME];
        int avoidgwd = 0;
 
@@ -122,7 +122,7 @@ char *argv[];
                        sysfl2 = Myname;
                else
                        sprintf(Rmtname, "%.7s", sysfl2);
                        sysfl2 = Myname;
                else
                        sprintf(Rmtname, "%.7s", sysfl2);
-               if (versys(sysfl2) != 0) {
+               if (versys(&sysfl2) != 0) {
                        fprintf(stderr, "bad system name: %s\n", sysfl2);
                        cleanup(1);
                }
                        fprintf(stderr, "bad system name: %s\n", sysfl2);
                        cleanup(1);
                }
@@ -153,7 +153,7 @@ char *argv[];
                                sysfile1 = Myname;
                        else
                                sprintf(Rmtname, "%.7s", sysfile1);
                                sysfile1 = Myname;
                        else
                                sprintf(Rmtname, "%.7s", sysfile1);
-                       if (versys(sysfile1) != 0) {
+                       if (versys(&sysfile1) != 0) {
                                fprintf(stderr, "bad system name: %s\n", sysfile1);
                                cleanup(0);
                        }
                                fprintf(stderr, "bad system name: %s\n", sysfile1);
                                cleanup(0);
                        }
index 0271044..89062aa 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uulog.c    5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uulog.c    5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
@@ -8,43 +8,34 @@ static char sccsid[] = "@(#)uulog.c   5.2 (Berkeley) %G%";
 static char SYSBUF[BUFSIZ];
 #endif
 
 static char SYSBUF[BUFSIZ];
 #endif
 
-/*******
- *
- *     uulog  -  
- *
- *     options:
- *             -s  -  system name for search
- *             -u  -  user name for search
- *
- *     exit codes:
- *             0  -  normal
- *
- */
-
 main(argc, argv)
 char *argv[];
 {
        FILE *plogf;
 main(argc, argv)
 char *argv[];
 {
        FILE *plogf;
-       char *system, *user;
+       char *sys, *user;
 
 
-       char buf[BUFSIZ], u[20], s[20];
+       char buf[BUFSIZ], u[64], s[64];
 
        setbuf(stdout, SYSBUF);
        strcpy(Progname, "uulog");
 
        setbuf(stdout, SYSBUF);
        strcpy(Progname, "uulog");
-       system = user = NULL;
+       sys = user = NULL;
 
 
        while (argc>1 && argv[1][0] == '-') {
                switch (argv[1][1]) {
                case 's':
 
 
        while (argc>1 && argv[1][0] == '-') {
                switch (argv[1][1]) {
                case 's':
-                       system = &argv[1][2];
-                       if (*system == NULL && argc > 2 && argv[2][0] != '-') {
-                               system = &argv[2][0];
+                       sys = &argv[1][2];
+                       if (*sys == NULL && argc > 2 && argv[2][0] != '-') {
+                               sys = &argv[2][0];
                                argv++;
                                argc--;
                        }
                                argv++;
                                argc--;
                        }
-                       if (strlen(system) > 7)
-                               system[7] = 0;
+                       if (strlen(sys) > 7)
+                               sys[7] = '\0';
+                       if (versys(&sys) != SUCCESS){
+                               fprintf(stderr,"uulog: unknown system %s\n", sys);
+                               sys = NULL;
+                       }
                        break;
                case 'u':
                        user = &argv[1][2];
                        break;
                case 'u':
                        user = &argv[1][2];
@@ -61,23 +52,38 @@ char *argv[];
        }
 
 
        }
 
 
-       if (user == NULL && system == NULL) {
-               fprintf(stderr, "usage: uulog [-u user] [-s system]\n");
+       if (user == NULL && sys == NULL) {
+               fprintf(stderr, "usage: uulog [-u user] [-s sys]\n");
                exit(1);
        }
                exit(1);
        }
-/*     chmod(LOGFILE, 0666);   rm-ed by rti!trt */
 
 
+#ifdef LOGBYSITE
+       if (chdir(SPOOL) < 0) {
+               perror(SPOOL);
+               exit(1);
+       }
+       /* this program is really obsolete, this is a rude backward compat */
+       if (user) {
+               sprintf(buf, "exec cat LOG/uu*/* | egrep '^%s '", user);
+               system(buf);
+       }
+       if (sys) {
+               sprintf(buf,"exec cat LOG/uu*/%s", sys);
+               system(buf);
+       }
+#else !LOGBYSITE
        plogf = fopen(LOGFILE, "r");
        ASSERT(plogf != NULL, "CAN NOT OPEN", LOGFILE, 0);
        while (fgets(buf, BUFSIZ, plogf) != NULL) {
                sscanf(buf, "%s%s", u, s);
                if (user != NULL && !prefix(user, u))
                        continue;
        plogf = fopen(LOGFILE, "r");
        ASSERT(plogf != NULL, "CAN NOT OPEN", LOGFILE, 0);
        while (fgets(buf, BUFSIZ, plogf) != NULL) {
                sscanf(buf, "%s%s", u, s);
                if (user != NULL && !prefix(user, u))
                        continue;
-               if (system != NULL && !prefix(system, s))
+               if (sys != NULL && !prefix(sys, s))
                        continue;
                fputs(buf, stdout);
                fflush(stdout);
        }
                        continue;
                fputs(buf, stdout);
                fflush(stdout);
        }
+#endif !LOGBYSITE
        exit(0);
 }
 
        exit(0);
 }
 
index cccfd49..158eec4 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uupoll.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uupoll.c   5.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -14,6 +14,8 @@ static char sccsid[] = "@(#)uupoll.c  5.2 (Berkeley) %G%";
 
 #include "uucp.h"
 
 
 #include "uucp.h"
 
+int TransferSucceeded = 1;
+
 main(argc, argv)
 register int argc;
 register char **argv;
 main(argc, argv)
 register int argc;
 register char **argv;
@@ -21,9 +23,11 @@ register char **argv;
        int ret;
        char wrkpre[MAXFULLNAME];
        char file[MAXFULLNAME];
        int ret;
        char wrkpre[MAXFULLNAME];
        char file[MAXFULLNAME];
+       char grade = 'z';
+       int nocall = 0;
 
        if (argc < 2) {
 
        if (argc < 2) {
-               fprintf(stderr, "usage: uupoll system ...\n");
+               fprintf(stderr, "usage: uupoll [-gX] [-n] system ...\n");
                cleanup(1);
        }
 
                cleanup(1);
        }
 
@@ -37,23 +41,32 @@ register char **argv;
                        fprintf(stderr, "This *is* %s!\n", Myname);
                        continue;
                }
                        fprintf(stderr, "This *is* %s!\n", Myname);
                        continue;
                }
+               if (strncmp(argv[0],"-g",2) == SAME) {
+                       grade = argv[0][2];
+                       continue;
+               }
+               if (strcmp(argv[0],"-n") == SAME) {
+                       nocall++;
+                       continue;
+               }
 
 
-               if (versys(argv[0])) {
+               if (versys(&argv[0])) {
                        fprintf(stderr, "%s: unknown system.\n", argv[0]);
                        continue;
                }
                /* Remove any STST file that might stop the poll */
                        fprintf(stderr, "%s: unknown system.\n", argv[0]);
                        continue;
                }
                /* Remove any STST file that might stop the poll */
-               sprintf(wrkpre, "LCK..%.7s", argv[0]);
+               sprintf(wrkpre, "%s/LCK..%.7s", LOCKDIR, argv[0]);
                if (access(wrkpre, 0) < 0)
                        rmstat(argv[0]);
                sprintf(wrkpre, "%c.%.7s", CMDPRE, argv[0]);
                if (!iswrk(file, "chk", Spool, wrkpre)) {
                if (access(wrkpre, 0) < 0)
                        rmstat(argv[0]);
                sprintf(wrkpre, "%c.%.7s", CMDPRE, argv[0]);
                if (!iswrk(file, "chk", Spool, wrkpre)) {
-                       sprintf(file, "%s/%c.%.7szPOLL", subdir(Spool, CMDPRE),
-                               CMDPRE, argv[0]);
+                       sprintf(file, "%s/%c.%.7s%cPOLL", subdir(Spool, CMDPRE),
+                               CMDPRE, argv[0], grade);
                        close(creat(file, 0666));
                }
                /* Attempt the call */
                        close(creat(file, 0666));
                }
                /* Attempt the call */
-               xuucico(argv[0]);
+               if (!nocall)
+                       xuucico(argv[0]);
        }
        cleanup(0);
 }
        }
        cleanup(0);
 }
index dd910da..d6f7c24 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uuq.c      4.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)uuq.c      4.2 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -12,7 +12,6 @@ static char sccsid[] = "@(#)uuq.c     4.1 (Berkeley) %G%";
 
 #include "uucp.h"
 #include <stdio.h>
 
 #include "uucp.h"
 #include <stdio.h>
-#include <sys/types.h>
 
 #ifdef NDIR
 #include "libndir/ndir.h"
 
 #ifdef NDIR
 #include "libndir/ndir.h"
index 99256e2..a466306 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uusnap.c   5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)uusnap.c   5.4 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -8,7 +8,6 @@ static char sccsid[] = "@(#)uusnap.c    5.3 (Berkeley) %G%";
  */
 
 #include "uucp.h"
  */
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #ifdef NDIR
 #include "ndir.h"
 #include <sys/stat.h>
 #ifdef NDIR
 #include "ndir.h"
@@ -194,7 +193,7 @@ char *sdir;
                perror(sdir);
                exit(1);
        }
                perror(sdir);
                exit(1);
        }
-       if ((dirp = opendir(".")) == NULL) {
+       if ((dirp = opendir(LOCKDIR)) == NULL) {
                perror(sdir);
                exit(1);
        }
                perror(sdir);
                exit(1);
        }
index c4a531c..2508343 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uux.c      5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uux.c      5.3 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
@@ -41,7 +41,8 @@ char *argv[];
        char *ap, *cmdp;
        char prm[BUFSIZ];
        char syspart[8], rest[MAXFULLNAME];
        char *ap, *cmdp;
        char prm[BUFSIZ];
        char syspart[8], rest[MAXFULLNAME];
-       char xsys[8], local[8];
+       char Xsys[8], local[8];
+       char *xsys = Xsys;
        FILE *fprx, *fpc, *fpd, *fp;
        extern char *getprm(), *lastpart();
        extern FILE *ufopen();
        FILE *fprx, *fpc, *fpd, *fp;
        extern char *getprm(), *lastpart();
        extern FILE *ufopen();
@@ -166,7 +167,7 @@ char *argv[];
                strcpy(xsys, local);
        sprintf(Rmtname, "%.7s", xsys);
        DEBUG(4, "xsys %s\n", xsys);
                strcpy(xsys, local);
        sprintf(Rmtname, "%.7s", xsys);
        DEBUG(4, "xsys %s\n", xsys);
-       if (versys(xsys) != 0) {
+       if (versys(&xsys) != 0) {
                /*  bad system name  */
                fprintf(stderr, "bad system name: %s\n", xsys);
                fclose(fprx);
                /*  bad system name  */
                fprintf(stderr, "bad system name: %s\n", xsys);
                fclose(fprx);
@@ -289,8 +290,7 @@ char *argv[];
                        if (redir == '<') {
                                fprintf(fprx, "%c %s\n", X_STDIN, dfile);
                                fprintf(fprx, "%c %s\n", X_RQDFILE, dfile);
                        if (redir == '<') {
                                fprintf(fprx, "%c %s\n", X_STDIN, dfile);
                                fprintf(fprx, "%c %s\n", X_RQDFILE, dfile);
-                       }
-                       else {
+                       } else {
                                APPCMD(lastpart(rest));
                                fprintf(fprx, "%c %s %s\n", X_RQDFILE,
                                 dfile, lastpart(rest));
                                APPCMD(lastpart(rest));
                                fprintf(fprx, "%c %s %s\n", X_RQDFILE,
                                 dfile, lastpart(rest));
@@ -317,8 +317,7 @@ char *argv[];
                        if (redir == '<') {
                                fprintf(fprx, "%c %s\n", X_RQDFILE, dfile);
                                fprintf(fprx, "%c %s\n", X_STDIN, dfile);
                        if (redir == '<') {
                                fprintf(fprx, "%c %s\n", X_RQDFILE, dfile);
                                fprintf(fprx, "%c %s\n", X_STDIN, dfile);
-                       }
-                       else {
+                       } else {
                                fprintf(fprx, "%c %s %s\n", X_RQDFILE, dfile,
                                  lastpart(rest));
                                APPCMD(lastpart(rest));
                                fprintf(fprx, "%c %s %s\n", X_RQDFILE, dfile,
                                  lastpart(rest));
                                APPCMD(lastpart(rest));
@@ -343,8 +342,7 @@ char *argv[];
                        if (redir == '<') {
                                fprintf(fprx, "%c %s\n", X_RQDFILE, t2file);
                                fprintf(fprx, "%c %s\n", X_STDIN, t2file);
                        if (redir == '<') {
                                fprintf(fprx, "%c %s\n", X_RQDFILE, t2file);
                                fprintf(fprx, "%c %s\n", X_STDIN, t2file);
-                       }
-                       else {
+                       } else {
                                fprintf(fprx, "%c %s %s\n", X_RQDFILE, t2file,
                                  lastpart(rest));
                                APPCMD(lastpart(rest));
                                fprintf(fprx, "%c %s %s\n", X_RQDFILE, t2file,
                                  lastpart(rest));
                                APPCMD(lastpart(rest));
@@ -408,6 +406,7 @@ char *argv[];
        }
        else
                unlink(subfile(tcfile));
        }
        else
                unlink(subfile(tcfile));
+       exit(0);
 }
 
 #define FTABSIZE 30
 }
 
 #define FTABSIZE 30
index e268aad..9df7ceb 100644 (file)
@@ -1,9 +1,8 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uuxqt.c    5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)uuxqt.c    5.5 (Berkeley) %G%";
 #endif
 
 #include "uucp.h"
 #endif
 
 #include "uucp.h"
-#include <sys/types.h>
 #include <sys/stat.h>
 #ifdef NDIR
 #include "ndir.h"
 #include <sys/stat.h>
 #ifdef NDIR
 #include "ndir.h"
@@ -12,7 +11,8 @@ static char sccsid[] = "@(#)uuxqt.c   5.4 (Berkeley) %G%";
 #endif
 #include <signal.h>
 
 #endif
 #include <signal.h>
 
-#define BADCHARS       "&^|(`\\<>;"
+#define BADCHARS       "&^|(`\\<>;\"{}\n'"
+#define RECHECKTIME    60*10   /* 10 minutes */
 
 #define APPCMD(d) {\
 char *p;\
 
 #define APPCMD(d) {\
 char *p;\
@@ -31,23 +31,24 @@ int Notify[NCMDS+1];
 #define        NT_NO   2       /* if should not notify ever (-n equivalent) */
 
 extern int Nfiles;
 #define        NT_NO   2       /* if should not notify ever (-n equivalent) */
 
 extern int Nfiles;
-char *sindex();
+char *strpbrk();
 
 
+int TransferSucceeded = 1;
 int notiok = 1;
 int nonzero = 0;
 
 int notiok = 1;
 int nonzero = 0;
 
-#ifdef SIGCHLD
-#include <sys/wait.h>
-reapchild()
-{
-       union wait status;
+char PATH[MAXFULLNAME] = "PATH=/bin:/usr/bin:/usr/ucb";
+char Shell[MAXFULLNAME];
+char HOME[MAXFULLNAME];
 
 
-       while (wait3(&status,WNOHANG,0) > 0)
-               ;
-}
-#endif SIGCHLD
+extern char **environ;
+char *nenv[] = {
+       PATH,
+       Shell,
+       HOME,
+       0
+};
 
 
-char PATH[MAXFULLNAME] = "PATH=/bin:/usr/bin:/usr/ucb";
 /*  to remove restrictions from uuxqt
  *  define ALLOK 1
  *
 /*  to remove restrictions from uuxqt
  *  define ALLOK 1
  *
@@ -74,15 +75,13 @@ char *argv[];
        int uid, ret, ret2, badfiles;
        register int i;
        int stcico = 0;
        int uid, ret, ret2, badfiles;
        register int i;
        int stcico = 0;
+       time_t xstart, xnow;
        char retstat[30];
        char retstat[30];
+       char **ep;
 
        strcpy(Progname, "uuxqt");
        uucpname(Myname);
 
 
        strcpy(Progname, "uuxqt");
        uucpname(Myname);
 
-#ifdef SIGCHLD
-       signal(SIGCHLD, reapchild);
-#endif SIGCHLD
-
        umask(WFMASK);
        Ofn = 1;
        Ifn = 0;
        umask(WFMASK);
        Ofn = 1;
        Ifn = 0;
@@ -101,13 +100,12 @@ char *argv[];
                --argc;  argv++;
        }
 
                --argc;  argv++;
        }
 
-       DEBUG(4, "\n\n** %s **\n", "START");
+       DEBUG(4, "\n\n** START **\n", CNULL);
        ret = subchdir(Spool);
        ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret);
        strcpy(Wrkdir, Spool);
        uid = getuid();
        guinfo(uid, User, path);
        ret = subchdir(Spool);
        ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret);
        strcpy(Wrkdir, Spool);
        uid = getuid();
        guinfo(uid, User, path);
-       /* Try to run as uucp -- rti!trt */
        setgid(getegid());
        setuid(geteuid());
 
        setgid(getegid());
        setuid(geteuid());
 
@@ -170,7 +168,15 @@ char *argv[];
        fclose(fp);
 
 doprocess:
        fclose(fp);
 
 doprocess:
+
+       (void) sprintf(HOME, "HOME=%s", Spool);
+       (void) sprintf(Shell, "SHELL=%s", SHELL);
+       environ = nenv; /* force use if our environment */
+
+       DEBUG(11,"path = %s\n", getenv("PATH"));
+
        DEBUG(4, "process %s\n", CNULL);
        DEBUG(4, "process %s\n", CNULL);
+       time(&xstart);
        while (gtxfile(xfile) > 0) {
                ultouch();
                /* if /etc/nologin exists, exit cleanly */
        while (gtxfile(xfile) > 0) {
                ultouch();
                /* if /etc/nologin exists, exit cleanly */
@@ -254,9 +260,7 @@ doprocess:
 
                /* expand file names where necessary */
                expfile(dfile);
 
                /* expand file names where necessary */
                expfile(dfile);
-               strcpy(buf, PATH);
-               strcat(buf, " ");
-               cmdp = buf + strlen(buf);
+               cmdp = buf;
                ptr = cmd;
                xcmd[0] = '\0';
                argnok = 0;
                ptr = cmd;
                xcmd[0] = '\0';
                argnok = 0;
@@ -281,7 +285,7 @@ doprocess:
                 */
                if (cmdp > buf && cmdp[0] == '\0' && cmdp[-1] == ' ')
                        *--cmdp = '\0';
                 */
                if (cmdp > buf && cmdp[0] == '\0' && cmdp[-1] == ' ')
                        *--cmdp = '\0';
-               if (sindex(user, BADCHARS) != NULL) {
+               if (strpbrk(user, BADCHARS) != NULL) {
                        sprintf(lbuf, "%s INVALID CHARACTER IN USERNAME", user);
                        logent(cmd, lbuf);
                        strcpy(user, "postmaster");
                        sprintf(lbuf, "%s INVALID CHARACTER IN USERNAME", user);
                        logent(cmd, lbuf);
                        strcpy(user, "postmaster");
@@ -300,7 +304,7 @@ doprocess:
                mvxfiles(xfile);
                ret = subchdir(XQTDIR);
                ASSERT(ret >= 0, "CHDIR FAILED", XQTDIR, ret);
                mvxfiles(xfile);
                ret = subchdir(XQTDIR);
                ASSERT(ret >= 0, "CHDIR FAILED", XQTDIR, ret);
-               ret = shio(buf, fin, dfile, CNULL);
+               ret = shio(buf, fin, dfile);
                sprintf(retstat, "signal %d, exit %d", ret & 0377,
                  (ret>>8) & 0377);
                if (strcmp(xcmd, "rmail") == SAME)
                sprintf(retstat, "signal %d, exit %d", ret & 0377,
                  (ret>>8) & 0377);
                if (strcmp(xcmd, "rmail") == SAME)
@@ -338,8 +342,7 @@ doprocess:
                        if (prefix(sysout, Myname)) {
                                xmv(dfile, fout);
                                chmod(fout, BASEMODE);
                        if (prefix(sysout, Myname)) {
                                xmv(dfile, fout);
                                chmod(fout, BASEMODE);
-                       }
-                       else {
+                       } else {
                                char *cp = rindex(user, '!');
                                gename(CMDPRE, sysout, 'O', cfile);
                                fp = fopen(subfile(cfile), "w");
                                char *cp = rindex(user, '!');
                                gename(CMDPRE, sysout, 'O', cfile);
                                fp = fopen(subfile(cfile), "w");
@@ -360,6 +363,14 @@ doprocess:
                }
                unlink(subfile(xfile));
                fclose(xfp);
                }
                unlink(subfile(xfile));
                fclose(xfp);
+
+               /* rescan X. for new work every RECHECKTIME seconds */
+               time(&xnow);
+               if (xnow > (xstart + RECHECKTIME)) {
+                       extern int Nfiles;
+                       Nfiles = 0;     /*force rescan for new work */
+               }
+               xstart = xnow;
        }
 
        if (stcico)
        }
 
        if (stcico)
@@ -378,15 +389,15 @@ int code;
         *      Since we run as a BATCH job we must wait for all processes to
         *      to finish
         */
         *      Since we run as a BATCH job we must wait for all processes to
         *      to finish
         */
-       while(wait(0) != -1);
+       while(wait(0) != -1)
+               ;
 #endif VMS
        exit(code);
 }
 
 
 #endif VMS
        exit(code);
 }
 
 
-/*******
- *     gtxfile(file)   get a file to execute
- *     char *file;
+/*
+ *     get a file to execute
  *
  *     return codes:  0 - no file  |  1 - file to execute
  */
  *
  *     return codes:  0 - no file  |  1 - file to execute
  */
@@ -444,10 +455,8 @@ retry:
        goto retry;
 }
 
        goto retry;
 }
 
-
-/***
- *     gotfiles(file)          check for needed files
- *     char *file;
+/*
+ *     check for needed files
  *
  *     return codes:  0 - not ready  |  1 - all files ready
  */
  *
  *     return codes:  0 - not ready  |  1 - all files ready
  */
@@ -480,11 +489,8 @@ register char *file;
 }
 
 
 }
 
 
-/***
- *     rmxfiles(xfile)         remove execute files to x-directory
- *     char *xfile;
- *
- *     return codes - none
+/*
+ *     remove execute files to x-directory
  */
 
 rmxfiles(xfile)
  */
 
 rmxfiles(xfile)
@@ -510,11 +516,8 @@ register char *xfile;
 }
 
 
 }
 
 
-/***
- *     mvxfiles(xfile)         move execute files to x-directory
- *     char *xfile;
- *
- *     return codes - none
+/*
+ *     move execute files to x-directory
  */
 
 mvxfiles(xfile)
  */
 
 mvxfiles(xfile)
@@ -540,15 +543,11 @@ char *xfile;
                ASSERT(ret == 0, "XQTDIR ERROR", CNULL, ret);
        }
        fclose(fp);
                ASSERT(ret == 0, "XQTDIR ERROR", CNULL, ret);
        }
        fclose(fp);
-       return;
 }
 
 }
 
-
-/***
- *     argok(xc, cmd)          check for valid command/argumanet
- *                     *NOTE - side effect is to set xc to the
- *                             command to be executed.
- *     char *xc, *cmd;
+/*
+ *     check for valid command/argument        
+ *     *NOTE - side effect is to set xc to the command to be executed.
  *
  *     return 0 - ok | 1 nok
  */
  *
  *     return 0 - ok | 1 nok
  */
@@ -559,8 +558,9 @@ register char *xc, *cmd;
        register char **ptr;
 
 #ifndef ALLOK
        register char **ptr;
 
 #ifndef ALLOK
-       if (sindex(cmd, BADCHARS) != NULL) {
+       if (strpbrk(cmd, BADCHARS) != NULL) {
                DEBUG(1,"MAGIC CHARACTER FOUND\n", CNULL);
                DEBUG(1,"MAGIC CHARACTER FOUND\n", CNULL);
+               logent(cmd, "NASTY MAGIC CHARACTER FOUND");
                return FAIL;
        }
 #endif !ALLOK
                return FAIL;
        }
 #endif !ALLOK
@@ -588,10 +588,8 @@ register char *xc, *cmd;
 }
 
 
 }
 
 
-/***
- *     chknotify(cmd)  check if notification should be sent for
- *                     successful execution of cmd
- *     char *cmd;
+/*
+ *     if notification should be sent for successful execution of cmd
  *
  *     return NT_YES - do notification
  *            NT_ERR - do notification if exit status != 0
  *
  *     return NT_YES - do notification
  *            NT_ERR - do notification if exit status != 0
@@ -617,10 +615,8 @@ char *cmd;
 
 
 
 
 
 
-/***
- *     notify  send mail to user giving execution results
- *     return code - none
- *     This program assumes new mail command - send remote mail
+/*
+ *     send mail to user giving execution results
  */
 
 notify(user, rmt, cmd, str)
  */
 
 notify(user, rmt, cmd, str)
@@ -638,10 +634,9 @@ char *user, *rmt, *cmd, *str;
        return;
 }
 
        return;
 }
 
-/***
- *     retosndr - return mail to sender
+/*
+ *     return mail to sender
  *
  *
- *     return code - none
  */
 
 retosndr(user, rmt, file)
  */
 
 retosndr(user, rmt, file)
@@ -665,7 +660,7 @@ char *user, *rmt, *file;
  * this is like index, but takes a string as the second argument
  */
 char *
  * this is like index, but takes a string as the second argument
  */
 char *
-sindex(str, chars)
+strpbrk(str, chars)
 register char *str, *chars;
 {
        register char *cp;
 register char *str, *chars;
 {
        register char *cp;
@@ -679,3 +674,55 @@ register char *str, *chars;
        } while (*str++);
        return NULL;
 }
        } while (*str++);
        return NULL;
 }
+
+/*
+ *     execute shell of command with fi and fo as standard input/output
+ */
+
+shio(cmd, fi, fo)
+char *cmd, *fi, *fo;
+{
+       int status, f;
+       int uid, pid, ret;
+       char path[MAXFULLNAME];
+       char *args[20];
+       extern int errno;
+
+       if (fi == NULL)
+               fi = DEVNULL;
+       if (fo == NULL)
+               fo = DEVNULL;
+
+       getargs(cmd, args, 20);
+       DEBUG(3, "shio - %s\n", cmd);
+#ifdef SIGCHLD
+       signal(SIGCHLD, SIG_IGN);
+#endif SIGCHLD
+       if ((pid = fork()) == 0) {
+               signal(SIGINT, SIG_IGN);
+               signal(SIGHUP, SIG_IGN);
+               signal(SIGQUIT, SIG_IGN);
+               signal(SIGKILL, SIG_IGN);
+               close(Ifn);
+               close(Ofn);
+               close(0);
+               setuid(getuid());
+               f = open(subfile(fi), 0);
+               if (f != 0) {
+                       logent(fi, "CAN'T READ");
+                       exit(-errno);
+               }
+               close(1);
+               f = creat(subfile(fo), 0666);
+               if (f != 1) {
+                       logent(fo, "CAN'T WRITE");
+                       exit(-errno);
+               }
+               execvp(args[0], args);
+               exit(100+errno);
+       }
+       while ((ret = wait(&status)) != pid && ret != -1)
+               ;
+       DEBUG(3, "status %d\n", status);
+       return status;
+}
index caab3ba..cd56b25 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uudecode.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)uudecode.c 5.3 (Berkeley) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -20,7 +20,6 @@ main(argc, argv)
 char **argv;
 {
        FILE *in, *out;
 char **argv;
 {
        FILE *in, *out;
-       struct stat sbuf;
        int mode;
        char dest[128];
        char buf[80];
        int mode;
        char dest[128];
        char buf[80];