summaryrefslogtreecommitdiff
path: root/gnu/libexec/uucp/common_sources
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
commit5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch)
treee779b5a6edddbb949b7990751b12d6f25304ba86 /gnu/libexec/uucp/common_sources
parenta16f65c7d117419bd266c28a1901ef129a337569 (diff)
Diffstat (limited to 'gnu/libexec/uucp/common_sources')
-rw-r--r--gnu/libexec/uucp/common_sources/chat.c61
-rw-r--r--gnu/libexec/uucp/common_sources/config.h (renamed from gnu/libexec/uucp/common_sources/conf.h)92
-rw-r--r--gnu/libexec/uucp/common_sources/conn.c249
-rw-r--r--gnu/libexec/uucp/common_sources/conn.h25
-rw-r--r--gnu/libexec/uucp/common_sources/copy.c4
-rw-r--r--gnu/libexec/uucp/common_sources/cu.h2
-rw-r--r--gnu/libexec/uucp/common_sources/log.c224
-rw-r--r--gnu/libexec/uucp/common_sources/policy.h205
-rw-r--r--gnu/libexec/uucp/common_sources/prot.c10
-rw-r--r--gnu/libexec/uucp/common_sources/prot.h7
-rw-r--r--gnu/libexec/uucp/common_sources/sysdep.h50
-rw-r--r--gnu/libexec/uucp/common_sources/system.h87
-rw-r--r--gnu/libexec/uucp/common_sources/tcp.c53
-rw-r--r--gnu/libexec/uucp/common_sources/tli.c116
-rw-r--r--gnu/libexec/uucp/common_sources/trans.h24
-rw-r--r--gnu/libexec/uucp/common_sources/util.c50
-rw-r--r--gnu/libexec/uucp/common_sources/uuconf.h60
-rw-r--r--gnu/libexec/uucp/common_sources/uucp.h37
-rw-r--r--gnu/libexec/uucp/common_sources/uudefs.h25
19 files changed, 918 insertions, 463 deletions
diff --git a/gnu/libexec/uucp/common_sources/chat.c b/gnu/libexec/uucp/common_sources/chat.c
index 8544ed2e2027..96c2942652e5 100644
--- a/gnu/libexec/uucp/common_sources/chat.c
+++ b/gnu/libexec/uucp/common_sources/chat.c
@@ -1,7 +1,7 @@
/* chat.c
Chat routine for the UUCP package.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,13 +20,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char chat_rcsid[] = "$Id: chat.c,v 1.1 1993/08/05 18:22:30 conklin Exp $";
+const char chat_rcsid[] = "$Id: chat.c,v 1.2 1994/05/07 18:08:33 ache Exp $";
#endif
#include <ctype.h>
@@ -153,6 +153,9 @@ fchat (qconn, puuconf, qchat, qsys, qdial, zphone, ftranslate, zport, ibaud)
/* Loop over subexpects and subsends. */
while (TRUE)
{
+ char *ztimeout;
+ int ctimeout;
+
/* Copy the expect string into the buffer so that we can
modify it in cescape. */
clen = strlen (*pzchat);
@@ -167,6 +170,23 @@ fchat (qconn, puuconf, qchat, qsys, qdial, zphone, ftranslate, zport, ibaud)
azstrings[0] = zbuf;
if (azstrings[0][0] == '-')
++azstrings[0];
+
+ /* \Wnum at the end of the string is a timeout. */
+ ctimeout = qchat->uuconf_ctimeout;
+ ztimeout = strrchr (azstrings[0], '\\');
+ if (ztimeout != NULL && ztimeout[1] == 'W')
+ {
+ char *zend;
+ int cval;
+
+ cval = (int) strtol (ztimeout + 2, &zend, 10);
+ if (zend != ztimeout + 2 && *zend == '\0')
+ {
+ ctimeout = cval;
+ *ztimeout = '\0';
+ }
+ }
+
aclens[0] = cescape (azstrings[0]);
if (aclens[0] == 0
@@ -185,8 +205,7 @@ fchat (qconn, puuconf, qchat, qsys, qdial, zphone, ftranslate, zport, ibaud)
int istr;
istr = icexpect (qconn, cstrings, azstrings, aclens,
- qchat->uuconf_ctimeout,
- qchat->uuconf_fstrip);
+ ctimeout, qchat->uuconf_fstrip);
/* If we found the string, break out of the
subexpect/subsend loop. */
@@ -640,7 +659,7 @@ fcsend (qconn, puuconf, z, qsys, qdial, zphone, ftranslate, fstrip)
break;
case 'd':
fquote = fcsend_debug (fquote, (size_t) 0, "sleep");
- usysdep_sleep (2);
+ usysdep_sleep (1);
break;
case 'e':
fquote = fcsend_debug (fquote, (size_t) 0, "echo-check-off");
@@ -717,6 +736,8 @@ fcsend (qconn, puuconf, z, qsys, qdial, zphone, ftranslate, fstrip)
case 'L':
{
const char *zlog;
+ char *zcopy;
+ size_t clen;
if (qsys == NULL)
{
@@ -756,18 +777,24 @@ fcsend (qconn, puuconf, z, qsys, qdial, zphone, ftranslate, fstrip)
}
zlog = zcallout_login;
}
+ zcopy = zbufcpy (zlog);
+ clen = cescape (zcopy);
fquote = fcsend_debug (fquote, (size_t) 0, "login");
- fquote = fcsend_debug (fquote, strlen (zlog), zlog);
- if (! (*pfwrite) (qconn, zlog, strlen (zlog)))
+ fquote = fcsend_debug (fquote, clen, zcopy);
+ if (! (*pfwrite) (qconn, zcopy, clen))
{
+ ubuffree (zcopy);
ucsend_debug_end (fquote, TRUE);
return FALSE;
}
+ ubuffree (zcopy);
}
break;
case 'P':
{
const char *zpass;
+ char *zcopy;
+ size_t clen;
if (qsys == NULL)
{
@@ -807,13 +834,17 @@ fcsend (qconn, puuconf, z, qsys, qdial, zphone, ftranslate, fstrip)
}
zpass = zcallout_pass;
}
+ zcopy = zbufcpy (zpass);
+ clen = cescape (zcopy);
fquote = fcsend_debug (fquote, (size_t) 0, "password");
- fquote = fcsend_debug (fquote, strlen (zpass), zpass);
- if (! (*pfwrite) (qconn, zpass, strlen (zpass)))
+ fquote = fcsend_debug (fquote, clen, zcopy);
+ if (! (*pfwrite) (qconn, zcopy, clen))
{
+ ubuffree (zcopy);
ucsend_debug_end (fquote, TRUE);
return FALSE;
}
+ ubuffree (zcopy);
}
break;
case 'D':
@@ -1168,6 +1199,7 @@ fcprogram (qconn, puuconf, pzprogram, qsys, qdial, zphone, zport, ibaud)
for (zfrom = *pz; *zfrom != '\0'; zfrom++)
{
const char *zadd = NULL;
+ char *zfree = NULL;
size_t cadd;
char abadd[15];
@@ -1241,7 +1273,9 @@ fcprogram (qconn, puuconf, pzprogram, qsys, qdial, zphone, zport, ibaud)
}
zlog = zcallout_login;
}
- zadd = zlog;
+ zfree = zbufcpy (zlog);
+ (void) cescape (zfree);
+ zadd = zfree;
}
break;
case 'P':
@@ -1287,7 +1321,9 @@ fcprogram (qconn, puuconf, pzprogram, qsys, qdial, zphone, zport, ibaud)
}
zpass = zcallout_pass;
}
- zadd = zpass;
+ zfree = zbufcpy (zpass);
+ (void) cescape (zfree);
+ zadd = zfree;
}
break;
case 'D':
@@ -1405,6 +1441,7 @@ fcprogram (qconn, puuconf, pzprogram, qsys, qdial, zphone, zport, ibaud)
memcpy (zto, zadd, cadd + 1);
zto += cadd;
clen += cadd;
+ ubuffree (zfree);
}
if (! fret)
diff --git a/gnu/libexec/uucp/common_sources/conf.h b/gnu/libexec/uucp/common_sources/config.h
index 9053c4423e0a..c02a754eae9d 100644
--- a/gnu/libexec/uucp/common_sources/conf.h
+++ b/gnu/libexec/uucp/common_sources/config.h
@@ -1,10 +1,13 @@
-/* conf.h. Generated automatically by configure. */
+/* config.h. Generated automatically by configure. */
/* Configuration header file for Taylor UUCP. -*- C -*- */
-/* Set MAIL_PROGRAM to a program which takes a mail address as an
- argument and accepts a mail message to send to that address on
- stdin (e.g. "/bin/mail"). */
-#define MAIL_PROGRAM "/usr/bin/mail"
+/* If your compiler does not use const correctly, then undefine it
+ here. This #undef is commented out by the configure script if it
+ determines that const is supported. */
+/* #undef const */
+
+/* If your compiler supports prototypes, set HAVE_PROTOTYPES to 1. */
+#define HAVE_PROTOTYPES 1
/* Set ECHO_PROGRAM to a program which echoes its arguments; if echo
is a shell builtin you can just use "echo". */
@@ -14,6 +17,7 @@
macro to 1 if you have the corresponding header file, or 0 if you
do not. */
#define HAVE_STDDEF_H 1 /* <stddef.h> */
+#define HAVE_STDARG_H 1 /* <stdarg.h> */
#define HAVE_STRING_H 1 /* <string.h> */
#define HAVE_STRINGS_H 1 /* <strings.h> */
#define HAVE_UNISTD_H 1 /* <unistd.h> */
@@ -22,12 +26,13 @@
#define HAVE_TIME_H 1 /* <time.h> */
#define HAVE_SYS_WAIT_H 1 /* <sys/wait.h> */
#define HAVE_SYS_IOCTL_H 1 /* <sys/ioctl.h> */
-#define HAVE_DIRENT_H 1 /* <dirent.h> */
+#define HAVE_DIRENT_H 0 /* <dirent.h> */
#define HAVE_MEMORY_H 1 /* <memory.h> */
#define HAVE_SYS_PARAM_H 1 /* <sys/param.h> */
#define HAVE_UTIME_H 1 /* <utime.h> */
#define HAVE_FCNTL_H 1 /* <fcntl.h> */
#define HAVE_SYS_FILE_H 1 /* <sys/file.h> */
+#define HAVE_SYS_TIME_H 1 /* <sys/time.h> */
#define HAVE_SYS_TIMES_H 1 /* <sys/times.h> */
#define HAVE_LIBC_H 0 /* <libc.h> */
#define HAVE_SYSEXITS_H 1 /* <sysexits.h> */
@@ -56,10 +61,19 @@
systems this will be void; some older systems use int. */
#define RETSIGTYPE void
-/* Set HAVE_SYS_TIME_AND_TIME_H to 1 if <time.h> and <sys/time.h> can both
- be included in a single source file; if you don't have either or both of
- them, it doesn't matter what you set this to. */
-#define HAVE_SYS_TIME_AND_TIME_H 1
+/* If the macro S_ISDIR is defined in <sys/stat.h>, but is incorrect,
+ define STAT_MACROS_BROKEN to be 1. This is said to be the case on
+ Tektronix UTekV, Amdahl UTS and Motorola System V/88. */
+#define STAT_MACROS_BROKEN 0
+
+/* Set TIME_WITH_SYS_TIME to 1 if <time.h> and <sys/time.h> can both
+ be included in a single source file; if you don't have either or
+ both of them, it doesn't matter what you set this to. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Set TM_IN_SYS_TIME to 1 if struct tm is defined in <sys/time.h>
+ rather than in <time.h>. */
+#define TM_IN_SYS_TIME 0
/* Set HAVE_TERMIOS_AND_SYS_IOCTL_H to 1 if <termios.h> and <sys/ioctl.h>
can both be included in a single source file; if you don't have either
@@ -91,22 +105,22 @@
/* The type pid_t is used to hold a process ID number. It is normally
defined in <sys/types.h>. This is the type returned by the
functions fork or getpid. Usually int will work fine. */
-#undef PID_T
+/* #undef PID_T */
/* The type uid_t is used to hold a user ID number. It is normally
defined in <sys/types.h>. This is the type returned by the getuid
function. Usually int will work fine. */
-#undef UID_T
+/* #undef UID_T */
/* The type gid_t is used to hold a group ID number. It is sometimes
defined in <sys/types.h>. This is the type returned by the getgid
function. Usually int will work fine. */
-#undef GID_T
+/* #undef GID_T */
/* The type off_t is used to hold an offset in a file. It is sometimes
defined in <sys/types.h>. This is the type of the second argument to
the lseek function. Usually long will work fine. */
-#undef OFF_T
+/* #undef OFF_T */
/* Set HAVE_SIG_ATOMIC_T_IN_SIGNAL_H if the type sig_atomic_t is defined
in <signal.h> as required by ANSI C. */
@@ -124,7 +138,7 @@
compiler does not support sig_atomic_t, there is no type which is
really correct; fortunately, for this package it does not really
matter very much. */
-#undef SIG_ATOMIC_T
+/* #undef SIG_ATOMIC_T */
/* Set HAVE_SIZE_T_IN_STDDEF_H to 1 if the type size_t is defined in
<stddef.h> as required by ANSI C. */
@@ -140,7 +154,7 @@
to the malloc and realloc functions. If size_t is not defined in
either <stddef.h> or <sys/types.h>, you may want to give it a
definition here. If you don't, the code will use unsigned. */
-#undef SIZE_T
+/* #undef SIZE_T */
/* Set HAVE_TIME_T_IN_TIME_H to 1 if the type time_t is defined in
<time.h>, as required by the ANSI C standard. */
@@ -167,12 +181,16 @@
STAT_STATFS2_FSIZE two argument statfs function with f_fsize field
STAT_STATFS2_FS_DATA two argument statfs function with fd_req field
STAT_STATFS4 four argument statfs function
+ STAT_DUSTAT dustat function (AIX PS/2)
+ STAT_DISK_SPACE disk_space function (QNX)
STAT_USTAT the ustat function with 512 byte blocks. */
#define STAT_STATVFS 0
#define STAT_STATFS2_BSIZE 0
#define STAT_STATFS2_FSIZE 1
#define STAT_STATFS2_FS_DATA 0
#define STAT_STATFS4 0
+#define STAT_DUSTAT 0
+#define STAT_DISK_SPACE 0
#define STAT_USTAT 0
/* Set HAVE_VOID to 1 if the compiler supports declaring functions with
@@ -186,6 +204,10 @@
/* Set HAVE_ERRNO_DECLARATION to 1 if errno is declared in <errno.h>. */
#define HAVE_ERRNO_DECLARATION 1
+/* Set HAVE_TXADDCD to 1 if TXADDCD is defined in <sys/ioctl.h>, as it
+ is on AIX. */
+#define HAVE_TXADDCD 0
+
/* There are now a number of functions to check for. For each of
these, the macro HAVE_FUNC should be set to 1 if your system has
FUNC. For example, HAVE_VFPRINTF should be set to 1 if your system
@@ -219,6 +241,7 @@
#define HAVE_STRDUP 1 /* strdup.o */
#define HAVE_STRSTR 1 /* strstr.o */
#define HAVE_STRTOL 1 /* strtol.o */
+#define HAVE_STRTOUL 1 /* strtou.o */
/* If neither of these functions exists, you should add bzero.o to
lib/Makefile. */
@@ -305,7 +328,7 @@
setjmp. These functions will only be used if your system restarts
system calls after interrupts (see HAVE_RESTARTABLE_SYSCALLS,
below). */
-#define HAVE_SIGSETJMP 0
+#define HAVE_SIGSETJMP 1
#define HAVE_SETRET 0
/* The code needs to know what function to use to set a signal
@@ -339,7 +362,7 @@
/* The code will use one of the following functions when detaching
from a terminal. One of these must exist. */
-#define HAVE_SETPGRP 0
+#define HAVE_SETPGRP 1
#define HAVE_SETSID 1
/* If you do not specify the local node name in the main configuration
@@ -347,7 +370,7 @@
in turn. If neither is available, you must specify the local node
name in the configuration file. */
#define HAVE_GETHOSTNAME 1
-#define HAVE_UNAME 0
+#define HAVE_UNAME 1
/* The code will try to use each of the following functions in turn to
determine the current time. If none are available, it will use
@@ -385,6 +408,11 @@
-lxti, to the Makefile variables LIBS. */
#define HAVE_T_OPEN 0
+/* If the dev_info function is available (QNX only), it will be used
+ to determine if any other process has the serial port open, and
+ that will cause uucico and cu to presume the port is locked. */
+#define HAVE_DEV_INFO 0
+
/* That's the end of the list of the functions. Now there are a few
last miscellaneous items. */
@@ -399,7 +427,7 @@
/* extern struct passwd *getpwnam (); */
#define GETPWNAM_DECLARATION_OK 1
/* extern struct passwd *getpwuid (); */
-#define GETPWUID_DECLARATION_OK 0
+#define GETPWUID_DECLARATION_OK 1
/* extern struct group *getgrent (); */
#define GETGRENT_DECLARATION_OK 1
@@ -425,20 +453,10 @@
#define HAVE_RESTARTABLE_SYSCALLS 1
/* Some systems supposedly need the following macros to be defined.
- These are handled by the configure script (it will turn #undef into
- #define when appropriate, which is why the peculiar #ifndef #undef
- construction is used). If you are configuring by hand, you may add
- appropriate definitions here, or just add them to CFLAGS when
- running make. */
-#ifndef _ALL_SOURCE
-#undef _ALL_SOURCE
-#endif
-#ifndef _POSIX_SOURCE
-#undef _POSIX_SOURCE
-#endif
-#ifndef _MINIX
-#undef _MINIX
-#endif
-#ifndef _POSIX_1_SOURCE
-#undef _POSIX_1_SOURCE
-#endif
+ These are handled by the configure script. If you are configuring
+ by hand, you may add appropriate definitions here, or just add them
+ to CFLAGS when running make. */
+/* #undef _ALL_SOURCE */
+/* #undef _POSIX_SOURCE */
+/* #undef _MINIX */
+/* #undef _POSIX_1_SOURCE */
diff --git a/gnu/libexec/uucp/common_sources/conn.c b/gnu/libexec/uucp/common_sources/conn.c
index 8db53516a685..5085ee5b63c9 100644
--- a/gnu/libexec/uucp/common_sources/conn.c
+++ b/gnu/libexec/uucp/common_sources/conn.c
@@ -1,7 +1,7 @@
/* conn.c
Connection routines for the Taylor UUCP package.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,13 +20,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char conn_rcsid[] = "$Id: conn.c,v 1.1 1993/08/05 18:22:35 conklin Exp $";
+const char conn_rcsid[] = "$Id: conn.c,v 1.2 1994/05/07 18:08:38 ache Exp $";
#endif
#include <ctype.h>
@@ -35,21 +35,19 @@ const char conn_rcsid[] = "$Id: conn.c,v 1.1 1993/08/05 18:22:35 conklin Exp $";
#include "uuconf.h"
#include "conn.h"
-static boolean fcdo_dial P((struct sconnection *qconn, pointer puuconf,
- struct uuconf_dialer *qdialer,
- const char *zphone, boolean ftranslate));
-
/* Create a new connection. This relies on system dependent functions
to set the qcmds and psysdep fields. If qport is NULL, it opens a
- standard input port. */
+ standard input port, in which case ttype is the type of port to
+ use. */
boolean
-fconn_init (qport, qconn)
+fconn_init (qport, qconn, ttype)
struct uuconf_port *qport;
struct sconnection *qconn;
+ enum uuconf_porttype ttype;
{
qconn->qport = qport;
- switch (qport == NULL ? UUCONF_PORTTYPE_STDIN : qport->uuconf_ttype)
+ switch (qport == NULL ? ttype : qport->uuconf_ttype)
{
case UUCONF_PORTTYPE_STDIN:
return fsysdep_stdin_init (qconn);
@@ -65,8 +63,10 @@ fconn_init (qport, qconn)
case UUCONF_PORTTYPE_TLI:
return fsysdep_tli_init (qconn);
#endif
+ case UUCONF_PORTTYPE_PIPE:
+ return fsysdep_pipe_init (qconn);
default:
- ulog (LOG_ERROR, "Unknown port type");
+ ulog (LOG_ERROR, "Unknown or unsupported port type");
return FALSE;
}
}
@@ -202,8 +202,9 @@ fconn_close (qconn, puuconf, qdialer, fsuccess)
fret = (*qconn->qcmds->pfclose) (qconn, puuconf, qdialer, fsuccess);
- /* Make sure any signal reporting has been done before we set
- fLog_sighup back to TRUE. */
+ /* Ignore any SIGHUP we may have gotten, and make sure any signal
+ reporting has been done before we reset fLog_sighup. */
+ afSignal[INDEXSIG_SIGHUP] = FALSE;
ulog (LOG_ERROR, (const char *) NULL);
fLog_sighup = TRUE;
@@ -211,17 +212,6 @@ fconn_close (qconn, puuconf, qdialer, fsuccess)
return fret;
}
-
-/* Reset the connection. */
-
-boolean
-fconn_reset (qconn)
- struct sconnection *qconn;
-{
- DEBUG_MESSAGE0 (DEBUG_PORT, "fconn_reset: Resetting connection");
-
- return (*qconn->qcmds->pfreset) (qconn);
-}
/* Dial out on the connection. */
@@ -347,7 +337,7 @@ fconn_break (qconn)
{
boolean (*pfbreak) P((struct sconnection *));
- pfbreak = *qconn->qcmds->pfbreak;
+ pfbreak = qconn->qcmds->pfbreak;
if (pfbreak == NULL)
return TRUE;
@@ -419,74 +409,65 @@ iconn_baud (qconn)
return (*pibaud) (qconn);
}
-/* Modem dialing routines. */
+/* Run through a dialer sequence. The pzdialer argument is a list of
+ strings, which are considered in dialer/token pairs. The dialer
+ string names a dialer to use. The token string is what \D and \T
+ in the chat script expand to. If there is no token for the last
+ dialer, the zphone argument is used. The qdialer argument is
+ filled in with information for the first dialer, and *ptdialerfound
+ is set to whether the information should be freed or not. However,
+ if *ptdialerfound is not DIALERFOUND_FALSE when this function is
+ called, then the information for the first dialer is already in
+ qdialer. */
-/*ARGSUSED*/
boolean
-fmodem_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
+fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone, qdialer,
+ ptdialerfound)
struct sconnection *qconn;
pointer puuconf;
+ char **pzdialer;
const struct uuconf_system *qsys;
const char *zphone;
struct uuconf_dialer *qdialer;
enum tdialerfound *ptdialerfound;
{
- *ptdialerfound = DIALERFOUND_FALSE;
+ const char *zname;
+ boolean ffirst, ffreefirst;
- if (qconn->qport->uuconf_u.uuconf_smodem.uuconf_pzdialer != NULL)
+ if (qconn->qport == NULL)
+ zname = NULL;
+ else
+ zname = qconn->qport->uuconf_zname;
+ ffirst = TRUE;
+ ffreefirst = FALSE;
+ while (*pzdialer != NULL)
{
- char **pz;
- boolean ffirst;
+ struct uuconf_dialer *q;
+ struct uuconf_dialer s;
+ const char *ztoken;
+ boolean ftranslate;
- /* The pzdialer field is a sequence of dialer/token pairs. The
- dialer portion names a dialer to use. The token portion is
- what \D and \T in the chat script expand to. If there is no
- token for the last dialer, the phone number for the system is
- used. */
- ffirst = TRUE;
- pz = qconn->qport->uuconf_u.uuconf_smodem.uuconf_pzdialer;
- while (*pz != NULL)
+ if (! ffirst)
+ q = &s;
+ else
+ q = qdialer;
+
+ if (! ffirst || *ptdialerfound == DIALERFOUND_FALSE)
{
int iuuconf;
- struct uuconf_dialer *q;
- struct uuconf_dialer s;
- const char *ztoken;
- boolean ftranslate;
-
- if (! ffirst)
- q = &s;
- else
- q = qdialer;
- iuuconf = uuconf_dialer_info (puuconf, *pz, q);
+ iuuconf = uuconf_dialer_info (puuconf, *pzdialer, q);
if (iuuconf == UUCONF_NOT_FOUND)
{
- ulog (LOG_ERROR, "%s: Dialer not found", *pz);
+ ulog (LOG_ERROR, "%s: Dialer not found", *pzdialer);
+ if (ffreefirst)
+ (void) uuconf_dialer_free (puuconf, qdialer);
return FALSE;
}
else if (iuuconf != UUCONF_SUCCESS)
{
ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
- return FALSE;
- }
-
- ++pz;
- ztoken = *pz;
-
- ftranslate = FALSE;
- if (ztoken == NULL
- || strcmp (ztoken, "\\D") == 0)
- ztoken = zphone;
- else if (strcmp (ztoken, "\\T") == 0)
- {
- ztoken = zphone;
- ftranslate = TRUE;
- }
-
- if (! fcdo_dial (qconn, puuconf, q, ztoken, ftranslate))
- {
- (void) uuconf_dialer_free (puuconf, q);
- if (! ffirst)
+ if (ffreefirst)
(void) uuconf_dialer_free (puuconf, qdialer);
return FALSE;
}
@@ -494,25 +475,109 @@ fmodem_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
if (ffirst)
{
*ptdialerfound = DIALERFOUND_FREE;
- ffirst = FALSE;
+ ffreefirst = TRUE;
}
- else
+ }
+
+ ++pzdialer;
+ ztoken = *pzdialer;
+
+ ftranslate = FALSE;
+ if (ztoken == NULL
+ || strcmp (ztoken, "\\D") == 0)
+ ztoken = zphone;
+ else if (strcmp (ztoken, "\\T") == 0)
+ {
+ ztoken = zphone;
+ ftranslate = TRUE;
+ }
+
+ if (! fchat (qconn, puuconf, &q->uuconf_schat, qsys, q, ztoken,
+ ftranslate, zname, iconn_baud (qconn)))
+ {
+ if (q == &s)
(void) uuconf_dialer_free (puuconf, q);
+ if (ffreefirst)
+ (void) uuconf_dialer_free (puuconf, qdialer);
+ return FALSE;
+ }
+
+ if (ffirst)
+ ffirst = FALSE;
+ else
+ (void) uuconf_dialer_free (puuconf, q);
+
+ if (*pzdialer != NULL)
+ ++pzdialer;
+ }
- if (*pz != NULL)
- ++pz;
+ return TRUE;
+}
+
+/* Modem dialing routine. */
+
+/*ARGSUSED*/
+boolean
+fmodem_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
+ struct sconnection *qconn;
+ pointer puuconf;
+ const struct uuconf_system *qsys;
+ const char *zphone;
+ struct uuconf_dialer *qdialer;
+ enum tdialerfound *ptdialerfound;
+{
+ char **pzdialer;
+
+ *ptdialerfound = DIALERFOUND_FALSE;
+
+ pzdialer = qconn->qport->uuconf_u.uuconf_smodem.uuconf_pzdialer;
+ if (pzdialer != NULL && *pzdialer != NULL)
+ {
+ int iuuconf;
+ boolean fret;
+
+ iuuconf = uuconf_dialer_info (puuconf, *pzdialer, qdialer);
+ if (iuuconf == UUCONF_NOT_FOUND)
+ {
+ ulog (LOG_ERROR, "%s: Dialer not found", *pzdialer);
+ return FALSE;
+ }
+ else if (iuuconf != UUCONF_SUCCESS)
+ {
+ ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
+ return FALSE;
}
- return TRUE;
+ *ptdialerfound = DIALERFOUND_FREE;
+
+ fret = (fsysdep_modem_begin_dial (qconn, qdialer)
+ && fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
+ qdialer, ptdialerfound)
+ && fsysdep_modem_end_dial (qconn, qdialer));
+
+ if (! fret)
+ (void) uuconf_dialer_free (puuconf, qdialer);
+
+ return fret;
}
else if (qconn->qport->uuconf_u.uuconf_smodem.uuconf_qdialer != NULL)
{
struct uuconf_dialer *q;
+ const char *zname;
q = qconn->qport->uuconf_u.uuconf_smodem.uuconf_qdialer;
*qdialer = *q;
*ptdialerfound = DIALERFOUND_TRUE;
- return fcdo_dial (qconn, puuconf, q, zphone, FALSE);
+
+ if (qconn->qport == NULL)
+ zname = NULL;
+ else
+ zname = qconn->qport->uuconf_zname;
+
+ return (fsysdep_modem_begin_dial (qconn, q)
+ && fchat (qconn, puuconf, &q->uuconf_schat, qsys, q,
+ zphone, FALSE, zname, iconn_baud (qconn))
+ && fsysdep_modem_end_dial (qconn, q));
}
else
{
@@ -520,33 +585,3 @@ fmodem_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
return FALSE;
}
}
-
-/* Actually use a dialer. We set up the modem (which may include
- opening the dialer device), run the chat script, and finish dealing
- with the modem. */
-
-static boolean
-fcdo_dial (qconn, puuconf, qdial, zphone, ftranslate)
- struct sconnection *qconn;
- pointer puuconf;
- struct uuconf_dialer *qdial;
- const char *zphone;
- boolean ftranslate;
-{
- const char *zname;
-
- if (! fsysdep_modem_begin_dial (qconn, qdial))
- return FALSE;
-
- if (qconn->qport == NULL)
- zname = NULL;
- else
- zname = qconn->qport->uuconf_zname;
-
- if (! fchat (qconn, puuconf, &qdial->uuconf_schat,
- (const struct uuconf_system *) NULL, qdial,
- zphone, ftranslate, zname, iconn_baud (qconn)))
- return FALSE;
-
- return fsysdep_modem_end_dial (qconn, qdial);
-}
diff --git a/gnu/libexec/uucp/common_sources/conn.h b/gnu/libexec/uucp/common_sources/conn.h
index 59d4881b07ff..368f7e658949 100644
--- a/gnu/libexec/uucp/common_sources/conn.h
+++ b/gnu/libexec/uucp/common_sources/conn.h
@@ -1,7 +1,7 @@
/* conn.h
Header file for routines which manipulate connections.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#ifndef CONN_H
@@ -121,8 +121,6 @@ struct sconncmds
pointer puuconf,
struct uuconf_dialer *qdialer,
boolean fsuccess));
- /* Reset the connection so that another call may be accepted. */
- boolean (*pfreset) P((struct sconnection *qconn));
/* Dial a number on a connection. This set *qdialer to the dialer
used, if any, and sets *ptdialerfound appropriately. The qsys
and zphone arguments are for the chat script. This field may be
@@ -170,9 +168,11 @@ struct sconncmds
/* Initialize a connection. This must be called before any of the
other connection functions are called. It initializes the fields
- of qconn. It returns FALSE on error. */
+ of qconn. If qport is NULL, this opens standard input as a port
+ using type ttype. This function returns FALSE on error. */
extern boolean fconn_init P((struct uuconf_port *qport,
- struct sconnection *qconn));
+ struct sconnection *qconn,
+ enum uuconf_porttype ttype));
/* Free up connection data. */
extern void uconn_free P((struct sconnection *qconn));
@@ -199,9 +199,6 @@ extern boolean fconn_close P((struct sconnection *qconn,
struct uuconf_dialer *qdialer,
boolean fsuccess));
-/* Reset a connection such that another call may be accepted. */
-extern boolean fconn_reset P((struct sconnection *q));
-
/* Dial out on a connection. The qsys and zphone arguments are for
the chat scripts; zphone is the phone number to dial. If qdialer
is not NULL, *qdialer will be set to the dialer information used if
@@ -275,6 +272,15 @@ extern boolean fconn_carrier P((struct sconnection *qconn,
extern boolean fconn_run_chat P((struct sconnection *qconn,
char **pzprog));
+/* Run through a dialer sequence. This is a support routine for the
+ port type specific dialing routines. */
+extern boolean fconn_dial_sequence P((struct sconnection *qconn,
+ pointer puuconf, char **pzdialer,
+ const struct uuconf_system *qsys,
+ const char *zphone,
+ struct uuconf_dialer *qdialer,
+ enum tdialerfound *ptdialerfound));
+
/* Dialing out on a modem is partially system independent. This is
the modem dialing routine. */
extern boolean fmodem_dial P((struct sconnection *qconn, pointer puuconf,
@@ -308,5 +314,6 @@ extern boolean fsysdep_tcp_init P((struct sconnection *qconn));
#if HAVE_TLI
extern boolean fsysdep_tli_init P((struct sconnection *qconn));
#endif
+extern boolean fsysdep_pipe_init P((struct sconnection *qconn));
#endif /* ! defined (CONN_H) */
diff --git a/gnu/libexec/uucp/common_sources/copy.c b/gnu/libexec/uucp/common_sources/copy.c
index 0d1a5bb2c270..176b53641c99 100644
--- a/gnu/libexec/uucp/common_sources/copy.c
+++ b/gnu/libexec/uucp/common_sources/copy.c
@@ -20,13 +20,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char copy_rcsid[] = "$Id: copy.c,v 1.1 1993/08/05 18:22:37 conklin Exp $";
+const char copy_rcsid[] = "$Id: copy.c,v 1.2 1994/05/07 18:08:42 ache Exp $";
#endif
#include "uudefs.h"
diff --git a/gnu/libexec/uucp/common_sources/cu.h b/gnu/libexec/uucp/common_sources/cu.h
index 5a514ee3bfe7..748e2d32c199 100644
--- a/gnu/libexec/uucp/common_sources/cu.h
+++ b/gnu/libexec/uucp/common_sources/cu.h
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
/* The user settable variables supported by cu. */
diff --git a/gnu/libexec/uucp/common_sources/log.c b/gnu/libexec/uucp/common_sources/log.c
index 9528baf5ca39..761efeff64af 100644
--- a/gnu/libexec/uucp/common_sources/log.c
+++ b/gnu/libexec/uucp/common_sources/log.c
@@ -1,7 +1,7 @@
/* log.c
Routines to add entries to the log files.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,22 +20,25 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char log_rcsid[] = "$Id: log.c,v 1.1 1993/08/05 18:22:39 conklin Exp $";
+const char log_rcsid[] = "$Id: log.c,v 1.2 1994/05/07 18:08:47 ache Exp $";
#endif
+#include <ctype.h>
#include <errno.h>
-#if ANSI_C
+#if HAVE_STDARG_H
#include <stdarg.h>
#endif
-#if HAVE_TIME_H
+#if TM_IN_SYS_TIME
+#include <sys/time.h>
+#else
#include <time.h>
#endif
@@ -45,8 +48,12 @@ const char log_rcsid[] = "$Id: log.c,v 1.1 1993/08/05 18:22:39 conklin Exp $";
/* Local functions. */
+__inline__ static char *zstpcpy P((char *zto, const char *zfrom));
static const char *zldate_and_time P((void));
+/* Program name. Set by main function. */
+const char *zProgram;
+
/* Log file name. */
static const char *zLogfile;
@@ -86,9 +93,6 @@ static FILE *eLdebug;
/* Whether we've tried to open the debugging file. */
static boolean fLdebug_tried;
-
-/* Whether we've written out any debugging information. */
-static boolean fLdebugging;
#endif
/* Statistics file name. */
@@ -212,11 +216,24 @@ ulog_device (zdevice)
zLdevice = zbufcpy (zdevice);
}
+/* A helper function for ulog. */
+
+__inline__ static char *
+zstpcpy (zto, zfrom)
+ char *zto;
+ const char *zfrom;
+{
+ while ((*zto++ = *zfrom++) != '\0')
+ ;
+ return zto - 1;
+}
+
/* Make a log entry. We make a token concession to non ANSI_C systems,
but it clearly won't always work. */
-#if ! ANSI_C
+#if ! HAVE_PROTOTYPES || ! HAVE_STDARG_H
#undef HAVE_VFPRINTF
+#define HAVE_VFPRINTF 0
#endif
/*VARARGS2*/
@@ -235,7 +252,11 @@ ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j)
#endif
FILE *e, *edebug;
boolean fstart, fend;
- const char *zhdr, *zstr;
+ const char *zhdr;
+ char *zprefix;
+ register char *zset;
+ char *zformat;
+ char *zfrom;
/* Log any received signal. We do it this way to avoid calling ulog
from the signal handler. A few routines call ulog to get this
@@ -276,11 +297,10 @@ ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j)
if (fLfile
&& eLdebug == NULL
&& ! fLdebug_tried
- && (fLdebugging || (int) ttype >= (int) LOG_DEBUG))
+ && iDebug != 0)
{
fLdebug_tried = TRUE;
eLdebug = esysdep_fopen (zLdebugfile, FALSE, TRUE, TRUE);
- fLdebugging = TRUE;
}
#endif /* DEBUG > 1 */
@@ -307,6 +327,8 @@ ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j)
#else /* HAVE_HDB_LOGGING */
{
const char *zsys;
+ char *zbase;
+ char *zlower;
char *zfile;
/* We want to write to .Log/program/system, e.g.
@@ -316,11 +338,23 @@ ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j)
else
zsys = zLsystem;
+ zbase = zsysdep_base_name (zProgram);
+ if (zbase == NULL)
+ zbase = zbufcpy (zProgram);
+
+ /* On some systems the native uusched will invoke uucico
+ with an upper case argv[0]. We work around that by
+ forcing the filename to lower case here. */
+ for (zlower = zbase; *zlower != '\0'; zlower++)
+ if (isupper (*zlower))
+ *zlower = tolower (*zlower);
+
zfile = zbufalc (strlen (zLogfile)
- + strlen (abProgram)
+ + strlen (zbase)
+ strlen (zsys)
+ 1);
- sprintf (zfile, zLogfile, abProgram, zsys);
+ sprintf (zfile, zLogfile, zbase, zsys);
+ ubuffree (zbase);
eLlog = esysdep_fopen (zfile, TRUE, TRUE, TRUE);
ubuffree (zfile);
}
@@ -328,10 +362,13 @@ ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j)
if (eLlog == NULL)
{
- /* We can't open the log file. We don't even have a
- safe way to report this problem, since we may not be
- able to write to stderr (it may, for example, be
- attached to the incoming call). */
+ /* We can't open the log file. We report the problem to
+ stderr. This is not ideal, since if this is uucico
+ running on an inbound call stderr is actually
+ connected to a remote system, but is better than
+ doing nothing. */
+ fprintf (stderr, "%s: %s: can not open log file\n",
+ zProgram, zLogfile);
if (pfLfatal != NULL)
(*pfLfatal) ();
usysdep_exit (FALSE);
@@ -392,99 +429,122 @@ ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j)
break;
}
- if (fstart)
+ if (! fstart)
+ zprefix = zbufcpy ("");
+ else
{
if (! fLfile)
{
- fprintf (e, "%s: ", abProgram);
- if (edebug != NULL)
- fprintf (edebug, "%s: ", abProgram);
+ zprefix = zbufalc (strlen (zProgram) + 3);
+ sprintf (zprefix, "%s: ", zProgram);
}
else
{
+ zprefix = zbufalc (strlen (zProgram)
+ + (zLsystem == NULL ? 1 : strlen (zLsystem))
+ + (zLuser == NULL ? 4 : strlen (zLuser))
+ + sizeof "1991-12-31 12:00:00.00"
+ + strlen (zhdr)
+ + 100);
+ zset = zprefix;
#if HAVE_TAYLOR_LOGGING
- fprintf (e, "%s ", abProgram);
- if (edebug != NULL)
- fprintf (edebug, "%s ", abProgram);
+ {
+ char *zbase;
+
+ zbase = zsysdep_base_name (zProgram);
+ if (zbase == NULL)
+ zbase = zbufcpy (zProgram);
+ zset = zstpcpy (zset, zbase);
+ *zset++ = ' ';
+ ubuffree (zbase);
+ }
#else /* ! HAVE_TAYLOR_LOGGING */
- fprintf (e, "%s ", zLuser == NULL ? "uucp" : zLuser);
- if (edebug != NULL)
- fprintf (edebug, "%s ", zLuser == NULL ? "uucp" : zLuser);
+ zset = zstpcpy (zset, zLuser == NULL ? "uucp" : zLuser);
+ *zset++ = ' ';
#endif /* HAVE_TAYLOR_LOGGING */
- fprintf (e, "%s ", zLsystem == NULL ? "-" : zLsystem);
- if (edebug != NULL)
- fprintf (edebug, "%s ", zLsystem == NULL ? "-" : zLsystem);
+ zset = zstpcpy (zset, zLsystem == NULL ? "-" : zLsystem);
+ *zset++ = ' ';
#if HAVE_TAYLOR_LOGGING
- fprintf (e, "%s ", zLuser == NULL ? "-" : zLuser);
- if (edebug != NULL)
- fprintf (edebug, "%s ", zLuser == NULL ? "-" : zLuser);
+ zset = zstpcpy (zset, zLuser == NULL ? "-" : zLuser);
+ *zset++ = ' ';
#endif /* HAVE_TAYLOR_LOGGING */
- zstr = zldate_and_time ();
- fprintf (e, "(%s", zstr);
- if (edebug != NULL)
- fprintf (edebug, "(%s", zstr);
+ *zset++ = '(';
+ zset = zstpcpy (zset, zldate_and_time ());
if (iLid != 0)
{
#if ! HAVE_HDB_LOGGING
#if HAVE_TAYLOR_LOGGING
- fprintf (e, " %d", iLid);
- if (edebug != NULL)
- fprintf (edebug, " %d", iLid);
+ sprintf (zset, " %d", iLid);
#else /* ! HAVE_TAYLOR_LOGGING */
- fprintf (e, "-%d", iLid);
- if (edebug != NULL)
- fprintf (edebug, "-%d", iLid);
+ sprintf (zset, "-%d", iLid);
#endif /* ! HAVE_TAYLOR_LOGGING */
#else /* HAVE_HDB_LOGGING */
-
/* I assume that the second number here is meant to be
some sort of file sequence number, and that it should
correspond to the sequence number in the statistics
file. I don't have any really convenient way to do
this, so I won't unless somebody thinks it's very
important. */
- fprintf (e, ",%d,%d", iLid, 0);
- if (edebug != NULL)
- fprintf (edebug, ",%d,%d", iLid, 0);
+ sprintf (zset, ",%d,%d", iLid, 0);
#endif /* HAVE_HDB_LOGGING */
+
+ zset += strlen (zset);
}
- fprintf (e, ") ");
- if (edebug != NULL)
- fprintf (edebug, ") ");
+#if QNX_LOG_NODE_ID
+ sprintf (zset, " %ld", (long) getnid ());
+ zset += strlen (zset);
+#endif
+
+ *zset++ = ')';
+ *zset++ = ' ';
- fprintf (e, "%s", zhdr);
- if (edebug != NULL)
- fprintf (edebug, "%s", zhdr);
+ strcpy (zset, zhdr);
}
}
+ zformat = zbufalc (2 * strlen (zprefix) + strlen (zmsg) + 2);
+
+ zset = zformat;
+ zfrom = zprefix;
+ while (*zfrom != '\0')
+ {
+ if (*zfrom == '%')
+ *zset++ = '%';
+ *zset++ = *zfrom++;
+ }
+
+ ubuffree (zprefix);
+
+ zset = zstpcpy (zset, zmsg);
+
+ if (fend)
+ {
+ *zset++ = '\n';
+ *zset = '\0';
+ }
+
#if HAVE_VFPRINTF
va_start (parg, zmsg);
- vfprintf (e, zmsg, parg);
+ vfprintf (e, zformat, parg);
va_end (parg);
if (edebug != NULL)
{
va_start (parg, zmsg);
- vfprintf (edebug, zmsg, parg);
+ vfprintf (edebug, zformat, parg);
va_end (parg);
}
#else /* ! HAVE_VFPRINTF */
- fprintf (e, zmsg, a, b, c, d, f, g, h, i, j);
+ fprintf (e, zformat, a, b, c, d, f, g, h, i, j);
if (edebug != NULL)
- fprintf (edebug, zmsg, a, b, c, d, f, g, h, i, j);
+ fprintf (edebug, zformat, a, b, c, d, f, g, h, i, j);
#endif /* ! HAVE_VFPRINTF */
- if (fend)
- {
- fprintf (e, "\n");
- if (edebug != NULL)
- fprintf (edebug, "\n");
- }
+ ubuffree (zformat);
(void) fflush (e);
if (edebug != NULL)
@@ -581,13 +641,24 @@ ustats (fsucceeded, zuser, zsystem, fsent, cbytes, csecs, cmicros, fmaster)
cbps = 0;
else
{
- long cmillis;
+ long cmillis, cdiv, crem;
- /* This computation will not overflow provided csecs < 2147483
- and cbytes and cbps both fit in a long. */
+ /* Compute ((csecs * 1000) / cmillis) using integer division.
+ Where DIV is integer division, we know
+ a = (a DIV b) * b + a % b
+ so
+ a / b = (a DIV b) + (a % b) / b
+ We compute the latter with a as csecs and b as cmillis,
+ mixing the multiplication by 1000. */
cmillis = csecs * 1000 + cmicros / 1000;
- cbps = ((cbytes / cmillis) * 1000
- + ((cbytes % cmillis) * 1000) / cmillis);
+ cdiv = (cbytes / cmillis) * 1000;
+ crem = (cbytes % cmillis) * 1000;
+ cbps = cdiv + (crem / cmillis);
+ if (cmillis < 0 || cdiv < 0 || crem < 0 || cbps < 0)
+ {
+ /* We overflowed using milliseconds, so use seconds. */
+ cbps = cbytes / (csecs + ((cmicros > 500000L) ? 1 : 0));
+ }
}
if (eLstats == NULL)
@@ -602,11 +673,12 @@ ustats (fsucceeded, zuser, zsystem, fsent, cbytes, csecs, cmicros, fmaster)
#if HAVE_TAYLOR_LOGGING
fprintf (eLstats,
- "%s %s (%s) %s%s %ld bytes in %ld.%03ld seconds (%ld bytes/sec)\n",
+ "%s %s (%s) %s%s %ld bytes in %ld.%03ld seconds (%ld bytes/sec) on port %s\n",
zuser, zsystem, zldate_and_time (),
fsucceeded ? "" : "failed after ",
fsent ? "sent" : "received",
- cbytes, csecs, cmicros / 1000, cbps);
+ cbytes, csecs, cmicros / 1000, cbps,
+ zLdevice == NULL ? "unknown" : zLdevice);
#endif /* HAVE_TAYLOR_LOGGING */
#if HAVE_V2_LOGGING
fprintf (eLstats,
@@ -625,18 +697,16 @@ ustats (fsucceeded, zuser, zsystem, fsent, cbytes, csecs, cmicros, fmaster)
probably correspond to the sequence number in the log file, but
that is currently always 0; using this fake sequence number
will still at least reveal which transfers are from different
- calls. We don't report a failed data transfer with this
- format. */
- if (! fsucceeded)
- return;
+ calls. */
++iseq;
fprintf (eLstats,
- "%s!%s %c (%s) (C,%d,%d) [%s] %s %ld / %ld.%03ld secs, %ld %s\n",
+ "%s!%s %c (%s) (C,%d,%d) [%s] %s %ld / %ld.%03ld secs, %ld%s%s\n",
zsystem, zuser, fmaster ? 'M' : 'S', zldate_and_time (),
iLid, iseq, zLdevice == NULL ? "unknown" : zLdevice,
fsent ? "->" : "<-",
cbytes, csecs, cmicros / 1000, cbps,
- "bytes/sec");
+ " bytes/sec",
+ fsucceeded ? "" : " [PARTIAL FILE]");
}
#endif /* HAVE_HDB_LOGGING */
diff --git a/gnu/libexec/uucp/common_sources/policy.h b/gnu/libexec/uucp/common_sources/policy.h
index 4c829bf42d8e..7fd03a24fa2e 100644
--- a/gnu/libexec/uucp/common_sources/policy.h
+++ b/gnu/libexec/uucp/common_sources/policy.h
@@ -1,7 +1,7 @@
/* policy.h
Configuration file for policy decisions. To be edited on site.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
/* This header file contains macro definitions which must be set by
@@ -72,14 +72,19 @@
figure out what's happening if something goes wrong. */
#if HAVE_BSD_TTY + HAVE_SYSV_TERMIO + HAVE_POSIX_TERMIOS == 0
+#ifdef __QNX__
+#undef HAVE_POSIX_TERMIOS
+#define HAVE_POSIX_TERMIOS 1
+#else /* ! defined (__QNX__) */
#if HAVE_CBREAK
#undef HAVE_BSD_TTY
#define HAVE_BSD_TTY 1
-#else
+#else /* ! HAVE_CBREAK */
#undef HAVE_SYSV_TERMIO
#define HAVE_SYSV_TERMIO 1
-#endif
-#endif
+#endif /* ! HAVE_CBREAK */
+#endif /* ! defined (__QNX__) */
+#endif /* HAVE_BSD_TTY + HAVE_SYSV_TERMIO + HAVE_POSIX_TERMIOS == 0 */
/* On some systems a write to a serial port will block even if the
file descriptor has been set to not block. File transfer can be
@@ -155,12 +160,23 @@
#define HAVE_STRIP_BUG 0
#if HAVE_BSD_TTY
+#ifdef __ultrix__
+#ifndef ultrix
+#define ultrix
+#endif
+#endif
#ifdef ultrix
#undef HAVE_STRIP_BUG
#define HAVE_STRIP_BUG 1
#endif
#endif
+/* If your system implements full duplex pipes, set
+ HAVE_FULLDUPLEX_PIPES to 1. Everything should work fine if you
+ leave it set to 0, but setting it to 1 can be slightly more
+ efficient. */
+#define HAVE_FULLDUPLEX_PIPES 0
+
/* TIMES_TICK is the fraction of a second which times(2) returns (for
example, if times returns 100ths of a second TIMES_TICK should be
set to 100). On a true POSIX system (one which has the sysconf
@@ -187,7 +203,7 @@
HAVE_SAVED_SETUID to 1, but your system does not have saved set
user ID, uucp will fail with an error message whenever anybody
other than the uucp user uses it. */
-#define HAVE_SAVED_SETUID 1
+#define HAVE_SAVED_SETUID 0
/* On some systems, such as the DG Aviion and, possibly, the RS/6000,
the setreuid function is broken. It should be possible to use
@@ -197,7 +213,7 @@
set HAVE_BROKEN_SETREUID to 1; if you do not, you will get error
messages from setreuid. Systems on which setreuid exists but is
broken pretty much always have saved setuid. */
-#define HAVE_BROKEN_SETREUID 0
+#define HAVE_BROKEN_SETREUID 1
/* On the 3B2, and possibly other systems, nap takes an argument in
hundredths of a second rather than milliseconds. I don't know of
@@ -206,6 +222,34 @@
have the nap function. */
#define HAVE_HUNDREDTHS_NAP 0
+/* Set MAIL_PROGRAM to a program which can be used to send mail. It
+ will be used for mail to both local and remote users. Set
+ MAIL_PROGRAM_TO_BODY to 1 if the recipient should be specified as a
+ To: line in the body of the message; otherwise, the recipient will
+ be provided as an argument to MAIL_PROGRAM. Set
+ MAIL_PROGRAM_SUBJECT_BODY if the subject should be specified as a
+ Subject: line in the body of the message; otherwise, the subject
+ will be provided using the -s option to MAIL_PROGRAM (if your mail
+ program does not support the -s option, you must set
+ MAIL_PROGRAM_SUBJECT_BODY to 1). If your system uses sendmail, use
+ the sendmail choice below. Otherwise, select one of the other
+ choices as appropriate. */
+#if 1
+#define MAIL_PROGRAM "/usr/sbin/sendmail -t"
+#define MAIL_PROGRAM_TO_BODY 1
+#define MAIL_PROGRAM_SUBJECT_BODY 1
+#endif
+#if 0
+#define MAIL_PROGRAM "/usr/ucb/mail"
+#define MAIL_PROGRAM_TO_BODY 0
+#define MAIL_PROGRAM_SUBJECT_BODY 0
+#endif
+#if 0
+#define MAIL_PROGRAM "/bin/mail"
+#define MAIL_PROGRAM_TO_BODY 0
+#define MAIL_PROGRAM_SUBJECT_BODY 1
+#endif
+
/* Set PS_PROGRAM to the program to run to get a process status,
including the arguments to pass it. This is used by ``uustat -p''.
Set HAVE_PS_MULTIPLE to 1 if a comma separated list of process
@@ -229,6 +273,13 @@
#define PS_PROGRAM "/bin/ps -flp"
#define HAVE_PS_MULTIPLE 1
#endif
+#ifdef __QNX__
+/* Use this for QNX, along with HAVE_QNX_LOCKFILES. */
+#undef PS_PROGRAM
+#undef HAVE_PS_MULTIPLE
+#define PS_PROGRAM "/bin/ps -l -n -p"
+#define HAVE_PS_MULTIPLE 0
+#endif
/* If you use other programs that also lock devices, such as cu or
uugetty, the other programs and UUCP must agree on whether a device
@@ -269,20 +320,91 @@
device itself, and zzz is the minor device number of the port
device.
+ Sequent DYNIX/ptx (but perhaps not Dynix 3.x) uses yet another
+ naming convention. The lock file for /dev/ttyXA/XAAP is named
+ LCK..ttyXAAP.
+
Coherent use a completely different method of terminal locking.
See unix/cohtty for details. For locks other than for terminals,
- HDB type lock files are used. */
+ HDB type lock files are used.
+
+ QNX lock files are similar to HDB lock files except that the node
+ ID must be stored in addition to the process ID and for serial
+ devices the node ID must be included in the lock file name. QNX
+ boxes are generally used in bunches, and all of them behave like
+ one big machine to some extent. Thus, processes on different
+ machines will be sharing the files in the spool directory. To
+ detect if a process has died and a lock is thus stale, you need the
+ node ID of the process as well as the process ID. The process ID
+ is stored as a number written using ASCII digits padded to 10
+ characters, followed by a space, followed by the node ID written
+ using ASCII digits padded to 10 characters, followed by a newline.
+ The format for QNX lock files was made up just for Taylor UUCP.
+ QNX doesn't come with a version of UUCP. */
#define HAVE_V2_LOCKFILES 0
#define HAVE_HDB_LOCKFILES 1
#define HAVE_SCO_LOCKFILES 0
#define HAVE_SVR4_LOCKFILES 0
+#define HAVE_SEQUENT_LOCKFILES 0
#define HAVE_COHERENT_LOCKFILES 0
+#define HAVE_QNX_LOCKFILES 0
+
+/* This tries to pick a default based on preprocessor definitions.
+ Ignore it if you have explicitly set one of the above values. */
+#if HAVE_V2_LOCKFILES + HAVE_HDB_LOCKFILES + HAVE_SCO_LOCKFILES + HAVE_SVR4_LOCKFILES + HAVE_SEQUENT_LOCKFILES + HAVE_COHERENT_LOCKFILES + HAVE_QNX_LOCKFILES == 0
+#ifdef __QNX__
+#undef HAVE_QNX_LOCKFILES
+#define HAVE_QNX_LOCKFILES 1
+#else /* ! defined (__QNX__) */
+#ifdef __COHERENT__
+#undef HAVE_COHERENT_LOCKFILES
+#define HAVE_COHERENT_LOCKFILES 1
+#else /* ! defined (__COHERENT__) */
+#ifdef _SEQUENT_
+#undef HAVE_SEQUENT_LOCKFILES
+#define HAVE_SEQUENT_LOCKFILES 1
+#else /* ! defined (_SEQUENT) */
+#ifdef sco
+#undef HAVE_SCO_LOCKFILES
+#define HAVE_SCO_LOCKFILES 1
+#else /* ! defined (sco) */
+#ifdef __svr4__
+#undef HAVE_SVR4_LOCKFILES
+#define HAVE_SVR4_LOCKFILES 1
+#else /* ! defined (__svr4__) */
+/* Final default is HDB. There's no way to tell V2 from HDB. */
+#undef HAVE_HDB_LOCKFILES
+#define HAVE_HDB_LOCKFILES 1
+#endif /* ! defined (__svr4__) */
+#endif /* ! defined (sco) */
+#endif /* ! defined (_SEQUENT) */
+#endif /* ! defined (__COHERENT__) */
+#endif /* ! defined (__QNX__) */
+#endif /* no LOCKFILES define */
/* If your system supports Internet mail addresses (which look like
user@host.domain rather than system!user), HAVE_INTERNET_MAIL
- should be set to 1. This is checked by uuxqt when sending error
- (or success, if requested) notifications to the person who
- submitted the job. */
+ should be set to 1. This is checked by uuxqt and uustat when
+ sending notifications to the person who submitted the job.
+
+ If your system does not understand addresses of the form user@host,
+ you must set HAVE_INTERNET_MAIL to 0.
+
+ If your system does not understand addresses of the form host!user,
+ which is unlikely, you must set HAVE_INTERNET_MAIL to 1.
+
+ If your system sends mail addressed to "A!B@C" to host C (i.e., it
+ parses the address as "(A!B)@C"), you must set HAVE_INTERNET_MAIL
+ to 1.
+
+ If your system sends mail addressed to "A!B@C" to host A (i.e., it
+ parses the address as "A!(B@C)"), you must set HAVE_INTERNET_MAIL
+ to 0.
+
+ Note that in general it is best to avoid addresses of the form
+ "A!B@C" because of this ambiguity of precedence. UUCP will not
+ intentionally generate addresses of this form, but it can occur in
+ certain rather complex cases. */
#define HAVE_INTERNET_MAIL 1
/* Adminstrative decisions. */
@@ -303,6 +425,16 @@
file size will be very helpful. */
#define DEBUG 2
+/* Set HAVE_ENCRYPTED_PASSWORDS to 1 if you want login passwords to be
+ encrypted before comparing them against the values in the file.
+ This only applies when uucico is run with the -l or -e switches and
+ is doing its own login prompting. Note that the passwords used are
+ from the UUCP password file, not the system /etc/passwd file. See
+ the documentation for further details. If you set this, you are
+ responsible for encrypting the passwords in the UUCP password file.
+ The function crypt will be used to do comparisons. */
+#define HAVE_ENCRYPTED_PASSWORDS 0
+
/* Set the default grade to use for a uucp command if the -g option is
not used. The grades, from highest to lowest, are 0 to 9, A to Z,
a to z. */
@@ -327,8 +459,8 @@
When looking something up (a system, a port, etc.) the new style
configuration files will be read first, followed by the V2
configuration files, followed by the HDB configuration files. */
-#define HAVE_V2_CONFIG 1
-#define HAVE_HDB_CONFIG 1
+#define HAVE_V2_CONFIG 0
+#define HAVE_HDB_CONFIG 0
/* Exactly one of the following macros must be set to 1. The exact
format of the spool directories is explained in unix/spool.c.
@@ -351,6 +483,15 @@
#define SPOOLDIR_SVR4 0
#define SPOOLDIR_TAYLOR 1
+/* The status file generated by UUCP can use either the traditional
+ HDB upper case comments or new easier to read lower case comments.
+ This affects the display of uustat -m or uustat -q. Some
+ third-party programs read these status files and expect them to be
+ in a certain format. The default is to use the traditional
+ comments when using an HDB or SVR4 spool directory, and to use
+ lower case comments otherwise. */
+#define USE_TRADITIONAL_STATUS (SPOOLDIR_HDB || SPOOLDIR_SVR4)
+
/* You must select which type of logging you want by setting exactly
one of the following to 1. These control output to the log file
and to the statistics file.
@@ -392,6 +533,27 @@
#define HAVE_V2_LOGGING 0
#define HAVE_HDB_LOGGING 0
+/* If QNX_LOG_NODE_ID is set to 1, log messages will include the QNX
+ node ID just after the process ID. This is a policy decision
+ because it changes the log file entry format, which can break other
+ programs (e.g., some of the ones in the contrib directory) which
+ expect to read the standard log file format. */
+#ifdef __QNX__
+#define QNX_LOG_NODE_ID 1
+#else
+#define QNX_LOG_NODE_ID 0
+#endif
+
+/* If LOG_DEVICE_PREFIX is 1, log messages will give the full
+ pathname of a device rather than just the final component. This is
+ important because on QNX //2/dev/ser2 refers to a different device
+ than //4/dev/ser2. */
+#ifdef __QNX__
+#define LOG_DEVICE_PREFIX 1
+#else
+#define LOG_DEVICE_PREFIX 0
+#endif
+
/* If you would like the log, debugging and statistics files to be
closed after each message, set CLOSE_LOGFILES to 1. This will
permit the log files to be easily moved. If a log file does not
@@ -403,6 +565,7 @@
/* The name of the default spool directory. If HAVE_TAYLOR_CONFIG is
set to 1, this may be overridden by the ``spool'' command in the
configuration file. */
+/* #define SPOOLDIR "/usr/spool/uucp" */
#define SPOOLDIR "/var/spool/uucp"
/* The name of the default public directory. If HAVE_TAYLOR_CONFIG is
@@ -410,6 +573,7 @@
configuration file. Also, a particular system may be given a
specific public directory by using the ``pubdir'' command in the
system file. */
+/* #define PUBDIR "/usr/spool/uucppublic" */
#define PUBDIR "/var/spool/uucppublic"
/* The default command path. This is a space separated list of
@@ -464,16 +628,19 @@
/* The default log file when using HAVE_TAYLOR_LOGGING. When using
HAVE_TAYLOR_CONFIG, this may be overridden by the ``logfile''
command in the configuration file. */
+/* #define LOGFILE "/usr/spool/uucp/Log" */
#define LOGFILE "/var/spool/uucp/Log"
/* The default statistics file when using HAVE_TAYLOR_LOGGING. When
using HAVE_TAYLOR_CONFIG, this may be overridden by the
``statfile'' command in the configuration file. */
+/* #define STATFILE "/usr/spool/uucp/Stats" */
#define STATFILE "/var/spool/uucp/Stats"
/* The default debugging file when using HAVE_TAYLOR_LOGGING. When
using HAVE_TAYLOR_CONFIG, this may be overridden by the
``debugfile'' command in the configuration file. */
+/* #define DEBUGFILE "/usr/spool/uucp/Debug" */
#define DEBUGFILE "/var/spool/uucp/Debug"
#endif /* HAVE_TAYLOR_LOGGING */
@@ -483,17 +650,17 @@
/* The default log file when using HAVE_V2_LOGGING. When using
HAVE_TAYLOR_CONFIG, this may be overridden by the ``logfile''
command in the configuration file. */
-#define LOGFILE "/var/spool/uucp/LOGFILE"
+#define LOGFILE "/usr/spool/uucp/LOGFILE"
/* The default statistics file when using HAVE_V2_LOGGING. When using
HAVE_TAYLOR_CONFIG, this may be overridden by the ``statfile''
command in the configuration file. */
-#define STATFILE "/var/spool/uucp/SYSLOG"
+#define STATFILE "/usr/spool/uucp/SYSLOG"
/* The default debugging file when using HAVE_V2_LOGGING. When using
HAVE_TAYLOR_CONFIG, this may be overridden by the ``debugfile''
command in the configuration file. */
-#define DEBUGFILE "/var/spool/uucp/DEBUG"
+#define DEBUGFILE "/usr/spool/uucp/DEBUG"
#endif /* HAVE_V2_LOGGING */
@@ -506,16 +673,16 @@
be replaced by the system name (if there is no appropriate system,
"ANY" will be used). No other '%' character may appear in the
string. */
-#define LOGFILE "/var/spool/uucp/.Log/%s/%s"
+#define LOGFILE "/usr/spool/uucp/.Log/%s/%s"
/* The default statistics file when using HAVE_HDB_LOGGING. When using
HAVE_TAYLOR_CONFIG, this may be overridden by the ``statfile''
command in the configuration file. */
-#define STATFILE "/var/spool/uucp/.Admin/xferstats"
+#define STATFILE "/usr/spool/uucp/.Admin/xferstats"
/* The default debugging file when using HAVE_HDB_LOGGING. When using
HAVE_TAYLOR_CONFIG, this may be overridden by the ``debugfile''
command in the configuration file. */
-#define DEBUGFILE "/var/spool/uucp/.Admin/audit.local"
+#define DEBUGFILE "/usr/spool/uucp/.Admin/audit.local"
#endif /* HAVE_HDB_LOGGING */
diff --git a/gnu/libexec/uucp/common_sources/prot.c b/gnu/libexec/uucp/common_sources/prot.c
index 433bf2766829..067ac1f52ff1 100644
--- a/gnu/libexec/uucp/common_sources/prot.c
+++ b/gnu/libexec/uucp/common_sources/prot.c
@@ -1,7 +1,7 @@
/* prot.c
Protocol support routines to move commands and data around.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,18 +20,19 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char prot_rcsid[] = "$Id: prot.c,v 1.1 1993/08/05 18:22:41 conklin Exp $";
+const char prot_rcsid[] = "$Id: prot.c,v 1.2 1994/05/07 18:08:51 ache Exp $";
#endif
#include <errno.h>
#include "uudefs.h"
+#include "uuconf.h"
#include "system.h"
#include "conn.h"
#include "prot.h"
@@ -76,6 +77,9 @@ fsend_data (qconn, zsend, csend, fdoread)
--crec;
}
+ if (crec == 0)
+ return fconn_write (qconn, zsend, csend);
+
csent = csend;
if (! fconn_io (qconn, zsend, &csent, abPrecbuf + iPrecend, &crec))
diff --git a/gnu/libexec/uucp/common_sources/prot.h b/gnu/libexec/uucp/common_sources/prot.h
index 4e2bb584d842..07dc6203f426 100644
--- a/gnu/libexec/uucp/common_sources/prot.h
+++ b/gnu/libexec/uucp/common_sources/prot.h
@@ -1,7 +1,7 @@
/* prot.h
Protocol header file.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
/* We need the definition of uuconf_cmdtab to declare the protocol
@@ -49,6 +49,8 @@ struct sprotocol
int ireliable;
/* The maximum number of channels this protocol can support. */
int cchans;
+ /* Whether files may be reliably restarted using this protocol. */
+ boolean frestart;
/* Protocol parameter commands. */
struct uuconf_cmdtab *qcmds;
/* A routine to start the protocol. If *pzlog is set to be
@@ -163,6 +165,7 @@ extern boolean fijstart P((struct sdaemon *qdaemon, char **pzlog,
extern struct uuconf_cmdtab asGproto_params[];
extern boolean fgstart P((struct sdaemon *qdaemon, char **pzlog));
extern boolean fbiggstart P((struct sdaemon *qdaemon, char **pzlog));
+extern boolean fvstart P((struct sdaemon *qdaemon, char **pzlog));
extern boolean fgshutdown P((struct sdaemon *qdaemon));
extern boolean fgsendcmd P((struct sdaemon *qdaemon, const char *z,
int ilocal, int iremote));
diff --git a/gnu/libexec/uucp/common_sources/sysdep.h b/gnu/libexec/uucp/common_sources/sysdep.h
index 47675ac2385d..41dcecdf9277 100644
--- a/gnu/libexec/uucp/common_sources/sysdep.h
+++ b/gnu/libexec/uucp/common_sources/sysdep.h
@@ -1,7 +1,7 @@
/* sysh.unx -*- C -*-
The header file for the UNIX system dependent routines.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#ifndef SYSH_UNX_H
@@ -34,14 +34,9 @@ struct uuconf_system;
struct sconnection;
#endif
-/* Make sure the defines do not conflict. These are in this file
- because they are Unix dependent. */
-#if HAVE_V2_LOCKFILES + HAVE_HDB_LOCKFILES + HAVE_SCO_LOCKFILES + HAVE_SVR4_LOCKFILES + HAVE_COHERENT_LOCKFILES != 1
- #error LOCKFILES define not set or duplicated
-#endif
-
-/* SCO and SVR4 lockfiles are basically just like HDB lockfiles. */
-#if HAVE_SCO_LOCKFILES || HAVE_SVR4_LOCKFILES
+/* SCO, SVR4 and Sequent lockfiles are basically just like HDB
+ lockfiles. */
+#if HAVE_SCO_LOCKFILES || HAVE_SVR4_LOCKFILES || HAVE_SEQUENT_LOCKFILES
#undef HAVE_HDB_LOCKFILES
#define HAVE_HDB_LOCKFILES 1
#endif
@@ -230,6 +225,9 @@ typedef struct termios sterminal;
failed. */
#define PRESERVEDIR ".Preserve"
+/* The name of the directory to which we move corrupt files. */
+#define CORRUPTDIR ".Corrupt"
+
/* The length of the sequence number used in a file name. */
#define CSEQLEN (4)
@@ -284,6 +282,10 @@ typedef struct termios sterminal;
#define S_IXOTH 0001
#endif
+#if STAT_MACROS_BROKEN
+#undef S_ISDIR
+#endif
+
#ifndef S_ISDIR
#ifdef S_IFDIR
#define S_ISDIR(i) (((i) & S_IFMT) == S_IFDIR)
@@ -351,12 +353,16 @@ struct ssysdep_conn
{
/* File descriptor. */
int o;
+ /* File descriptor to read from (used by stdin and pipe port types). */
+ int ord;
+ /* File descriptor to write to (used by stdin and pipe port types). */
+ int owr;
/* Device name. */
char *zdevice;
/* File status flags. */
int iflags;
- /* File status flags for descriptor 1 (-1 if not standard input). */
- int istdout_flags;
+ /* File status flags for write descriptor (-1 if not used). */
+ int iwr_flags;
/* Hold the real descriptor when using a dialer device. */
int ohold;
/* TRUE if this is a terminal and the remaining fields are valid. */
@@ -369,6 +375,9 @@ struct ssysdep_conn
sterminal sorig;
/* Current terminal settings. */
sterminal snew;
+ /* Process ID of currently executing pipe command, or parent process
+ of forked TCP or TLI server, or -1. */
+ pid_t ipid;
#if HAVE_COHERENT_LOCKFILES
/* On Coherent we need to hold on to the real port name which will
be used to enable the port. Ick. */
@@ -428,6 +437,19 @@ extern FILE *espopen P((const char **pazargs, boolean frd,
prototype. */
extern int ixswait P((unsigned long ipid, const char *zreport));
+/* Read from a connection using two file descriptors. */
+extern boolean fsdouble_read P((struct sconnection *qconn, char *zbuf,
+ size_t *pclen, size_t cmin, int ctimeout,
+ boolean freport));
+
+/* Write to a connection using two file descriptors. */
+extern boolean fsdouble_write P((struct sconnection *qconn,
+ const char *zbuf, size_t clen));
+
+/* Run a chat program on a connection using two file descriptors. */
+extern boolean fsdouble_chat P((struct sconnection *qconn,
+ char **pzprog));
+
/* Find a spool file in the spool directory. For a local file, the
bgrade argument is the grade of the file. This is needed for
SPOOLDIR_SVR4. */
@@ -435,7 +457,7 @@ extern char *zsfind_file P((const char *zsimple, const char *zsystem,
int bgrade));
/* Return the grade given a sequence number. */
-extern char bsgrade P((pointer pseq));
+extern int bsgrade P((pointer pseq));
/* Lock a string. */
extern boolean fsdo_lock P((const char *, boolean fspooldir,
@@ -493,7 +515,7 @@ extern int dup2 P((int oold, int onew));
#if ! HAVE_FTW
extern int ftw P((const char *zdir,
int (*pfn) P((const char *zfile,
- const struct stat *qstat,
+ struct stat *qstat,
int iflag)),
int cdescriptors));
#endif
diff --git a/gnu/libexec/uucp/common_sources/system.h b/gnu/libexec/uucp/common_sources/system.h
index aa9d2a41a45a..9765edf17a49 100644
--- a/gnu/libexec/uucp/common_sources/system.h
+++ b/gnu/libexec/uucp/common_sources/system.h
@@ -2,7 +2,7 @@
Header file for system dependent stuff in the Taylor UUCP package.
This file is not itself system dependent.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -21,7 +21,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#ifndef SYSTEM_H
@@ -73,6 +73,11 @@ extern size_t cSysdep_max_name_len;
means, on Unix, this program is normally installed setuid. */
#define INIT_SUID (04)
+/* Do not close all open descriptors. This is not used by the UUCP
+ code, but it is used by other programs which share some of the
+ system dependent libraries. */
+#define INIT_NOCLOSE (010)
+
extern void usysdep_initialize P((pointer puuconf, int iflags));
/* Exit the program. The fsuccess argument indicates whether to
@@ -172,9 +177,13 @@ extern const char *zsysdep_port_name P((boolean *pftcp_port));
desirable on other systems. This should always return an absolute
path name, probably in the public directory. It should return NULL
on error; otherwise the return value should be allocated using
- zbufcpy or zbufalc. */
+ zbufcpy or zbufalc. If pfbadname is not NULL, then if the function
+ returns NULL *pfbadname should be set to TRUE if the error is just
+ that the file name is badly specified; *pfbadname should be set to
+ FALSE for some sort of internal error. */
extern char *zsysdep_local_file P((const char *zname,
- const char *zpubdir));
+ const char *zpubdir,
+ boolean *pfbadname));
/* Return whether a file name is in a directory, and check for read or
write access. This should check whether zfile is within zdir (or
@@ -201,17 +210,16 @@ extern boolean fsysdep_in_directory P((const char *zfile,
return error. */
extern boolean fsysdep_file_exists P((const char *zfile));
-/* Start up a program. The code expects fsysdep_run to return after
- doing a fork, but at least for now everything will work fine if it
- does not (on a system which does not support forking). The three
- string arguments may be catenated together to form the program to
- execute; I did it this way to make it easy to call execl(2), and
- because I never needed more than two arguments. The program will
- always be "uucico" or "uuxqt". The return value will be passed
- directly to usysdep_exit, and should be TRUE on success, FALSE on
+/* Start up a program. If the ffork argument is true, this should
+ spawn a new process and return. If the ffork argument is false,
+ this may either return or not. The three string arguments may be
+ catenated together to form the program to execute; I did it this
+ way to make it easy to call execl(2), and because I never needed
+ more than two arguments. The program will always be "uucico" or
+ "uuxqt". The return value should be TRUE on success, FALSE on
error. */
-extern boolean fsysdep_run P((const char *zprogram, const char *zarg1,
- const char *zarg2));
+extern boolean fsysdep_run P((boolean ffork, const char *zprogram,
+ const char *zarg1, const char *zarg2));
/* Send a mail message. This function will be passed an array of
strings. All necessary newlines are already included; the strings
@@ -329,6 +337,12 @@ extern boolean fsysdep_did_work P((pointer pseq));
the file. */
extern const char *zsysdep_save_temp_file P((pointer pseq));
+/* Save a file in a location used to hold corrupt files. This is
+ called if a bad execution file is found by uuxqt. This should
+ return the new name of the file (allocated by zbufalc), or NULL if
+ the move failed (in which the original file should remain). */
+extern char *zsysdep_save_corrupt_file P((const char *zfile));
+
/* Cleanup anything left over by fsysdep_get_work_init and
fsysdep_get_work. This may be called even though
fsysdep_get_work_init has not been. */
@@ -397,23 +411,27 @@ extern openfile_t esysdep_open_send P((const struct uuconf_system *qsys,
/* Return a temporary file name to receive into. This file will be
opened by esysdep_open_receive. The qsys argument is the system
the file is coming from, the zto argument is the name the file will
- have after it has been fully received, and the ztemp argument, if
- it is not NULL, is from the command sent by the remote system. The
- return value must be freed using ubuffree. The function should
- return NULL on error. */
+ have after it has been fully received, the ztemp argument, if it is
+ not NULL, is from the command sent by the remote system, and the
+ frestart argument is TRUE if the protocol and remote system permit
+ file transfers to be restarted. The return value must be freed
+ using ubuffree. The function should return NULL on error. */
extern char *zsysdep_receive_temp P((const struct uuconf_system *qsys,
const char *zfile,
- const char *ztemp));
+ const char *ztemp,
+ boolean frestart));
/* Open a file to receive from another system. The zreceive argument
is the return value of zsysdep_receive_temp with the same qsys,
zfile and ztemp arguments. If the function can determine that this
file has already been partially received, it should set *pcrestart
to the number of bytes that have been received. If the file has
- not been partially received, *pcrestart should be set to -1. The
- function should return EFILECLOSED on error. After the file is
- written, fsysdep_move_file will be called to move the file to its
- final destination, and to set the correct file mode. */
+ not been partially received, *pcrestart should be set to -1.
+ pcrestart will be passed in as NULL if file restart is not
+ supported by the protocol or the remote system. The function
+ should return EFILECLOSED on error. After the file is written,
+ fsysdep_move_file will be called to move the file to its final
+ destination, and to set the correct file mode. */
extern openfile_t esysdep_open_receive P((const struct uuconf_system *qsys,
const char *zto,
const char *ztemp,
@@ -428,8 +446,8 @@ extern openfile_t esysdep_open_receive P((const struct uuconf_system *qsys,
this should make sure the directory is writeable by the user zuser
(if zuser is NULL, then it must be writeable by any user); this is
to avoid a window of vulnerability between fsysdep_in_directory and
- fsysdep_move_file. This function should return FALSE on error; the
- zorig file should be removed even if an error occurs. */
+ fsysdep_move_file. This function should return FALSE on error, in
+ which case the zorig file should still exist. */
extern boolean fsysdep_move_file P((const char *zorig, const char *zto,
boolean fmkdirs, boolean fpublic,
boolean fcheck, const char *zuser));
@@ -675,7 +693,8 @@ extern boolean fsysdep_move_uuxqt_files P((int cfiles,
started in rather than in the public directory. This should return
NULL on error. */
extern char *zsysdep_local_file_cwd P((const char *zname,
- const char *zpubdir));
+ const char *zpubdir,
+ boolean *pfbadname));
/* Add the working directory to a file name. The named file is
actually on a remote system. If the file already has a directory,
@@ -748,9 +767,11 @@ extern boolean usysdep_walk_tree P((const char *zdir,
extern char *zsysdep_jobid P((const struct uuconf_system *qsys,
pointer pseq));
-/* See whether the current user is permitted to kill jobs submitted by
- another user. This should return TRUE if permission is granted,
- FALSE otherwise. */
+/* See whether the current user is privileged. Privileged users are
+ permitted to kill jobs submitted by another user, and they are
+ permitted to use the -u argument to uucico; other uses of this call
+ may be added later. This should return TRUE if permission is
+ granted, FALSE otherwise. */
extern boolean fsysdep_privileged P((void));
/* Kill a job, given the jobid. This should remove all associated
@@ -778,6 +799,11 @@ extern long ixsysdep_work_time P((const struct uuconf_system *qsys,
value must use the same epoch as ixsysdep_time. */
extern long ixsysdep_file_time P((const char *zfile));
+/* Touch a file to make it appear as though it was created at the
+ current time. This is called by uustat on execution files. On
+ error this should log an error message and return FALSE. */
+extern boolean fsysdep_touch_file P((const char *zfile));
+
/* Get the size in bytes of a file. If this file does not exist, this
should not give an error message, but should return -1. If some
other error occurs, this should return -2. */
@@ -942,7 +968,8 @@ extern boolean fsysdep_uupick_free P((const char *zsystem,
zsysdep_local_file_cwd except that a file beginning with ~/ is
placed in the user's home directory rather than in the public
directory. */
-extern char *zsysdep_uupick_local_file P((const char *zfile));
+extern char *zsysdep_uupick_local_file P((const char *zfile,
+ boolean *pfbadname));
/* Remove a directory and all the files in it. */
extern boolean fsysdep_rmdir P((const char *zdir));
diff --git a/gnu/libexec/uucp/common_sources/tcp.c b/gnu/libexec/uucp/common_sources/tcp.c
index 543e9f0d8205..6c06eb639ab4 100644
--- a/gnu/libexec/uucp/common_sources/tcp.c
+++ b/gnu/libexec/uucp/common_sources/tcp.c
@@ -1,7 +1,7 @@
/* tcp.c
Code to handle TCP connections.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,13 +20,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char tcp_rcsid[] = "$Id: tcp.c,v 1.1 1993/08/05 18:22:46 conklin Exp $";
+const char tcp_rcsid[] = "$Id: tcp.c,v 1.2 1994/05/07 18:09:01 ache Exp $";
#endif
#if HAVE_TCP
@@ -72,7 +72,6 @@ static boolean ftcp_close P((struct sconnection *qconn,
pointer puuconf,
struct uuconf_dialer *qdialer,
boolean fsuccess));
-static boolean ftcp_reset P((struct sconnection *qconn));
static boolean ftcp_dial P((struct sconnection *qconn, pointer puuconf,
const struct uuconf_system *qsys,
const char *zphone,
@@ -88,7 +87,6 @@ static const struct sconncmds stcpcmds =
NULL, /* pfunlock */
ftcp_open,
ftcp_close,
- ftcp_reset,
ftcp_dial,
fsysdep_conn_read,
fsysdep_conn_write,
@@ -110,9 +108,11 @@ fsysdep_tcp_init (qconn)
q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn));
q->o = -1;
+ q->ord = -1;
+ q->owr = -1;
q->zdevice = NULL;
q->iflags = -1;
- q->istdout_flags = -1;
+ q->iwr_flags = -1;
q->fterminal = FALSE;
q->ftli = FALSE;
q->ibaud = 0;
@@ -175,6 +175,10 @@ ftcp_open (qconn, ibaud, fwait)
return FALSE;
}
+ /* We save our process ID in the qconn structure. This is checked
+ in ftcp_close. */
+ qsysdep->ipid = getpid ();
+
/* If we aren't waiting for a connection, we're done. */
if (! fwait)
return TRUE;
@@ -347,23 +351,16 @@ ftcp_close (qconn, puuconf, qdialer, fsuccess)
fret = FALSE;
}
qsysdep->o = -1;
- return fret;
-}
-
-/* Reset the port. This will be called by a child which was forked
- off in ftcp_open, above. We don't want uucico to continue looping
- and giving login prompts, so we pretend that we received a SIGINT
- signal. This should probably be handled more cleanly. The signal
- will not be recorded in the log file because we don't set
- afLog_signal[INDEXSIG_SIGINT]. */
-/*ARGSUSED*/
-static boolean
-ftcp_reset (qconn)
- struct sconnection *qconn;
-{
- afSignal[INDEXSIG_SIGINT] = TRUE;
- return TRUE;
+ /* If the current pid is not the one we used to open the port, then
+ we must have forked up above and we are now the child. In this
+ case, we are being called from within the fendless loop in
+ uucico.c. We return FALSE to force the loop to end and the child
+ to exit. This should be handled in a cleaner fashion. */
+ if (qsysdep->ipid != getpid ())
+ fret = FALSE;
+
+ return fret;
}
/* Dial out on a TCP port, so to speak: connect to a remote computer. */
@@ -383,6 +380,7 @@ ftcp_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer)
struct hostent *q;
struct sockaddr_in s;
const char *zport;
+ char **pzdialer;
qsysdep = (struct ssysdep_conn *) qconn->psysdep;
@@ -411,9 +409,9 @@ ftcp_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer)
}
s.sin_family = q->h_addrtype;
+ memcpy (&s.sin_addr.s_addr, q->h_addr, (size_t) q->h_length);
zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;
s.sin_port = itcp_port_number (zport);
- memcpy (&s.sin_addr.s_addr, q->h_addr, (size_t) q->h_length);
if (connect (qsysdep->o, (struct sockaddr *) &s, sizeof s) < 0)
{
@@ -421,6 +419,15 @@ ftcp_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer)
return FALSE;
}
+ /* Handle the dialer sequence, if any. */
+ pzdialer = qconn->qport->uuconf_u.uuconf_stcp.uuconf_pzdialer;
+ if (pzdialer != NULL && *pzdialer != NULL)
+ {
+ if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
+ qdialer, ptdialer))
+ return FALSE;
+ }
+
return TRUE;
}
diff --git a/gnu/libexec/uucp/common_sources/tli.c b/gnu/libexec/uucp/common_sources/tli.c
index 9fffdcdfebd1..0b2ab5489fb1 100644
--- a/gnu/libexec/uucp/common_sources/tli.c
+++ b/gnu/libexec/uucp/common_sources/tli.c
@@ -1,7 +1,7 @@
/* tli.c
Code to handle TLI connections.
- Copyright (C) 1992 Ian Lance Taylor
+ Copyright (C) 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,13 +20,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char tli_rcsid[] = "$Id: tli.c,v 1.1 1993/08/05 18:22:46 conklin Exp $";
+const char tli_rcsid[] = "$Id: tli.c,v 1.2 1994/05/07 18:09:03 ache Exp $";
#endif
#if HAVE_TLI
@@ -92,9 +92,11 @@ extern int t_errno;
extern char *t_errlist[];
extern int t_nerr;
+#ifndef HAVE_TIUSER_H
#ifndef t_alloc
extern pointer t_alloc ();
#endif
+#endif
/* This code handles TLI connections. It's Unix specific. It's
largely based on code from Unix Network Programming, by W. Richard
@@ -110,7 +112,6 @@ static boolean ftli_close P((struct sconnection *qconn,
pointer puuconf,
struct uuconf_dialer *qdialer,
boolean fsuccess));
-static boolean ftli_reset P((struct sconnection *qconn));
static boolean ftli_dial P((struct sconnection *qconn, pointer puuconf,
const struct uuconf_system *qsys,
const char *zphone,
@@ -125,7 +126,6 @@ static const struct sconncmds stlicmds =
NULL, /* pfunlock */
ftli_open,
ftli_close,
- ftli_reset,
ftli_dial,
fsysdep_conn_read,
fsysdep_conn_write,
@@ -149,7 +149,8 @@ ztlierror ()
return t_errlist[t_errno];
}
-/* Initialize a TLI connection. */
+/* Initialize a TLI connection. This may be called with qconn->qport
+ NULL, when opening standard input as a TLI connection. */
boolean
fsysdep_tli_init (qconn)
@@ -159,9 +160,11 @@ fsysdep_tli_init (qconn)
q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn));
q->o = -1;
+ q->ord = -1;
+ q->owr = -1;
q->zdevice = NULL;
q->iflags = -1;
- q->istdout_flags = -1;
+ q->iwr_flags = -1;
q->fterminal = FALSE;
q->ftli = TRUE;
q->ibaud = 0;
@@ -295,6 +298,10 @@ ftli_open (qconn, ibaud, fwait)
return FALSE;
}
+ /* We save our process ID in the qconn structure. This is checked
+ in ftli_close. */
+ qsysdep->ipid = getpid ();
+
/* If we aren't waiting for a connection, we can bind to any local
address, and then we're finished. */
if (! fwait)
@@ -463,23 +470,15 @@ ftli_close (qconn, puuconf, qdialer, fsuccess)
qsysdep->o = -1;
}
- return fret;
-}
-
-/* Reset the port. This will be called by a child which was forked
- off in ftli_open, above. We don't want uucico to continue looping
- and giving login prompts, so we pretend that we received a SIGINT
- signal. This should probably be handled more cleanly. The signal
- will not be recorded in the log file because we don't set
- afLog_signal[INDEXSIG_SIGINT]. */
+ /* If the current pid is not the one we used to open the port, then
+ we must have forked up above and we are now the child. In this
+ case, we are being called from within the fendless loop in
+ uucico.c. We return FALSE to force the loop to end and the child
+ to exit. This should be handled in a cleaner fashion. */
+ if (qsysdep->ipid != getpid ())
+ fret = FALSE;
-/*ARGSUSED*/
-static boolean
-ftli_reset (qconn)
- struct sconnection *qconn;
-{
- afSignal[INDEXSIG_SIGINT] = TRUE;
- return TRUE;
+ return fret;
}
/* Dial out on a TLI port, so to speak: connect to a remote computer. */
@@ -569,73 +568,12 @@ ftli_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
if (! ftli_push (qconn))
return FALSE;
- /* Handle the rest of the dialer sequence. This is similar to
- fmodem_dial, and they should, perhaps, be combined somehow. */
- if (pzdialer != NULL)
+ /* Handle the rest of the dialer sequence. */
+ if (pzdialer != NULL && *pzdialer != NULL)
{
- boolean ffirst;
-
- ffirst = TRUE;
- while (*pzdialer != NULL)
- {
- int iuuconf;
- struct uuconf_dialer *q;
- struct uuconf_dialer s;
- const char *ztoken;
- boolean ftranslate;
-
- if (! ffirst)
- q = &s;
- else
- q = qdialer;
-
- iuuconf = uuconf_dialer_info (puuconf, *pzdialer, q);
- if (iuuconf == UUCONF_NOT_FOUND)
- {
- ulog (LOG_ERROR, "%s: Dialer not found", *pzdialer);
- return FALSE;
- }
- else if (iuuconf != UUCONF_SUCCESS)
- {
- ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
- return FALSE;
- }
-
- ++pzdialer;
- ztoken = *pzdialer;
-
- ftranslate = FALSE;
- if (ztoken == NULL
- || strcmp (ztoken, "\\D") == 0)
- ztoken = zphone;
- else if (strcmp (ztoken, "\\T") == 0)
- {
- ztoken = zphone;
- ftranslate = TRUE;
- }
-
- if (! fchat (qconn, puuconf, &q->uuconf_schat,
- (const struct uuconf_system *) NULL, q,
- zphone, ftranslate, qconn->qport->uuconf_zname,
- (long) 0))
- {
- (void) uuconf_dialer_free (puuconf, q);
- if (! ffirst)
- (void) uuconf_dialer_free (puuconf, qdialer);
- return FALSE;
- }
-
- if (ffirst)
- {
- *ptdialerfound = DIALERFOUND_FREE;
- ffirst = FALSE;
- }
- else
- (void) uuconf_dialer_free (puuconf, q);
-
- if (*pzdialer != NULL)
- ++pzdialer;
- }
+ if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
+ qdialer, ptdialerfound))
+ return FALSE;
}
return TRUE;
diff --git a/gnu/libexec/uucp/common_sources/trans.h b/gnu/libexec/uucp/common_sources/trans.h
index 79c380ea48d8..93aee2e9ac8f 100644
--- a/gnu/libexec/uucp/common_sources/trans.h
+++ b/gnu/libexec/uucp/common_sources/trans.h
@@ -1,7 +1,7 @@
/* trans.h
Header file for file and command transfer routines.
- Copyright (C) 1992 Ian Lance Taylor
+ Copyright (C) 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
/* The maximum possible number of channels. */
@@ -56,6 +56,10 @@ struct sdaemon
{
/* Global uuconf pointer. */
pointer puuconf;
+ /* Configuration file name argument (from -I option). */
+ const char *zconfig;
+ /* How often to spawn uuxqt (from uuconf_runuuxqt). */
+ int irunuuxqt;
/* Remote system information. */
const struct uuconf_system *qsys;
/* Local name being used. */
@@ -64,6 +68,8 @@ struct sdaemon
struct sconnection *qconn;
/* Protocol being used. */
const struct sprotocol *qproto;
+ /* Number of channels being used. */
+ int cchans;
/* The largest file size permitted for a local request. */
long clocal_size;
/* The largest file size permitted for a remote request. */
@@ -72,6 +78,13 @@ struct sdaemon
long cmax_ever;
/* The remote system ulimit. */
long cmax_receive;
+ /* Number of bytes sent. */
+ long csent;
+ /* Number of bytes received. */
+ long creceived;
+ /* Number of execution files received since the last time we spawned
+ uuxqt. */
+ long cxfiles_received;
/* Features supported by the remote side. */
int ifeatures;
/* TRUE if we should request the remote side to hang up. */
@@ -266,3 +279,10 @@ extern void usent_receive_ack P((struct sdaemon *qdaemon,
lost. */
extern void uwindow_acked P((struct sdaemon *qdaemon,
boolean fallacked));
+
+/* Spawn a uuxqt process. The ffork argument is passed to
+ fsysdep_run. If the zsys argument is not NULL, then -s zsys is
+ passed to uuxqt. The zconfig argument is the name of the
+ configuration file, from the -I option. */
+extern boolean fspawn_uuxqt P((boolean ffork, const char *zsys,
+ const char *zconfig));
diff --git a/gnu/libexec/uucp/common_sources/util.c b/gnu/libexec/uucp/common_sources/util.c
index 89b3caf1d446..2534665a4d1e 100644
--- a/gnu/libexec/uucp/common_sources/util.c
+++ b/gnu/libexec/uucp/common_sources/util.c
@@ -1,7 +1,7 @@
/* util.c
A couple of UUCP utility functions.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,13 +20,13 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#include "uucp.h"
#if USE_RCS_ID
-const char util_rcsid[] = "$Id: util.c,v 1.1 1993/08/05 18:22:48 conklin Exp $";
+const char util_rcsid[] = "$Id: util.c,v 1.2 1994/05/07 18:09:07 ache Exp $";
#endif
#include <ctype.h>
@@ -95,6 +95,46 @@ funknown_system (puuconf, zsystem, qsys)
return TRUE;
}
+/* Remove all occurrences of the local system name followed by an
+ exclamation point from the front of a string, returning the new
+ string. This is used by uucp and uux. */
+
+char *
+zremove_local_sys (qlocalsys, z)
+ struct uuconf_system *qlocalsys;
+ char *z;
+{
+ size_t clen;
+ char *zexclam;
+
+ clen = strlen (qlocalsys->uuconf_zname);
+ zexclam = strchr (z, '!');
+ while (zexclam != NULL)
+ {
+ if (z == zexclam
+ || (zexclam - z == clen
+ && strncmp (z, qlocalsys->uuconf_zname, clen) == 0))
+ ;
+ else if (qlocalsys->uuconf_pzalias == NULL)
+ break;
+ else
+ {
+ char **pzal;
+
+ for (pzal = qlocalsys->uuconf_pzalias; *pzal != NULL; pzal++)
+ if (strlen (*pzal) == zexclam - z
+ && strncmp (z, *pzal, (size_t) (zexclam - z)) == 0)
+ break;
+ if (*pzal == NULL)
+ break;
+ }
+ z = zexclam + 1;
+ zexclam = strchr (z, '!');
+ }
+
+ return z;
+}
+
/* See whether a file is in a directory list, and make sure the user
has appropriate access. */
@@ -118,7 +158,7 @@ fin_directory_list (zfile, pzdirs, zpubdir, fcheck, freadable, zuser)
if (pz[0][0] == '!')
{
- zuse = zsysdep_local_file (*pz + 1, zpubdir);
+ zuse = zsysdep_local_file (*pz + 1, zpubdir, (boolean *) NULL);
if (zuse == NULL)
return FALSE;
@@ -128,7 +168,7 @@ fin_directory_list (zfile, pzdirs, zpubdir, fcheck, freadable, zuser)
}
else
{
- zuse = zsysdep_local_file (*pz, zpubdir);
+ zuse = zsysdep_local_file (*pz, zpubdir, (boolean *) NULL);
if (zuse == NULL)
return FALSE;
diff --git a/gnu/libexec/uucp/common_sources/uuconf.h b/gnu/libexec/uucp/common_sources/uuconf.h
index 4bf6bccbf3f2..1710568d499a 100644
--- a/gnu/libexec/uucp/common_sources/uuconf.h
+++ b/gnu/libexec/uucp/common_sources/uuconf.h
@@ -1,7 +1,7 @@
/* uuconf.h
Header file for UUCP configuration routines.
- Copyright (C) 1992 Ian Lance Taylor
+ Copyright (C) 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP uuconf library.
@@ -26,7 +26,7 @@
informative, and does not modify the License in any way).
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#ifndef UUCONF_H
@@ -348,7 +348,9 @@ enum uuconf_porttype
/* A TCP port. Not supported on all systems. */
UUCONF_PORTTYPE_TCP,
/* A TLI port. Not supported on all systems. */
- UUCONF_PORTTYPE_TLI
+ UUCONF_PORTTYPE_TLI,
+ /* A pipe port. Not supported on all systems. */
+ UUCONF_PORTTYPE_PIPE
};
/* Additional information for a stdin port (there is none). */
@@ -377,6 +379,8 @@ struct uuconf_modem_port
long uuconf_ihighbaud;
/* Non-zero if the port supports carrier detect. */
int uuconf_fcarrier;
+ /* Non-zero if the port supports hardware flow control. */
+ int uuconf_fhardflow;
/* A NULL terminated sequence of dialer/token pairs (element 0 is a
dialer name, element 1 is a token, etc.) May be NULL, in which
case qdialer should not be NULL. */
@@ -394,6 +398,10 @@ struct uuconf_direct_port
char *uuconf_zdevice;
/* The baud rate (speed). */
long uuconf_ibaud;
+ /* Non-zero if the port uses carrier detect. */
+ int uuconf_fcarrier;
+ /* Non-zero if the port supports hardware flow control. */
+ int uuconf_fhardflow;
};
/* Additional information for a TCP port. */
@@ -403,6 +411,9 @@ struct uuconf_tcp_port
/* The TCP port number to use. May be a name or a number. May be
NULL, in which case "uucp" is looked up using getservbyname. */
char *uuconf_zport;
+ /* A NULL terminated sequence of dialer/token pairs (element 0 is a
+ dialer name, element 1 is a token, etc.) May be NULL. */
+ char **uuconf_pzdialer;
};
/* Additional information for a TLI port. */
@@ -431,6 +442,14 @@ struct uuconf_tli_port
char *uuconf_zservaddr;
};
+/* Additional information for a pipe port. */
+
+struct uuconf_pipe_port
+{
+ /* The command and its arguments. */
+ char **uuconf_pzcmd;
+};
+
/* Information kept for a port. */
struct uuconf_port
@@ -460,6 +479,7 @@ struct uuconf_port
struct uuconf_direct_port uuconf_sdirect;
struct uuconf_tcp_port uuconf_stcp;
struct uuconf_tli_port uuconf_stli;
+ struct uuconf_pipe_port uuconf_spipe;
} uuconf_u;
};
@@ -545,6 +565,13 @@ struct uuconf_dialer
be b1 - b2. */
#define UUCONF_GRADE_CMP(b1, b2) (uuconf_grade_cmp ((b1), (b2)))
+/* uuconf_runuuxqt returns either a positive number (the number of
+ execution files to receive between uuxqt invocations) or one of
+ these constant values. */
+#define UUCONF_RUNUUXQT_NEVER (0)
+#define UUCONF_RUNUUXQT_ONCE (-1)
+#define UUCONF_RUNUUXQT_PERCALL (-2)
+
/* Most of the uuconf functions returns an error code. A value of
zero (UUCONF_SUCCESS) indicates success. */
@@ -849,15 +876,29 @@ extern int uuconf_debuglevel (void *uuconf_pglobal,
extern int uuconf_maxuuxqts (void *uuconf_pglobal,
int *uuconf_pcmaxuuxqt);
+/* Get the frequency with which to spawn a uuxqt process. This
+ returns an integer. A positive number is the number of execution
+ files that should be received between spawns. Other values are one
+ of the UUCONF_RUNUUXQT constants listed above. */
+extern int uuconf_runuuxqt (void *uuconf_pglobal,
+ int *uuconf_pirunuuxqt);
+
/* Check a login name and password. This checks the Taylor UUCP
password file (not /etc/passwd). It will work even if
- uuconf_taylor_init was not called. If the login name exists and
- the password is correct, this returns UUCONF_SUCCESS. If the login
- does not exist, or the password is wrong, this returns
- UUCONF_NOT_FOUND. Other errors are also possible. */
+ uuconf_taylor_init was not called. All comparisons are done via a
+ callback function. The first argument to the function will be zero
+ when comparing login names, non-zero when comparing passwords. The
+ second argument to the function will be the pinfo argument passed
+ to uuconf_callin. The third argument will be the login name or
+ password from the UUCP password file. The comparison function
+ should return non-zero for a match, or zero for a non-match. If
+ the login name is found and the password compares correctly,
+ uuconf_callin will return UUCONF_SUCCESS. If the login is not
+ found, or the password does not compare correctly, uuconf_callin
+ will return UUCONF_NOT_FOUND. Other errors are also possible. */
extern int uuconf_callin (void *uuconf_pglobal,
- const char *uuconf_zlogin,
- const char *uuconf_zpassword);
+ int (*uuconf_cmp) (int, void *, const char *),
+ void *uuconf_pinfo);
/* Get the callout login name and password for a system. This will
set both *pzlog and *pzpass to a string allocated by malloc, or to
@@ -922,6 +963,7 @@ extern int uuconf_statsfile ();
extern int uuconf_debugfile ();
extern int uuconf_debuglevel ();
extern int uuconf_maxuuxqts ();
+extern int uuconf_runuuxqt ();
extern int uuconf_callin ();
extern int uuconf_callout ();
extern int uuconf_remote_unknown ();
diff --git a/gnu/libexec/uucp/common_sources/uucp.h b/gnu/libexec/uucp/common_sources/uucp.h
index 8df3ec4c3e79..5faa63c120b6 100644
--- a/gnu/libexec/uucp/common_sources/uucp.h
+++ b/gnu/libexec/uucp/common_sources/uucp.h
@@ -1,7 +1,7 @@
/* uucp.h
Header file for the UUCP package.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,11 +20,11 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
/* Get the system configuration parameters. */
-#include "conf.h"
+#include "config.h"
#include "policy.h"
/* Get a definition for ANSI_C if we weren't given one. */
@@ -41,11 +41,11 @@
/* We always include some standard header files. We need <signal.h>
to define sig_atomic_t. */
+#include <stdio.h>
+#include <signal.h>
#if HAVE_STDDEF_H
#include <stddef.h>
#endif
-#include <stdio.h>
-#include <signal.h>
/* On some systems we need <sys/types.h> to get sig_atomic_t or
size_t or time_t. */
@@ -103,21 +103,24 @@ typedef long time_t;
constpointer -- for a generic pointer to constant data.
BUCHAR -- to convert a character to unsigned. */
#if ANSI_C
-#if ! HAVE_VOID || ! HAVE_UNSIGNED_CHAR
- #error ANSI C compiler without void or unsigned char
+#if ! HAVE_VOID || ! HAVE_UNSIGNED_CHAR || ! HAVE_PROTOTYPES
+ #error ANSI C compiler without void or unsigned char or prototypes
#endif
#define P(x) x
typedef void *pointer;
typedef const void *constpointer;
#define BUCHAR(b) ((unsigned char) (b))
#else /* ! ANSI_C */
-/* Handle uses of const, volatile and void in Classic C. */
-#define const
+/* Handle uses of volatile and void in Classic C. */
#define volatile
#if ! HAVE_VOID
#define void int
#endif
+#if HAVE_PROTOTYPES
+#define P(x) x
+#else
#define P(x) ()
+#endif
typedef char *pointer;
typedef const char *constpointer;
#if HAVE_UNSIGNED_CHAR
@@ -169,6 +172,7 @@ extern pointer memcpy (), memchr ();
#else /* ! HAVE_STDLIB_H */
extern pointer malloc (), realloc (), bsearch ();
extern long strtol ();
+extern unsigned long strtoul ();
extern char *getenv ();
#endif /* ! HAVE_STDLIB_H */
@@ -225,6 +229,11 @@ typedef FILE *openfile_t;
#define ffileseek(e, i) (fseek ((e), (long) (i), 0) == 0)
#define ffilerewind(e) (fseek ((e), (long) 0, 0) == 0)
#endif
+#ifdef SEEK_END
+#define ffileseekend(e) (fseek ((e), (long) 0, SEEK_END) == 0)
+#else
+#define ffileseekend(e) (fseek ((e), (long) 0, 2) == 0)
+#endif
#define ffileclose(e) (fclose (e) == 0)
#else /* ! USE_STDIO */
@@ -247,6 +256,11 @@ typedef int openfile_t;
#define ffileseek(e, i) (lseek ((e), (long) i, 0) >= 0)
#define ffilerewind(e) (lseek ((e), (long) 0, 0) >= 0)
#endif
+#ifdef SEEK_END
+#define ffileseekend(e) (lseek ((e), (long) 0, SEEK_END) >= 0)
+#else
+#define ffileseekend(e) (lseek ((e), (long) 0, 2) >= 0)
+#endif
#define ffileclose(e) (close (e) >= 0)
#endif /* ! USE_STDIO */
@@ -359,6 +373,11 @@ extern char *strrchr P((const char *z, int b));
extern long strtol P((const char *, char **, int));
#endif
+/* Turn a string into a long unsigned integer. */
+#if ! HAVE_STRTOUL
+extern unsigned long strtoul P((const char *, char **, int));
+#endif
+
/* Lookup a key in a sorted array. */
#if ! HAVE_BSEARCH
extern pointer bsearch P((constpointer pkey, constpointer parray,
diff --git a/gnu/libexec/uucp/common_sources/uudefs.h b/gnu/libexec/uucp/common_sources/uudefs.h
index 47d2c89896ef..f957ee636c16 100644
--- a/gnu/libexec/uucp/common_sources/uudefs.h
+++ b/gnu/libexec/uucp/common_sources/uudefs.h
@@ -1,7 +1,7 @@
/* uudefs.h
Miscellaneous definitions for the UUCP package.
- Copyright (C) 1991, 1992 Ian Lance Taylor
+ Copyright (C) 1991, 1992, 1993 Ian Lance Taylor
This file is part of the Taylor UUCP package.
@@ -20,7 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
- c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
+ c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139.
*/
#if ANSI_C
@@ -106,8 +106,8 @@ struct scmd
simple execution, 'H' for hangup, 'Y' for hangup confirm, 'N' for
hangup deny). */
char bcmd;
- /* At least one compiler needs an explicit padding byte here. */
- char bdummy;
+ /* Grade of the command ('\0' if from remote system). */
+ char bgrade;
/* Sequence handle for fsysdep_did_work. */
pointer pseq;
/* File name to transfer from. */
@@ -237,6 +237,12 @@ extern boolean fspool_file P((const char *zfile));
extern boolean ftimespan_match P((const struct uuconf_timespan *qspan,
long *pival, int *pcretry));
+/* Remove all occurrences of the local system name followed by an
+ exclamation point from the start of the argument. Return the
+ possibly shortened argument. */
+extern char *zremove_local_sys P((struct uuconf_system *qlocalsys,
+ char *z));
+
/* Determine the maximum size that may ever be transferred, given a
timesize span. If there are any time gaps larger than 1 hour not
described by the timesize span, this returns -1. Otherwise it
@@ -375,9 +381,8 @@ extern void xfree P((pointer));
/* Global variables. */
-/* The name of the program being run. This is statically initialized,
- although it should perhaps be set from argv[0]. */
-extern char abProgram[];
+/* The name of the program being run. Set from argv[0]. */
+extern const char *zProgram;
/* When a signal occurs, the signal handlers sets the appropriate
element of the arrays afSignal and afLog_signal to TRUE. The
@@ -427,12 +432,6 @@ extern boolean fLog_sighup;
(afSignal[INDEXSIG_SIGHUP] || afSignal[INDEXSIG_SIGQUIT] \
|| afSignal[INDEXSIG_SIGTERM] || afSignal[INDEXSIG_SIGPIPE])
-/* File being sent. */
-extern openfile_t eSendfile;
-
-/* File being received. */
-extern openfile_t eRecfile;
-
/* Device name to log. This is set by fconn_open. It may be NULL. */
extern char *zLdevice;