diff options
Diffstat (limited to 'gnu/libexec')
245 files changed, 18438 insertions, 3760 deletions
diff --git a/gnu/libexec/uucp/ChangeLog b/gnu/libexec/uucp/ChangeLog index 48a52b75a285..82353fff56a3 100644 --- a/gnu/libexec/uucp/ChangeLog +++ b/gnu/libexec/uucp/ChangeLog @@ -1,25 +1,1260 @@ -Sat Feb 13 15:57:30 1993 Ian Lance Taylor (ian@comton.airs.com) +Thu May 5 23:15:11 1994 Ian Lance Taylor (ian@airs.com) + + * Released version 1.05. + + * Makefile.in (doc-dist): Put uucp.ps in uucp-doc-$(VERSION). + +Sun May 1 23:41:49 1994 Ian Lance Taylor (ian@airs.com) + + * uuchk.c (ikshow_port): Show reliability information. + (ukshow_dialer): Likewise. + (ukshow_reliable): New function. + +Sat Apr 16 22:28:10 1994 Ian Lance Taylor (ian@airs.com) + + * Andrew A. Chernov: uucico.c (main): Pass 'z' to getopt. + (uhelp): Mention -z aka --try-next. + + * log.c (ustats): Report failed transfers when HAVE_HDB_LOGGING. + +Wed Apr 13 23:07:20 1994 Ian Lance Taylor (ian@airs.com) + + * prot.c (fsend_data): If no room in receive buffer, just write + the data out, don't call fconn_io. + +Tue Apr 12 21:55:32 1994 Ian Lance Taylor (ian@airs.com) + + * Spider Boardman: unix/serial.c (fsysdep_modem_end_dial): Set + terminal characteristics of reopened port. + +Sun Apr 10 18:05:34 1994 Ian Lance Taylor (ian@airs.com) + + * send.c (flocal_send_fail): Always call fsysdep_did_work. + (flocal_send_await_reply): Don't call flocal_send_fail if we are + going to call fsend_exec_file_init. Only call + fsend_exec_file_init if fnever is TRUE. Pass fnever to + flocal_send_cancelled using the qinfo->fsent flag. + (flocal_send_cancelled): Only call fsend_exec_file_init if + qinfo->fsent is TRUE. + + * unix/statsb.c (fsysdep_lock_status): If HAVE_QNX_LOCKFILES, + initialize painid to NULL. + +Tue Apr 5 23:09:00 1994 Ian Lance Taylor (ian@airs.com) + + * Released version gamma 1.05. + + * Makefile.in (VERSION): Changed to gamma1.05. + + * uucico.c (fcall): Return TRUE if -C was used and no call was + made because there was no work. + +Mon Apr 4 20:29:30 1994 Ian Lance Taylor (ian@airs.com) + + * Chris Lewis: unix/serial.c: Include <sys/ioctl.h> if + HAVE_TXADDCD. Check for HAVE_TXADDCD rather than ifdef TXADDCD or + TXDELCD. + + * configure.in: Check for TXADDCD in <sys/ioctl.h>. + * config.h.in (HAVE_TXADDCD): New configuration macro. + +Sun Apr 3 14:05:30 1994 Ian Lance Taylor (ian@airs.com) + + * send.c (flocal_send_request): Queue stransfer structure up + before sending any command or data, because sending data may cause + data to be received for this stransfer, and we must be prepared to + handle it correctly. + (fremote_rec_reply): Likewise. + * rec.c (flocal_rec_send_request, fremote_send_reply): Likewise. + (fremote_send_fail_send): Likewise. + * xcmd.c (flocal_xcmd_request): Likewise. + + * Chris Lewis: unix/serial.c (fsserial_hardflow): Add support for + AIX TXADDCD and 3b1 CTSCD. + +Sat Apr 2 00:04:30 1994 Ian Lance Taylor (ian@airs.com) + + * policy.h (USE_TRADITIONAL_STATUS): Permit this to be defined. + * lib/status.c: Control initialization of azStatus based on + USE_TRADITIONAL_STATUS rather than SPOOLDIR_HDB || SPOOLDIR_SVR4. + +Fri Apr 1 23:52:09 1994 Ian Lance Taylor (ian@airs.com) + + * log.c (ulog): When using HAVE_HDB_LOGGING, force the program + name to lower case when using it as a file name. + + * send.c (flocal_send_await_reply): Correct code to really not + decrement number of channels to one. + * rec.c (flocal_rec_await_reply): Likewise. + +Wed Mar 30 22:57:30 1994 Ian Lance Taylor (ian@airs.com) + + * lib/buffer.c (ubuffree): Change ioff from size_t to int to avoid + HP/UX compiler bug. + + * configure.in: Make sure that <utime.h> defines struct utimbuf + before assuming that it is present. + +Tue Mar 29 23:00:15 1994 Ian Lance Taylor (ian@airs.com) + + * uuconf/filnam.c: Use UUCONF_CONST, not const, to match + declaration in uuconf.h. + +Mon Mar 28 20:06:00 1994 Ian Lance Taylor (ian@airs.com) + + * Andrew A. Chernov: policy.h: For several macros, add commented + out values appropriate for some free BSD distributions. + * Makefile.in: Likewise. + + * uucico.c (icallin_cmp): Use pointer, not void *. + * uuconf/callin.c (struct sinfo, uuconf_callin): Likewise. + + * Chris Lewis: uuconv.c (fvperm_string_cmp, fvperm_array_cmp): AIX + 3.2.5 cc can't handle conditional expressions in if conditions. + +Sun Mar 27 15:04:27 1994 Ian Lance Taylor (ian@airs.com) + + * send.c (flocal_send_fail): Don't assume that qtrans is not NULL. + + * Jeff Ross, Stephen J. Walick: Makefile.in (uusched): Substitute + for @SBINDIR@, not @BINDIR@. + + * configure.in: Make sure that <dirent.h> defines struct dirent + before assuming that it is present. + + * Benoit Grange: unix/detach.c (usysdep_detach): Correct type of + HAVE_BSD_SETPGRP for HAVE_BSD_PGRP. + +Sat Mar 26 12:59:36 1994 Ian Lance Taylor (ian@airs.com) + + * Andrew A. Chernov: uucico.c (asLongopts): Add --try-next as + synonym for -z. + (main): If -z, call fcall with ftrynext as TRUE. + (fcall): Add ftrynext argument. If ftrynext is TRUE, try the next + alternate if a call fails. + +Fri Mar 25 22:37:51 1994 Ian Lance Taylor (ian@airs.com) + + * lib/parse.c (fparse_cmd): If we get a decimal 666 or 777 for the + mode, turn it into an octal 0666 or 0777. + + * send.c (flocal_send_fail): Accept qdaemon argument rather than + qsys. Changed all callers. If we are going to send an execution + file, don't call fsysdep_did_work. + + * protg.c (fgstart): Say ``sending'' and ``receiving'' instead of + ``remote'' and ``local'' in log message. + * proti.c (fijstart): Likewise. + +Thu Mar 24 22:40:49 1994 Ian Lance Taylor (ian@airs.com) + + * Gert Doering: uuchk.c (ikshow_port): Don't use qtli for a TCP + port. + + * Makefile.in (uusched, uuto): Fix typo in sed command. + + * unix/mail.c (fsysdep_mail): Add casts to avoid warnings. + * uuconf/runuxq.c (uuconf_runuuxqt): Likewise. + + * Emmanuel Mogenet: unix/pipe.c (fspipe_dial): Make consistently + static. + + * unix/serial.c (fsserial_open): Only strip /dev/ from the start + of a device name, rather than dropping everything before the last + slash. + + * sysh.unx (ftw): Change stat argument to not be const pointer. + * unix/ftw.c (ftw_dir, ftw): Change stat argument to func argument + to not be const pointer. + * unix/srmdir.c (isremove_dir): Change stat argument to not be + const pointer. + * unix/walk.c (iswalk_dir): Likewise. + +Wed Mar 23 20:02:26 1994 Ian Lance Taylor (ian@airs.com) + + * conn.c (fconn_break): Remove incorrect indirection of function + pointer. + + * unix/mkdirs.c (fsysdep_make_dirs): Some systems can return + EACCES, not EEXIST, when a directory exists. + + * configure.in: Fix STAT_STATFS2_FSIZE test. + * configure: Regenerated. + +Tue Mar 22 01:32:21 1994 Ian Lance Taylor (ian@airs.com) + + * uucico.c (main): Skip a leading dash in argv[0] which is + probably the result of being invoked by the Unix login program. + + * configure.in: Check for sys/time.h. + * config.h.in (HAVE_SYS_TIME_H): Define. + + * unix/serial.c (fsysdep_modem_begin_dial): Correct type of q for + qsysdep. + + * uux.c (main): Check for zXnames being NULL. + +Sat Mar 19 14:07:31 1994 Ian Lance Taylor (ian@airs.com) + + * Released version beta 1.05. + + * Makefile.in (uucp.info): Use -o argument to force info files to + be created in objdir. + (doc-dist): Get README-DOC from $(srcdir). + + * lib/debug.c (iDebug, azDebug_names, idebug_parse): Only compile + if DEBUG > 1. + +Mon Feb 14 22:46:49 1994 Ian Lance Taylor (ian@airs.com) + + * lib/strtou.c: New file, for strtoul. + * lib/MANIFEST: List strtou.c. + * configure.in: Check for strtoul, add strtou.o to LIBOBJS if not + there. + * config.h.in (HAVE_STRTOUL): Define. + * uucp.h (strtoul): Declare. + +Mon Jan 31 20:17:30 1994 Ian Lance Taylor (ian@airs.com) + + * Makefile.in, lib/Makefile.in, unix/Makefile.in, + uuconf/Makefile.in: Use $(CFLAGS) after all other flags. + +Sun Jan 30 14:34:51 1994 Ian Lance Taylor (ian@airs.com) + + * Makefile.in (clean, distclean, dist, doc-dist): Remove .tar.gz + file, not .tar.Z one. + (dist, doc-dist): Use gzip --best, not compress. + + * Makefile.in (VERSION): Set to beta1.05. + + * cu.c, uuchk.c, uucico.c, uuconv.c, uucp.c, uulog.c, uuname.c, + uupick.c, uustat.c, uux.c, uuxqt.c: Updated copyright date. + + * conn.c (fconn_init): Added third argument: type of standard + input port. + * conn.h (fconn_init): Updated declaration. + * uucico.c (asLongopts): Added --stdin, synonym for -i. + (main): Accept -i TLI to set standard input to be of type TLI. + Pass appropriate additional argument to fconn_init. + (uhelp): Updated. + (fconn_call, iuport_lock): Changed all calls to fconn_init. + * cu.c: Changed all calls to fconn_init. + * prot.c, protj.c: Include uuconf.h before conn.h. + * Makefile.in (prot.o, protj.o): Updated. + + * unix/serial.c (fsysdep_conn_read): Permit up to two EWOULDBLOCK + error returns from read before quitting. + +Sat Jan 22 16:48:41 1994 Ian Lance Taylor (ian@airs.com) + + * uuconf/hinit.c: Don't treat lines with leading whitespace as + comments in Sysfiles. + + * log.c: Don't require ANSI C to use vfprintf, just require + stdarg.h and prototypes. Required for Alpha cc support. + + * configure.in: Check for prototype support. Check for stdarg.h. + When looking for socket and t_open check for "-lsocket -lnsl" + after plain "-lnsl". + * config.h.in (HAVE_PROTOTYPES, HAVE_STDARG_H): New macros. + * uucp.h: Demand that an ANSI C compiler support prototypes. If + HAVE_PROTOTYPES is 1 for Classic C, defined P(x) to be x. + + * configure: Upgraded to autoconf 1.7. + + * protg.c (fgstart): Ensure that window size is reasonable. + + * protg.c (fvstart): Change default packet size from 512 to 1024. + + * trans.h (struct sdaemon): Added zconfig, irunuuxqt, and + cxfiles_received fields. + (fspawn_uuxqt): Declare. + * uucico.c (fcall, flogin_prompt, faccept_call): Added zconfig and + fuuxqt arguments; changed all callers. + (main): Use fspawn_uuxqt to invoke uuxqt, and only do it if + uuconf_runuuxqt returns UUCONF_RUNUUXQT_ONCE. + (fcall, faccept_call): Initialize new struct sdaemon fields. + Spawn uuxqt if uuconf_runuuxqt returned UUCONF_RUNUUXQT_PERCALL or + if it returned a positive number and execution files have arrived + since the last time uuxqt was spawned. + (fspawn_uuxqt): New function. + * rec.c (frec_file_end): Spawn uuxqt if enough execution files + have been received. + + * uuconf.h (UUCONF_RUNUUXQT_NEVER, UUCONF_RUNUUXQT_ONCE, + UUCONF_RUNUUXQT_PERCALL): New #define constants. + (uuconf_runuuxqt): Declare. + * uuconf/runuxq.c: New file. + * uuconf/uucnfi.h (struct sprocess); Added zrunuuxqt field. + * uuconf/tinit.c (asCmds): Added "run-uuxqt". + * uuconf/iniglb.c (_uuconf_iinit_global): Initialize zrunuuxqt + field. + * uuconf/MANIFEST, uuconf/Makefile.in: Handle runuxq.c. + + * system.h (fsysdep_run): Added ffork argument. + * unix/run.c (fsysdep_run): Added ffork argument. + * uucico.c (main), uux.c (main), uucp.c (main): Changed calls to + fsysdep_run to pass ffork argument as FALSE. + +Fri Jan 14 19:40:20 1994 Ian Lance Taylor (ian@airs.com) + + * Chip Salzenberg: unix/splcmd.c (zsysdep_spool_commands): More + fitting value for size of abtempfile. + +Mon Jan 10 22:46:52 1994 Ian Lance Taylor (ian@airs.com) + + * unix/recep.c (fsysdep_remember_reception): Create directory with + mode of 0755, not 0777. + +Mon Jan 3 20:34:35 1994 Ian Lance Taylor (ian@airs.com) + + * protg.c (fgprocess_data): Don't believe the ACK of an out of + order packet. + + * uucico.c (asProtocols): Added 'v'. + * prot.h (fvstart): Declare. + * protg.c (fvstart): New function. + +Sun Jan 2 15:34:12 1994 Ian Lance Taylor (ian@airs.com) + + * uucico.c (main), uucp.c (main), uux.c (main): Pass -I argument + to invoked program. + + * uustat.c (JOB_REJUVENATE): Define. + (asLongopts): Add "rejuvenate-all". + (main, ususage): Handle -R. + (fsworkfile_show, fsexecutions): Handle JOB_REJUVENATE. + * system.h (fsysdep_touch_file): Declare. + * unix/statsb.c (issettime): Rename from ussettime. + (fsysdep_touch_file): Create. + + * Jim Avera: system.h: (INIT_NOCLOSE): Define. + * unix/init.c (usysdep_initialize): If INIT_NOCLOSE is set, don't + close all open descriptors. + + * Allen Delaney: tli.c: Don't declare t_alloc if we have + <tiuser.h>, since it can cause conflicts. + + * configure.in: Call AC_CONST. + * config.h.in: Added #undef const for configure to comment out. + * uucp.h: Don't undefine const here. + + * Spider Boardman: uucico.c (main): Correct error message. + uux.c (main), uucp.c (main): Call uucico with -C option. + + * tstuu.c (uprepare_test): Don't put the obsolete pty command into + the port file. + + * spawn.c (ixsspawn): Set close-on-exec flag for both ends of + new pipe. + + * Andrew A. Chernov: unix/serial.c (ICLEAR_IFLAG): Clear IMAXBEL + if it is defined. + (ICLEAR_LFLAG): Clear PENDIN if it is defined. + + * send.c (flocal_send_file_init): If stat fails, discard the + command and save the temporary file. + (flocal_send_fail): Cleaned up zsysdep_save_temp_file call. + +Thu Dec 23 00:55:22 1993 Ian Lance Taylor (ian@airs.com) + + * Martin Tomes: spawn.c (ixsspawn): On ISC, call __setostype + before execve. + +Wed Dec 22 00:06:25 1993 Ian Lance Taylor (ian@airs.com) + + * uuconf/tport.c (ipunknown): Set UUCONF_CMDTABRET_EXIT if an + error is found. + + * uucico.c (asLongopts): Add --login as a synonym for -u. + (main): Permit a privileged user to use -u to set the login name + rather than always using zsysdep_login_name (). + (flogin_prompt): Accept login name as an argument. If non-null, + use it rather than prompting for one. + (uhelp): Document new --login option. + * uucico.8: Document new --login option. + * unix/priv.c: New file, containing fsysdep_privileged. + * unix/statsb.c (fsysdep_privileged): Moved to priv.c. + * unix/MANIFEST, unix/Makefile.in: Support new priv.c file. + + * uuchk.c (ikshow_port): Print a note when using the port name as + a device name. + +Tue Dec 21 00:01:40 1993 Ian Lance Taylor (ian@airs.com) + + * uucico.c (fcall): Ignore status file times in the future when + deciding whether a retry is permitted. + + * detach.c (usysdep_detach): If it forks, output a debugging + message with the old and new process IDs. + + * Scott Ballantyne: unix/spawn.c (ixsspawn): If fkeepuid is TRUE, + try to set the real user and group ID to the effective user and + group ID. This will not work on System V derived systems, but + should do no harm. + * unix/xqtsub.c (fsysdep_execute): Pass fkeepuid as TRUE to + ixsspawn. + * unix/epopen.c (espopen): Likewise. + + * uucico.c (faccept_call): Use correct default for + max-remote-debug. + + * uuconf/tportc.c (ipdialer): Don't core dump if the port name is + NULL, as it is for the default port. + + * unix/xqtsub.c (fsysdep_xqt_check_file): Do not permit the name + ``..'', or strings starting with ``../''. + + * proti.c (fijstart): Send a fourth byte in the SYNC packet with + the number of channels. + (fiprocess_packet): If a SYNC packet has a fourth byte, use it to + set the number of channels. + + * rec.c (flocal_rec_await_reply): Handle RN9 (no channels + available on remote). + * send.c (flocal_send_await_reply): Handle SN9 (no channels + available on remote). + + * trans.h (struct sdaemon): Added cchans field. + * uucico.c (fcall, fdo_call, faccept_call): Initialize cchans. + * trans.c (utchanalc, fcheck_queue, floop): Use qdaemon->cchans, + not qdaemon->qproto->cchans. + * send.c (flocal_send_request, flocal_send_await_reply): Likewise. + * rec.c (fremote_send_fail): Likewise. + +Sun Dec 19 19:44:31 1993 Ian Lance Taylor (ian@airs.com) + + * proti.c (cIack_frequency): New static variable. + (asIproto_params): New protocol parameter ack-frequency. + (fijstart): If cIack_frequency is not set, set it to half the + window size. + (fishutdown): Clear cIack_frequency. + (fiprocess_data): Use cIack_frequency to determine when to send an + acknowledgement, rather than always sending one at half the window + size. + + * uuconf/cmdfil.c (uuconf_cmd_file): Free zline. + + * uuconf/callin.c (uuconf_callin): Treat colon as a field + delimiter, for Unix /etc/passwd support. + + * unix/xqtsub.c (zsysdep_find_command): If file named with + absolute path does not exist, give a reasonable error message. + + * uuconf/rdperm.c (ihadd_norw): Ignore use of empty string with + NOREAD or NOWRITE, rather than denying everything. + + * Chip Salzenberg: uulog.c (main): Set zluser correctly under + HAVE_HDB_LOGGING. + + * Chip Salzenberg: protz.c (izrecv_hdr): Use %lx, not %x. + +Sun Dec 12 19:24:35 1993 Ian Lance Taylor (ian@airs.com) + + * uucp.c (uccopy): Null terminate name of forwarding system. + +Mon Nov 22 21:12:41 1993 Ian Lance Taylor (ian@airs.com) + + * unix/tmpfil.c: Include "uudefs.h". + * unix/Makefile.in: Changed accordingly. + + * log.c (zstpcpy): New function. + (ulog): Output to log file with a single call to fprintf. + + * uucp.c (uccopy): Clarified "not permitted to send" error. + + * log.c (ulog): If debugging is on, output all log messages to + debugging file. + + * uucico.c (fdo_call): Changed "Bad initialization string" error + message. + + * unix/lock.c (fsdo_lock): Print date a stale lock was last + modified. + + * uucico.c (uaccept_call_cleanup): Call ulog_system (NULL). + +Sun Nov 21 17:04:27 1993 Ian Lance Taylor (ian@airs.com) + + * Joe Wells: policy.h: Added new parameter LOG_DEVICE_PREFIX. + * unix/serial.c (fsserial_open): Use it. + + * Makefile.in: Always use CFLAGS as well as LDFLAGS when linking. + + * Joe Wells: policy.h: Added new parameter QNX_LOG_NODE_ID. + * log.c (ulog): Log the QNX node ID if QNX_LOG_NODE_ID is set. + + * Joe Wells: unix/serial.c: Support QNX dev_info function for + serial port locking. + + * Joe Wells: unix/fsusg.c: Support QNX disk_space function. + * unix/Makefile.in: fsusg.o now depends upon uudefs.h. + + * Joe Wells: policy.h: Changed PS_PROGRAM default for __QNX__. + Added HAVE_QNX_LOCKFILES. Rearranged LOCKFILE defines to permit + some default selections. + * sysh.unx: Removed LOCKFILES sanity check. + * unix/lock.c (fsdo_lock, fsqnx_stale), unix/serial.c + (fsserial_lockfile), unix/statsb.c (fsysdep_lock_status): Added + support for HAVE_QNX_LOCKFILES. + + * configure.in, config.h.in, policy.h: Moved MAIL_PROGRAM to + policy.h. Added MAIL_PROGRAM_TO_BODY and + MAIL_PROGRAM_SUBJECT_BODY. + * unix/mail.c: Updated accordingly. + + * uucico.c (main): Don't make -p imply -e. + (uhelp): Modified accordingly. + * uucico.8: Modified accordingly. + +Mon Nov 1 21:34:36 1993 Ian Lance Taylor (ian@airs.com) + + * uucico.c (main): Call fconn_close and fconn_open rather than + calling fconn_reset. + * conn.h (struct sconncmds): Removed pfreset field. + (fconn_reset): Removed declaration. + * conn.c (fconn_reset): Removed. + * tcp.c (ftcp_reset): Removed. + (ftcp_open): Save pid in ssysdep_conn information. + (ftcp_close): If pid has changed, return FALSE. + * tli.c (ftli_reset): Removed. + (ftli_open): Save pid in ssysdep_conn information. + (ftli_close): If pid has changed, return FALSE. + * unix/pipe.c (fspipe_close): Replaced with fspipe_reset body. + (fspipe_reset): Removed. + (fspipe_dial): Call fspipe_close, not fspipe_reset. + * unix/serial.c (fsserial_reset, fsstdin_reset): Removed. + (fsysdep_modem_begin_dial): Hangup terminal here, rather than + calling fconn_reset. + + * send.c (fremote_rec_reply): If we want to request hangup, send + an M after the mode. + * rec.c (flocal_rec_await_reply): If there an M after the mode, + the remote is requesting a hangup. + +Sun Oct 31 23:43:40 1993 Ian Lance Taylor (ian@airs.com) + + * uux.c (zXnames): New static variable to hold list of file names + being sent. + (uxadd_name): Function to add a new name. + (main, uxadd_send_file): Call uxadd_name. + (main): Include zXnames in log message. + +Mon Oct 18 00:23:27 1993 Ian Lance Taylor (ian@airs.com) + + * proti.c (fijstart): Ensure that packet size and window size are + reasonable; restrict window size to 16. + + * proti.c (iIforced_remote_winsize): Removed, along with all + references. + (asIproto_params): Removed "remote-window". + +Sun Oct 17 22:15:14 1993 Ian Lance Taylor (ian@airs.com) + + * Mark Delany: protg.c (cGremote_duprrs): New static variable. + (fgstart): Initialize it. + (fgshutdown): Count rejects as cGremote_duprrs + cGremote_rejects. + (fgprocess_data): If cGremote_rejects is non-zero, don't treat + duplicate RR as reject. Count duplicate RR's in cGremote_duprrs, + not cGremote_rejects. + + * Mark Delany: unix/serial.c (fsdouble_chat, fsysdep_conn_chat): + After running a chat program, reread the terminal characteristics. + +Wed Oct 13 20:46:46 1993 Ian Lance Taylor (ian@airs.com) + + * uucico.c (fdo_call): Fix typo. + +Thu Oct 7 22:28:45 1993 Ian Lance Taylor (ian@airs.com) + + * unix/app3.c (zsappend3), unix/app4.c (zsappend4), unix/ftw.c + (ftw), unix/sindir.c (zsysdep_in_dir): Don't duplicate '/' + character for root directory. + + * send.c (flocal_send_await_reply): If an SN comes in while the + file is being sent, seek to the end rather than setting fsendfile + to FALSE. + (flocal_send_cancelled): Don't send an empty packet. + * trans.c (utransfree): Set e field to EFILECLOSED when debugging. + (floop): Check for file send cancelled at top of loop, not middle. + + * uucp.h (ffileseekend): Define. + +Wed Oct 6 00:51:08 1993 Ian Lance Taylor (ian@airs.com) + + * proti.c (fisenddata, fiprocess_packet): Report channel numbers + in debugging messages. + +Tue Oct 5 00:00:33 1993 Ian Lance Taylor (ian@airs.com) + + * unix/statsb.c (fsysdep_lock_status): Only report the status of a + particular job once, no matter how many lock files it has. + + * uustat.c (fsnotify): Added itime argument. Changed all callers. + Report time job was queued in mail message. + + * unix/cusub.c (fsysdep_terminal_raw): For TERMIO and TERMIOS, + clear IXON, IXOFF and IXANY (TERMIO only) in c_iflag. + + * Lele Gaifax: log.c (ustats): Report device name. + + * log.c (ulog): Use zsysdep_base_name of zProgram. + + * uuxqt.c (main): Accept local system name and unknown system + names for -s argument. zsysdep_get_xqt may return an alias. + +Wed Sep 29 00:13:39 1993 Ian Lance Taylor (ian@airs.com) + + * proti.c (fiprocess_packet): If sending an ACK for a NAK, don't + also send a packet. + + * unix/serial.c (fsysdep_modem_end_dial): If TIOCWONLINE is not + defined, reopen the port to wait for carrier. + + * policy.h: Use __ultrix__ as well as ultrix in check for + HAVE_STRIP_BUG. + +Tue Sep 28 22:25:05 1993 Ian Lance Taylor (ian@airs.com) + + * Marcel Waldvogel: uuchk.c (ukshow): Don't die if the call out + file can not be opened. + +Sun Sep 19 00:16:01 1993 Ian Lance Taylor (ian@airs.com) + + * Jason Molenda: policy.h (HAVE_SEQUENT_LOCKFILES): New + configuration parameter. + * sysh.unx, unix/serial.c: Implement it. + + * uulog.c (main): Ignore any errors when trying to canonicalize + the system name. + + * Marcel Waldvogel: uucico.c (faccept_call): If the calling system + is already locked, and we are using sequence numbers for it, + increment the local sequence number to keep in synch. + + * unix/sleep.c (usysdep_sleep): If usysdep_pause is accurate, use + it. Otherwise call sleep, but always for at least two seconds. + * chat.c (fcsend): Call usysdep_sleep with 1, not 2. + + * unix/pause.c: Correct USE_SELECT_TIMER to HAVE_SELECT. + + * unix/serial.c (fsmodem_open): Only turn on hardware flow control + for an incoming connection. + (fsmodem_carrier): Turn on hardware flow control after turning on + carrier. Turn off hardware flow control before turning off + carrier. + + * uuxqt.c (uqdo_xqt_file): Use known system name, not system name + from execution file, unless the former is a prefix of the latter. + +Sat Sep 18 16:53:41 1993 Ian Lance Taylor (ian@airs.com) + + * policy.h: Add HAVE_ENCRYPTED_PASSWORDS configuration parameter. + * callin.c: Change interface to use a passed in comparison + function. + * uuconf.h: Change declaration of uuconf_callin. + * uucico.c (flogin_prompt): Change call to uuconf_callin. + (icallin_cmp): New function. Handle HAVE_ENCRYPTED_PASSWORDS. + + * Hans-Dieter Doll: chat.c (fchat): Permit \W at the end of an + expect string to specify a timeout. + + * util.c (zremove_local_sys): New function. + * uudefs.h: Declare zremove_local_sys. + * uucp.c (main): Read local system information. Ignore local + system name in front of arguments. + * uux.c (main): Ignore local system name in front of arguments. + + * configure.in: Call AC_HAVE_POUNDBANG, AC_STAT_MACROS_BROKEN, + AC_TIME_WITH_SYS_TIME, AC_STRUCT_TM. Call AC_SUBST(POUNDBANG). + Remove HAVE_SYS_TIME_AND_TIME_H check. Rework disk space + configuration to actually check for the functions. Check for + function dev_info. Don't confuse HAVE_FTW_H and HAVE_FTW (from + Joe Wells). + * config.h.in (STAT_MACROS_BROKEN, TM_IN_SYS_TIME, STAT_DUSTAT, + STAT_DISK_SPACE, HAVE_DEV_INFO): New macros set by configure. + (TIME_WITH_SYS_TIME): Renamed from HAVE_SYS_TIME_AND_TIME_H. + * Makefile.in (POUNDBANG): Set to @POUNDBANG@. + (uusched, uuto): If POUNDBANG = no, turn #!/bin/sh into :. + (config.status): Use config.status --recheck. + (configure): Chdir to $(srcdir) before running autoconf. + * sysh.unx: If STAT_MACROS_BROKEN, undefine S_ISDIR. + * log.c, time.c, uustat.c, unix/loctim.c: If TM_IN_SYS_TIME, + include <sys/time.h>, not <time.h>. + * tstuu.c, unix/pause.c, unix/proctm.c, unix/serial.c: Rename + HAVE_SYS_TIME_AND_TIME_H to TIME_WITH_SYS_TIME. + * fsusg.c: Check STAT_DUSTAT, not _AIX and _I386. + + * config.h.in: Renamed from conf.h.in. + * MANIFEST, configure.in, Makefile.in, lib/Makefile.in, + unix/Makefile.in, uuconf/Makefile.in, uucp.h: conf.h renamed to + config.h. + +Fri Sep 17 00:36:16 1993 Ian Lance Taylor (ian@airs.com) + + * Joe Wells: policy.h: If __QNX__, default to HAVE_POSIX_TERMIOS. + + * Joe Wells: Makefile.in (FORCE): Add dummy command to work around + QNX make bug. + + * Makefile.in, lib/Makefile.in, unix/Makefile.in, + uuconf/Makefile.in: Add .PHONY declaration for appropriate + commands. + + * Joe Wells: Makefile.in (install): Create $(man1dir) and + $(man8dir) if necessary. + (install-info): Create $(infodir) if necessary. + + * Joe Wells: sysh.unx (bsgrade): Declare as returning int rather + than char, since it can return a negative number. + * unix/work.c (bsgrade): Define as returning int. + + * Joe Wells: unix/lock.c (fsdo_lock), unix/statsb.c + (fsysdep_lock_status): Use pid_t rather than int for variables + that hold pid's. Cast to long when using printf. + + * Joe Wells: uucico.c (fcall): Fix test for 24 hour check when too + many retries. + + * Joe Wells: uucico.c (fcall), unix/opensr.c + (esysdep_open_receive), unix/recep.c (fsysdep_already received): + Cast values in multiplication to determine seconds per day or per + week to long, because result is larger than 16 bits. + + * Joe Wells: uuconv.c: Add return 0 after exit to avoid warnings. + +Thu Sep 16 23:53:58 1993 Ian Lance Taylor (ian@airs.com) + + * Joe Wells: configure.in: Set AR from environment, defaulting to + ar, and substitute it in Makefiles. + * Makefile.in: Set AR to @AR@. Pass it down in MDEFINES. + * lib/Makefile.in, unix/Makefile.in, uuconf/Makefile.in: Set AR to + @AR@. Use $(AR) instead of ar. Use rc instead of qc (POSIX.2 + does not define q). + +Wed Sep 15 00:47:33 1993 Ian Lance Taylor (ian@airs.com) + + * uuconf/callin.c (uuconf_callin): Take an additional argument: a + function to call to transform the login name and password. This + is a hack to avoid requiring escape sequence handling in uuconf. + * uucico.c (flogin_prompt): Pass cescape to uuconf_callin. This + is an incompatible change. + * uuconf.h (uuconf_callin): Update declaration. + * tstuu.c (uprepare_test): Use \s in password in Call1 and Pass2. + + * chat.c (fcsend, fcprogram): Expand escape sequences in callout + login names and passwords. This is an incompatible change. + + * Joe Wells: uustat.c (fsnotify): Add missing break statement. + + * Mark Eichin: tstuu.c (main): Add some sleeps in the children to + make the tests more robust on Linux. + + * uulog.c (ulhelp): Clean up general usage message: don't show -F + for HDB_LOGGING, don't show -x for non HDB_LOGGING. Remove + mention of numeric debugging levels. + * uustat.c (ushelp): Remove mention of numeric debugging levels. + + * unix/serial.c (ICLEAR_CFLAG): Removed CLOCAL. + (enum tclocal_setting): New enum. + (fsserial_lock): Don't call TIOCSCTTY. + (fsserial_open): Changed flocal argument to tlocal. Use it to + determine initial CLOCAL setting for TERMIO and TERMIOS. Don't + call TIOCSCTTY until after setting the terminal state. + (fsstdin_open): Call fsserial_open with IGNORE_CLOCAL. + (fsmodem_open): Call fsserial_open with SET_CLOCAL if calling out, + CLEAR_CLOCAL if waiting for an incoming call. + (fsdirect_open): Call with SET_CLOCAL or CLEAR_CLOCAL depending + upon fcarrier setting. + * uuconf.h (struct uuconf_direct_port): Added fcarrier field. + * uuconf/tportc.c (asPdirect_cmds): Added ``carrier'' command. + (_uuconf_iport_cmd): Initialize direct fcarrier field to FALSE. + * uuconf/hport.c (uuconf_hdb_find_port), uuconf/vport.c + (uuconf_v2_find_port): Set direct fcarrier field to FALSE. + * uuchk.c (ikshow_port): Print direct port carrier field. + * uuconv.c (uvwrite_taylor_port): Likewise. + + * uustat.c (main, fsquery, fsquery_systems, fsquery_show): Support + -o, -y, -s and -S in conjunction with -q. + +Tue Sep 14 00:51:50 1993 Ian Lance Taylor (ian@airs.com) + + * log.c (ulog): If we can't open the log file, print an error on + stderr. + + * configure.in, conf.h.in: Adjusted for autoconf 1.5. + +Sun Sep 12 15:52:29 1993 Ian Lance Taylor (ian@airs.com) + + * unix/serial.c (fsserial_open): Add flocal argument. Changed all + callers. Pass it as TRUE when dialing out on a modem. This is + supposedly required on 386bsd. + + * conn.c (fconn_dial_sequence): New function. + (fmodem_dial): Use fconn_dial_sequence. Call fsysdep_modem_begin + only once, before entire sequence, and fsysdep_modem_end only + once, after entire sequence. Don't call fcdo_dial. + (fcdo_dial): Removed. + * conn.h: Declare fconn_dial_sequence. + * uucico.c (fconn_call): Don't free dialer if fconn_dial fails. + * uuconf.h (struct uuconf_tcp_port): Add pzdialer field. + * tcp.c (ftcp_dial): Pass new pzdialer field to + fconn_dial_sequence. + * tli.c (ftli_dial): Pass pzdialer to fconn_dial_sequence. + * uuconf/hport.c (uuconf_hdb_find_port): Add trailing dialer + sequence to pzdialer field for TCP port. + * uuconf/tportc.c (asPtcp): Add ``dialer-sequence'' command. + (_uuconf_iport_cmd): Initialize pzdialer for TCP port. + * uuconf/vsinfo.c (_uuconf_iv2_system_internal): Initialize + pzdialer for TCP port. + * uuchk.c (ikshow_port): Print TCP pzdialer field. + * uuconv.c (uvwrite_taylor_port, ivwrite_hdb_port): Output TCP + pzdialer field. + +Sat Sep 11 16:30:17 1993 Ian Lance Taylor (ian@airs.com) + + * uulog.c, uuname.c (main): Pass INIT_NOCHDIR to + usysdep_initialize. + + * uucp.1, uustat.1, uux.1, uuxqt.8: Remove uses of nonportable .EX + and .EE macros. + + * uuxqt.c (asQcmds, iqout, iqfile, iqrequestor, iquser): Remove + restrictions on number of arguments to commands in execution file, + since is there is such a range of buggy UUCP implementations out + there. + + * sysh.unx (CORRUPTDIR): Define. + * unix/corrup.c: New file for new zsysdep_save_corrupt_file + function to save a file in CORRUPTDIR. + * unix/Makefile.in, unix/MANIFEST: Add corrup. + * system.h: Add declaration of zsysdep_save_corrupt_file. + * uuxqt.c (uqdo_xqt_file): If execution file has a syntax error, + save it using zsysdep_save_corrupt_file and notify OWNER. + + * uuconf/hsinfo.c (_uuconf_ihdb_system_internal), vsinfo.c + (_uuconf_iv2_system_internal): Treat a specified time/grade as + both a timegrade and a call-timegrade. + + * rec.c (frec_file_end): If the received file can not be moved to + the final location, and there is enough disk space, keep the file, + mentioned the saved name in the error message, and send mail to + OWNER about it. If the hand created execution file can not be + moved, delete it. + * unix/move.c (fsysdep_move_file): Don't delete the original file + if the move fails. + * unix/splcmd.c (zsysdep_spool_commands): Remove the temporary + file if the move fails. + +Wed Sep 1 23:29:30 1993 Ian Lance Taylor (ian@airs.com) + + * uuconf/tinit.c (itdebug, _uuconf_idebug_cmd): New functions. + (asCmds): Call itdebug for "debug", to accept spaces between + options as well as commas. + * uuconf/tsinfo.c (iidebug): New function. + (asIcmds): Call iidebug for "debug". + * uuconf/uucnfi.h: Added prototype for _uuconf_idebug_cmd. + +Tue Aug 31 00:09:33 1993 Ian Lance Taylor (ian@airs.com) + + * send.c (flocal_send_file_init): Don't set flocal if job was + requested by a remote user. + (flocal_send_fail, flocal_send_open_file): Don't save temporary + file in .Preserve if job was requested by a remote user. + + * unix/wldcrd.c (fsysdep_wildcard_start): Don't free zcmd until + after calling espopen. + + * lib/buffer.c (ubuffree): Added debugging code controlled by + DEBUG_BUFFER macro. + +Sun Aug 29 13:33:21 1993 Ian Lance Taylor (ian@airs.com) + + * uuconf/tcalou.c: Permit empty password in call file. + + * unix/work.c (COMMANDS_PER_SCAN): New macro. + (fsysdep_get_work_init): Get at most COMMANDS_PER_SCAN new command + files, to avoid timeouts while reading a large directory. + + * rec.c (fremote_send_file_init): Initialize crestart. + + * uux.c (main): Changed special handling of single "-" argument to + call getopt multiple times. + + * D.J. James: protg.c (fgsendcmd, fgsenddata), prott.c + (ftsendcmd): Avoid passing 0 to bzero to avoid SunOS bug. + + * protf.c (ffprocess_data): Some systems seem to send characters + with parity, so strip the parity bit from incoming bytes. + + * Kenji Rikitake: uucp.h: Changed order of header files to avoid + gcc stddef.h vs. sys/stdtypes.h problem on SunOS 4.1. + + * Alexander Lehmann: configure.in: Correct misspelling of + HAVE_GETWD. + + * John Hood: unix/filnam.c (ZCHARS): Get the alphabet right. + + * Gabor Kiss: tcp.c (ftcp_dial): Use all gethostbyname info before + calling getservbyname. + +Thu Aug 26 23:15:33 1993 Ian Lance Taylor (ian@airs.com) + + * uux.c, uuxqt.c: Added long options. + + * uucp.c: Added v to getopt_long argument, print help and version + info to stderr. + + * unix/splcmd.c (zsysdep_spool_commands): Create command file via + temporary file, so that the command file is created atomically. + * unix/spool.c (zscmd_file): Accept files starting with "TMP". + +Sun Jul 25 14:50:41 1993 Ian Lance Taylor (ian@airs.com) + + * uupick.c, uustat.c: Added long options. + +Mon Jul 19 22:06:19 1993 Ian Lance Taylor (ian@airs.com) + + * uucico.c, uuconv.c, uucp.c, uulog.c, uuname.c: Added long + options. + * uucico.c (main, fcall): Made -c option not print the ``No work'' + log message. + * uuname.c (main): Call ulog_uuconf rather than unuuconf_error. + +Sun Jul 11 14:29:39 1993 Ian Lance Taylor (ian@airs.com) + + * cu.c, uuchk.c: Added long options. + + * uudefs.h, log.c (zProgram): Renamed from abProgram. + * cu.c, uucico.c, uucp.c, uulog.c, uuname.c, uupick.c, uustat.c, + uux.c, uuxqt.c (main): Initialize zProgram from argv[0]. + + * Bob Hemedinger: unix/cohtty.c (fscoherent_disable_tty): Almost + always return TRUE. + * unix/serial.c (fsserial_lockfile): Skip "LCK.." in string passed + to lockttyexist and fscoherent_disable_tty. + * uucico.c (main): If __COHERENT__ is defined, change the meaning + of -c for backward compatibility with old Coherent UUCP. + + * David Nugent: uucico.c (main): Added -C option to only call + system named by -s or -S if there is work. + + * uuconf/syssub.c (_uuconf_isystem_default): Merge in default + protocol parameters so that setting parameters for one protocol + does not lose the default settings for other protocols. + + * unix/lcksys.c (zssys_lock_name): New function. + (fsysdep_lock_system, fsysdep_unlock_system): Use it. + + * John Plate: uuchk.c (ukshow): Call ukshow_size with the right + arguments in the called remote case. + + * uuconf/remunk.c (uuconf_remote_unknown): use the remote.unknown + shell script if HDB_CONFIG and no ``unknown'' commands appeared in + the config file. + + * Jim Brownfield: uuconf/vsinfo.c (_uuconf_iv2_system_internal): + Accept continuation lines in L.sys. + + * Marc Evans: unix/serial.c (fsysdep_conn_write, fsysdep_conn_io): + Add casts to t_snd calls to avoid warnings. + + * Julian Stacey: uuchk.c (main): If no information found, say so. + + * Ju"rgen Fluk: uulog.c (main): Better error messages for HDB. + + * uucico.c (zget_typed_line): If last string ended in \r, ignore + leading \n. + + * Mark E. Mallett: uuconf/time.c (asTdays): Add "none". + + * uuconf/hsinfo.c (_uuconf_ihdb_system_internal): Report line + numbers for syntax errors. + +Sat Jul 10 10:28:03 1993 Ian Lance Taylor (ian@airs.com) + + Initial hardware flow control support from Peter Wemm: + * uuconf.h (struct uuconf_modem_port, struct uuconf_direct_port): + New field uuconf_fhardflow in each structure. + * unix/serial.c (fsserial_hardflow): New routine. Initially + supports SunOS and SCO Unix. + (fsmodem_open, fsdirect_open): Turn on hardware flow control if + supported by the port. + (fsserial_set): If CRTFSL is set, don't send XON/XOFF characters. + * uuconf/hport.c (uuconf_hdb_find_port), uuconf/tportc.c + (_uuconf_iport_cmd), uuconf/vport.c (uuconf_v2_find_port): + Initialize uuconf_fhardflow field to TRUE. + * uuconf/tportc.c (struct asPmodem_cmds, struct asPdirect_cmds): + Added "hardflow" command. + * uuchk.c (ikshow_port): Report whether hardware flow control is + available. + * uuconv.c (uvwrite_taylor_port): Write out hardware flow control + information. + + * Peter Wemm: protg.c (fgstart), proti.c (fijstart): Report local + packet and window size as well as remote. + * rec.c (fremote_send_file_init), send.c (flocal_send_open_file, + fremote_rec_reply): Report number of bytes being sent or received, + and restart point if any. + + * Peter Wemm: trans.h (struct sdaemon): New fields csent and + creceived. + * uucico.c (fcall, faccept_call): Initialize csent and creceived. + (fdo_call, faccept_call): Report on number of file bytes + transferred and bytes per second. + * rec.c (frec_file_end): Record number of bytes received. + * send.c (fsend_wait_confirm): Record numbers of bytes sent. + * trans.c (ufailed): Record number of bytes sent or received. + + * Peter Wemm: uusched.in, uuto.in: Use #!/bin/sh rather than :. + Use exec when invoking program. + + * uulog.c (main): Don't die if we can't canonicalize the -s + argument. + + * unix/cusub.c (uscu_child): Force the descriptor into blocking + mode. + + Port type pipe support contributed by Marc Boucher: + * unix/pipe.c: New file. Support routines for pipes. + * unix/MANIFEST, unix/Makefile.in: Adjusted for new file pipe.c. + * uuconf.h (enum uuconf_porttype): Added UUCONF_PORTTYPE_PIPE. + (struct uuconf_pipe_port): New structure. + (struct uuconf_port): Added uuconf_pipe_port to union. + * sysh.unx (struct ssysdep_conn): Add fields ord, owr and ipid, + rename istdout_flags to iwr_flags. + (fsdouble_{read, write, chat}): New prototypes. + * conn.h: Prototype for fsysdep_pipe_init. + * unix/serial.c: Renamed fsstdin_{read, write, chat} to + fsdouble_{read, write, chat}. Made them non-static. Changed them + to use ord and owr fields rather than 0 and 1. + (fsserial_init, fsstdin_open): Initialize ord and owr fields. + (fsstdin_close, fsblock, fsstdin_reset, fsysdep_conn_io, + fsstdin_break, fsstdin_set): Use ord and owr fields rather than 0 + and 1. + * uuconf/tportc.c (asPtype_names): Added "pipe". + (asPpipe_cmds, CPIPE_CMDS): New array of pipe commands. + (CCMDS, _uuconf_iport_cmd): Adjusted accordingly. + * tcp.c (fsysdep_tcp_init), tli.c (fsysdep_tli_init): Initialize + new ord and owr fields. + * conn.c (fconn_init): Call fsysdep_pipe_init for + UUCONF_PORTTYPE_PIPE. + * unix/cusub.c (zsport_line, uscu_child, fsysdep_shell): Handle + UUCONF_PORTTYPE_PIPE. + * uuchk.c (ikshow_port): Report on port type pipe. + * uuconv.c (uvwrite_taylor_port): Write out port type pipe. + + * Marc Boucher: cu.c: (main, ucuabort): Use new variable + fCuconnprinted to avoid printing ZDISMSG if ZCONNMSG has not been + printed. + (main): Call fsysdep_port_access only after we have locked the + port, to get a better error message on systems with shared lines. + + * Marc Boucher: policy.h (HAVE_FULLDUPLEX_PIPES): New macro. + * unix/spawn.c (ixspawn): Use it. + + * Marc Boucher: uucico.c (uusage): Added lines for -c and -D. + + * uuconf/time.c (_uuconf_itime_parse): Add casts to avoid a + compiler warning. + + * uustat.c (fsworkfile_show): Don't report non-existent send + files. + + * lib/parse.c (fparse_cmd): Accept any base for the mode argument, + rather than always using 8. Depend upon the leading zero to + indicate base 8. Accomodates UFGATE 1.03. + +Wed Jun 30 00:27:27 1993 Ian Lance Taylor (ian@airs.com) + + * uudefs.h (struct scmd): Changed bdummy field to bgrade. + * trans.c (fqueue_send): Sort sends by whether they are a command + and then by grade. + * unix/work.c (asSwork_files): Renamed from azSwork_files, made + array of struct ssfilename rather than char *. + (struct ssfile): Added bgrade field. + (iswork_cmp, fsysdep_get_work_init, usysdep_get_work_freed): + Changed accordingly. + (fsysdep_get_work): Set qcmd->bgrade. + * uucp.c (uccopy), uux.c (main, uxadd_send_file), uuxqt.c + (uqdo_xqt_file), xcmd.c (fremote_xcmd_init), lib/parse.c + (fparse_cmd): Initialize bgrade field of scmd structure. + +Sun Jun 27 23:21:33 1993 Ian Lance Taylor (ian@airs.com) + + * send.c (flocal_send_await_reply, flocal_send_cancelled): If the + first D. file being sent for a faked E command fails, send the + second one anyhow. + +Sun Jun 6 23:07:33 1993 Ian Lance Taylor (ian@airs.com) + + * proti.c (fiprocess_data): If we get a packet we sent a NAK for, + forget that sent NAKs for all preceding packets. + (fiprocess_packet): If we get a NAK for the packet we are about to + send, and all our packets have been acknowledged, send an ACK. + +Thu Jun 3 20:54:55 1993 Ian Lance Taylor (ian@airs.com) + + * prot.h (struct sprotocol): Added frestart field. + * uucico.c (asProtocols): Initialize frestart field. + * system.h, unix/opensr.c (zsysdep_receive_temp): Added frestart + argument to zsysdep_receive_temp. + * rec.c (flocal_rec_send_request, fremote_send_file_init, + frec_file_end): Pass frestart argument to zsysdep_receive_temp. + * unix/opensr.c (esysdep_open_receive): Permit pcrestart argument + to be NULL. + * rec.c (flocal_rec_await_reply, fremote_send_file_init): Pass + pcrestart argument to esysdep_open_receive as NULL if file + tranfers can not be restarted. + + * lib/status.c (azStatus): Uwe Doering: If SPOOLDIR_HDB or + SPOOLDIR_SVR4, use the same strings they use. + * unix/status.c (aiMapstatus): Uwe Doering: Swap 4 and 20. + + * unix/serial.c (fsserial_open): Uwe Doering: Set VTIME to 1. + + * uucico.c (faccept_call, uaccept_call_cleanup): Uwe Doering: Free + and unlock evertyhing after any return from faccept_call. + (main): Don't need to unlock after faccept_call here any more. + + * proti.c (fiprocess_data): Added additional debugging + information. + +Sat May 15 13:55:21 1993 Ian Lance Taylor (ian@airs.com) + + * protg.c (fgprocess_data): Don't treat a duplicate RR as an RJ if + we are retransmitting packets. If we are treating a duplicate RR + as an RJ, don't also treat it as an acknowledgement. + + * unix/serial.c (fsysdep_conn_io): Typo in debugging message. + +Tue May 4 00:03:32 1993 Ian Lance Taylor (ian@airs.com) + + * uux.c (main): Andreas Raab: Move aboptions out of local block + since a pointer to it escapes the scope. + + * unix/mkdirs.c: W Christopher Martin: Just try to make the + directories, and ignore EEXIST errors, rather than first checking + whether the directory exists. + + * send.c (flocal_send_request): Chip Salzenberg: Double check that + the file still exists before sending the S command. + + * uucico.c (zget_uucp_cmd, zget_typed_line), trans.c (fgot_data): + Matthew Geier: Avoid doing memcpy (z, NULL, 0). + +Mon May 3 22:52:46 1993 Ian Lance Taylor (ian@airs.com) + + * system.h, unix/locfil.c, unix/cwd.c, unix/picksb.c: Johan + Vromans: Added pfbadname argument to zsysdep_local_file, + zsysdep_local_file_cwd, zsysdep_uupick_local_file. + * Changed all callers. + * send.c (fremote_rec_file_init), rec.c (fremote_send_file_init): + If remote system gives bad name, return an error rather than + aborting the connection. + * uuxqt.c (uqdo_xqt_file): If bad file name, abort execution + rather than try again later. + * uupick.c (main): If bad file name, permit new command rather + than exiting. + + * lib/debug.c: Stephan Niemz: Accept whitespace separated + debugging types. + + * unix/detach.c: Always use setsid if it is available. + +Sun May 2 13:23:33 1993 Ian Lance Taylor (ian@airs.com) + + * unix/spool.c (zsfind_file): Fix handling of execution file + names for systems to work with any possible execution file name. + + * send.c (flocal_send_open_file): Subtract starting position from + number of bytes passed to pffile. + + * uuconf/rdperm.c: Syd Weinstein: Don't skip lines in Permissions + with leading whitespace. + + * uuconf/vsinfo.c: Gero Kuhlmann: Set default retry time + correctly. + + * unix/lock.c (fsdo_lock): Andrew Vignaux: Handle readonly lock + files correctly. + + * send.c (flocal_send_fail, flocal_send_await_reply): James Van + Artsdalen: Clarify error messages relating to execution files. + + * log.c (ustats): Avoid overflow in bytes/sec calculation. + +Sat May 1 17:40:14 1993 Ian Lance Taylor (ian@airs.com) + + * trans.c (ftadd_cmd): Don't treat junk at end of command as a + size if the remote system doesn't support sizes. + + * uucico.c (faccept_call): Turn on the protocol before reading the + queue, in case there are lots of command files. + + * unix/cusub.c: Julian Stacey: If SIGUSR2 is not defined, use + SIGURG instead. + + * uuconf/syshdr.unx (MAKE_ABSOLUTE): New macro. + * uuconf/tinit.c (itaddfile): Renamed from itadd. Use + MAKE_ABSOLUTE to force absolute pathnames to configuration files. + + * conn.c (fconn_close): Steve M. Robbins: Ignore any SIGHUP + received after closing the connection. + + * cu.c (main): Frank Conrad: When an alternate fails, move on to + the next one. + + * uucico.c (faccept_call): Alexei K. Yushin: Supposedly some + UUCP's send UgG rather than just Ug. + + * unix/serial.c (fsserial_lockfile): Bob Hemedinger: Fix error + message in HAVE_COHERENT_LOCKFILES case. + + * unix/mkdir.c: Andy Fyfe: Pass fkeepuid as TRUE to ixsspawn. + + * unix/strerr.c: Undefine strerror in case there is a macro + definition which configure did not pick up. + + * configure.in: Andy Fyfe: AT&T 3b1 has sys/mount.h but not + statfs. + + * uudir.c: Andy Fyfe: Include uucp.h. + + * unix/fsusg.c: Andy Fyfe: Typos in (untested) STAT_USTAT case. + + * unix/filnam.c: Eric Lee Green: Avoid generating filenames that + only differ in case, to make life easier for bad filesystems. + + * uuconf/llocnm.c: Brian J. Murrell: Don't read HDB files if + ``hdb-files no'' given. + +Sat Mar 20 16:10:20 1993 Ian Lance Taylor (ian@airs.com) + + * uudefs.h (eSendfile, eRecfile): Deleted obsolete declarations. + +Sat Feb 13 15:57:30 1993 Ian Lance Taylor (ian@airs.com) * Released version 1.04. * unix/detach.c: Andrew A. Chernov: Don't check return of setsid. -Sun Jan 31 01:45:56 1993 Ian Lance Taylor (ian@comton.airs.com) +Sun Jan 31 01:45:56 1993 Ian Lance Taylor (ian@airs.com) * cu.c (main): Pass "cu" to uuconf_init. * protz.c (fzprocess): Restore ZPAD char before calling getinsync. -Sat Jan 30 22:19:26 1993 Ian Lance Taylor (ian@comton.airs.com) +Sat Jan 30 22:19:26 1993 Ian Lance Taylor (ian@airs.com) * Makefile.in (doc-dist): New target. -Wed Jan 27 22:55:26 1993 Ian Lance Taylor (ian@comton.airs.com) +Wed Jan 27 22:55:26 1993 Ian Lance Taylor (ian@airs.com) * protg.c (fgstart): Set iGremote_segsize when using remote-packet-size. -Tue Jan 26 01:01:34 1993 Ian Lance Taylor (ian@comton.airs.com) +Tue Jan 26 01:01:34 1993 Ian Lance Taylor (ian@airs.com) * proti.c (fiprocess_data): always send an ACK after receiving half a window, rather than sometimes resending a packet. Half a @@ -28,7 +1263,7 @@ Tue Jan 26 01:01:34 1993 Ian Lance Taylor (ian@comton.airs.com) * tstuu.c (main, cread, fsend): rewrote communication routines to avoid deadlock. -Sun Jan 24 01:02:47 1993 Ian Lance Taylor (ian@comton.airs.com) +Sun Jan 24 01:02:47 1993 Ian Lance Taylor (ian@airs.com) * trans.c (ufailed): don't report statistics if no bytes transferred. @@ -36,27 +1271,27 @@ Sun Jan 24 01:02:47 1993 Ian Lance Taylor (ian@comton.airs.com) * Makefile.in (install): simplified somewhat. (dist): distribute the sample directory. -Sat Jan 23 19:47:12 1993 Ian Lance Taylor (ian@comton.airs.com) +Sat Jan 23 19:47:12 1993 Ian Lance Taylor (ian@airs.com) * configure.in, conf.h.in, tli.c: Karl Swarz: check for and use <sys/tli.h>. -Fri Jan 22 00:09:37 1993 Ian Lance Taylor (ian@comton.airs.com) +Fri Jan 22 00:09:37 1993 Ian Lance Taylor (ian@airs.com) * send.c (flocal_send_request): Alan Judge: don't send C in option string when faking an E command as an S command. -Thu Jan 21 00:09:31 1993 Ian Lance Taylor (ian@comton.airs.com) +Thu Jan 21 00:09:31 1993 Ian Lance Taylor (ian@airs.com) * uux.c (main): don't use E command if forwarding. -Wed Jan 20 00:22:38 1993 Ian Lance Taylor (ian@comton.airs.com) +Wed Jan 20 00:22:38 1993 Ian Lance Taylor (ian@airs.com) * send.c (fsend_exec_file_init), rec.c (frec_file_end), uux.c (main): Chip Salzenberg: always put the C line last in an execution file, to support Fredmail. -Tue Jan 19 00:09:43 1993 Ian Lance Taylor (ian@comton.airs.com) +Tue Jan 19 00:09:43 1993 Ian Lance Taylor (ian@airs.com) * trans.h, trans.c (ftcharge, floop, fgot_data): rewrote timing code. @@ -65,7 +1300,7 @@ Tue Jan 19 00:09:43 1993 Ian Lance Taylor (ian@comton.airs.com) (fqueue_local, fqueue_remote, fqueue_send, fqueue_receive): added boolean return value and qdaemon argument. -Mon Jan 18 00:01:46 1993 Ian Lance Taylor (ian@comton.airs.com) +Mon Jan 18 00:01:46 1993 Ian Lance Taylor (ian@airs.com) * uucico.c (fdo_call, faccept_call): Ted Lindgreen, Chip Salzenberg: wait for remote hangup string before hanging up. @@ -73,7 +1308,7 @@ Mon Jan 18 00:01:46 1993 Ian Lance Taylor (ian@comton.airs.com) * proti.c (fiprocess_data, fiprocess_packet): stop scanning input buffer after a CLOSE packet. -Sat Jan 16 22:44:28 1993 Ian Lance Taylor (ian@comton.airs.com) +Sat Jan 16 22:44:28 1993 Ian Lance Taylor (ian@airs.com) * system.h, uucico.c (main), uuxqt.c (main), unix/init.c: Ted Lindgreen: eliminated INIT_DAEMON. @@ -88,7 +1323,7 @@ Sat Jan 16 22:44:28 1993 Ian Lance Taylor (ian@comton.airs.com) * policy.h, unix/pause.c: Gregory Gulik: added HAVE_HUNDREDTHS_NAP configuration parameter. -Wed Jan 6 21:06:45 1993 Ian Lance Taylor (ian@comton.airs.com) +Wed Jan 6 21:06:45 1993 Ian Lance Taylor (ian@airs.com) * unix/serial.c (fsserial_lockfile): create HDB lock files when using HAVE_COHERENT_LOCKING. @@ -98,11 +1333,11 @@ Wed Jan 6 21:06:45 1993 Ian Lance Taylor (ian@comton.airs.com) * unix/cusub.c (fsysdep_terminal_raw): Andrew A. Chernov: if POSIX_TERMIOS, turn of IEXTEN flag. -Sat Jan 2 23:19:27 1993 Ian Lance Taylor (ian@comton.airs.com) +Sat Jan 2 23:19:27 1993 Ian Lance Taylor (ian@airs.com) * protg.c (fgprocess_data): treat a duplicate RR as an RJ. -Fri Jan 1 11:17:30 1993 Ian Lance Taylor (ian@comton.airs.com) +Fri Jan 1 11:17:30 1993 Ian Lance Taylor (ian@airs.com) * policy.h, unix/proctm.c: Steven S. Dick: use sysconf (_SC_CLK_TCK) for TIMES_TICK if possible. @@ -113,7 +1348,7 @@ Fri Jan 1 11:17:30 1993 Ian Lance Taylor (ian@comton.airs.com) unix/run.c: Karsten Thygesen: removed ffork argument from fsysdep_run. -Wed Dec 30 00:21:55 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Dec 30 00:21:55 1992 Ian Lance Taylor (ian@airs.com) * unix/link.c: Andrey G Blochintsev: don't fail just because destination directories do not exist. @@ -123,12 +1358,12 @@ Wed Dec 30 00:21:55 1992 Ian Lance Taylor (ian@comton.airs.com) * protz.c: Chip Salzenberg: reformatted to 80 columns. -Tue Dec 29 23:50:52 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Dec 29 23:50:52 1992 Ian Lance Taylor (ian@airs.com) * uuconv.c (uvwrite_time): scott@geom.umn.edu: handle midnight more correctly. -Fri Dec 18 00:49:16 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Dec 18 00:49:16 1992 Ian Lance Taylor (ian@airs.com) * system.h, uucp.c (uccopy), uux.c (main), cu.c (icuput, icutake), unix/ufopen.c (esysdep_user_fopen): Doug Evans: open files used @@ -136,7 +1371,7 @@ Fri Dec 18 00:49:16 1992 Ian Lance Taylor (ian@comton.airs.com) privileges of uucp. Added frd and fbinary arguments to esysdep_user_fopen. -Thu Dec 17 00:04:53 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Dec 17 00:04:53 1992 Ian Lance Taylor (ian@airs.com) * unix/picksb.c (zsysdep_uupick): Peter Wemm: allocation error. @@ -150,14 +1385,14 @@ Thu Dec 17 00:04:53 1992 Ian Lance Taylor (ian@comton.airs.com) (fsend_await_confirm), rec.c (frec_file_end): Peter Wemm: added fmaster argument to ustats, used only in HDB_LOGGING. -Wed Dec 16 23:35:51 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Dec 16 23:35:51 1992 Ian Lance Taylor (ian@airs.com) * uustat.c (main): Marc Unangst: forgot to call strtol for -y. * policy.h, sysh.unx: Brian J. Murrell: yet another configuration parameter: HAVE_BROKEN_SETREUID. -Tue Dec 15 00:13:04 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Dec 15 00:13:04 1992 Ian Lance Taylor (ian@airs.com) * uuconv.c (uvwrite_taylor_system): mnichols@pacesetter.com: use command-path rather than path. @@ -181,18 +1416,18 @@ Tue Dec 15 00:13:04 1992 Ian Lance Taylor (ian@comton.airs.com) FREE_SPACE_DELTA bytes, and abort the file transfer if disk space gets too low. -Wed Dec 2 00:24:12 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Dec 2 00:24:12 1992 Ian Lance Taylor (ian@airs.com) * policy.h, unix/serial.c (fsserial_set): Frank Conrad: added HAVE_PARITY_BUG parameter for the Sony NEWS. -Mon Nov 30 00:06:59 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Nov 30 00:06:59 1992 Ian Lance Taylor (ian@airs.com) * lib/spool.c (fspool_file): Andrew Chernov: accept any alphanumeric character in the name, because it could be a grade from another system. -Sun Nov 29 22:36:47 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Nov 29 22:36:47 1992 Ian Lance Taylor (ian@airs.com) * lib/buffer.c (ubuffree): scott@geom.umn.edu, Richard Gumpertz: use a temporary variable to hold the offsetof result. @@ -212,14 +1447,14 @@ Sun Nov 29 22:36:47 1992 Ian Lance Taylor (ian@comton.airs.com) * rec.c (fremote_send_reply): do file restart correctly for E commands. -Sun Nov 22 15:09:43 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Nov 22 15:09:43 1992 Ian Lance Taylor (ian@airs.com) * protz.c: Chip Salzenberg: always do bitwise operations on unsigned values. * getopt.h: Chip Salzenberg: don't rely on __STDC__. -Thu Nov 19 00:13:46 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Nov 19 00:13:46 1992 Ian Lance Taylor (ian@airs.com) * uuconf/freblk.c: Niels Baggesen: loop over the right list. @@ -227,7 +1462,7 @@ Thu Nov 19 00:13:46 1992 Ian Lance Taylor (ian@comton.airs.com) take an argument and default to showing 10 current lines. (ulusage): added new options and missing old ones. -Wed Nov 18 22:26:36 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Nov 18 22:26:36 1992 Ian Lance Taylor (ian@airs.com) * rec.c (frec_file_end): Andrey G Blochintsev: call fsysdep_remember_reception as soon as the file has been moved to @@ -239,7 +1474,7 @@ Wed Nov 18 22:26:36 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/tmpfil.c (ZDIGS): don't use '.', since we use it to separate parts of the file name. -Sun Nov 15 15:31:49 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Nov 15 15:31:49 1992 Ian Lance Taylor (ian@airs.com) * uustat.c (fsquery_show, csunits_show): Marc Unangst, Chip Salzenberg: line up uustat -q output. @@ -282,7 +1517,7 @@ Sun Nov 15 15:31:49 1992 Ian Lance Taylor (ian@comton.airs.com) * configure.in: Brian Campbell: check for /usr/bin/mailx. -Sat Nov 14 11:11:04 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Nov 14 11:11:04 1992 Ian Lance Taylor (ian@airs.com) * uuconf/hlocnm.c (uuconf_hdb_login_localname): Christian Seyb: check for _uuconf_unset as well as NULL. @@ -294,7 +1529,7 @@ Sat Nov 14 11:11:04 1992 Ian Lance Taylor (ian@comton.airs.com) and made _uuconf_unset char * to avoid possible alignment problems. -Tue Nov 10 00:16:35 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Nov 10 00:16:35 1992 Ian Lance Taylor (ian@airs.com) * trans.h, uucico.c (fcall, faccept_call), trans.c (uclear_queue, floop): Stephen J. Walick: move clean up from end of floop into @@ -305,13 +1540,13 @@ Tue Nov 10 00:16:35 1992 Ian Lance Taylor (ian@comton.airs.com) location for HAVE_SVR4_LOCKFILES. (fsserial_init): Doug Evans: null terminate the device name. -Sun Nov 8 10:58:59 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Nov 8 10:58:59 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (fcall, faccept_call): Stephen J. Walick: call usysdep_get_work_free here. trans.c (floop): don't call usysdep_get_work free here. -Sun Nov 1 17:05:07 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Nov 1 17:05:07 1992 Ian Lance Taylor (ian@airs.com) * Released gamma version 1.04. @@ -326,7 +1561,7 @@ Sun Nov 1 17:05:07 1992 Ian Lance Taylor (ian@comton.airs.com) * policy.h, unix/cohtty.c: Bob Hemedinger: finish Coherent style locking. -Wed Oct 28 00:20:15 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Oct 28 00:20:15 1992 Ian Lance Taylor (ian@airs.com) * tstuu.c: Ralf Stephan: check HAVE_POLL_H and HAVE_STROPTS_H. @@ -338,7 +1573,7 @@ Wed Oct 28 00:20:15 1992 Ian Lance Taylor (ian@comton.airs.com) requested position. uucp.c, uux.c, uuxqt.c, xcmd.c: initialize ipos field. -Sun Oct 25 10:39:23 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Oct 25 10:39:23 1992 Ian Lance Taylor (ian@airs.com) * unix/serial.c (fsysdep_conn_write, fsysdep_conn_io): T. William Wells: take special care to ensure we don't write after SIGHUP. @@ -350,7 +1585,7 @@ Sun Oct 25 10:39:23 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/cusub.c (uscu_child): Igor V. Semenyuk: accept a 0 return from read until we have read some data at some point. -Thu Oct 22 10:38:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Oct 22 10:38:32 1992 Ian Lance Taylor (ian@airs.com) * proti.c: various tweaks for bad connections. @@ -363,7 +1598,7 @@ Thu Oct 22 10:38:32 1992 Ian Lance Taylor (ian@comton.airs.com) * uuxqt.c (uqdo_xqt_file): Bob Hemedinger: don't take address of array. -Wed Oct 21 00:05:31 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Oct 21 00:05:31 1992 Ian Lance Taylor (ian@airs.com) * uustat.c (fsnotify): Gert Doering: if the file appears to be binary, don't include it in any mail message. @@ -391,7 +1626,7 @@ Wed Oct 21 00:05:31 1992 Ian Lance Taylor (ian@comton.airs.com) * uucico.c (fdo_call, faccept_call): Hans-Dieter Doll: avoid overflow when turning ulimit value into bytes. -Tue Oct 20 23:12:26 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Oct 20 23:12:26 1992 Ian Lance Taylor (ian@airs.com) * serial.c (fsmodem_carrier): Hans-Dieter Doll: use IS68K LNOMDM bit if available. @@ -403,7 +1638,7 @@ Tue Oct 20 23:12:26 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/run.c: Peter Wemm: pass fsetuid as TRUE to ixsspawn. -Sun Oct 18 13:58:17 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Oct 18 13:58:17 1992 Ian Lance Taylor (ian@airs.com) * policy.h, unix/serial.c (fsmodem_close): Stephen J. Walick: added HAVE_RESET_BUG for SCO Xenix. @@ -413,18 +1648,18 @@ Sun Oct 18 13:58:17 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/ufopen.c: Igor V. Semenyuk: handle unsigned uid_t. -Sat Oct 17 11:00:30 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Oct 17 11:00:30 1992 Ian Lance Taylor (ian@airs.com) * conf.h.in, configure.in, uucp.h, unix/serial.c (fsserial_lockfile), lib/MANIFEST: eliminated strlwr. -Fri Oct 16 01:10:56 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Oct 16 01:10:56 1992 Ian Lance Taylor (ian@airs.com) * Igor V. Semenyuk: uuchk.c (ukshow): print max-remote-debug correctly. lib/debug.c (idebug_parse): accept DEBUG_NONE. -Thu Oct 15 00:49:58 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Oct 15 00:49:58 1992 Ian Lance Taylor (ian@airs.com) * unix/cusub.c (fsysdep_terminal_puts): don't modify zalc before freeing it up. @@ -432,7 +1667,7 @@ Thu Oct 15 00:49:58 1992 Ian Lance Taylor (ian@comton.airs.com) * protg.c (fgcheck_errors, fggot_ack, fgprocess_data): Mark E. Mallett: better handling of error decay. -Wed Oct 14 22:09:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Oct 14 22:09:20 1992 Ian Lance Taylor (ian@airs.com) * unix/lock.c: Tomi Vainio: make sure SEEK_SET is defined. @@ -445,12 +1680,12 @@ Wed Oct 14 22:09:20 1992 Ian Lance Taylor (ian@comton.airs.com) lib/debug.c, unix/portnm.c, uuconf/int.c, uuconf/llocnm.c, uuconf/time.c: cast more arguments to eliminate more warnings. -Tue Oct 13 00:25:03 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Oct 13 00:25:03 1992 Ian Lance Taylor (ian@airs.com) * prot.h, proti.c (fistart, fijstart), protj.c, uucico.c, tstuu.c (uprepare_test), Makefile.in, MANIFEST: added 'j' protocol. -Sun Oct 11 23:45:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Oct 11 23:45:20 1992 Ian Lance Taylor (ian@airs.com) * policy.h, unix/serial.c (fsserial_set): added HAVE_STRIP_BUG to policy.h to get around stupid Ultrix bug. @@ -459,16 +1694,16 @@ Sun Oct 11 23:45:20 1992 Ian Lance Taylor (ian@comton.airs.com) HAVE_BSD_TTY, keep tchars and ltchars in the sterminal structure, and in fsserial_open disable all interrupt characters. -Sat Oct 10 01:18:31 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Oct 10 01:18:31 1992 Ian Lance Taylor (ian@airs.com) * uuconf/tinit.c (itunknown): Gert Doering: don't save "unknown" with the other arguments. -Fri Oct 9 00:56:43 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Oct 9 00:56:43 1992 Ian Lance Taylor (ian@airs.com) * unix/lock.c: check for running process before doing kill. -Thu Oct 8 00:20:12 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Oct 8 00:20:12 1992 Ian Lance Taylor (ian@airs.com) * chat.c, protf.c, send.c, rec.c, unix/locfil.c: Stephen J. Walick: cast arguments to strtol and strcspn to avoid warnings. @@ -485,7 +1720,7 @@ Thu Oct 8 00:20:12 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/spool.c (zsfind_file): Matthias Zepf: fixed typos for SPOOLDIR_BSD*. -Wed Oct 7 00:03:08 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Oct 7 00:03:08 1992 Ian Lance Taylor (ian@airs.com) * uuname.c (main): Marc Boucher: reverse sense of -a, and do not display aliases by default. @@ -495,7 +1730,7 @@ Wed Oct 7 00:03:08 1992 Ian Lance Taylor (ian@comton.airs.com) * tstuu.c (main): Marc Boucher: add support for STREAMS ptys. -Tue Oct 6 23:16:15 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Oct 6 23:16:15 1992 Ian Lance Taylor (ian@airs.com) * policy.h: Marc Boucher: improve comments to describe SVR4. @@ -506,7 +1741,7 @@ Tue Oct 6 23:16:15 1992 Ian Lance Taylor (ian@comton.airs.com) * uuname.c (main): Andreas Vogel: usysdep_exit (TRUE) rather than usysdep_exit (EXIT_SUCCESS). -Mon Oct 5 22:59:51 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Oct 5 22:59:51 1992 Ian Lance Taylor (ian@airs.com) * sysh.unx, unix/serial.c (fsserial_init): Marc Boucher: avoid freeing unallocated string. @@ -518,7 +1753,7 @@ Mon Oct 5 22:59:51 1992 Ian Lance Taylor (ian@comton.airs.com) (fcudo_cmd, fcudo_subcmd, uculist_fns, icuunrecogfn): T. William Wells: give reasonable error messages. -Sun Oct 4 00:03:10 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Oct 4 00:03:10 1992 Ian Lance Taylor (ian@airs.com) * */Makefile.in: T. William Wells: use ar qc rather than ar rc. @@ -566,7 +1801,7 @@ Sun Oct 4 00:03:10 1992 Ian Lance Taylor (ian@comton.airs.com) argument to zsfile_to_jobid, and pbgrade argument to zsjobid_to_file. -Sat Oct 3 11:03:13 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Oct 3 11:03:13 1992 Ian Lance Taylor (ian@airs.com) * MANIFEST, Makefile.in, lib/MANIFEST, lib/Makefile.in, lib/parse.c: moved parse.c from main directory to lib. @@ -590,7 +1825,7 @@ Sat Oct 3 11:03:13 1992 Ian Lance Taylor (ian@comton.airs.com) * uuconf/cmdarg.c: check first character to avoid calls to strcmp or strcasecmp. -Thu Oct 1 23:44:24 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Oct 1 23:44:24 1992 Ian Lance Taylor (ian@airs.com) * trans.h, uucico.c (fdo_call, faccept_call), parse.c (fparse_cmd), send.c (flocal_send_request): Gert Doering: SVR4 @@ -600,7 +1835,7 @@ Thu Oct 1 23:44:24 1992 Ian Lance Taylor (ian@comton.airs.com) * tstuu.c (main, uprepare_test): added -n switch to not destroy existing configuration files. -Fri Sep 25 00:16:35 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Sep 25 00:16:35 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgsenddata): T. William Wells: clear bytes correctly so that resending a packet doesn't get a completely incorrect size. @@ -608,14 +1843,14 @@ Fri Sep 25 00:16:35 1992 Ian Lance Taylor (ian@comton.airs.com) * send.c (usadd_exec_line): Stephen J. Walick: don't send trailing spaces on the created execute file, because it confuses Waffle. -Thu Sep 24 00:25:18 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Sep 24 00:25:18 1992 Ian Lance Taylor (ian@airs.com) * unix/jobid.c (zsjobid_to_file): Franc,ois Pinard: if the job ID is too short, return NULL rather than dumping core. unix/statsb.c (fskill_or_rejuv, isysdep_work_time): handle a NULL return from zsjobid_to_file. -Mon Sep 21 09:01:02 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Sep 21 09:01:02 1992 Ian Lance Taylor (ian@airs.com) * uuconf/init.c, uuconf/syssub.c: Lele Gaifax: moved declaration of _uuconf_unset from syssub.c to addstr.c because @@ -627,11 +1862,11 @@ Mon Sep 21 09:01:02 1992 Ian Lance Taylor (ian@comton.airs.com) * lib/Makefile.in, unix/Makefile.in: Lele Gaifax: bug in clean target. -Thu Sep 17 01:01:13 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Sep 17 01:01:13 1992 Ian Lance Taylor (ian@airs.com) * Released beta version 1.04. -Wed Sep 16 01:02:55 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Sep 16 01:02:55 1992 Ian Lance Taylor (ian@airs.com) * uux.c (main): null terminate the options list for an 'E' command. @@ -655,14 +1890,14 @@ Wed Sep 16 01:02:55 1992 Ian Lance Taylor (ian@comton.airs.com) lib/Makefile.in: use -I flags to permit compilation in a separate directory. Set up clean targets per GNU standards. -Tue Sep 15 00:07:09 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Sep 15 00:07:09 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (zget_uucp_cmd): can't set size_t variable to -1. * Makefile.in (install): don't install info files. Added new targets info and install-info. -Mon Sep 14 13:19:42 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Sep 14 13:19:42 1992 Ian Lance Taylor (ian@airs.com) * uuxqt.c (main): Gregory Bond: canonicalize the system name given by the -s argument. @@ -685,7 +1920,7 @@ Mon Sep 14 13:19:42 1992 Ian Lance Taylor (ian@comton.airs.com) fsysdep_unlock_uuxqt_dir, fsysdep_move_uuxqt_files): use .Xqtdir for first uuxqt execution, not .Xqtdir0000. -Sun Sep 13 11:51:22 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Sep 13 11:51:22 1992 Ian Lance Taylor (ian@airs.com) * trans.h, uucico.c (fdo_call, faccept_call), send.c (flocal_send_request), rec.c (flocal_rec_send_request) parse.c @@ -716,7 +1951,7 @@ Sun Sep 13 11:51:22 1992 Ian Lance Taylor (ian@comton.airs.com) minutes. Honor CYM from the remote system. Send CYM if we have something to do. -Sat Sep 12 15:47:52 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Sep 12 15:47:52 1992 Ian Lance Taylor (ian@airs.com) * Makefile.in: use $(MAKE) instead of make for recursive calls. @@ -724,7 +1959,7 @@ Sat Sep 12 15:47:52 1992 Ian Lance Taylor (ian@comton.airs.com) unix/MANIFEST, unix/Makefile.in: added esysdep_user_open to open a file with user permissions. -Fri Sep 11 00:27:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Sep 11 00:27:32 1992 Ian Lance Taylor (ian@airs.com) * uudefs.h, copy.c: added fcopy_open_file. @@ -732,7 +1967,7 @@ Fri Sep 11 00:27:32 1992 Ian Lance Taylor (ian@comton.airs.com) * configure.in, conf.h.in: check for setreuid. -Tue Sep 8 00:11:10 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Sep 8 00:11:10 1992 Ian Lance Taylor (ian@airs.com) * protf.c (ffsendcmd), prott.c (ftsendcmd): eliminate calls to alloca. @@ -743,7 +1978,7 @@ Tue Sep 8 00:11:10 1992 Ian Lance Taylor (ian@comton.airs.com) lib/Makefile.in, lib/MANIFEST: added getopt_long, and changed all calls to getopt to call getopt_long instead. -Mon Sep 7 22:26:51 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Sep 7 22:26:51 1992 Ian Lance Taylor (ian@airs.com) * getopt.h, lib/getopt.c, lib/Makefile.in: bring getopt up to glibc 1.04; call malloc instead of alloca in exchange. @@ -755,7 +1990,7 @@ Mon Sep 7 22:26:51 1992 Ian Lance Taylor (ian@comton.airs.com) * cu.c, unix/cusub.c: various minor improvements. -Sun Sep 6 20:25:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Sep 6 20:25:20 1992 Ian Lance Taylor (ian@airs.com) * uux.c (uxcopy_stdin): use getchar rather than fread to avoid SVR4 bug. @@ -766,12 +2001,12 @@ Sun Sep 6 20:25:20 1992 Ian Lance Taylor (ian@comton.airs.com) * protg.c (fgsend_control): Niels Baggesen: report sending an RJ when DEBUG_ABNORMAL. -Tue Aug 25 00:07:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Aug 25 00:07:20 1992 Ian Lance Taylor (ian@airs.com) * uuconf/time.c: Zacharias Beckman: let user defined time tables override the defaults. -Mon Aug 24 00:25:23 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Aug 24 00:25:23 1992 Ian Lance Taylor (ian@airs.com) * system.h, uuxqt.c (uqdo_xqt_file), unix/xqtsub.c (zsysdep_xqt_local_file): Jarmo Raiha: expand ~name in uuxqt.c. @@ -803,7 +2038,7 @@ Mon Aug 24 00:25:23 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/serial.c: Brian Campbell: check for B57600, B76800 and B115200 in baud rate table. -Sun Aug 23 13:05:28 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Aug 23 13:05:28 1992 Ian Lance Taylor (ian@airs.com) * chat.c (fcsend), tstuu.c (uchild): Chip Salzenberg: call sleep (2) instead of sleep (1). Hopefully this won't break any chat @@ -844,7 +2079,7 @@ Sun Aug 23 13:05:28 1992 Ian Lance Taylor (ian@comton.airs.com) when closing a modem connection. Also, retry if we time out when setting MIN. -Sat Aug 22 22:31:34 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Aug 22 22:31:34 1992 Ian Lance Taylor (ian@airs.com) * uuconf/time.c: Stephen Walick: don't require a comma between time strings, since HDB doesn't seem to. @@ -871,14 +2106,14 @@ Sat Aug 22 22:31:34 1992 Ian Lance Taylor (ian@comton.airs.com) unix/xqtfil.c: Brian J. Murrell and Don Phillips: added SPOOLDIR_SVR4. -Thu Aug 20 00:06:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Aug 20 00:06:32 1992 Ian Lance Taylor (ian@airs.com) * sysh.unx: Chiaki Ishikawa: some systems define some but not all of the S_ file mode bits. * uuchk.c (ikshow_port): Chiaki Ishikawa: display lockname. -Wed Aug 19 22:41:39 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Aug 19 22:41:39 1992 Ian Lance Taylor (ian@airs.com) * log.c (ustats): Scott Blachowicz: avoid overflow when reporting bytes per second. @@ -896,29 +2131,29 @@ Wed Aug 19 22:41:39 1992 Ian Lance Taylor (ian@comton.airs.com) ack. Added new SN8 rejection, meaning that the file has already been received. -Sat Aug 15 11:50:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Aug 15 11:50:32 1992 Ian Lance Taylor (ian@airs.com) * uuconf/time.c (itadd_span): Don Lewis: fixed bug if later span overlapped two or more earlier spans. -Thu Aug 13 00:19:50 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Aug 13 00:19:50 1992 Ian Lance Taylor (ian@airs.com) * system.h, rec.c (fremote_send_file_init, fremote_send_reply), uucico.c (fdo_call, faccept_call), uucp.c (main), uux.c (main), unix/opensr.c (zsysdep_receive_temp, esysdep_open_receive): implemented file restart. -Wed Aug 12 23:32:05 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Aug 12 23:32:05 1992 Ian Lance Taylor (ian@airs.com) * proti.c (fiprocess_data): ensure that the first argument to fgot_data is always > 0 if the second argument is > 0. -Mon Aug 10 22:43:40 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Aug 10 22:43:40 1992 Ian Lance Taylor (ian@airs.com) * trans.c (floop, ustats_failed): handle half-duplex connections and failed calls correctly. -Sun Aug 9 17:56:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Aug 9 17:56:32 1992 Ian Lance Taylor (ian@airs.com) * proti.c (firesend, fisenddata, ficheck_errors): made several changes to improve performance on a lossy line: can now shrink @@ -934,7 +2169,7 @@ Sun Aug 9 17:56:32 1992 Ian Lance Taylor (ian@comton.airs.com) * MANIFEST, Makefile.in, prot.h, uucico.c, protz.c, trans.c: Doug Evans: added Doug Evans's zmodem implementation as protocol 'a'. -Wed Aug 5 22:28:14 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Aug 5 22:28:14 1992 Ian Lance Taylor (ian@airs.com) * policy.h, uuconf.h, uucico.c (fcall), uuconf/tsinfo.c, uuconf/hsinfo.c, uuconf/syssub.c: added "max-retries" command for @@ -947,7 +2182,7 @@ Wed Aug 5 22:28:14 1992 Ian Lance Taylor (ian@comton.airs.com) protocol entry point, changed handshake successful message to display it. -Tue Aug 4 00:04:31 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Aug 4 00:04:31 1992 Ian Lance Taylor (ian@airs.com) * prot.h, uucico.c, protg.c (fbiggstart, cGshort_packets): Chip Salzenberg: added support for 'G' protocol. Added "short-packets" @@ -960,7 +2195,7 @@ Tue Aug 4 00:04:31 1992 Ian Lance Taylor (ian@comton.airs.com) * unix/spawn.c: don't close the file descriptor after dupping it. -Sun Aug 2 23:04:18 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Aug 2 23:04:18 1992 Ian Lance Taylor (ian@airs.com) * trans.c (fremote_hangup_reply): don't hangup if a file transfer is in progress. @@ -968,7 +2203,7 @@ Sun Aug 2 23:04:18 1992 Ian Lance Taylor (ian@comton.airs.com) * send.c (flocal_send_cancelled): don't pass a NULL buffer to pfsenddata. -Sun Jul 26 13:28:27 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Jul 26 13:28:27 1992 Ian Lance Taylor (ian@airs.com) * unix/work.c (fsysdep_get_work_init): return TRUE if there is no work directory. @@ -991,7 +2226,7 @@ Sun Jul 26 13:28:27 1992 Ian Lance Taylor (ian@comton.airs.com) memmove, avoiding the SCO bug and making the 'g' protocol slightly more efficient. -Sat Jul 25 14:20:30 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Jul 25 14:20:30 1992 Ian Lance Taylor (ian@airs.com) * uucp.h, uudefs.h, many other files: broke part of uucp.h out into uudefs.h, stopped including uuconf.h in uucp.h, fixed up .c @@ -1016,7 +2251,7 @@ Sat Jul 25 14:20:30 1992 Ian Lance Taylor (ian@comton.airs.com) lib/escape.c. Made all connections on Unix use the same system dependent structure. -Tue Jul 21 22:08:10 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Jul 21 22:08:10 1992 Ian Lance Taylor (ian@airs.com) * uucp.h, trans.h, uucico.c (fdo_call, faccept_call), uuxqt.c (uqdo_xqt_file), uucp.c (main), uux.c (main), uustat.c @@ -1028,7 +2263,7 @@ Tue Jul 21 22:08:10 1992 Ian Lance Taylor (ian@comton.airs.com) added E request to send file executions which only require reading from standard input. -Sat Jul 18 20:22:50 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Jul 18 20:22:50 1992 Ian Lance Taylor (ian@airs.com) * proti.c, Makefile.in, MANIFEST, prot.h, system.h, trans.h, uucico.c, prote.c, protf.c, protg.c, prott.c, trans.c, send.c, @@ -1037,31 +2272,31 @@ Sat Jul 18 20:22:50 1992 Ian Lance Taylor (ian@comton.airs.com) points. Cleaned up send and receive state machines. Removed pfgone argument from esysdep_open_send. -Fri Jul 17 09:41:05 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Jul 17 09:41:05 1992 Ian Lance Taylor (ian@airs.com) * uuxqt.c (uqdo_xqt_file): only report base name of execution file, not full name. -Thu Jul 16 00:45:06 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Jul 16 00:45:06 1992 Ian Lance Taylor (ian@airs.com) * lib/crc.c: unroll the loop a bit. * configure.in, conf.h.in, unix/init.c: updated to autoconf 0.120. -Wed Jul 15 14:45:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Jul 15 14:45:32 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconv.c, uuconf/uucnfi.h, uuconf/reliab.c, uuconf/tportc.c, uuconf/tdialc.c, uuconf/diasub.c, uuconf/hport.c, uuconf/prtsub.c, uuconf/vsinfo.c: added UUCONF_RELIABLE_FULLDUPLEX and "half-duplex" command for ports and dialers. -Mon Jul 13 16:53:04 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Jul 13 16:53:04 1992 Ian Lance Taylor (ian@airs.com) * prot.h, lib/crc.c, lib/Makefile.in, lib/MANIFEST: added icrc function to compute 32 bit CRC (from Gary S. Brown, via Doug Evans). -Sun Jul 12 21:40:15 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Jul 12 21:40:15 1992 Ian Lance Taylor (ian@airs.com) * uuconv.c (uvwrite_time): Chris Lewis: don't output two commas in a row. @@ -1069,7 +2304,7 @@ Sun Jul 12 21:40:15 1992 Ian Lance Taylor (ian@comton.airs.com) * uuconv.c (uvwrite_taylor_system, uvwrite_taylor_port): Chris Lewis: generate command "protocol", not "protocols". -Sat Jul 11 17:09:09 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Jul 11 17:09:09 1992 Ian Lance Taylor (ian@airs.com) * xcmd.c (fremote_xcmd_init): Chris Lewis: use qdaemon->puuconf, since puuconf is not defined. @@ -1083,7 +2318,7 @@ Sat Jul 11 17:09:09 1992 Ian Lance Taylor (ian@comton.airs.com) * uuconf/freblk.c, uuconf/free.c: Chris Lewis: don't define as void when ! UUCONF_ANSI_C. -Thu Jul 9 09:17:55 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Jul 9 09:17:55 1992 Ian Lance Taylor (ian@airs.com) * prot.h, uucico.c (fdo_call, faccept_call), prote.c (festart), protf.c (ffstart), protg.c (fgstart), prott.c (ftstart): no need @@ -1092,7 +2327,7 @@ Thu Jul 9 09:17:55 1992 Ian Lance Taylor (ian@comton.airs.com) * protf.c (ffawait_ack, ffawait_cksum): don't try to resend if we don't have a file. -Wed Jul 8 14:28:23 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Jul 8 14:28:23 1992 Ian Lance Taylor (ian@airs.com) * unix/srmdir.c (fsysdep_rmdir), unix/walk.c (usysdep_walk_tree): cast to char * to avoid warning. @@ -1119,7 +2354,7 @@ Wed Jul 8 14:28:23 1992 Ian Lance Taylor (ian@comton.airs.com) of jobs to do, and support connections. Added new files trans.h, trans.c, send.c, rec.c, xcmd.c, and removed old file file.c. -Mon Jun 29 15:14:15 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Jun 29 15:14:15 1992 Ian Lance Taylor (ian@airs.com) * Makefile.in: Stephen J. Walick: copy uustat.1 to uustat.$(manext), not uucp.($manext). Also try to create @@ -1128,11 +2363,11 @@ Mon Jun 29 15:14:15 1992 Ian Lance Taylor (ian@comton.airs.com) * chat.c (fcsend, fcprogram): check for NULL return from uuconf_callout. -Thu Jun 18 22:37:28 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Jun 18 22:37:28 1992 Ian Lance Taylor (ian@airs.com) * configure.in, Makefile.in: updated to autoconf 0.118. -Wed Jun 17 14:22:11 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Jun 17 14:22:11 1992 Ian Lance Taylor (ian@airs.com) * unix/serial.c (fsserial_init): add /dev if necessary to device as well as to port name. @@ -1142,12 +2377,12 @@ Wed Jun 17 14:22:11 1992 Ian Lance Taylor (ian@comton.airs.com) * cu.c (main), uucp.c (main), uux.c (main), uuxqt.c (main): don't call zsysdep_localname until we've called usysdep_initialize. -Tue Jun 16 17:42:50 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Jun 16 17:42:50 1992 Ian Lance Taylor (ian@airs.com) * unix/signal.c (usset_signal): set SA_INTERRUPT to force system calls to be interrupted on SunOS. -Mon Jun 15 15:10:24 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Jun 15 15:10:24 1992 Ian Lance Taylor (ian@airs.com) * everything: integrated uuconf library. Split out lib and unix libraries. Made many changes, including defaults for port and @@ -1155,19 +2390,19 @@ Mon Jun 15 15:10:24 1992 Ian Lance Taylor (ian@comton.airs.com) handling of HDB Permissions, new zbufalc routines to manage strings on the heap. Incorporated uuconv. -Wed Jun 10 23:51:03 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Jun 10 23:51:03 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconf/Makefile.in, uuconf/locnm.c, uuconf/llocnm.c, uuconf/hlocnm.c, uuconf/tlocnm.c: renamed uuconf_localname to uuconf_login_localname and added new uuconf_localname which doesn't need to read system information. -Tue Jun 9 14:19:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Jun 9 14:19:20 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconf/Makefile.in, uuconf/local.c: wrote uuconf_system_local. -Mon Jun 8 14:14:30 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Jun 8 14:14:30 1992 Ian Lance Taylor (ian@airs.com) * policy.h: changed description of LOCKDIR, which now need not always be defined. @@ -1176,7 +2411,7 @@ Mon Jun 8 14:14:30 1992 Ian Lance Taylor (ian@comton.airs.com) uuconf/tinit.c, uuconf/Makefile.in: added uuconf_lockdir, and ``lockdir'' command to config. -Sat Jun 6 22:07:58 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Jun 6 22:07:58 1992 Ian Lance Taylor (ian@airs.com) * configure.in: updated to autoconf 0.115, added code to set LIBOBJS. @@ -1185,13 +2420,13 @@ Sat Jun 6 22:07:58 1992 Ian Lance Taylor (ian@comton.airs.com) routines now in lib/, changed to include regular UUCP header files. -Fri Jun 5 15:31:29 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Jun 5 15:31:29 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconf/uucnfi.h, uuconf/syssub.c, uuconf/uuconv.c: always set zpubdir for every system, changed uuconf_zpubdir to const char *. -Wed Jun 3 15:15:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Jun 3 15:15:32 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconf/Makefile.in, uuconf/deblev.c, uuconf/maxuxq.c, uuconf/pubdir.c, uuconf/spool.c: wrote uuconf_debuglevel, @@ -1201,12 +2436,12 @@ Wed Jun 3 15:15:32 1992 Ian Lance Taylor (ian@comton.airs.com) * uuconf/tportc.c: default TCP ports to being fully reliable. -Mon Jun 1 17:03:22 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Jun 1 17:03:22 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconf/prtsub.c: removed uuconf_psysdep from uuconf_port. -Sun May 31 00:07:40 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun May 31 00:07:40 1992 Ian Lance Taylor (ian@airs.com) * uuconf.h, uuconf/Makefile.in, uuconf/diacod.c: wrote uuconf_dialcode. @@ -1224,7 +2459,7 @@ Sun May 31 00:07:40 1992 Ian Lance Taylor (ian@comton.airs.com) * uuconf.h, uuconf/Makefile.in, uuconf/val.c, uuconf/tval.c: wrote uuconf_validate, uuconf_taylor_validate. -Sat May 30 12:37:02 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat May 30 12:37:02 1992 Ian Lance Taylor (ian@airs.com) * system.h, sys1.unx: changed zsysdep_local_name to zsysdep_localname, and made it fatal out rather than return NULL. @@ -1246,12 +2481,12 @@ Sat May 30 12:37:02 1992 Ian Lance Taylor (ian@comton.airs.com) * configure.in, conf.h.in: check for <stddef.h>. -Fri May 29 00:03:05 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri May 29 00:03:05 1992 Ian Lance Taylor (ian@airs.com) * sysinf.c (ztranslate_system): Jac Kersing: must xstrdup the argument, since it points to a buffer that will be reused. -Thu May 28 12:42:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu May 28 12:42:20 1992 Ian Lance Taylor (ian@airs.com) * sys3.unx (zsysdep_real_file_name): Ted Lindgreen: check return value of zstilde_expand. @@ -1303,13 +2538,13 @@ Thu May 28 12:42:20 1992 Ian Lance Taylor (ian@comton.airs.com) * configure.in, conf.h.in, sysh.unx, sys1.unx: John Theus: use sv_onstack instead of sv_flags in the sigvec structure on 4.2BSD. -Wed May 27 23:23:39 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed May 27 23:23:39 1992 Ian Lance Taylor (ian@airs.com) * policy.h, sys2.unx (fsysdep_modem_no_carrier): Scott Reynolds: added HAVE_CLOCAL_BUG compilation parameter to work around problems on some serial ports. -Tue May 26 15:50:17 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue May 26 15:50:17 1992 Ian Lance Taylor (ian@airs.com) * uustat.c, uustat.1: added a bunch of options to support uuclean: -e, -i, -K, -M, -N, -W, -Q. @@ -1317,13 +2552,13 @@ Tue May 26 15:50:17 1992 Ian Lance Taylor (ian@comton.airs.com) * system.h, sys7.unx (fsysdep_privileged, fskill_or_rejuv): added fsysdep_privileged function. -Thu May 21 13:30:21 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu May 21 13:30:21 1992 Ian Lance Taylor (ian@airs.com) * uuxqt.c (uqdo_xqt_file): processing of execution file has to be case significant; this will change handling of "n" flag, which was not correctly handled before. -Wed May 20 14:22:12 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed May 20 14:22:12 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx (usysdep_detach): close the statistics file when detaching. @@ -1361,7 +2596,7 @@ Wed May 20 14:22:12 1992 Ian Lance Taylor (ian@comton.airs.com) (usysdep_walk_tree, isdir, ftw, do_ftw): added -R option to uucp to recursively copy directories. -Tue May 19 18:29:32 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue May 19 18:29:32 1992 Ian Lance Taylor (ian@airs.com) * sys3.unx: changed zsysdep_in_dir to always append the filename to the directory, even if the directory did not already exist. @@ -1369,25 +2604,25 @@ Tue May 19 18:29:32 1992 Ian Lance Taylor (ian@comton.airs.com) * sysh.unx, sys1.unx, sys3.unx, sys4.unx, sys5.unx: renamed fsdirectory_exists to fsysdep_directory. -Mon May 18 14:49:35 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon May 18 14:49:35 1992 Ian Lance Taylor (ian@airs.com) * system.h, uucp.c (main), sys6.unx (zsysdep_uuto): added -t option to uucp to emulate uuto, wrote zsysdep_uuto to do Unix dependent destination translation for uuto, added -p option to uucp as synonym for -C for uuto compatibility. -Sun May 17 22:04:09 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun May 17 22:04:09 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgexchange_init): permit a second INITB to override the segment size given in the first INITB. -Tue May 5 16:03:22 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue May 5 16:03:22 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (main, fdo_call), uucico.8: Chip Salzenberg: added -c option to uucico to not warn if invoked when the system may not be called. -Tue Apr 28 15:05:01 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Apr 28 15:05:01 1992 Ian Lance Taylor (ian@airs.com) * sysh.unx, sys2.unx (fsserial_open, fsblock): preserve file status flags. @@ -1395,7 +2630,7 @@ Tue Apr 28 15:05:01 1992 Ian Lance Taylor (ian@comton.airs.com) * protg.c (fgwait_for_packet): Heiko Rupp: only send RJ packet if there are no unacknowledged packets. -Mon Apr 27 18:56:42 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Apr 27 18:56:42 1992 Ian Lance Taylor (ian@airs.com) * system.h: added several routines for cu. @@ -1404,7 +2639,7 @@ Mon Apr 27 18:56:42 1992 Ian Lance Taylor (ian@comton.airs.com) * uux.c (main): Jose Manas: dumb bug when checking against calloc_args. -Fri Apr 24 20:32:06 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Apr 24 20:32:06 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx: changed HAVE_LONG_NAMES to HAVE_LONG_FILENAMES for new version of autoconf. @@ -1423,7 +2658,7 @@ Fri Apr 24 20:32:06 1992 Ian Lance Taylor (ian@comton.airs.com) * sys2.unx: get the right versions of major and minor. -Wed Apr 22 11:19:11 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Apr 22 11:19:11 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgsenddata, fggot_ack): Michael Haberler: the slow start after error code was essentially shrinking the window size. @@ -1440,7 +2675,7 @@ Wed Apr 22 11:19:11 1992 Ian Lance Taylor (ian@comton.airs.com) (uv2_read_systems): Michael Richardson: don't core dump if no chat script. -Tue Apr 21 00:19:47 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Apr 21 00:19:47 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (faccept_call): Chris Lewis: a successful call in should clear the number of retries. @@ -1454,24 +2689,24 @@ Tue Apr 21 00:19:47 1992 Ian Lance Taylor (ian@comton.airs.com) parity generation, input parity checking, and XON/XOFF handshaking, all to support cu. -Mon Apr 20 11:47:23 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Apr 20 11:47:23 1992 Ian Lance Taylor (ian@airs.com) * port.h, uucico.c (fdo_call), port.c (fport_dial, fmodem_dial), tcp.c (ftcp_dial): added separate zphone argument to fport_dial to support cu. -Thu Apr 16 01:15:42 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Apr 16 01:15:42 1992 Ian Lance Taylor (ian@airs.com) * bnu.c (ubadd_perm, ubadd_perm_alternate): Chris Lewis: handle a combination of Permissions entries which specify just LOGNAME with entries that specify both MACHINE and LOGNAME. -Wed Apr 15 16:11:48 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Apr 15 16:11:48 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx (usysdep_initialize, zsysdep_login_name): John Theus: don't die if can't get login name, unless it's really needed. -Tue Apr 14 12:39:18 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Apr 14 12:39:18 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (main, fcall): Petri Helenius: must relock system after detaching from terminal when trying different alternates. @@ -1505,18 +2740,18 @@ Tue Apr 14 12:39:18 1992 Ian Lance Taylor (ian@comton.airs.com) * uucp.texi: Harlan Stenn: correct case of references. -Tue Apr 7 01:02:17 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Apr 7 01:02:17 1992 Ian Lance Taylor (ian@airs.com) * Released version 1.03. -Mon Apr 6 15:49:08 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Apr 6 15:49:08 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (faccept_call): Marc Boucher: set *pqsys to NULL. * bnu.c (ubnu_read_systems, fbnu_find_port): Erik Forsberg: support multiple character modem classes. -Fri Apr 3 00:37:25 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Apr 3 00:37:25 1992 Ian Lance Taylor (ian@airs.com) * sys2.unx: Petri Helenius: only clear known bits in termio or termios structure; didn't change HAVE_BSD_TTY handling--maybe next @@ -1529,14 +2764,14 @@ Fri Apr 3 00:37:25 1992 Ian Lance Taylor (ian@comton.airs.com) * sys1.unx, chat.c: minor cleanups for gcc 2.1. -Thu Apr 2 17:51:36 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Apr 2 17:51:36 1992 Ian Lance Taylor (ian@airs.com) * tstuu.c: conditionally declare times. * uucp.h, prot.c, sysinf.c, prtinf.c: added gcc 2.0 format checking to ulog, and fixed a few problems it discovered. -Wed Apr 1 16:21:08 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Apr 1 16:21:08 1992 Ian Lance Taylor (ian@airs.com) * sys3.unx (esysdep_open_receive): David J. MacKenzie: some USG_STATFS systems use 512 as the block size of f_bfree, despite @@ -1564,7 +2799,7 @@ Wed Apr 1 16:21:08 1992 Ian Lance Taylor (ian@comton.airs.com) * uucico.8, uuxqt.8, uucp.1, uux.1: updated -x switch, cleaned up a bit. -Tue Mar 31 14:40:06 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Mar 31 14:40:06 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx (usysdep_initialize): use $PWD to get the current working directory if it's defined and correct. @@ -1579,7 +2814,7 @@ Tue Mar 31 14:40:06 1992 Ian Lance Taylor (ian@comton.airs.com) * protg.c (fgsenddata): Niels Baggesen: packet to retransmit did not get reset correctly. -Mon Mar 30 10:03:28 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Mar 30 10:03:28 1992 Ian Lance Taylor (ian@airs.com) * tcp.c (ftcp_reset): Petri Helenius: TCP server never started uuxqt, because it exited in ftcp_reset. @@ -1590,7 +2825,7 @@ Mon Mar 30 10:03:28 1992 Ian Lance Taylor (ian@comton.airs.com) * sys3.unx (esysdep_open_receive): Niels Baggesen: USG statfs has an f_bsize field. -Sun Mar 29 23:04:20 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Mar 29 23:04:20 1992 Ian Lance Taylor (ian@airs.com) * uucp.h, sysinf.c, prot.c, prote.c, protf.c, protg.c, prott.c: Niels Baggesen: added new debugging types abnormal and uucp-proto. @@ -1604,7 +2839,7 @@ Sun Mar 29 23:04:20 1992 Ian Lance Taylor (ian@comton.airs.com) fsserial_io): always block and unblock the read and write descriptors together. -Sat Mar 28 14:40:50 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Mar 28 14:40:50 1992 Ian Lance Taylor (ian@airs.com) * uustat.c: allow multiple systems and users to be specified at once; likewise for kills and rejuvenates. Allow old and young to @@ -1640,7 +2875,7 @@ Sat Mar 28 14:40:50 1992 Ian Lance Taylor (ian@comton.airs.com) * uucico.c (fuucp), log.c (ulog, ustats, ustats_close): close log and statistics file every time master and slave switch roles. -Fri Mar 27 00:31:23 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Mar 27 00:31:23 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (fdo_call): Mark Mallett: minor cleanup. @@ -1674,29 +2909,29 @@ Fri Mar 27 00:31:23 1992 Ian Lance Taylor (ian@comton.airs.com) * Makefile.in, configure.in: David J. MacKenzie: various cleanups. Changed default newconfigdir definition. Supported compilation in a different directory. Used symbolic links if available. Changed - default infordir definition per Franc,ois Pinard. + default infodir definition per Franc,ois Pinard. * policy.h: David J. MacKenzie: various cleanups. -Thu Mar 26 12:17:41 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Mar 26 12:17:41 1992 Ian Lance Taylor (ian@airs.com) * sys3.unx: reduced race condition in fsdo_lock. * sys1.unx: Gerben Wierda: various cleanups. Also don't set sa_flags to SV_INTERRUPT per Chip Salzenberg. -Wed Mar 25 22:20:24 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Mar 25 22:20:24 1992 Ian Lance Taylor (ian@airs.com) * configure.in: Overhauled for readability and functionality as suggested by T. William Wells and others. Added bug checks, including for SCO memmove and ftime. -Tue Mar 24 12:18:56 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Mar 24 12:18:56 1992 Ian Lance Taylor (ian@airs.com) * sysinf.c (uiread_systems): fixed handling of alternates in file-wide defaults. -Wed Mar 18 01:01:25 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Mar 18 01:01:25 1992 Ian Lance Taylor (ian@airs.com) * config.c (tprocess_one_cmd): handle CMDTABTYPE_FULLSTRING correctly if there are no arguments. @@ -1706,7 +2941,7 @@ Wed Mar 18 01:01:25 1992 Ian Lance Taylor (ian@comton.airs.com) * sys1.unx (usysdep_detach): open the controlling terminal in non delay mode since it might be a modem. -Tue Mar 17 00:01:53 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Mar 17 00:01:53 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (fdo_call, faccept_call): T. William Wells: set current time in status file when call completes. @@ -1718,7 +2953,7 @@ Tue Mar 17 00:01:53 1992 Ian Lance Taylor (ian@comton.airs.com) * sys2.unx (fsserial_lock, fsserial_open): don't block when opening the write descriptor. -Mon Mar 16 00:14:43 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Mar 16 00:14:43 1992 Ian Lance Taylor (ian@airs.com) * system.h, uuxqt.c (uqdo_xqt_file), sys5.unx (fsysdep_execute): pass command to fsysdep_execute as first element of argument @@ -1771,7 +3006,7 @@ Mon Mar 16 00:14:43 1992 Ian Lance Taylor (ian@comton.airs.com) maximum file transfer size; accept and ignore SVR4 -R flag meaning that the system supports file restart. -Sun Mar 15 00:21:56 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Mar 15 00:21:56 1992 Ian Lance Taylor (ian@airs.com) * sysinf.c (titime, titimegrade): permit a retry time to be specified as an optional additional argument. @@ -1798,7 +3033,7 @@ Sun Mar 15 00:21:56 1992 Ian Lance Taylor (ian@comton.airs.com) * bnu.c (fbnu_find_port): Scott Ballantyne: accept "Any" as a Device speed. -Sat Mar 14 20:52:11 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Mar 14 20:52:11 1992 Ian Lance Taylor (ian@airs.com) * uucp.h, system.h, sysh.unx, uucico.c (main, zget_typed_line), uuxqt.c (main), uucp.c (main), uux.c (main, uxcopy_stdin), tcp.c @@ -1817,7 +3052,7 @@ Sat Mar 14 20:52:11 1992 Ian Lance Taylor (ian@comton.airs.com) tstuu.c (uchild): added function isspawn, espopen and iswait and channeled all execs of new processes and waits through them. -Fri Mar 13 18:00:04 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Mar 13 18:00:04 1992 Ian Lance Taylor (ian@airs.com) * sysinf.c (uset_system_defaults): Chip Salzenberg: changed default login script timeout to 10 seconds. @@ -1828,7 +3063,7 @@ Fri Mar 13 18:00:04 1992 Ian Lance Taylor (ian@comton.airs.com) freport argument to freceive_data, and change all old calls to pass it in as FALSE. -Thu Mar 12 14:49:59 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Mar 12 14:49:59 1992 Ian Lance Taylor (ian@airs.com) * uucp.h: added a padding byte to scmd structure, since at least one compiler needs it. @@ -1850,7 +3085,7 @@ Thu Mar 12 14:49:59 1992 Ian Lance Taylor (ian@comton.airs.com) The debugging types are additive. Many source files changed. Inspired by Michael Richardson, Johan Vromans and Peter da Silva. -Wed Mar 11 12:01:03 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Mar 11 12:01:03 1992 Ian Lance Taylor (ian@airs.com) * policy.h, uuxqt.c (uqdo_xqt_file): Chip Salzenberg: support Internet mail addresses in uuxqt replies (added configuration @@ -1872,7 +3107,7 @@ Wed Mar 11 12:01:03 1992 Ian Lance Taylor (ian@comton.airs.com) Jon Zeef: if a temporary failure occurs, retry the execution later. -Tue Mar 10 12:40:30 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Mar 10 12:40:30 1992 Ian Lance Taylor (ian@airs.com) * sysh.unx, sys1.unx (isfork), sys2.unx, sys5.unx, tcp.c: Franc,ois Pinard: retry fork several times before giving up. @@ -1908,7 +3143,7 @@ Tue Mar 10 12:40:30 1992 Ian Lance Taylor (ian@comton.airs.com) parameter HAVE_TERMIOS_AND_SYS_IOCTL_H accordingly; handle it in sysh.unx. -Mon Mar 9 00:06:12 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Mar 9 00:06:12 1992 Ian Lance Taylor (ian@airs.com) * sys2.unx (fsserial_close): Franc,ois Pinard: sleep for a second after closing the serial port to give it a chance to settle. @@ -1940,7 +3175,7 @@ Mon Mar 9 00:06:12 1992 Ian Lance Taylor (ian@comton.airs.com) this status type is not used (if an attempt is made to call the system, the status is left unchanged). -Sun Mar 8 11:41:45 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Mar 8 11:41:45 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (main, flogin_prompt, faccept_call): Ted Lindgreen: if we were asked to call a single system, or if a single system @@ -1959,7 +3194,7 @@ Sun Mar 8 11:41:45 1992 Ian Lance Taylor (ian@comton.airs.com) report the port name and (for incoming calls) the login name in the log file. -Sat Mar 7 10:00:47 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Mar 7 10:00:47 1992 Ian Lance Taylor (ian@airs.com) * port.h, prtinf.c, sys2.unx (fsserial_lockfile, fsserial_lock): Peter da Silva: added ``lockname'' command to ports to permit @@ -1981,7 +3216,7 @@ Sat Mar 7 10:00:47 1992 Ian Lance Taylor (ian@comton.airs.com) * prot.h: never included more than once. -Fri Mar 6 21:53:28 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Mar 6 21:53:28 1992 Ian Lance Taylor (ian@airs.com) * uucp.h: Eric Ziegast: some systems don't define EXIT_SUCCESS or EXIT_FAILURE in stdlib.h. @@ -1993,7 +3228,7 @@ Fri Mar 6 21:53:28 1992 Ian Lance Taylor (ian@comton.airs.com) incorrect maximum possible transfer size. Added new file uutime.h. -Wed Mar 4 10:06:13 1992 Ian Lance Taylor (ian@comton.airs.com) +Wed Mar 4 10:06:13 1992 Ian Lance Taylor (ian@airs.com) * sys2.unx (fsserial_lockfile, fsserial_lock, fsysdep_modem_open, fsysdep_direct_open, fsysdep_modem_close, fsysdep_direct_close): @@ -2014,7 +3249,7 @@ Wed Mar 4 10:06:13 1992 Ian Lance Taylor (ian@comton.airs.com) * uucico.c (zget_uucp_cmd): Michael Haberler: some systems send \n after Shere, rather than a null byte. -Tue Mar 3 01:03:22 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Mar 3 01:03:22 1992 Ian Lance Taylor (ian@airs.com) * uuxqt.c (main, uqdo_xqt_file): permit local executions, don't get grade out of system dependent file name. @@ -2060,7 +3295,7 @@ Tue Mar 3 01:03:22 1992 Ian Lance Taylor (ian@comton.airs.com) with V2 or BNU configuration files, don't complain if the HAVE_TAYLOR_CONFIG files are missing. -Mon Mar 2 10:21:36 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Mar 2 10:21:36 1992 Ian Lance Taylor (ian@airs.com) * sys2.unx (fsserial_read): T. William Wells: don't arbitrarily extend read timeout. @@ -2068,14 +3303,14 @@ Mon Mar 2 10:21:36 1992 Ian Lance Taylor (ian@comton.airs.com) * uux.c (main): check iSignal before entering fread, since the user may have hit ^C earlier in the program. -Sun Mar 1 23:39:33 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Mar 1 23:39:33 1992 Ian Lance Taylor (ian@airs.com) * policy.h, uucp.h, sysh.unx, sys2.unx (fsserial_lock, fsysdep_modem_close, fsysdep_direct_close), util.c (strlwr), configure.in: Marc Unangst: added HAVE_SCO_LOCKFILES configuration parameter to force lock file names to lower case. -Fri Feb 28 00:07:12 1992 Ian Lance Taylor (ian@comton.airs.com) +Fri Feb 28 00:07:12 1992 Ian Lance Taylor (ian@airs.com) * system.h, uucico.c (faccept_call, fdo_xcmd), uuxqt.c (uqdo_xqt_file), uux.c (main), uucp.c (main, ucspool_cmds), @@ -2107,7 +3342,7 @@ Fri Feb 28 00:07:12 1992 Ian Lance Taylor (ian@comton.airs.com) setjmp. Also TIOCNOTTY sets the process group to 0, so we don't have to fork before calling it. -Thu Feb 27 00:08:09 1992 Ian Lance Taylor (ian@comton.airs.com) +Thu Feb 27 00:08:09 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx, sys6.unx, sys7.unx: added some extern definitions. @@ -2132,7 +3367,7 @@ Thu Feb 27 00:08:09 1992 Ian Lance Taylor (ian@comton.airs.com) checked at various points, notably in the port routines and in the main loops in uucico and uuxqt. -Tue Feb 25 10:59:23 1992 Ian Lance Taylor (ian@comton.airs.com) +Tue Feb 25 10:59:23 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgwait_for_packet): Bob Denny: reset the count of timeouts only when data is recognized, so that we aren't fooled by @@ -2141,7 +3376,7 @@ Tue Feb 25 10:59:23 1992 Ian Lance Taylor (ian@comton.airs.com) * sys5.unx (zsysdep_get_xqt): Bob Denny: don't warn if opendir gets ENOENT. I think POSIX requires ENOTDIR, but what can you do? -Mon Feb 24 14:37:10 1992 Ian Lance Taylor (ian@comton.airs.com) +Mon Feb 24 14:37:10 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (main, uusage): don't treat an extra argument as a port name. @@ -2169,7 +3404,7 @@ Mon Feb 24 14:37:10 1992 Ian Lance Taylor (ian@comton.airs.com) * uucp.h: John Theus: if we don't have vprintf, ulog is defined without an ellipsis, so don't declare it with one. -Sun Feb 23 14:45:53 1992 Ian Lance Taylor (ian@comton.airs.com) +Sun Feb 23 14:45:53 1992 Ian Lance Taylor (ian@airs.com) * uucp.h, system.h, bnu.c (ubnu_read_systems), config.c (fin_directory_list), sys1.unx (fsysdep_in_directory), sys5.unx @@ -2192,7 +3427,7 @@ Sun Feb 23 14:45:53 1992 Ian Lance Taylor (ian@comton.airs.com) zcalled_remote_receive fields to ssysteminfo structure for this, and handled them in all the appropriate places. -Sat Feb 22 22:30:59 1992 Ian Lance Taylor (ian@comton.airs.com) +Sat Feb 22 22:30:59 1992 Ian Lance Taylor (ian@airs.com) * Complete overhaul of configuration to use automatic shell script. Eliminated conf.h, now generated by configure. Renamed @@ -2200,12 +3435,12 @@ Sat Feb 22 22:30:59 1992 Ian Lance Taylor (ian@comton.airs.com) decisions and other choices which can not be made automatically. Many changes to many source files, none having to do with code. -Thu Feb 20 17:57:55 1992 Ian Lance Taylor (ian at comton.airs.com) +Thu Feb 20 17:57:55 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (fdo_call): Chip Salzenberg: some systems truncate the Shere= machine name to 7 characters. -Wed Feb 19 14:36:31 1992 Ian Lance Taylor (ian at comton.airs.com) +Wed Feb 19 14:36:31 1992 Ian Lance Taylor (ian@airs.com) * sys7.unx (fskill_or_rejuv): make sure that only the submitter or the superuser is permitted to cancel (or rejuvenate) a request. @@ -2223,12 +3458,12 @@ Wed Feb 19 14:36:31 1992 Ian Lance Taylor (ian at comton.airs.com) to take a time returned by isysdep_time rather than always use the current time. Changed the calls as appropriate. -Tue Feb 18 14:03:19 1992 Ian Lance Taylor (ian at comton.airs.com) +Tue Feb 18 14:03:19 1992 Ian Lance Taylor (ian@airs.com) * uuxqt.c (main): pass fdaemon argument correctly to usysdep_initialize. -Mon Feb 17 17:09:16 1992 Ian Lance Taylor (ian at comton.airs.com) +Mon Feb 17 17:09:16 1992 Ian Lance Taylor (ian@airs.com) * uuxqt.c (uqdo_xqt_file): T. William Wells: make sure sh uses absolute path of command, rather than relying on PATH. @@ -2242,7 +3477,7 @@ Mon Feb 17 17:09:16 1992 Ian Lance Taylor (ian at comton.airs.com) * sys2.unx (fsrun_chat): Bob Denny: log chat program messages as LOG_NORMAL, not LOG_ERROR. -Fri Feb 14 00:17:57 1992 Ian Lance Taylor (ian at comton.airs.com) +Fri Feb 14 00:17:57 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (ucatch), uuxqt.c (uqcatch): Neils Baggesen: under HAVE_BNU_LOGGING, don't lose the system name when dieing. @@ -2260,7 +3495,7 @@ Fri Feb 14 00:17:57 1992 Ian Lance Taylor (ian at comton.airs.com) * uucp.c (main): Niels Baggesen: abtname must be copied into memory, or it will be overwritten by the next file to be copied. -Sun Feb 9 00:12:58 1992 Ian Lance Taylor (ian at comton.airs.com) +Sun Feb 9 00:12:58 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (fuucp), prot.c (fsend_file, freceive_file): Bob Denny: call fmail_transfer before calling fsysdep_did_work, because the @@ -2272,7 +3507,7 @@ Sun Feb 9 00:12:58 1992 Ian Lance Taylor (ian at comton.airs.com) suid program uudir which sets its uid to uucp and invokes /bin/mkdir. Added rules to create uudir to Makefile. -Sat Feb 8 14:25:50 1992 Ian Lance Taylor (ian at comton.airs.com) +Sat Feb 8 14:25:50 1992 Ian Lance Taylor (ian@airs.com) * sysh.unx, sys1.unx (opendir, readdir, closedir), sys4.unx, sys5.unx: added HAVE_OLD_DIRECTORIES configuration parameter to @@ -2321,7 +3556,7 @@ Sat Feb 8 14:25:50 1992 Ian Lance Taylor (ian at comton.airs.com) related variables by macro defining them to gnu_*. This avoids conflicts with system header files and system libraries. -Fri Feb 7 12:08:42 1992 Ian Lance Taylor (ian at comton.airs.com) +Fri Feb 7 12:08:42 1992 Ian Lance Taylor (ian@airs.com) * everything: added HAVE_STRING_H and HAVE_STRINGS_H. Removed include of <string.h> in every source file and put it in uucp.h. @@ -2331,7 +3566,7 @@ Fri Feb 7 12:08:42 1992 Ian Lance Taylor (ian at comton.airs.com) * uucico.c (fcall): Bob Denny: retry time not reached is not really an error, so just make a normal log entry for it. -Sun Feb 2 01:38:47 1992 Ian Lance Taylor (ian at comton.airs.com) +Sun Feb 2 01:38:47 1992 Ian Lance Taylor (ian@airs.com) * uucp.c (main): Get the file name for the destination of a local copy using zsysdep_real_file_name rather than zsysdep_in_dir, @@ -2350,7 +3585,7 @@ Sun Feb 2 01:38:47 1992 Ian Lance Taylor (ian at comton.airs.com) be separated by more than just a single space if they are read from a V2 or BNU configuration file. -Fri Jan 31 19:51:57 1992 Ian Lance Taylor (ian at comton.airs.com) +Fri Jan 31 19:51:57 1992 Ian Lance Taylor (ian@airs.com) * protg.c: Chip Salzenberg: change default window size to 7. @@ -2360,12 +3595,12 @@ Fri Jan 31 19:51:57 1992 Ian Lance Taylor (ian at comton.airs.com) * log.c (ulog): Michael Nolan: if SIGABRT is not defined, just call abort. -Thu Jan 30 18:19:33 1992 Ian Lance Taylor (ian at comton.airs.com) +Thu Jan 30 18:19:33 1992 Ian Lance Taylor (ian@airs.com) * bnu.c (ubadd_perm): Michael Nolan: debugging check was done wrong for entry with LOGNAME but no MACHINE. -Wed Jan 29 13:28:59 1992 Ian Lance Taylor (ian at comton.airs.com) +Wed Jan 29 13:28:59 1992 Ian Lance Taylor (ian@airs.com) * uucico.c (zget_uucp_cmd): Patrick Smith: only wait a short time for the hangup string. @@ -2373,7 +3608,7 @@ Wed Jan 29 13:28:59 1992 Ian Lance Taylor (ian at comton.airs.com) * sys4.unx (iswork_cmp): Patrick Smith: fixed casts to not cast away const. -Tue Jan 28 11:06:34 1992 Ian Lance Taylor (ian at comton.airs.com) +Tue Jan 28 11:06:34 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx, sys3.unx, tstuu.c: Jay Vassos-Libove: removed some declarations of system functions that conflict with system header @@ -2384,7 +3619,7 @@ Tue Jan 28 11:06:34 1992 Ian Lance Taylor (ian at comton.airs.com) * protg.c (fgsendcmd): the previous patch wasn't really correct. -Mon Jan 27 22:30:47 1992 Ian Lance Taylor (ian at comton.airs.com) +Mon Jan 27 22:30:47 1992 Ian Lance Taylor (ian@airs.com) * log.c (ustats): Marty Shannon: don't report a failed transfer under USE_BNU_LOGGING. @@ -2403,7 +3638,7 @@ Mon Jan 27 22:30:47 1992 Ian Lance Taylor (ian at comton.airs.com) end of command which was exactly a power of two in length correctly. -Tue Jan 21 14:37:10 1992 Ian Lance Taylor (ian at comton.airs.com) +Tue Jan 21 14:37:10 1992 Ian Lance Taylor (ian@airs.com) * Released version 1.02. @@ -2411,7 +3646,7 @@ Tue Jan 21 14:37:10 1992 Ian Lance Taylor (ian at comton.airs.com) zcone_system), sys1.unx (fsysdep_run): Chip Salzenberg: have uucp and uux start up uucico -s system rather than uucico -r1. -Mon Jan 20 11:45:38 1992 Ian Lance Taylor (ian at comton.airs.com) +Mon Jan 20 11:45:38 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx (fsysdep_make_dirs): don't try to create a directory with no name. @@ -2427,7 +3662,7 @@ Mon Jan 20 11:45:38 1992 Ian Lance Taylor (ian at comton.airs.com) the .Status file if it's the wrong time to call, and upon receiving a call. -Sun Jan 19 13:29:23 1992 Ian Lance Taylor (ian at comton.airs.com) +Sun Jan 19 13:29:23 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgsendcmd, fgsenddata): Dave Platt: if the remote UUCP accepts packets larger than 64 bytes, assume it can handle @@ -2443,7 +3678,7 @@ Sun Jan 19 13:29:23 1992 Ian Lance Taylor (ian at comton.airs.com) * conf.h, uucp.h, util.c (bsearch): added HAVE_BSEARCH configuration parameter. -Sat Jan 18 17:45:28 1992 Ian Lance Taylor (ian at comton.airs.com) +Sat Jan 18 17:45:28 1992 Ian Lance Taylor (ian@airs.com) * tstuu.c (utransfer): Mike Park: don't sleep when the input buffer is full; it's too slow. @@ -2463,7 +3698,7 @@ Sat Jan 18 17:45:28 1992 Ian Lance Taylor (ian at comton.airs.com) permanently and does not remove file if request fails only temporarily. -Thu Jan 16 11:33:08 1992 Ian Lance Taylor (ian at comton.airs.com) +Thu Jan 16 11:33:08 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgsendcmd, fgsenddata): zero out unused bytes in short packets. @@ -2484,7 +3719,7 @@ Thu Jan 16 11:33:08 1992 Ian Lance Taylor (ian at comton.airs.com) * sys2.unx, tstuu.c: Mike Park: ioctl is sometimes declared varadic, so we can't declare it. -Wed Jan 15 02:03:43 1992 Ian Lance Taylor (ian at comton.airs.com) +Wed Jan 15 02:03:43 1992 Ian Lance Taylor (ian@airs.com) * sys1.unx: put \n at end of fsysdep_run error message. @@ -2520,7 +3755,7 @@ Wed Jan 15 02:03:43 1992 Ian Lance Taylor (ian at comton.airs.com) configuration files are looked up using NEWCONFIGLIB. Old style configuration files are looked up using OLDCONFIGLIB. -Mon Jan 13 00:35:43 1992 Ian Lance Taylor (ian at comton.airs.com) +Mon Jan 13 00:35:43 1992 Ian Lance Taylor (ian@airs.com) * sys3.unx: David Nugent: don't declare chmod, since it may be prototyped to take an argument that is smaller than an int. @@ -2566,7 +3801,7 @@ Mon Jan 13 00:35:43 1992 Ian Lance Taylor (ian at comton.airs.com) * sysinf.c (tisystem): Mike Park: ulog was being passed the wrong number of arguments. -Sun Jan 12 14:32:47 1992 Ian Lance Taylor (ian at comton.airs.com) +Sun Jan 12 14:32:47 1992 Ian Lance Taylor (ian@airs.com) * Eliminated CONFIG, INSTALL and THANKS. They are now included in uucp.texi. Changed README and MANIFEST accordingly. Added @@ -2580,7 +3815,7 @@ Sun Jan 12 14:32:47 1992 Ian Lance Taylor (ian at comton.airs.com) * log.c (ulog): allocate enough bytes to name file if HAVE_BNU_LOGGING is in use but zLogfile has no %s. -Sat Jan 11 12:11:56 1992 Ian Lance Taylor (ian at comton.airs.com) +Sat Jan 11 12:11:56 1992 Ian Lance Taylor (ian@airs.com) * Makefile: changed to correspond to GNU standards, according to standards.text of 24 Nov 91. @@ -2597,7 +3832,7 @@ Sat Jan 11 12:11:56 1992 Ian Lance Taylor (ian at comton.airs.com) structure to avoid bug in AIX compiler which causes it to fail to recognize an address constant containing the -> operator. -Tue Jan 7 10:22:43 1992 Ian Lance Taylor (ian at comton.airs.com) +Tue Jan 7 10:22:43 1992 Ian Lance Taylor (ian@airs.com) * Released beta 1.02. @@ -2608,7 +3843,7 @@ Tue Jan 7 10:22:43 1992 Ian Lance Taylor (ian at comton.airs.com) * sysinf.c (tadd_proto_param): Niels Baggesen: allocate number of protocol parameters based on *pc, not sIhold.cproto_params. -Sat Jan 4 16:42:21 1992 Ian Lance Taylor (ian at comton.airs.com) +Sat Jan 4 16:42:21 1992 Ian Lance Taylor (ian@airs.com) * log.c (ulog): tweaked HAVE_V2_LOGGING slightly. @@ -2639,7 +3874,7 @@ Sat Jan 4 16:42:21 1992 Ian Lance Taylor (ian at comton.airs.com) option ALLOW_FILENAME_ARGUMENTS to permit arguments that look like filenames, to allow undoing the patch I just made. -Fri Jan 3 00:44:59 1992 Ian Lance Taylor (ian at comton.airs.com) +Fri Jan 3 00:44:59 1992 Ian Lance Taylor (ian@airs.com) * system.h, uuxqt.c (uqdo_xqt_file), sys5.unx (fsysdep_xqt_check_file): David J. Fiander: make sure that if an @@ -2648,12 +3883,12 @@ Fri Jan 3 00:44:59 1992 Ian Lance Taylor (ian at comton.airs.com) * sys3.unx (fsdo_lock): remove temporary file if link fails in fsdo_lock. -Thu Jan 2 00:01:53 1992 Ian Lance Taylor (ian at comton.airs.com) +Thu Jan 2 00:01:53 1992 Ian Lance Taylor (ian@airs.com) * protg.c (fgstart, fgshutdown, fgprocess_data): count remote rejections separately from resent packets when counting errors. -Tue Dec 31 14:31:38 1991 Ian Lance Taylor (ian at comton.airs.com) +Tue Dec 31 14:31:38 1991 Ian Lance Taylor (ian@airs.com) * protg.c (fgstart): Franc,ois Pinard: forgot to initialize cGdelayed_packets. @@ -2666,13 +3901,13 @@ Tue Dec 31 14:31:38 1991 Ian Lance Taylor (ian at comton.airs.com) sent; fixed bug in freceive_data which caused to ask for the wrong number of bytes when the buffer was empty. -Mon Dec 30 23:16:48 1991 Ian Lance Taylor (ian at comton.airs.com) +Mon Dec 30 23:16:48 1991 Ian Lance Taylor (ian@airs.com) * sys2.unx (fsserial_open): Chip Salzenberg: don't turn on IXON and IXOFF initially; after all, the initialization packets might contain an XOFF character. -Sun Dec 29 00:00:42 1991 Ian Lance Taylor (ian at comton.airs.com) +Sun Dec 29 00:00:42 1991 Ian Lance Taylor (ian@airs.com) * uucp.h, prot.c (fploop): John Theus: check for EOF before reading from file to work around bug in Tektronix library. @@ -2686,7 +3921,7 @@ Sun Dec 29 00:00:42 1991 Ian Lance Taylor (ian at comton.airs.com) * log.c (zldate_and_time): wasn't allocating enough buffer space. -Sat Dec 28 01:09:58 1991 Ian Lance Taylor (ian at comton.airs.com) +Sat Dec 28 01:09:58 1991 Ian Lance Taylor (ian@airs.com) * uuxqt.c (uqdo_xqt_file): forgot to initialize zmail. @@ -2719,7 +3954,7 @@ Sat Dec 28 01:09:58 1991 Ian Lance Taylor (ian at comton.airs.com) * conf.h, uucp.h, util.c, getopt.c, tstuu.c: added HAVE_STRCHR and HAVE_INDEX to conf.h. -Fri Dec 27 01:00:41 1991 Ian Lance Taylor (ian at comton.airs.com) +Fri Dec 27 01:00:41 1991 Ian Lance Taylor (ian@airs.com) * uucico.c (fuucp): set fmasterdone correctly when running as a slave. @@ -2740,18 +3975,18 @@ Fri Dec 27 01:00:41 1991 Ian Lance Taylor (ian at comton.airs.com) parameter ``errors'' to set maximum number of errors permitted. Also made fgprocess_data only reply once per batch of data. -Thu Dec 26 17:54:54 1991 Ian Lance Taylor (ian at comton.airs.com) +Thu Dec 26 17:54:54 1991 Ian Lance Taylor (ian@airs.com) * tcp.c (ftcp_dial, itcp_port_number): Monty Solomon: cast arguments to avoid prototype errors on NeXT. -Mon Dec 23 00:16:19 1991 Ian Lance Taylor (ian at comton.airs.com) +Mon Dec 23 00:16:19 1991 Ian Lance Taylor (ian@airs.com) * uucp.h, sysinf.c, uucico.c (main, flogin_prompt, faccept_call), uuchk.c (main): David Nugent: allow debugging level to be set for a specific system. -Sun Dec 22 15:51:10 1991 Ian Lance Taylor (ian at comton.airs.com) +Sun Dec 22 15:51:10 1991 Ian Lance Taylor (ian@airs.com) * conf.h, uucp.c, sysh.unx, tcp.c, sys1.unx, sys2.unx, sys3.unx, sys5.unx, sys6.unx, tstuu.c: Monty Solomon: added HAVE_UNISTD_H to @@ -2769,7 +4004,7 @@ Sun Dec 22 15:51:10 1991 Ian Lance Taylor (ian at comton.airs.com) * uucp.h: Monty Solomon: removed prototypes for strcasecmp and strncasecmp from uucp.h, since they may be in string.h. -Sat Dec 21 16:04:58 1991 Ian Lance Taylor (ian at comton.airs.com) +Sat Dec 21 16:04:58 1991 Ian Lance Taylor (ian@airs.com) * uucp.h, uucico.c (ucatch), prot.c (fpsendfile_confirm, fprecfile_confirm, ustats_failed), file.c (fsent_file, @@ -2795,7 +4030,7 @@ Sat Dec 21 16:04:58 1991 Ian Lance Taylor (ian at comton.airs.com) * sys1.unx (fsysdep_run): use the real program name from abProgram in the error messages in fsysdep_run. -Thu Dec 19 19:02:28 1991 Ian Lance Taylor (ian at comton.airs.com) +Thu Dec 19 19:02:28 1991 Ian Lance Taylor (ian@airs.com) * uucico.c (fdo_call, faccept_call): Terry Gardner: put the length of the conversation in the ``Call complete'' log file message. @@ -2829,7 +4064,7 @@ Thu Dec 19 19:02:28 1991 Ian Lance Taylor (ian at comton.airs.com) optimized the protocol to wait for up to seven characters at a time rather than just one. -Wed Dec 18 00:12:42 1991 Ian Lance Taylor (ian at comton.airs.com) +Wed Dec 18 00:12:42 1991 Ian Lance Taylor (ian@airs.com) * sysh.unx, sys2.unx, tstuu.c: Terry Gardner: added USE_FOR_UNBLOCKED configuration parameter to support systems that @@ -2852,7 +4087,7 @@ Wed Dec 18 00:12:42 1991 Ian Lance Taylor (ian at comton.airs.com) -l option to uucico to prompt for the login name and password once and then exit. -Tue Dec 17 00:24:41 1991 Ian Lance Taylor (ian at comton.airs.com) +Tue Dec 17 00:24:41 1991 Ian Lance Taylor (ian@airs.com) * uucp.h, uucico.c, uuxqt.c, uux.c, uucp.c, config.c (uread_config), log.c (ulog): eliminated ulog_program and added @@ -2894,7 +4129,7 @@ Tue Dec 17 00:24:41 1991 Ian Lance Taylor (ian at comton.airs.com) when a serial port is opened. This will clear out a NO\sCARRIER string left by a previous dropped connection. -Mon Dec 16 11:26:17 1991 Ian Lance Taylor (ian at comton.airs.com) +Mon Dec 16 11:26:17 1991 Ian Lance Taylor (ian@airs.com) * uucico.c (main), uuxqt.c (main), tstuu.c (main, uchild): David Nugent: ignore SIGHUP in uucico and uuxqt, so that they are @@ -2905,7 +4140,7 @@ Mon Dec 16 11:26:17 1991 Ian Lance Taylor (ian at comton.airs.com) fbnu_read_dialer_info): Mike Bernson: ignore lines that begin with whitespace, fix compilation error. -Sat Dec 14 20:59:10 1991 Ian Lance Taylor (ian at comton.airs.com) +Sat Dec 14 20:59:10 1991 Ian Lance Taylor (ian@airs.com) * sys2.unx (fsserial_open): don't turn on ISTRIP initially. @@ -2932,12 +4167,12 @@ Sat Dec 14 20:59:10 1991 Ian Lance Taylor (ian at comton.airs.com) processing files just because opendir failed on one; it could just be because we don't have read permission. -Fri Dec 13 17:43:52 1991 Ian Lance Taylor (ian at comton.airs.com) +Fri Dec 13 17:43:52 1991 Ian Lance Taylor (ian@airs.com) * config.c (uprocesscmds): don't continually allocate and free the array of arguments. -Thu Dec 12 12:46:01 1991 Ian Lance Taylor (ian at comton.airs.com) +Thu Dec 12 12:46:01 1991 Ian Lance Taylor (ian@airs.com) * prot.c (fgetcmd): Franc,ois Pinard: don't bother to give an error if the final HY doesn't come in; apparently the MtXinu UUCP @@ -2962,7 +4197,7 @@ Thu Dec 12 12:46:01 1991 Ian Lance Taylor (ian at comton.airs.com) GID as well as the UID, in case anybody wants to run this as a setgid package. -Wed Dec 11 10:03:22 1991 Ian Lance Taylor (ian at comton.airs.com) +Wed Dec 11 10:03:22 1991 Ian Lance Taylor (ian@airs.com) * conf.h, uucp.h, util.c (strtol): Mark Powell: added my own version of strtol to util.c, for systems which lack it. @@ -2972,7 +4207,7 @@ Wed Dec 11 10:03:22 1991 Ian Lance Taylor (ian at comton.airs.com) already seen; otherwise the other side may assume we've already seen them while we're looking for them. -Tue Dec 10 15:42:41 1991 Ian Lance Taylor (ian at comton.airs.com) +Tue Dec 10 15:42:41 1991 Ian Lance Taylor (ian@airs.com) * conf.h, sysh.unx, log.c (ulog, ustats), tstuu.c (uprepare_test): Arne Ludwig: merged in Arne Ludwig's patches to support V2 and BNU @@ -2994,7 +4229,7 @@ Tue Dec 10 15:42:41 1991 Ian Lance Taylor (ian at comton.airs.com) file.c to log.c in preparation for supporting BNU log file routines. -Mon Dec 9 12:00:52 1991 Ian Lance Taylor (ian at comton.airs.com) +Mon Dec 9 12:00:52 1991 Ian Lance Taylor (ian@airs.com) * bnu.c (ubnu_read_systems): Arne Ludwig: the device entry for a system can be followed by a comma and a list of protocols. @@ -3017,7 +4252,7 @@ Mon Dec 9 12:00:52 1991 Ian Lance Taylor (ian at comton.airs.com) * config.c (uprocesscmds): Richard Todd: don't warn if the special "#" command is unrecognized. -Sat Dec 7 13:05:40 1991 Ian Lance Taylor (ian at comton.airs.com) +Sat Dec 7 13:05:40 1991 Ian Lance Taylor (ian@airs.com) * config.c (uprocesscmds): Franc,ois Pinard: don't limit the number of arguments to a command! @@ -3025,7 +4260,7 @@ Sat Dec 7 13:05:40 1991 Ian Lance Taylor (ian at comton.airs.com) * chat.c (fchat): handle a chat script which consists only of a single string. -Fri Dec 6 16:11:29 1991 Ian Lance Taylor (ian at comton.airs.com) +Fri Dec 6 16:11:29 1991 Ian Lance Taylor (ian@airs.com) * sys5.unx (fsysdep_execute): David J. Fiander: if execve fails with ENOEXEC, try using /bin/sh with a quoted argument. @@ -3050,7 +4285,7 @@ Fri Dec 6 16:11:29 1991 Ian Lance Taylor (ian at comton.airs.com) return a negative number, since the callers don't know how to deal with that. -Mon Dec 2 16:26:16 1991 Ian Lance Taylor (ian at comton.airs.com) +Mon Dec 2 16:26:16 1991 Ian Lance Taylor (ian@airs.com) * bnu.c (ubnu_read_systems): Dave Buck: time strings with grades were parsed in an endless loop! @@ -3065,7 +4300,7 @@ Mon Dec 2 16:26:16 1991 Ian Lance Taylor (ian at comton.airs.com) the ``protocol-parameter'' command didn't work for ports or dialers. -Sun Dec 1 09:46:12 1991 Ian Lance Taylor (ian at comton.airs.com) +Sun Dec 1 09:46:12 1991 Ian Lance Taylor (ian@airs.com) * tstuu.c: don't use the fd_set typedef at all. @@ -3079,7 +4314,7 @@ Sun Dec 1 09:46:12 1991 Ian Lance Taylor (ian at comton.airs.com) * uuchk.c (fkshow_port): Bob Izenberg: report dialer/token pairs correctly. -Sat Nov 30 17:40:00 1991 Ian Lance Taylor (ian at comton.airs.com) +Sat Nov 30 17:40:00 1991 Ian Lance Taylor (ian@airs.com) * tstuu.c: Bob Izenberg: copied over conditional definitions of EAGAIN and EWOULDBLOCK from sys2.unx. @@ -3123,7 +4358,7 @@ Sat Nov 30 17:40:00 1991 Ian Lance Taylor (ian at comton.airs.com) auto array abpubdir, since old cc didn't permit initialization of auto aggregates. -Mon Nov 25 20:56:39 1991 Ian Lance Taylor (ian at comton.airs.com) +Mon Nov 25 20:56:39 1991 Ian Lance Taylor (ian@airs.com) * tstuu.c: Bob Denny: add definitions for FD_SET, FD_ZERO and FD_ISSET. @@ -3141,12 +4376,12 @@ Mon Nov 25 20:56:39 1991 Ian Lance Taylor (ian at comton.airs.com) (fv2_find_port): Marty Shannon: the ireliable field of ports and dialers was not getting initialized. -Sun Nov 24 15:06:37 1991 Ian Lance Taylor (ian at comton.airs.com) +Sun Nov 24 15:06:37 1991 Ian Lance Taylor (ian@airs.com) * tcp.c (itcp_port_number): Michael Haberler: wasn't calling htons if passed a numeric string. -Sat Nov 23 13:43:52 1991 Ian Lance Taylor (ian at comton.airs.com) +Sat Nov 23 13:43:52 1991 Ian Lance Taylor (ian@airs.com) * Released version 1.01 to alt.sources and uunet diff --git a/gnu/libexec/uucp/Makefile.inc b/gnu/libexec/uucp/Makefile.inc index b9bac708a1ab..a40e0a35300b 100644 --- a/gnu/libexec/uucp/Makefile.inc +++ b/gnu/libexec/uucp/Makefile.inc @@ -16,9 +16,9 @@ LIBUUCP= $(.CURDIR)/../libuucp/obj/libuucp.a LIBUUCP= $(.CURDIR)/../libuucp/libuucp.a .endif -VERSION= 1.04 +VERSION= 1.05 owner= uucp -group= wheel +group= uucp bindir= /usr/bin sbindir= /usr/libexec/uucp diff --git a/gnu/libexec/uucp/NEWS b/gnu/libexec/uucp/NEWS new file mode 100644 index 000000000000..65360d57fa8e --- /dev/null +++ b/gnu/libexec/uucp/NEWS @@ -0,0 +1,119 @@ +Changes in version 1.05: + + As usual, many bugs were fixed. + + Support was added for the UUPC/extended 'v' protocol. + + Initial hardware flow control support was added, contributed by + Peter Wemm. + + A new port type, ``pipe'', was added; this sends data to a program + such as rlogin, and was contributed by Marc Boucher. + + The programs all now accept long option names with a leading --. + They all support --help and --version. + + uuxqt now saves execution files it can not parse in + $(SPOOLDIR)/.Corrupt. + + If a received file can not be moved to the final location, and + there is enough disk space, it is kept in the spool directory. + + A run-uuxqt command was added to config, to permit specifying when + uuxqt should be run. + + The 'i' protocol has a new ack-frequency protocol parameter. The + remote-window protocol parameter was removed, as it did not work + correctly. + + Chat scripts now permit /W in an expect string to set the timeout. + + TCP ports now support the ``dialer-sequence'' command. + + Direct ports now support the ``carrier'' command. + + Some support was added to read UUCP passwords from /etc/passwd, + and to use encrypted passwords. + + uucico now accepts a -C argument to only call a system named by -S + or -s if there is work for it. + + uucico accepts a -i TLI argument to use TLI I/O calls on standard + input. + + uucico accepts a -u argument to set the user name. + + uucico accepts a -z argument to try the next alternate if a call + fails. + + uustat accepts a -R argument to rejuvenate each listed job. + + Mailer configuration was moved from configure checking to + policy.h. + + Support was added for QNX, contributed by Joe Wells. + +Changes in version 1.04: + +IMPORTANT: the default when talking to another version of 1.04 is to +use the new bidirectional 'i' protocol. If you are using a +half-duplex modem, such as a Telebit T2500, you will want to either +mark the port as half-duplex with the ``half-duplex'' command, or +force use of the 'g' protocol by using the ``protocol'' command in the +sys or port file or by adding ``,g'' after the port name in the +Systems or L.sys or Devices file. + + As usual, many bugs were fixed. + + Bidirectional transfers are supported with the new 'i' protocol; + it requires an eight-bit clear datapath. + + New programs: uusched, cu, uuto and uupick. + + The 'G' protocol and a new Zmodem protocol were added. + + A number of uustat options were added to support uuclean, and a + sample uuclean shell script was added to the contrib directory. + The uustat output formats were changed slightly. + + A protocol extension eliminates transfer of the command file for + simple commands, such as rmail or rnews, when talking to another + version of 1.04. + + Some TLI support was added. + + UUCP forwarding was added, along with the ``forward-to'', + ``forward-from'' and ``forward'' commands. + + If a file transfer fails in the middle, the retry will now start + from where it left off. The implementation is compatible with + SVR4. + + The work queue is checked every 10 minutes during a conversation; + if there is new work and a bidirectional protocol is not in use, + the receiving uucico requests the sender to transfer control. + + The amount of free disk space is checked periodically as a file is + received, and if it drops too low the call is aborted. + + The UUCP configuration file reading routines were moved into a + standalone library, uuconf. All known bugs in V2 and HDB + configuration file reading were fixed. + + The ``half-duplex'' command was added for the port and dialer + files. + + The ``max-retries'', ``success-wait'', ``send-request'' and + ``receive-request'' commands were added for the sys file. The + ``call-request'' and ``called-request'' commands were eliminated + (they did not work correctly anyhow). + + \d in chat scripts now calls sleep (2) rather than sleep (1), so + it will sleep longer (on some systems sleep(1) may delay much less + than one second). + + SPOOLDIR_SVR4 was added for SVR4 style spool directories. + + Defaults are now permitted in the port and dialer files. + + The ALIAS field is supported in the HDB Permissions file. diff --git a/gnu/libexec/uucp/README b/gnu/libexec/uucp/README index bfcd46c3f2ae..8d69444fd62f 100644 --- a/gnu/libexec/uucp/README +++ b/gnu/libexec/uucp/README @@ -1,8 +1,8 @@ -This is the README file for version 1.04 of the Taylor UUCP package. +This is the README file for version 1.05 of the Taylor UUCP package. It was written by Ian Lance Taylor. I can be reached at ian@airs.com, -or, equivalently, uunet!cygint!airs!ian, or c/o Cygnus Support, 4th -Floor, Building 200, 1 Kendall Square, Cambridge MA, 02139, USA. +or, equivalently, uunet!cygint!airs!ian, or c/o Cygnus Support, +Building 200, 1 Kendall Square, Cambridge MA, 02139, USA. There is a mailing list for discussion of the package. To join (or get off) the list, send mail to taylor-uucp-request@gnu.ai.mit.edu. @@ -11,6 +11,10 @@ joining the list, make sure you include the address at which you want to receive mail in the body of your message. To send a message to the list, send it to taylor-uucp@gnu.ai.mit.edu. +Jeff Ross has volunteered to maintain patches for UUCP releases. They +may be obtained via anonymous FTP from ftp.fdu.edu, in the directory +pub/taylor-uucp. + This package is covered by the Gnu Public License. See the file COPYING for details. If you would like to do something with this package that you feel is reasonable but you feel is prohibited by the @@ -25,8 +29,7 @@ uupick, and cu, as well as uuchk (a program to check configuration files), uuconv (a program to convert from one type of configuration file to another) and tstuu (a test harness for the package). -The Free Software Foundation plans to make this their standard UUCP -package. +This is the standard UUCP package of the Free Software Foundation. The package currently supports the 'f', 'g' (in all window and packet sizes), 'G', 't' and 'e' protocols, as well a Zmodem protocol and two @@ -77,80 +80,13 @@ If you start using this package, I suggest that you join the mailing list (see above) to keep up to date on patches and new versions. I am also open to suggestions for improvements and modifications. -CHANGES SINCE 1.03 - -For a complete list, see ChangeLog. - -IMPORTANT: the default when talking to another version of 1.04 is to -use the new bidirectional 'i' protocol. If you are using a -half-duplex modem, such as a Telebit T2500, you will want to either -mark the port as half-duplex with the ``half-duplex'' command, or -force use of the 'g' protocol by using the ``protocol'' command in the -sys or port file or by adding ``,g'' after the port name in the -Systems or L.sys or Devices file. - - As usual, many bugs were fixed. - - Bidirectional transfers are supported with the new 'i' protocol; - it requires an eight-bit clear datapath. - - New programs: uusched, cu, uuto and uupick. - - The 'G' protocol and a new Zmodem protocol were added. - - A number of uustat options were added to support uuclean, and a - sample uuclean shell script was added to the contrib directory. - The uustat output formats were changed slightly. - - A protocol extension eliminates transfer of the command file for - simple commands, such as rmail or rnews, when talking to another - version of 1.04. - - Some TLI support was added. - - UUCP forwarding was added, along with the ``forward-to'', - ``forward-from'' and ``forward'' commands. - - If a file transfer fails in the middle, the retry will now start - from where it left off. The implementation is compatible with - SVR4. - - The work queue is checked every 10 minutes during a conversation; - if there is new work and a bidirectional protocol is not in use, - the receiving uucico requests the sender to transfer control. - - The amount of free disk space is checked periodically as a file is - received, and if it drops too low the call is aborted. - - The UUCP configuration file reading routines were moved into a - standalone library, uuconf. All known bugs in V2 and HDB - configuration file reading were fixed. - - The ``half-duplex'' command was added for the port and dialer - files. - - The ``max-retries'', ``success-wait'', ``send-request'' and - ``receive-request'' commands were added for the sys file. The - ``call-request'' and ``called-request'' commands were eliminated - (they did not work correctly anyhow). - - \d in chat scripts now calls sleep (2) rather than sleep (1), so - it will sleep longer (on some systems sleep(1) may delay much less - than one second). - - SPOOLDIR_SVR4 was added for SVR4 style spool directories. - - Defaults are now permitted in the port and dialer files. - - The ALIAS field is supported in the HDB Permissions file. - DOCUMENTATION The documentation is in the file uucp.texi, which is a Texinfo file. Texinfo is a format used by the Free Software Foundation. You can print the documentation using TeX in combination with the file texinfo.tex. DVI, PostScript and info versions of the documentation -are available in a separate package, uucp-doc-1.04.tar.Z. +are available in a separate package, uucp-doc-1.05.tar.gz. See the TODO file for things which should be done. Please feel free to do them, although you may want to check with me first. Send me @@ -174,7 +110,7 @@ The compilation instructions are in uucp.texi. Here is a summary. what is available on your system, so if your system is at all unusual you will need to pass in $CC and $LIBS correctly. - The configure script will create conf.h from conf.h.in and + The configure script will create config.h from config.h.in and Makefile from Makefile.in. It will also create config.status, which is a shell script which actually creates the files. Please report any configuration problems, so that they can be fixed in @@ -195,7 +131,23 @@ The compilation instructions are in uucp.texi. Here is a summary. use -posix, instead I run gcc with -D_POSIX_SOURCE, and add -lcposix to LIBS. - Examine conf.h and Makefile to make sure they're right. + On some versions of BSDI there is a bug in the shell which causes + the default value for CFLAGS to be set incorrectly. If ``echo + ${CFLAGS--g}'' echoes ``g'' rather than ``-g'', then you must set + CFLAGS in the environment before running configure. There is a + patch available from BSDI for this bug. (From David Vrona). + + On AIX 3.2.5, and possibly other versions, cc -E does not work, + reporting ``Option NOROCONST is not valid.'' Test this before + running configure by doing something like + touch /tmp/foo.c + cc -E /tmp/foo.c + This may give a warning about the file being empty, but it should + not give the ``Option NOROCONST'' warning. The workaround is to + remove the ",noroconst" entry from the "options" clause in the + "cc" stanza in /etc/xlc.cfg. (From Chris Lewis). + + Examine config.h and Makefile to make sure they're right. Edit policy.h for your local system. @@ -204,4 +156,7 @@ The compilation instructions are in uucp.texi. Here is a summary. Use ``uuchk'' to check configuration files. You can use ``uuconv'' to convert between configuration file formats. - Type ``make install'' to install. + Type ``make install'' to install. Note that by default the + programs are compiled with debugging information, and they are not + stripped when they are installed. Read the man page for strip for + more information. diff --git a/gnu/libexec/uucp/TODO b/gnu/libexec/uucp/TODO index a1cc643ab52f..a0e96bfdc8cc 100644 --- a/gnu/libexec/uucp/TODO +++ b/gnu/libexec/uucp/TODO @@ -92,11 +92,6 @@ UUCP protocols to do file transfers. This would allow ftp work to be done late at night, and allow neighbors of cooperative Internet sites to use UUCP forwarding for anonymous FTP. -31. - -David Nugent: add a -C option to uucico to only call the system if -there is work to do. - 32. It would be nice if uucico could sleep until a line was available. @@ -194,11 +189,6 @@ expect strings. Use POSIX fcntl locks when possible instead of creating a lock file. -130. - -Chip Salzenberg: BSD lets you override the timeout for a particular -expect string by using a trailing ~. - 138. T. William Wells: BNU apparently uses a file named A.whatever to hold @@ -323,20 +313,6 @@ system and command locks, and do any other type of file. Scott Blachowicz: provide some sort of include mechanism for the configuration files. -162. - -Chris Lewis: add uuxqtpolicy command, probably in config, supporting -the following values which determine when uuxqt should be run: - - never (let cron or something else worry about it) - - perinvocation (when uucico exits for good - current behaviour) - - persite (when uucico terminates a conversation - HDBish) - - periodic (per 5 or 10 incoming X. files - BSDish) - - perturnaround? - -163. - -Sort jobs in the send queue by size. Pretty easy. - 164. Ed Carp: preserve files if uuxqt execution fails. @@ -349,11 +325,6 @@ Marc Sheldon: use exit codes from <sysexits.h> in uux and uucp. Chip Salzenberg: allow chat failure strings to specify a retry time. -167. - -Gregory Bond: allow a dialer sequence for a TCP port, so you can make -a TCP connection to a modem and then dial out. - 168. Jose A. Manas: allow a maximum connect time, after which we try to @@ -421,14 +392,6 @@ number''. Don Phillips: should there be some way to restrict of grade of transfers even when the other system places the call? -179. - -Nickolay Saukh: add something to chat scripts to specify the timeout -for an expect string, e.g. AT\c OK\W3 to wait for 3 seconds. Except -that perhaps the unit should not be seconds. Berkeley apparently uses -~number, not \W number, but I don't see any reason to prevent use of -the ~ character in an expect string. - 180. Nickolay Saukh: if we have received a partial file, request the remote @@ -451,12 +414,6 @@ statement. Optionally check for interrupts in fcopy_file, since it can take a long time to copy a file named in a uucp request. -184. - -Ian Moran: if an attempt is made to a copy a file to a directory which -denies write permission, perhaps the file should be saved somewhere. -It must be saved in a private location, though. - 185. A syntax error in a command received from the remote system should not @@ -536,11 +493,6 @@ to do, and then try again later. This would require a protocol extension. I don't know if it's worth it. The code should be checked to see how well it handles a disk full situation. -196. - -For real adjustability, provide some mechanism for picking the lead -characters to use for the shell scripts, between : and #!. - 197. Try alternate IP addresses if there are any. @@ -571,3 +523,220 @@ Bill Foote: have uuchk check whether a system is defined more than once. 203. + +Eric Ziegast: allow specification of the minimum grade to receive, as +well as the maximum grade. Probably sending a second character after +the -pM argument would work fine. + +204. + +Tom Rushworth: perhaps there should be some program which can be used +to retrieve the current spool directory. Perhaps on option on uustat. + +207. + +James B. O'Connor: use additional messages in the status file when +placing a call, such as Dialing, Chatting, and the like. Slightly +less efficient. + +208. + +When checking whether a file may be received into a directory, perhaps +uucico should check using the real user ID rather than insisting that +the directory be world writable. This should be a policy.h parameter. +This would enable sites which use different uids for each incoming +UUCP login to have better control over security. + +209. + +Jon Vos: add an alias command for ports. + +210. + +Joe Wells: I'd like to have a way so that if the dial chat fails due +to "NO CARRIER", in addition to this log message: + + ERROR: Chat script failed: Got "NO\sCARRIER" + +I would get another log message right next to it that would look like +this: + + ERROR: Chat script failed: 5 "RRING" strings seen + +Ian: I doubt this is worth implementing in uucico, but it might make +sense for an external, or otherwise more independent and controllable, +chat program. + +211. + +Joe Wells: In some cases it would be nice to be able to change the set +of chat-fail strings in the middle of the chat script. Personally, I +think this is too complex for the simple chat scripts currently +implemented. + +212. + +Joe Wells: There should be an option to all programs directing them to +send all debugging output to the log file. This would just involve +calling ulog_to_file at some point just after reporting any usage +messages. + +213. + +Joe Wells: There should be a way to specify the execution directory +used by uuxqt. This would avoid certain sorts of permissions +problems. Some mechanism would still be needed for using multiple +directories. + +214. + +Joe Wells: uuto should be documented. + +215. + +Joe Wells: Perhaps it should be possible to use multiple spool +directories. It would be a lot of work, though. + +216. + +Joe Wells: It should be possible to specify only one of complete or +abort. + +217. + +Dan Everhart: It would be nice if the chat-fail string could affect +the error message reported by uustat, so that uustat could say +something ``Line was busy''. + +218. + +Andrew A. Chernov: Add a chat-char-delay xx configuration parameter, +which has the effect of adding \p after each character, with delay xx. +This is to accommodate modems which can't accept command characters at +a given baud rate. + +219. + +Gert Doering: Provide some mechanism for specifying the maximum length +of a call. Convenient for anonymous UUCP sites. + +220. + +Joe Wells: There should be some way for "cu" to obey user commands +during the dial chat. Right now, the only thing the user can do is +send signals (e.g. type Control-C). This leads to user complaints +that "cu" is not obeying its documentation. + +221. + +Joe Wells: Right now, if there is any failure in the dial or login +chat scripts, the remote system alternate is skipped even though the +cause of the failure may have been the local serial port or modem. +"uucico" will not try another modem with the same remote system +alternate. If the remote system only has one alternate, then it is +skipped entirely. + +Thus, there should be a way to specify that when certain expect +strings are not seen or certain chat-fail strings are seen that the +port is skipped instead of the remote system alternate. + +222. + +Richard H. Gumpertz: Support pipelines in uuxqt. Right now they are +only supported if uux puts in an 'e' line (which it does) and shell +executions are permitted (which they normally are not). It would be +possible to permit restricted pipelines by handling the pipe character +specially and making sure all commands in the pipeline were permitted. + +223. + +Bill Sommerfeld: When dialing out, set the status to DIALING rather +than CONNECTION CLOSED. Setting the status takes a bit of time; it's +hard to tell where the right break-even point is. + +224. + +Joe Wells: Keep track of the last successful incoming call separately +from the last successful outgoing call. Currently the two times are +both put together in the status file. + +225. + +Joe Wells: It would be nice if uustat would provide a way to avoid +bouncing mail that it sent itself, to avoid sending notification +e-mail for notification e-mail. I can't think of a mechanism, though +(using a special grade for uustat does not work because most mail +programs do not provide a mechanism for passing a grade through to +uux). + +226. + +Joe Wells: It would be nice if uustat could know whether it had sent +mail for a particular job, to avoid generating multiple messages for +the job. + +227. + +Joe Wells: It would be nice if dialcode suffixes were supported, as +well as prefixes. + +228. + +Joe Wells: It would be nice to support another spool directory scheme +which split stuff up more to avoid very large directories. This would +be most useful for the files which are named in C. and X. files, +rather than for the C. and X. files themselves (since C. and X. files +are rarely looked up by name). Basically, some sort of partition of +the D. directory is called for. + +229. + +Joe Wells: ``It would be nice if the exit sequence of "cu", where it +runs the complete chat script and then disconnects could be aborted +without disconnecting. (Yes, I know, this is a strange desire.) It +would be nice to be able to reinvoke the dial chat by user command in +"cu". It would be nice to be able to invoke an arbitrary named chat +script in "cu".'' + +230. + +Kevin Johnson: Provide some mechanism such that all requests to a +particular system were automatically forwarded through some other +system. This would be useful to hide details of a non-strongly- +connected network, particularly if the details were subject to change. + +231. + +Gert Doering: Perhaps it should be possible to -r the default for uucp +and uux. This would require adding a new option to force the +invocation of uucico. + +232. + +Mark Davies: spaces are not handled correctly in the -a argument of +uux. If an E command is generated, the requestor address is not +quoted correctly, nor is it parsed correctly. If an execution file is +generated, the R line is not parsed correctly. + +233. + +Emmanuel Mogenet: provide some mechanism for a maximum number of +garbage bytes during a chat script before giving up. + +234. + +Scott Ballantyne: The address for a TCP port should be separate from +the phone number, so that a TCP dialer can use \D. + +235. + +Peter Wemm: The 'i' protocol default parameters do not work at 2400 +baud, because the time it takes to transfer half the packets is less +than the timeout time. Of course people can always change the +parameters, but it would be nice if this were dealt with somehow. + +236. + +Andrew A. Chernov: Perhaps uuxqt should log when it terminates. + +237. diff --git a/gnu/libexec/uucp/VERSION b/gnu/libexec/uucp/VERSION index 99fd8f0eef77..f940c9bc0bc7 100644 --- a/gnu/libexec/uucp/VERSION +++ b/gnu/libexec/uucp/VERSION @@ -1,4 +1,4 @@ -Version 1.04 +Version 1.05 a complete, unmodified version of this program is available from prep.ai.mit.edu. 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; - - /* 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) + struct uuconf_dialer *q; + struct uuconf_dialer s; + const char *ztoken; + boolean ftranslate; + + 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; + } + + 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; - if (*pz != NULL) - ++pz; + 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; - - /* This computation will not overflow provided csecs < 2147483 - and cbytes and cbps both fit in a long. */ + long cmillis, cdiv, crem; + + /* 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; diff --git a/gnu/libexec/uucp/contrib/Makefile.uurt b/gnu/libexec/uucp/contrib/Makefile.uurt index 235fcca889f8..39922d5cb319 100644 --- a/gnu/libexec/uucp/contrib/Makefile.uurt +++ b/gnu/libexec/uucp/contrib/Makefile.uurt @@ -1,30 +1,40 @@ +# $Id: Makefile.uurt,v 1.2 1994/05/07 18:09:19 ache Exp $ +# Makefile for uurate 1.10 # -# Makefile for uurate 1.0 -# + +# Prefix directory for installation directories. +prefix = /usr/local + +# Directory where the needed .h files are installed (uucp.h ...). +uucpsrcs = ../ # Where uurate is installed -BIN=/usr/local/bin +BIN=$(prefix)/bin +# Where uurate's man is installed +MAN=$(prefix)/man/man1 + +# The directory to look in for Taylor style configuration files +newconfigdir = $(prefix)/conf/uucp # Flags to use when compiling uurate -CFLAGS=-I.. +CC=gcc -O2 +CFLAGS=-I.. -Wall +LDFLAGS=-s -CC=cc SHELL=/bin/sh PROGS=uurate #----------- +MORECFLAGS= -I. -I$(uucpsrcs) -DNEWCONFIGLIB=\"$(newconfigdir)\" all: $(PROGS) +uurate: uurate.c + $(CC) $(CFLAGS) $(MORECFLAGS) $@.c -o $@ $(LDFLAGS) + install: $(PROGS) - @for i in $(PROGS) ; do \ - echo "Install $$i into $(BIN)..." ; \ - cp $$i $(BIN) ; \ - echo "Set ownership and protection..." ; \ - /bin/chmod 0555 $(BIN)/$$i ; \ - /bin/chown bin $(BIN)/$$i ; \ - /bin/chgrp bin $(BIN)/$$i ; \ - done + cp $(PROGS) $(BIN) + cp uurate.man $(MAN)/uurate.1 clean: rm -f $(PROGS) core diff --git a/gnu/libexec/uucp/contrib/README b/gnu/libexec/uucp/contrib/README index c4105ed03868..8e4651a9bbd2 100644 --- a/gnu/libexec/uucp/contrib/README +++ b/gnu/libexec/uucp/contrib/README @@ -3,6 +3,11 @@ This is the README file for the Taylor UUCP contrib directory. This directory contains contributed shell scripts and programs that you may find useful. +Not actually included here, but nonetheless useful, is the TUA program +distributed by Lele Gaifax <lele@nautilus.sublink.org>. It can do +various sorts of analysis of any type of UUCP log file. It should be +available from most FTP sites. + xchat.c, xchat.man, README-XCHAT, xc-conf.h-dist, Makefile.xchat: A program by Bob Denny that may be invoked by the ``chat-program'' command for any of the various types of chat scripts. It is @@ -13,9 +18,16 @@ xchat.c, xchat.man, README-XCHAT, xc-conf.h-dist, Makefile.xchat: Dial.Hayes, Hangup.Hayes, Login.LAT, Login.PortSel, Login.VMS: Sample scripts for xchat. +uucomp.shar + A set of programs which automatically compresses outgoing data in + the spool directory. The remote system must cooperate when using + this. It can cut down on phone usage when applicable. + Contributed by Ed Carp. + uurate.c, uurate.man, README-UURATE, Makefile.uurt: A nifty little program by Bob Denny which analyzes the Log and - Stats file and prints various sorts of reports. + Stats file and prints various sorts of reports. This version was + tweaked by Stephan Niemz and Klaus Dahlenburg. uutraf: Another program to produce neat reports from your log files, this @@ -28,9 +40,10 @@ savelog.sh, savelog.man: is originally from smail. It was written by Ronald S. Karr and Landon Curt Noll, and was given to me by Bob Denny. -uureroute: - A perl script reroute all mail queued up for one host to another. - Written by Bill Campbell and contributed by Francois Pinard. +uureroute.perl: + A perl script to reroute all mail queued up for one host to + another. Written by Bill Campbell and contributed by Francois + Pinard. stats.sh: A gawk script by Zacharias Beckman which reads the Stats file and @@ -39,6 +52,29 @@ stats.sh: uuq.sh: A uuq workalike shell script by Zacharias Beckman. +uupoll.shar: + uupoll and autopoll programs contributed by Klaus Dahlenburg. + uupoll can be used to automatically poll all systems, or a list of + systems; autopoll will poll and then retry failed calls. + +uudemon.shar: + An implementation of the HDB uudemon.poll script by Donald Burr. + +uuxconv: + A program by Richard E. Nickle to help convert SPOOLDIR_HDB spool + directories to SPOOLDIR_TAYLOR spool directories (note that it is + not necessary to convert your spool directories at all; the + SPOOLDIR_TAYLOR approach may be slightly more efficient). + +dialHDB.c: + A program by Daniel Hagerty which permits using HDB dialer + programs as chat programs. + +amiga.c: + A wrapper program to run uucico from a cron table under Amiga + SVR4 (apparently a wrapper is required). This was contributed by + Lawrence E. Rosenman. + tstout.c: A program to remove a user from utmp and wtmp, essentially logging them out. I put this together from BSD code. I need it to use diff --git a/gnu/libexec/uucp/contrib/README-UURATE b/gnu/libexec/uucp/contrib/README-UURATE index 2cc361ce26fb..0ef637514a5b 100644 --- a/gnu/libexec/uucp/contrib/README-UURATE +++ b/gnu/libexec/uucp/contrib/README-UURATE @@ -1,20 +1,21 @@ -uurate V1.2 - Gather and display Taylor UUCP traffic statistics +uurate V1.10 - Gather and display Taylor UUCP traffic statistics -Bob Denny (denny@alisa.com) - Thu Sep 3 19:47:41 1992 +Bob Denny (denny@alisa.com) - Thu Sep 3 19:47:41 1992 (V1.2.1) +Klaus Dahlenburg (kdburg@incoahe.hanse.de) - Tue Sep 28 18:11:34 CET 1993 See the man page for documentation. Installation: ------------ -(1) Copy Makefile.uurt to Makefile. +(1) Copy or sym-link Makefile.uurt to Makefile. -(2) Edit Makefile: set BIN where you want uurate to be installed, and - set CFLAGS to point to the directory containing the UUCP sources - (this is .. by default). +(2) Edit Makefile: set BIN where you want uurate to be installed, + MAN where the man page should go to, and set CFLAGS to point + to the directory containing the UUCP sources (this is .. by + default). Don't forget to set newconfigdir= to point to the + directory where the (Taylor-uucp)config is stored. (3) Type ``make'' to compile the program. (4) Type ``make install'' to install the program. - -(5) Install the man page if you want. I didn't put that into the Makefile. diff --git a/gnu/libexec/uucp/contrib/amiga.c b/gnu/libexec/uucp/contrib/amiga.c new file mode 100644 index 000000000000..d982364cfd57 --- /dev/null +++ b/gnu/libexec/uucp/contrib/amiga.c @@ -0,0 +1,43 @@ +/* Wrapper code for Taylor UUCP on Amiga Unix (SVR4) for cron invoked UUCP */ +/* processes. */ + +/* The problem: Cron is not a "licensed" process. any process that grabs a + controlling terminal needs to be licensed. Taylor UUCP needs controlling + terminals. Taylor UUCP does relinquish the controlling terminal before + fork(), so the "UUCP" license is appropriate. + This simple program does the "right" thing, but *MUST* be SETUID ROOT */ + +/* Written by: Lawrence E. Rosenman <ler@lerami.lerctr.org> */ + +#include <sys/sysm68k.h> +#include <sys/types.h> +#include <stdio.h> +#include <errno.h> +#include <unistd.h> +#include <pwd.h> + +int main(int argc,char *argv[],char *envp) +{ + struct passwd *pw; + char name[256]; + + strcpy(name,"/usr/local/lib/uucp/uucico"); + if (sysm68k(_m68k_LIMUSER,EUA_GET_LIC) == 0 ) { /* are we unlicensed? */ + if (sysm68k(_m68k_LIMUSER,EUA_UUCP) == -1) { /* yes, get a "uucp" license */ + fprintf(stderr,"sysm68k failed, errno=%d\n",errno); /* we didn't? crab it */ + exit(errno); + } + } + + pw = getpwnam("uucp"); /* get the Password Entry for uucp */ + if (pw == NULL) + { + fprintf(stderr,"User ID \"uucp\" doesn't exist.\n"); + exit(1); + } + setgid(pw->pw_gid); /* set gid to uucp */ + setuid(pw->pw_uid); /* set uid to uucp */ + argv[0]=name; /* have PS not lie... */ + execv("/usr/local/lib/uucp/uucico",argv); /* go to the real program */ + exit(errno); +} diff --git a/gnu/libexec/uucp/contrib/dialHDB.c b/gnu/libexec/uucp/contrib/dialHDB.c new file mode 100644 index 000000000000..cb2662134af6 --- /dev/null +++ b/gnu/libexec/uucp/contrib/dialHDB.c @@ -0,0 +1,187 @@ +/* +# File: dialHDB.c +# Author: Daniel Hagerty , hag@eddie.mit.edu +# Copyright (C) 1993 +# Date: Fri Nov 26 19:22:31 1993 +# Description: Program for using HDB dialers for dialing modems, exiting + with 0 on success, else failure. +# Version: 1.0 +# Revision History: +###### +### 11/26/93 Hag - File creation +###### +### 1/5/94 Hag - Finally got around to finishing this damn thing. +###### +*/ +/* Basic theory behind this program- + dialHDB forks into two processes, a monitor parent, and a child + that does the exec of the dialer. Child pretty much just execs the + dialer program, unless there's an exec problem, in which case the + child sends the parent a SIGUSR1 to indicate failed execution. +*/ + +#include <stdio.h> +#include <string.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <signal.h> + +#define kUsage "Usage:\n\t%s dialerPath device number speed\n\ +%s dialer -h device speed\n" + +#define kExitErrFlag 0x80 /* & in with exit code to determine error */ +#define kErrorMask 0x0f /* Mask to determine error code */ + +/* Error code defines as lifted from an HDB dialer */ +#define RCE_NULL 0 /* general purpose or unknown error code */ +#define RCE_INUSE 1 /* line in use */ +#define RCE_SIG 2 /* signal aborted dialer */ +#define RCE_ARGS 3 /* invalid arguments */ +#define RCE_PHNO 4 /* invalid phone number */ +#define RCE_SPEED 5 /* invalid baud rate -or- bad connect baud */ +#define RCE_OPEN 6 /* can't open line */ +#define RCE_IOCTL 7 /* ioctl error */ +#define RCE_TIMOUT 8 /* timeout */ +#define RCE_NOTONE 9 /* no dial tone */ +#define RCE_BUSY 13 /* phone is busy */ +#define RCE_NOCARR 14 /* no carrier */ +#define RCE_ANSWER 15 /* no answer */ + +/* Structure definition to map error codes to strings */ +typedef struct +{ + int errNum; + char *errString; +} errTable; + +const errTable errors[]= +{ + { RCE_NULL, "Unknown Error" }, + { RCE_INUSE, "Line is being used" }, + { RCE_SIG, "Recieved fatal signal" }, + { RCE_ARGS, "Bad arguments" }, + { RCE_PHNO, "Invalid phone number" }, + { RCE_SPEED, "Invalid baud rate or bad connection" }, + { RCE_OPEN, "Unable to open line" }, + { RCE_IOCTL, "ioctl error" }, + { RCE_TIMOUT, "Timed out" }, + { RCE_NOTONE, "No dialtone" }, + { RCE_BUSY, "Phone number is busy" }, + { RCE_NOCARR, "No carrier" }, + { RCE_ANSWER, "No answer" }, + { 0,NULL} +}; + +/* Function Prototypes */ +int figureStat(int stat); +char *findInTable(int error); +void badExec(void); + +char *dialerName; /* basename of our dialer program */ +char *dialerPath; /* full path of dialer program */ + +main(int argc,char *argv[]) +{ + int parent; /* pid of parent process */ + int child; /* pid of child process */ + int stat; /* exit status of child process */ + char *temp; /* used to get basename of dialer */ + + if(argc!=5) + { + fprintf(stderr,kUsage,argv[0],argv[0]); + exit(1); + } + + dialerPath=argv[1]; + dialerName= (temp=strrchr(argv[1],'/'))!=NULL ? temp+1 : argv[1]; + + parent=getpid(); + + signal(SIGUSR1,badExec); /* set up for possible failed exec */ + + if((child=fork())<0) + { + perror("fork"); + exit(2); + } + if(child>0) /* We're parent, wait for child to exit */ + { + /* Set up to ignore signals so we can report them on stderror */ + signal(SIGHUP,SIG_IGN); + signal(SIGINT,SIG_IGN); + signal(SIGTERM,SIG_IGN); + + wait(&stat); /* wait for child to exit */ + exit(figureStat(stat)); /* figure out our exit code and die */ + } + else /* child process */ + { + close(0); /* close of modem file desc, since HDB */ + close(1); /* doesn't use them */ + dup2(2,1); /* and remap stdout to stderr, just in case */ + if(execvp(argv[1],argv+1)<0) /* exec program with argv shifted by 1 */ + { /* if exec fails, send SIGUSR1 to parent */ + kill(parent,SIGUSR1); + exit(0); + } + } + exit(0); +} + +/* Figure out whether or not dialer ran succesfully, and return +with 0 if it worked, otherwise error */ +int figureStat(int stat) +{ + int exit; + int errFlag; + int error; + + if(WIFSIGNALED(stat)) /* determine if exit was from signal or what */ + { + fprintf(stderr,"Error: Dialer %s recieved signal %d.\n",dialerName, + WTERMSIG(stat)); + return(1); + } + if(WIFSTOPPED(stat)) + { + fprintf(stderr,"Error: Dialer %s recieved signal %d.\n",dialerName, + WSTOPSIG(stat)); + return(1); + } + exit=WEXITSTATUS(stat); + + errFlag=exit&kExitErrFlag; /* Is the error flag set? */ + if(errFlag) + { + char *errString; + + error=exit&kErrorMask; + errString=findInTable(error); /* find it's string, print it on stderr */ + fprintf(stderr,"Error: %s - %s.\n",dialerName,errString); /* and return */ + return(1); + } + return(0); +} + +/* Support routine, look up exit code in error table, and return pointer +to proper string */ +char *findInTable(int error) +{ + int i=0; + + for(i=0;errors[i].errString!=NULL;i++) + { + if(errors[i].errNum==error) + return(errors[i].errString); + } + /* Still here, return the top entry, for unknown error */ + return(errors[0].errString); +} + +/* Called by signal if we recieve SIGUSR 1 */ +void badExec(void) +{ + fprintf(stderr,"Error: %s - Execution problem.\n",dialerPath); + exit(1); +} diff --git a/gnu/libexec/uucp/contrib/uucomp.shar b/gnu/libexec/uucp/contrib/uucomp.shar new file mode 100644 index 000000000000..da131d048c5e --- /dev/null +++ b/gnu/libexec/uucp/contrib/uucomp.shar @@ -0,0 +1,552 @@ +#! /bin/sh +# +# Created by shar, version 0.5 - 04/10/91 +# +# This is a shell archive, meaning: +# 1. Remove everything about the #! /bin/sh line. +# 2. Save the resulting text in a file. +# 3. Execute the file with /bin/sh to create: +# +# length name +# ------ ------------------------------------- +# 128 uucomp-1.1/Compress +# 264 uucomp-1.1/Copyright +# 410 uucomp-1.1/INTERNALS +# 1069 uucomp-1.1/Makefile +# 3528 uucomp-1.1/README +# 632 uucomp-1.1/crmail.c +# 632 uucomp-1.1/crnews.c +# 108 uucomp-1.1/tags +# 3506 uucomp-1.1/uucomp.c +# 383 uucomp-1.1/uucomp.h +# + +if test ! -d uucomp-1.1 ; then + mkdir uucomp-1.1 +fi +# +# Archive number 1 +# This archive created Tue Sep 28 20:21:14 1993 +# + +echo "shar: extracting uucomp-1.1/Compress - (128 characters)" +if test -f 'uucomp-1.1/Compress' ; then + echo shar: will not over-write existing file uucomp-1.1/Compress +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/Compress' +Xfor i in $* +Xdo +X if [ -d /usr/spool/uucp/$i ] +X then +X# echo Looking at $i +X cd /usr/spool/uucp/$i +X /usr/bin/uucomp C.* +X fi +Xdone +SHAR_EOF +if test 128 -ne "`wc -c < 'uucomp-1.1/Compress'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/Compress (should have been 128 characters, but was "`wc -c < 'uucomp-1.1/Compress'`" characters) *****" +fi +fi + +touch 0715110393 uucomp-1.1/Compress +chmod 0700 uucomp-1.1/Compress + +echo "shar: extracting uucomp-1.1/Copyright - (264 characters)" +if test -f 'uucomp-1.1/Copyright' ; then + echo shar: will not over-write existing file uucomp-1.1/Copyright +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/Copyright' +X +X/* +X * +X * Copyright 1993 by Ed Carp (erc@apple.com) All rights reserved. +X * +X * Permission is hereby granted for any non-commercial use of this +X * program, as long as this copyright notice remains intact. Commercial +X * users may contact me - I'm easy. +X * +X */ +X +SHAR_EOF +if test 264 -ne "`wc -c < 'uucomp-1.1/Copyright'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/Copyright (should have been 264 characters, but was "`wc -c < 'uucomp-1.1/Copyright'`" characters) *****" +fi +fi + +touch 0715174993 uucomp-1.1/Copyright +chmod 0600 uucomp-1.1/Copyright + +echo "shar: extracting uucomp-1.1/INTERNALS - (410 characters)" +if test -f 'uucomp-1.1/INTERNALS' ; then + echo shar: will not over-write existing file uucomp-1.1/INTERNALS +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/INTERNALS' +XThis is the basic workflow for uucomp: +X +Xfor (every argv) +Xdo +X if not "C." file skip +X if open fail, skip +X read 1 line from C. file +X grab second and 10th field (second is data file name, +X 10th is command name) +X if open fail on second field, skip +X if 10th field isn't "rmail" or "rnews", skip +X execute "gzip -9" on second field +X change "rmail" and "rnews" to "crmail" and "crnews", respectively +X in C. file +Xdone +SHAR_EOF +if test 410 -ne "`wc -c < 'uucomp-1.1/INTERNALS'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/INTERNALS (should have been 410 characters, but was "`wc -c < 'uucomp-1.1/INTERNALS'`" characters) *****" +fi +fi + +touch 0715174693 uucomp-1.1/INTERNALS +chmod 0600 uucomp-1.1/INTERNALS + +echo "shar: extracting uucomp-1.1/Makefile - (1069 characters)" +if test -f 'uucomp-1.1/Makefile' ; then + echo shar: will not over-write existing file uucomp-1.1/Makefile +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/Makefile' +X# +X# Makefile generated with genmake - version 1.1 08/22/92 +X# +X# genmake is Copyright 1991 by Edwin R. Carp +X# +X# GENMAKE -B/usr/bin -tsp [files] +X# +X +XCC = gcc -O6 +XCFLAGS = $(INCLUDE) +XSOURCES = crmail.c crnews.c uucomp.c +XOBJECTS = crmail.o crnews.o uucomp.o +XPROGRAMS = /usr/bin/crmail /usr/bin/crnews /usr/bin/uucomp +X +Xall: $(PROGRAMS) tags +X +X/usr/bin/crmail: crmail.o +X $(CC) $(CFLAGS) -o crmail crmail.o $(LDFLAGS) -O +X strip crmail +X chmod 755 crmail +X mv crmail /usr/bin +X +X/usr/bin/crnews: crnews.o +X $(CC) $(CFLAGS) -o crnews crnews.o $(LDFLAGS) -O +X strip crnews +X chmod 755 crnews +X mv crnews /usr/bin +X +X/usr/bin/uucomp: uucomp.o +X $(CC) $(CFLAGS) -o uucomp uucomp.o $(LDFLAGS) -O +X strip uucomp +X chmod 755 uucomp +X mv uucomp /usr/bin +X +Xclean: +X /bin/rm -f $(OBJECTS) MAKELOG eddep makedep +X +Xclobber: +X /bin/rm -f $(OBJECTS) $(PROGRAMS) MAKELOG eddep makedep *~ *.bak *.BAK +X /bin/rm -f tags +X +Xhidden: +X echo "make all > MAKELOG 2>&1 &"|/bin/sh +X +Xmakefile: +X genmake -B/usr/bin -tsp $(SOURCES) & +X +Xmakeall: +X genmake -B/usr/bin -tsp *.c & +X +Xtags: $(SOURCES) +X ctags $(SOURCES) > tags +X +SHAR_EOF +if test 1069 -ne "`wc -c < 'uucomp-1.1/Makefile'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/Makefile (should have been 1069 characters, but was "`wc -c < 'uucomp-1.1/Makefile'`" characters) *****" +fi +fi + +touch 0714235093 uucomp-1.1/Makefile +chmod 0600 uucomp-1.1/Makefile + +echo "shar: extracting uucomp-1.1/README - (3528 characters)" +if test -f 'uucomp-1.1/README' ; then + echo shar: will not over-write existing file uucomp-1.1/README +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/README' +XLike most people these days, I'm looking for ways to make my computing +Xenvironment more efficient. This environment consists of a 486, a 386, +Xand a 386SL laptop, all of which run Taylor uucp under Linux. The 386 +Xlaptop gets used a lot, since it goes wherever I go and I answer a lot +Xof news and email every day. Often, I must use other people's facilities +X(phone lines and such) to send out replies and post news if I'm not at home. +XSince it's not fair to the client for them to pay for my zone calls back +Xto my home in Fremont, I place the calls on my phone card. Unfortunately, +XPacBell is very proud of the services they offer, especially in regards +Xto this convenience of automatically charging calls to my house wherever I +Xmay be. Considering that this can be very expensive to do, I searched for +Xa way to cut my phone bill down to something I could afford to pay each +Xmonth without fainting every time I saw the bill. +X +XThe first thing I did was to go out and plunk $195 for a 14.4KB modem. +XThat helped, but C-News is very slow on my laptop, and batching articles +Xis even slower, and email (of course) isn't batched at all. Even with +XMNP5 compression turned on, this doesn't make for a very efficient setup, +Xeven at high speeds. +X +XPlaying around with uucp told me that the line turnaround wasn't that much +Xoverhead, nor was sending the C./X. files (the execute files) - the real +Xoverhead was sending out uncompressed news and especially email, since +XI subscribe to several mailing lists and digests can run quite large. +X +XI looked at uubatch, but the most current version I could find (1.05) was +Xnot compatible with Taylor uucp (and I had no other alternative), so I +Xdecided to write my own. Experiments with "gzip -9" convinced me that +Xthat was the way to go, since gzip gives email and news 60 to 75 percent +Xcompression, which would tend to cut one's phone bill significantly. +X +XYou hold in your mailbox (or news reader) the end result of that effort. +XBear in mind that (1) this is a "first cut" and while it is unlikely that +Xthere are very many bugs, there are certainly places where the programs could +Xbe improved and tuned. Suggestions and comments are welcome! +X +XTo install: +X +X 1. Feed this to shar. +X 2. Look at the Makefile. Make sure that the paths for +X things are set up correctly. +X 3. Look at uucomp.h and make sure that the path and +X options for COMPRESS/UNCOMPRESS are set up properly. +X 3. Type "make". This will make uucomp, crmail, and crnews +X and will place them in /usr/bin. Move Compress into +X /usr/lib/uucp. +X 4. Make an entry in crontab to do +X /usr/lib/uucp/Compress site1 site2 site3... +X occasionally. It is suggested that this be done fairly +X frequently. Alternately, you could set up a login shell +X for selected sites to run uucomp every time that site +X logged in. +X 5. Don't forget to add /usr/bin/crmail and /usr/bin/crnews +X to the list of programs allowed to be executed in your +X Permissions file (if running HDB UUCP), or whatever is +X appropriate for your version of uucp. +X +XEnjoy! Any questions or comments can be sent to erc@apple.com. +X +XNote: This is tuned for Taylor uucp, but would not be particularly +Xdifficult to adapt to other version of uucp. See the file INTERNALS for +Xdetails of how this works. +X +XJuly 15, 1993 +XEd Carp +Xerc@apple.com +X------------------------------------------------------------------------------ +XChanges since 1.0: +X +X Version Date Description +X +X 1.1 08/04/93 Added sanity check in C. file (check that +X 'E' is first char in file, otherwise skip) +SHAR_EOF +if test 3528 -ne "`wc -c < 'uucomp-1.1/README'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/README (should have been 3528 characters, but was "`wc -c < 'uucomp-1.1/README'`" characters) *****" +fi +fi + +touch 0804224993 uucomp-1.1/README +chmod 0600 uucomp-1.1/README + +echo "shar: extracting uucomp-1.1/crmail.c - (632 characters)" +if test -f 'uucomp-1.1/crmail.c' ; then + echo shar: will not over-write existing file uucomp-1.1/crmail.c +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/crmail.c' +X/* +X * crmail - get compressed mail from host, uncompress +X * WARNING: This may be insecure! +X */ +X +X/* +X * +X * Copyright 1993 by Ed Carp (erc@apple.com) All rights reserved. +X * +X * Permission is hereby granted for any non-commercial use of this +X * program, as long as this copyright notice remains intact. Commercial +X * users may contact me - I'm easy. +X * +X */ +X +X#include <stdio.h> +X#include "uucomp.h" +Xmain (argc, argv) +Xint argc; +Xchar **argv; +X{ +X char cmd[1024]; +X int i; +X +X sprintf (cmd, "%s|%s ", UNCOMPRESS, RMAIL); +X for (i = 1; i < argc; i++) +X { +X strcat (cmd, argv[i]); +X strcat (cmd, " "); +X } +X system (cmd); +X exit (0); +X} +SHAR_EOF +if test 632 -ne "`wc -c < 'uucomp-1.1/crmail.c'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/crmail.c (should have been 632 characters, but was "`wc -c < 'uucomp-1.1/crmail.c'`" characters) *****" +fi +fi + +touch 0715195493 uucomp-1.1/crmail.c +chmod 0600 uucomp-1.1/crmail.c + +echo "shar: extracting uucomp-1.1/crnews.c - (632 characters)" +if test -f 'uucomp-1.1/crnews.c' ; then + echo shar: will not over-write existing file uucomp-1.1/crnews.c +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/crnews.c' +X/* +X * crnews - get compressed news from host, uncompress +X * WARNING: This may be insecure! +X */ +X +X/* +X * +X * Copyright 1993 by Ed Carp (erc@apple.com) All rights reserved. +X * +X * Permission is hereby granted for any non-commercial use of this +X * program, as long as this copyright notice remains intact. Commercial +X * users may contact me - I'm easy. +X * +X */ +X +X#include <stdio.h> +X#include "uucomp.h" +Xmain (argc, argv) +Xint argc; +Xchar **argv; +X{ +X char cmd[1024]; +X int i; +X +X sprintf (cmd, "%s|%s ", UNCOMPRESS, RNEWS); +X for (i = 1; i < argc; i++) +X { +X strcat (cmd, argv[i]); +X strcat (cmd, " "); +X } +X system (cmd); +X exit (0); +X} +SHAR_EOF +if test 632 -ne "`wc -c < 'uucomp-1.1/crnews.c'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/crnews.c (should have been 632 characters, but was "`wc -c < 'uucomp-1.1/crnews.c'`" characters) *****" +fi +fi + +touch 0715195593 uucomp-1.1/crnews.c +chmod 0600 uucomp-1.1/crnews.c + +echo "shar: extracting uucomp-1.1/tags - (108 characters)" +if test -f 'uucomp-1.1/tags' ; then + echo shar: will not over-write existing file uucomp-1.1/tags +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/tags' +Xmain crmail.c /^main (argc, argv)$/ +Xmain crnews.c /^main (argc, argv)$/ +Xmain uucomp.c /^main (argc, argv)$/ +SHAR_EOF +if test 108 -ne "`wc -c < 'uucomp-1.1/tags'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/tags (should have been 108 characters, but was "`wc -c < 'uucomp-1.1/tags'`" characters) *****" +fi +fi + +touch 0804224993 uucomp-1.1/tags +chmod 0600 uucomp-1.1/tags + +echo "shar: extracting uucomp-1.1/uucomp.c - (3506 characters)" +if test -f 'uucomp-1.1/uucomp.c' ; then + echo shar: will not over-write existing file uucomp-1.1/uucomp.c +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/uucomp.c' +X/* +X * uucomp - compress outgoing news/mail +X * +X * usage: uucomp C.* +X * +X * This works for Taylor uucp (available from prep.ai.mit.edu:/pub/gnu/uucp*), +X * but I don't promise it works for anyone else's uucp package. Basically, this +X * is a quick-n-dirty hack to get compressed mail and news to a uucp site. This +X * becomes important when you're on the other end of a 1200 baud packet radio +X * link, where the throughput can be 60 CPS (or lower). It also tends to hide +X * any nasties that people might want to say to you, since the packets *are* +X * public readable. Yes, I looked at uubatch, but it was too complicated for +X * me to figure out <grin>, and it didn't work with Taylor-uucp. This is almost +X * too simple to work... +X * +X * To use this little guy, do something like this in the .bashrc or .profile +X * or .cshrc of the uucp's login shell: +X * +X * cd /usr/spool/uucp/<wherever the C. and D. files are kept> +X * /usr/bin/uucomp C.* +X * exec /usr/lib/uucp/uucico +X * +X * This program was written by Ed Carp (erc@apple.com). It can be used for any +X * non-commercial purpose. This software is freely redistributable. +X */ +X +X/* +X * +X * Copyright 1993 by Ed Carp (erc@apple.com) All rights reserved. +X * +X * Permission is hereby granted for any non-commercial use of this +X * program, as long as this copyright notice remains intact. Commercial +X * users may contact me - I'm easy. +X * +X */ +X +X#include <stdio.h> +X#include "uucomp.h" +X#undef NULL +X#define NULL (0) +Xmain (argc, argv) +Xint argc; +Xchar **argv; +X{ +X int i, j, sw, ctr = 0, errflag = 0, mctr = 0, nctr = 0, skipctr = 0; +X char scr[64], rcmd[10], line[1024], lineout[1024]; +X char *strtok (), *ptr, *lineptr, compfile[32]; +X FILE *in; +X +X printf ("uucomp 1.1 08/04/93 ... by erc@apple.com\nscanning %d files.", argc - 1); +X for (i = 1; i < argc; i++) +X { +X if (strncmp (argv[i], "C.", 2) != 0) +X { +X skipctr++; +X continue; +X } +X if ((in = fopen (argv[i], "r+")) == (FILE *) NULL) +X { +X skipctr++; +X continue; +X } +X fgets (line, 1022, in); +X if(*line != 'E') +X { +X skipctr++; +X continue; +X } +X line[strlen (line) - 1] = NULL; +X rewind (in); +X *lineout = NULL; +X lineptr = line; +X sw = errflag = 0; +X printf ("."); +X fflush (stdout); +X for (j = 0;; j++) +X { +X ptr = strtok (lineptr, " "); +X if (ptr == NULL) +X break; +X lineptr = NULL; +X if (j == 1) +X { +X if (access (ptr, 4) == EOF) +X { +X#ifdef DEBUG +X printf ("skip: file '%s' doesn't exist\n", ptr); +X#endif +X errflag = 1; +X break; /* +X * skip it if the data file isn't +X * there yet +X */ +X } +X strcpy (compfile, ptr); +X } +X if (j == 9) +X { +X if (strcmp (ptr, "rmail") != 0 && strcmp (ptr, "rnews") != 0) +X { +X#ifdef DEBUG +X printf ("skip: '%s' wrong command\n", ptr); +X#endif +X errflag = 1; +X break; +X } +X if (strcmp (ptr, "rmail") == 0) +X mctr++; +X if (strcmp (ptr, "rnews") == 0) +X nctr++; +X sw = 1; +X strcat (lineout, "c"); +X } +X strcat (lineout, ptr); +X strcat (lineout, " "); +X } +X if (errflag == 1) +X { +X skipctr++; +X fclose (in); +X continue; +X } +X fprintf (in, "%s\n", lineout); +X fclose (in); +X sprintf (line, +X "%s -fc > /tmp/uucomp.%d < %s;cp /tmp/uucomp.%d %s", +X COMPRESS, getpid (), compfile, getpid (), compfile); +X system (line); +X ctr++; +X } +X sprintf (line, "/tmp/uucomp.%d", getpid ()); +X unlink (line); +X printf ("\n%d skipped, %d compressed (%d mail, %d news).\n", +X skipctr, ctr, mctr, nctr); +X exit (0); +X} +SHAR_EOF +if test 3506 -ne "`wc -c < 'uucomp-1.1/uucomp.c'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/uucomp.c (should have been 3506 characters, but was "`wc -c < 'uucomp-1.1/uucomp.c'`" characters) *****" +fi +fi + +touch 0804224693 uucomp-1.1/uucomp.c +chmod 0600 uucomp-1.1/uucomp.c + +echo "shar: extracting uucomp-1.1/uucomp.h - (383 characters)" +if test -f 'uucomp-1.1/uucomp.h' ; then + echo shar: will not over-write existing file uucomp-1.1/uucomp.h +else +sed 's/^X//' << \SHAR_EOF > 'uucomp-1.1/uucomp.h' +X/* +X * +X * Copyright 1993 by Ed Carp (erc@apple.com) All rights reserved. +X * +X * Permission is hereby granted for any non-commercial use of this +X * program, as long as this copyright notice remains intact. Commercial +X * users may contact me - I'm easy. +X * +X */ +X +X#define COMPRESS "/usr/bin/gzip -9c" +X#define UNCOMPRESS "/usr/bin/gzip -dc" +X#define RMAIL "rmail" +X#define RNEWS "rnews" +SHAR_EOF +if test 383 -ne "`wc -c < 'uucomp-1.1/uucomp.h'`" ; then + echo "shar: ***** error transmitting file uucomp-1.1/uucomp.h (should have been 383 characters, but was "`wc -c < 'uucomp-1.1/uucomp.h'`" characters) *****" +fi +fi + +touch 0715190293 uucomp-1.1/uucomp.h +chmod 0600 uucomp-1.1/uucomp.h +echo End of all shell archives +exit 0 diff --git a/gnu/libexec/uucp/contrib/uudemon.shar b/gnu/libexec/uucp/contrib/uudemon.shar new file mode 100644 index 000000000000..31a8fa60707c --- /dev/null +++ b/gnu/libexec/uucp/contrib/uudemon.shar @@ -0,0 +1,82 @@ +#! /bin/sh +# This is a shell archive. Remove anything before this line, then unpack +# it by saving it into a file and typing "sh file". To overwrite existing +# files, type "sh file -c". You can also feed this as standard input via +# unshar, or by typing "sh <file", e.g.. If this archive is complete, you +# will see the following message at the end: +# "End of shell archive." +# Contents: Poll uudemon.poll +# Wrapped by dburr@sbanet on Fri Jul 23 20:15:18 1993 +PATH=/bin:/usr/bin:/usr/ucb ; export PATH +if test -f 'Poll' -a "${1}" != "-c" ; then + echo shar: Will not clobber existing file \"'Poll'\" +else +echo shar: Extracting \"'Poll'\" \(244 characters\) +sed "s/^X//" >'Poll' <<'END_OF_FILE' +X# HDB-ish poll file +X# +X# Format: <site><tab><hour1> <hour2> ... +X# ONLY ONE TAB BETWEEN FIELDS... more may work, but I have absolutely no +X# idea if it will work at all. +X# +X# comment lines (begin with `#') are ignored. +X +Xdschub 20 21 22 +Xgd 20 21 22 +END_OF_FILE +if test 244 -ne `wc -c <'Poll'`; then + echo shar: \"'Poll'\" unpacked with wrong size! +fi +# end of 'Poll' +fi +if test -f 'uudemon.poll' -a "${1}" != "-c" ; then + echo shar: Will not clobber existing file \"'uudemon.poll'\" +else +echo shar: Extracting \"'uudemon.poll'\" \(941 characters\) +sed "s/^X//" >'uudemon.poll' <<'END_OF_FILE' +X#!/bin/sh +X# +X# This is my impersonation of the HDB uudemon.poll script. +X# Yes, I know, this is very clumsy and clunky... ahh well, I've always +X# been better at C/pascal/etc than Shell programming... :( +X +X# change LIBDIR to where UUCP library/conf. files are +X# change SPOOLDIR to the UUCP spool directory. It must be HDB-ish. +XLIBDIR=/usr/lib/uucp; export LIBDIR +XSPOOLDIR=/usr/spool/uucp; export SPOOLDIR +X +X### no changes needed past here ### +X +XHOUR=`date +%H`; export HOUR +X +Xif [ -f ${LIBDIR}/Poll ]; then +X for SYS in `uuname` +X do +X CHOICES="`grep "^$SYS[ ]" ${LIBDIR}/Poll | awk -F' ' \ +X '{ print $2 }'`" +X DOIT="no" +X for H in $CHOICES +X do +X if [ "$HOUR" = "$H" ]; then +X DOIT="yes" +X fi +X done +X if [ "$DOIT" = "yes" ]; then +X if [ ! -d ${SPOOLDIR}/${SYS} ]; then +X mkdir ${SPOOLDIR}/${SYS} +X fi +X chmod 755 ${SPOOLDIR}/${SYS} +X touch ${SPOOLDIR}/${SYS}/C.${SYS}n0000 +X chmod 644 ${SPOOLDIR}/${SYS}/C.${SYS}n0000 +X fi +X done +Xfi +END_OF_FILE +if test 941 -ne `wc -c <'uudemon.poll'`; then + echo shar: \"'uudemon.poll'\" unpacked with wrong size! +fi +chmod +x 'uudemon.poll' +# end of 'uudemon.poll' +fi +echo shar: End of shell archive. +exit 0 diff --git a/gnu/libexec/uucp/contrib/uupoll.shar b/gnu/libexec/uucp/contrib/uupoll.shar new file mode 100644 index 000000000000..49cdb1b33318 --- /dev/null +++ b/gnu/libexec/uucp/contrib/uupoll.shar @@ -0,0 +1,2696 @@ +#!/bin/sh +# This is a shell archive (produced by shar 3.49) +# To extract the files from this archive, save it to a file, remove +# everything above the "!/bin/sh" line above, and type "sh file_name". +# +# made 04/17/1994 02:21 UTC by ian@comton.airs.com +# Source directory /disk4/ian +# +# existing files will NOT be overwritten unless -c is specified +# +# This shar contains: +# length mode name +# ------ ---------- ------------------------------------------ +# 2602 -r--r--r-- uupoll/Makefile +# 3636 -r--r--r-- uupoll/README +# 4718 -r--r--r-- uupoll/autopoll.8c +# 44031 -r--r--r-- uupoll/autopoll.c +# 3884 -r--r--r-- uupoll/conf.h +# 4787 -r--r--r-- uupoll/uupoll.8c +# 27587 -r--r--r-- uupoll/uupoll.c +# +# ============= uupoll/Makefile ============== +if test ! -d 'uupoll'; then + echo 'x - creating directory uupoll' + mkdir 'uupoll' +fi +if test -f 'uupoll/Makefile' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/Makefile (File already exists)' +else +echo 'x - extracting uupoll/Makefile (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/Makefile' && +# This is the Makefile for uupoll and autopoll +# borrowed and hacked from Taylor UUCP 1.04 +X +# Prefix directory for installation directories. +prefix = /usr/local +X +# The user name/group that should own the resulting executables. +# Both should run suid. +owner = uucp.daemon +X +# Which mode should the resulting executables have. +emode = 4111 +X +# Where to install autopoll. This definition requires $(prefix)/lib to exist. +lbindir = $(prefix)/lib/uucp +X +# Where are the sources from uucp-Taylor uucp.h, uuconf.h, policy.h. +# the following assumes that our sources are in uucp-1.05/contrib/uupoll +# and the required .h files are in main directory for uucp-1.05 +uucpsrcs = ../../ +X +# Where to install uupoll +bbindir = $(prefix)/bin +X +# Where to install man pages. Section 8 for daemons. +man8dir = $(prefix)/man/man8 +man8ext = .8c +X +# Define programs and flags +CC = gcc +CFLAGS = -O2 +LDFLAGS = -s +LIBS = +X +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) -m 644 +X +# +# Nothing else to configure +# +X +SHELL = /bin/sh +X +VERSION = 1.00 +X +MORECFLAGS = -I. -I$(uucpsrcs) -Wall +X +PROGRAMS = uupoll autopoll +X +UUPOLLOBJS = uupoll.o +AUTOOBJS = autopoll.o +X +ALLOBJS = uupoll.o autopoll.o +X +all: $(PROGRAMS) +X +install: $(PROGRAMS) +X if test -d $(lbindir); then true; else mkdir $(lbindir); fi +X if test -d $(bbindir); then true; else mkdir $(bbindir); fi +X -if test -f $(lbindir)/autopoll.old; then rm -f $(lbindir)/autopoll; else mv $(lbindir)/autopoll $(lbindir)/autopoll.old; fi +X -if test -f $(bbindir)/uupoll.old; then rm -f $(bbindir)/uupoll; else mv $(bbindir)/uupoll $(bbindir)/uupoll.old; fi +X $(INSTALL_PROGRAM) autopoll $(lbindir)/autopoll +X $(INSTALL_PROGRAM) uupoll $(bbindir)/uupoll +X chown $(owner) $(lbindir)/autopoll $(bbindir)/uupoll +X chmod $(emode) $(lbindir)/autopoll $(bbindir)/uupoll +X $(INSTALL_DATA) uupoll.8c $(man8dir)/uupoll$(man8ext) +X $(INSTALL_DATA) autopoll.8c $(man8dir)/autopoll$(man8ext) +X +uninstall: +X rm -f $(lbindir)/autopoll $(bbindir)/uupoll +X rm -f $(man8dir)/autopoll$(man8ext) $(man8dir)/uupoll$(man8ext) +X -cp $(lbindir)/autopoll.old $(lbindir)/autopoll +X -cp $(bbindir)/uupoll.old $(bbindir)/uupoll +X -chown $(owner) $(lbindir)/autopoll $(bbindir)/uupoll +X -chmod $(emode) $(lbindir)/autopoll $(bbindir)/uupoll +X +uupoll: $(UUPOLLOBJS) +X $(CC) $(LDFLAGS) -o uupoll $(UUPOLLOBJS) $(LIBS) +X +autopoll: $(AUTOOBJS) +X $(CC) $(LDFLAGS) -o autopoll $(AUTOOBJS) $(LIBS) +X +.c.o: +X $(CC) -c $(CFLAGS) $(MORECFLAGS) $< +X +X +clean: +X rm -f $(ALLOBJS) $(PROGRAMS) +X +mostlyclean: clean +X +TAGS: +X etags *.h *.c +X +# Header file dependencies. These are maintained by hand. +X +$(ALLOBJS): conf.h +X +.NOEXPORT: +SHAR_EOF +chmod 0444 uupoll/Makefile || +echo 'restore of uupoll/Makefile failed' +Wc_c="`wc -c < 'uupoll/Makefile'`" +test 2602 -eq "$Wc_c" || + echo 'uupoll/Makefile: original size 2602, current size' "$Wc_c" +fi +# ============= uupoll/README ============== +if test -f 'uupoll/README' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/README (File already exists)' +else +echo 'x - extracting uupoll/README (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/README' && +X +The package consists of the following files: +X +X - autopoll.c +X - autopoll.8c +X - conf.h +X - Makefile +X - README +X - uupoll.c +X - uupoll.8c +X +CAVEAT: +uupoll as well as autopoll are created, tested and run on +a NeXT running NeXTstep 2.1+ only! Autopoll will take the same arguments +as uucico and may well work with them the same way uucico works but it +has only been tested to call uucico with the options: +X +X -s<site> -S<site> -f -r1 -C -D (as well as the long form of these options) +X +so far. All options given to autopoll will be passed verbatim to uucico. +X +DESCRIPTION: +The program uupoll was created to be a full replacement for the vendor +supplied one on a NeXT computer. That uupoll checked any site name against +the "hardwired" L.sys and did end with a "Bus error" if the site could not +be found. There was no source available to modify so it had to be created +from scratch. +The program autopoll has no equivalent an the NeXT. The intentions behind +it was to automate the task of rescheduling any failed call. It may be +started by an entry in the crontab tables in just the same way uucico is +started (it will start uucico): +X +05 5 * * * uucp /usr/local/lib/uucp/autopoll -r1 >>/tmp/poll.log 2>&1 +X +Any messages go to stderr or a file (if compiled with that option); in case +the file could not be opened it will use stdout to tell you just that and quit. +To catch any output one may place the string +X +X >>/tmp/poll.log 2>&1 +X +into the command line as well. Uupoll as well as autopoll will place only +a start message into the logfiles in case they are invoked manually from +the shell. +If the call fails autopoll will reschedule uucico for a later time by means +of an AT job. +The messages given by uupoll and autopoll carry an indicator to inform about +the nature of an error; they are: +X +- (I) informal message; such as ".. started" ".. ended". +- (W) there might be an error but the program decided to go ahead. +X The exit code will be at least 4. +- (E) a severe error was encountered that either aborts the whole run or +X only the task for one site will be aborted. +X The exit code will be at least 8. +- (C) a catastrophic error has been found such as unable to fork. The run +X is aborted. +X The exit code will be at least 16. +The final message will show the exit code the programm has terminated with. +X +For more information see the man pages or look into the source. +X +INSTALLATION: +all files should be placed in one folder. Then examine and change the files +Makefile and conf.h to meet your needs. To compile uupoll some files of +uucp must be available (see Makefile: uucpsrcs) +If not already there change to the directory which contain the files and type: +X +make +X +this should compile UUPOLL and AUTOPOLL. There should only be a warning +that rcsid is defined but not used. +Before actually installing you should test the programs to be working as +desired. +Then check the Makefile for the final placement of the modules and the man +pages. Make sure the ownership and setuid is what you need on your machine +to run the program(s). +Then su to root and type: +X +make install +X +which should install the above programs and the man pages in the appropriate +directories. +Some word on the coding: have mercy! This is my second project in 'C'; any +suggestions that may improve the style/coding are welcome however. +X +In case of any problems that can't be solved feel free to contact the +author at: +X +Klaus Dahlenburg Timezone : GMT + 2 +P.O.Box 1267 email : kdburg@incoahe.hanse.de +D-21249 Tostedt Fax : +49 4287 676 +X Germany Voice : +49 4287 681 +X +Have fun! +SHAR_EOF +chmod 0444 uupoll/README || +echo 'restore of uupoll/README failed' +Wc_c="`wc -c < 'uupoll/README'`" +test 3636 -eq "$Wc_c" || + echo 'uupoll/README: original size 3636, current size' "$Wc_c" +fi +# ============= uupoll/autopoll.8c ============== +if test -f 'uupoll/autopoll.8c' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/autopoll.8c (File already exists)' +else +echo 'x - extracting uupoll/autopoll.8c (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/autopoll.8c' && +.\" +.\" @(#)autopoll.8c 1.4 (incoahe) 5/09/1993 +.\" +.TH AUTOPOLL 8C "May 09, 1993" +.UC 6 +.SH NAME +autopoll \- automatic \s-1UUCP\s+1 file transfer supervisor +.SH SYNOPSIS +.B autopoll +[ +.BI options +] +.SH DESCRIPTION +file transfer requests placed by +.IR uucp (1) +or +.IR uux (1) +are handled by +.IR uucico (8C). +.IR uucico +will be invoked immediately by the above programs unless the \-r +option is given which queues the request for later processing. This +is typically done by entries in the +.IR crontab +table(s) which will invoke +.IR uucico. +.IR uucico +can also be invoked by +.IR uupoll (8C). +All methods have in common that there is no automatic retry by +.IR uucico +itself in case the call failed for some reason. +Either manual +intervention or some sort of scripts must be used to overcome this +limitation. +.PP +.IR Autopoll +can be used to automate up to a certain degree the task of rescheduling +a call. None of the standard programs already mentioned need to be +modified to get this working. Also not recommended (see BUGS section) +.IR uucico +may be an alias to +.IR autopoll +as all arguments passed to +.IR autopoll +will be copied verbatim to +.IR uucico. +In case this is done by link or other means the original +.I uucio +must still be available in a directory outside of the normal search path +otherwise +.I autopoll +can't do what it's intended to do and will form a loop. +.PP +When +.IR autopoll +is called thre will be a check on the \-s, \-S and \-f option to +see whether this +is a specific call or not. Also the \-S and the \-f option must be checked +to determine the type of call: honor any imposed wait for a site or not. +Any call to ourself or to an unknown site will be refused. The known sites +will be obtained by a call to +.IR uuname(1). +All other options will not be checked in any way. Next to this +.IR uucico +is called and the exit code is checked for a `1' which indicates that the call +failed for some reason whatsoever. A `0' exit code will be interpreted as +a success and +.IR autopoll +ends immediate. If the call seems to be unsuccessful a new call is scheduled +for any site whose .Status files have a retry period greater than 0. The +retry will be scheduled by means of placing an +.IR at +job at the time of the failing call plus any wait time given. For those +sites that have been called with either the \-f or \-S option the retry +time will be the time of the failing call plus 120 seconds. +.PP +In case the time calculated from the values found in a \.Status file is +lower than the current time, the current time plus 60 seconds will be taken +as the retry time. +.PP +A site will +.IR not +be automatically called again if one of the following +conditions is met: +.PP +\- +.IR uucico +is terminated by a signal +.PP +\- either fork() or exec() failed +.PP +\- the +.IR at +command failed for any reasons. +.PP +\- if no wait should be honored and the retry time is found to be zero. +(this may indicate a `Wrong time to call' condition. +.PP +There are other circumstances that may lead to not reschedule a call or +not to call +.IR uucico +at all, all of which should be accompanied by (a) self explanatory message(s). +.SH BUGS +\- invalid options will make +.IR uucico +fail. The exit code for this type is the same as for any other failure; this +can reschedule the call over and over again or never. +.PP +\- +.IR autopoll +may not work as expected when called with options other than \-r1, \-s, +\-S or \-f. +.PP +\- a rescheduled call may fail with `wrong time to call' the second time +but will be rescheduled again. The times to call won't be checked by +.IR autopoll +and the .Status file may not indicate this in case the \-c option is given. +.PP +\- in case the ..._DIR points to an invalid file a `Bus error' my pop up +during the `exec' call. +.PP +\- the `chat-timeout' value may have to be increased when using +.IR autopoll. +An indication to do that is that the call fails short after `CONNECT' +has been received with `Time out in chat script'. +.PP +\- the site names given will be checked aginst the output of +.I uuname +without any alias expansion done. +.PP +\- the text strings whithin the \.Status files will not be used to detect +a failing call. +.SH FILES +.nf +/usr/local/lib/uucp UUCP internal utilities +/usr/lib/uucp +/usr/local/bin UUCP internal utilities +/usr/bin +/usr/spool/uucp/.Status/ Status files for each site +/usr/spool/uucp/ UUCP spool area. one of its sub- +X directories will hold the null jobs. +/tmp/poll.log This file is present only if autopoll +X has been compiled to place the messages +X into a file. Otherwise all messages will +X go to stderr. The directory as well as +X the name may be different. +.fi +.SH SEE ALSO +uucp(1C), uux(1C), uucico(8C), uupoll(8C), uuname(1C), sort(1), uniq(1), +at(1) +SHAR_EOF +chmod 0444 uupoll/autopoll.8c || +echo 'restore of uupoll/autopoll.8c failed' +Wc_c="`wc -c < 'uupoll/autopoll.8c'`" +test 4718 -eq "$Wc_c" || + echo 'uupoll/autopoll.8c: original size 4718, current size' "$Wc_c" +fi +# ============= uupoll/autopoll.c ============== +if test -f 'uupoll/autopoll.c' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/autopoll.c (File already exists)' +else +echo 'x - extracting uupoll/autopoll.c (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/autopoll.c' && +/* ---------------------------------------------------------------------------* +X +X Name: autopoll +X +X Author: Klaus Dahlenburg <kdburg@incoahe.hanse.de> +X +X Status: Public domain +X +X Copyright: none; claiming it to be your work will adversly affect +X your image to be a good programmer. +X +X Function: Autopoll may be called just as uucico is called. The difference +X is that autopoll will call uucico and if the return code is +X not zero a check is made on the status files to see which site's +X call failed. Those sites will be called again at that time found +X in the status file plus any imposed wait. The next call will be +X scheduled via an at job which in turn is handled by cron. +X Atrun depends on the scheduling granularity of cron so the +X actual times may be later than planned. +X Autopoll will check the options -f and -s (-S) as well as the name +X of the site passed. All other options will be passed unchecked. +X The -f and -S options will indicate to autopoll that any wait +X to call a site should be ignored; if the call fails the next +X call to those sites will be at the current time plus 120 secs. +X When the time found plus any wait evaluates to a time that +X passed already the next call will be the current time plus 60 +X secs. The name of the site if given must be a valid one and not +X the host itself otherwise it will be ignored. +X +X Call: autopoll [ options ] +X +X all option that apply to uucico may be given and +X will be passed verbatim. See man uucico(8). +X +X Environment: NeXT 2.1+, Taylor UUCP-1.04+ +X +X I/O: stdin: unused. +X stdout: used only when ALOG_DIR is defined and the file +X can't be opened. It will be a single message to tell +X just that and the run is aborted. +X stderr: all messages go here. +X If ALOG_DIR is defined (see conf.h) all messages will +X be appended to a file autopoll.msglog in that +X directory; the file will be created automatically if +X necessary; a redirection is then no longer possible. +X Needs access to .Status files (see Comments later on). +X +X Called Programs: sort, uniq, uucico, uuname, at +X +X Compile: no special options are needed. Compiled with gcc 2.3.3 -O2. +X Compile with the supplied cc might produce erroneous code +X for the check options switch case 's' code: the break inside +X the first if (..) {... break} is ignored. +X +X Comments: - should run setuid UUCP or whatever userid is necessary to +X access (RDONLY) the .Status files and to run the programs +X named under "Called Programs" above. +X - No alias expansion is done on the given names for the +X check against uuname's output.. +X - Invalid arguments will yield in an exit code > 0 as do +X "normal" failures. It may therefore happen that a site +X is called at the intervals with the same invalid arguments. +X - "Wrong time to call" is not handled properly and may +X call the site at the intervals until the time ban is lifted. +X - human action is necessary as we can't distinguish between +X "normal" failures and "errors" such as wrong password, +X number to dial etc. The logs should be checked periodically. +X - if CICO_DIR points to a non existent program the run may +X end with signal 10: Bus Error. +X - is has been observed that uucico will time out with "Dial +X failed" when called via autopoll; setting chat-timeout to +X value of 40 cured that problem. +X - no rescheduling is done in case uucico fails and this +X is not reported in the .Status file, one should check +X the uucico log; this is to the fact that autopoll will +X not scan the uucico log. +*/ +X +X +#if !defined(lint) +static char rcsid[] = "$Id: uupoll.shar,v 1.1 1994/05/07 18:09:32 ache Exp $"; +#endif /* not lint */ +X +/* $Log: uupoll.shar,v $ +# Revision 1.1 1994/05/07 18:09:32 ache +# Upgrade to version 1.05 +# +X * Revision 2.8 1994/04/14 17:22:54 kdburg +X * corrected misspelled AT_OPTION +X * +X * Revision 2.7 1994/04/11 20:15:48 kdburg +X * major rework done; honor now some of the new option taht came with +X * uucp-1.05 +X * +X * Revision 2.6 1994/03/26 17:40:30 kdburg +X * added support for UNAME_DIR; cleanup of some code; adjusted code after +X * obtaining sitenames via popen() +X * +X * Revision 2.5 1993/07/07 16:49:02 kdburg +X * when used interactivly only the start msg is put into the msg-log +X * so far defined (UULOG) +X * +X * Revision 2.4 1993/06/26 16:17:51 kdburg +X * the -S option wasn't propagated to the command passed to the at pgm +X * +X * Revision 2.3 1993/05/25 12:05:01 kdburg +X * added error check on gettimeofday; added comment in the note section; +X * minor changes not affection code +X * +X * Revision 2.2 1993/05/17 20:47:05 kdburg +X * execution of at cmd also ok always said failed... +X * +X * Revision 2.1 1993/05/16 21:49:13 kdburg +X * changed exit() to _exit() in case the exec fails within child +X * +X * Revision 2.0 1993/05/16 14:12:05 kdburg +X * initial revision +X * */ +X +#define CAT 16 +#define SEVERE 8 +#define WARNING 4 +#define OK 0 +/* Boolean types */ +typedef int bool; +#undef TRUE +#undef FALSE +#define TRUE (1) +#define FALSE (0) +X +#include "conf.h" +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <ctype.h> +#include <pwd.h> +#include <unistd.h> +#include <sys/file.h> +#include <sys/time.h> +#include <sys/param.h> +#include <sys/wait.h> +X +#ifdef ALOG_FILE +X static char Msg_Log[] = ALOG_FILE; /* name of msglog filename */ +#endif +X +#ifdef UNAME_DIR +X static char subcmd[] = " | sort | uniq"; /* pipe that follows uuname */ +#else /* ! UNAME_DIR */ +X static char Sort[] = "uuname | sort | uniq"; /* default to obtain site names */ +#endif /*UNAME_DIR */ +X +#ifdef AT_OPTION +X static char at_opt[] = AT_OPTION; +#else +X static char at_opt[] = "-mc"; +#endif /* AT_OPTION */ +X +static char at_cmd[] = "at"; +static char cGrade[] = DEF_GRADE; /* grade as defined in conf.h */ +static char dGrade[] = "A"; /* use this if DEF_GRADE is invalid */ +static char Auto_Dir[] = AUTO_DIR; /* we live here */ +static char Cico_Dir[] = CICO_DIR; /* here lives cico */ +X +struct Sites { +X char name[MAXHOSTNAMELEN+1]; /* name of site as supplied by uuname */ +X char grade[1]; /* as passed or defaulted */ +X bool flag; /* TRUE: call this site only */ +X bool force; /* TRUE: -S or -f option given */ +X int stat_code; +X int stat_retries; +X long stat_lastcall; +X long stat_delay; +X char *stat_errtext; +}; +X struct Common_Stor { +X int maxtab; /* high-water-mark for site tab */ +X int Single_Site_Tab; /* entry into site tab for a site */ +X /* passed via -s or -S option */ +X bool force_any; /* TRUE: -f option without site */ +X bool one_site; /* TRUE: call for a specific site */ +X bool nodetach; /* TRUE: -D or --nodetach found */ +X bool ifwork; /* TRUE: -C or --ifwork found */ +X char *Grade; /* use this as grade for calls */ +X char *Poll_Pgm; /* our name without path */ +X char *called_as; /* but called by this name */ +X int our_pid; /* our process-id */ +X char *Uucico; /* cico's name without path */ +X char This_Site[MAXHOSTNAMELEN+1]; /* our site name */ +X char Single_Site[MAXHOSTNAMELEN+1]; /* name of site found as arg */ +X union wait *W_Stat; +X char *Usort; /* will hold uuname + subcmd */ +X struct passwd *pwd; +X struct timeval tp; +X struct timezone tzp; +X struct Sites Sitetab[SITE_MAX]; +X char mon[3]; +X int day, hh, mm, ss; +X char oname[24]; +X char jname[20]; +X char tstr[20]; +X char ctag[2]; +X char workf[300]; +X char call_args[300]; +X }; +X +/* copied from taylor uucp "uudefs.h" +X * +X **/ +X +/* The tstatus_type enumeration holds the kinds of status information +X we put in the status file. The order of entries here corresponds +X to the order of entries in the azStatus array. */ +enum tstatus_type +{ +X /* Conversation complete. */ +X STATUS_COMPLETE, +X /* Port unavailable. */ +X STATUS_PORT_FAILED, +X /* Dial failed. */ +X STATUS_DIAL_FAILED, +X /* Login failed. */ +X STATUS_LOGIN_FAILED, +X /* Handshake failed. */ +X STATUS_HANDSHAKE_FAILED, +X /* Failed after logging in. */ +X STATUS_FAILED, +X /* Talking to remote system. */ +X STATUS_TALKING, +X /* Wrong time to call. */ +X STATUS_WRONG_TIME, +X /* Number of status values. */ +X STATUS_VALUES +}; +X +/* ----end-- copied from taylor uucp "uudefs.h" */ +X +X +/* define the prototypes +X * */ +X +int set_mlog(FILE **seclog, struct Common_Stor *); +int get_sites(struct Common_Stor *); +int Call_Cico(int argc, char *argv[], struct Common_Stor *); +int get_args(int argc, char *argv[], struct Common_Stor *); +int Housekeeping(int argc, char *argv[], struct Common_Stor *); +int Chk_Status(int argc, char *argv[], +X struct timeval tcc, +X struct timezone tzcc, +X struct Common_Stor *); +int Check_Site(struct Common_Stor *); +int start_at(char *name, struct Common_Stor *); +void *storage(unsigned count, char *errloc, int *Rc, struct Common_Stor *); +X +extern int gethostname(char *name, int namelen); +extern int system(char *cmd); +extern int fork(); +extern int unlink(char *path); +extern void *malloc(size_t byteSize); +extern int execve(char *name, char *argv[], char *envp[]); +extern int execlp(char *name, char *arg0, ...); +extern int chmod(char *path, int mode); +extern int getuid(); +extern int getpid(); +extern int isatty(int); +extern char *ttyname(int); +extern void free(void *ptr); +#ifdef __STRICT_ANSI__ +extern FILE *popen(char *command, char *type); +extern int pclose(FILE *stream); +extern void _exit(int status); +#endif /* __STRICT_ANSI__ */ +#ifdef __STRICT_BSD__ +extern int fprintf(FILE *stream, const char *format, ...); +extern int fclose(FILE *stream); +extern char *strerror(int errnum); +extern int fflush(FILE *stream); +extern void exit(int status); +extern int fscanf(FILE *stream, const char *format, ...); +extern int sscanf(char *s, const char *format, ...); +#endif /* __STRICT_BSD__ */ +X +/* --------------------------------------------------------------------------*/ +/* Main */ +/* --------------------------------------------------------------------------*/ +X +int main(int argc, char *argv[]) +{ +X +X struct Common_Stor *sCom_Sto; +X int Maxrc = OK; /* Max err-code encountered so far */ +X int k = 0; +X +X if ( NULL == (sCom_Sto = malloc(sizeof(struct Common_Stor))) ) { +X fprintf(stderr,"%s: (C) malloc failed (%s). Reason: %i (%s)\n", +X AUTO_DIR,"Common_Stor",errno,strerror(errno)); +X exit (CAT); +X } +X +X Maxrc = Housekeeping(argc, argv, sCom_Sto); +X +/* If any errors popped up so far they are of such a nature that it is very +X * questionable to continue; so we better bail out in this case. +X */ +X if (Maxrc <= WARNING) { +X if ((sCom_Sto->W_Stat = (union wait *)storage (sizeof(union wait), +X "W_Stat",&Maxrc,sCom_Sto)) != NULL) { +X k = Call_Cico(argc, argv, sCom_Sto); +X Maxrc = Maxrc >= k ? Maxrc:k; +X free(sCom_Sto->W_Stat); +X sCom_Sto->W_Stat = NULL; +X } +X } +X k = gettimeofday(&sCom_Sto->tp, &sCom_Sto->tzp); +X fprintf(stderr,"%s: (I) ended with rc = %i on %s\n", +X sCom_Sto->called_as, +X Maxrc,k!=0 ? "time unavailable":ctime(&sCom_Sto->tp.tv_sec)); +X fclose(stderr); +X free(sCom_Sto); +X sCom_Sto = NULL; +X exit (Maxrc); +} +X +/* --------------------------------------------------------------------------*/ +/* Functions */ +/* --------------------------------------------------------------------------*/ +X +/* -------------------------------------------------------------------- +X * housekeeping +X */ +X +int Housekeeping(argc, argv, sCom_Sto) +X int argc; +X char *argv[]; +X struct Common_Stor *sCom_Sto; { +X +X FILE *seclog = NULL; +X int Rc = OK; +X int Rci = OK; /* intermediate rc as returnd by functions */ +X +X sCom_Sto->our_pid = getpid(); +X +/* +X * get our name sans path +X * */ +X +X sCom_Sto->called_as = argv[0] + strlen(*argv); +X for(;sCom_Sto->called_as >= argv[0] && *--sCom_Sto->called_as != '/';) +X ; +X sCom_Sto->called_as++; +X +/* if defined set up the name of the message log file otherwise +X * stderr will be used. Setup the cmd string to obtain all known sitenames +X * which will be sorted in ascending order with duplicates removed +X * */ +X +X Rc = set_mlog(&seclog, sCom_Sto); +X if (Rc > WARNING) +X return (Rc); +X +/* put out the started message including the time and the userid. +X * */ +X +X sCom_Sto->pwd = getpwuid(getuid()); +X +X if ((gettimeofday(&sCom_Sto->tp, &sCom_Sto->tzp)) != 0) { /* unacceptable error */ +X fprintf(stderr,"%s: (C) gettimeofday() failed. Reason: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X return (Rc >= CAT ? Rc:CAT); +X } +X +X if (seclog != NULL) { +X fprintf(seclog,"\n%s: (I) started by `%s' (%s) on %s", +X sCom_Sto->called_as, +X (sCom_Sto->pwd==NULL) ? "???":sCom_Sto->pwd->pw_name, +X ttyname(0), +X ctime(&sCom_Sto->tp.tv_sec)); +X fclose(seclog); +X } +X fprintf(stderr,"\n%s: (I) started by `%s' on %s", +X sCom_Sto->called_as, +X (sCom_Sto->pwd==NULL) ? "???":sCom_Sto->pwd->pw_name, +X ctime(&sCom_Sto->tp.tv_sec)); +X +/* set up the default grade +X * */ +X +X sCom_Sto->Grade = dGrade; /* set default for now */ +X if (strlen(cGrade) != 1) { +X fprintf(stderr,"%s: (W) grade %s invalid; default `%s' used\n", +X sCom_Sto->called_as,cGrade,sCom_Sto->Grade); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X else +X sCom_Sto->Grade = cGrade; /* Ok, take the one from conf.h */ +X +/* get the program to actually call the site. This is normally UUCICO. +X * */ +X +X sCom_Sto->Uucico = Cico_Dir + strlen(Cico_Dir); +X for(;sCom_Sto->Uucico >= Cico_Dir && *--sCom_Sto->Uucico != '/';) +X ; +X sCom_Sto->Uucico++; +X +/* get the path to ourself. +X * */ +X +X sCom_Sto->Poll_Pgm = Auto_Dir + strlen(Auto_Dir); +X for(;sCom_Sto->Poll_Pgm >= Auto_Dir && *--(sCom_Sto->Poll_Pgm) != '/';) +X ; +X sCom_Sto->Poll_Pgm++; +X +/* obtain our sitename +X * */ +X +X if ((gethostname(sCom_Sto->This_Site,MAXHOSTNAMELEN+1)) != 0) { +X fprintf(stderr,"%s: (W) hostname could not be obtained\n", +X sCom_Sto->called_as); +X Rc = (Rc >= WARNING) ? Rc:WARNING; +X } +X +/* obtain all known sitenames +X * */ +X +X Rci = get_sites(sCom_Sto); +X Rc = Rci > Rc ? Rci:Rc; +X +/* check the arguments that we are called with +X * */ +X +X Rci = get_args(argc, argv, sCom_Sto); +X Rc = Rci > Rc ? Rci:Rc; +X +X return (Rc); +} +X +/* -------------------------------------------------------------------- +X * check all relevant arguments that have been passed to us. Those args +X * that may be needed for a recall will be copied to a workfield. +X * */ +X +int get_args(int argc, char *argv[], struct Common_Stor *sCom_Sto) { +X +X int j = 0; +X int Rc = OK; +X int Rci = OK; +X +X strcpy(sCom_Sto->Single_Site,""); +X sCom_Sto->force_any = FALSE; +X sCom_Sto->one_site = FALSE; +X sCom_Sto->nodetach = FALSE; +X +X strcpy(sCom_Sto->call_args,AUTO_DIR); /* specify complete path to us */ +X strcat(sCom_Sto->call_args," "); /* and separate by one space */ +X for (j=1;j<argc;j++) { +X if (strcmp(argv[j],"--nodetach") == 0 || +X strcmp(argv[j],"-D") == 0) { +X sCom_Sto->nodetach = TRUE; +X strcat(sCom_Sto->call_args,"-D "); +X continue; +X } +X if (strcmp(argv[j],"--force") == 0 || +X strcmp(argv[j],"-f") == 0) { +X strcat(sCom_Sto->call_args,"-f "); +X sCom_Sto->force_any = TRUE; +X continue; +X } +X if (strcmp(argv[j],"--ifwork") == 0 || +X strcmp(argv[j],"-C") == 0) { +X sCom_Sto->ifwork = TRUE; +X continue; +X } +X if ( strncmp(argv[j],"-s",2) == 0 || +X strncmp(argv[j],"-S",2) == 0 || +X strcmp(argv[j],"--system") == 0) { +X if (strncmp(argv[j],"-S",2) == 0) +X sCom_Sto->force_any = TRUE; +X +X if (strlen(argv[j]) == 2 || strcmp(argv[j],"--system") == 0) { +X j++; +X if (j>=argc) { +X fprintf(stderr,"%s: (E) System to call is missing\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X break; +X } +X else { +X strcpy(sCom_Sto->Single_Site,argv[j]); +X Rci = Check_Site(sCom_Sto); +X if (! Rci) { +X sCom_Sto->one_site = TRUE; /* specific call */ +X strcat(sCom_Sto->call_args,argv[j-1]); +X strcat(sCom_Sto->call_args," "); +X strcat(sCom_Sto->call_args,argv[j]); +X strcat(sCom_Sto->call_args," "); +X } +X } +X Rc = Rci <= Rc ? Rc:Rci; +X } +X else { +X strcpy(sCom_Sto->Single_Site,argv[j]+2); +X Rci = Check_Site(sCom_Sto); +X if (! Rci) { +X sCom_Sto->one_site = TRUE; /* specific call */ +X strcat(sCom_Sto->call_args,argv[j]); +X strcat(sCom_Sto->call_args," "); +X } +X Rc = Rci <= Rc ? Rc:Rci; +X } +X continue; +X } +X strcat(sCom_Sto->call_args,argv[j]); +X strcat(sCom_Sto->call_args," "); +X } /* end copy all arguments */ +X +X if (sCom_Sto->ifwork) { +X if (sCom_Sto->one_site) { +X strcat(sCom_Sto->call_args,"-C "); +X } +X else { +X fprintf(stderr,"%s: (W) no site given, '-C' option is ignored\n", +X sCom_Sto->called_as); +X sCom_Sto->ifwork = FALSE; +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X } +X +X if (! sCom_Sto->nodetach) { +X strcat(sCom_Sto->call_args,"-D "); +X } +X +X return (Rc); +} +X +/* -------------------------------------------------------------------- +X * call uucico or whatever programm is necessary to get connected +X */ +X +/* Start uucico and wait for completion. In case the return code is '0' +X * we're finished; otherwise we'll have to check the status files for any +X * non successful calls (retry time > 0). +X * Any such site will be called again at the current time plus any wait +X * Note: +X * If the '-D' or '--nodetach' option is missing, uucico will +X * detach immediate. The return-code is 0 in this case and therefore +X * we can't check whether the call is successful or not. No recall +X * is scheduled for such an invocation. If we however get control +X * to schedule a recall we silently add the '-D' option. To add +X * the '-D' option in any case may be undesirable for a specific +X * type of run. +X */ +X +int Call_Cico(int argc, char *argv[], struct Common_Stor *sCom_Sto) { +X +X int W_Ret = 0; +X int pid = 0; +X int Rc = OK; +X struct timeval tcc; +X struct timezone tzcc; +X +X if ((gettimeofday(&tcc, &tzcc)) != 0) { /* unacceptable error */ +X fprintf(stderr,"%s: (C) gettimeofday() failed. Reason: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X Rc = Rc >= CAT ? Rc:CAT; +X } +X +X if (Rc > WARNING) { +X return (Rc); +X } +X +X fflush(stderr); +X switch(pid = fork()) { +X case -1: +X fprintf(stderr,"%s: (C) could not fork(). Reason-code: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X return (CAT); +X case 0: +X if ((argv[0] = (char *)storage(strlen(sCom_Sto->Uucico)+1,"argv[0]", +X &Rc,sCom_Sto)) == NULL) { +X _exit (CAT); +X } +X strcpy(argv[0],sCom_Sto->Uucico); /* change name to be uucico */ +X execve(Cico_Dir, argv, NULL); +X fprintf(stderr,"%s: (C) could not start %s. Reason-code: %i (%s)\n", +X sCom_Sto->called_as, +X sCom_Sto->Uucico,errno,strerror(errno)); +X _exit (CAT); /* child: bail out */ +X default: +X fprintf(stderr,"%s: (I) starting %s [%d]\n\n", +X sCom_Sto->called_as,sCom_Sto->Uucico,pid); +X fflush(stderr); /* maybe we come behind uucico's output */ +X /* if any; it's a race condition */ +X W_Ret = wait(sCom_Sto->W_Stat); +X if (sCom_Sto->W_Stat->w_termsig == 0) { +X if (sCom_Sto->W_Stat->w_retcode == 0) { +X fprintf(stderr,"%s: (I) %s [%d] ended normally\n", +X sCom_Sto->called_as,sCom_Sto->Uucico,pid); +X return (OK); +X } +X if (sCom_Sto->W_Stat->w_retcode != CAT) { +X fprintf(stderr,"%s: (I) %s's log may contain further information !\n", +X sCom_Sto->called_as,sCom_Sto->Uucico); +X fprintf(stderr,"\n%s: (W) %s [%d] ended with rc = %i\n", +X sCom_Sto->called_as, +X sCom_Sto->Uucico,pid, +X sCom_Sto->W_Stat->w_retcode); +X return (Chk_Status(argc, argv, +X tcc, tzcc, sCom_Sto)); +X } +X else +X return (CAT); /* we where unable to exec */ +X } +X else { +X fprintf(stderr,"\n%s: (E) %s [%d] terminated by signal %i\n", +X sCom_Sto->called_as, +X sCom_Sto->Uucico, +X pid, +X sCom_Sto->W_Stat->w_termsig); +X return (SEVERE); +X } +X } /* switch (pid = fork()) */ +X return (OK); /* Never reached: silence the compiler */ +} +X +X +/* -------------------------------------------------------------------- +X * check the status after the call has completed and the return code +X * is > zero. The status is checked for all sites found via uuname or +X * for one site only (option -s, -S or --system given on call) +X */ +X +int Chk_Status(int argc, char *argv[], +X struct timeval tcc, +X struct timezone tzcc, +X struct Common_Stor *sCom_Sto) { +X +/* +X * For all sites found in Site_Tab their status files will be checked. +X * The table scan will be bypassed for a call to a specific site. +X * If the call failed the wait period is > 0. We will schedule an at-job +X * to be run at the time found + the delta. In case we find an old entry +X * where the time + delta is lower than the current time we'll advance +X * the current time by 60 secs. and use that value instead. +X * In case we are invoked to call a specific site and either the -f option or +X * the site was given as -S... indicating to disregard any wait, we'll +X * use the time found in the status file increased by 120 secs. +*/ +X +X FILE *infile; +X long secs, retries = 0; +X long add = 0; +X int errind = 0; +X int i = 0; +X int ecnt = 0; +X int recall_cnt = 0; +X char curr_site[MAXHOSTNAMELEN+11] = ""; /* keyword + sitename */ +X bool schedule = TRUE; /* FALSE: no more rescheduling: unspec. + force */ +X int Rc = WARNING; /* uucico got rc = 1 otherwise we were not here */ +X int Rs = 0; /* uucico' reason code from .Status file */ +X +/* +X * Note +X * We have to increase the sum of time and wait by at least one minute. +X * That is because this time denotes the earliest point *after* which +X * we may call again. +X * When a site is called at the wrong time the follwing actions are +X * taken: wait = 0 && ! force --> no further action (indicator: see log) +X * wait = 0 && force --> (W) message generated; no further action +X * wait > 0 && ! force --> normal scheduling at time + wait +X * wait > 0 && force --> normal scheduling at time+120 secs +X * We can't depend on the string "Wrong time to call" because the .Status +X * file may not be updated due to the -c switch. This may lead to a +X * situation where the site will be called over and over again while it's +X * still the wrong time. (No we don't want to go fishing for a message in +X * the uucp LOG!) +X * In case the -s, -S or --system option was given we will only +X * check that site and schedule a recall for it so far the +X * conditions are met. +X * In case the -C or --ifwork switch is given without naming a site a +X * the option is dropped and only an unspecific call is scheduled. +X * */ +X +X if (sCom_Sto->one_site) { +X i = sCom_Sto->Single_Site_Tab; +X if (strncmp(sCom_Sto->Sitetab[i].name, +X sCom_Sto->Single_Site, +X sizeof(sCom_Sto->Single_Site)) != 0) { +X fprintf(stderr,"%s: (C) internal index-error (%d): %s found: %s\n", +X sCom_Sto->called_as, +X i, +X sCom_Sto->Single_Site, +X sCom_Sto->Sitetab[i].name); +X Rc = Rc >= CAT ? Rc:CAT; +X return (Rc); /* break unconditionally */ +X } +X } +X +X for (i = sCom_Sto->Single_Site_Tab; i <= sCom_Sto->maxtab; i++) { +X sprintf(sCom_Sto->workf,"%s%s",STATUS_DIR,sCom_Sto->Sitetab[i].name); +X if ((infile=fopen(sCom_Sto->workf,"r")) == NULL) { +X ecnt++; +X fprintf(stderr,"%s: (W) no access to status file for: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rc = Rc >= WARNING ? Rc:WARNING; +X if (sCom_Sto->one_site) { +X break; +X } +X else { +X continue; +X } +X } +X +X fscanf(infile,"%d %d %ld %ld",&errind,&retries,&secs,&add); +X fclose(infile); +X +X /* +X * in case the .Status file is not updated and we have a call to +X * a specific site we try to give some clues of what went wrong +X * (we won't succeed in any case!) +X */ +X +X if (sCom_Sto->Sitetab[i].stat_lastcall == secs && sCom_Sto->one_site) { +X +X if (errind == 0 && retries == 0 && add == 0) +X break; +X +X if (errind > 0) { +X if (tcc.tv_sec <= (secs+add) && ! sCom_Sto->Sitetab[i].force) { +X fprintf(stderr,"%s: (W) retry time not reached for site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X else { +X fprintf(stderr,"%s: (E) maybe port/site unavailable site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X } +X else { +X if (sCom_Sto->one_site) { +X fprintf(stderr,"%s: (E) unknown error for call to site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X } +X fprintf(stderr,"%s: (W) no recall scheduled for site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X break; /* bail out completely */ +X } +X +X if (sCom_Sto->Sitetab[i].stat_lastcall == secs) { +X if (sCom_Sto->one_site) +X break; +X else +X continue; +X } +X +X Rs = OK; /* if Rs is > WARNING we won't schedule a recall */ +X switch(errind) { +X case STATUS_COMPLETE: +X if (add != 0 || retries != 0) { +X fprintf(stderr,"%s: (E) unknown error for call to site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rs = Rs >= SEVERE ? Rs:SEVERE; +X } +X break; +X case STATUS_PORT_FAILED: +X fprintf(stderr,"%s: (E) port was unavailable site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X break; +X case STATUS_DIAL_FAILED: +X fprintf(stderr,"%s: (E) dail failed for site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X break; +X case STATUS_LOGIN_FAILED: +X fprintf(stderr,"%s: (E) login for site: %s failed\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rs = Rs >= SEVERE ? Rs:SEVERE; +X break; +X case STATUS_HANDSHAKE_FAILED: +X fprintf(stderr,"%s: (E) handshake failed site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X break; +X case STATUS_FAILED: +X fprintf(stderr,"%s: (E) invalid status after login site: %s \n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X break; +X case STATUS_TALKING: +X break; +X case STATUS_WRONG_TIME: +X fprintf(stderr,"%s: (W) it's the wrong time to call site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rs = Rs >= SEVERE ? Rs:SEVERE; +X break; +X default: +X fprintf(stderr,"%s: (E) unknown error for call to site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rs = Rs >= SEVERE ? Rs:SEVERE; +X break; +X } +X Rc = Rs > Rc ? Rs:Rc; +X if (Rs > WARNING) { /* schedule a recall ? */ +X fprintf(stderr,"%s: (W) no recall scheduled for site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X if (sCom_Sto->one_site) +X break; +X else +X continue; +X } +X +X if (add == 0) { +X fprintf(stderr,"%s: (W) no delay found for site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X +X +X if (! schedule) { +X recall_cnt += 1; +X continue; /* scheduling already done: unspec. + force */ +X } +X if ((gettimeofday(&sCom_Sto->tp, &sCom_Sto->tzp)) != 0) { +X fprintf(stderr,"%s: (C) gettimeofday() failed. Reason: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X fclose(infile); +X Rc = Rc >= CAT ? Rc:CAT; +X break; /* break unconditionally */ +X } +X +X if (sCom_Sto->force_any || sCom_Sto->Sitetab[i].force) { +X add = secs + 120; /* shorten the wait */ +X } +X else { /* ! force */ +X +/* +X * check for an already scheduled recall. For we don't keep +X * a file of already scheduled recalls the only way to recognize +X * this, is to check the current time against that of the .Stats file. +X * In case the current time is >= the .Stats-time + n-secs fuzz value +X * we assume (99.99% correctness) that we have already scheduled a recall +X * for this site. If this assumption is incorrect a call will be +X * scheduled on the next unspecific failing call. This check can't +X * be done for forced call because the .Stats will be updated. +X */ +X if (sCom_Sto->tp.tv_sec >= secs+2) { +X fprintf(stderr,"%s: (W) Retry time not reached for site: %s\n", +X sCom_Sto->called_as, +X sCom_Sto->Sitetab[i].name); +X Rc = Rc >= WARNING ? Rc:WARNING; +X if (sCom_Sto->one_site) +X break; +X else +X continue; +X } +X add += secs + 60; /* if not force then take the full wait */ +X } /* force */ +X +X if (sCom_Sto->tp.tv_sec >= add) { +X add = sCom_Sto->tp.tv_sec + 60; /* time < current time */ +X } +X +X sscanf(ctime(&add),"%*s %s %d %d:%d:%d",sCom_Sto->mon, +X &sCom_Sto->day, +X &sCom_Sto->hh, +X &sCom_Sto->mm, +X &sCom_Sto->ss); +X +X sprintf(sCom_Sto->oname,"/tmp/at.%d.%02d%02d%02d",sCom_Sto->our_pid, +X sCom_Sto->hh, +X sCom_Sto->mm, +X sCom_Sto->ss); +X if (! sCom_Sto->one_site) { +X strcpy(curr_site,"-s"); +X strcat(curr_site,sCom_Sto->Sitetab[i].name); +X } +X +X /* +X * If 'onesite' is FALSE and 'force' is TRUE +X * we will reschedule one unspecific call an let UUCICO decide +X * which site should be called (is there any work?) +X */ +X +X if ( ! sCom_Sto->one_site && sCom_Sto->force_any) { +X recall_cnt += 1; +X schedule = FALSE; +X continue; +X } +X strcat(sCom_Sto->call_args,curr_site); +X Rs = start_at(sCom_Sto->Sitetab[i].name, sCom_Sto); +X Rc = Rs >= Rc ? Rs:Rc; +X unlink(sCom_Sto->oname); +X if (Rc > SEVERE || sCom_Sto->one_site) +X break; +X } /* for (i = Single_Site_Tab; ...) */ +X +X if (ecnt > sCom_Sto->maxtab) { +X fprintf(stderr,"%s: (E) no access to status files; no scheduling done\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X else { +X if (! schedule) { +X if (recall_cnt == 1) { +X strcat(sCom_Sto->call_args,curr_site); +X } +X Rs = start_at("any site", sCom_Sto); +X Rc = Rs >= Rc ? Rs:Rc; +X unlink(sCom_Sto->oname); +X } +X } +X return (Rc); +} +X +X /* +X * +X */ +X +int start_at(char *site, struct Common_Stor *sCom_Sto) { +X +FILE *outfile; +int W_Ret = 0; +int Rc = OK; +int pid = 0; +X +/* +X * if we can't open the workfile to be passed to AT we'll abandon +X * this site and set the rc accordingly +X * */ +X +X if ((outfile=fopen(sCom_Sto->oname,"w")) == NULL) { +X fprintf(stderr,"%s: (E) could not open workfile %s. No scheduling for: %s\n", +X sCom_Sto->called_as, +X sCom_Sto->oname, +X site); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X fclose(outfile); +X unlink(sCom_Sto->oname); +X return (Rc); /* bail out here */ +X } +X sprintf(sCom_Sto->jname,"at.%d.%02d%02d%02d",sCom_Sto->our_pid, +X sCom_Sto->hh, +X sCom_Sto->mm, +X sCom_Sto->ss); +X fprintf(outfile,"%s \n",sCom_Sto->call_args); +X sprintf(sCom_Sto->tstr,"%02d%02d",sCom_Sto->hh, +X sCom_Sto->mm); +X sprintf(sCom_Sto->ctag,"%d",sCom_Sto->day); +X fclose(outfile); +X if ((chmod(sCom_Sto->oname,00644)) != 0) { +X fprintf(stderr,"%s: (W) chmod to %s failed. Reason_code: %i (%s)\n", +X sCom_Sto->called_as, +X sCom_Sto->oname, +X errno, +X strerror(errno)); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X +X switch (pid = fork()) { +X case -1: +X fprintf(stderr,"%s: (C) could not fork(). Reason-code: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X return (Rc >= CAT ? Rc:CAT); +X case 0: +X if (*at_opt == '\0') +X execlp(at_cmd, at_cmd, sCom_Sto->tstr, +X sCom_Sto->mon, sCom_Sto->ctag, +X sCom_Sto->oname, 0); +X else +X execlp(at_cmd, at_cmd, at_opt, sCom_Sto->tstr, +X sCom_Sto->mon, sCom_Sto->ctag, +X sCom_Sto->oname, 0); +X +X fprintf(stderr,"%s: (C) could not start AT-cmd. Reason-code: %i (%s)\n", +X sCom_Sto->called_as, +X errno,strerror(errno)); +X _exit (CAT); /* child: bail out */ +X default: +X fprintf(stderr,"%s: (I) at [%d] started. Job name: %s\n", +X sCom_Sto->called_as, +X pid, +X sCom_Sto->jname); +X W_Ret = wait(sCom_Sto->W_Stat); +X if (sCom_Sto->W_Stat->w_termsig == 0) { +X if (sCom_Sto->W_Stat->w_retcode != 0) { +X if (sCom_Sto->W_Stat->w_retcode != CAT) { +X fprintf(stderr,"%s: (E) at-cmd failed for some reason\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X else { +X Rc = Rc >= CAT ? Rc:CAT; +X } +X +X fprintf(stderr,"%s: (I) at [%d] ended with rc = %i\n", +X sCom_Sto->called_as, +X pid, +X sCom_Sto->W_Stat->w_retcode); +X /* bail out in case wait returned > SEVERE */ +X if (Rc > SEVERE) { +X return (Rc); +X } +X } +X else { +X fprintf(stderr,"%s: (I) at-cmd [%d] ended normally\n", +X sCom_Sto->called_as, +X pid); +X } +X } +X else { +X fprintf(stderr,"%s: (E) at [%d] terminated by signal %i\n", +X sCom_Sto->called_as, +X pid, +X sCom_Sto->W_Stat->w_termsig); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X } /* switch (pid = fork()) */ +X return (Rc); +} +/* ----------------------------------------------------------------- +X * check the site passed via -s or -S option to be a valid one and +X * not to be our hostname. +X * */ +X +int Check_Site(struct Common_Stor *sCom_Sto) { +X +X int i,j = 0; +X sCom_Sto->Single_Site_Tab = 0; +X if (strcmp(sCom_Sto->Single_Site,sCom_Sto->This_Site) == 0) { +X fprintf(stderr,"%s: (E) won't call *ourself* %s\n", +X sCom_Sto->called_as,sCom_Sto->Single_Site); +X return(SEVERE); +X } +X for(i=0;i<=sCom_Sto->maxtab;i++) { +X if ((j=strcmp(sCom_Sto->Sitetab[i].name,sCom_Sto->Single_Site)) >= 0) { +X break; +X } +X } +X if (j != 0) { +X fprintf(stderr,"%s: (E) unknown site: %s\n", +X sCom_Sto->called_as,sCom_Sto->Single_Site); +X return(SEVERE); +X } +X sCom_Sto->Single_Site_Tab = i; +X sCom_Sto->Sitetab[i].flag = TRUE; +X if (sCom_Sto->force_any) { +X sCom_Sto->Sitetab[i].force = TRUE; +X sCom_Sto->force_any = FALSE; +X } +X return(OK); +} +X +X /* ------------------------------------------------------------------ +X * storage - get some memory +X */ +X +void *storage(unsigned count, +X char *location, +X int *Rc, +X struct Common_Stor *sCom_Sto) +{ +X void *p; +X +X if( NULL == (p= malloc(count)) ) { +X fprintf(stderr,"%s: (C) malloc failed (%s). Reason: %i (%s)\n", +X sCom_Sto->called_as,location,errno,strerror(errno)); +X *Rc = *Rc >= CAT ? *Rc:CAT; +X } +X return p; +} +X +/* ------------------------------------------------------------------ +X * if defined open the message log file otherwise all mesages will go +X * to stderr. If UNAME_DIR is defined construct the command to be +X * passed to popen(); if undefined the deafult will be used +X * */ +X +int set_mlog(FILE **seclog, struct Common_Stor *sCom_Sto) { +X +X int Rc = 0; +X +#ifdef ALOG_FILE +X if (!isatty(0)) { +X if ((freopen(Msg_Log,"a",stderr)) == NULL) { +X fprintf(stdout,"%s: (C) Could not open msglog: %s\n", +X sCom_Sto->called_as,Msg_Log); +X return (Rc >= CAT ? Rc:CAT); +X } +X } +X else { +X if ((*seclog = fopen(Msg_Log,"a")) == NULL) { +X fprintf(stderr,"%s: (C) Could not open msglog: %s\n", +X sCom_Sto->called_as,Msg_Log); +X return (Rc >= CAT ? Rc:CAT); +X } +X } +#endif /* ALOG_FILE */ +X +/* set up the pipe together with the complete path to uuname */ +X +#ifdef UNAME_DIR +X if ((sCom_Sto->Usort = (char *)storage (sizeof(UNAME_DIR)+sizeof(subcmd), +X "Sort",&Rc, sCom_Sto)) != NULL) { +X strncpy(sCom_Sto->Usort,UNAME_DIR,strlen(UNAME_DIR)); /* paste in the path */ +X strcat(sCom_Sto->Usort,subcmd); /* chain the pipe to it */ +X } +#else /* ! UNAME_DIR */ +X sCom_Sto->Usort = &Sort; /* set pointer to uuname + sort */ +#endif /* UNAME_DIR */ +X +X return (Rc); +} +X +/* ------------------------------------------------------------------ +X * obtain all active sitenames +X * */ +X +int get_sites(struct Common_Stor *sCom_Sto) { +X +X int i = 0; +X int n; +X int Rc = 0; +X FILE *infile, *statsfile; +X +X if ((infile=popen(sCom_Sto->Usort,"r")) != NULL) { +X while(fgets(sCom_Sto->Sitetab[i].name,MAXHOSTNAMELEN+1,infile)) { +X if (i > SITE_MAX) { /* let'm run so that we can give */ +X i++; /* the user some guidance */ +X continue; /* we'll tell the user later on */ +X } +X n = strlen(sCom_Sto->Sitetab[i].name)-1; /* offset: next to last char */ +X sCom_Sto->Sitetab[i].name[n] = '\0'; /* strip trailing newline */ +X sCom_Sto->Sitetab[i].flag = FALSE; /* TRUE: poll this site only*/ +X sCom_Sto->Sitetab[i].force = FALSE; /* TRUE: force call */ +X strcpy(sCom_Sto->Sitetab[i].grade,sCom_Sto->Grade); +X sprintf(sCom_Sto->workf,"%s%s",STATUS_DIR,sCom_Sto->Sitetab[i].name); +X if ((statsfile=fopen(sCom_Sto->workf,"r")) == NULL) { +X fprintf(stderr,"%s: (W) no access to status file for: %s\n", +X sCom_Sto->called_as,sCom_Sto->Sitetab[i].name); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X else { +X fscanf(statsfile,"%d %d %ld %ld %s", +X &sCom_Sto->Sitetab[i].stat_code, +X &sCom_Sto->Sitetab[i].stat_retries, +X &sCom_Sto->Sitetab[i].stat_lastcall, +X &sCom_Sto->Sitetab[i].stat_delay, +X sCom_Sto->workf); +X +X fclose(statsfile); +X if ((sCom_Sto->Sitetab[i].stat_errtext = +X (char *)storage (sizeof(sCom_Sto->workf), +X "stat_errtext",&Rc, sCom_Sto)) == NULL) { +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X else +X strcpy(sCom_Sto->Sitetab[i].stat_errtext,sCom_Sto->workf); +X } +X sCom_Sto->maxtab = i++; /* set high-water-mark */ +X } +X if (ferror(infile) != 0) { +X fprintf(stderr,"%s: (E) fgets() for sitenames failed reason-code: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X pclose(infile); +X +X /* +X * check for an empty table (strange but possible) +X */ +X +X if (sCom_Sto->maxtab == 0) { +X fprintf(stderr,"%s: (E) could not obtain sitenames.\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X else { +X +X /* in case the internal table overflows we'll now give notice and tell +X * the user by which amount the table has to be increased to hold all +X * site-names +X */ +X +X if (i > SITE_MAX) { +X fprintf(stderr,"%s: (E) number of sites > internal tab\n", +X sCom_Sto->called_as); +X fprintf(stderr,"%s: (E) increase SITE_MAX to >= %d and recompile\n", +X sCom_Sto->called_as,i); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X } /* sCom_Sto->maxtab == 0 */ +X +X } +X else /* infile == NULL */ +X { +X fprintf(stderr,"%s: (E) could not sort sitenames. Reason-code: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X +X } /* if ((infile=popen(sCom_Sto->Usort,"r")) ... */ +X +X return (Rc); +} +SHAR_EOF +chmod 0444 uupoll/autopoll.c || +echo 'restore of uupoll/autopoll.c failed' +Wc_c="`wc -c < 'uupoll/autopoll.c'`" +test 44031 -eq "$Wc_c" || + echo 'uupoll/autopoll.c: original size 44031, current size' "$Wc_c" +fi +# ============= uupoll/conf.h ============== +if test -f 'uupoll/conf.h' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/conf.h (File already exists)' +else +echo 'x - extracting uupoll/conf.h (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/conf.h' && +#ifndef CONF +X #define CONF +X +/* $Id: uupoll.shar,v 1.1 1994/05/07 18:09:32 ache Exp $ */ +/* $Log: uupoll.shar,v $ +# Revision 1.1 1994/05/07 18:09:32 ache +# Upgrade to version 1.05 +# +X * Revision 1.9 1994/04/14 17:24:58 kdburg +X * added comment to the AT_OPTION +X * +X * Revision 1.8 1994/03/26 17:41:06 kdburg +X * the location of uuname can now be specified. This was added due to +X * the fact that cron (NeXT 3.2 and +) now obeys the path that was active +X * during boot (either /.path or set within /etc/rc) so autopoll/uupoll +X * always got the wrong uuname when called direct fron cron. This is +X * not true when called via a script that does a 'su - user -c ...' +X * +X * Revision 1.7 1993/06/26 16:21:47 kdburg +X * default location for logfiles changed +X * +X * Revision 1.6 1993/05/14 22:32:05 kdburg +X * change to HAVE_SPOOLDIR_TAYLOR +X * +X * Revision 1.5 1993/05/09 13:16:53 kdburg +X * make have-autopoll the default +X * +X * Revision 1.4 1993/05/08 23:17:34 kdburg +X * cleanup and to reflect changes made to autopoll/uupoll +X * +X * Revision 1.3 1993/04/29 10:46:34 kdburg +X * added def for STATUS_DIR +X * +X * Revision 1.2 1993/04/27 15:31:47 kdburg +X * rearranged the defs; changed LOG_DIR to ALOG_DIR in case uupoll +X * will have one too; we need then eventually 2 different dirs. +X * +X * Revision 1.1 1993/04/26 21:20:12 kdburg +X * Initial revision +X * */ +X +/* --------- combined config file for uupoll and autopoll */ +/* --------- change the following defines to meet your needs */ +X +/* define the default grade to be inserted into the pollfile name */ +#define DEF_GRADE "A" +X +/* Define the complete path to the uuname program. +X * If undefined we'll use just the name 'uuname' to call it +X * */ +#define UNAME_DIR "/usr/local/bin/uuname" +X +/* define the path to the directory which does contain uucico */ +#define CICO_DIR "/usr/local/lib/uucp/uucico" +X +/* define the path to the directory which holds all the uucp files. +X * We'll place the poll file in one of it's subdirectories +X * */ +#define SPOOL_DIR "/usr/spool/uucp" +X +/* at least one of the follwing must be defined To use the second or +X * third set of definitions, change the ``#if 1'' to ``#if 0'' +X * and change the appropriate ``#if 0'' to ``#if 1''. +X * */ +#if 0 +#define HAVE_SPOOLDIR_BSD +#endif +#if 0 +#define HAVE_SPOOLDIR_HDB +#endif +#if 1 +#define HAVE_SPOOLDIR_TAYLOR +#endif +X +/* define the maximum number of sites in your config or L.sys */ +#define SITE_MAX 100 +X +/* define the path to the directory which is to contain the +X * message log created by uupoll and the file name itself. +X * change the ``#if 1'' to ``#if 0'' to have the messages on stderr +X * */ +#if 1 +#define ULOG_FILE "/Logfiles/poll.log" +#endif +X +/* change if to 0 if you don't have autopoll installed. */ +#if 1 +#define AUTO_POLL +#endif +X +/* The following defs are irrelevant if you don't have autopoll */ +X +/* define the options to be given to the at cmd (-s -c -m). The default +X * is shown (use csh and send mail after execution) if AT_OPTION is +X * undefined +X * */ +#define AT_OPTION "-mc" +X +/* Define the complete path to the autopoll program. +X * This will assure that we get the one we want +X * The path must be the same as given in Makefile (lbindir) +X * */ +#define AUTO_DIR "/usr/local/lib/uucp/autopoll" +X +/* define the path to the directory which is to contain the +X * message log created by autopoll and the file name itself. +X * change the ``#if 1'' to ``#if 0'' to have the messages on stderr +X * */ +#if 1 +#define ALOG_FILE "/Logfiles/poll.log" +#endif +X +/* define the full path to the directory which holds the status files +X * The name should be given *except* the sitename. A trailing `/' if any +X * must be given. +X * Example: /usr/spool/uucp/.Status/sys.sitename +X * then specify STATUS_DIR as +X * "/usr/spool/uucp/.Status/sys." +X * */ +#define STATUS_DIR "/usr/spool/uucp/.Status/" +#endif +SHAR_EOF +chmod 0444 uupoll/conf.h || +echo 'restore of uupoll/conf.h failed' +Wc_c="`wc -c < 'uupoll/conf.h'`" +test 3884 -eq "$Wc_c" || + echo 'uupoll/conf.h: original size 3884, current size' "$Wc_c" +fi +# ============= uupoll/uupoll.8c ============== +if test -f 'uupoll/uupoll.8c' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/uupoll.8c (File already exists)' +else +echo 'x - extracting uupoll/uupoll.8c (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/uupoll.8c' && +.\" Copyright (c) 1986 Regents of the University of California. +.\" All rights reserved. The Berkeley software License Agreement +.\" specifies the terms and conditions for redistribution. +.\" +.\" @(#)uupoll.8c 6.1 (Berkeley) 4/24/86 +.\" @(#)uupoll.8c 1.11 (incoahe) 5/09/1993 +.\" +.TH UUPOLL 8C "Mai 09, 1993" +.UC 6 +.SH NAME +uupoll \- poll a remote \s-1UUCP\s+1 site +.SH SYNOPSIS +.B uupoll +[ +.BI \-g grade +] [ +.B \-n +] [ +.B \-x +] +.I system ... ... +.SH SUMMARY +This version of +.IR uupoll +can be used to fully replace the vendor supplied +.IR uupoll +that comes with the NeXTStep OS. The original version (up to 3.1) had a +X bug in that +X an unknown site given as argument would yield in a `Bus error' condition. +Using any other type of UUCP like Taylor-UUCP with the option of having +a different file structure as well as a different L.sys will therefore +make it necessary to do maintenance to the (unused) L.sys as well to keep +.IR uupoll +going. This one has been programmed from scratch due to the fact that no +source code was available. Some enhancements have been incorporated into +this version: +.PP +\- the default grade may now be compiled different from `A'. +.PP +\- the options may now be given in any order and the \-g option may be given +more than once. Any option will be used immediately when encountered and +will stay in effect unless reset; this does not apply to the \-x and \-n +option which can't be reset. The processing of options is guaranteed to be +from left to right so that some grouping may be achieved (see below). +.PP +\- +.IR uupoll +may be used to call any program instead of +.IR uucico +namely +.IR autopoll +to ease the task of rescheduling a failed call. +.SH DESCRIPTION +.I Uupoll +is used to force a poll of a remote system. It queues a null job for the +remote system, unless the \-x option has been given, and then invokes +either +.IR uucico (8C) +or +.IR autopoll (8C) +or any other program depending on how +.IR uupoll +is customized. If used in conjunction with +.IR autopoll +the latter will then invoke +.IR uucico. +.SH OPTIONS +The following options are available: +.TP 8 +.BI \-g grade +Only send jobs of grade +.I grade +or higher on this call. The +.I grade +stays in effect until it is changed by a different \-g option. +.TP 8 +.B \-n +Queue the null job, but do not invoke the program that actually calls +the named site(s). +The \-n option once given will apply to all sites following to the +.IR right +of it. +.TP 8 +.B \-x +Do not place a null job for all following sites. This option must be given +before the \-n option. The \-n option will nullify this. Any grade in effect +will not be honored because +.I uucico (Taylor) +does not carry the \-g option at the moment. +.PP +.I Uupoll +is usually run by +.IR cron (5) +or by a user who wants to hurry a job along. A typical entry in +.I crontab +could be: +.PP +.nf +X 0 0,8,16 * * * uucp /usr/bin/uupoll ihnp4 +X 0 4,12,20 * * * uucp /usr/bin/uupoll ucbvax +.fi +This will poll +.B ihnp4 +at midnight, 0800, and 1600, and +.B ucbvax +at 0400, noon, and 2000. +.PP +If the local machine is already running +.I uucico +every +hour and has a limited number of outgoing modems, a better approach +might be: +.PP +.nf +X 0 0,8,16 * * * uucp /usr/bin/uupoll -n ihnp4 +X 0 4,12,20 * * * uucp /usr/bin/uupoll -n ucbvax +X 5 * * * * uucp /usr/lib/uucp/uucico -r1 -D -C +.fi +This will queue null jobs for the remote sites at the top of the hour; they +will be processed by +.I uucico +when it runs five minutes later (the -C option apply to Taylor +uucp-1.05 only, the -D option applies to Talor uucp-1.04 and up) +.SH EXTENDED options +An example of the options and how they interact is given below. The working +order while processing the options is left to right: +.nf +X uupoll -gC site1 -gB site2 -x site3 -n -gA site4 site5 +.fi +.PP +this poll will: +.PP +- call immediate site1 with grade C or higher and will place a null job +.PP +- call immediate site2 with grade B or higher and will place a null job +.PP +- call immediate site3 with grade B or higher without placing a null job +.PP +- just placing a null job for site4 and site5 with grade A or higher. These +sites will be called at the next regular schedule. +.SH BUGS +When more than one site is given on the command line and no \-n option is +given there will be an immediate invocation of +.IR uucico +or +.IR autopoll +for +.IR all +sites given. That may lead to a `No port available' condition. +.SH FILES +.ta \w'/usr/spool/uucp/ 'u +.nf +/etc/uucp/ UUCP internal files/utilities +/usr/spool/uucp/ Spool directory +/tmp/poll.log This file is present only if uupoll has been +X compiled to place the messages into a file. +X Otherwise all messages will go to stderr. +X The directory as well as the name may be +X different. The name may be defined at compile time. +.fi +.SH SEE ALSO +uucp(1C), uux(1C), uucico(8C), autopoll(8C) +SHAR_EOF +chmod 0444 uupoll/uupoll.8c || +echo 'restore of uupoll/uupoll.8c failed' +Wc_c="`wc -c < 'uupoll/uupoll.8c'`" +test 4787 -eq "$Wc_c" || + echo 'uupoll/uupoll.8c: original size 4787, current size' "$Wc_c" +fi +# ============= uupoll/uupoll.c ============== +if test -f 'uupoll/uupoll.c' -a X"$1" != X"-c"; then + echo 'x - skipping uupoll/uupoll.c (File already exists)' +else +echo 'x - extracting uupoll/uupoll.c (Text)' +sed 's/^X//' << 'SHAR_EOF' > 'uupoll/uupoll.c' && +/* ---------------------------------------------------------------------------* +X +X Name: uupoll +X +X Author: Klaus Dahlenburg <kdburg@incoahe.hanse.de> +X +X Status: Public domain +X +X Copyright: none +X +X Funktion: The main intention behind this program was to get a full +X replacement of the uupoll supplied by NeXT when using an +X UUCP or a file structure that is different from that hardwired +X config in NeXT's uupoll. The lack of source made it impossible +X to modify the supplied uupoll. +X +X Call: uupoll [-n] [-x] [-g[A | 0-9,A-Z,a-z]] site ... +X +X -n just place a poll file but do not call uucico; +X This option can be given only once. +X -x meaningful only for sites not affected by the -n +X option. It prevents the creation of a poll file; +X the default is to place one. In case the poll fails +X there will be no attempt to poll those sites on +X the next general (unspecific) poll. If using +X autopoll the site will be called at the next + 1 +X run of autopoll. +X -g any grade may be given to meet the criteria for +X a successful poll. The default being specified +X in conf.h (A). +X This option may be given individually for each +X site to call. +X site the name of the site to be called. As many sites +X as necessary may be specified separated by at least +X one blank. +X Note: any site will be called with the options currently in +X effect. The working order is left to right. Example: +X uupoll -gQ site1 site2 -gZ site3 -n site4 +X site1 and site2 will be called immediate with grade Q +X site3 will be called immediate with grade Z. Site4 will +X have a poll file created with grade Z. +X +X Environment: NeXT 2.1 +X +X Called Programs: sort, uniq, uucico (or autopoll), uuname +X +X Compile: no special options are needed +X +X Comments: - should run setuid UUCP or whatever userid is necessary to +X write to the spool directory with the proper ownership of +X the files and to run uucico. +X - No alias expansion is done on the given names. +*/ +X +#if !defined(lint) +static char rcsid[] = "$Id: uupoll.shar,v 1.1 1994/05/07 18:09:32 ache Exp $"; +#endif /* not lint */ +X +/* $Log: uupoll.shar,v $ +# Revision 1.1 1994/05/07 18:09:32 ache +# Upgrade to version 1.05 +# +X * Revision 2.7 1994/04/14 17:22:04 kdburg +X * major rework done +X * +X * Revision 2.6 1994/03/26 17:38:41 kdburg +X * added support for UNAME_DIR; cleanup of some code; adjusted code after +X * obtaining sitenames via popen() +X * +X * Revision 2.5 1994/03/24 19:01:24 kdburg +X * some minor changes; some calls had their rc not checked +X * +X * Revision 2.4 1993/07/08 07:56:26 kdburg +X * befor invoking autopoll stdin is now closed to avoid blocking of +X * terminal +X * +X * Revision 2.3 1993/07/05 19:43:00 kdburg +X * when used interactivly only the start msg is put into the msg-log +X * so far defined (UULOG) +X * +X * Revision 2.2 1993/05/20 18:50:52 kdburg +X * no execute permission to the poll-pgm (uucico/autopoll) was not +X * reflected in the log; when to start message was not given when -x +X * option was present +X * +X * Revision 2.1 1993/05/16 21:48:15 kdburg +X * changed exit() to _exit() in case the exec fails within child +X * +X * Revision 2.0 1993/05/16 14:11:04 kdburg +X * initial revision +X * */ +X +#define CAT 16 +#define SEVERE 8 +#define WARNING 4 +#define OK 0 +#define P_MODE 00647 /* file-mode for poll-file */ +/* Boolean types */ +typedef int bool; +#undef TRUE +#undef FALSE +#define TRUE (1) +#define FALSE (0) +X +#include "conf.h" +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <ctype.h> +#include <sys/file.h> +#include <sys/param.h> +#include <pwd.h> +#include <sys/time.h> +X +#define X_OK 1 /* access: executable ? */ +X +#ifdef ALOG_FILE +X static char Msg_Log[] = ALOG_FILE; /* name of msglog filename */ +#endif +X +#ifdef UNAME_DIR +X static char subcmd[] = " | sort | uniq"; /* pipe that follows uuname */ +#else /* ! UNAME_DIR */ +X static char Sort[] = "uuname | sort | uniq"; /* default to obtain site names */ +#endif /*UNAME_DIR */ +X +static char cGrade[] = DEF_GRADE; /* grade as defined in conf.h */ +static char dGrade[] = "A"; /* use this if DEF_GRADE is invalid */ +#ifdef AUTO_POLL +X static char Auto_Dir[] = AUTO_DIR; /* autopoll lives here */ +#else +X static char Cico_Dir[] = CICO_DIR; /* and here lives cico */ +#endif /* AUTO_POLL */ +X +struct Sites { +X char name[MAXHOSTNAMELEN+1]; /* name of site as supplied by uuname */ +X char grade[1]; /* as passed or defaulted */ +X bool flag; /* TRUE this site should be polled */ +X int asap; /* 1 without -n; 2 with -x option */ +}; +X struct Common_Stor { +X int maxtab; /* high-water-mark for site tab */ +X char *Grade; /* use this as grade for calls */ +X char *Poll_Pgm; /* our name without path */ +X char *called_as; /* but called by this name */ +X int our_pid; /* our process-id */ +X char *Uucico; /* cico's name without path */ +X char This_Site[MAXHOSTNAMELEN+1]; /* our site name */ +X char System[MAXHOSTNAMELEN+1]; /* intermediate to hold sitename */ +X char *Usort; /* will hold uuname + subcmd */ +X struct passwd *pwd; +X struct timeval tp; +X struct timezone tzp; +X struct Sites Sitetab[SITE_MAX]; +X char workf[300]; +X }; +X +/* define the prototypes +X * */ +X +int set_mlog(FILE **seclog, struct Common_Stor *); +int get_sites(struct Common_Stor *); +int Check_Args(int argc, char *argv[], struct Common_Stor *); +int Housekeeping(int argc, char *argv[], struct Common_Stor *); +int Call_Site(struct Common_Stor *); +void *storage(unsigned count, char *errloc, int *Rc, struct Common_Stor *); +X +extern int getpid(); +extern void free(void *ptr); +extern int access(char *path, int mode); +extern int gethostname(char *name, int namelen); +extern int system(char *cmd); +extern int fork(); +extern int execlp(char *name, char *arg0, ...); +extern void *malloc(size_t byteSize); +extern int getuid(); +extern int isatty(int); +extern char *ttyname(int); +extern int open(char *path, int flags, int mode); +extern int close(int fd); +#ifdef __STRICT_ANSI__ +extern FILE *popen(char *command, char *type); +extern int pclose(FILE *stream); +extern void _exit(int status); +#endif /* __STRICT_ANSI__ */ +#ifdef __STRICT_BSD__ +extern int fprintf(FILE *stream, const char *format, ...); +extern int fclose(FILE *stream); +extern char *strerror(int errnum); +extern int fflush(FILE *stream); +extern void exit(int status); +#endif /* __STRICT_BSD__ */ +X +/* --------------------------------------------------------------------------*/ +/* Main */ +/* --------------------------------------------------------------------------*/ +X +int main(int argc, char *argv[]) +{ +X +X struct Common_Stor *sCom_Sto; +X int Maxrc = OK; /* Max err-code encountered so far */ +X int k = 0; +X +X if ( NULL == (sCom_Sto = malloc(sizeof(struct Common_Stor))) ) { +X fprintf(stderr,"%s: (C) malloc failed (%s). Reason: %i (%s)\n", +X argv[0],"Common_Stor",errno,strerror(errno)); +X exit (CAT); +X } +X +X Maxrc = Housekeeping(argc, argv, sCom_Sto); +X +/* If any errors popped up so far they are of such a nature that it is very +X * questionable to continue; so we better bail out in this case. +X */ +X if (Maxrc <= WARNING) { +X k = Call_Site(sCom_Sto); +X Maxrc = Maxrc >= k ? Maxrc:k; +X } +X k = gettimeofday(&sCom_Sto->tp, &sCom_Sto->tzp); +X fprintf(stderr,"%s: (I) ended with rc = %i on %s\n", +X sCom_Sto->called_as, +X Maxrc,k!=0 ? "time unavailable":ctime(&sCom_Sto->tp.tv_sec)); +X fclose(stderr); +X free(sCom_Sto); +X sCom_Sto = NULL; +X exit (Maxrc); +} +X +/* --------------------------------------------------------------------------*/ +/* Functions */ +/* --------------------------------------------------------------------------*/ +X +/* -------------------------------------------------------------------- +X * housekeeping +X */ +X +int Housekeeping(argc, argv, sCom_Sto) +X int argc; +X char *argv[]; +X struct Common_Stor *sCom_Sto; { +X +X FILE *seclog = NULL; +X int Rc = OK; +X int Rci = OK; /* intermediate rc as returnd by functions */ +X +X sCom_Sto->our_pid = getpid(); +X +/* +X * get our name sans path +X * */ +X +X sCom_Sto->called_as = argv[0] + strlen(*argv); +X for(;sCom_Sto->called_as >= argv[0] && *--sCom_Sto->called_as != '/';) +X ; +X sCom_Sto->called_as++; +X +/* if defined set up the name of the message log file otherwise +X * stderr will be used. Setup the cmd string to obtain all known sitenames +X * which will be sorted in ascending order with duplicates removed +X * */ +X +X Rc = set_mlog(&seclog, sCom_Sto); +X if (Rc > WARNING) +X return (Rc); +X +/* put out the started message including the time and the userid. +X * */ +X +X sCom_Sto->pwd = getpwuid(getuid()); +X +X if ((gettimeofday(&sCom_Sto->tp, &sCom_Sto->tzp)) != 0) { /* unacceptable error */ +X fprintf(stderr,"%s: (C) gettimeofday() failed. Reason: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X return (Rc >= CAT ? Rc:CAT); +X } +X +X if (seclog != NULL) { +X fprintf(seclog,"\n%s: (I) started by `%s' (%s) on %s", +X sCom_Sto->called_as, +X (sCom_Sto->pwd==NULL) ? "???":sCom_Sto->pwd->pw_name, +X ttyname(0), +X ctime(&sCom_Sto->tp.tv_sec)); +X fclose(seclog); +X } +X fprintf(stderr,"\n%s: (I) started by `%s' on %s", +X sCom_Sto->called_as, +X (sCom_Sto->pwd==NULL) ? "???":sCom_Sto->pwd->pw_name, +X ctime(&sCom_Sto->tp.tv_sec)); +X +/* set up the default grade +X * */ +X +X sCom_Sto->Grade = dGrade; /* set default for now */ +X if (strlen(cGrade) != 1) { +X fprintf(stderr,"%s: (W) grade %s invalid; default `%s' used\n", +X sCom_Sto->called_as,cGrade,sCom_Sto->Grade); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X else +X sCom_Sto->Grade = cGrade; /* Ok, take the one from conf.h */ +X +/* get the program to actually call the site. This is either UUCICO +X * or AUTOPOLL or something completely different. +X * */ +X +#ifdef AUTO_POLL +X sCom_Sto->Uucico = Auto_Dir + strlen(Auto_Dir); +X for(;sCom_Sto->Uucico >= Auto_Dir && *--sCom_Sto->Uucico != '/';) +X ; +X sCom_Sto->Uucico++; +#else /* ! AUTO_POLL */ +X sCom_Sto->Uucico = Cico_Dir + strlen(Cico_Dir); +X for(;sCom_Sto->Uucico >= Cico_Dir && *--sCom_Sto->Uucico != '/';) +X ; +X sCom_Sto->Uucico++; +#endif /* AUTO_POLL */ +X +/* get the path to ourself. +X * */ +X +X sCom_Sto->Poll_Pgm = argv[0] + strlen(argv[0]); +X for(;sCom_Sto->Poll_Pgm >= argv[0] && *--(sCom_Sto->Poll_Pgm) != '/';) +X ; +X sCom_Sto->Poll_Pgm++; +X +/* obtain our sitename +X * */ +X +X if ((gethostname(sCom_Sto->This_Site,MAXHOSTNAMELEN+1)) != 0) { +X fprintf(stderr,"%s: (W) hostname could not be obtained\n", +X sCom_Sto->called_as); +X Rc = (Rc >= WARNING) ? Rc:WARNING; +X } +X +/* obtain all known sitenames +X * */ +X +X Rci = get_sites(sCom_Sto); +X Rc = Rci > Rc ? Rci:Rc; +X +/* check the arguments that we are called with +X * */ +X +X Rci = Check_Args(argc, argv, sCom_Sto); +X Rc = Rci > Rc ? Rci:Rc; +X +X return (Rc); +} +X +/* -------------------------------------------------------------------- +X * check all relevant arguments that have been passed to us. Those args +X * that may be needed for a recall will be copied to a workfield. +X * */ +X +int Check_Args(int argc, char *argv[], struct Common_Stor *sCom_Sto) { +X int i,s,k,n = 0; +X int Rc = OK; +X int One_Site = 0; /* TRUE: found at least one valid site to call */ +X int poll_file = 1; /* FALSE: after -x option given */ +X int def_flag = 0; /* TRUE: when option -n was encountered */ +X +X /* --------------------------------------------------------------*/ +X /* check the arguments passed to us */ +X /* */ +X /* These are: -n -> place a POLL file but do not start uucico */ +X /* -x -> do not place a poll file (immed. poll only) */ +X /* -g? -> specify a grade with the POLL file. The ? */ +X /* may be: 0-9, A-Z, a-z */ +X /* (validity not checked!) */ +X /* site name of the site to call. There many be as */ +X /* many as necessary separated by at least one */ +X /* blank */ +X /* Note: all options will stay in effect as long as they are'nt */ +X /* changed by a new setting. The options -n and -x can't */ +X /* be negated once given; that means place all sites */ +X /* that should be immediately polled to the left of the */ +X /* -n option; the same applies to the -x option which must */ +X /* be left of the -n option to come into effect! */ +X /* The working order is left to right! */ +X /* --------------------------------------------------------------*/ +X +X for (i = 1, s = 0; i < argc; i++) { +X k = strlen(argv[i]); +X switch (*argv[i]) { +X +X /* ----> handle the options */ +X +X case '-': +X n = 1; +X switch (*(argv[i]+n)) { +X case 'n': +X if (k > 2) { +X fprintf(stderr,"%s: (E) invalid specification %s\n", +X sCom_Sto->called_as,argv[i]); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X break; +X } +X def_flag = 1; +X break; +X case 'x': +X if (k > 2) { +X fprintf(stderr,"%s: (E) invalid specification %s\n", +X sCom_Sto->called_as,argv[i]); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X break; +X } +X if (def_flag) { +X fprintf(stderr,"%s: (W) -x after -n has no effect\n", +X sCom_Sto->called_as); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X else { +X poll_file = 0; +X } +X break; +X case 'g': +X if (k > 3) { +X fprintf(stderr,"%s: (E) invalid specification %s\n", +X sCom_Sto->called_as,argv[i]); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X break; +X } +X if (*(argv[i]+n+1) == '\0') { +X fprintf(stderr,"%s: (E) missing grade\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X break; +X } +X if (isalnum(*(argv[i]+n+1)) == 0) { +X fprintf(stderr,"%s: (E) invalid grade %s\n", +X sCom_Sto->called_as,argv[i]); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X break; +X } +X strcpy(sCom_Sto->Grade,(argv[i]+n+1)); +X break; +X default: +X fprintf(stderr,"%s: (W) missing/unknown option `-%s' ignored\n", +X sCom_Sto->called_as,argv[i]+n); +X Rc = Rc >= WARNING ? Rc:WARNING; +X break; +X } /* end of switch (*(argv[i]+n)) */ +X break; +X +X /* ----> handle the sitenames */ +X +X default: +X if (strcmp(argv[i],sCom_Sto->This_Site) == 0) { +X fprintf(stderr,"%s: (W) ignoring to call *ourself* %s\n", +X sCom_Sto->called_as,argv[i]); +X Rc = Rc >= WARNING ? Rc:WARNING; +X break; +X } +X strcpy(sCom_Sto->System,argv[i]); +X for(s=0;s<=sCom_Sto->maxtab;s++) { +X if ((n=strcmp(sCom_Sto->Sitetab[s].name,sCom_Sto->System)) >= 0) { +X break; +X } +X } +X if (n != 0) { +X fprintf(stderr,"%s: (W) unknown site (ignored): %s\n", +X sCom_Sto->called_as,sCom_Sto->System); +X Rc = Rc >= WARNING ? Rc:WARNING; +X break; +X } +X +X /* ----> if there was no error we arrive here to save the data */ +X +X strcpy(sCom_Sto->Sitetab[s].grade,sCom_Sto->Grade); +X One_Site = sCom_Sto->Sitetab[s].flag = 1; /* poll this site */ +X if (def_flag) +X sCom_Sto->Sitetab[s].asap = 0; /* poll on next schedule */ +X else { +X sCom_Sto->Sitetab[s].asap = 1; /* poll immediately */ +X if (! poll_file) +X sCom_Sto->Sitetab[s].asap++; /* and do not place a poll file */ +X } +X s++; +X break; +X } /* end of switch (*argv[i]) */ +X } /* end of for(...) */ +X +/* now let's check what we've gotten so far. If no valid data has been */ +/* entered we will indicate that to prevent further processing */ +X +X if (! One_Site) { +X fprintf(stderr,"%s: (E) found no site to call\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X +return (Rc); +} +X +int Call_Site(struct Common_Stor *sCom_Sto) { +X +/* For all sites that carry the -n flag we will place */ +/* a poll file into the appropriate directory. For all others there will */ +/* be an immediate call to uucico (or autopoll) */ +/* Those sites that have been named on the command have the corresponding */ +/* flag byte set to one. */ +X +X int fdpoll; /* fildes for the poll file */ +X int mode = P_MODE; /* mode for poll file */ +X int i = 0; +X int Rc = OK; +X int pid = 0; /* process-id after fork() */ +X +X for(i=0;(i<=sCom_Sto->maxtab);i++) { +X if (sCom_Sto->Sitetab[i].flag == 0) /* should we trigger this one ? */ +X continue; /* nope */ +X +/* processing done for delayed polls only */ +X +X if (sCom_Sto->Sitetab[i].asap <= 1) { /* do not place a poll file */ +X /* for sites that will be polled */ +X /* immediate and carry the -x option */ +#ifdef HAVE_SPOOLDIR_TAYLOR +X sprintf(sCom_Sto->workf,"%s/%s/C./C.%sPOLL", +X SPOOL_DIR, +X sCom_Sto->Sitetab[i].name, +X sCom_Sto->Sitetab[i].grade); +#endif +#ifdef HAVE_SPOOLDIR_HDB +X sprintf(sCom_Sto->workf,"%s/%s/C.%s%sPOLL", +X SPOOL_DIR, +X sCom_Sto->Sitetab[i].name, +X sCom_Sto->Sitetab[i].name, +X sCom_Sto->Sitetab[i].grade); +#endif +#ifdef HAVE_SPOOLDIR_BSD +X sprintf(sCom_Sto->workf,"%s/C./C.%s%sPOLL", +X SPOOL_DIR, +X sCom_Sto->Sitetab[i].name, +X sCom_Sto->Sitetab[i].grade); +#endif +X +X fflush(stderr); +X if ((fdpoll=open(sCom_Sto->workf,O_CREAT,mode)) <= 0) { +X fprintf(stderr,"%s: (E) couldn't place poll file for system: %s. Reason: %s\n", +X sCom_Sto->called_as, +X sCom_Sto->Sitetab[i].name, +X strerror(errno)); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X else { +X if (close(fdpoll) != 0) { +X fprintf(stderr,"%s: (W) close failed for poll file; system: %s. Reason: %s\n", +X sCom_Sto->called_as, +X sCom_Sto->Sitetab[i].name, +X strerror(errno)); +X Rc = Rc >= WARNING ? Rc:WARNING; +X } +X } +X } +X +/* the following processing is done for immediate polls only +X * there is no wait for the completion of the called program that actually +X * calls the site +X * */ +X +X fflush(stderr); +X if (Rc <= WARNING) { +X fprintf(stderr,"%s: (I) site %s will be called %s\n", +X sCom_Sto->called_as, +X sCom_Sto->Sitetab[i].name, +X sCom_Sto->Sitetab[i].asap == 0 ? +X "upon next poll":"immediately"); +X if (sCom_Sto->Sitetab[i].asap >= 1) +X { +#ifdef AUTO_DIR +X if ( access(Auto_Dir,X_OK) != 0) /* do we have xecute permission ? */ +#else /* ! AUTO_DIR */ +X if ( access(Cico_Dir,X_OK) != 0) /* do we have xecute permission ? */ +#endif /* AUTO_DIR */ +X { +X fprintf(stderr,"%s: (C) could not start %s. Reason-code: %i (%s)\n", +X sCom_Sto->called_as, +X sCom_Sto->Uucico, +X errno,strerror(errno)); +X return (Rc >= CAT ? Rc:CAT); /* abandon the run */ +X } +X switch (pid = fork()) +X { +X case -1: +X fprintf(stderr,"%s: (C) could not fork() Reason-code: %i (%s)\n", +X sCom_Sto->called_as, +X errno,strerror(errno)); +X return (Rc >= CAT ? Rc:CAT); +X case 0: +X if (isatty(0)) +X close(0); /* don't block the terminal by autopoll */ +#ifdef AUTO_DIR +X execlp(Auto_Dir, +#else /* ! AUTO_DIR */ +X execlp(Cico_Dir, +#endif /*AUTO_DIR */ +X sCom_Sto->Uucico, +X "-D", "-r1", "-s", +X sCom_Sto->Sitetab[i].name,0); +X fprintf(stderr,"%s: (C) could not start %s. Reason-code: %i (%s)\n", +X sCom_Sto->called_as, +X sCom_Sto->Uucico, +X errno,strerror(errno)); +X _exit (CAT); /* child: bail out */ +X default: +X fflush(stderr); +X fprintf(stderr,"%s: (I) %s [%d] started; site: %s\n", +X sCom_Sto->called_as, +X sCom_Sto->Uucico, +X pid, +X sCom_Sto->Sitetab[i].name); +X } /* switch (pid = fork()) */ +X } /* if (Sitetab ...) */ +X } /* if (Rc ...) */ +X } /* for(i=0;(i<= ...)) */ +X return (Rc); +} +X +X /* ------------------------------------------------------------------ +X * storage - get some memory +X */ +X +void *storage(unsigned count, +X char *location, +X int *Rc, +X struct Common_Stor *sCom_Sto) +{ +X void *p; +X +X if( NULL == (p= malloc(count)) ) { +X fprintf(stderr,"%s: (C) malloc failed (%s). Reason: %i (%s)\n", +X sCom_Sto->called_as,location,errno,strerror(errno)); +X *Rc = *Rc >= CAT ? *Rc:CAT; +X } +X return p; +} +X +/* ------------------------------------------------------------------ +X * if defined open the message log file otherwise all mesages will go +X * to stderr. If UNAME_DIR is defined construct the command to be +X * passed to popen(); if undefined the default will be used +X * */ +X +int set_mlog(FILE **seclog, struct Common_Stor *sCom_Sto) { +X +X int Rc = 0; +X +#ifdef ALOG_FILE +X if (!isatty(0)) { +X if ((freopen(Msg_Log,"a",stderr)) == NULL) { +X fprintf(stdout,"%s: (C) Could not open msglog: %s\n", +X sCom_Sto->called_as,Msg_Log); +X return (Rc >= CAT ? Rc:CAT); +X } +X } +X else { +X if ((*seclog = fopen(Msg_Log,"a")) == NULL) { +X fprintf(stderr,"%s: (C) Could not open msglog: %s\n", +X sCom_Sto->called_as,Msg_Log); +X return (Rc >= CAT ? Rc:CAT); +X } +X } +#endif /* ALOG_FILE */ +X +/* set up the pipe together with the complete path to uuname */ +X +#ifdef UNAME_DIR +X if ((sCom_Sto->Usort = (char *)storage (sizeof(UNAME_DIR)+sizeof(subcmd), +X "Sort",&Rc, sCom_Sto)) != NULL) { +X strncpy(sCom_Sto->Usort,UNAME_DIR,strlen(UNAME_DIR)); /* paste in the path */ +X strcat(sCom_Sto->Usort,subcmd); /* chain the pipe to it */ +X } +#else /* ! UNAME_DIR */ +X sCom_Sto->Usort = &Sort; /* set pointer to uuname + sort */ +#endif /* UNAME_DIR */ +X +X return (Rc); +} +X +/* ------------------------------------------------------------------ +X * obtain all active sitenames +X * */ +X +int get_sites(struct Common_Stor *sCom_Sto) { +X +X int i = 0; +X int n; +X int Rc = 0; +X FILE *infile; +X +X if ((infile=popen(sCom_Sto->Usort,"r")) != NULL) { +X while(fgets(sCom_Sto->Sitetab[i].name,MAXHOSTNAMELEN+1,infile)) { +X if (i > SITE_MAX) { /* let'm run so that we can give */ +X i++; /* the user some guidance */ +X continue; /* we'll tell the user later on */ +X } +X n = strlen(sCom_Sto->Sitetab[i].name)-1; /* offset: next to last char */ +X sCom_Sto->Sitetab[i].name[n] = '\0'; /* strip trailing newline */ +X sCom_Sto->Sitetab[i].flag = FALSE; /* TRUE: poll this site */ +X sCom_Sto->Sitetab[i].asap = FALSE; /* TRUE: immediate poll */ +X strcpy(sCom_Sto->Sitetab[i].grade,sCom_Sto->Grade); +X sprintf(sCom_Sto->workf,"%s%s",STATUS_DIR,sCom_Sto->Sitetab[i].name); +X sCom_Sto->maxtab = i++; /* set high-water-mark */ +X } +X if (ferror(infile) != 0) { +X fprintf(stderr,"%s: (E) fgets() for sitenames failed reason-code: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X pclose(infile); +X +X /* +X * check for an empty table (strange but possible) +X */ +X +X if (sCom_Sto->maxtab == 0) { +X fprintf(stderr,"%s: (E) could not obtain sitenames.\n", +X sCom_Sto->called_as); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X else { +X +X /* in case the internal table overflows we'll now give notice and tell +X * the user by which amount the table has to be increased to hold all +X * site-names +X */ +X +X if (i > SITE_MAX) { +X fprintf(stderr,"%s: (E) number of sites > internal tab\n", +X sCom_Sto->called_as); +X fprintf(stderr,"%s: (E) increase SITE_MAX to >= %d and recompile\n", +X sCom_Sto->called_as,i); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X } +X } /* sCom_Sto->maxtab == 0 */ +X +X } +X else /* infile == NULL */ +X { +X fprintf(stderr,"%s: (E) could not sort sitenames. Reason-code: %i (%s)\n", +X sCom_Sto->called_as,errno,strerror(errno)); +X Rc = Rc >= SEVERE ? Rc:SEVERE; +X +X } /* if ((infile=popen(sCom_Sto->Usort,"r")) ... */ +X +X return (Rc); +} +SHAR_EOF +chmod 0444 uupoll/uupoll.c || +echo 'restore of uupoll/uupoll.c failed' +Wc_c="`wc -c < 'uupoll/uupoll.c'`" +test 27587 -eq "$Wc_c" || + echo 'uupoll/uupoll.c: original size 27587, current size' "$Wc_c" +fi +exit 0 diff --git a/gnu/libexec/uucp/contrib/uurate.c b/gnu/libexec/uucp/contrib/uurate.c index ceab41c53bfd..80972f611baf 100644 --- a/gnu/libexec/uucp/contrib/uurate.c +++ b/gnu/libexec/uucp/contrib/uurate.c @@ -5,16 +5,16 @@ * and outputs various statistical data to standard out. * * Author: - * Bob Denny (denny@alisa.com) - * Fri Feb 7 13:38:36 1992 + * Bob Denny (denny@alisa.com) + * Fri Feb 7 13:38:36 1992 * * Original author: - * Mark Pizzolato mark@infopiz.UUCP + * Mark Pizzolato mark@infopiz.UUCP * * Edits: - * Bob Denny - Fri Feb 7 15:04:54 1992 - * Heavy rework for Taylor UUCP. This was the (very old) uurate from - * DECUS UUCP, which had a single logfile for activity and stats. + * Bob Denny - Fri Feb 7 15:04:54 1992 + * Heavy rework for Taylor UUCP. This was the (very old) uurate from + * DECUS UUCP, which had a single logfile for activity and stats. * Personally, I would have done things differently, with tables * and case statements, but in the interest of time, I preserved * Mark Pizzolato's techniques and style. @@ -23,41 +23,165 @@ * Changes to report format suggested by Francois Pinard and others. * Add summary report, format from uutraf.pl (perl script), again * thanks to Francois. Integrate and checkout with 1.03 of Taylor UUCP. + * + * Stephan Niemz <stephan@sunlab.ka.sub.org> - Fri Apr 9 1993 + * - Print totals in summary report, + * - show all commands in execution report, + * - count incoming calls correctly, + * - suppress empty tables, + * - don't divide by zero in efficiency report, + * - limit the efficiency to 100% (could be more with the i-protocol), + * - suppress some zeros to improve readability, + * - check for failure of calloc, + * - -h option changed to -s for consistency with all other uucp commands + * (but -h was left in for comptibility). + * + * Scott Boyd <scott@futures.com> - Thu Aug 26 13:21:34 PDT 1993 + * - Changed hosts linked-list insertion routine so that hosts + * are always listed in alphabetical order on reports. + * + * Klaus Dahlenburg <kdburg@incoahe.hanse.de> - Fri Jun 18 1993 (1.2.2) + * - redesigned the printed layout (sticked to those 80 column tubes). + * - 'Retry time not ...' and ' ERROR: All matching ports ...' will now be + * counted as calls and will raise the failed-call counter. + * - times now shown as hh:mm:ss; the fields may hold up to 999 hrs + * (a month equals 744 hrs at max). Printing will be as follows: + * + * hrs > 0 hh:mm:ss + * min > 0 mm:ss + * sec > 0 ss + * leading zeroes are suppressed. + * + * - the bytes xfered will be given in thousands only (we're counting + * so 1K is 1000 bytes!). Sums up to 9,999,999.9 thousand can be shown. + * - dropped the fractions of a byte in columns: bytes/second (avg cps). + * - File statistic changed to display in/out in one row instead of 2 + * separate reports. + * - eliminated the goto in command report and tightened the code; also + * the 'goto usage' has been replaced by a call to void usage() with no + * return (exit 1). + * - a totaling is done for all reports now; the total values are held + * within the structure; after finishing read there will be an alloc + * for a site named 'Total' so that the totals line will be printed + * more or less automatically. + * - option -t implemented: that is every possible report will be given. + * - the start and end date/time of the input files are printed; can be + * dropped by the -q option at run time. + * - it is now possible to use Log/Stats files from V2_LOGGING configs. + * They must however not be mixed together (with each other). + * - the Log/Stats files are taken from config which is passed via + * Makefile at compile time. Variable to set is: newconfigdir. If the + * default config can't be read the default values are used + * (the config is optional!). + * Note: keyword/filename must be on the same line (no continuation). + * - -I option implemented to run with a different config file. In case + * the file can't be opened the run is aborted! + * - -q option implemented to run without environment report (default is + * FALSE: print the report). + * - -p option added to print protocol statistics: one for the packets + * and one for the errors encountered + * - reapplied patch by Scott Boyd <scott@futures.com> that I did not + * get knowledge of */ +/* $Log: uurate.c,v $ + * Revision 1.2 1994/05/07 18:09:35 ache + * Upgrade to version 1.05 + * + * Revision 1.15 1994/04/07 21:47:11 kdburg + * printed 'no data avail' while there was data; layout chnaged + * (cosmetic only) + * + * Revision 1.14 1994/04/07 21:16:32 kdburg + * the layout of the protocol-used line within the LOGFILE changed + * from 1.04 to 1.05; both formats may be used together; output + * changed for packet report (columns adjusted) + * + * Revision 1.13 1994/04/04 10:04:35 kdburg + * cosmetic change to the packet-report (separator lines) + * + * Revision 1.12 1994/03/30 19:52:04 kdburg + * incorporated patch by Scott Boyd which was missing from this version + * of uurate.c. Left the comment in cronological order. + * + * Revision 1.11 1994/03/28 18:53:22 kdburg + * config not checked properly for 'logfile/statsfile' overwrites, bail-out + * possible; wrong file name written to log for statsfile when found + * + * Revision 1.10 1993/09/28 16:46:51 kdburg + * transmission failures denoted by: failed after ... in stats file + * have not been counted at all. + * + * Revision 1.9 1993/08/17 23:38:36 kdburg + * sometimes a line(site) was missing from the protocol stats due + * to a missing +; added option -d and -v reassing option -h to print + * the help; a zero was returned instead of a null-pointer by + * prot_sum + * + * Revision 1.8 1993/07/03 06:58:55 kdburg + * empty input not handled properly; assigned some buffer to input; msg + * not displayed when no protocol data was available + * + * Revision 1.7 1993/06/27 10:31:53 kdburg + * rindex was replaced by strchr must be strrchr + * + * Revision 1.6 1993/06/26 06:59:18 kdburg + * switch hdr_done not reset at beginning of protocol report + * + * Revision 1.5 1993/06/25 22:22:30 kdburg + * changed rindex to strchr; if there is no NEWCONFIG defined take + * appropriate action + * + * Revision 1.4 1993/06/25 20:04:07 kdburg + * added comment about -p option; inserted proto for rindex + * + * Revision 1.3 1993/06/25 19:31:14 kdburg + * major rework done; added protocol reports (normal/errors) + * + * Revision 1.2 1993/06/21 19:53:54 kdburg + * init + * */ -char version[] = "@(#) Taylor UUCP Log File Summary Filter, Version 1.2"; - -#include <ctype.h> /* Character Classification */ -#include <string.h> +char version[] = "@(#) Taylor UUCP Log File Summary Filter, Version 1.2.2"; +static char rcsid[] = "$Id: uurate.c,v 1.2 1994/05/07 18:09:35 ache Exp $"; +#include <ctype.h> /* Character Classification */ #include <math.h> - #include "uucp.h" +/* uucp.h includes string.h or strings.h, no include here. */ #define _DEBUG_ 0 - + /* * Direction of Calling and Data Transmission */ -#define IN 0 /* Inbound */ -#define OUT 1 /* Outbound */ + +#define IN 0 /* Inbound */ +#define OUT 1 /* Outbound */ + +/* + * define some limits + */ +#define MAXCOLS 8 /* report has this # of columns incl. 'name' */ +#define MAXREP 6 /* number of reports available */ +#define MAXFNAME 64 /* max input file name length incl. path*/ +#define MAXDNAME 8 /* max display (Hostname) name length */ /* * Data structures used to collect information */ struct File_Stats { - int files; /* Files Transferred */ - unsigned long bytes; /* Data Size Transferred*/ - double time; /* Transmission Time */ + int files; /* Files Transferred */ + unsigned long bytes; /* Data Size Transferred*/ + double time; /* Transmission Time */ }; struct Phone_Call { - int calls; /* Call Count */ - int succs; /* Successful calls */ - double connect_time; /* Connect Time Spent */ - struct File_Stats flow[2]; /* Rcvd & Sent Data */ + int calls; /* Call Count */ + int succs; /* Successful calls */ + double connect_time; /* Connect Time Spent */ + struct File_Stats flow[2]; /* Rcvd & Sent Data */ }; struct Execution_Command @@ -67,591 +191,1664 @@ struct Execution_Command int count; }; +struct Protocol_Summary + { + struct Protocol_Summary *next; + char type[3]; + long int pr_cnt; + long int pr_psent; + long int pr_present; + long int pr_preceived; + long int pr_eheader; + long int pr_echksum; + long int pr_eorder; + long int pr_ereject; + long int pr_pwinmin; + long int pr_pwinmax; + long int pr_psizemin; + long int pr_psizemax; + }; + struct Host_entry { struct Host_entry *next; char Hostname[32]; - struct Execution_Command *cmds; /* Local Activities */ - struct Phone_Call call[2]; /* In & Out Activities */ + struct Execution_Command *cmds; /* Local Activities */ + struct Phone_Call call[2]; /* In & Out Activities */ + struct Protocol_Summary *proto; }; + struct Host_entry *hosts = NULL; + struct Host_entry *tot = NULL; + struct Host_entry *cur = NULL; + struct Execution_Command *cmd, *t_cmds = NULL; + struct Protocol_Summary *prot, *t_prot, *s_prot, *ss_prot = NULL; /* * Stuff for getopt() */ -extern int optind; /* GETOPT : Option Index */ -extern char *optarg; /* GETOPT : Option Value */ -extern void *calloc(); - -static void fmtime(); -static void fmbytes(); +extern int optind; /* GETOPT : Option Index */ +extern char *optarg; /* GETOPT : Option Value */ +#if ! HAVE_STDLIB_H + extern pointer *calloc(); +#endif /* HAVE_STDLIB_H */ /* * Default files to read. Taken from Taylor compile-time configuration. - * Must look like an argvec, hence the dummy argv[0]. + * def_logs must look like an argvec, hence the dummy argv[0]. + * Maybe later modified by scanning the config */ -static char *(def_logs[3]) = { "", LOGFILE, STATFILE }; + +static char *def_logs[3] = { NULL, NULL, NULL}; +char *I_conf = NULL; /* points to config lib given by -I option */ +char *D_conf = NULL; /* points to config lib from makefile */ +char *Tlog = NULL; /* points to Log-file */ +char *Tstat = NULL; /* points to Stats-file */ +char Pgm_name[64]; /* our pgm-name */ +char logline[BUFSIZ+1]; /* input area */ +char noConf[] = "- not defined -"; +char buff[16*BUFSIZ]; +char sbuff[2*BUFSIZ]; /* - * Misc. strings for reports + * Boolean switches for various decisions */ -static char *(file_hdr[2]) = { "\nReceived file statistics:\n", - "\nSent file statistics\n" }; - + + int p_done = FALSE; /* TRUE: start date/time of file printed */ + int hdr_done = FALSE; /* TRUE: report header printed */ + int show_files = FALSE; /* TRUE: -f option given */ + int show_calls = FALSE; /* TRUE: -c option given */ + int show_commands = FALSE; /* TRUE: -x option given */ + int show_efficiency = FALSE; /* TRUE: -e option given */ + int show_all = FALSE; /* TRUE: -t option given */ + int show_proto = FALSE; /* TRUE: -p option given */ + int use_stdin = FALSE; /* TRUE: -i option given */ + int be_quiet = FALSE; /* TRUE: -q option given */ + int have_files[2]; /* TRUE: [IN] or [OUT] files found */ + int have_calls = FALSE; /* TRUE: in/out calls found */ + int have_commands = FALSE; /* TRUE: found uuxqt records */ + int have_proto = FALSE; /* TRUE: protocol data found */ + int no_records = TRUE; /* FALSE: got one record from file */ + +/* + * protos + */ + +static pointer *getmem(unsigned n); +static void inc_cmd(struct Execution_Command **, char *name); +static void fmtime(double sec, char *buf); +static void fmbytes(unsigned long n, char *buf); +static void usage(); +static int chk_config(char *conf, int n, int type); +static void hdrprt(char c, int bot); +struct Protocol_Summary *prot_sum(struct Protocol_Summary **, char *, int); + /* * BEGIN EXECUTION */ -main(argc, argv) -int argc; -char *argv[]; + +int main(argc, argv) + int argc; + char *argv[]; { - char c; - char *p, *s; - struct Host_entry *hosts = NULL; - struct Host_entry *cur = NULL; - struct Host_entry *e; - struct Execution_Command *cmd; - struct Execution_Command *ec; - char Hostname[64]; FILE *Log = NULL; - char logline[1024]; + int c; + char *p, *s, *stt, *flq = NULL; + char Hostname[MAXHOSTNAMELEN]; /* def taken from <sys/param.h> */ + char Filename[15]; /* filename to be printed */ + char in_date[14]; /* holds the date info of record read*/ + char in_time[14]; /* holds the time info of record read */ + char dt_info[31]; /* holds the date info from the last record read */ char *logmsg; - int sent; - int called; - int show_files = 0; /* I prefer boolean, but... */ - int show_calls = 0; - int show_commands = 0; - int show_efficiency = 0; - int show_summary = 0; - int have_files = 0; - int have_calls = 0; - int have_commands = 0; - int use_stdin = 0; - Hostname[0] = '\0'; + int sent, called = IN; + int report = 0; /* if <= 0 give msg that no report was avail. */ + int junk; + + /* -------------------------------------------------------------------- + * P r o l o g + * -------------------------------------------------------------------- + */ + + Hostname[0] = '\0'; + have_files[IN]= have_files[OUT]= FALSE; + setvbuf(stdout,sbuff,_IOFBF,sizeof(sbuff)); + + /* + * get how we've been called isolate the name from the path + */ + if ((stt = strrchr(argv[0],'/')) != NULL) + strcpy(Pgm_name,++stt); + else + strcpy(Pgm_name,argv[0]); + def_logs[0] = Pgm_name; + /* * I wish the compiler had the #error directive! */ -#if !HAVE_TAYLOR_LOGGING - fprintf(stderr, "uurate cannot be used with your configuration of\n"); - fprintf(stderr, "Taylor UUCP. To use uurate you must be using the\n"); - fprintf(stderr, "TAYLOR_LOGGING configuration.\n"); + +#if !HAVE_TAYLOR_LOGGING && !HAVE_V2_LOGGING + fprintf(stderr,"\a%s: (E) %s\n",Pgm_name,"Your config of Taylor UUCP is not yet supported."); + fprintf(stderr,"%s: (E) %s\n",Pgm_name,"Current support is for V2 or TAYLOR logging only."); + puts(" Run aborted due to errors\n") exit(1); #endif /* - * Process the command line arguments + * get some mem to store the default config name (def's are in + * policy.h ) */ - while((c = getopt(argc, argv, "h:cfexai")) != EOF) - { - switch(c) - { - case 'h': - strcpy(Hostname, optarg); - break; - case 'c': - show_calls = 1; - break; - case 'f': - show_files = 1; - break; - case 'x': - show_commands = 1; - break; - case 'e': - show_efficiency = 1; - break; - case 'a': - show_calls = show_files = show_commands = show_efficiency = 1; - break; - case 'i': - use_stdin = 1; - break; - default : - goto usage; - } - } + if (sizeof(NEWCONFIGLIB) > 1) /* defined at compile time */ + { + D_conf = (char *)getmem((sizeof(NEWCONFIGLIB) + sizeof("/config"))); + strcpy(D_conf,NEWCONFIGLIB); /* passed by makefile */ + strcat(D_conf,"/config"); + } + Tlog = (char *)getmem(sizeof(LOGFILE)); + Tstat = (char *)getmem(sizeof(STATFILE)); + Tlog = LOGFILE; + Tstat = STATFILE; + /* - * If no report switches given, show summary report. + * Process the command line arguments */ - if (show_calls == 0 && show_files == 0 - && show_efficiency == 0 && show_commands == 0) - show_summary = 1; - + + while((c = getopt(argc, argv, "I:s:cfdexaitphv")) != EOF) + { + switch(c) + { + case 'h': + (void) usage(); + case 's': + strcpy(Hostname, optarg); + break; + case 'c': + show_calls = TRUE; + ++report; + break; + case 'd': + printf("%s: (I) config-file default: %s\n",Pgm_name,D_conf); + exit (0); + break; + case 'f': + show_files = TRUE; + ++report; + break; + case 'x': + show_commands = TRUE; + ++report; + break; + case 'e': + show_efficiency = TRUE; + ++report; + break; + case 'a': + show_calls = show_files = show_commands = show_efficiency = TRUE; + report = 4; + break; + case 'i': + use_stdin = TRUE; + break; + case 't': + show_all = TRUE; + report = MAXREP; + break; + case 'p': + show_proto = TRUE; + ++report; + break; + case 'I': + I_conf = (char *)getmem(sizeof(optarg)); + I_conf = optarg; + break; + case 'q': + be_quiet = TRUE; + break; + case 'v': + printf("%s\n",rcsid); + exit (0); + default : + (void) usage(); + } + } + if (report == 0) /* no options given */ + ++report; /* at least summary can be printed */ + if (! be_quiet) + hdrprt('i',0); /* print header for environment info */ + /* * Adjust argv and argc to account for the args processed above. */ + argc -= (optind - 1); argv += (optind - 1); /* - * If further args present, Assume rest are logfiles for us to process, - * otherwise, take input from Log and Stat files provided in the - * compilation environment of Taylor UUCP. If -i was given, Log already - * points to stdin and no file args are accepted. + * If further args present, Assume rest are logfiles for us to process + * which should be given in pairs (log plus stat) otherwise the results may + * not come out as expected! If no further args are present take input from + * Log and Stat files provided in the compilation environment of Taylor UUCP. + * If -i was given, Log already points to stdin and no file args are accepted. + */ + + if (use_stdin) /* If -i, read from stdin */ + { + if (argc != 1) /* No file arguments allowed */ + { + fprintf(stderr,"\a%s: (E) %s\n",Pgm_name, + "it's not posssible to give file args with '-i'"); + (void) usage(); + } + else + { + argc = 2; + Log = stdin; + if (! be_quiet) + puts(" Input from stdin; no other files will be used\n"); + } + } + else + { + if (argc != 1) /* file arguments are present */ + { + if (! be_quiet) + puts(" No defaults used; will use passed file arguments\n"); + } + else /* Read from current logs */ + { + def_logs[1] = Tlog; /* prime the */ + def_logs[2] = Tstat; /* file names */ + if (! be_quiet) + printf(" Config for this run: "); + + if (I_conf != NULL) + { + junk = 0; + if (! be_quiet) + printf("%s\n",I_conf); + if (0 != (chk_config(I_conf,be_quiet,junk))) + return (8); + } + else + { + if (D_conf != NULL) + { + junk = 1; /* indicate default (compiled) config */ + if (! be_quiet) + printf("%s\n",D_conf); + chk_config(D_conf,be_quiet,junk); + } + else + if (! be_quiet) + printf("%s\n",noConf); + } + def_logs[1] = Tlog; /* final setting of */ + def_logs[2] = Tstat; /* file names */ + argv = def_logs; /* Bash argvec to log/stat files */ + argc = sizeof(def_logs) / sizeof(def_logs[0]); + } + } + + /* -------------------------------------------------------------------- + * MAIN LOGFILE PROCESSING LOOP + * -------------------------------------------------------------------- */ - if(argc == 1) /* No file arguments */ + + if (!use_stdin) + { + if (argc < 3 && ! be_quiet) + { + puts(" (W) there is only one input file!"); + puts(" (W) some reports may not be printed"); + } + if (! be_quiet) + hdrprt('d',0); /* give subheaderline */ + } + + while (argc > 1) + { + if (!use_stdin && (Log = fopen(argv[1], "r")) == NULL) { - if (use_stdin) /* If -i, read from stdin */ - { - argc = 2; - Log = stdin; - } - else /* Read from current logs */ - { - argc = 3; /* Bash argvec to default log/stat files */ - argv = &def_logs[0]; - } + perror(argv[1]); + exit (8); } - else if (use_stdin) /* File args with -i is an error */ + setvbuf(Log,buff,_IOFBF,sizeof(buff)); + if ((flq = strrchr(argv[1], '/')) == NULL) + strncpy(Filename,argv[1],sizeof(Filename)-1); + else + strncpy(Filename,++flq,sizeof(Filename)-1); + + strcpy(in_date," n/a"); + strcpy(in_time," n/a"); + p_done = FALSE; /* no info printed yet */ + no_records = TRUE; /* not read any record yet */ + + /* + * Read each line of the logfile and collect information + */ + + while (fgets(logline, sizeof(logline), Log)) { - fprintf(stderr, "uurate (error): file args given with '-i'\n"); - goto usage; + /* + * The host name of the other end of the connection is + * always the second field of the log line, whether we + * are reading a Log file or a Stats file. Set 'p' to + * point to the second field, null-terminated. Skip + * the line if something is funny. V2 and Taylor ar identical + * up to this part. Put out the start/end date of the files read; + */ + + if (NULL == (p = strchr(logline, ' '))) + continue; + no_records = FALSE; /* got one (usable) record at least */ + ++p; + + if (NULL != (stt = strchr(p, '('))) + { + if (! p_done && ! use_stdin && ! be_quiet) + { + +#if HAVE_TAYLOR_LOGGING + sscanf(++stt,"%s%*c%[^.]",in_date,in_time); +#endif /* HAVE_TAYLOR_LOGGING */ + +#if HAVE_V2_LOGGING + sscanf(++stt,"%[^-]%*c%[1234567890:]",in_date,in_time); +#endif /* HAVE_V2_LOGGING */ + + printf(" %-14s %10s %8s",Filename, in_date, in_time); + strcpy(in_date," n/a"); /* reset to default */ + strcpy(in_time," n/a"); + p_done = TRUE; + } + else + { + if (! use_stdin && ! be_quiet) /* save for last time stamp prt. */ + strncpy(dt_info,++stt,sizeof(dt_info)-1); + } + } + + if (NULL != (s = strchr(p, ' '))) + *s = '\0'; + for (s = p; *s; ++s) + if (isupper(*s)) + *s = tolower(*s); + + /* + * Skip this line if we got -s <host> and + * this line does not contain that host name. + * Don't skip the `incoming call' line with the system name `-'. + */ + + if (Hostname[0] != '\0') + if ( (p[0] != '-' || p[1] != '\0') && 0 != strcmp(p, Hostname) ) + continue; + + /* + * We are within a call block now. If this line is a file + * transfer record, determine the direction. If not then + * skip the line if it is not interesting. + */ + + if ((s = strchr(++s, ')')) == NULL) + continue; + +#if ! HAVE_TAYLOR_LOGGING +#if HAVE_V2_LOGGING + if ((strncmp(s,") (",3)) == 0) /* are we in stats file ?) */ + if ((s = strchr(++s, ')')) == NULL) + continue; /* yes but strange layout */ +#endif /* HAVE_V2_LOGGING */ +#endif /* ! HAVE_TAYLOR_LOGGING */ + + logmsg = s + 2; /* Message is 2 characters after ')' */ + if ((0 != strncmp(logmsg, "Call complete", 13)) && + (0 != strncmp(logmsg, "Calling system", 14)) && + (0 != strncmp(logmsg, "Incoming call", 13)) && + (0 != strncmp(logmsg, "Handshake successful", 20)) && + (0 != strncmp(logmsg, "Retry time not", 14)) && + (0 != strncmp(logmsg, "ERROR: All matching ports", 25)) && + (0 != strncmp(logmsg, "Executing", 9)) && + (0 != strncmp(logmsg, "Protocol ", 9)) && + (0 != strncmp(logmsg, "sent ", 5)) && + (0 != strncmp(logmsg, "received ", 9)) && + (0 != strncmp(logmsg, "failed after ", 13)) && + (0 != strncmp(logmsg, "Errors: ", 8))) + continue; + + /* + * Find the Host_entry for this host, or create a new + * one and link it on to the list. + */ + + if ((cur == NULL) || (0 != strcmp(p, cur->Hostname))) + { + struct Host_entry *e, *last; + + for (e= cur= hosts; cur != NULL ; e= cur, cur= cur->next) + if (0 == strcmp(cur->Hostname, p)) + break; + if (cur == NULL) + { + cur= (struct Host_entry *)getmem(sizeof(*hosts)); + strcpy(cur->Hostname, p); + if (hosts == NULL) + e= hosts= cur; + else { + e = hosts; + last = NULL; + while (e != NULL) { + if (strcmp(e->Hostname, cur->Hostname) <= 0) { + if (e->next == NULL) { + e->next = cur; + break; + } + last = e; + e = e->next; + } + else { + cur->next = e; + if (last == NULL) + hosts = cur; + else + last->next = cur; + break; + } + } /* while (e != NULL) */ + } /* hosts == NULL */ + } /* cur == NULL */ + } + + /* + * OK, if this is a uuxqt record, find the Execution_Command + * structure for the command being executed, or create a new + * one. Then count an execution of this command. + * (Log file only) + */ + + if (0 == strncmp(logmsg, "Executing", 9)) + { + if (NULL == (p = strchr(logmsg, '('))) + continue; + if ((s = strpbrk(++p, " )")) == NULL) + continue; + *s = '\0'; + inc_cmd(&cur->cmds, p); + inc_cmd(&t_cmds, p); + have_commands = TRUE; + continue; + } + + /* + * Count start of outgoing call. + */ + + if ((0 == strncmp(logmsg, "Calling system", 14)) || + (0 == strncmp(logmsg, "Retry time not", 14)) || + (0 == strncmp(logmsg, "ERROR: All matching ports", 25))) + { + called = OUT; + cur->call[OUT].calls++; + have_calls = TRUE; + s_prot = NULL; /* destroy pointer to protocol */ + continue; + } + + /* + * Count start of incoming call. + */ + + if (0 == strncmp(logmsg, "Incoming call", 13)) + { + called = IN; + s_prot = NULL; /* destroy pointer to protocol */ + continue; + } + + /* + * On an incoming call, get system name from the second line. + * Get protocol type and size/window too + */ + + if (0 == strncmp(logmsg, "Handshake successful", 20)) + { + if ( called==IN ) + cur->call[IN].calls++; + have_calls = TRUE; + s_prot = NULL; /* destroy pointer to protocol */ + if (NULL == (p = strchr(logmsg, '('))) + continue; + if (0 == strncmp(p, "(protocol ", 10)) + { + if (NULL == (p = strchr(p, '\''))) + continue; + ss_prot = prot_sum(&cur->proto, ++p, 1); + s_prot = prot_sum(&t_prot, p, 1); + continue; + } + } + + /* + * check protocol type and get stats + * + */ + + if (0 == strncmp(logmsg, "Protocol ", 9)) + { + s_prot = NULL; /* destroy pointer to protocol */ + if (NULL == (p = strchr(logmsg, '\''))) + continue; + ss_prot = prot_sum(&cur->proto, ++p, 2); + s_prot = prot_sum(&t_prot, p, 2); + continue; + } + + /* + * check protocol errors. Unfortunately the line does not contain + * the used protocol, so if any previous line did contain that + * information and we did process that line we will save the pointer + * to that particular segment into s_prot. If this pointer is not set + * the error info is lost for we don't know where to store. + * + */ + + if ((0 == strncmp(logmsg, "Errors: header", 14)) && s_prot != NULL) + { + int i1,i2,i3,i4 = 0; + sscanf(logmsg,"%*s %*s %d%*c%*s %d%*c%*s %d%*c%*s %*s%*c %d",&i1,&i2,&i3,&i4); + ss_prot->pr_eheader += i1; + ss_prot->pr_echksum += i2; + ss_prot->pr_eorder += i3; + ss_prot->pr_ereject += i4; + s_prot->pr_eheader += i1; + s_prot->pr_echksum += i2; + s_prot->pr_eorder += i3; + s_prot->pr_ereject += i4; + s_prot = NULL; + continue; + } + + /* + * Handle end of call. Pick up the connect time. + * position is on the closing paren of date/time info + * i.e: ) text.... + */ + + if (0 == strncmp(logmsg, "Call complete", 13)) + { + cur->call[called].succs++; + s_prot = NULL; /* destroy pointer to protocol */ + if (NULL == (s = strchr(logmsg, '('))) + continue; + cur->call[called].connect_time += atof(s+1); + continue; + } + + /* + * We are definitely in a Stats file now. + * If we reached here, this must have been a file transfer + * record. Count it in the field corresponding to the + * direction of the transfer. Count bytes transferred and + * the time to transfer as well. + * Position within the record is at the word 'received' or 'sent' + * depending on the direction. + */ + + sent = IN; /* give it an initial value */ + if (0 == strncmp(logmsg, "failed after ",13)) + logmsg += 13; /* the transmission failed for any reason */ + /* so advance pointer */ + if (0 == strncmp(logmsg, "sent", 4)) + sent = OUT; + else if (0 == strncmp(logmsg, "received", 8)) + sent = IN; + have_files[sent] = TRUE; + cur->call[called].flow[sent].files++; + if (NULL == (s = strchr(logmsg, ' '))) /* point past keyword */ + continue; /* nothing follows */ + /* we should be at the bytes column now*/ +#if HAVE_TAYLOR_LOGGING + cur->call[called].flow[sent].bytes += atol(++s); +#endif /* HAVE_TAYLOR_LOGGING */ +#if HAVE_V2_LOGGING + if (NULL == (s = strpbrk(s, "0123456789"))) /* point to # bytes */ + continue; + cur->call[called].flow[sent].bytes += atol(s); +#endif /* HAVE_V2_LOGGING */ + if (NULL == (s = strchr(s, ' '))) /* point past # of bytes */ + continue; + if (NULL == (s = strpbrk(s, "0123456789"))) /* point to # of seconds */ + continue; + cur->call[called].flow[sent].time += atof(s); + + } /* end of while (fgets(logline...)) */ + + if (stt != NULL && ! use_stdin && ! be_quiet && ! no_records) + { + +#if HAVE_TAYLOR_LOGGING + sscanf(dt_info,"%s%*c%[^.]",in_date,in_time); +#endif /* HAVE_TAYLOR_LOGGING */ + +#if HAVE_V2_LOGGING + sscanf(dt_info,"%[^-]%*c%[1234567890:]",in_date,in_time); +#endif /* HAVE_V2_LOGGING */ + + printf(" %10s %8s\n",in_date, in_time); + p_done = FALSE; } + if (Log != stdin) + { + if (0 != ferror(Log)) + { + if (! be_quiet) + printf(" %-14s data is incomplete; read error"," "); + else + fprintf(stderr,"%s (W) data is incomplete; read error on %s\n", + Pgm_name,argv[1]); + } + else + { + if (! be_quiet && no_records) + printf(" %-14s %10s\n",Filename, " is empty "); + } + } + fclose(Log); -#if _DEBUG_ - printf("\n"); -#endif + argc--; + argv++; + } /* end of while (for (argv ....) */ /* - * MAIN LOGFILE PROCESSING LOOP + * do we have *any* data ? */ - while (argc > 1) - { - if (!use_stdin && (Log = fopen(argv[1], "r")) == NULL) - { - perror(argv[1]); - return; - } + if (cur == NULL) + { + puts("\n(I) Sorry! No data is available for any requested report\n"); + exit(0); + } -#if _DEBUG_ - printf("Reading %s...\n", (use_stdin ? "stdin" : argv[1])); -#endif - - /* - * Read each line of the logfile and collect information - */ - while (fgets(logline, sizeof(logline), Log)) - { - /* - * The host name of the other end of the connection is - * always the second field of the log line, whether we - * are reading a Log file or a Stats file. Set 'p' to - * point to the second field, null-terminated. Skip - * the line if something is funny. - */ - if (NULL == (p = strchr(logline, ' '))) - continue; - ++p; - if (NULL != (s = strchr(p, ' '))) - *s = '\0'; - for (s = p; *s; ++s) - if (isupper(*s)) - *s = tolower(*s); - /* - * Skip this line if we got -h <host> and - * this line does not contain that host name. - */ - if (Hostname[0] != '\0') - if (0 != strcmp(p, Hostname)) - continue; - /* - * We are within a call block now. If this line is a file - * transfer record, determine the direction. If not then - * skip the line if it is not interesting. - */ - if ((s = strchr(++s, ')')) == NULL) - continue; - logmsg = s + 2; /* Message is 2 characters after ')' */ - if (0 == strncmp(logmsg, "sent", 4)) - sent = OUT; - else - if (0 == strncmp(logmsg, "received", 8)) - sent = IN; - else - if ((0 != strncmp(logmsg, "Call complete", 13)) && - (0 != strncmp(logmsg, "Calling system", 14)) && - (0 != strncmp(logmsg, "Incoming call", 13)) && - (0 != strncmp(logmsg, "Executing", 9))) - continue; - /* - * Find the Host_entry for this host, or create a new - * one and link it on to the list. - */ - if ((cur == NULL) || (0 != strcmp(p, cur->Hostname))) - { - for (cur = hosts; cur != NULL ; cur = cur->next) - if (0 == strcmp(cur->Hostname, p)) - break; - if (cur == NULL) - { - cur = (struct Host_entry *)calloc(1, sizeof(*hosts)); - strcpy(cur->Hostname, p); - if (hosts == NULL) - hosts = cur; - else - { - for (e = hosts; e->next != NULL; e = e->next); - e->next = cur; - } - } - } - /* - * OK, if this is a uuxqt record, find the Execution_Command - * structure for the command being executed, or create a new - * one. Then count an execution of this command. - */ - if (0 == strncmp(logmsg, "Executing", 9)) - { - if (NULL == (p = strchr(logmsg, '('))) - continue; - if ((s = strpbrk(++p, " )")) == NULL) - continue; - *s = '\0'; - for (cmd = cur->cmds; cmd != NULL; cmd = cmd->next) - if (0 == strcmp(cmd->Commandname, p)) - break; - if (cmd == NULL) - { - cmd = (struct Execution_Command *)calloc(1, sizeof(*cmd)); - strcpy(cmd->Commandname, p); - if (cur->cmds == NULL) - cur->cmds = cmd; - else - { - for (ec = cur->cmds; ec->next != NULL; ec = ec->next); - ec->next = cmd; - } - } - ++cmd->count; - have_commands = 1; - continue; - } - /* - * Count start of outgoing call. - */ - if (0 == strncmp(logmsg, "Calling system", 14)) - { - called = OUT; - cur->call[called].calls += 1; - have_calls = 1; - continue; - } - /* - * Count start of incoming call. - */ - if (0 == strncmp(logmsg, "Incoming call", 13)) - { - called = IN; - cur->call[called].calls += 1; - have_calls = 1; - continue; - } - /* - * Handle end of call. Pick up the connect time. - */ - if (0 == strncmp(logmsg, "Call complete", 13)) - { - cur->call[called].succs += 1; - if (NULL == (s = strchr(logmsg, '('))) - continue; - cur->call[called].connect_time += atof(s+1); - continue; - } - /* - * If we reached here, this must have been a file transfer - * record. Count it in the field corresponding to the - * direction of the transfer. Count bytes transferred and - * the time to transfer as well. - */ - have_files = 1; - cur->call[called].flow[sent].files += 1; - if (NULL == (s = strchr(logmsg, ' '))) - continue; - cur->call[called].flow[sent].bytes += atol(++s); - if (NULL == (s = strchr(s, ' '))) - continue; - if (NULL == (s = strpbrk(s, "0123456789"))) - continue; - cur->call[called].flow[sent].time += atof(s); - } - argc -= 1; - argv += 1; - if(Log != stdin) - fclose(Log); - } - /* - * *********** - * * REPORTS * - * *********** + * truncate hostname, alloc the structure holding the totals and + * collect the totals data */ + for (cur = hosts; cur != NULL;cur = cur->next) + { + cur->Hostname[MAXDNAME] = '\0'; + if (cur->next == NULL) /* last so will have to alloc totals */ + { + cur->next = (struct Host_entry *)getmem(sizeof(*hosts)); + strcpy(cur->next->Hostname,"Totals"); + tot = cur->next; + for (cur = hosts; cur != NULL; cur = cur->next) + { + if (cur->next != NULL) /* don't count totals to totals */ + { + tot->call[IN].flow[IN].bytes += cur->call[IN].flow[IN].bytes; + tot->call[OUT].flow[IN].bytes += cur->call[OUT].flow[IN].bytes; + tot->call[IN].flow[OUT].bytes += cur->call[IN].flow[OUT].bytes; + tot->call[OUT].flow[OUT].bytes += cur->call[OUT].flow[OUT].bytes; + tot->call[IN].flow[IN].time += cur->call[IN].flow[IN].time; + tot->call[OUT].flow[IN].time += cur->call[OUT].flow[IN].time; + tot->call[IN].flow[OUT].time += cur->call[IN].flow[OUT].time; + tot->call[OUT].flow[OUT].time += cur->call[OUT].flow[OUT].time; + tot->call[IN].flow[IN].files += cur->call[IN].flow[IN].files; + tot->call[OUT].flow[IN].files += cur->call[OUT].flow[IN].files; + tot->call[IN].flow[OUT].files += cur->call[IN].flow[OUT].files; + tot->call[OUT].flow[OUT].files += cur->call[OUT].flow[OUT].files; + tot->call[OUT].succs += cur->call[OUT].succs; + tot->call[OUT].calls += cur->call[OUT].calls; + tot->call[OUT].connect_time += cur->call[OUT].connect_time; + tot->call[IN].succs += cur->call[IN].succs; + tot->call[IN].calls += cur->call[IN].calls; + tot->call[IN].connect_time += cur->call[IN].connect_time; + } + } + break; /* totals is last in Host_Entry */ + } + } + /* - * Truncate the Hostnames to 8 characters at most. + * *********** + * * REPORTS * + * *********** */ - for (cur = hosts; cur != NULL; cur = cur->next) - cur->Hostname[8] = '\0'; #if _DEBUG_ - printf("\n"); + putchar('\n'); #endif - /* - * Summary report + /* ------------------------------------------------------------------ + * + * Summary report only when no other report except option -t is given * * I know, this code could be tightened (rbd)... + * ------------------------------------------------------------------ */ - if(show_summary) - { - char t1[32], t2[32], t3[32], t4[32], t5[32]; - long ib, ob, b, rf, sf; - long t_ib=0, t_ob=0, t_b=0, t_rf=0, t_sf=0; - double it, ot, ir, or; - double t_it=0.0, t_ot=0.0; - int nhosts = 0; - - printf("\n\ - Remote ------- Bytes -------- --- Time ---- -- Avg CPS -- -- Files --\n"); - printf("\ - Host Rcvd Sent Total Rcvd Sent Rcvd Sent Rcvd Sent\n"); - printf("\ --------- ------- ------- ------- ------ ------ ------ ------ ----- -----\n"); - for (cur = hosts; cur != NULL; cur = cur->next) - { - ib = (cur->call[IN].flow[IN].bytes + - cur->call[OUT].flow[IN].bytes); - fmbytes(ib, t1); - t_ib += ib; - - ob = (cur->call[IN].flow[OUT].bytes + - cur->call[OUT].flow[OUT].bytes); - fmbytes(ob, t2); - t_ob += ob; - - b = ib + ob; - fmbytes(b, t3); - t_b += b; - - it = cur->call[IN].flow[IN].time + - cur->call[OUT].flow[IN].time; - fmtime(it, t4); - t_it += it; - - ot = cur->call[IN].flow[OUT].time + - cur->call[OUT].flow[OUT].time; - fmtime(ot, t5); - t_ot += ot; - - rf = cur->call[IN].flow[IN].files + - cur->call[OUT].flow[IN].files; - t_rf += rf; - - sf = cur->call[IN].flow[OUT].files + - cur->call[OUT].flow[OUT].files; - t_sf += sf; - - ir = (it == 0.0) ? 0.0 : (ib / it); - or = (ot == 0.0) ? 0.0 : (ob / ot); - - printf("%-8s %7s %7s %7s %6s %6s %6.1f %6.1f %5d %5d\n", - cur->Hostname, - t1, t2, t3, t4, t5, - ir, or, rf, sf); - } - - if(nhosts > 1) - { - fmbytes(t_ib, t1); - fmbytes(t_ob, t2); - fmbytes(t_b, t3); - fmtime(t_it, t4); - fmtime(t_ot, t5); - ir = (t_it == 0.0) ? 0.0 : (t_ib / t_it); - or = (t_ot == 0.0) ? 0.0 : (t_ob / t_ot); - - printf("\ --------- ------- ------- ------- ------ ------ ------ ------ ----- -----\n"); - printf("\ -Totals %7s %7s %7s %6s %6s %6.1f %6.1f %5d %5d\n", - t1, t2, t3, t4, t5, - ir, or, t_rf, t_sf); - } - } - - /* - * Call statistics report + if ( !(show_calls || show_files || + show_efficiency || show_commands || show_proto) || show_all) + { + if (have_calls || have_files[IN] || have_files[OUT]) + { + char t1[32], t2[32], t3[32], t4[32], t5[32]; + long ib, ob, b, rf, sf; + double it, ot, ir, or; + + hdr_done = FALSE; + for (cur = hosts; cur != NULL; cur = cur->next) + { + ib = (cur->call[IN].flow[IN].bytes + + cur->call[OUT].flow[IN].bytes); + fmbytes(ib, t1); + + ob = (cur->call[IN].flow[OUT].bytes + + cur->call[OUT].flow[OUT].bytes); + fmbytes(ob, t2); + + /* Don't print null-lines. */ + if (( b= ib+ob ) == 0 ) + continue; + /* Don't print the header twice. */ + if (! hdr_done) + { + hdrprt('s',0); /* print the header line(s) */ + hdr_done = TRUE; + } + + fmbytes(b, t3); + + it = cur->call[IN].flow[IN].time + + cur->call[OUT].flow[IN].time; + fmtime(it, t4); + + ot = cur->call[IN].flow[OUT].time + + cur->call[OUT].flow[OUT].time; + fmtime(ot, t5); + + rf = cur->call[IN].flow[IN].files + + cur->call[OUT].flow[IN].files; + + sf = cur->call[IN].flow[OUT].files + + cur->call[OUT].flow[OUT].files; + + ir = (it == 0.0) ? 0.0 : (ib / it); + or = (ot == 0.0) ? 0.0 : (ob / ot); + + if (cur->next == NULL) /* totals line reached ? */ + hdrprt('s',1); /* print the separator line */ + + printf("%-8s %4d %4d %9s %9s %9s %9s %9s %5.0f %5.0f\n", + cur->Hostname, rf, sf, + t1, t2, t3, t4, t5, + ir, or); + } + if (! hdr_done) + { + puts("\n(I) No data found to print Compact summary report"); + } + } + else + { + puts("\n(I) No data available for Compact summary report"); + --report; + } + } + + /* ------------------------------------------------------------------ + * Protocol statistics report + * ------------------------------------------------------------------ */ - if(show_calls && have_calls) - { - char t1[32], t2[32]; - - printf("\nCall statistics:\n"); - printf("\ - sysname callto failto totime callfm failfm fmtime\n"); - printf("\ - -------- ------ ------ -------- ------ ------ --------\n"); - for (cur = hosts; cur != NULL; cur = cur->next) - { - fmtime(cur->call[OUT].connect_time, t1); - fmtime(cur->call[IN].connect_time, t2), - printf(" %-8s %6d %6d %8s %6d %6d %8s\n", - cur->Hostname, - cur->call[OUT].calls, - cur->call[OUT].calls - cur->call[OUT].succs, - t1, - cur->call[IN].calls, - cur->call[IN].calls - cur->call[IN].succs, - t2); - } - } - /* - * File statistics report + if (show_proto || show_all) + { + if (have_proto) + { + /* --------------------- */ + /* protocol packet report */ + /* --------------------- */ + + char *type = NULL; + hdr_done = FALSE; + for (cur = hosts; cur != NULL; cur = cur->next) + { + type = cur->Hostname; + if (cur->next == NULL) + { + if (hdr_done) + puts("-------------------------------------------------------------------"); + cur->proto = t_prot; + } + for (prot = cur->proto; prot != NULL; prot = prot->next) + { + if (! hdr_done) + { + hdrprt('p',0); /* print the header line(s) */ + hdr_done = TRUE; + } + printf("%-8s %3s %4d %4d %5d %4d %10d %7d %10d\n", + type == NULL ? " ":cur->Hostname, + prot->type, + prot->pr_psizemin, + prot->pr_psizemax, + prot->pr_pwinmin, + prot->pr_pwinmax, + prot->pr_psent, + prot->pr_present, + prot->pr_preceived); + type = NULL; + } + } + if (! hdr_done) + puts("\n(I) No data found to print Protocol packet report"); + + /* --------------------- */ + /* protocol error report */ + /* --------------------- */ + + type = NULL; + hdr_done = FALSE; + if (t_prot != NULL) + { + for (cur = hosts; cur != NULL; cur = cur->next) + { + type = cur->Hostname; + if (cur->next == NULL) + { + if (hdr_done) + puts("--------------------------------------------------------------"); + cur->proto = t_prot; + } + + for (prot = cur->proto; prot != NULL; prot = prot->next) + { + if ((prot->pr_eheader + prot->pr_echksum + + prot->pr_eorder + prot->pr_ereject) != 0) + { + if (! hdr_done) + { + hdrprt('p',1); /* print the header line(s) */ + hdr_done = TRUE; + } + printf("%-8s %3s %11d %11d %11d %11d\n", + type == NULL ? " ":cur->Hostname, + prot->type, + prot->pr_eheader, + prot->pr_echksum, + prot->pr_eorder, + prot->pr_ereject); + type = NULL; + } + } + } + } + if (! hdr_done) + puts("\n(I) No data found to print Protocol error report"); + } + else + { + puts("\n(I) No data available for Protocol reports"); + --report; + } + } + + /* ------------------------------------------------------------------ + * Call statistics report + * ------------------------------------------------------------------ */ - if(show_files && have_files) - { - char t1[32], t2[32]; - - for (sent = IN; sent <= OUT; ++sent) - { - printf(file_hdr[sent]); - printf(" sysname files bytes xfr time byte/s\n"); - printf(" -------- ------ -------- -------- ------\n"); - for (cur = hosts; cur != NULL; cur = cur->next) - { - double rate; - double time; - - time = cur->call[IN].flow[sent].time + - cur->call[OUT].flow[sent].time; - if (time == 0.0) - continue; - rate = (cur->call[IN].flow[sent].bytes + - cur->call[OUT].flow[sent].bytes) / time; - fmbytes((cur->call[IN].flow[sent].bytes + - cur->call[OUT].flow[sent].bytes), t1); - fmtime((cur->call[IN].flow[sent].time + - cur->call[OUT].flow[sent].time), t2); - printf(" %-8s %6d %8s %8s %6.1f\n", - cur->Hostname, - cur->call[IN].flow[sent].files + - cur->call[OUT].flow[sent].files, - t1, t2, rate); - } - } - } - /* - * Efficiency report + if (show_calls || show_all) + { + if (have_calls) + { + char t1[32], t2[32]; + + hdr_done = FALSE; + for (cur = hosts; cur != NULL; cur = cur->next) + { + if (cur->next == NULL) + { + if (hdr_done) + hdrprt('c',1); /* print the separator line */ + } + else + { + /* Don't print null-lines on deatail lines */ + if ( cur->call[OUT].calls + cur->call[IN].calls == 0 ) + continue; + + /* Don't print the header twice. */ + if (! hdr_done) + { + hdrprt('c',0); /* print the header line(s) */ + hdr_done = TRUE; + } + } + if ( cur->call[OUT].calls > 0 || cur->next == NULL) + { + fmtime(cur->call[OUT].connect_time, t1); + printf( " %-8s %7d %7d %7d %9s", + cur->Hostname, + cur->call[OUT].succs, + cur->call[OUT].calls - cur->call[OUT].succs, + cur->call[OUT].calls, + t1 ); + } + else + { + printf( " %-42s", cur->Hostname ); + } + if ( cur->call[IN].calls > 0 || cur->next == NULL ) + { + fmtime(cur->call[IN].connect_time, t2); + printf( " %7d %7d %7d %9s", + cur->call[IN].succs, + cur->call[IN].calls - cur->call[IN].succs, + cur->call[IN].calls, + t2 ); + } + putchar('\n'); + } + if (! hdr_done) + { + puts("\n(I) No data found to print Call statistics report"); + } + } + else + { + puts("\n(I) No data available for Call statistics report"); + --report; + } + } + + /* ------------------------------------------------------------------ + * File statistics report + * ------------------------------------------------------------------ */ - if (show_efficiency && have_files) + + if (show_files || show_all) + { + if (have_files[IN] || have_files[OUT]) + { + char t1[32], t2[32]; + double rate = 0, time = 0; + int b = 0; + int lineOut = 0; + + hdr_done = FALSE; + for (cur = hosts; cur != NULL; cur = cur->next) + { + lineOut = 0; + for (sent= IN; sent <= OUT; ++sent) + { + b = cur->call[IN].flow[sent].bytes + + cur->call[OUT].flow[sent].bytes; + time = cur->call[IN].flow[sent].time + + cur->call[OUT].flow[sent].time; + + /* Don't print null-lines on detail lines. */ + if ( (b != 0 && time != 0.0) || cur->next == NULL) + { + /* Don't print the header twice. */ + if (! hdr_done) + { + hdrprt('f',0); /* print the header line(s) */ + hdr_done = TRUE; + } + fmbytes(b, t1); + rate = (cur->call[IN].flow[sent].bytes + + cur->call[OUT].flow[sent].bytes) / time; + fmtime((cur->call[IN].flow[sent].time + + cur->call[OUT].flow[sent].time), t2); + + if (lineOut == 0) /* first half not printed yet ? */ + { + if (cur->next == NULL) /* totals line ? */ + hdrprt('f',1); /* print the separator line */ + printf(" %-8s", cur->Hostname); + if (sent == OUT) /* can't happen whith totals line */ + printf("%34s", " "); + } + + printf(" %5d %11s %9s %5.0f", + cur->call[IN].flow[sent].files + + cur->call[OUT].flow[sent].files, + t1, t2, rate); + lineOut = 1; + } + } /* end: for (sent ... ) */ + if (lineOut) + printf("\n"); + } /* end: for (cur= ... ) */ + if (! hdr_done) + { + puts("\n(I) No data found to print File statistics report"); + } + } + else + { + puts("\n(I) No data available for File statistics report"); + --report; + } + } + + /* ------------------------------------------------------------------ + * Efficiency report + * ------------------------------------------------------------------ + */ + + if (show_efficiency || show_all) + { + if (have_files[IN] || have_files[OUT]) + { + char t1[32], t2[32], t3[32]; + double total, flow; + + hdr_done = FALSE; + for (cur = hosts; cur != NULL; cur = cur->next) + { + /* Don't print null-lines. */ + if ( 0 == cur->call[IN].flow[IN].files + + cur->call[IN].flow[OUT].files + + cur->call[OUT].flow[IN].files + + cur->call[OUT].flow[OUT].files || + 0.0 == (total= cur->call[IN].connect_time + + cur->call[OUT].connect_time)) + { + continue; + } + + if (! hdr_done) + { + hdrprt('e',0); /* print the header line(s) */ + hdr_done = TRUE; + } + + flow = cur->call[IN].flow[IN].time + + cur->call[IN].flow[OUT].time + + cur->call[OUT].flow[IN].time + + cur->call[OUT].flow[OUT].time; + fmtime(total, t1); + fmtime(flow, t2); + fmtime(total-flow, t3); + + if (cur->next == NULL) + hdrprt('e',1); /* print the separator line */ + + printf(" %-8s %10s %10s %10s %7.2f\n", + cur->Hostname, t1, t2, t3, + flow >= total ? 100.0: flow*100.0/total); + } /* end: for (cur= .. */ + if (! hdr_done) + { + puts("\n(I) No data found to print Efficiency report"); + } + } + else + { + puts("\n(I) No data available for Efficiency report"); + --report; + } + } + + /* ------------------------------------------------------------------ + * Command execution report + * ------------------------------------------------------------------ + */ + + if (show_commands || show_all) + { + if (have_commands) + { + int ncmds, i, match; + + /* + * layout the header line. The column's header is the command name + */ + + hdr_done = FALSE; + for (ncmds= 0, cmd= t_cmds; + cmd != NULL && ncmds <= MAXCOLS-1; + ncmds++, cmd= cmd->next) + { + if (! hdr_done) + { + puts("\nCommand executions:"); + puts("-------------------"); + puts(" Name of "); + fputs(" site ", stdout); + hdr_done = TRUE; + } + printf(" %7s", cmd->Commandname); + } + if (! hdr_done) + { + puts("\n(I) No data found to print Command execution report"); + } + else + { + fputs("\n --------", stdout); + for (i= 0; i<ncmds; i++) + fputs(" ------", stdout); + putchar('\n'); + + /* + * print out the number of executions for each host/command + */ + + for (cur= hosts; cur != NULL; cur= cur->next) + { + if (cur->next == NULL) + break; + + /* Don't print null-lines. */ + + if (cur->cmds == NULL) + continue; + + printf(" %-8s", cur->Hostname); + for (cmd= t_cmds; cmd != NULL; cmd= cmd->next) + { + struct Execution_Command *ec; + match = FALSE; + for(ec= cur->cmds; ec != NULL; ec= ec->next) + { + if ( 0 == strcmp(cmd->Commandname, ec->Commandname) ) + { + printf(" %7d", ec->count); + match = TRUE; + break; + } + } + if (! match) + printf("%8s"," "); /* blank out column */ + } + putchar('\n'); + } + + /* + * print the totals line + */ + + fputs(" --------", stdout); + for (i= 0; i<ncmds; i++) + fputs("--------", stdout); + printf("\n %-8s", cur->Hostname); + for (cmd= t_cmds; cmd != NULL; cmd= cmd->next) + { + printf(" %7d", cmd->count); + } + putchar('\n'); + } + } + else + { + puts("\n(I) No data available for Command execution report"); + --report; + } + } + if (report <= 0 ) /* any reports ? */ + { + puts("\n(I) Sorry! No data is available for any requested report\n"); + exit(1); + } + + puts("\n(I) End of reports\n"); + exit (0); +} /* end of main */ + + /* ------------------------------------------------------------------ + * * Functions * + * ------------------------------------------------------------------ + */ + + /* ------------------------------------------------------------------ + * display the help + * ------------------------------------------------------------------ + */ + +void usage() +{ + fprintf(stderr,"Usage uurate [-acdefhiptvx] [-s hostname] [-I config file] [logfile(s) ... logfile(s)]\n"); + fprintf(stderr,"where:\t-a\tPrint reports c,e,f,x\n"); + fprintf(stderr,"\t-c\tReport call statistics\n"); + fprintf(stderr,"\t-d\tPrint the name of the default config file\n"); + fprintf(stderr,"\t-e\tReport efficiency statistics\n"); + fprintf(stderr,"\t-f\tReport file transfer statistics\n"); + fprintf(stderr,"\t-h\tPrint this help\n"); + fprintf(stderr,"\t-i\tRead log info from standard input\n"); + fprintf(stderr,"\t-p\tReport protocol statistics\n"); + fprintf(stderr,"\t-t\tAll available reports plus compact summary report\n"); + fprintf(stderr,"\t-v\tPrint version number\n"); + fprintf(stderr,"\t-x\tReport command execution statistics\n"); + fprintf(stderr,"\t-s host\tReport activities involving HOST only\n"); + fprintf(stderr,"\t-I config Use config instead of standard config file\n"); + fprintf(stderr,"If no report options given, a compact summary report is printed.\n"); + fprintf(stderr,"log files should be given as pairs that is Log/Stats ... .\n"); + fprintf(stderr,"If neither -i nor logfiles given, those names found in config will be used\n"); + + exit (1); +} + + /* ------------------------------------------------------------------ + * getmem - get some memory + * ------------------------------------------------------------------ + */ + +static pointer *getmem(n) + unsigned n; +{ + pointer *p; + + if( NULL== (p= calloc(1, n)) ) { - char t1[32], t2[32], t3[32]; - double total, flow; - - printf("\nEfficiency:\n"); - printf(" sysname conntime flowtime ovhdtime eff. %%\n"); - printf(" -------- -------- -------- -------- ------\n"); - for (cur = hosts; cur != NULL; cur = cur->next) - { - total = cur->call[IN].connect_time + cur->call[OUT].connect_time; - flow = cur->call[IN].flow[IN].time + cur->call[IN].flow[OUT].time + - cur->call[OUT].flow[IN].time + cur->call[OUT].flow[OUT].time; - fmtime(total, t1); - fmtime(flow, t2); - fmtime((total-flow), t3); - printf(" %-8s %8s %8s %8s %5.1f%%\n", - cur->Hostname, t1, t2, t3, ((flow / total) * 100.0)); - } + fprintf(stderr,"\a%s (C) %s\n",Pgm_name, "out of memory\n"); + exit (8); } + return p; +} + + /* ------------------------------------------------------------------ + * inc_cmd - increment command count + * ------------------------------------------------------------------ + */ + +static void inc_cmd(cmds, name) + struct Execution_Command **cmds; + char *name; +{ + int cnt = 0; + struct Execution_Command *cmd, *ec; + + for (ec = cmd = *cmds; cmd != NULL; ec= cmd, cmd= cmd->next, cnt++) + if ( (0 == strcmp(cmd->Commandname, name)) || + (0 == strcmp(cmd->Commandname, "Misc.")) ) + break; + if (cmd == NULL) + { + cmd= (struct Execution_Command *)getmem(sizeof(*cmd)); + if (cnt <= MAXCOLS-1) /* first col prints site name therefore < max-1 */ + { + strcpy(cmd->Commandname, name); + if (*cmds == NULL) + ec = *cmds = cmd; + else + ec->next= cmd; + } + else + { + strcpy(ec->Commandname, "Misc."); /* reached high-water-mark */ + cmd = ec; /* backtrack */ + } + } + cmd->count++; +} + + + /* ------------------------------------------------------------------ + * prot_sum - collect protocol data + * ------------------------------------------------------------------ + */ + + struct Protocol_Summary * + prot_sum(proto, ptype, ind) + struct Protocol_Summary **proto; + char *ptype; + int ind; +{ + int cnt = 0; + int i1, i2, i3 = 0; + struct Protocol_Summary *cur, *first; + for (first = cur = *proto; cur != NULL; first= cur, cur= cur->next, cnt++) + { + if ( (0 == strncmp(cur->type, ptype,strlen(cur->type)))) + break; + } + if (cur == NULL) + { + cur= (struct Protocol_Summary *)getmem(sizeof(*cur)); + sscanf(ptype,"%[^\' ]3",cur->type); + if (*proto == NULL) + first = *proto = cur; + else + first->next= cur; + } + if (NULL == (ptype = strchr(ptype, ' '))) + return (NULL); + cur->pr_cnt++; + have_proto = TRUE; + ++ptype; + switch(ind) + { + case 1: /* used protocol line */ /* - * Command execution report - */ - if (show_commands & have_commands) - { - printf("\nCommand executions:\n"); - printf(" sysname rmail rnews other\n"); - printf(" -------- ------ ------ ------\n"); - for (cur = hosts; cur != NULL; cur = cur->next) - { - int rmail, rnews, other; - - if (cur->cmds == NULL) - continue; - rmail = rnews = other = 0; - for (cmd = cur->cmds; cmd != NULL; cmd = cmd->next) - { - if (strcmp(cmd->Commandname, "rmail") == 0) - rmail += cmd->count; - else if (strcmp(cmd->Commandname, "rnews") == 0) - rnews += cmd->count; - else - other += cmd->count; - } - printf(" %-8s %6d %6d %6d\n", cur->Hostname, - rmail, rnews, other); - } - } - return; - - usage: - fprintf(stderr, - "Usage uurate [-cfexai] [-h hostname] [logfile ... logfile]\n"); - fprintf(stderr,"where:\t-c\tReport call statistics\n"); - fprintf(stderr, "\t-f\tReport file transfer statistics\n"); - fprintf(stderr, "\t-e\tReport efficiency statistics\n"); - fprintf(stderr, "\t-x\tReport command execution statistics\n"); - fprintf(stderr, "\t-a\tAll of the above reports\n"); - fprintf(stderr, "\t-h host\tReport activities involving ONLY host\n"); - fprintf(stderr, "\t-i\tRead log info from standard input\n"); - fprintf(stderr, - "If no report options given, a compact summary report is given.\n"); - fprintf(stderr, - "If neither -i nor logfiles given, defaults to reading from\n"); - fprintf(stderr, "%s and %s\n\n", LOGFILE, STATFILE); + * uucp-1.04 format: .... packet size ssss window ww) + * uucp-1.05 format: .... remote packet/window ssss/ww local ssss/ww) + * (the remote packet/window will be used!) + */ + + i1 = i2 = 0; /* reset */ + + if (NULL == (strchr(ptype, '/'))) + sscanf(ptype,"%*s %*s %d %*s %d",&i1,&i2); + else + sscanf(ptype,"%*s %*s %d/%d",&i1,&i2); + + if (i1 > cur->pr_psizemax) + cur->pr_psizemax = i1; + if (i1 < cur->pr_psizemin || cur->pr_psizemin == 0) + cur->pr_psizemin = i1; + + if (i2 > cur->pr_pwinmax) + cur->pr_pwinmax = i2; + if (i2 < cur->pr_pwinmin || cur->pr_pwinmin == 0) + cur->pr_pwinmin = i2; + break; + case 2: /* protocol statistics line */ + i1 = i2 = i3 = 0; /* reset */ + sscanf(ptype,"%*s %*s %d%*c %*s %d%*c %*s %d",&i1,&i2,&i3); + cur->pr_psent += i1; + cur->pr_present += i2; + cur->pr_preceived += i3; + break; + default: + break; + } + return (cur); } + /* ------------------------------------------------------------------ + * fmtime() - Format time in hours & minutes & seconds; + * ------------------------------------------------------------------ + */ -/* - * fmtime() - Format time in hours & minutes; - */ static void fmtime(dsec, buf) - double dsec; - char *buf; + double dsec; + char *buf; { long hrs, min, lsec; - lsec = dsec; - hrs = lsec / 3600L; - min = (lsec - (hrs * 3600L)) / 60L; + if( dsec <= 0 ) + { + strcpy(buf, "0" ); + return; + } + lsec = fmod(dsec+0.5, 60L); /* round to the next full second */ + hrs = dsec / 3600L; + min = ((long)dsec / 60L) % 60L; + if (hrs == 0) + if (min == 0) + sprintf(buf,"%6s%2ld"," ",lsec); + else + sprintf(buf,"%3s%2ld:%02ld"," ",min,lsec); + else + sprintf(buf,"%2ld:%02ld:%02ld",hrs,min,lsec); - sprintf(buf, "%02ld:%02ld", hrs, min); } -/* - * fmbytes - Format size in bytes - */ + /* ------------------------------------------------------------------ + * fmbytes - Format size in bytes + * ------------------------------------------------------------------ + */ + static void fmbytes(n, buf) - unsigned long n; - char *buf; + unsigned long n; + char *buf; { - char t; - double s = n; + if ( n == 0 ) + { + strcpy( buf, "0.0" ); + return; + } + sprintf(buf, "%.1f", (double)n / 1000.0); /* Display in Kilobytes */ +} - if(s >= 10239897.6) /* More than 9999.9K ? */ - { - s = (double)n / 1048576.0; /* Yes, display in Megabytes */ - t = 'M'; - } - else - { - s = (double)n / 1024.0; /* Display in Kilobytes */ - t = 'K'; - } - sprintf(buf, "%.1f%c", s, t); + /* ------------------------------------------------------------------ + * chk_config - Read the config file + * check on keywords: logfile and statfile. When found override + * the corresponding default + * ------------------------------------------------------------------ + */ + +int chk_config(char *T_conf,int be_quiet, int type) +{ + FILE *Conf; + char keywrd[9]; + char name[MAXPATHLEN+1]; + char *pos1, *pos2; + int i = 0; + int logf = FALSE; + int statf = FALSE; + + if ((Conf = fopen(T_conf, "r")) == NULL) + { + if (! be_quiet) + { + puts(" Could not open config"); + if (type == 0) + { + puts(" The run will be aborted\n"); + return (8); + } + } + else + { + fprintf(stderr,"%s (E) %s %s \n",Pgm_name, + "could not open config:", + T_conf); + if (type != 0) + fprintf(stderr,"%s (W) defaults used for all files\n", + Pgm_name); + else + { + fprintf(stderr,"%s (C) ended due to errors\n", + Pgm_name); + return (8); + } + } + } + else + { + while (fgets(logline, sizeof(logline), Conf)) + { + if (logline[0] == '#') + continue; + sscanf(logline,"%8s %s",keywrd,name); + if (0 == strncmp(keywrd,"logfile",7)) + { + pos1 = pos2 = name; + for (i=0;(i<=MAXPATHLEN && *pos1 != '\0');pos1++,pos2++,i++) + { + if (*pos1 == '#') /* name immed followed by comment */ + break; + if (*pos1 == '\\') /* quoted comment (filename has #) */ + { + ++pos1; /* skip escape char */ + if (*pos1 != '#') /* continuation ? */ + { + puts(" Config error:"); + puts(" Found filename continuation; bailing out\n"); + exit (8); + } + } + *pos2 = *pos1; /* move char */ + } + *pos2 = '\0'; /* terminate string */ + Tlog = (char *)getmem(strlen(name)+1); + strcpy(Tlog,name); + if (! be_quiet) + printf(" logfile used: %s\n",Tlog); + logf = TRUE; + if (statf) /* statsfile still to come ? */ + break; /* no finished */ + continue; + } + + if (0 == strncmp(keywrd,"statfile",8)) + { + pos1 = pos2 = name; + for (i=0;(i<=MAXPATHLEN && *pos1 != '\0');pos1++,pos2++,i++) + { + if (*pos1 == '#') /* name immed followed by comment */ + break; + if (*pos1 == '\\') /* quoted comment (filename has #) */ + { + ++pos1; /* skip escape char */ + if (*pos1 != '#') /* continuation ? */ + { + puts(" Config error:"); + puts(" Found filename continuation; bailing out\n"); + exit (8); + } + } + *pos2 = *pos1; /* move char */ + } + *pos2 = '\0'; /* terminate string */ + Tstat = (char *)getmem(strlen(name)+1); + strcpy(Tstat,name); + if (! be_quiet) + printf(" statfile used: %s\n",Tstat); + statf = TRUE; + if (logf) /* logfile still to come ? */ + break; /* no finished */ + continue; + } + } + fclose(Conf); + } + + if (! be_quiet) + { + if (! logf) + puts(" logfile used: - default -"); + if (! statf) + puts(" statfile used: - default -"); + } + +return 0; } + + /* ------------------------------------------------------------------ + * hdrprt - Print Header/Trailer lines (constant data) + * ------------------------------------------------------------------ + */ + +static void hdrprt(char head, int bot) +{ + switch(head) + { + case('s'): /* standard summary report */ + if (bot == 0) + { + puts("\nCompact summary:"); + puts("----------------"); + puts("\ +Name of + Files + +------- Bytes/1000 --------+ +------ Time -----+ + Avg CPS +\n\ +site in out inbound outbound total inbound outbound in out\n\ +-------- ---- ---- --------- --------- --------- --------- --------- ----- -----"); + } + else + puts("\ +--------------------------------------------------------------------------------"); + break; + + + case('f'): /* file statistic report */ + if (bot == 0) + { + puts("\nFile statistics:"); + puts("----------------"); + puts(" Name of +----------- Inbound -----------+ +---------- Outbound -----------+"); + puts(" site files Bytes/1000 xfr time B/sec files Bytes/1000 xfr time B/sec"); + puts(" -------- ----- ----------- --------- ----- ----- ----------- --------- -----"); + } + else + puts("\ + ----------------------------------------------------------------------------"); + break; + + + case('c'): /* calls statistic report */ + if (bot == 0) + { + puts("\nCall statistics:"); + puts("----------------"); + puts(" Name of +------- Outbound Calls -------+ +-------- Inbound Calls ------+"); + puts(" site succ. failed total time succ. failed total time"); + puts(" -------- ------ ------ ------ --------- ------ ------ ------ ---------"); + } + else + puts("\ + ----------------------------------------------------------------------------"); + break; + + + case('e'): /* efficiency statistic report */ + if (bot == 0) + { + puts("\nEfficiency:"); + puts("-----------"); + puts(" Name of +------ Times inbound/outbound -------+"); + puts(" site connected xfr time overhead eff. %"); + puts(" -------- --------- --------- --------- ------"); + } + else + puts(" -------------------------------------------------"); + break; + + case('i'): /* Environment information */ + if (bot == 0) + { + puts("\nEnvironment Information:"); + puts("------------------------"); + printf(" Default config: %s\n",D_conf == NULL ? + noConf:D_conf); + printf(" Default logfile: %s\n",Tlog); + printf(" Default statfile: %s\n\n",Tstat); + } + break; + + case('d'): /* Date/time coverage */ + if (bot == 0) + { + puts("\n Date coverage of input files:"); + puts(" Name of +----- Start -----+ +------ End ------+"); + puts(" file date time date time"); + puts(" -------- ---------- -------- ---------- --------"); + } + break; + + case('p'): /* Protocol stats */ + if (bot == 0) + { + puts("\nProtocol packet report:"); + puts("-----------------------"); + puts(" +------- protocol -----+ +--------- Packets ----------+"); + puts("Name of packet window "); + puts("site typ min max min max sent resent received"); + puts("-------- --- ---- ---- ---- ---- ----------- ------- ----------"); + } + else + { + puts("\nProtocol error report:"); + puts("----------------------"); + puts("Name of +----------------- Error Types --------------------+"); + puts("site typ header checksum order rem-reject"); + puts("-------- --- ----------- ---------- ----------- ----------"); + } + break; + + default: + if (bot == 0) + { + puts("\nNo header for this report defined:"); + } + else + puts(" "); + break; + } +} diff --git a/gnu/libexec/uucp/contrib/uurate.man b/gnu/libexec/uucp/contrib/uurate.man index 9f33ef303862..b7b69a46f2dd 100644 --- a/gnu/libexec/uucp/contrib/uurate.man +++ b/gnu/libexec/uucp/contrib/uurate.man @@ -1,10 +1,13 @@ +''' $Id: uurate.man,v 1.2 1994/05/07 18:09:37 ache Exp $ .TH uurate 1 .SH NAME uurate \- Report Taylor UUCP statistics .SH SYNOPSIS -.BR uurate " [ " "\-cfexai" " ] [ " "\-h " +.BR uurate " [ " "\-acdefhipqtvx" " ] [ " "\-s " .I host -.RI " ] [ " "logfile..." " ] " +.RI " ] [ " "\-I " +.I config +.RI " ][ " "logfile..." " ] " .PP or simply, .PP @@ -12,20 +15,20 @@ or simply, .PP for a traffic summary report. .SH DESCRIPTION -The +The .I uurate -command provides tabular summary reports on the operation of the +command provides tabular summary reports on the operation of the Taylor UUCP system. Data is taken from the currently active log -files, standard input, or from a list of log files given on the -command line. Output is in the form of tabular reports summarizing +files, standard input, or from a list of log files given on the +command line. Output is in the form of tabular reports summarizing call, file transfer, and command execution .RI "(" "uuxqt" ")" activity. .PP -The log files given to +The log and stats files given to .I uurate -must be in the ``Taylor'' format. Also, note that call and file -transfer activities are logged in separate files, nominally called +must be in the ``Taylor'' or ``V2'' format. Also, note that call and file +transfer activities are logged in separate files, nominally called .I Log and .I Stats, @@ -33,43 +36,49 @@ respectively. For reports to be meaningful, the .I Log and .I Stats -files should be given to +files should be given to .I uurate together, and cover the same time period. .PP If neither the .B \-i -option nor any +or +.B \-I +option nor any .I logfile -options are given, +options are given, .I uurate defaults to taking its input from the current Taylor .I Log and .I Stats -files, as defined at compilation time. +files. The names are either as defined at compilation time, in case +there is no config file, or taken from the arguments of the keywords +.I logfile +and +.I statfile +when encountered in the config file. This is the normal mode of operation. .PP The reporting options described below can be used to select -the set of reports desired. If no options are given, the -.B call -and -.B file -reports are displayed. If there is no relevant data for a particular -report or host, that report or host will be supressed. +the set of reports desired. If no options are given, a summary +report is displayed. If there is no relevant data for a particular +report or host, that report or host will be suppressed. .SH OPTIONS -The following options may be given to +The following options may be given to .I uurate: .TP 5 +.B \-a +All reports. Identical to +.B \-cfexp. +.TP 5 .B \-c Report on call statistics. Requires data from a .I Log file. .TP 5 -.B \-f -Report on file transfer statistics. Requires data from a -.I Stats -file. +.B \-d +will print the default config file to be used. .TP 5 .B \-e Report on efficiency (total connect time versus time spent transferring @@ -79,6 +88,32 @@ and a .I Stats file, and they must span the same time period. .TP 5 +.B \-f +Report on file transfer statistics. Requires data from a +.I Stats +file. +.TP 5 +.B \-h +will print a short help information. +.TP 5 +.B \-i +tells uurate to read any logfile information from standard input. +.TP 5 +.B \-p +report on protocol errors and packets sent/received +.TP 5 +.B \-q +do not print the Environment information, +.TP 5 +.B \-t +All reports. Identical to +.B \-cfexp. +plus the +.B Compact summary. +.TP 5 +.B \-v +will print the version id string +.TP 5 .B \-x Report on remote execution requests (e.g., .IR rmail ")." @@ -86,19 +121,20 @@ Requires data from a .I Log file. .TP 5 -.B \-a -All reports. Identical to -.B \-cfex. -.TP 5 -.BI "\-h " "host" +.BI "\-s " "host" Restrict report output to .I host. +.TP 5 +.BI "\-I " "config file" +an alternate config file may be passed by this option. .SH "DESCRIPTION OF REPORTS" There are four reports available: the call, file transfer, efficiency, and remote execution reports. Each may be selected by a command line -option. All reports may be selected via the option -.B \-a. -If no report selection options are given, +option. All reports may be selected via the options +.B \-a +or +.B \-t. +If no report selection options are given, .I uurate displays a compact traffic summary report (see below). .SS "Summary report" @@ -109,109 +145,136 @@ displays a traffic summary report. This is particularly useful in daily jobs which report on errors and the like. Traffic statistics for each active system is reported on a single line. If more than one system was active, a 'totals' line is included at the end of the report. +.SS "Protocol packet report" +The protocol report gives statistics on min/max packet and window sizes +used during transmission. Further on data is collected for packets +transferred. The data is collected for each host/protocol type. +The fields are described below: +.PP +.br +.nf +.in +.3i +.ta 1.0i +.BR "site " "UUCP node name of neighbor host system," +.BR "typ " "Type of protocol used" +.BR "Min " "minimum packet/window size" +.BR "Max " "maximum packet/window size" +.BR "sent " "packets sent" +.BR "resent " "packets resent" +.BR "received " "packets received" +.in -.3 +.SS "Protocol error report" +The protocol report gives statistics on packet errors +during transmission. The data is collected for each host/protocol type. +The fields are described below: +.PP +.br +.nf +.in +.3i +.ta 1.5i +.BR "site " "UUCP node name of neighbor host system," +.BR "typ " "Type of protocol used" +.BR "header " "number of errors in header" +.BR "checksum " "number of checksum errors" +.BR "order " "number of order errors" +.BR "resent " "number packets resent" +.BR "rem-reject " "packets that the remote site rejected" +.in -.3 .SS "Call report" -The call report gives statistics on inbound and outbound calls for +The call report gives statistics on inbound and outbound calls for each active host system. The fields are described below: +.PP .br .nf -.in +.5i +.in +.3i .ta 1.0i -.BR "sysname " "UUCP node name of neighbor host system" -.BR "callto " "Outbound calls attempted to that system" -.BR "failto " "Failed outbound calls to that system" -.BR "totime " "Connect time (sec.) on outbound calls" -.BR "callfm " "Inbound calls attempted by that system" -.BR "failfm " "Failed inbound calls from that system" -.BR "fmtime " "Connect time (sec.) on inbound calls" -.in -.5 +.BR "site " "UUCP node name of neighbor host system," +.BR "succ. " "Successful calls attempted to/by that system," +.BR "failed " "Failed calls to/by that system," +.BR "total " "Total calls to/by that system," +.BR "time " "Collected connect time (hh:mm:ss) for all calls," +.in -.3 .SS "File transfer reports" -The file transfer reports give statistics on inbound and +The file transfer reports give statistics on inbound and outbound file transfers (regardless of which end initiated the transfer) for each active host system. There are two reports, one for files sent to the remote system and one for files received from the remote system. The fields in each report are described below: +.PP .br .nf -.in +.5i +.in +.3i .ta 1.0i -.BR "sysname " "UUCP node name of neighbor host system" -.BR "files " "Number of files transferred" -.BR "bytes " "Total size (bytes) of files transferred" -.BR "seconds " "Total time (sec.) to transfer files" -.BR "byte/sec " "Average transfer rate (bytes/sec)" -.in -.5 +.BR "site " "UUCP node name of neighbor host system" +.BR "files " "Number of files transferred" +.BR "Bytes/1000 " "Total size of files transferred given in thousands" +.BR "xfr time " "Total time (hh:mm:ss) spent on transfer the files," +.BR "B/sec " "Average transfer rate (bytes/sec)." +.in -.3 .SS "Efficiency report" The efficiency report describes the utilization of the links to each active remote system, giving the ratio of total connect time -to the time spent actually transferring files. +to the time spent actually transferring files. The fields are described below: +.PP .br .nf -.in +.5i +.in +.3i .ta 1.0i -.BR "sysname " "UUCP node name of neighbor host system" -.BR "conntime " "Total connect time for that system" -.BR "flowtime " "Total file transfer time for that system" -.BR "ovhdtime " "Connect time not used to transfer files" -.BR "effcy (%) " "Ratio of connect time to transfer time" -.in -.5 -.SS "Remote execution report" +.BR "site " "UUCP node name of neighbor host system" +.BR "connected " "Total connect time for that system (turn-around)" +.BR "xfr time " "Total file transfer time for that system" +.BR "overhead " "Connect time not used to transfer files," +.BR "eff. % " "Ratio of connect time to transfer time (xfer*100/conn)" +.in -.3 +.SS "Command executions report" The remote execution report describes remotely -requested command executions from each active host system. -Executions of +requested command executions from each active host system, like .I rmail and -.I rnews -are the most common, and are detailed separately. The fields -are described below: +.IR rnews "." +Up to eight command names are displayed. If there are more, the +rest will be put together in an `Misc.' column. +The fields are described below: +.PP .br .nf -.in +.5i +.in +.3i .ta 1.0i -.BR "sysname " "UUCP node name of neighbor host system" -.BR "rmail " "Number of rmail requests from that system" -.BR "rnews " "Number of rnews requests from that system" -.BR "other " "Number of other requests from that system" -.in -.5i +.BR "site " "UUCP node name of neighbor host system," +.BR "(command) " "Number of requests of this command," +.BR "Misc. " "Number of other requests, if more than eight." +.in -.3i .SS FILES The file names below may be changed at compilation time or by the configuration file, so these are only approximations. .br .nf -.in +.5in -.ta 2.0i -.IR "/usr/spool/uucp/Log " "Taylor format call/execution log" -.IR "/usr/spool/uucp/Stats " "Taylor format file transfer log" +.in +.3in +.ta 2.2i +.IR "/usr/spool/uucp/Log " "V2/Taylor format call/execution log," +.IR "/usr/spool/uucp/Stats " "V2/Taylor format file transfer log." .SS "SEE ALSO" .IR uucico "(8)" .SS BUGS -Does not understand older (V2, BNU) logging formats. Anyone care to -volunteer to add this? I don't use the stuff myself. +Does not understand other than V2/TAYLOR logging formats. Anyone care to +volunteer to add the not mentioned? .PP -The entries that Taylor UUCP makes in the log file for incoming calls -don't have a host name. This confuses -.I uurate -into thinking that the calls came in for system "-". This may require -a change to Taylor logging. +Scanning the arguments of logfile and statfile keywords +in config should handle lines continued with the backslash as well. .PP -Should check the configuration file to locate the currently active -.I Log -and -.I Stats -files when using them for default inputs. Instead, it uses the -compile-time settings only. -.PP -Should report packet protocol error statistics by host and -protocol type. +The +.B failfm +field in the call statistics table is always zero, unless +something really serious happens, e.g. uucico got SIGQUIT or +the whole system crashed. .SS AUTHOR -Robert B. Denny (denny@alisa.com) +Robert B. Denny (denny@alisa.com). .br Loosely based on the DECUS UUCP program .I uurate by Mark Pizzolato. - - - - - - +.br +Modified by Stephan Niemz (stephan@sunlab.ka.sub.org). +.br +Modified by Klaus Dahlenburg (kdburg@incoahe.hanse.de). diff --git a/gnu/libexec/uucp/contrib/uureroute.perl b/gnu/libexec/uucp/contrib/uureroute.perl new file mode 100755 index 000000000000..3eeb654e1e27 --- /dev/null +++ b/gnu/libexec/uucp/contrib/uureroute.perl @@ -0,0 +1,91 @@ +#!/usr/local/bin/perl +eval ' exec /usr/local/bin/perl $0 "$@" ' + if $running_under_some_shell; + +# From a script by <Bill.Campbell@celestial.com> +# Newsgroups: comp.sources.misc +# Subject: v28i073: uureroute - Reroute HDB queued mail, Part01/01 +# Date: 26 Feb 92 02:28:37 GMT +# +# This is a Honey DanBer specific routine written in perl to reroute all +# mail queued up for a specific host. It needs to be run as "root" since +# uucp will not allow itself to remove others requests. +# +# Revision *** 92/21/09: Francois Pinard <pinard@iro.umontreal.ca> +# 1. adapted for Taylor UUCP +# +# Revision 1.3 91/10/08 09:01:21 src +# 1. Rewritten in perl +# 2. Add -v option for debugging. +# +# Revision 1.2 91/10/07 23:57:42 root +# 1. Fix mail program path. +# 2. Truncate directory name to 7 characters + +($progname = $0) =~ s!.*/!!; # save this very early + +$USAGE = " +# Reroute uucp mail +# +# Usage: $progname [-v] host [host...] +# +# Options Argument Description +# -v Verbose (doesn't execute /bin/sh) +# +"; + +$UUSTAT = "/usr/local/bin/uustat"; +$SHELL = "/bin/sh"; +$SMAIL = "/bin/smail"; + +sub usage +{ + die join ("\n", @_) . "\n$USAGE\n"; +} + +do "getopts.pl"; + +&usage ("Invalid Option") unless do Getopts ("vV"); + +$verbose = ($opt_v ? '-v' : ()); +$suffix = ($verbose ? '' : $$); + +&usage ("No system specified") if $#ARGV < 0; + +if (!$verbose) +{ + open (SHELL, "| $SHELL"); + select SHELL; +} + +while ($system = shift) +{ + $sysprefix = substr ($system, 0, 7); + $directory = "/usr/spool/uucp/$sysprefix"; + open (UUSTAT, "$UUSTAT -s $system -c rmail |"); + print "set -ex\n"; + while (<UUSTAT>) + { + ($jobid, ) = split; + ($cfile) = substr ($jobid, length ($jobid) - 5); + $cfilename = "$directory/C./C.$cfile"; + open (CFILE, $cfilename) || die "Cannot open $cfilename\n"; + $_ = <CFILE>; + close CFILE; + if (/^E D\.(....) [^ ]+ [^ ]+ -CR D\.\1 0666 [^ ]+ 0 rmail (.*)/) + { + $datafile = "$directory/D./D.$1"; + $address = $2; + } + else + { + print STDERR; + die "Cannot parse previous line from $cfilename\n"; + } + print "$SMAIL -R $system!$address < $datafile && $UUSTAT -k $jobid\n"; + } + close UUSTAT; +} +close SHELL unless $verbose; + +exit 0; diff --git a/gnu/libexec/uucp/contrib/uusnap.c b/gnu/libexec/uucp/contrib/uusnap.c index d657a620ec8a..a3d9fb433249 100644 --- a/gnu/libexec/uucp/contrib/uusnap.c +++ b/gnu/libexec/uucp/contrib/uusnap.c @@ -25,7 +25,7 @@ #include "uucp.h" #if USE_RCS_ID -char uusnap_rcsid[] = "$Id: uusnap.c,v 1.1 1993/08/05 18:23:18 conklin Exp $"; +char uusnap_rcsid[] = "$Id: uusnap.c,v 1.2 1994/05/07 18:09:40 ache Exp $"; #endif #include <ctype.h> diff --git a/gnu/libexec/uucp/contrib/uutraf b/gnu/libexec/uucp/contrib/uutraf index 8b56d0f6b4f5..9625ea5206ca 100644 --- a/gnu/libexec/uucp/contrib/uutraf +++ b/gnu/libexec/uucp/contrib/uutraf @@ -1,11 +1,11 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # uutraf.pl -- UUCP Traffic Analyzer -# SCCS Status : @(#)@ uutraf 1.7 +# SCCS Status : @(#)@ uutraf 1.8 # Author : Johan Vromans # Created On : *** # Last Modified By: Johan Vromans -# Last Modified On: Wed Feb 26 08:52:56 1992 -# Update Count : 4 +# Last Modified On: Mon Aug 30 15:02:22 1993 +# Update Count : 6 # Status : OK # Requires: : Perl V4 or later @@ -52,7 +52,7 @@ if ( $ARGV[0] =~ /^-/ ) { } if ( $uucp_type eq "taylor" || $uucp_type eq "gnu" ) { - @ARGV = ("/usr/spool/uucp/Stats") unless $#ARGV >= 0; + @ARGV = ("/usr/local/spool/uucp/Stats") unless $#ARGV >= 0; $pat = "^[^ ]+ ([^ ]+) \\(([-0-9:\\/ .]+)\\) " . "(sent|received) (\\d+) bytes in (\\d+)\\.(\\d+) seconds"; $uucp_type = 0; @@ -73,16 +73,17 @@ elsif ( $uucp_type eq "bsd" || $uucp_type eq "v7" ) { $recv = "received"; } else { - die ("Unknown UUCP type: $uucp_type\n"); + die ("FATAL: Unknown UUCP type: $uucp_type\n"); } $garbage = 0; while ( <> ) { unless ( /$pat/o ) { - print STDERR "Possible garbage: $_"; + print STDERR "$_"; + next if /failed/; if ( $garbage++ > 10 ) { - die ("Too much garbage; wrong UUCP type?\n"); + die ("FATAL: Too much garbage; wrong UUCP type?\n"); } next; } @@ -90,10 +91,10 @@ while ( <> ) { # gather timestamps $last_date = $2; $first_date = $last_date unless defined $first_date; - + # initialize new hosts unless ( defined $hosts{$1} ) { - $hosts{$1} = $files_in{$1} = $files_out{$1} = + $hosts{$1} = $files_in{$1} = $files_out{$1} = $bytes_in{$1} = $bytes_out{$1} = $secs_in{$1} = $secs_out{$1} = 0; } @@ -162,9 +163,9 @@ foreach $host (@hosts) { sub print_line { reset "Z"; # reset print fields - local ($Zhost, - $Zi_bytes, $Zo_bytes, - $Zi_secs, $Zo_secs, + local ($Zhost, + $Zi_bytes, $Zo_bytes, + $Zi_secs, $Zo_secs, $Zi_count, $Zo_count) = @_; $Ti_bytes += $Zi_bytes; $To_bytes += $Zo_bytes; @@ -186,7 +187,7 @@ sub print_line { sub print_dashes { $Zhost = $Zi_bytes = $Zo_bytes = $Zt_bytes = - $Zi_hrs = $Zo_hrs = $Zi_acps = $Zo_acps = $Zi_count = $Zo_count = + $Zi_hrs = $Zo_hrs = $Zi_acps = $Zo_acps = $Zi_count = $Zo_count = "------------"; write; # easy, isn't it? @@ -196,6 +197,12 @@ sub print_dashes { sub gethostname { $ENV{"SHELL"} = "/bin/sh"; + $try = `hostname 2>/dev/null`; + chop $try; + return $+ if $try =~ /^[-.\w]+$/; + $try = `uname -n 2>/dev/null`; + chop $try; + return $+ if $try =~ /^[-.\w]+$/; $try = `uuname -l 2>/dev/null`; chop $try; return $+ if $try =~ /^[-.\w]+$/; diff --git a/gnu/libexec/uucp/contrib/uuxconv b/gnu/libexec/uucp/contrib/uuxconv new file mode 100755 index 000000000000..843f9e000fab --- /dev/null +++ b/gnu/libexec/uucp/contrib/uuxconv @@ -0,0 +1,50 @@ +#!/bin/sh +# +# uuxconv +# +# After converting to Taylor from SVR4.03 UUCP, I still had a lot of +# jobs queued up to go out. +# +# This script is a one-shot to mass-requeue a site's spool. +# +# It doesn't go and do your whole spool, nor even all grades. +# you need to go into each grade directory for each site and +# execute this. +# +# i.e.: You have a site named 'foo' +# cd /var/spool/uucp/foo/Z +# uuxconv foo +# +# it does delete the 'D' & 'X' after requeing them, but doesn't remove +# the 'C' files. +# +# I foolishly went and ran this script on all my queued jobs, without +# adding the improvements to recursively go through the entire UUCP spool, +# so now I'm out of files to test with. I don't want to add the code +# to do that since I can't test it, and this worked. +# +# I hereby give this (trivial :-)) program to the GNU Project/FSF +# and Ian Taylor in it's entirety, so that it can be placed in +# the contrib directory of taylor-uucp, and save others the pain +# of rewriting it. +# +# Richard Nickle (rick@trystro.uucp, rnickle@gnu.ai.mit.edu) +# May 27, 1993 +# +if [ $# -eq 0 ] +then + echo "Usage: $0 sitename" + exit 1 +fi +exit 0 +site=$1 +tsite=`echo $site | cut -c1-5` +find . -name "D.$tsite*" -print | +while read file +do + control=`egrep "^C" $file | cut -c3-` + input=`egrep "^I" $file | cut -c3-` + (uux - -r -z $site!$control < $input) && (rm $file $input) + echo "$site!$control < $input" +done +exit 0 diff --git a/gnu/libexec/uucp/contrib/xchat.c b/gnu/libexec/uucp/contrib/xchat.c index 0fd763d9f3fc..b44549e53ed4 100644 --- a/gnu/libexec/uucp/contrib/xchat.c +++ b/gnu/libexec/uucp/contrib/xchat.c @@ -9,6 +9,9 @@ * Bob Denny (denny@alisa.com) * Based on code in DECUS UUCP (for VAX/VMS) * + * Small modification by: + * Daniel Hagerty (hag@eddie.mit.edu) + * * History: * Version 1.0 shipped with Taylor 1.03. No configuration info inside. * @@ -18,21 +21,25 @@ * for timed reads. Use Taylor UUCP "conf.h" file to set * configuration for this program. Add defaulting of script * and log file paths. + * + * Daniel Hagerty - Mon Nov 22 18:17:38 1993 + * V1.2 - Added a new opcode to xchat. "expectstr" is a cross between + * sendstr and expect, looking for a parameter supplied string. + * Useful where a prompt could change for different dial in + * lines and such. * * Bugs: * Does not support BSD terminal I/O. Anyone care to add it? */ -#include <unistd.h> #include <sys/types.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <signal.h> #include <time.h> -#include <sys/time.h> #include <sys/ioctl.h> -#include <sys/termios.h> +#include <sys/termio.h> #include "xc-conf.h" @@ -132,7 +139,8 @@ struct script_opdef { #define SC_PEVN 39 /* Set port for 7-bit, even parity */ #define SC_PODD 40 /* Set port for 7-bit, odd parity */ #define SC_HUPS 41 /* Change state on HUP signal */ -#define SC_END 42 /* end of array */ +#define SC_XPST 42 /* Expect a param string */ +#define SC_END 43 /* end of array */ /* values for prmtype, prm2type */ @@ -188,6 +196,7 @@ static struct script_opdef sc_opdef[] = {"sendstr", SC_SNDP, SC_INT, SC_NONE}, {"ifstr", SC_IF1P, SC_INT, SC_NWST}, {"ifnstr", SC_IF0P, SC_INT, SC_NWST}, + {"expectstr", SC_XPST, SC_INT, SC_NWST}, {"table end", SC_END, SC_NONE, SC_NONE} }; @@ -224,16 +233,16 @@ static char telno[64]; /* Telephone number w/meta-chars */ static int Debug; static int fShangup = FALSE; /* TRUE if HUP signal received */ static FILE *dbf = NULL; -static struct termios old, new; +static struct termio old, new; -static void usignal(); -static void uhup(); +extern int usignal(); +extern int uhup(); static struct siglist { int signal; - void (*o_catcher) (); - void (*n_catcher) (); + int (*o_catcher) (); + int (*n_catcher) (); } sigtbl[] = { { SIGHUP, NULL, uhup }, { SIGINT, NULL, usignal }, @@ -246,17 +255,17 @@ static struct siglist extern struct script *read_script(); extern void msleep(); -static char xgetc(); -static void charlog(); -static void setup_tty(); -static void restore_tty(); -static void ttoslow(); -static void ttflui(); -static void tthang(); -static void ttbreak(); -static void tt7bit(); -static void ttpar(); -static void DEBUG(); +extern char xgetc(); +extern void charlog(); +extern void setup_tty(); +extern void restore_tty(); +extern void ttoslow(); +extern void ttflui(); +extern void tthang(); +extern void ttbreak(); +extern void tt7bit(); +extern void ttpar(); +extern void DEBUG(); extern void *malloc(); @@ -337,7 +346,7 @@ char *argv[]; sigs = &sigtbl[0]; while(sigs->signal) { - sigs->o_catcher = signal(sigs->signal, sigs->n_catcher); + sigs->o_catcher = (int (*) ())signal(sigs->signal, sigs->n_catcher); sigs += 1; } @@ -1031,6 +1040,7 @@ int do_script(begin) case SC_TIMO: /* these are "expects", don't bother */ case SC_XPCT: /* with them yet, other than noting that */ case SC_CARR: /* they exist */ + case SC_XPST: expcnt++; break; } @@ -1134,7 +1144,24 @@ int do_script(begin) } } } - + /* New opcode added by hag@eddie.mit.edu for expecting a + parameter supplied string */ + case SC_XPST: + if(curscr->intprm >paramc-1) + { + sprintf(tempstr,"expectstr - param#%d",curscr->intprm); + logit(tempstr, " not present"); + return(FAIL); + } + prmlen=xlat_str(tempstr,paramv[curscr->intprm]); + if((expin >= prmlen) && + (strncmp(tempstr,&expbuf[expin-prmlen], + prmlen) == SAME)) + { + charlog(tempstr,prmlen,DB_LGI, "Matched"); + goto _chgstate; + } + break; /* * SIGNAL HANDLERS */ @@ -1142,7 +1169,7 @@ int do_script(begin) /* * usignal - generic signal catcher */ -static void usignal(isig) +static int usignal(isig) int isig; { DEBUG(DB_LOG, "Caught signal %d. Exiting...\n", isig); @@ -1153,7 +1180,7 @@ static void usignal(isig) /* * uhup - HUP catcher */ -static void uhup(isig) +static int uhup(isig) int isig; { DEBUG(DB_LOG, "Data set hangup.\n"); @@ -1175,15 +1202,14 @@ int tmo; /* Timeout, seconds */ { char c; struct timeval s; - fd_set f; + int f = 1; /* Select on stdin */ int result; - FD_SET(0,&f); /* Select on stdin */ if(read(0, &c, 1) <= 0) /* If no data available */ { s.tv_sec = (long)tmo; s.tv_usec = 0L; - if(select (1, &f, (fd_set *) NULL, &f, &s) == 1) + if(select (1, &f, (int *) NULL, &f, &s) == 1) read(0, &c, 1); else c = '\377'; @@ -1294,7 +1320,7 @@ static void setup_tty() { register int i; - tcgetattr(0,&old); + ioctl(0, TCGETA, &old); new = old; @@ -1305,7 +1331,7 @@ static void setup_tty() new.c_iflag = ISTRIP; /* Raw mode, 7-bit stripping */ new.c_lflag = 0; /* No special line discipline */ - tcsetattr(0,TCSANOW,&new); + ioctl(0, TCSETA, &new); } /* @@ -1314,7 +1340,7 @@ static void setup_tty() static void restore_tty(sig) int sig; { - tcsetattr(0,TCSANOW,&old); + ioctl(0, TCSETA, &old); return; } @@ -1346,7 +1372,7 @@ static void ttoslow(s, len, delay) static void ttflui() { if(isatty(0)) - tcflush(0,TCIFLUSH); + (void) ioctl ( 0, TCFLSH, 0); } /* @@ -1364,13 +1390,13 @@ static int ttcd() */ static void tthang() { - if(!isatty(1)) + if(!isatty()) return; -#ifdef TIOCCDTR - (void) ioctl (1, TIOCCDTR, 0); +#ifdef TCCLRDTR + (void) ioctl (1, TCCLRDTR, 0); sleep (2); - (void) ioctl (1, TIOCSDTR, 0); + (void) ioctl (1, TCSETDTR, 0); #endif return; @@ -1381,7 +1407,7 @@ static void tthang() */ static void ttbreak() { - tcsendbreak(1,5); + (void) ioctl (1, TCSBRK, 0); } /* @@ -1405,7 +1431,7 @@ static void tt7bit(enable) else new.c_iflag &= ~ISTRIP; - tcsetattr(0,TCSANOW,&new); + ioctl(0, TCSETA, &new); } /* @@ -1436,5 +1462,12 @@ static void ttpar(mode) break; } - tcsetattr(0,TCSANOW,&new); + ioctl(0, TCSETA, &new); } + + + + + + + diff --git a/gnu/libexec/uucp/contrib/xchat.man b/gnu/libexec/uucp/contrib/xchat.man index c980e202fcb4..55537be90726 100644 --- a/gnu/libexec/uucp/contrib/xchat.man +++ b/gnu/libexec/uucp/contrib/xchat.man @@ -380,6 +380,18 @@ is received from standard input (usually the serial port). Case is significant, but high-order bits are not checked. .TP 2.0i +.BI "expectstr " "ns int" +Change to state +.I ns +if the string specified in parameter +.I int +is received from standard input (usually the serial port). +.I int +must be in the range 0 to 7. +Case is significant, but high-order bits are not +checked. +Useful where a prompt can change in different dial-in lines. +.TP 2.0i .BI "ifcarr " ns Change to state .I ns @@ -604,6 +616,8 @@ seconds). uucico(8) for Taylor UUCP, and documentation for Taylor UUCP. .SH AUTHOR Robert B. Denny (denny@alisa.com) +.SH CONTRIBUTORS +Daniel Hagerty (hag@eddie.mit.edu) .SH HISTORY This program is an adaptation of the dial/login script processing code that is a part of DECUS UUCP for VAX/VMS, written by Jamie diff --git a/gnu/libexec/uucp/cu/Makefile b/gnu/libexec/uucp/cu/Makefile index c2171a690a83..ada7ab2b64a7 100644 --- a/gnu/libexec/uucp/cu/Makefile +++ b/gnu/libexec/uucp/cu/Makefile @@ -1,9 +1,9 @@ # Makefile for cu -# $Id: Makefile,v 1.1 1993/08/05 18:23:27 conklin Exp $ +# $Id: Makefile,v 1.3 1994/05/31 07:47:39 ache Exp $ BINDIR= $(bindir) BINOWN= $(owner) -BINMODE= 4555 +BINMODE= 4555 PROG= cu SRCS= cu.c prot.c log.c chat.c conn.c tcp.c tli.c copy.c diff --git a/gnu/libexec/uucp/cu/cu.1 b/gnu/libexec/uucp/cu/cu.1 index c08fe8020f25..630e11ca6e96 100644 --- a/gnu/libexec/uucp/cu/cu.1 +++ b/gnu/libexec/uucp/cu/cu.1 @@ -1,5 +1,5 @@ -''' $Id: cu.1,v 1.1 1993/08/05 18:23:28 conklin Exp $ -.TH cu 1 "Taylor UUCP 1.04" +''' $Id: cu.1,v 1.2 1994/05/07 18:09:51 ache Exp $ +.TH cu 1 "Taylor UUCP 1.05" .SH NAME cu \- Call up another system .SH SYNOPSIS @@ -22,8 +22,12 @@ Otherwise, if the argument begins with a digit, it is taken to be a phone number to call. Otherwise, it is taken to be the name of a system to call. The .B \-z +or +.B \-\-system option may be used to name a system beginning with a digit, and the .B \-c +or +.B \-\-phone option may be used to name a phone number that does not begin with a digit. @@ -31,9 +35,9 @@ digit. locates a port to use in the UUCP configuration files. If a simple system name is given, it will select a port appropriate for that system. The -.B \-p, \-l +.B \-p, \-\-port, \-l, \-\-line, \-s and -.B \-s +.B \-\-speed options may be used to control the port selection. When a connection is made to the remote system, @@ -208,53 +212,55 @@ default is true. The following options may be given to .I cu. .TP 5 -.B \-e +.B \-e, \-\-parity=even Use even parity. .TP 5 -.B \-o -Use odd parity. If both +.B \-o, \-\-parity=odd +Use odd parity. +.TP 5 +.B \-\-parity=none +Use no parity. No parity is also used if both .B \-e and .B \-o -are used, no parity is used. Otherwise the default parity of the line -is used. +are given. .TP 5 -.B \-h +.B \-h, \-\-halfduplex Echo characters locally (half-duplex mode). .TP 5 -.B \-z system +.B \-z system, \-\-system system The system to call. .TP 5 -.B \-c phone-number +.B \-c phone-number, \-\-phone phone-number The phone number to call. .TP 5 -.B \-p port +.B \-p port, \-\-port port Name the port to use. .TP 5 .B \-a port Equivalent to -.B \-p port. +.B \-\-port port. .TP 5 -.B \-l line +.B \-l line, \-\-line line Name the line to use by giving a device name. This may be used to dial out on ports that are not listed in the UUCP configuration files. Write access to the device is required. .TP 5 -.B \-s speed +.B \-s speed, \-\-speed speed The speed (baud rate) to use. .TP 5 .B \-# Where # is a number, equivalent to -.B \-s #. +.B \-\-speed #. .TP 5 -.B \-n +.B \-n, \-\-prompt Prompt for the phone number to use. .TP 5 .B \-d Enter debugging mode. Equivalent to -.B \-x all. +.B \-debug all. .TP 5 -.B \-x type +.B \-x type, \-\-debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. Only abnormal, chat, @@ -262,20 +268,26 @@ handshake, port, config, incoming and outgoing are meaningful for .I cu. Multiple types may be given, separated by commas, and the -.B \-x +.B \-\-debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, -.B \-x 2 +.B \-\-debug 2 is equivalent to -.B \-x abnormal,chat. -.B \-x all +.B \-\-debug abnormal,chat. +.B \-\-debug all may be used to turn on all debugging options. .TP 5 -.B \-I file +.B \-I file, \-\-config file Set configuration file to use. This option may not be available, depending upon how .I cu was compiled. +.TP 5 +.B \-v, \-\-version +Report version information and exit. +.TP 5 +.B \-\-help +Print a help message and exit. .SH BUGS This program does not work very well. .SH FILES @@ -284,3 +296,6 @@ approximation. .br /usr/lib/uucp/config - Configuration file. +.SH AUTHOR +Ian Lance Taylor +<ian@airs.com> diff --git a/gnu/libexec/uucp/cu/cu.c b/gnu/libexec/uucp/cu/cu.c index 5e34601de3b9..3939f6a02ece 100644 --- a/gnu/libexec/uucp/cu/cu.c +++ b/gnu/libexec/uucp/cu/cu.c @@ -1,7 +1,7 @@ /* cu.c Call up a remote system. - 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 cu_rcsid[] = "$Id: cu.c,v 1.1 1993/08/05 18:23:29 conklin Exp $"; +const char cu_rcsid[] = "$Id: cu.c,v 1.2 1994/05/07 18:09:54 ache Exp $"; #endif #include "cu.h" @@ -66,7 +66,7 @@ boolean fCuvar_binary = FALSE; /* A prefix string to use before sending a binary character from a file; this is only used if fCuvar_binary is TRUE. The default is - ^Z. */ + ^V. */ const char *zCuvar_binary_prefix = "\026"; /* Whether to check for echoes of characters sent when sending a file. @@ -126,9 +126,6 @@ static const struct uuconf_cmdtab asCuvars[] = { NULL, 0, NULL, NULL} }; -/* The program name. */ -char abProgram[] = "cu"; - /* The string printed at the initial connect. */ #if ANSI_C #define ZCONNMSG "\aConnected." @@ -175,6 +172,9 @@ static boolean fCulocalecho; /* Whether we need to call fsysdep_cu_finish. */ static boolean fCustarted; +/* Whether ZCONNMSG has been printed yet. */ +static boolean fCuconnprinted = FALSE; + /* A structure used to pass information to icuport_lock. */ struct sconninfo { @@ -187,6 +187,7 @@ struct sconninfo /* Local functions. */ static void ucuusage P((void)); +static void ucuhelp P((void)); static void ucuabort P((void)); static void uculog_start P((void)); static void uculog_end P((void)); @@ -209,7 +210,24 @@ static boolean fcusend_buf P((struct sconnection *qconn, const char *zbuf, do { if (! fsysdep_terminal_puts (zline)) ucuabort (); } while (0) /* Long getopt options. */ -static const struct option asCulongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asCulongopts[] = +{ + { "phone", required_argument, NULL, 'c' }, + { "parity", required_argument, NULL, 2 }, + { "halfduplex", no_argument, NULL, 'h' }, + { "prompt", no_argument, NULL, 'n' }, + { "line", required_argument, NULL, 'l' }, + { "port", required_argument, NULL, 'p' }, + { "speed", required_argument, NULL, 's' }, + { "baud", required_argument, NULL, 's' }, + { "mapcr", no_argument, NULL, 't' }, + { "system", required_argument, NULL, 'z' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -252,6 +270,8 @@ main (argc, argv) struct uuconf_dialer *qdialer; char bcmd; + zProgram = argv[0]; + /* We want to accept -# as a speed. It's easiest to look through the arguments, replace -# with -s#, and let getopt handle it. */ for (i = 1; i < argc; i++) @@ -271,7 +291,7 @@ main (argc, argv) } } - while ((iopt = getopt_long (argc, argv, "a:c:dehnI:l:op:s:tx:z:", + while ((iopt = getopt_long (argc, argv, "a:c:dehnI:l:op:s:tvx:z:", asCulongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -347,13 +367,47 @@ main (argc, argv) #endif break; + case 'v': + /* Print version and exit. */ + fprintf + (stderr, + "%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 2: + /* --parity. */ + if (strncmp (optarg, "even", strlen (optarg)) == 0) + feven = TRUE; + else if (strncmp (optarg, "odd", strlen (optarg)) == 0) + fodd = TRUE; + else if (strncmp (optarg, "none", strlen (optarg)) == 0) + { + feven = TRUE; + fodd = TRUE; + } + else + { + fprintf (stderr, "%s: --parity requires even, odd or none\n", + zProgram); + ucuusage (); + } + break; + + case 1: + /* --help. */ + ucuhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: ucuusage (); - break; + /*NOTREACHED*/ } } @@ -366,7 +420,10 @@ main (argc, argv) if (optind != argc - 1 || zsystem != NULL || zphone != NULL) - ucuusage (); + { + fprintf (stderr, "%s: too many arguments\n", zProgram); + ucuusage (); + } if (strcmp (argv[optind], "dir") != 0) { if (isdigit (BUCHAR (argv[optind][0]))) @@ -382,7 +439,11 @@ main (argc, argv) && zport == NULL && zline == NULL && ibaud == 0L) - ucuusage (); + { + fprintf (stderr, "%s: must specify system, line, port or speed\n", + zProgram); + ucuusage (); + } if (fprompt) { @@ -395,7 +456,7 @@ main (argc, argv) if (getline (&zphone, &cphone, stdin) <= 0 || *zphone == '\0') { - fprintf (stderr, "%s: No phone number entered\n", abProgram); + fprintf (stderr, "%s: no phone number entered\n", zProgram); exit (EXIT_FAILURE); } } @@ -523,16 +584,20 @@ main (argc, argv) sport.uuconf_u.uuconf_sdirect.uuconf_zdevice = NULL; sport.uuconf_u.uuconf_sdirect.uuconf_ibaud = ibaud; - if (! fsysdep_port_access (&sport)) - ulog (LOG_FATAL, "%s: Permission denied", zline); - - if (! fconn_init (&sport, &sconn)) + if (! fconn_init (&sport, &sconn, UUCONF_PORTTYPE_UNKNOWN)) ucuabort (); if (! fconn_lock (&sconn, FALSE)) ulog (LOG_FATAL, "%s: Line in use", zline); qCuconn = &sconn; + + /* Check user access after locking the port, because on + some systems shared lines affect the ownership and + permissions. In such a case ``Line in use'' is more + clear than ``Permission denied.'' */ + if (! fsysdep_port_access (&sport)) + ulog (LOG_FATAL, "%s: Permission denied", zline); } ihighbaud = 0L; } @@ -544,7 +609,8 @@ main (argc, argv) continue; if (qsys->uuconf_qport != NULL) { - if (fconn_init (qsys->uuconf_qport, &sconn)) + if (fconn_init (qsys->uuconf_qport, &sconn, + UUCONF_PORTTYPE_UNKNOWN)) { if (fconn_lock (&sconn, FALSE)) { @@ -648,7 +714,8 @@ main (argc, argv) || qsys == NULL) ucuabort (); - if (qsys->uuconf_qalternate == NULL) + qsys = qsys->uuconf_qalternate; + if (qsys == NULL) ulog (LOG_FATAL, "%s: No remaining alternates", zsystem); fCuclose_conn = FALSE; @@ -693,6 +760,7 @@ main (argc, argv) only comes out when a special command is received from the terminal. */ printf ("%s\n", ZCONNMSG); + fCuconnprinted = TRUE; if (! fsysdep_terminal_raw (fCulocalecho)) ucuabort (); @@ -719,7 +787,8 @@ main (argc, argv) (void) fconn_unlock (&sconn); uconn_free (&sconn); - printf ("\n%s\n", ZDISMSG); + if (fCuconnprinted) + printf ("\n%s\n", ZDISMSG); ulog_close (); @@ -734,41 +803,56 @@ main (argc, argv) static void ucuusage () { + fprintf (stderr, "Usage: %s [options] [system or phone-number]\n", + zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print a help message. */ + +static void +ucuhelp () +{ fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + "Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); fprintf (stderr, - "Usage: cu [options] [system or phone-number]\n"); + "Usage: %s [options] [system or phone-number]\n", zProgram); fprintf (stderr, - " -a port, -p port: Use named port\n"); + " -a,-p,--port port: Use named port\n"); fprintf (stderr, - " -l line: Use named device (e.g. tty0)\n"); + " -l,--line line: Use named device (e.g. tty0)\n"); fprintf (stderr, - " -s speed, -#: Use given speed\n"); + " -s,--speed,--baud speed, -#: Use given speed\n"); fprintf (stderr, - " -c phone: Phone number to call\n"); + " -c,--phone phone: Phone number to call\n"); fprintf (stderr, - " -z system: System to call\n"); + " -z,--system system: System to call\n"); fprintf (stderr, " -e: Set even parity\n"); fprintf (stderr, " -o: Set odd parity\n"); fprintf (stderr, - " -h: Echo locally\n"); + " --parity={odd,even}: Set parity\n"); + fprintf (stderr, + " -h,--halfduplex: Echo locally\n"); fprintf (stderr, - " -t: Map carriage return to carriage return/linefeed\n"); + " -t,--mapcr: Map carriage return to carriage return/linefeed\n"); fprintf (stderr, - " -n: Prompt for phone number\n"); + " -n,--prompt: Prompt for phone number\n"); fprintf (stderr, " -d: Set maximum debugging level\n"); fprintf (stderr, - " -x debug: Set debugging type\n"); + " -x,--debug debug: Set debugging type\n"); #if HAVE_TAYLOR_CONFIG fprintf (stderr, - " -I file: Set configuration file to use\n"); + " -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ - - exit (EXIT_FAILURE); + fprintf (stderr, + " -v,--version: Print version and exit\n"); + fprintf (stderr, + " --help: Print help and exit\n"); } /* This function is called when a fatal error occurs. */ @@ -805,7 +889,8 @@ ucuabort () ulog_close (); - printf ("\n%s\n", ZDISMSG); + if (fCuconnprinted) + printf ("\n%s\n", ZDISMSG); usysdep_exit (FALSE); } @@ -866,7 +951,7 @@ icuport_lock (qport, pinfo) q->fmatched = TRUE; - if (! fconn_init (qport, q->qconn)) + if (! fconn_init (qport, q->qconn, UUCONF_PORTTYPE_UNKNOWN)) return UUCONF_NOT_FOUND; else if (! fconn_lock (q->qconn, FALSE)) { diff --git a/gnu/libexec/uucp/doc/uucp.texi b/gnu/libexec/uucp/doc/uucp.texi new file mode 100644 index 000000000000..5ab74118d6e9 --- /dev/null +++ b/gnu/libexec/uucp/doc/uucp.texi @@ -0,0 +1,4036 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename uucp.info +@settitle Taylor UUCP +@setchapternewpage odd +@c %**end of header + +@iftex +@finalout +@end iftex + +@ignore +----------------------------------------------------------------------> +Franc,ois Pinard says: + +Hi, Ian! This is the promised merging of the current documents from +Taylor UUCP 1.01, plus the patches to documentation you sent to me, into +a taylor.texi file. Many things remain to do, among which: + +- merging in the Taylor UUCP program man pages. +----------------------------------------------------------------------< +@end ignore + +@ifinfo +This file documents Taylor UUCP, version 1.05. + +Copyright @copyright{} 1992, 1993, 1994 Ian Lance Taylor + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries a copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +section entitled ``Copying'' are included exactly as in the original, and +provided that the entire resulting derived work is distributed under the +terms of a permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that the section entitled ``Copying'' may be included in a +translation approved by the author instead of in the original English. +@end ifinfo + +@titlepage +@title Taylor UUCP +@subtitle Version 1.05 +@author Ian Lance Taylor @code{<ian@@airs.com>} + +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1992, 1993, 1994 Ian Lance Taylor + +Published by Ian Lance Taylor @code{<ian@@airs.com>}. + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that the +section entitled ``Copying'' are included exactly as in the original, and +provided that the entire resulting derived work is distributed under the +terms of a permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that the section entitled ``Copying'' may be included in a +translation approved by the author instead of in the original English. +@end titlepage + +@node Top, Copying, (dir), (dir) +@top Taylor UUCP 1.05 + +This is the documentation for the Taylor UUCP package, version 1.05. +The programs were written by Ian Lance Taylor. The author can be +reached at @code{<ian@@airs.com>}, or @samp{c/o Cygnus Support, Building +200, 1 Kendall Square, Cambridge, MA, 02139, USA}. + +There is a mailing list for discussion of the package. To join (or get +off) the list, send mail to +@code{<taylor-uucp-request@@gnu.ai.mit.edu>}. Mail to this address is +answered by a person, not a program. When joining the list, please give +the address at which you wish to receive mail; do not rely on the +message headers. To send a message to the list, send it to +@code{<taylor-uucp@@gnu.ai.mit.edu>}. + +Jeff Ross has volunteered to maintain patches for UUCP releases. They +may be obtained via anonymous FTP from ftp.fdu.edu, in the directory +pub/taylor-uucp. + +@menu +* Copying:: Taylor UUCP copying conditions +* Introduction:: Introduction to Taylor UUCP +* Overall Installation:: Taylor UUCP installation +* Configuration Files:: Taylor UUCP configuration files +* Protocols:: UUCP protocol internals +* Hacking:: Hacking Taylor UUCP +* Acknowledgements:: Acknowledgements + +* Index (concepts):: Concept index +* Index (configuration file):: Index to new configuration files + + --- The Detailed Node Listing --- + +Taylor UUCP Overall Installation + +* Configuration:: Configuring Taylor UUCP +* Compilation:: Compiling Taylor UUCP +* Testing:: Testing Taylor UUCP +* Installation:: Installing Taylor UUCP +* TCP:: TCP together with Taylor UUCP + +Installing Taylor UUCP + +* Running uucico:: Running uucico +* Using UUCP for mail and news:: Using UUCP for mail and news. +* Trimming UUCP Log Files:: Trimming UUCP Log Files + +Using UUCP for mail and news. + +* Sending mail or news:: Sending mail or news via UUCP +* Receiving mail or news:: Receiving mail or news via UUCP + +Taylor UUCP Configuration Files + +* Configuration File Format:: Configuration file format +* Configuration File Overview:: Configuration File Overview +* Configuration Examples:: Examples of configuration files +* Time Strings:: How to write time strings +* Chat Scripts:: How to write chat scripts +* config File:: The main configuration file +* sys File:: The system configuration file +* port File:: The port configuration files +* dial File:: The dialer configuration files +* Security:: Security issues + +Examples of Configuration Files + +* config File Examples:: Examples of the main configuration file +* Leaf Example:: Call a single remote site +* Gateway Example:: The gateway for several local systems + +The Main Configuration File + +* Miscellaneous (config):: Miscellaneous config file commands +* Configuration File Names:: Using different configuration files +* Log File Names:: Using different log files +* Debugging Levels:: Debugging levels + +The System Configuration File + +* Defaults and Alternates:: Using defaults and alternates +* Naming the System:: Naming the system +* Calling Out:: Calling out +* Accepting a Call:: Accepting a call +* Protocol Selection:: Protocol selection +* File Transfer Control:: File transfer control +* Miscellaneous (sys):: Miscellaneous sys file commands +* Default sys File Values:: Default values + +Calling Out + +* When to Call:: When to call +* Placing the Call:: Placing the call +* Logging In:: Logging in + +Hacking Taylor UUCP + +* System Dependence:: System Dependence +* Naming Conventions:: Naming Conventions +* Patches:: Patches +@end menu + +@node Copying, Introduction, Top, Top +@unnumbered Taylor UUCP Copying Conditions + +This package is covered by the GNU Public License. See the file +@file{COPYING} for details. If you would like to do something with this +package that you feel is reasonable, but you feel is prohibited by the +license, contact me to see if we can work it out. + +Here is some propaganda from the Free Software Foundation. If you find +this stuff offensive or annoying, remember that you probably did not +spend any money to get this code. I did not write this code to make +life easier for developers of UUCP packages, I wrote it to help end +users, and I believe that these are the most appropriate conditions for +distribution. + +All the programs, scripts and documents relating to Taylor UUCP are +@dfn{free}; this means that everyone is free to use them and free to +redistribute them on a free basis. The Taylor UUCP-related programs are +not in the public domain; they are copyrighted and there are +restrictions on their distribution, but these restrictions are designed +to permit everything that a good cooperating citizen would want to do. +What is not allowed is to try to prevent others from further sharing any +version of these programs that they might get from you. + +Specifically, we want to make sure that you have the right to give away +copies of the programs that relate to Taylor UUCP, that you receive +source code or else can get it if you want it, that you can change these +programs or use pieces of them in new free programs, and that you know +you can do these things. + +To make sure that everyone has such rights, we have to forbid you to +deprive anyone else of these rights. For example, if you distribute +copies of the Taylor UUCP related programs, you must give the recipients +all the rights that you have. You must make sure that they, too, +receive or can get the source code. And you must tell them their +rights. + +Also, for our own protection, we must make certain that everyone finds +out that there is no warranty for the programs that relate to Taylor +UUCP. If these programs are modified by someone else and passed on, we +want their recipients to know that what they have is not what we +distributed, so that any problems introduced by others will not reflect +on our reputation. + +The precise conditions of the licenses for the programs currently being +distributed that relate to Taylor UUCP are found in the General Public +Licenses that accompany them. + +@node Introduction, Overall Installation, Copying, Top +@chapter Introduction to Taylor UUCP + +General introductions to UUCP are available, and perhaps one day I will +write one. In the meantime, here is a very brief one that concentrates +on the programs provided by Taylor UUCP. + +Taylor UUCP is a complete UUCP package. It is covered by the GNU Public +License, which means that the source code is always available. It is +composed of several programs; most of the names of these programs are +based on earlier UUCP packages. + +@table @code + +@item uucp + +The @code{uucp} program is used to copy file between systems. It is +similar to the standard Unix @code{cp} program, except that you can +refer to a file on a remote system by using @samp{system!} before the +file name. For example, to copy the file @file{notes.txt} to the system +@samp{airs}, you would say @samp{uucp notes.txt airs!~/notes.txt}. In +this example @samp{~} is used to name the UUCP public directory on +@samp{airs}. + +@item uux + +The @code{uux} program is used to request the execution of a program on +a remote system. This is how mail and news are transferred over UUCP. +As with @code{uucp}, programs and files on remote systems may be named +by using @samp{system!}. For example, to run the @code{rnews} program +on @samp{airs} passing it standard input, you would say @samp{uux - +airs!rnews}. The @samp{-} means to read standard input and set things +up such that when @code{rnews} runs on @samp{airs} it will receive the +same standard input. + +@end table + +Neither @code{uucp} nor @code{uux} actually do any work immediately. +Instead, they queue up requests for later processing. They then start a +daemon process which processes the requests and calls up the appropriate +systems. Normally the system will also start the daemon periodically to +check if there is any work to be done. The advantage of this approach +is that it all happens automatically. You don't have to sit around +waiting for the files to be transferred. The disadvantage is that if +anything goes wrong it might be a while before anybody notices. + +@table @code + +@item uustat + +The @code{uustat} program does many things. By default it will simply +list all the jobs you have queued with @code{uucp} or @code{uux} that +have not yet been processed. You can use @code{uustat} to remove any of +your jobs from the queue. You can also it use it to show the status of +the UUCP system in various ways, such as showing the connection status +of all the remote systems your system knows about. The system +administrator can use @code{uustat} to automatically discard old jobs +while sending mail to the user who requested them. + +@item uuname + +The @code{uuname} program by default lists all the remote systems your +system knows about. You can also use it to get the name of your local +system. It is mostly useful for shell scripts. + +@item uulog + +The @code{uulog} program can be used to display entries in the UUCP log +file. It can select the entries for a particular system or a particular +user. You can use it to see what has happened to your queued jobs in +the past. + +@item uuto +@item uupick + +@code{uuto} is a simple shell script interface to @code{uucp}. It will +transfer a file, or the contents of a directory, to a remote system, and +notify a particular user on the remote system when it arrives. The +remote user can then retrieve the file(s) with @code{uupick}. + +@item cu + +The @code{cu} program can be used to call up another system and +communicate with it as though you were directly connected. It can also +do simple file transfers, though it does not provide any error checking. + +@end table + +These eight programs just described, @code{uucp}, @code{uux}, +@code{uuto}, @code{uupick}, @code{uustat}, @code{uuname}, @code{uulog}, +and @code{cu} are the user programs provided by Taylor UUCP@. +@code{uucp}, @code{uux}, and @code{uuto} add requests to the work queue, +@code{uupick} extracts files from the UUCP public directory, +@code{uustat} examines the work queue, @code{uuname} examines the +configuration files, @code{uulog} examines the log files, and @code{cu} +just uses the UUCP configuration files. + +The real work is actually done by two daemon processes, which are +normally run automatically rather than by a user. + +@table @code + +@item uucico + +The @code{uucico} daemon is the program which actually calls the remote +system and transfers files and requests. @code{uucico} is normally +started automatically by @code{uucp} and @code{uux}. Most systems will +also start it periodically to make sure that all work requests are +handled. @code{uucico} checks the queue to see what work needs to be +done, and then calls the appropriate systems. If the call fails, +perhaps because the phone line is busy, @code{uucico} leaves the +requests in the queue and goes on to the next system to call. It is +also possible to force @code{uucico} to call a remote system even if +there is no work to be done for it, so that it can pick up any work that +may be queued up remotely. + +@need 1000 +@item uuxqt + +The @code{uuxqt} daemon processes execution requests made by the +@code{uux} program on remote systems. It also processes requests made +on the local system which require files from a remote system. It is +normally started by @code{uucico}. + +@end table + +Suppose you, on the system @samp{bantam}, want to copy a file to the +system @samp{airs}. You would run the @code{uucp} command locally, with +a command like @samp{uucp notes.txt airs!~/notes.txt}. This would queue +up a request on @samp{bantam} for @samp{airs}, and would then start the +@code{uucico} daemon. @code{uucico} would see that there was a request +for @samp{airs} and attempt to call it. When the call succeeded, +another copy of @code{uucico} would be started on @samp{airs}. The two +copies of @code{uucico} would tell each other what they had to do and +transfer the file from @samp{bantam} to @samp{airs}. When the file +transfer was complete the @code{uucico} on @samp{airs} would move it +into the UUCP public directory. + +UUCP is often used to transfer mail. This is normally done +automatically by mailer programs. When @samp{bantam} has a mail message +to send to @samp{ian} at @samp{airs}, it executes @samp{uux - airs!rmail +ian} and writes the mail message to the @code{uux} process as standard +input. The @code{uux} program, running on @samp{bantam}, will read the +standard input and store it, as well as the @code{rmail} request itself, +on the work queue for @samp{airs}. @code{uux} will then start the +@code{uucico} daemon. The @code{uucico} daemon will call up +@samp{airs}, just as in the @code{uucp} example, and transfer the work +request and the mail message. The @code{uucico} daemon on @samp{airs} +will put the files on a local work queue. When the communication +session is over, the @code{uucico} daemon on @samp{airs} will start the +@code{uuxqt} daemon. @code{uuxqt} will see the request to run, and will +run @samp{rmail ian} with the mail message as standard input. The +@code{rmail} program, which is not part of the UUCP package, is then +responsible for either putting the message in the right mailbox on +@samp{airs} or forwarding the message on to another system. + +Taylor UUCP comes with a few other programs that are useful when +installing and configuring UUCP. + +@table @code + +@item uuchk + +The @code{uuchk} program reads the UUCP configuration files and displays +a rather lengthy description of what it finds. This is useful when +configuring UUCP to make certain that the UUCP package will do what you +expect it to do. + +@item uuconv + +The @code{uuconv} program can be used to convert UUCP configuration +files from one format to another. This can be useful for administrators +converting from an older UUCP. Taylor UUCP is able to read and use old +configuration file formats, but some new features can not be selected +using the old formats. + +@item uusched + +The @code{uusched} script is just provided for compatibility with older +UUCP releases. It starts @code{uucico} to call, one at a time, all the +systems for which work has been queued. + +@item tstuu + +The @code{tstuu} program is a test harness for the UUCP package; it can +help check that the package has been configured and compiled correctly. +However, it uses pseudo-terminals, which means that it is less portable +than the rest of the package. If it works, it can be useful when +initially installing Taylor UUCP. + +@end table + +@node Overall Installation, Configuration Files, Introduction, Top +@chapter Taylor UUCP Overall Installation + +These are the installation instructions for the Taylor UUCP package. + +@menu +* Configuration:: Configuring Taylor UUCP +* Compilation:: Compiling Taylor UUCP +* Testing:: Testing Taylor UUCP +* Installation:: Installing Taylor UUCP +* TCP:: TCP together with Taylor UUCP +@end menu + +@node Configuration, Compilation, Overall Installation, Overall Installation +@section Configuring Taylor UUCP + +You will have to decide what types of configuration files you want to +use. This package supports a new sort of configuration file; see +@ref{Configuration Files}. It also supports V2 configuration files +(@file{L.sys}, @file{L-devices}, etc.) and HDB configuration files +(@file{Systems}, @file{Devices}, etc.). No documentation is provided +for V2 or HDB configuration files. All types of configuration files can +be used at once, if you are so inclined. Currently using just V2 +configuration files is not really possible, because there is no way to +specify a dialer (there are no built in dialers, and the program does +not know how to read @file{acucap} or @file{modemcap}); however, V2 +configuration files can be used with a new style dial file (@pxref{dial +File}), or with a HDB @file{Dialers} file. + +Use of HDB configuration files has two known bugs. A blank line in the +middle of an entry in the @file{Permissions} file will not be ignored as +it should be. Dialer programs, as found in some versions of HDB, are +not recognized directly. If you must use a dialer program, rather than +an entry in @file{Devices}, you must use the @code{chat-program} command +in a new style dial file; see @ref{dial File}. You will have to invoke +the dialer program via a shell script or another program, since an exit +code of 0 is required to recognize success; the @code{dialHDB} program +in the @file{contrib} directory may be used for this purpose. + +The @code{uuconv} program can be used to convert from V2 or HDB +configuration files to the new style (it can also do the reverse +translation, if you are so inclined). It will not do all of the work, +and the results should be carefully checked, but it can be quite useful. + +If you are installing a new system, you will, of course, have to write +the configuration files; see @ref{Configuration Files}. + +You must also decide what sort of spool directory you want to use. If +you will be using only these programs for UUCP, I recommend +@samp{SPOOLDIR_TAYLOR}; otherwise select the spool directory +corresponding to your existing UUCP package. The details of the spool +directory choices are described at somewhat tedious length in +@file{unix/spool.c}. + +@node Compilation, Testing, Configuration, Overall Installation +@section Compiling Taylor UUCP + +@enumerate + +@item +Take a look at the top of @file{Makefile.in} and set the appropriate +values for your system. These control where the programs are installed +and which user on the system owns them (normally they will be owned by a +special user @code{uucp} rather than a real person; they should probably +not be owned by @code{root}). + +@item +Run the shell script @code{configure}. This script was generated using +the @code{autoconf} program written by David MacKenzie of the Free +Software Foundation. It takes a while to run. It will generate the +file @file{config.h} based on @file{config.h.in}, and, for each source +code directory, will generate @file{Makefile} based on +@file{Makefile.in}. + +You can pass certain arguments to @code{configure} in the environment. +Because @code{configure} will compile little test programs to see what +is available on your system, you must tell it how to run your compiler. +It recognizes the following environment variables: + +@table @samp +@item CC +The C compiler. If this is not set, then if @code{configure} can find +@samp{gcc} it will use it, otherwise it will use @samp{cc}. +@item CFLAGS +Flags to pass to the C compiler when compiling the actual code. If this +is not set, @code{configure} will use @samp{-g}. +@item LDFLAGS +Flags to pass to the C compiler when only linking, not compiling. If +this is not set, @code{configure} will use the empty string. +@item LIBS +Libraries to pass to the C compiler. If this is not set, +@code{configure} will use the empty string. +@item INSTALL +The program to run to install UUCP in the binary directory. If this is +not set, then if @code{configure} finds the BSD @code{install} program, +it will set this to @samp{install -c}; otherwise, it will use @samp{cp}. +@item INSTALLDATA +The program to run to install UUCP data files, such as the man pages and +the info pages. If this is not set, then if @code{configure} finds the +BSD @code{install} program, it will set this to @samp{install -c -m +644}; otherwise, it will use @samp{cp}. +@end table + +Suppose you want to set the environment variable @samp{CC} to +@samp{rcc}. If you are using @code{sh} or @code{bash}, invoke +@code{configure} as @samp{CC=rcc configure}. If you are using +@code{csh}, do @samp{setenv CC rcc; sh configure}. + +On some systems you will want to use @samp{LIBS=-lmalloc}. On Xenix +derived versions of Unix do not use @samp{LIBS=-lx} because this will +bring in the wrong versions of certain routines; if you want to use +@samp{-lx} you must specify @samp{LIBS=-lc -lx}. + +If @code{configure} fails for some reason, or if you have a very weird +system, you may have to configure the package by hand. To do this, copy +the file @file{config.h.in} to @file{config.h} and edit it for your +system. Then for each source directory (the top directory, and the +subdirectories @file{lib}, @file{unix}, and @file{uuconf}) copy +@file{Makefile.in} to @file{Makefile}, find the words within @kbd{@@} +characters, and set them correctly for your system. + +@item +Igor V. Semenyuk provided this (lightly edited) note about ISC Unix 3.0. +The @code{configure} script will default to passing @samp{-posix} to +@code{gcc}. However, using @samp{-posix} changes the environment to +POSIX, and on ISC 3.0, at least, the default for POSIX_NO_TRUNC is 1. +This means nothing for uucp, but can lead to a problem when uuxqt +executes rmail. IDA sendmail has dbm configuration files named +@file{mailertable.@{dir,pag@}}. Notice these names are 15 characters +long. When uuxqt compiled with @samp{-posix} executes rmail, which in +turn executes sendmail, the later is run under POSIX environment too! +This leads to sendmail bombing out with @samp{'error opening 'M' +database: name too long' (mailertable.dir)}. It's rather obscure +behaviour, and it took me a day to find out the cause. I don't use +@samp{-posix}, instead I run @code{gcc} with @samp{-D_POSIX_SOURCE}, and +add @samp{-lcposix} to @samp{LIBS}. + +@item +On some versions of BSDI there is a bug in the shell which causes the +default value for @samp{CFLAGS} to be set incorrectly. If @samp{echo +$@{CFLAGS--g@}} echoes @samp{g} rather than @samp{-g}, then you must set +@samp{CFLAGS} in the environment before running configure. There is a +patch available from BSDI for this bug. (From David Vrona). + +@item +On AIX 3.2.5, and possibly other versions, @samp{cc -E} does not work, +reporting @samp{Option NOROCONST is not valid}. Test this before +running configure by doing something like @samp{touch /tmp/foo.c; cc -E +/tmp/foo.c}. This may give a warning about the file being empty, but it +should not give the @samp{Option NOROCONST} warning. The workaround is +to remove the @samp{,noroconst} entry from the @samp{options} clause in +the @samp{cc} stanza in @file{/etc/xlc.cfg}. (From Chris Lewis). + +@item +You should verify that @code{configure} worked correctly by checking +@file{config.h} and the instances of @file{Makefile}. + +@item +Edit @file{policy.h} for your local system. The comments should explain +the various choices. The default values are intended to be reasonable, +so you may not have to make any changes. + +@item +Type @samp{make} to compile everything. The @file{tstuu.c} file is not +particularly portable; if you can't figure out how to compile it you can +safely ignore it, as it is only used for testing (to use STREAMS +pseudo-terminals, tstuu.c must be compiled with +@samp{-DHAVE_STREAMS_PTYS}; this is not automatically determined at the +moment). If you have any other problems there is probably a bug in the +@code{configure} script. + +@item +Please report any problems you have. That is the only way they will get +fixed for other people. Supply a patch if you can (@pxref{Patches}), or +just ask for help. + +@end enumerate + +@node Testing, Installation, Compilation, Overall Installation +@section Testing Taylor UUCP + +This package is in use at hundreds, perhaps thousands, of sites, and has +been running at @file{airs.com} for several years. However, it will +doubtless fail in some situations. Do not rely on this code until you +have proven to yourself that it will work. + +You can use the @code{uuchk} program to test your configuration files. +It will read them and print out a verbose description. This program +should not be made setuid, because it will display passwords if it can +read them. + +If your system supports pseudo-terminals, and you compiled the code to +support the new style of configuration files, you should be able to use +the @code{tstuu} program to test the @code{uucico} daemon (if your +system supports STREAMS based pseudo-terminals, you must compile tstuu.c +with @samp{-DHAVE_STREAMS_PTYS}, at least at the moment; the STREAMS +based code was contributed by Marc Boucher). + +To run @code{tstuu}, just type @samp{tstuu} with no arguments while +logged in to the compilation directory (since it runs @file{./uucp}, +@file{./uux} and @file{./uucico}). It will run a lengthy series of +tests (it takes over ten minutes on a slow VAX). You will need a fair +amount of space available in @file{/usr/tmp}. You will probably want to +put it in the background. Do not use @kbd{^Z}, because the program +traps on @code{SIGCHLD} and winds up dying. It will create a directory +@file{/usr/tmp/tstuu} and fill it with configuration files, and create +spool directories @file{/usr/tmp/tstuu/spool1} and +@file{/usr/tmp/tstuu/spool2}. + +If your system does not support the @code{FIONREAD} call, the +@samp{tstuu} program will run very slowly. This may or may not get +fixed in a later version. + +The program will finish with an execute file named +@file{X.@var{something}} and a data file named @file{D.@var{something}} +in the directory @file{/usr/tmp/tstuu/spool1} (or, more likely, in +subdirectories, depending on the choice of @code{SPOOLDIR} in +@file{policy.h}). Two log files will be created in the directory +@file{/usr/tmp/tstuu}. They will be named @file{Log1} and @file{Log2}, +or, if you have selected @code{HAVE_HDB_LOGGING} in @file{policy.h}, +@file{Log1/uucico/test2} and @file{Log2/uucico/test1}. You can test +@code{uuxqt} by running the command @samp{./uuxqt -I +/usr/tmp/tstuu/Config1}. This should leave a command file +@file{C.@var{something}} and a data file @file{D.@var{something}} in +@file{/usr/tmp/tstuu/spool1} or in subdirectories. Again, there should +be no errors in the log file. + +Assuming you compiled the code with debugging enabled, the @samp{-x} +switch can be used to set debugging modes; see the @code{debug} command +for details (@pxref{Debugging Levels}). Use @samp{-x all} to turn on +all debugging and generate far more output than you will ever want to +see. The @code{uucico} daemons will put debugging output in the files +@file{Debug1} and @file{Debug2} in the directory @file{/usr/tmp/tstuu}. +After that, you're pretty much on your own. + +On some systems you can also use @code{tstuu} to test @code{uucico} +against the system @code{uucico}, by using the @samp{-u} switch. For +this to work, change the definitions of @code{ZUUCICO_CMD} and +@code{UUCICO_EXECL} at the top of @file{tstuu.c} to something +appropriate for your system. The definitions in @file{tstuu.c} are what +I used for Ultrix 4.0, on which @file{/usr/lib/uucp/uucico} is +particularly obstinate about being run as a child; I was only able to +run it by creating a login name with no password whose shell was +@file{/usr/lib/uucp/uucico}. Calling login in this way will leave fake +entries in @file{wtmp} and @file{utmp}; if you compile @file{tstout.c} +(in the @file{contrib} directory) as a setuid @code{root} program, +@code{tstuu} will run it to clear those entries out. On most systems, +such hackery should not be necessary, although on SCO I had to su to +@code{root} (@code{uucp} might also have worked) before I could run +@file{/usr/lib/uucp/uucico}. + +You can test @code{uucp} and @code{uux} (give them the @samp{-r} switch +to keep them from starting @code{uucico}) to make sure they create the +right sorts of files. Unfortunately, if you don't know what the right +sorts of files are, I'm not going to tell you here. + +If @code{tstuu} passes, or you can't run it for some reason or other, +move on to testing with some other system. Set up the configuration +files (@pxref{Configuration Files}), or use an existing configuration. +Tell @code{uucico} to dial out to the system by using the @samp{-s} +system switch (e.g. @samp{uucico -s uunet}). The log file should tell +you what happens. + +If you compiled the code with debugging enabled, you can use debugging +mode to get a great deal of information about what sort of data is +flowing back and forth; the various possibilities are described under +the @code{debug} command (@pxref{Debugging Levels}). When initially +setting up a connection @samp{-x chat} is probably the most useful (e.g. +@samp{uucico -s uunet -x chat}); you may also want to use @samp{-x +handshake,incoming,outgoing}. You can use @samp{-x} multiple times on +one command line, or you can give it comma separated arguments as in the +last example. Use @samp{-x all} to turn on all possible debugging +information. The debugging information is written to a file, normally +@file{/usr/spool/uucp/Debug}, although the default can be changed in +@file{policy.h} and the @file{config} file can override the name with +the @code{debugfile} command. The debugging file may contain passwords +and some file contents as they are transmitted over the line, so the +debugging file is only readable by the @code{uucp} user. + +You can use the @samp{-f} switch to force @code{uucico} to call out even +if the last call failed recently; using @samp{-S} when naming a system +has the same effect. Otherwise the status file (in the @file{.Status} +subdirectory of the main spool directory, normally +@file{/usr/spool/uucp}) will prevent too many attempts from occurring in +rapid succession. + +Again, please let me know about any problems you have and how you got +around them. If you do report a problem, please include the version +number of the package you are using, and a sample of the debugging file +showing the problem (debugging information is usually what is needed, +not just the log file). General questions such as ``why doesn't uucico +dial out'' are impossible to answer without much more information. + +@node Installation, TCP, Testing, Overall Installation +@section Installing Taylor UUCP + +You can install the executable files by becoming @code{root} and typing +@samp{make install}. Or you can look at what @samp{make install} does +and do it by hand. It tries to preserve your old programs, if any, but +it only does this the first time Taylor UUCP is installed (so that if +you install several versions of Taylor UUCP, you can still go back to +your original UUCP programs). You can retrieve the original programs by +typing @samp{make uninstall}. + +Note that by default the programs are compiled with debugging +information, and they are not stripped when they are installed. You may +want to strip the installed programs to save disk space. See your +system documentation for strip for more information. + +However, simply installing the executable files is not enough. You must +also arrange for them to be used correctly. + +@menu +* Running uucico:: Running uucico +* Using UUCP for mail and news:: Using UUCP for mail and news. +* Trimming UUCP Log Files:: Trimming UUCP Log Files +@end menu + +@node Running uucico, Using UUCP for mail and news, Installation, Installation +@subsection Running uucico + +By default @code{uucp} and @code{uux} will automatically start up +@code{uucico} to call another system whenever work is queued up. +However, the call may fail, or you may have put in time restrictions +which prevent the call at that time (perhaps because telephone rates are +high) (@pxref{When to Call}). Also, a remote system may have work +queued up for your system, but may not be calling you for some reason +(perhaps you have agreed that your system should always place the call). +To make sure that works get transferred between the systems withing a +reasonable time period, you should arrange to periodically invoke +@code{uucico}. + +These periodic invocations are normally caused by entries in the +@file{crontab} file. The exact format of @file{crontab} files, and how +new entries are added, varies from system to system; check your local +documentation (try @samp{man cron}). + +To attempt to call all systems with outstanding work, use the command +@samp{uucico -r1}. To attempt to call a particular system, use the +command @samp{uucico -s @var{system}}. To attempt to call a particular +system, but only if there is work for it, use the command @samp{uucico +-C -s @var{system}}. + +A common case is to want to try to call a system at a certain time, with +periodic retries if the call fails. A simple way to do this is to +create an empty UUCP command file, known as a @dfn{poll file}. If a +poll file exists for a system, then @samp{uucico -r1} will place a call +to it. If the call succeeds, the poll file will be deleted. + +The file can be easily created using the @samp{touch} command. The name +of a poll file currently depends on the type of spool directory you are +using, as set in @file{policy.h}. If you are using +@code{SPOOLDIR_TAYLOR} (the default), put something like this in your +@file{crontab} file: +@example +touch /usr/spool/uucp/@var{sys}/C./C.A0000 +@end example +In this example @var{sys} is the system you wish to call, and +@samp{/usr/spool/uucp} is your UUCP spool directory. +If you are using @code{SPOOLDIR_HDB}, use +@example +touch /usr/spool/uucp/@var{sys}/C.@var{sys}A0000 +@end example + +For example, I use the following crontab entries locally: + +@example +45 * * * * /bin/echo /usr/lib/uucp/uucico -r1 | /bin/su uucpa +40 4,10,15 * * * touch /usr/spool/uucp/uunet/C./C.A0000 +@end example + +Every hour, at 45 minutes past, this will check if there is any work to +be done, and, if there is, will call the appropriate system. Also, at +4:40am, 10:40am and 3:40pm this will create a poll file file for +@samp{uunet}, forcing the next check to call @samp{uunet}. + +@node Using UUCP for mail and news, Trimming UUCP Log Files, Running uucico, Installation +@subsection Using UUCP for mail and news. + +Taylor UUCP does not include a mail package. All Unix systems come with +some sort of mail delivery agent, typically @code{sendmail} or +@code{MMDF}. Source code is available for some alternative mail +delivery agents, such as @code{IDA sendmail} and @code{smail}. + +Taylor UUCP also does not include a news package. The two major Unix +news packages are @code{C-news} and @code{INN}. Both are available in +source code form. + +Configuring and using mail delivery agents is a notoriously complex +topic, and I will not be discussing it here. Configuring news systems +is usually simpler, but I will not be discussing that either. I will +merely describe the interactions between the mail and news systems and +UUCP. + +A mail or news system interacts with UUCP in two ways: sending and +receiving. + +@menu +* Sending mail or news:: Sending mail or news via UUCP +* Receiving mail or news:: Receiving mail or news via UUCP +@end menu + +@node Sending mail or news, Receiving mail or news, Using UUCP for mail and news, Using UUCP for mail and news +@unnumberedsubsubsec Sending mail or news via UUCP + +When mail is to be sent from your machine to another machine via UUCP, +the mail delivery agent will invoke @code{uux}. It will generally run a +command such as @samp{uux - @var{system}!rmail}, where @var{system} is +the remote system to which the mail is being sent. It may pass other +options to @code{uux}, such as @samp{-r} or @samp{-g}. + +News also invokes @code{uux} in order to transfer articles to another +system. The only difference is that news will use @code{uux} to invoke +@code{rnews} on the remote system, rather than @code{rmail}. + +You should arrange for your mail and news systems to invoke the Taylor +UUCP version of @code{uux} when sending mail via UUCP. If you simply +replace any existing version of @code{uux} with the Taylor UUCP version, +this will probably happen automatically. However, if both versions +exist on your system, you will probably have to modify the mail and news +configuration files in some way. + +Actually, if both the system UUCP and Taylor UUCP are using the same +spool directory format, the system @code{uux} will probably work fine +with the Taylor @code{uucico} (the reverse is not the case: the Taylor +@code{uux} requires the Taylor @code{uucico}). However, data transfer +will be somewhat more efficient if the Taylor @code{uux} is used. + +@node Receiving mail or news, , Sending mail or news, Using UUCP for mail and news +@unnumberedsubsubsec Receiving mail or news via UUCP + +As noted in @ref{Sending mail or news}, mail is sent by requesting a +remote execution of @code{rmail}. To receive mail, then, all that is +necessary is for UUCP to invoke @code{rmail} itself. + +Any mail delivery agent will provide an appropriate version of +@code{rmail}; you must simply make sure that it is in the command path +used by UUCP (it almost certainly already is). The default command path +is set in @file{policy.h}, and it may be overridden for a particular +system by the @code{command-path} command (@pxref{Miscellaneous (sys)}). + +Similarly, for news UUCP must be able to invoke @code{rnews}. Any news +system will provide a version of @code{rnews}, and you must ensure that +is in a directory on the path that UUCP will search. + +@node Trimming UUCP Log Files, , Using UUCP for mail and news, Installation +@subsection Trimming UUCP Log Files + +You should also periodically trim the log files, as they will otherwise +continue to grow without limit. The names of the log files are set in +@file{policy.h}, and may be overridden in the configuration file +(@pxref{config File}). By default they are are +@file{/usr/spool/uucp/Log} and @file{/usr/spool/uucp/Stats}. + +You may find the @code{savelog} program in the @file{contrib} directory +to be of use. There is a manual page for it in @file{contrib} as well. + +@node TCP, , Installation, Overall Installation +@section TCP together with Taylor UUCP + +If your system has a Berkeley style socket library, or a System V style +TLI interface library, you can compile the code to permit making +connections over TCP. Specifying that a system should be reached via +TCP is easy, but nonobvious. + +If you are using the new style configuration files, see +@ref{Configuration Files}. Basically, you can just add the line +@samp{port type tcp} to the entry in the system configuration file. By +default UUCP will get the port number by looking up @samp{uucp} in +@file{/etc/services}; if @samp{uucp} is not found, port 540 will be +used. You can set the port number to use with the command @samp{port +service @var{xxx}}, where @var{xxx} can be either a number or a name to +look up in @file{/etc/services}. You can specify the address of the +remote host with @samp{address @var{a.b.c}}; if you don't give an +address, the remote system name will be used. You should give an +explicit chat script for the system when you use TCP; the default chat +script begins with a carriage return, which will not work with some UUCP +TCP servers. + +If you are using V2 configuration files, add a line like this to +@file{L.sys}: + +@example +@var{sys} Any TCP uucp @var{host}.@var{domain} chat-script +@end example + +This will make an entry for system @var{sys}, to be called at any time, +over TCP, using port number @samp{uucp} (as found in +@file{/etc/services}; this may be specified as a number), using remote +host @file{@var{host}.@var{domain}}, with some chat script. + +@need 1000 +If you are using HDB configuration files, add a line like this to +Systems: + +@example +@var{sys} Any TCP - @var{host}.@var{domain} chat-script +@end example + +and a line like this to Devices: + +@example +TCP uucp - - +@end example + +You only need one line in Devices regardless of how many systems you +contact over TCP. This will make an entry for system @var{sys}, to be +called at any time, over TCP, using port number @samp{uucp} (as found in +@file{/etc/services}; this may be specified as a number), using remote +host @file{@var{host}.@var{domain}}, with some chat script. + +The @code{uucico} daemon can also be run as a TCP server. To use the +default port number, which is a reserved port, @code{uucico} must be +invoked by root (or it must be set user ID to root, but I don't +recommend doing that). + +Basically, you must define a port, either using the port file +(@pxref{port File}) if you are using the new configuration method or +with an entry in Devices if you are using HDB; there is no way to define +a port using V2. If you are using HDB the port must be named +@samp{TCP}; a line as shown above will suffice. You can then start +@code{uucico} as @samp{uucico -p TCP} (after the @samp{-p}, name the +port; in HDB it must be @samp{TCP}). This will wait for incoming +connections, and fork off a child for each one. Each connection will be +prompted with @samp{login:} and @samp{Password:}; the results will be +checked against the UUCP (not the system) password file +(@pxref{Configuration File Names}). + +Of course, you can get a similar effect by using the BSD @code{uucpd} +program. + +You can also have @code{inetd} start up @code{uucico} with the @samp{-l} +switch, which will cause it to prompt with @samp{login:} and +@samp{Password:} and check the results against the UUCP (not the system) +password file (you may want to also use the @samp{-D} switch to avoid a +fork, which in this case is unnecessary). This may be used in place of +@code{uucpd}. + +@node Configuration Files, Protocols, Overall Installation, Top +@chapter Taylor UUCP Configuration Files + +This chapter describes the configuration files accepted by the Taylor +UUCP package if compiled with @code{HAVE_TAYLOR_CONFIG} defined in +@file{policy.h}. + +The configuration files are normally found in the directory +@var{newconfigdir}, which is defined by the @file{Makefile} variable +@file{newconfigdir}; by default @var{newconfigdir} is +@file{/usr/local/conf/uucp}. However, the main configuration file, +@file{config}, is the only one which must be in that directory, since it +may specify a different location for any or all of the other files. You +may run any of the UUCP programs with a different main configuration +file by using the @samp{-I} option; this can be useful when testing a +new configuration. When you use the @samp{-I} option the programs will +revoke any setuid privileges. + +@menu +* Configuration File Format:: Configuration file format +* Configuration File Overview:: Configuration File Overview +* Configuration Examples:: Examples of configuration files +* Time Strings:: How to write time strings +* Chat Scripts:: How to write chat scripts +* config File:: The main configuration file +* sys File:: The system configuration file +* port File:: The port configuration files +* dial File:: The dialer configuration files +* Security:: Security issues +@end menu + +@node Configuration File Format, Configuration File Overview, Configuration Files, Configuration Files +@section Configuration File Format + +All the configuration files follow a simple line-oriented +@samp{@var{keyword} @var{value}} format. Empty lines are ignored, as +are leading spaces; unlike HDB, lines with leading spaces are read. The +first word on each line is a keyword. The rest of the line is +interpreted according to the keyword. Most keywords are followed by +numbers, boolean values or simple strings with no embedded spaces. + +The @kbd{#} character is used for comments. Everything from a @kbd{#} +to the end of the line is ignored unless the @kbd{#} is preceded by a +@kbd{\} (backslash); if the @kbd{#} is preceeded by a @kbd{\}, the +@kbd{\} is removed but the @kbd{#} remains in the line. This can be +useful for a phone number containing a @kbd{#}. To enter the sequence +@samp{\#}, use @samp{\\#}. + +The backslash character may be used to continue lines. If the last +character in a line is a backslash, the backslash is removed and the +line is continued by the next line. The second line is attached to the +first with no intervening characters; if you want any whitespace between +the end of the first line and the start of the second line, you must +insert it yourself. + +However, the backslash is not a general quoting character. For example, +you cannot use it to get an embedded space in a string argument. + +Everything after the keyword must be on the same line. A @var{boolean} +may be specified as @kbd{y}, @kbd{Y}, @kbd{t}, or @kbd{T} for true and +@kbd{n}, @kbd{N}, @kbd{f}, or @kbd{F} for false; any trailing characters +are ignored, so @code{true}, @code{false}, etc., are also acceptable. + +@node Configuration File Overview, Configuration Examples, Configuration File Format, Configuration Files +@section Configuration File Overview + +UUCP uses several different types of configuration files, each +describing a different kind of information. The commands permitted in +each file are described in detail below. This section is a brief +description of some of the different types of files. + +The @file{config} file is the main configuration file. It describes +general information not associated with a particular remote system, such +as the location of various log files. There are reasonable defaults for +everything that may be specified in the @file{config} file, so you may +not actually need one on your system. + +There may be only one @file{config} file, but there may be one or more +of each other type of file. The default is one file for each type, but +more may be listed in the @file{config} file. + +The @file{sys} files are used to describe remote systems. Each remote +system to which you connect must be listed in a @file{sys} file. A +@file{sys} file will include information for a system, such as the speed +(baud rate) to use, or when to place calls. + +For each system you wish to call, you must describe one or more ports; +these ports may be defined directly in the @file{sys} file, or they may +be defined in a @file{port} file. + +The @file{port} files are used to describe ports. A port is a +particular hardware connection on your computer. You would normally +define as many ports as there are modems attached to your computer. A +TCP connection is also described using a port. + +The @file{dial} files are used to describe dialers. Dialer is +essentially another word for modem. The @file{dial} file describes the +commands UUCP should use to dial out on a particular type of modem. You +would normally define as many dialers as there are types of modems +attached to your computer. For example, if you have three Telebit +modems used for UUCP, you would probably define three ports and one +dialer. + +There are other types of configuration files, but these are the +important ones. The other types are described below. + +@node Configuration Examples, Time Strings, Configuration File Overview, Configuration Files +@section Examples of Configuration Files + +This section provides few typical examples of configuration files. +There are also sample configuration files in the @file{sample} +subdirectory of the distribution. + +@menu +* config File Examples:: Examples of the main configuration file +* Leaf Example:: Call a single remote site +* Gateway Example:: The gateway for several local systems +@end menu + +@node config File Examples, Leaf Example, Configuration Examples, Configuration Examples +@subsection config File Examples +@cindex config file examples + +To start with, here are some examples of uses of the main configuration +file, @file{config}. For a complete description of the commands that +are permitted in @file{config}, see @ref{config File}. + +In many cases you will not need to create a @file{config} file at all. +The most common reason to create one is to give your machine a special +UUCP name. Other reasons might be to change the UUCP spool directory or +to permit any remote system to call in. + +If you have an internal network of machines, then it is likely that the +internal name of your UUCP machine is not the name you want to use when +calling other systems. For example, here at @file{airs.com} our +mail/news gateway machine is named @file{elmer.airs.com} (it is one of +several machines all named @file{@var{localname}.airs.com}). If we did +not provide a @file{config} file, then our UUCP name would be +@file{elmer}; however, we actually want it to be @file{airs}. +Therefore, we use the following line in @file{config}: + +@example +nodename airs +@end example + +@cindex changing spool directory +@cindex spool directory (changing) +The UUCP spool directory name is set in @file{policy.h} when the code is +compiled. You might at some point decide that it is appropriate to move +the spool directory, perhaps to put it on a different disk partition. +You would use the following commands in @file{config} to change to +directories on the partition @file{/uucp}: + +@example +spool /uucp/spool +pubdir /uucp/uucppublic +logfile /uucp/spool/Log +debugfile /uucp/spool/Debug +@end example + +You would then move the contents of the current spool directory to +@file{/uucp/spool}. If you do this, make sure that no UUCP processes +are running while you change @file{config} and move the spool directory. + +@cindex anonymous UUCP +Suppose you wanted to permit any system to call in to your system and +request files. This is generally known as @dfn{anonymous UUCP}, since +the systems which call in are effectively anonymous. By default, +unknown systems are not permitted to call in. To permit this you must +use the @code{unknown} command in @file{config}. The @code{unknown} +command is followed by any command that may appear in the system file; +for full details, see @ref{sys File}. + +I will show two possible anonymous UUCP configurations. The first will +let any system call in and download files, but will not permit them to +upload files to your system. + +@example +# No files may be transferred to this system +unknown receive-request no +# The public directory is /usr/spool/anonymous +unknown pubdir /usr/spool/anonymous +# Only files in the public directory may be sent (the default anyhow) +unknown remote-send ~ +@end example + +@noindent +Setting the public directory is convenient for the systems which call +in. It permits to request a file by prefixing it with @file{~/}. For +example, assuming your system is known as @samp{server}, then to +retrieve the file @file{/usr/spool/anonymous/INDEX} a user on a remote +site could just enter @samp{uucp server!~/INDEX ~}; this would transfer +@file{INDEX} from @samp{server}'s public directory to the user's local +public directory. Note that when using @samp{csh} or @samp{bash} the +@kbd{!} and the second @kbd{~} must be quoted. + +The next example will permit remote systems to upload files to a special +directory named @file{/usr/spool/anonymous/upload}. Permitting a remote +system to upload files permits it to send work requests as well; this +example is careful to prohibit commands from unknown systems. + +@example +# No commands may be executed (the list of permitted commands is empty) +unknown commands +# The public directory is /usr/spool/anonymous +unknown pubdir /usr/spool/anonymous +# Only files in the public directory may be sent; users may not download +# files from the upload directory +unknown remote-send ~ !~/upload +# May only upload files into /usr/spool/anonymous/upload +unknown remote-receive ~/upload +@end example + +@node Leaf Example, Gateway Example, config File Examples, Configuration Examples +@subsection Leaf Example + +@cindex leaf site +@cindex sys file example (leaf) +A relatively common simple case is a @dfn{leaf site}, a system which +only calls or is called by a single remote site. Here is a typical +@file{sys} file that might be used in such a case. For full details on +what commands can appear in the @file{sys} file, see @ref{sys File}. + +This is the @file{sys} file that is used at @file{airs.com}. We use a +single modem to dial out to @file{uunet}. This example shows how you +can specify the port and dialer information directly in the @file{sys} +file for simple cases. It also shows the use of the following: + +@table @code + +@item call-login +Using @code{call-login} and @code{call-password} allows the default +login chat script to be used. In this case, the login name is specified +in the call-out login file (@pxref{Configuration File Names}). + +@item call-timegrade +@file{uunet} is requested to not send us news during the daytime. + +@item chat-fail +If the modem returns @samp{BUSY} or @samp{NO CARRIER} the call is +immediately aborted. + +@item protocol-parameter +Since @file{uunet} tends to be slow, the default timeout has been +increased. + +@end table + +This @file{sys} file relies on certain defaults. It will allow +@file{uunet} to queue up @samp{rmail} and @samp{rnews} commands. It +will allow users to request files from @file{uunet} into the UUCP public +directory. It will also allow @file{uunet} to request files from the +UUCP public directory; in fact @file{uunet} never requests files, but +for additional security we could add the line @samp{request false}. + +@example +# The following information is for uunet +system uunet + +# The login name and password are kept in the callout password file +call-login * +call-password * + +# We can send anything at any time. +time any + +# During the day we only accept grade `Z' or above; at other times +# (not mentioned here) we accept all grades. uunet queues up news +# at grade `d', which is lower than `Z'. +call-timegrade Z Wk0755-2305,Su1655-2305 + +# The phone number. +phone 7389449 + +# uunet tends to be slow, so we increase the timeout +chat-timeout 120 + +# We are using a preconfigured Telebit 2500. +port type modem +port device /dev/ttyd0 +port speed 19200 +port carrier true +port dialer chat "" ATZ\r\d\c OK ATDT\D CONNECT +port dialer chat-fail BUSY +port dialer chat-fail NO\sCARRIER +port dialer complete \d\d+++\d\dATH\r\c +port dialer abort \d\d+++\d\dATH\r\c + +# Increase the timeout and the number of retries. +protocol-parameter g timeout 20 +protocol-parameter g retries 10 +@end example + +@node Gateway Example, , Leaf Example, Configuration Examples +@subsection Gateway Example + +@cindex gateway +@cindex sys file example (gateway) +Many organizations have several local machines which are connected by +UUCP, and a single machine which connects to the outside world. This +single machine is often referred to as a @dfn{gateway} machine. + +For this example I will assume a fairly simple case. It should still +provide a good general example. There are three machines, @file{elmer}, +@file{comton} and @file{bugs}. @file{elmer} is the gateway machine for +which I will show the configuration file. @file{elmer} calls out to +@file{uupsi}. As an additional complication, @file{uupsi} knows +@file{elmer} as @file{airs}; this will show how a machine can have one +name on an internal network but a different name to the external world. +@file{elmer} has two modems. It also has an TCP/IP connection to +@file{uupsi}, but since that is supposed to be reserved for interactive +work (it is, perhaps, only a 9600 baud SLIP line) it will only use it if +the modems are not available. + +A network this small would normally use a single @file{sys} file. +However, for pedagogical purposes I will show two separate @file{sys} +files, one for the local systems and one for @file{uupsi}. This is done +with the @code{sysfile} command in the @file{config} file. Here is the +@file{config} file. + +@example +# This is config +# The local sys file +sysfile /usr/local/lib/uucp/sys.local +# The remote sys file +sysfile /usr/local/lib/uucp/sys.remote +@end example + +Using the defaults feature of the @file{sys} file can greatly simplify +the listing of local systems. Here is @file{sys.local}. Note that this +assumes that the local systems are trusted; they are permited to request +any world readable file and to write files into any world writable +directory. + +@example +# This is sys.local +# Get the login name and password to use from the call-out file +call-login * +call-password * + +# The systems must use a particular login +called-login Ulocal + +# Permit sending any world readable file +local-send / +remote-send / + +# Permit requesting into any world writable directory +local-receive / +remote-receive / + +# Call at any time +time any + +# Use port1, then port2 +port port1 + +alternate + +port port2 + +# Now define the systems themselves. Because of all the defaults we +# used, there is very little to specify for the systems themselves. + +system comton +phone 5551212 + +system bugs +phone 5552424 +@end example + +The @file{sys.remote} file describes the @file{uupsi} connection. The +@code{myname} command is used to change the UUCP name to @file{airs} +when talking to @file{uupsi}. + +@example +# This is sys.remote +# Define uupsi +system uupsi + +# The login name and password are in the call-out file +call-login * +call-password * + +# We can call out at any time +time any + +# uupsi uses a special login name +called-login Uuupsi + +# uuspi thinks of us as `airs' +myname airs + +# The phone number +phone 5554848 + +# We use port2 first, then port1, then TCP + +port port2 + +alternate + +port port1 + +alternate + +# We don't bother to make a special entry in the port file for TCP, we +# just describe the entire port right here. We use a special chat +# script over TCP because the usual one confuses some TCP servers. +port type TCP +address uu.psi.com +chat ogin: \L word: \P +@end example + +The ports are defined in the file @file{port} (@pxref{port File}). For +this example they are both connected to the same type of 2400 baud +Hayes-compatible modem. + +@example +# This is port + +port port1 +type modem +device /dev/ttyd0 +dialer hayes +speed 2400 + +port port2 +type modem +device /dev/ttyd1 +dialer hayes +speed 2400 +@end example + +Dialers are described in the @file{dial} file (@pxref{dial File}). + +@example +# This is dial + +dialer hayes + +# The chat script used to dial the phone. \D is the phone number. +chat "" ATZ\r\d\c OK ATDT\D CONNECT + +# If we get BUSY or NO CARRIER we abort the dial immediately +chat-fail BUSY +chat-fail NO\sCARRIER + +# When the call is over we make sure we hangup the modem. +complete \d\d+++\d\dATH\r\c +abort \d\d+++\d\dATH\r\c +@end example + +@node Time Strings, Chat Scripts, Configuration Examples, Configuration Files +@section Time Strings +@cindex time strings + +Several commands use time strings to specify a range of times. This +section describes how to write time strings. + +A time string may be a list of simple time strings separated with a +vertical bar @kbd{|} or a comma @kbd{,}. + +Each simple time string must begin with @samp{Su}, @samp{Mo}, @samp{Tu}, +@samp{We}, @samp{Th}, @samp{Fr}, or @samp{Sa}, or @samp{Wk} for any +weekday, or @samp{Any} for any day. + +Following the day may be a range of hours separated with a hyphen using +24 hour time. The range of hours may cross 0; for example +@samp{2300-0700} means any time except 7 AM to 11 PM. If no time is +given, calls may be made at any time on the specified day(s). + +The time string may also consist of the single word @samp{Never}, which +does not match any time, or a single word with a name defined in a +previous @code{timetable} command (@pxref{Miscellaneous (config)}). + +Here are a few sample time strings with an explanation of what they +mean. + +@table @samp + +@item Wk2305-0855,Sa,Su2305-1655 + +This means weekdays before 8:55 AM or after 11:05 PM, any time Saturday, +or Sunday before 4:55 PM or after 11:05 PM. These are approximately the +times during which night rates apply to phone calls in the U.S.A. Note +that this time string uses, for example, @samp{2305} rather than +@samp{2300}; this will ensure a cheap rate phone call even if the +computer clock is running up to five minutes ahead of the real time. + +@item Wk0905-2255,Su1705-2255 + +This means weekdays from 9:05 AM to 10:55 PM, or Sunday from 5:05 PM to +10:55 PM. This is approximately the opposite of the previous example. + +@item Any + +This means any day. Since no time is specified, it means any time on +any day. + +@end table + +@node Chat Scripts, config File, Time Strings, Configuration Files +@section Chat Scripts +@cindex chat scripts + +Chat scripts are used in several different places, such as dialing out +on modems or logging in to remote systems. Chat scripts are made up of +pairs of strings. The program waits until it sees the first string, +known as the @dfn{expect} string, and then sends out the second string, +the @dfn{send} string. + +Each chat script is defined using a set of commands. These commands +always end in a string beginning with @code{chat}, but may start with +different strings. For example, in the @file{sys} file there is one set +of commands beginning with @code{chat} and another set beginning with +@code{called-chat}. The prefixes are only used to disambiguate +different types of chat scripts, and this section ignores the prefixes +when describing the commands. + +@table @code + +@item chat @var{strings} +@findex chat + +Specify a chat script. The arguments to the @code{chat} command are +pairs of strings separated by whitespace. The first string of each pair +is an expect string, the second is a send string. The program will wait +for the expect string to appear; when it does, the program will send the +send string. If the expect string does not appear within a certain +number of seconds (as set by the @code{chat-timeout} command) the chat +script fails and, typically, the call is aborted. If the final expect +string is seen (and the optional final send string has been sent), the +chat script is successful. + +An expect string may contain additional subsend and subexpect strings, +separated by hyphens. If the expect string is not seen, the subsend +string is sent and the chat script continues by waiting for the +subexpect string. This means that a hyphen may not appear in an expect +string; on an ASCII system, use @samp{\055} instead. + +An expect string may simply be @samp{""}, meaning to skip the expect +phase. Otherwise, the following escape characters may appear in expect +strings: + +@table @samp +@item \b +a backspace character +@item \n +a newline or line feed character +@item \N +a null character (for HDB compatibility) +@item \r +a carriage return character +@item \s +a space character +@item \t +a tab character +@item \\ +a backslash character +@item \@var{ddd} +character @var{ddd}, where @var{ddd} are up to three octal digits +@item \x@var{ddd} +character @var{ddd}, where @var{ddd} are hexadecimal digits. +@end table + +As in C, there may be up to three octal digits following a backslash, +but the hexadecimal escape sequence continues as far as possible. To +follow a hexadecimal escape sequence with a hex digit, interpose a send +string of @samp{""}. + +A chat script expect string may also specify a timeout. This is done by +using the escape sequence @samp{\W@var{seconds}}. This escape sequence +may only appear at the very end of the expect string. It temporarily +overrides the timeout set by @code{chat-timeout} (described below) only +for the expect string to which it is attached. + +A send string may simply be @samp{""} to skip the send phase. +Otherwise, all of the escape characters legal for expect strings may be +used, and the following escape characters are also permitted: + +@table @samp +@item EOT +send an end of transmission character (@kbd{^D}) +@item BREAK +send a break character (may not work on all systems) +@item \c +suppress trailing carriage return at end of send string +@item \d +delay sending for 1 or 2 seconds +@item \e +disable echo checking +@item \E +enable echo checking +@item \K +same as @samp{BREAK} (for HDB compatibility) +@item \p +pause sending for a fraction of a second +@end table + +Some specific types of chat scripts also define additional escape +sequences that may appear in the send string. For example, the login +chat script defines @samp{\L} and @samp{\P} to send the login name and +password, respectively. + +A carriage return will be sent at the end of each send string, unless +the @kbd{\c} escape sequence appears in the string. Note that some UUCP +packages use @kbd{\b} for break, but here it means backspace. + +Echo checking means that after writing each character the program will +wait until the character is echoed. Echo checking must be turned on +separately for each send string for which it is desired; it will be +turned on for characters following @kbd{\E} and turned off for characters +following @kbd{\e}. + +@item chat-timeout @var{number} +@findex chat-timeout + +The number of seconds to wait for an expect string in the chat script +before timing out and sending the next subsend or failing the chat +script entirely. The default value is 10 for a login chat or 60 for +any other type of chat. + +@item chat-fail @var{string} +@findex chat-fail + +If the @var{string} is seen at any time during a chat script, the chat +script is aborted. The string may not contain any whitespace +characters; escape sequences must be used for them. Multiple +@code{chat-fail} commands may appear in a single chat script. The +default is to have none. + +This permits a chat script to be quickly aborted if an error string is +seen. For example, a script used to dial out on a modem might use the +command @samp{chat-fail BUSY} to stop the chat script immediately if the +string @samp{BUSY} was seen. + +The @code{chat-fail} strings are considered in the order they are +listed, so if one string is a suffix of another the longer one should be +listed first. Of course, if one string is contained within another, the +smaller string will always be found before the larger string could +match. + +@item chat-seven-bit @var{boolean} +@findex chat-seven-bit + +If the argument is true, all incoming characters are stripped to seven +bits when being compared to the expect string. Otherwise all eight bits +are used in the comparison. The default is true, because some Unix +systems generate parity bits during the login prompt which must be +ignored while running a chat script. This has no effect on any +@code{chat-program}, which must ignore parity by itself if necessary. + +@item chat-program @var{strings} +@findex chat-program + +Specify a program to run before executing the chat script. This program +could run its own version of a chat script, or it could do whatever it +wants. If both @code{chat-program} and @code{chat} are specified, the +program is executed first followed by the chat script. + +The first argument to the @code{chat-program} command is the program +name to run. The remaining arguments are passed to the program. The +following escape sequences are recognized in the arguments: + +@table @kbd +@item \Y +port device name +@item \S +port speed +@item \\ +backslash +@end table + +Some specific uses of @code{chat-program} define additional escape +sequences. + +Arguments other than escape sequences are passed exactly as they appear +in the configuration file, except that sequences of whitespace are +compressed to a single space character (this exception may be removed in +the future). + +If the @code{chat-program} command is not used, no program is run. + +On Unix, the standard input and standard output of the program will be +attached to the port in use. Anything the program writes to standard +error will be written to the UUCP log file. No other file descriptors +will be open. If the program does not exit with a status of 0, it will +be assumed to have failed. This means that the dialing programs used by +some versions of HDB may not be used directly, but you may be able to +run them via the @code{dialHDB} program in the @file{contrib} directory. + +The program will be run as the @code{uucp} user, and the environment +will be that of the process that started @code{uucico}, so care must be +taken to maintain security. + +No search path is used to find the program; a full path name must be +given. If the program is an executable shell script, it will be passed +to @file{/bin/sh} even on systems which are unable to execute shell +scripts. + +@end table + +Here is a simple example of a chat script that might be used to reset a +Hayes compatible modem. + +@example +chat "" ATZ OK-ATZ-OK +@end example + +The first expect string is @samp{""}, so it is ignored. The chat script +then sends @samp{ATZ}. If the modem responds with @samp{OK}, the chat +script finishes. If 60 seconds (the default timeout) pass before seeing +@samp{OK}, the chat script sends another @samp{ATZ}. If it then sees +@samp{OK}, the chat script succeeds. Otherwise, the chat script fails. + +For a more complex chat script example, see @ref{Logging In}. + +@node config File, sys File, Chat Scripts, Configuration Files +@section The Main Configuration File +@cindex config file +@cindex main configuration file +@cindex configuration file (config) + +The main configuration file is named @file{config}. + +Since all the values that may be specified in the main configuration +file also have defaults, there need not be a main configuration file at +all. + +Each command in @file{config} may have a program prefix, which is a +separate word appearing at the beginning of the line. The currently +supported prefixes are @samp{uucp} and @samp{cu}. Any command prefixed +by @samp{uucp} will not be read by the @code{cu} program. Any command +prefixed by @samp{cu} will only be read by the @code{cu} program. For +example, to use a list of systems known only to @code{cu}, list them in +a separate file @file{@var{file}} and put @samp{cu sysfile +@file{@var{file}}} in @file{config}. + +@menu +* Miscellaneous (config):: Miscellaneous config file commands +* Configuration File Names:: Using different configuration files +* Log File Names:: Using different log files +* Debugging Levels:: Debugging levels +@end menu + +@node Miscellaneous (config), Configuration File Names, config File, config File +@subsection Miscellaneous config File Commands + +@table @code + +@item nodename @var{string} +@findex nodename +@itemx hostname @var{string} +@findex hostname +@itemx uuname @var{string} +@findex uuname +@cindex UUCP system name +@cindex system name + +These keywords are equivalent. They specify the UUCP name of the local +host. If there is no configuration file, an appropriate system function +will be used to get the host name, if possible. + +@item spool @var{string} +@findex spool +@cindex spool directory +@cindex /usr/spool/uucp + +Specify the spool directory. The default is from @file{policy.h}. This +is where UUCP files are queued. Status files and various sorts of +temporary files are also stored in this directory and subdirectories of +it. + +@item pubdir @var{string} +@findex pubdir in config file +@cindex public directory +@cindex uucppublic +@cindex /usr/spool/uucppublic + +Specify the public directory. The default is from @file{policy.h}. +When a file is named using a leading @kbd{~/}, it is taken from or to +the public directory. Each system may use a separate public directory +by using the @code{pubdir} command in the system configuration file; see +@ref{Miscellaneous (sys)}. + +@item lockdir @var{string} +@findex lockdir +@cindex lock directory + +Specify the directory to place lock files in. The default is from +@file{policy.h}; see the information in that file. Normally the lock +directory should be set correctly in @file{policy.h}, and not changed +here. However, changing the lock directory is sometimes useful for +testing purposes. + +@item unknown @var{string} @dots{} +@findex unknown +@cindex unknown systems + +The @var{string} and subsequent arguments are treated as though they +appeared in the system file (@pxref{sys File}). They are used to apply +to any unknown systems that may call in, probably to set file transfer +permissions and the like. If the @code{unknown} command is not used, +unknown systems are not permitted to call in. + +@item max-uuxqts @var{number} +@findex max-uuxqts + +Specify the maximum number of @code{uuxqt} processes which may run at +the same time. Having several @code{uuxqt} processes running at once +can significantly slow down a system, but since @code{uuxqt} is +automatically started by @code{uucico}, it can happen quite easily. The +default for @code{max-uuxqts} is 0, which means that there is no limit. +If HDB configuration files are being read and the code was compiled +without @code{HAVE_TAYLOR_CONFIG}, then if the file @file{Maxuuxqts} in +the configuration directory contains a readable number it will be used as +the value for @code{max-uuxqts}. + +@item run-uuxqt @var{string} or @var{number} +@findex run-uuxqt + +Specify when @code{uuxqt} should be run by @code{uucico}. This may be a +positive number, in which case @code{uucico} will start a @code{uuxqt} +process whenever it receives the given number of execution files from +the remote system, and, if necessary, at the end of the call. The +argument may also be one of the strings @samp{once}, @samp{percall}, or +@samp{never}. The string @samp{once} means that @code{uucico} will +start @code{uuxqt} once at the end of execution. The string +@samp{percall} means that @code{uucico} will start @code{uuxqt} once per +call that it makes (this is only different from @code{once} when +@code{uucico} is invoked in a way that causes it to make multiple calls, +such as when the @samp{-r1} argument is used without the @samp{-s} +argument). The string @samp{never} means that @code{uucico} will never +start @code{uuxqt}, in which case @code{uuxqt} should be periodically +run via some other mechanism. The default depends upon which type of +configuration files are being used; if @code{HAVE_TAYLOR_CONFIG} is used +the default is @samp{once}, otherwise if @code{HAVE_HDB_CONFIG} is used +the default is @samp{percall}, and otherwise, for @code{HAVE_V2_CONFIG}, +the default is @samp{10}. + +@item timetable @var{string} @var{string} +@findex timetable + +The @code{timetable} defines a timetable that may be used in +subsequently appearing time strings; @ref{Time Strings}. The first +string names the timetable entry; the second is a time string. + +The following @code{timetable} commands are predefined. The NonPeak +timetable is included for compatibility. It originally described the +offpeak hours of Tymnet and Telenet, but both have since changed their +schedules. + +@example +timetable Evening Wk1705-0755,Sa,Su +timetable Night Wk2305-0755,Sa,Su2305-1655 +timetable NonPeak Wk1805-0655,Sa,Su +@end example + +If this command does not appear, then obviously no additional timetables +will be defined. + +@item v2-files @var{boolean} +@findex v2-files + +If the code was compiled to be able to read V2 configuration files, a +false argument to this command will prevent them from being read. +This can be useful while testing. The default is true. + +@item hdb-files @var{boolean} +@findex hdb-files + +If the code was compiled to be able to read HDB configuration files, a +false argument to this command will prevent them from being read. +This can be useful while testing. The default is true. + +@end table + +@node Configuration File Names, Log File Names, Miscellaneous (config), config File +@subsection Configuration File Names + +@table @code + +@item sysfile @var{strings} +@findex sysfile + +Specify the system file(s). The default is the file @file{sys} in the +directory @var{newconfigdir}. These files hold information about other +systems with which this system communicates; see @ref{sys File}. +Multiple system files may be given on the line, and the @code{sysfile} +command may be repeated; each system file has its own set of defaults. + +@item portfile @var{strings} +@findex portfile + +Specify the port file(s). The default is the file @file{port} in the +directory @var{newconfigdir}. These files describe ports which are used +to call other systems and accept calls from other systems; see @ref{port +File}. No port files need be named at all. Multiple port files may be +given on the line, and the @code{portfile} command may be repeated. + +@item dialfile @var{strings} +@findex dialfile + +Specify the dial file(s). The default is the file @file{dial} in the +directory @var{newconfigdir}. These files describe dialing devices +(modems); @xref{dial File}. No dial files need be named at all. +Multiple dial files may be given on the line, and the @code{dialfile} +command may be repeated. + +@item dialcodefile @var{strings} +@findex dialcodefile +@cindex configuration file (dialcode) +@cindex dialcode file +@cindex dialcode configuration file + +Specify the dialcode file(s). The default is the file @file{dialcode} +in the directory @var{newconfigdir}. These files specify dialcodes that +may be used when sending phone numbers to a modem. This permits using +the same set of phone numbers in different area-codes or with different +phone systems, by using dialcodes to specify the calling sequence. When +a phone number goes through dialcode translation, the leading alphabetic +characters are stripped off. The dialcode files are read line by line, +just like any other configuration file, and when a line is found whose +first word is the same as the leading characters from the phone number, +the second word on the line (which would normally consist of numbers) +replaces the dialcode in the phone number. No dialcode file need be +used. Multiple dialcode files may be specified on the line, and the +@code{dialcodefile} command may be repeated; all the dialcode files will +be read in turn until a dialcode is located. + +@item callfile @var{strings} +@findex callfile +@cindex call out file +@cindex call configuration file +@cindex call out login name +@cindex call out password +@cindex configuration file (call) + +Specify the call out login name and password file(s). The default is +the file @file{call} in the directory @var{newconfigdir}. If the call +out login name or password for a system are given as @kbd{*} +(@pxref{Logging In}), these files are read to get the real login name or +password. Each line in the file(s) has three words: the system name, +the login name, and the password. The login name and password may +contain escape sequences like those in a chat script expect string +(@pxref{Chat Scripts}). This file is only used when placing calls to +remote systems; the password file described under @code{passwdfile} +below is used for incoming calls. The intention of the call out file is +to permit the system file to be publically readable; the call out files +must obviously be kept secure. These files need not be used. Multiple +call out files may be specified on the line, and the @code{callfile} +command may be repeated; all the files will be read in turn until the +system is found. + +@item passwdfile @var{strings} +@findex passwdfile +@cindex passwd file +@cindex passwd configuration file +@cindex configuration file (passwd) +@cindex call in login name +@cindex call in password + +Specify the password file(s) to use for login names when @code{uucico} +is doing its own login prompting, which it does when given the +@samp{-e}, @samp{-l} or @samp{-w} switches. The default is the file +@file{passwd} in the directory @var{newconfigdir}. Each line in the +file(s) has two words: the login name and the password (e.g. @code{Ufoo +foopas}). They may contain escape sequences like those in a chat script +expect string (@pxref{Chat Scripts}). The login name is accepted before +the system name is known, so these are independent of which system is +calling in; a particular login may be required for a system by using the +@code{called-login} command in the system file (@pxref{Accepting a +Call}). These password files are optional, although one must exist if +@code{uucico} is to present its own login prompts. + +As a special exception, a colon may be used to separate the login name +from the password, and a colon may be used to terminate the password. +This means that the login name and password may not contain a colon. +This feature, in conjunction with the @code{HAVE_ENCRYPTED_PASSWORDS} +macro in @file{policy.h}, permits using a standard Unix +@file{/etc/passwd} as a UUCP password file, providing the same set of +login names and passwords for both @code{getty} and @code{uucico}. + +Multiple password files may be specified on the line, and the +@code{passwdfile} command may be repeated; all the files will be read in +turn until the login name is found. + +@end table + +@node Log File Names, Debugging Levels, Configuration File Names, config File +@subsection Log File Names + +@table @code + +@item logfile @var{string} +@findex logfile +@cindex log file + +Name the log file. The default is from @file{policy.h}. Logging +information is written to this file. If @code{HAVE_HDB_LOGGING} is +defined in @file{policy.h}, then by default a separate log file is used +for each system. Using this command to name a log file will cause all +the systems to use it. + +@item statfile @var{string} +@findex statfile +@cindex statistics file + +Name the statistics file. The default is from @file{policy.h}. +Statistical information about file transfers is written to this file. + +@item debugfile @var{string} +@findex debugfile +@cindex debugging file + +Name the file to which all debugging information is written. The +default is from @file{policy.h}. This command is only effective if the +code has been compiled to include debugging (this is controlled by the +@code{DEBUG} macro in @file{policy.h}). If debugging is on, messages +written to the log file are also written to the debugging file to make +it easier to keep the order of actions straight. The debugging file is +different from the log file because information such as passwords can +appear in it, so it must be not be publically readable. + +@end table + +@node Debugging Levels, , Log File Names, config File +@subsection Debugging Levels + +@table @code + +@item debug @var{string} @dots{} +@findex debug in config file + +Set the debugging level. This command is only effective if the code has +been compiled to include debugging. The default is to have no +debugging. The arguments are strings which name the types of debugging +to be turned on. The following types of debugging are defined: + +@table @samp +@item abnormal +Output debugging messages for abnormal situations, such as recoverable errors. +@item chat +Output debugging messages for chat scripts. +@item handshake +Output debugging messages for the initial handshake. +@item uucp-proto +Output debugging messages for the UUCP session protocol. +@item proto +Output debugging messages for the individual link protocols. +@item port +Output debugging messages for actions on the communication port. +@item config +Output debugging messages while reading the configuration files. +@item spooldir +Output debugging messages for actions in the spool directory. +@item execute +Output debugging messages whenever another program is executed. +@item incoming +List all incoming data in the debugging file. +@item outgoing +List all outgoing data in the debugging file. +@item all +All of the above. +@end table + +The debugging level may also be specified as a number. A 1 will set +@samp{chat} debugging, a 2 will set both @samp{chat} and +@samp{handshake} debugging, and so on down the possibilities. Currently +an 11 will turn on all possible debugging, since there are 11 types of +debugging messages listed above; more debugging types may be added in +the future. The @code{debug} command may be used several times in the +configuration file; every debugging type named will be turned on. When +running any of the programs, the @samp{-x} switch (actually, for +@code{uulog} it's the @samp{-X} switch) may be used to turn on +debugging. The argument to the @samp{-x} switch is one of the strings +listed above, or a number as described above, or a comma separated list +of strings (e.g. @samp{-x chat,handshake}). The @samp{-x} switch may +also appear several times on the command line, in which case all named +debugging types will be turned on. The @samp{-x} debugging is in +addition to any debugging specified by the @code{debug} command; there +is no way to cancel debugging information. The debugging level may also +be set specifically for calls to or from a specific system with the +@code{debug} command in the system file (@pxref{Miscellaneous (sys)}). + +The debugging messages are somewhat idiosyncratic; it may be necessary +to refer to the source code for additional information in some cases. + +@end table + +@node sys File, port File, config File, Configuration Files +@section The System Configuration File +@cindex sys file +@cindex system configuration file +@cindex configuration file (sys) + +By default there is a single system configuration, named @file{sys} in +the directory @var{newconfigdir}. This may be overridden by the +@code{sysfile} command in the main configuration file; see +@ref{Configuration File Names}. + +These files describe all remote systems known to the UUCP package. + +@menu +* Defaults and Alternates:: Using defaults and alternates +* Naming the System:: Naming the system +* Calling Out:: Calling out +* Accepting a Call:: Accepting a call +* Protocol Selection:: Protocol selection +* File Transfer Control:: File transfer control +* Miscellaneous (sys):: Miscellaneous sys file commands +* Default sys File Values:: Default values +@end menu + +@node Defaults and Alternates, Naming the System, sys File, sys File +@subsection Defaults and Alternates + +The first set of commands in the file, up to the first @code{system} +command, specify defaults to be used for all systems in that file. Each +@file{sys} file uses a different set of defaults. + +Subsequently, each set of commands from @code{system} up to the next +@code{system} command describe a particular system. Default values may +be overridden for specific systems. + +Each system may then have a series of alternate choices to use when +calling out or calling in. The first set of commands for a particular +system, up to the first @code{alternate} command, provide the first +choice. Subsequently, each set of commands from @code{alternate} up to +the next @code{alternate} command describe an alternate choice for +calling out or calling in. + +When a system is called, the commands before the first @code{alternate} +are used to select a phone number, port, and so forth; if the call fails +for some reason, the commands between the first @code{alternate} and the +second are used, and so forth. Well, not quite. Actually, each +succeeding alternate will only be used if it is different in some +relevant way (different phone number, different chat script, etc.). If +you want to force the same alternate to be used again (to retry a phone +call more than once, for example), enter the phone number (or any other +relevant field) again to make it appear different. + +The alternates can also be used to give different permissions to an +incoming call based on the login name. This will only be done if the +first set of commands, before the first @code{alternate} command, uses +the @code{called-login} command. The list of alternates will be +searched, and the first alternate with a matching @code{called-login} +command will be used. If no alternates match, the call will be +rejected. + +The @code{alternate} command may also be used in the file-wide defaults +(the set of commands before the first @code{system} command). This +might be used to specify a list of ports which are available for all +systems (for an example of this, see @ref{Gateway Example}) or to +specify permissions based on the login name used by the remote system +when it calls in. The first alternate for each system will default to +the first alternate for the file-wide defaults (as modified by the +commands used before the first @code{alternate} command for this +system), the second alternate for each system to the second alternate +for the file-wide defaults (as modified the same way), and so forth. If +a system specifies more alternates than the file-wide defaults, the +trailing ones will default to the last file-wide default alternate. If +a system specifies fewer alternates than the file-wide defaults, the +trailing file-wide default alternates will be used unmodified. The +@code{default-alternates} command may be used to modify this behaviour. + +This can all get rather confusing, although it's easier to use than to +describe concisely; the @code{uuchk} program may be used to ensure that +you are getting what you want. + +@node Naming the System, Calling Out, Defaults and Alternates, sys File +@subsection Naming the System + +@table @code + +@item system @var{string} +@findex system + +Specify the remote system name. Subsequent commands up to the next +@code{system} command refer to this system. + +@item alternate [@var{string}] +@findex alternate + +Start an alternate set of commands (@pxref{Defaults and Alternates}). +An optional argument may be used to name the alternate. This name will +be put in the log file if the alternate is used to call the system. +There is no way to name the first alternate (the commands before the +first @code{alternate} command). + +@item default-alternates @var{boolean} +@findex default-alternates + +If the argument is false, any remaining default alternates (from the +defaults specified at the top of the current system file) will not be +used. The default is true. + +@item alias @var{string} +@findex alias + +Specify an alias for the current system. The alias may be used by local +@code{uucp} and @code{uux} commands, as well as by the remote system +(which can be convenient if a remote system changes its name). The +default is to have no aliases. + +@item myname @var{string} +@findex myname + +Specifies a different system name to use when calling the remote system. +Also, if @code{called-login} is used and is not @samp{ANY}, then, when a +system logs in with that login name, @var{string} is used as the local +system name. Because the local system name must be determined before +the remote system has identified itself, using @code{myname} and +@code{called-login} together for any system will set the local name for +that login; this means that each locally used system name must have a +unique login name associated with it. This allows a system to have +different names for an external and an internal network. The default is +to not use a special local name. + +@end table + +@node Calling Out, Accepting a Call, Naming the System, sys File +@subsection Calling Out + +This section describes commands used when placing a call to another +system. + +@menu +* When to Call:: When to call +* Placing the Call:: Placing the call +* Logging In:: Logging in +@end menu + +@node When to Call, Placing the Call, Calling Out, Calling Out +@subsubsection When to Call + +@table @code + +@item time @var{string} [@var{number}] +@findex time + +Specify when the system may be called. The first argument is a time +string; see @ref{Time Strings}. The optional second argument specifies +a retry time in minutes. If a call made during a time that matches the +time string fails, no more calls are permitted until the retry time has +passed. By default an exponentially increasing retry time is used: +after each failure the next retry period is longer. A retry time +specified in the @code{time} command is always a fixed amount of time. + +The @code{time} command may appear multiple times in a single alternate, +in which case if any time string matches the system may be called. When +the @code{time} command is used for a particular system, any @code{time} +or @code{timegrade} commands that appeared in the system defaults are +ignored. + +The default time string is @samp{Never}. + +@item timegrade @var{character} @var{string} [@var{number}] +@findex timegrade + +The @var{character} specifies a grade. It must be a single letter or +digit. The @var{string} is a time string (@pxref{Time Strings}). All +jobs of grade @var{character} or higher (where @kbd{0} > @kbd{9} > +@kbd{A} > @kbd{Z} > @kbd{a} > @kbd{z}) may be run at the specified time. +An ordinary @code{time} command is equivalent to using @code{timegrade} +with a grade of @kbd{z}, permitting all jobs. If there are no jobs of a +sufficiently high grade according to the time string, the system will +not be called. Giving the @samp{-s} switch to @code{uucico} to force it +to call a system causes it to assume there is a job of grade @kbd{0} +waiting to be run. + +The optional third argument specifies a retry time in minutes. See the +@code{time} command, above, for more details. + +Note that the @code{timegrade} command serves two purposes: 1) if there +is no job of sufficiently high grade the system will not be called, and +2) if the system is called anyway (because the @samp{-s} switch was +given to @code{uucico}) only jobs of sufficiently high grade will be +transferred. However, if the other system calls in, the +@code{timegrade} commands are ignored, and jobs of any grade may be +transferred (but see @code{call-timegrade} below). Also, the +@code{timegrade} command will not prevent the other system from +transferring any job it chooses, regardless of who placed the call. + +The @code{timegrade} command may appear multiple times without using +@code{alternate}. When the @code{timegrade} command is used for a +particular system, any @code{time} or @code{timegrade} commands that +appeared in the system defaults are ignored. + +If this command does not appear, there are no restrictions on what grade +of work may be done at what time. + +@item max-retries @var{number} +@findex max-retries + +Gives the maximum number of times this system may be retried. If this +many calls to the system fail, it will be called at most once a day +whatever the retry time is. The default is 26. + +@item success-wait @var{number} + +A retry time, in seconds, which applies after a successful call. This +can be used to put a limit on how frequently the system is called. For +example, an argument of 1800 means that the system will not be called +more than once every half hour. The default is 0, which means that +there is no limit. + +@item call-timegrade @var{character} @var{string} +@findex call-timegrade + +The @var{character} is a single character @kbd{A} to @kbd{Z}, @kbd{a} to +@kbd{z}, or @kbd{0} to @kbd{9} and specifies a grade. The @var{string} +is a time string as described under the @code{time} command. If a call +is placed to the other system during a time which matches the time +string, the remote system will be requested to only run jobs of grade +@var{character} or higher. Unfortunately, there is no way to guarantee +that the other system will obey the request (this UUCP package will, but +there are others which will not); moreover job grades are historically +somewhat arbitrary, so specifying a grade will only be meaningful if the +other system cooperates in assigning grades. This grade restriction +only applies when the other system is called, not when the other system +calls in. + +The @code{call-timegrade} command may appear multiple times without +using @code{alternate}. If this command does not appear, or if none of +the time strings match, the remote system will be allowed to send +whatever grades of work it chooses. + +@end table + +@node Placing the Call, Logging In, When to Call, Calling Out +@subsubsection Placing the Call + +@table @code + +@itemx speed @var{number} +@findex speed in sys file +@item baud @var{number} +@findex baud in sys file + +Specify the speed (the term @dfn{baud} is technically incorrect, but +widely understood) at which to call the system. This will try all +available ports with that speed until an unlocked port is found. The +ports are defined in the port file. If both @code{speed} and +@code{port} commands appear, both are used when selecting a port. To +allow calls at more than one speed, the @code{alternate} command must be +used (@pxref{Defaults and Alternates}). If this command does not +appear, there is no default; the speed may be specified in the port +file, but if it is not then the natural speed of the port will be used +(whatever that means on the system). Specifying an explicit speed of 0 +will request the natural speed of the port (whatever the system sets it +to), overriding any default speed from the defaults at the top of the +file. + +@item port @var{string} +@findex port in sys file + +Name a particular port or type of port to use when calling the system. +The information for this port is obtained from the port file. If this +command does not appear, there is no default; a port must somehow be +specified in order to call out (it may be specified implicitly using the +@code{speed} command or explicitly using the next version of +@code{port}). There may be many ports with the same name; each will be +tried in turn until an unlocked one is found which matches the desired +speed. + +@item port @var{string} @dots{} + +If more than one string follows the @code{port} command, the strings are +treated as a command that might appear in the port file (@pxref{port +File}). If a port is named (by using a single string following +@code{port}) these commands are ignored; their purpose is to permit +defining the port completely in the system file rather than always +requiring entries in two different files. In order to call out, a port +must be specified using some version of the @code{port} command, or by +using the @code{speed} command to select ports from the port file. + +@item phone @var{string} +@findex phone +@itemx address @var{string} +@findex address + +Give a phone number to call (when using a modem port) or a remote host +to contact (when using a TCP or TLI port). The commands @code{phone} +and @code{address} are equivalent; the duplication is intended to +provide a mnemonic choice depending on the type of port in use. + +When used with a modem port, an @kbd{=} character in the phone number +means to wait for a secondary dial tone (although only some modems +support this); a @kbd{-} character means to pause while dialing for 1 +second (again, only some modems support this). If the system has more +than one phone number, each one must appear in a different alternate. +The @code{phone} command must appear in order to call out on a modem; +there is no default. + +When used with a TCP port, the string names the host to contact. It may +be a domain name or a numeric Internet address. If no address is +specified, the system name is used. + +When used with a TLI port, the string is treated as though it were an +expect string in a chat script, allowing the use of escape characters +(@pxref{Chat Scripts}). The @code{dialer-sequence} command in the port +file may override this address (@pxref{port File}). + +When used with a port that not a modem or TCP or TLI, this command is +ignored. + +@end table + +@node Logging In, , Placing the Call, Calling Out +@subsubsection Logging In +@table @code + +@item chat @var{strings} +@findex chat in sys file +@item chat-timeout @var{number} +@findex chat-timeout in sys file +@item chat-fail @var{string} +@findex chat-fail in sys file +@item chat-seven-bit @var{boolean} +@findex chat-seven-bit in sys file +@item chat-program @var{strings} +@findex chat-program in sys file + +These commands describe a chat script to use when logging on to a remote +system. Chat scripts are explained in @ref{Chat Scripts}. + +Two additional escape sequences may be used in send strings. + +@table @samp +@item \L +Send the login name, as set by the @code{call-login} command. +@item \P +Send the password, as set by the @code{call-password} command. +@end table + +Three additional escape sequences may be used with the +@code{chat-program} command. These are @samp{\L} and @samp{\P}, which +become the login name and password, respectively, and @samp{\Z}, which +becomes the name of the system of being called. + +The default chat script is: + +@example +chat "" \r\c ogin:-BREAK-ogin:-BREAK-ogin: \L word: \P +@end example + +This will send a carriage return (the @kbd{\c} suppresses the additional +trailing carriage return that would otherwise be sent) and waits for the +string @samp{ogin:} (which would be the last part of the @samp{login:} +prompt supplied by a Unix system). If it doesn't see @samp{ogin:}, it +sends a break and waits for @samp{ogin:} again. If it still doesn't see +@samp{ogin:}, it sends another break and waits for @samp{ogin:} again. +If it still doesn't see @samp{ogin:}, the chat script aborts and hangs +up the phone. If it does see @samp{ogin:} at some point, it sends the +login name (as specified by the @code{call-login} command) followed by a +carriage return (since all send strings are followed by a carriage +return unless @kbd{\c} is used) and waits for the string @samp{word:} +(which would be the last part of the @samp{Password:} prompt supplied by +a Unix system). If it sees @samp{word:}, it sends the password and a +carriage return, completing the chat script. The program will then +enter the handshake phase of the UUCP protocol. + +This chat script will work for most systems, so you will only be +required to use the @code{call-login} and @code{call-password} commands. +In fact, in the file-wide defaults you could set defaults of +@samp{call-login *} and @samp{call-password *}; you would then just have +to make an entry for each system in the call-out login file. + +Some systems seem to flush input after the @samp{login:} prompt, so they +may need a version of this chat script with a @kbd{\d} before the +@kbd{\L}. When using UUCP over TCP, some servers will not be handle the +initial carriage return sent by this chat script; in this case you may +have to specify the simple chat script @samp{ogin: \L word: \P}. + +@item call-login @var{string} +@findex call-login + +Specify the login name to send with @kbd{\L} in the chat script. If the +string is @samp{*} (e.g. @samp{call-login *}) the login name will be +fetched from the call out login name and password file +(@pxref{Configuration File Names}). The string may contain escape +sequences as though it were an expect string in a chat script +(@pxref{Chat Scripts}). There is no default. + +@item call-password @var{string} +@findex call-password + +Specify the password to send with @kbd{\P} in the chat script. If the +string is @samp{*} (e.g. @samp{call-password *}) the password will be +fetched from the call-out login name and password file +(@pxref{Configuration File Names}). The string may contain escape +sequences as though it were an expect string in a chat script +(@pxref{Chat Scripts}). There is no default. + +@end table + +@node Accepting a Call, Protocol Selection, Calling Out, sys File +@subsection Accepting a Call + +@table @code + +@item called-login @var{strings} +@findex called-login + +The first @var{string} specifies the login name that the system must use +when calling in. If it is @samp{ANY} (e.g. @samp{called-login ANY}) any +login name may be used; this is useful to override a file-wide default +and to indicate that future alternates may have different login names. +Case is significant. The default value is @samp{ANY}. + +Different alternates (@pxref{Defaults and Alternates}) may use different +@code{called-login} commands, in which case the login name will be used +to select which alternate is in effect; this will only work if the first +alternate (before the first @code{alternate} command) uses the +@code{called-login} command. + +Additional strings may be specified after the login name; they are a +list of which systems are permitted to use this login name. If this +feature is used, then normally the login name will only be given in a +single @code{called-login} command. Only systems which appear on the +list, or which use an explicit @code{called-login} command, will be +permitted to use that login name. If the same login name is used more +than once with a list of systems, all the lists are concatenated +together. This feature permits you to restrict a login name to a +particular set of systems without requiring you to use the +@code{called-login} command for every single system; you can achieve a +similar effect by using a different system file for each permitted login +name with an appropriate @code{called-login} command in the file-wide +defaults. + +@item callback @var{boolean} +@findex callback + +If @var{boolean} is true, then when the remote system calls +@code{uucico} will hang up the connection and prepare to call it back. +The default is false. + +@item called-chat @var{strings} +@findex called-chat +@item called-chat-timeout @var{number} +@findex called-chat-timeout +@item called-chat-fail @var{string} +@findex called-chat-fail +@item called-chat-seven-bit @var{boolean} +@findex called-chat-seven-bit +@item called-chat-program @var{strings} +@findex called-chat-program + +These commands may be used to define a chat script (@pxref{Chat +Scripts}) that is run whenever the local system is called by the system +being defined. The chat script defined by the @code{chat} command +(@pxref{Logging In}), on the other hand, is used when the remote system +is called. This called chat script might be used to set special modem +parameters that are appropriate to a particular system. It is run after +protocol negotiation is complete, but before the protocol has been +started. See @ref{Logging In} for additional escape sequence which may +be used besides those defined for all chat scripts. There is no default +called chat script. If the called chat script fails, the incoming call +will be aborted. + +@end table + +@node Protocol Selection, File Transfer Control, Accepting a Call, sys File +@subsection Protocol Selection + +@table @code + +@item protocol @var{string} +@findex protocol in sys file + +Specifies which protocols to use for the other system, and in which +order to use them. This would not normally be used. For example, +@samp{protocol tfg}. + +The default depends on the characteristics of the port and the dialer, +as specified by the @code{seven-bit} and @code{reliable} commands. If +neither the port nor the dialer use either of these commands, the +default is to assume an eight-bit reliable connection. The commands +@samp{seven-bit true} or @samp{reliable false} might be used in either +the port or the dialer to change this. Each protocol has particular +requirements that must be met before it will be considered during +negotiation with the remote side. + +The @samp{t} and @samp{e} protocols are intended for use over TCP or +some other communication path with end to end reliability, as they do no +checking of the data at all. They will only be considered on a TCP port +which is both reliable and eight bit. + +The @samp{i} protocol is a bidirectional protocol. It requires an +eight-bit connection. It will run over a half-duplex link, such as +Telebit modems in PEP mode, but for efficient use of such a connection +you must use the @code{half-duplex} command (@pxref{port File}). + +The @samp{g} protocol is robust, but requires an eight-bit connection. + +The @samp{G} protocol is the System V Release 4 version of the @samp{g} +protocol. + +The @samp{a} protocol is a Zmodem like protocol, contributed by Doug +Evans. It requires an eight-bit connection, but unlike the @samp{g} or +@samp{i} protocol it will work if certain control characters may not be +transmitted. + +The @samp{j} protocol is a variant of the @samp{i} protocol which can +avoid certain control characters. The set of characters it avoids can +be set by a parameter. While it technically does not require an eight +bit connection (it could be configured to avoid all characters with the +high bit set) it would be very inefficient to use it over one. It is +useful over a eight-bit connection that will not transmit certain +control characters. + +The @samp{f} protocol is intended for use with X.25 connections; it +checksums each file as a whole, so any error causes the entire file to +be retransmitted. It requires a reliable connection, but only uses +seven-bit transmissions. It is a streaming protocol, so, while it can +be used on a serial port, the port must be completely reliable and flow +controlled; many aren't. + +The @samp{v} protocol is the @samp{g} protocol as used by the DOS +program UUPC/Extended. It is provided only so that UUPC/Extended users +can use it; there is no particular reason to select it. + +The protocols will be considered in the order shown above. This means +that if neither the @code{seven-bit} nor the @code{reliable} command are +used, the @samp{t} protocol will be used over a TCP connection and the +@samp{i} protocol will be used over any other type of connection +(subject, of course, to what is supported by the remote system; it may +be assumed that all systems support the @samp{g} protocol). + +Note that currently specifying both @samp{seven-bit true} and +@samp{reliable false} will not match any protocol. If this occurs +through a combination of port and dialer specifications, you will have +to use the @code{protocol} command for the system or no protocol will be +selected at all (the only reasonable choice would be @samp{protocol f}). + +A protocol list may also be specified for a port (@pxref{port File}), +but if there is a list for the system the list for the port is ignored. + +@item protocol-parameter @var{character} @var{string} @dots{} +@findex protocol-parameter in sys file + +@var{character} is a single character specifying a protocol. The +remaining strings are a command specific to that protocol which will be +executed if that protocol is used. A typical command is something like +@samp{window 7}. The particular commands are protocol specific. + +The @samp{i} protocol supports the following commands, all of which take +numeric arguments: + +@table @code +@item window +The window size to request the remote system to use. This must be +between 1 and 16 inclusive. The default is 16. +@item packet-size +The packet size to request the remote system to use. This must be +between 1 and 4095 inclusive. The default is 1024. +@item remote-packet-size +If this is between 1 and 4095 inclusive, the packet size requested by +the remote system is ignored and this is used instead. The default is +0, which means that the remote system's request is honored. +@item sync-timeout +The length of time, in seconds, to wait for a SYNC packet from the remote +system. SYNC packets are exchanged when the protocol is started. The +default is 10. +@item sync-retries +The number of times to retry sending a SYNC packet before giving up. +The default is 6. +@item timeout +The length of time, in seconds, to wait for an incoming packet before +sending a negative acknowledgement. The default is 10. +@item retries +The number of times to retry sending a packet or a negative +acknowledgement before giving up and closing the connection. The +default is 6. +@item errors +The maximum number of errors to permit before closing the connection. +The default is 100. +@item error-decay +The rate at which to ignore errors. Each time this many packets are +received, the error count is decreased by one, so that a long connection +with an occasional error will not exceed the limit set by @code{errors}. +The default is 10. +@item ack-frequency +The number of packets to receive before sending an acknowledgement. The +default is half the requested window size, which should provide good +performance in most cases. +@end table + +The @samp{g}, @samp{G} and @samp{v} protocols support the following +commands, all of which take numeric arguments, except +@code{short-packets} which takes a boolean argument: + +@table @code +@item window +The window size to request the remote system to use. This must be +between 1 and 7 inclusive. The default is 7. +@item packet-size +The packet size to request the remote system to use. This must be a +power of 2 between 32 and 4096 inclusive. The default is 64 for the +@samp{g} and @samp{G} protocols and 512 for the @samp{v} protocol. Many +older UUCP packages do not support packet sizes larger than 64, and many +others do not support packet sizes larger than 128. Some UUCP packages +will even dump core if a larger packet size is requested. The packet +size is not a negotiation, and it may be different in each direction. +If you request a packet size larger than the remote system supports, you +will not be able to send any files. +@item startup-retries +The number of times to retry the initialization sequence. The default +is 8. +@item init-retries +The number of times to retry one phase of the initialization sequence +(there are three phases). The default is 4. +@item init-timeout +The timeout in seconds for one phase of the initialization sequence. The +default is 10. +@item retries +The number of times to retry sending either a data packet or a request +for the next packet. The default is 6. +@item timeout +The timeout in seconds when waiting for either a data packet or an +acknowledgement. The default is 10. +@item garbage +The number of unrecognized bytes to permit before dropping the +connection. This must be larger than the packet size. The default is +10000. +@item errors +The number of errors (malformed packets, out of order packets, bad +checksums, or packets rejected by the remote system) to permit before +dropping the connection. The default is 100. +@item error-decay +The rate at which to ignore errors. Each time this many packets are +received, the error count is decreased by one, so that a long connection +with an occasional error will not exceed the limit set by @code{errors}. +The default is 10. +@item remote-window +If this is between 1 and 7 inclusive, the window size requested by the +remote system is ignored and this is used instead. This can be useful +when dealing with some poor UUCP packages. The default is 0, which +means that the remote system's request is honored. +@item remote-packet-size +If this is between 32 and 4096 inclusive the packet size requested by +the remote system is ignored and this is used instead. There is +probably no good reason to use this. The default is 0, which means that +the remote system's request is honored. +@item short-packets +If this is true, then the code will optimize by sending shorter packets +when there is less data to send. This confuses some UUCP packages, such +as System V Release 4 (when using the @samp{G} protocol) and Waffle; +when connecting to such a package, this parameter must be set to false. +The default is true for the @samp{g} and @samp{v} protocols and false +for the @samp{G} protocol. +@end table + +The @samp{a} protocol is a Zmodem like protocol contributed by Doug +Evans. It supports the following commands, all of which take numeric +arguments except for @code{escape-control}, which takes a boolean +argument: + +@table @code +@item timeout +Number of seconds to wait for a packet to arrive. The default is 10. +@item retries +The number of times to retry sending a packet. The default is 10. +@item startup-retries +The number of times to retry sending the initialization packet. The +default is 4. +@item garbage +The number of garbage characters to accept before closing the +connection. The default is 2400. +@item send-window +The number of characters that may be sent before waiting for an +acknowledgement. The default is 1024. +@item escape-control +Whether to escape control characters. If this is true, the protocol may +be used over a connection which does not transmit certain control +characters, such as @code{XON} or @code{XOFF}. The connection must +still transmit eight bit characters other than control characters. The +default is false. +@end table + +The @samp{j} protocol can be used over an eight bit connection that will +not transmit certain control characters. It accepts the same protocol +parameters that the @samp{i} protocol accepts, as well as one more: + +@table @code +@item avoid +A list of characters to avoid. This is a string which is interpreted as +an escape sequence (@pxref{Chat Scripts}). The protocol does not have a +way to avoid printable ASCII characters (byte values from 32 to 126, +inclusive); only ASCII control characters and eight-bit characters may +be avoided. The default value is @samp{\021\023}; these are the +characters @code{XON} and @code{XOFF} which many connections use for +flow control. If the package is configured to use @code{HAVE_BSD_TTY}, +then on some versions of Unix you may have to avoid @samp{\377} as well, +due to the way some implementations of the BSD terminal driver handle +signals. +@end table + +The @samp{f} protocol is intended for use with error-correcting modems +only; it checksums each file as a whole, so any error causes the entire +file to be retransmitted. It supports the following commands, both of +which take numeric arguments: + +@table @code +@item timeout +The timeout in seconds before giving up. The default is 120. +@item retries +How many times to retry sending a file. The default is 2. +@end table + +The @samp{t} and @samp{e} protocols are intended for use over TCP or +some other communication path with end to end reliability, as they do no +checking of the data at all. They both support a single command, which +takes a numeric argument: + +@table @code +@item timeout +The timeout in seconds before giving up. The default is 120. +@end table + +The protocol parameters are reset to their default values after each +call. + +@end table + +@node File Transfer Control, Miscellaneous (sys), Protocol Selection, sys File +@subsection File Transfer Control + +@table @code + +@item send-request @var{boolean} +@findex send-request + +The @var{boolean} determines whether the remote system is permitted to +request files from the local system. The default is yes. + +@item receive-request @var{boolean} +@findex receive-request + +The @var{boolean} determines whether the remote system is permitted to +send files to the local system. The default is yes. + +@item request @var{boolean} +@findex request + +A shorthand command, equivalent to specifying both @samp{send-request +@var{boolean}} and @samp{receive-request @var{boolean}}. + +@item call-transfer @var{boolean} +@findex call-transfer + +The @var{boolean} is checked when the local system places the call. It +determines whether the local system may do file transfers queued up for +the remote system. The default is yes. + +@item called-transfer @var{boolean} +@findex called-transfer + +The @var{boolean} is checked when the remote system calls in. It +determines whether the local system may do file transfers queued up for +the remote system. The default is yes. + +@item transfer @var{boolean} +@findex transfer + +Equivalent to specifying both @samp{call-transfer @var{boolean}} +@samp{called-transfer @var{boolean}}. + +@item call-local-size @var{number} @var{string} +@findex call-local-size + +The @var{string} is a time string (@pxref{Time Strings}). The +@var{number} is the size in bytes of the largest file that should be +transferred at a time matching the time string if the local system +placed the call and the request was made by the local system. This +command may appear multiple times in a single alternate. If this +command does not appear, or if none of the time strings match, there are +no size restrictions. + +With all the size control commands, the size of a file from the remote +system (as opposed to a file from the local system) will only be checked +if the other system is running this package; other UUCP packages will +not understand a maximum size request, nor will they provide the size of +remote files. + +@item call-remote-size @var{number} @var{string} +@findex call-remote-size + +Specify the size in bytes of the largest file that should be +transferred at a given time by remote request when the local system +placed the call. This command may appear multiple times in a single +alternate. If this command does not appear, there are no size +restrictions. + +@item called-local-size @var{number} @var{string} +@findex called-local-size + +Specify the size in bytes of the largest file that should be transferred +at a given time by local request when the remote system placed the call. +This command may appear multiple times in a single alternate. If this +command does not appear, there are no size restrictions. + +@item called-remote-size @var{number} @var{string} +@findex called-remote-size + +Specify the size in bytes of the largest file that should be transferred +at a given time by remote request when the remote system placed the +call. This command may appear multiple times in a single alternate. If +this command does not appear, there are no size restrictions. + +@item local-send @var{strings} +@findex local-send + +Specifies that files in the directories named by the @var{strings} may +be sent to the remote system when requested locally (using @code{uucp} +or @code{uux}). The directories in the list should be separated by +whitespace. A @kbd{~} may be used for the public directory. On a Unix +system, this is typically @file{/usr/spool/uucppublic}; the public +directory may be set with the @code{pubdir} command. Here is an example +of @code{local-send}: + +@example +local-send ~ /usr/spool/ftp/pub +@end example + +Listing a directory allows all files within the directory and all +subdirectories to be sent. Directories may be excluded by preceding +them with an exclamation point. For example: + +@example +local-send /usr/ftp !/usr/ftp/private ~ +@end example + +@noindent +means that all files in @file{/usr/ftp} or the public directory may be +sent, except those files in @file{/usr/ftp/private}. The list of +directories is read from left to right, and the last directory to apply +takes effect; this means that directories should be listed from top +down. The default is the root directory (i.e., any file at all may be +sent by local request). + +@item remote-send @var{strings} +@findex remote-send + +Specifies that files in the named directories may be sent to the remote +system when requested by the remote system. The default is @kbd{~}. + +@item local-receive @var{strings} +@findex local-receive + +Specifies that files may be received into the named directories when +requested by a local user. The default is @kbd{~}. + +@item remote-receive @var{strings} +@findex remote-receive + +Specifies that files may be received into the named directories when +requested by the remote system. The default is @kbd{~}. On Unix, the +remote system may only request that files be received into directories +that are writeable by the world, regardless of how this is set. + +@item forward-to @var{strings} +@findex forward-to + +Specifies a list of systems to which files may be forwarded. The remote +system may forward files through the local system on to any of the +systems in this list. The string @samp{ANY} may be used to permit +forwarding to any system. The default is to not permit forwarding to +other systems. Note that if the remote system is permitted to execute +the @code{uucp} command, it effectively has the ability to forward to +any system. + +@item forward-from @var{strings} +@findex forward-from + +Specifies a list of systems from which files may be forwarded. The +remote system may request files via the local system from any of the +systems in this list. The string @samp{ANY} may be used to permit +forwarding to any system. The default is to not permit forwarding from +other systems. Note that if a remote system is permitted to execute the +@code{uucp} command, it effectively has the ability to request files +from any system. + +@item forward @var{strings} +@findex forward + +Equivalent to specifying both @samp{forward-to @var{strings}} and +@samp{forward-from @var{strings}}. This would normally be used rather +than either of the more specific commands. + +@end table + +@node Miscellaneous (sys), Default sys File Values, File Transfer Control, sys File +@subsection Miscellaneous sys File Commands + +@table @code + +@item sequence @var{boolean} +@findex sequence + +If @var{boolean} is true, then conversation sequencing is automatically +used for the remote system, so that if somebody manages to spoof as the +remote system, it will be detected the next time the remote system +actually calls. This is false by default. + +@item command-path @var{string} +@findex command-path + +Specifies the path (a list of whitespace separated directories) to be +searched to locate commands to execute. This is only used for commands +requested by @code{uux}, not for chat programs. The default is from +@file{policy.h}. + +@item commands @var{strings} +@findex commands + +The list of commands which the remote system is permitted to execute +locally. For example: @samp{commands rnews rmail}. If the value is +@samp{ALL} (case significant), all commands may be executed. The +default is @samp{rnews rmail}. + +@item free-space @var{number} +@findex free-space + +Specify the minimum amount of file system space (in bytes) to leave free +after receiving a file. If the incoming file will not fit, it will be +rejected. This initial rejection will only work when talking to another +instance of this package, since older UUCP packages do not provide the +file size of incoming files. Also, while a file is being received, +@code{uucico} will periodically check the amount of free space. If it +drops below the amount given by the @code{free-space} command, the file +transfer will be aborted. The default amount of space to leave free is +from @file{policy.h}. This file space checking may not work on all +systems. + +@item pubdir @var{string} +@findex pubdir in sys file + +Specifies the public directory that is used when @kbd{~} is specifed in +a file transfer or a list of directories. This essentially overrides +the public directory specified in the main configuration file for this +system only. The default is the public directory specified in the main +configuration file (which defaults to a value from @file{policy.h}). + +@item debug @var{string} @dots{} +@findex debug in sys file + +Set additional debugging for calls to or from the system. This may be +used to debug a connection with a specific system. It is particularly +useful when debugging incoming calls, since debugging information will +be generated whenever the call comes in. See the @code{debug} command +in the main configuration file (@pxref{Debugging Levels}) for more +details. The debugging information specified here is in addition to +that specified in the main configuration file or on the command line. + +@item max-remote-debug @var{string} @dots{} +@findex max-remote-debug + +When the system calls in, it may request that the debugging level be set +to a certain value. This command may be used to put a limit on the +debugging level which the system may request, to avoid filling up the +disk with debugging information. Only the debugging types named in the +@code{max-remote-debug} command may be turned on by the remote system. +To prohibit any debugging, use @samp{max-remote-debug none}. + +@end table + +@node Default sys File Values, , Miscellaneous (sys), sys File +@subsection Default sys File Values + +The following are used as default values for all systems; they can be +considered as appearing before the start of the file. + +@example +time Never +chat "" \r\c ogin:-BREAK-ogin:-BREAK-ogin: \L word: \P +chat-timeout 10 +callback n +sequence n +request y +transfer y +local-send / +remote-send ~ +local-receive ~ +remove-receive ~ +command-path [ from @file{policy.h} ] +commands rnews rmail +max-remote-debug abnormal,chat,handshake +@end example + +@node port File, dial File, sys File, Configuration Files +@section The Port Configuration File +@cindex port file +@cindex port configuration file +@cindex configuration file (port) + +The port files may be used to name and describe ports. By default there +is a single port file, named @file{port} in the directory +@var{newconfigdir}. This may be overridden by the @code{portfile} +command in the main configuration file; see @ref{Configuration File +Names}. + +Any commands in a port file before the first @code{port} command specify +defaults for all ports in the file; however, since the @code{type} +command must appear before all other commands for a port, the defaults +are only useful if all ports in the file are of the same type (this +restriction may be lifted in a later version). All commands after a +@code{port} command up to the next @code{port} command then describe +that port. There are different types of ports; each type supports its +own set of commands. Each command indicates which types of ports +support it. There may be many ports with the same name; if a system +requests a port by name then each port with that name will be tried +until an unlocked one is found. + +@table @code + +@item port @var{string} +@findex port in port file + +Introduces and names a port. + +@item type @var{string} +@findex type + +Define the type of port. The default is @samp{modem}. If this command +appears, it must immediately follow the @code{port} command. The type defines +what commands are subsequently allowed. Currently the types are: + +@table @samp +@item modem +For a modem hookup. +@item stdin +For a connection through standard input and standard output, as when +@code{uucico} is run as a login shell. +@item direct +For a direct connection to another system. +@item tcp +For a connection using TCP. +@item tli +For a connection using TLI. +@item pipe +For a connection through a pipe running another program. +@end table + +@item protocol @var{string} +@findex protocol in port file + +Specify a list of protocols to use for this port. This is just like the +corresponding command for a system (@pxref{Protocol Selection}). A +protocol list for a system takes precedence over a list for a port. + +@item protocol-parameter @var{character} @var{strings} [ any type ] +@findex protocol-parameter in port file + +The same command as the @code{protocol-parameter} command used for +systems (@pxref{Protocol Selection}). This one takes precedence. + +@item seven-bit @var{boolean} [ any type ] +@findex seven-bit in port file + +This is only used during protocol negotiation; if the argument is true, +it forces the selection of a protocol which works across a seven-bit +link. It does not prevent eight bit characters from being transmitted. +The default is false. + +@item reliable @var{boolean} [ any type ] +@findex reliable in port file + +This is only used during protocol negotiation; if the argument is +false, it forces the selection of a protocol which works across +an unreliable communication link. The default is true. It would +be more common to specify this for a dialer rather than a port. + +@item half-duplex @var{boolean} [ any type ] +@findex half-duplex in port file + +If the argument is true, it means that the port only supports +half-duplex connections. This only affects bidirectional protocols, and +causes them to not do bidirectional transfers. + +@item device @var{string} [ modem, direct and tli only ] +@findex device + +Names the device associated with this port. If the device is not named, +the port name is taken as the device. Device names are system +dependent. On Unix, a modem or direct connection might be something +like @file{/dev/ttyd0}; a TLI port might be @file{/dev/inet/tcp}. + +@itemx speed @var{number} [modem and direct only ] +@findex speed in port file +@item baud @var{number} [ modem and direct only ] +@findex baud in port file + +The speed this port runs at. If a system specifies a speed but no port +name, then all ports which match the speed will be tried in order. If +the speed is not specified here and is not specified by the system, the +natural speed of the port will be used by default. + +@itemx speed-range @var{number} @var{number} [ modem only ] +@findex speed-range +@item baud-range @var{number} @var{number} [ modem only ] +@findex baud-range + +Specify a range of speeds this port can run at. The first number is the +minimum speed, the second number is the maximum speed. These numbers +will be used when matching a system which specifies a desired speed. +The simple @code{speed} (or @code{baud}) command is still used to +determine the speed to run at if the system does not specify a speed. +For example, the command @samp{speed-range 300 19200} means that the +port will match any system which uses a speed from 300 to 19200 baud +(and will use the speed specified by the system); this could be combined +with @samp{speed 2400}, which means that when this port is used with a +system that does not specify a speed, the port will be used at 2400 +baud. + +@item carrier @var{boolean} [ modem and direct only ] +@findex carrier in port file + +The argument indicates whether the port supports carrier. + +If a modem port does not support carrier, the carrier detect signal will +never be required on this port, regardless of what the modem chat script +indicates. The default for a modem port is true. + +If a direct port supports carrier, the port will be set to expect +carrier whenever it is used. The default for a direct port is false. + +@item hardflow @var{boolean} [ modem and direct only ] +@findex hardflow + +The argument indicates whether the port supports hardware flow control. +If it does not, hardware flow control will not be turned on for this +port. The default is true. Hardware flow control is only supported on +some systems. + +@item dial-device @var{string} [ modem only ] +@findex dial-device + +Dialing instructions should be output to the named device, rather than +to the normal port device. The default is to output to the normal port +device. + +@item dialer @var{string} [ modem only ] +@findex dialer in port file + +Name a dialer to use. The information is looked up in the dial file. +There is no default. Some sort of dialer information must be specified +to call out on a modem. + +@item dialer @var{string} @dots{} [ modem only ] + +Execute a dialer command. If a dialer is named (by using the first form +of this command, described just above), these commands are ignored. +They may be used to specify dialer information directly in simple +situations without needing to go to a separate file. There is no +default. Some sort of dialer information must be specified to call out +on a modem. + +@item dialer-sequence @var{strings} [ modem or tcp or tli only ] +@findex dialer-sequence + +Name a sequence of dialers and tokens (phone numbers) to use. The first +argument names a dialer, and the second argument names a token. The +third argument names another dialer, and so on. If there are an odd +number of arguments, the phone number specified with a @code{phone} +command in the system file is used as the final token. The token is +what is used for @kbd{\D} or @kbd{\T} in the dialer chat script. If the +token in this string is @kbd{\D}, the system phone number will be used; +if it is @kbd{\T}, the system phone number will be used after undergoing +dialcodes translation. A missing final token is taken as @kbd{\D}. + +This command currently does not work if @code{dial-device} is specified; +to handle this correctly will require a more systematic notion of chat +scripts. Moreover, the @code{complete} and @code{abort} chat scripts, +the protocol parameters, and the @code{carrier} and @code{dtr-toggle} +commands are ignored for all but the first dialer. + +This command basically lets you specify a sequence of chat scripts to +use. For example, the first dialer might get you to a local network and +the second dialer might describe how to select a machine from the local +network. This lets you break your dialing sequence into simple modules, +and may make it easier to share dialer entries between machines. + +This command is to only way to use a chat script with a TCP port. This +can be useful when using a modem which is accessed via TCP. + +When this command is used with a TLI port, then if the first dialer is +@samp{TLI} or @samp{TLIS} the first token is used as the address to +connect to. If the first dialer is something else, or if there is no +token, the address given by the @code{address} command is used +(@pxref{Placing the Call}). Escape sequences in the address are +expanded as they are for chat script expect strings (@pxref{Chat +Scripts}). The different between @samp{TLI} and @samp{TLIS} is that the +latter implies the command @samp{stream true}. These contortions are +all for HDB compatibility. Any subsequent dialers are treated as they +are for a TCP port. + +@item lockname @var{string} [ modem and direct only ] +@findex lockname + +Give the name to use when locking this port. On Unix, this is the name +of the file that will be created in the lock directory. It is used as +is, so on Unix it should generally start with @samp{LCK..}. For +example, if a single port were named both @file{/dev/ttycu0} and +@file{/dev/tty0} (perhaps with different characteristics keyed on the +minor device number), then the command @code{lockname LCK..ttycu0} could +be used to force the latter to use the same lock file name as the +former. + +@item service @var{string} [ tcp only ] +@findex service + +Name the TCP port number to use. This may be a number. If not, it will +be looked up in @file{/etc/services}. If this is not specified, the +string @samp{uucp} is looked up in @file{/etc/services}. If it is not +found, port number 540 (the standard UUCP-over-TCP port number) will be +used. + +@item push @var{strings} [ tli only ] +@findex push + +Give a list of modules to push on to the TLI stream. + +@item stream @var{boolean} [ tli only ] +@findex stream + +If this is true, and the @code{push} command was not used, the +@samp{tirdwr} module is pushed on to the TLI stream. + +@item server-address @var{string} [ tli only ] +@findex server-address + +Give the address to use when running as a TLI server. Escape sequences +in the address are expanded as they are for chat script expect strings +(@pxref{Chat Scripts}). + +@item command @var{strings} [ pipe only ] +@findex command + +Give the command, with arguments, to run when using a pipe port type. +When a port of this type is used, the command is executed and uucico +communicates with it over a pipe. This permits uucico or cu to +communicate with another system which can only be reached through some +unusual means. A sample use might be @samp{command /bin/rlogin -E -8 -l +@var{login} @var{system}}. The command is run with the full privileges +of UUCP; it is responsible for maintaining security. + +@end table + +@node dial File, Security, port File, Configuration Files +@section The Dialer Configuration File +@cindex dial file +@cindex dialer configuration file +@cindex configuration file (dial) + +The dialer configuration files define dialers. By default there is a +single dialer file, named @file{dial} in the directory +@var{newconfigdir}. This may be overridden by the @code{dialfile} +command in the main configuration file; see @ref{Configuration File +Names}. + +Any commands in the file before the first @code{dialer} command specify +defaults for all the dialers in the file. All commands after a +@code{dialer} command up to the next @code{dialer} command are +associated with the named dialer. + +@table @code + +@item dialer @var{string} +@findex dialer in dial file + +Introduces and names a dialer. + +@item chat @var{strings} +@findex chat in dial file +@item chat-timeout @var{number} +@findex chat-timeout in dial file +@item chat-fail @var{string} +@findex chat-fail in dial file +@item chat-seven-bit @var{boolean} +@findex chat-seven-bit in dial file +@item chat-program @var{strings} +@findex chat-program in dial file + +Specify a chat script to be used to dial the phone. See @ref{Chat +Scripts} for full details on chat scripts. + +Taylor UUCP will sleep for one second between attempts to dial out on a +modem. If your modem requires a longer wait period, you must start your +chat script with delays (@samp{\d} in a send string). + +The chat script will be read from and sent to the port specified by the +@code{dial-device} command for the port, if there is one. + +The following escape addition escape sequences may appear in send +strings: + +@table @kbd +@item \D +send phone number without dialcode translation +@item \T +send phone number with dialcode translation +@item \M +do not require carrier +@item \m +require carrier (fail if not present) +@end table + +See the description of the dialcodes file (@pxref{Configuration File +Names}) for a description of dialcode translation. If the port does not +support carrier (as set by the @code{carrier} command in the port file) +@kbd{\M} and @kbd{\m} are ignored. If both the port and the dialer +support carrier (as set by the @code{carrier} command in the port file +and the @code{carrier} command in the dialer file), then every chat +script implicitly begins with @kbd{\M} and ends with @kbd{\m}. There is +no default chat script for dialers. + +The following additional escape sequences may be used in +@code{chat-program}: + +@table @kbd +@item \D +phone number without dialcode translation +@item \T +phone number with dialcode translation +@end table + +If the program changes the port in any way (e.g., sets parity) the +changes will be preserved during protocol negotiation, but once the +protocol is selected it will change the port settings. + +@item dialtone @var{string} +@findex dialtone + +A string to output when dialing the phone number which causes the modem +to wait for a secondary dial tone. This is used to translate the +@kbd{=} character in a phone number. The default is a comma. + +@item pause @var{string} +@findex pause + +A string to output when dialing the phone number which causes the modem +to wait for 1 second. This is used to translate the @kbd{-} character +in a phone number. The default is a comma. + +@item carrier @var{boolean} +@findex carrier in dial file + +If the argument is true, the dialer supports the modem carrier signal. +After the phone number is dialed, @code{uucico} will require that +carrier be on. One some systems, it will be able to wait for it. If +the argument is false, carrier will not be required. The default is +true. + +@item carrier-wait @var{number} +@findex carrier-wait + +If the port is supposed to wait for carrier, this may be used to +indicate how many seconds to wait. The default is 60 seconds. Only +some systems support waiting for carrier. + +@item dtr-toggle @var{boolean} @var{boolean} +@findex dtr-toggle + +If the first argument is true, then DTR is toggled before using +the modem. This is only supported on some systems and some ports. The +second @var{boolean} need not be present; if it is, and it is +true, the program will sleep for 1 second after toggling DTR. +The default is not to toggle DTR. + +@item complete-chat @var{strings} +@findex complete-chat +@item complete-chat-timeout @var{number} +@findex complete-chat-timeout +@item complete-chat-fail @var{string} +@findex complete-chat-fail +@item complete-chat-seven-bit @var{boolean} +@findex complete-chat-seven-bit +@item complete-chat-program @var{strings} +@findex complete-chat-program + +These commands define a chat script (@pxref{Chat Scripts}) which is run +when a call is finished normally. This allows the modem to be reset. +There is no default. No additional escape sequences may be used. + +@item complete @var{string} +@findex complete + +This is a simple use of @code{complete-chat}. It is equivalent to +@code{complete-chat "" @var{string}}; this has the effect of sending +@var{string} to the modem when a call finishes normally. + +@item abort-chat @var{strings} +@findex abort-chat +@item abort-chat-timeout @var{number} +@findex abort-chat-timeout +@item abort-chat-fail @var{string} +@findex abort-chat-fail +@item abort-chat-seven-bit @var{boolean} +@findex abort-chat-seven-bit +@item abort-chat-program @var{strings} +@findex abort-chat-program + +These commands define a chat script (@pxref{Chat Scripts}) to be run +when a call is aborted. They may be used to interrupt and reset the +modem. There is no default. No additional escape sequences may be +used. + +@item abort @var{string} +@findex abort + +This is a simple use of @code{abort-chat}. It is equivalent to +@code{abort-chat "" @var{string}}; this has the effect of sending +@var{string} to the modem when a call is aborted. + +@item protocol-parameter @var{character} @var{strings} +@findex protocol-parameter in dial file + +Set protocol parameters, just like the @code{protocol-parameter} command +in the system configuration file or the port configuration file; see +@ref{Protocol Selection}. These parameters take precedence, then those +for the port, then those for the system. + +@item seven-bit @var{boolean} +@findex seven-bit in dial file + +This is only used during protocol negotiation; if it is true, it +forces selection of a protocol which works across a seven-bit link. It +does not prevent eight bit characters from being transmitted. The +default is false. It would be more common to specify this for a +port than for a dialer. + +@item reliable @var{boolean} +@findex reliable in dial file + +This is only used during protocol negotiation; if it is false, it +forces selection of a protocol which works across an unreliable +communication link. The default is true. + +@item half-duplex @var{boolean} [ any type ] +@findex half-duplex in dial file + +If the argument is true, it means that the dialer only supports +half-duplex connections. This only affects bidirectional protocols, and +causes them to not do bidirectional transfers. + +@end table + +@node Security, , dial File, Configuration Files +@section Security + +This discussion of UUCP security applies only to Unix. It is a bit +cursory; suggestions for improvement are solicited. + +UUCP is traditionally not very secure. Taylor UUCP addresses some +security issues, but is still far from being a secure system. + +If security is very important to you, then you should not permit any +external access to your computer, including UUCP. Any opening to the +outside world is a potential security risk. + +By default Taylor UUCP provides few mechanisms to secure local users of +the system from each other. You can allow increased security by putting +the owner of the UUCP programs (normally @code{uucp}) into a separate +group; the use of this is explained in the following paragraphs, which +refer to this separate group as @code{uucp-group}. + +When the @code{uucp} program is invoked to copy a file to a remote +system, it will by default copy the file into the UUCP spool directory. +When the @code{uux} program is used, the @samp{-C} switch must be used +to copy the file into the UUCP spool directory. In any case, once the +file has been copied into the spool directory, other local users will +not be able to access it. + +When a file is requested from a remote system, UUCP will only permit it +to be placed in a directory which is writable by the requesting user. +The directory must also be writable by UUCP. A local user can create a +directory with a group of @code{uucp-group} and set the mode to permit +group write access. This will allow the file be requested without +permitting it to be viewed by any other user. + +There is no provision for security for @code{uucp} requests (as opposed +to @code{uux} requests) made by a user on a remote system. A file sent +over by a remote request may only be placed in a directory which is +world writable, and the file will be world readable and writable. This +will permit any local user to destroy or replace the contents of the +file. A file requested by a remote system must be world readable, and +the directory it is in must be world readable. Any local user will be +able to examine, although not necessarily modify, the file before it is +sent. + +There are some security holes and race conditions that apply to the +above discussion which I will not elaborate on. They are not hidden +from anybody who reads the source code, but they are somewhat technical +and difficult (though scarcely impossible) to exploit. Suffice it to +say that even under the best of conditions UUCP is not completely +secure. + +For many sites, security from remote sites is a more important +consideration. Fortunately, Taylor UUCP does provide some support in +this area. + +The greatest security is provided by always dialing out to the other +site. This prevents anybody from pretending to be the other site. Of +course, only one side of the connection can do this. + +If remote dialins must be permitted, then it is best if the dialin line +is used only for UUCP. If this is the case, then you should create a +call-in password file (@pxref{Configuration File Names}) and let +@code{uucico} do its own login prompting. For example, to let remote +sites log in on a port named @samp{entry} in the port file (@pxref{port +File}) you might invoke @samp{uucico -p entry}. This would cause +@code{uucico} to enter an endless loop of login prompts and daemon +executions. The advantage of this approach is that even if remote users +break into the system by guessing or learning the password, they will +only be able to do whatever @code{uucico} permits them to do. They will +not be able to start a shell on your system. + +If remote users can dial in and log on to your system, then you have a +security hazard more serious than that posed by UUCP. But then, you +probably knew that already. + +Once your system has connected with the remote UUCP, there is a fair +amount of control you can exercise. You can use the @code{remote-send} +and @code{remote-receive} commands to control the directories the remote +UUCP can access. You can use the @code{request} command to prevent the +remote UUCP from making any requests of your system at all; however, if +you do this it will not even be able to send you mail or news. If you +do permit remote requests, you should be careful to restrict what +commands may be executed at the remote system's request. The default is +@code{rmail} and @code{rnews}, which will suffice for most systems. + +If different remote systems call in and they must be granted different +privileges (perhaps some systems are within the same organization and +some are not) then the @code{called-login} command should be used for +each system to require that they different login names. Otherwise it +would be simple for a remote system to use the @code{myname} command and +pretend to be a different system. The @code{sequence} command can be +used to detect when one system pretended to be another, but since the +sequence numbers must be reset manually after a failed handshake this +can sometimes be more trouble than it's worth. + +@node Protocols, Hacking, Configuration Files, Top +@chapter UUCP protocol internals + +A detailed description of how the various UUCP protocols work is posted +monthly to the newsgroups @samp{comp.mail.uucp}, @samp{news.answers} and +@samp{comp.answers}. There is no need to read this information in order +to use Taylor UUCP. It is intended for people who are interested in how +the UUCP code works. + +@node Hacking, Acknowledgements, Protocols, Top +@chapter Hacking Taylor UUCP + +This chapter provides the briefest of guides to the Taylor UUCP source +code itself. + +@menu +* System Dependence:: System Dependence +* Naming Conventions:: Naming Conventions +* Patches:: Patches +@end menu + +@node System Dependence, Naming Conventions, Hacking, Hacking +@section System Dependence + +The code is carefully segregated into a system independent portion and a +system dependent portion. The system dependent code is in the +@file{unix} subdirectory, and also in the files @file{tcp.c}, +@file{tli.c} and @file{sysh.unx} (also known as @file{sysdep.h}). + +With the right configuration parameters, the system independent code +calls only ANSI C functions. Some of the less common ANSI C functions +are also provided in the @file{lib} directory. The replacement function +@code{strtol} in @file{lib/strtol.c} assumes that the characters @kbd{A} +to @kbd{F} and @kbd{a} to @kbd{f} appear in strictly sequential order. +The function @code{igradecmp} in @file{uuconf/grdcmp.c} assumes that the +upper and lower case letters appear in order. Both assumptions are true +for ASCII and EBCDIC, but neither is guaranteed by ANSI C. Disregarding +these caveats, I believe that the system independent portion of the code +is strictly conforming. + +That's not too exciting, since all the work is done in the system +dependent code. I think that this code can conform to POSIX 1003.1, +given the right compilation parameters. I'm a bit less certain about +this, though. + +The code is in use on a 16 bit segmented system with no function +prototypes, so I'm certain that all casts to long and pointers are done +when necessary. + +@node Naming Conventions, Patches, System Dependence, Hacking +@section Naming Conventions + +I use a modified Hungarian naming convention for my variables and +functions. As with all naming conventions, the code is rather opaque if +you are not familiar with it, but becomes clear and easy to use with +time. + +The first character indicates the type of the variable (or function +return value). Sometimes additional characters are used. I use the +following type prefixes: + +@table @samp +@item a +array; the next character is the type of an element +@item b +byte or character +@item c +count of something +@item e +stdio FILE * +@item f +boolean +@item i +generic integer +@item l +double +@item o +file descriptor (as returned by open, creat, etc.) +@item p +generic pointer +@item q +pointer to structure +@item s +structure +@item u +void (function return values only) +@item z +character string +@end table + +A generic pointer (@code{p}) is sometimes a @code{void *}, sometimes a +function pointer in which case the prefix is pf, and sometimes a pointer +to another type, in which case the next character is the type to which +it points (pf is overloaded). + +An array of strings (@code{char *[]}) would be named @code{az} (array of +string). If this array were passed to a function, the function +parameter would be named @code{paz} (pointer to array of string). + +Note that the variable name prefixes do not necessarily indicate the +type of the variable. For example, a variable prefixed with i may be +int, long or short. Similarly, a variable prefixed with b may be a char +or an int; for example, the return value of getchar would be caught in +an int variable prefixed with b. + +For a non-local variable (extern or file static), the first character +after the type prefix is capitalized. + +Most static variables and functions use another letter after the type +prefix to indicate which module they come from. This is to help +distinguish different names in the debugger. For example, all static +functions in @file{protg.c}, the @samp{g} protocol source code, use a +module prefix of @samp{g}. This isn't too useful, as a number of +modules use a module prefix of @samp{s}. + +@node Patches, , Naming Conventions, Hacking +@section Patches + +I am always grateful for any patches sent in. Much of the flexibility +and portability of the code is due to other people. Please do not +hesitate to send me any changes you have found necessary or useful. + +When sending a patch, please send the output of the Unix @code{diff} +program invoked with the @samp{-c} option (if you have the GNU version +of @code{diff}, use the @samp{-p} option). Always invoke @code{diff} +with the original file first and the modified file second. + +If your @code{diff} does not support @samp{-c} (or you don't have +@code{diff}), send a complete copy of the modified file (if you have +just changed a single function, you can just send the new version of the +function). In particular, please do not send @code{diff} output without +the @samp{-c} option, as it is useless. + +If you have made a number of changes, it is very convenient for me if +you send each change as a separate mail message. Sometimes I will think +that one change is useful but another one is not. If they are in +different messages it is much easier for me to apply one but not the +other. + +I rarely apply the patches directly. Instead I work my way through the +hunks and apply each one separately. This ensures that the naming +remains consistent, and that I understand all the code. + +If you can not follow all these rules, then don't. But if you do, it +makes it more likely that I will incorporate your changes. I am not +paid for my UUCP work, and my available time is unfortunately very +restricted. The package is important to me, and I do what I can, but I +can not do all that I would like, much less all that everybody else +would like. + +Finally, please do not be offended if I do not reply to messages for +some time, even a few weeks. I am often behind on my mail, and if I +think your message deserves a considered reply I will often put it aside +until I have time to deal with it. + +@node Acknowledgements, Index (concepts), Hacking, Top +@chapter Acknowledgements + +This is a list of people who gave help or suggestions while I was +working on the Taylor UUCP project. Appearance on this list does not +constitute endorsement of the program, particularly since some of the +comments were criticisms. I've probably left some people off, and I +apologize for any oversight; it does not mean your contribution was +unappreciated. + +@ifinfo +First of all, I would like to thank the people at Infinity Development +Systems (formerly AIRS, which lives on in the domain name, at least for +now) for permitting me to use their computers and @file{uunet} access. +I would also like to thank Richard Stallman @code{<rms@@gnu.ai.mit.edu>} +for founding the Free Software Foundation and John Gilmore +@code{<gnu@@cygnus.com>} for writing the initial version of gnuucp which +was a direct inspiration for this somewhat larger project. Chip +Salzenberg @code{<chip@@tct.com>} has contributed many patches. +Franc,ois Pinard @code{<pinard@@iro.umontreal.ca>} tirelessly tested the +code and suggested many improvements. He also put together the initial +version of this document. Doug Evans contributed the zmodem protocol. +Marc Boucher @code{<marc@@CAM.ORG>} contributed the code supporting the +pipe port type. Finally, Verbus M. Counts @code{<verbus@@westmark.com>} +and Centel Federal Systems, Inc. deserve special thanks, since they +actually paid me money to port this code to System III. +@end ifinfo +@iftex +First of all, I would like to thank the people at Infinity Development +Systems (formerly AIRS, which lives on in the domain name, at least for +now) for permitting me to use their computers and @file{uunet} access. +I would also like to thank Richard Stallman @code{<rms@@gnu.ai.mit.edu>} +for founding the Free Software Foundation and John Gilmore +@code{<gnu@@cygnus.com>} for writing the initial version of gnuucp which +was a direct inspiration for this somewhat larger project. Chip +Salzenberg @code{<chip@@tct.com>} has contributed many patches. +@tex +Fran\c cois Pinard +@end tex +@code{<pinard@@iro.umontreal.ca>} tirelessly tested the code and +suggested many improvements. He also put together the initial version +of this document. Doug Evans contributed the zmodem protocol. Marc +Boucher @code{<marc@@CAM.ORG>} contributed the code supporting the pipe +port type. Finally, Verbus M. Counts @code{<verbus@@westmark.com>} and +Centel Federal Systems, Inc. deserve special thanks, since they actually +paid me money to port this code to System III. +@end iftex + +In alphabetical order: + +@example +"Earle F. Ake - SAIC" @code{<ake@@Dayton.SAIC.COM>} +@code{mra@@searchtech.com} (Michael Almond) +@code{cambler@@zeus.calpoly.edu} (Christopher J. Ambler) +Brian W. Antoine @code{<briana@@tau-ceti.isc-br.com>} +@code{jantypas@@soft21.s21.com} (John Antypas) +@code{james@@bigtex.cactus.org} (James Van Artsdalen) +@code{nba@@sysware.DK} (Niels Baggesen) +@code{uunet!hotmomma!sdb} (Scott Ballantyne) +Zacharias Beckman @code{<zac@@dolphin.com>} +@code{mike@@mbsun.ann-arbor.mi.us} (Mike Bernson) +@code{bob@@usixth.sublink.org} (Roberto Biancardi) +@code{statsci!scott@@coco.ms.washington.edu} (Scott Blachowicz) +@code{bag%wood2.cs.kiev.ua@@relay.ussr.eu.net} (Andrey G Blochintsev) +@code{spider@@Orb.Nashua.NH.US} (Spider Boardman) +Gregory Bond @code{<gnb@@bby.com.au>} +Marc Boucher @code{<marc@@CAM.ORG>} +@code{dean@@coplex.com} (Dean Brooks) +@code{jbrow@@radical.com} (Jim Brownfield) +@code{dave@@dlb.com} (Dave Buck) +@code{gordon@@sneaky.lonestar.org} (Gordon Burditt) +@code{dburr@@sbphy.physics.ucsb.edu} (Donald Burr) +@code{mib@@gnu.ai.mit.edu} (Michael I Bushnell) +Brian Campbell @code{<brianc@@quantum.on.ca>} +Andrew A. Chernov @code{<ache@@astral.msk.su>} +@code{mafc!frank@@bach.helios.de} (Frank Conrad) +Ed Carp @code{<erc@@apple.com>} +@code{mpc@@mbs.linet.org} (Mark Clements) +@code{verbus@@westmark.westmark.com} (Verbus M. Counts) +@code{cbmvax!snark.thyrsus.com!cowan} (John Cowan) +Bob Cunningham @code{<bob@@soest.hawaii.edu>} +@code{kdburg@@incoahe.hanse.de} (Klaus Dahlenburg) +Damon @code{<d@@exnet.co.uk>} +@code{hubert@@arakis.fdn.org} (Hubert Delahaye) +@code{markd@@bushwire.apana.org.au} (Mark Delany) +Allen Delaney @code{<allen@@brc.ubc.ca>} +@code{denny@@dakota.alisa.com} (Bob Denny) +@code{ssd@@nevets.oau.org} (Steven S. Dick) +@code{gert@@greenie.gold.sub.org} (Gert Doering) +@code{gemini@@geminix.in-berlin.de} (Uwe Doering) +Hans-Dieter Doll @code{<hd2@@Insel.DE>} +Mark W. Eichin @code{<eichin@@cygnus.com>} +Andrew Evans @code{<andrew@@airs.com>} +@code{dje@@cygnus.com} (Doug Evans) +Marc Evans @code{<marc@@synergytics.com>} +Dan Everhart @code{<dan@@dyndata.com>} +@code{kksys!kegworks!lfahnoe@@cs.umn.edu} (Larry Fahnoe) +@code{fenner@@jazz.psu.edu} (Bill Fenner) +@code{jaf@@inference.com} (Jose A. Fernandez) +"David J. Fiander" @code{<golem!david@@news.lsuc.on.ca>} +Thomas Fischer @code{<batman@@olorin.dark.sub.org>} +@code{louis@@marco.de} (Ju"rgen Fluk) +@code{erik@@eab.retix.com} (Erik Forsberg) +@code{andy@@scp.caltech.edu} (Andy Fyfe) +Lele Gaifax @code{<piggy@@idea.sublink.org>} +@code{Peter.Galbavy@@micromuse.co.uk} +@code{hunter@@phoenix.pub.uu.oz.au} (James Gardiner [hunter]) +Terry Gardner @code{<cphpcom!tjg01>} +@code{ol@@infopro.spb.su} (Oleg Girko) +@code{jimmy@@tokyo07.info.com} (Jim Gottlieb) +Benoit Grange @code{<ben@@fizz.fdn.org>} +@code{elg@@elgamy.jpunix.com} (Eric Lee Green) +@code{ryan@@cs.umb.edu} (Daniel R. Guilderson) +@code{greg@@gagme.chi.il.us} (Gregory Gulik) +Richard H. Gumpertz @code{<rhg@@cps.com>} +Michael Haberler @code{<mah@@parrot.prv.univie.ac.at>} +Daniel Hagerty @code{<hag@@eddie.mit.edu>} +@code{jh@@moon.nbn.com} (John Harkin) +@code{guy@@auspex.auspex.com} (Guy Harris) +Petri Helenius @code{<pete@@fidata.fi>} +@code{gabe@@edi.com} (B. Gabriel Helou) +Bob Hemedinger @code{<bob@@dalek.mwc.com>} +Andrew Herbert @code{<andrew@@werple.pub.uu.oz.au>} +Peter Honeyman @code{<honey@@citi.umich.edu>} +@code{jhood@@smoke.marlboro.vt.us} (John Hood) +Bill Irwin @code{<bill@@twg.bc.ca>} +@code{pmcgw!personal-media.co.jp!ishikawa} (Chiaki Ishikawa) +@code{bei@@dogface.austin.tx.us} (Bob Izenberg) +@code{djamiga!djjames@@fsd.com} (D.J.James) +Rob Janssen @code{<cmgit!rob@@relay.nluug.nl>} +@code{harvee!esj} (Eric S Johansson) +Kevin Johnson @code{<kjj@@pondscum.phx.mcd.mot.com>} +Alan Judge @code{<aj@@dec4ie.IEunet.ie>} +@code{chris@@cj_net.in-berlin.de} (Christof Junge) +@code{tron@@Veritas.COM} (Ronald S. Karr) +Brendan Kehoe @code{<brendan@@cs.widener.edu>} +@code{warlock@@csuchico.edu} (John Kennedy) +@code{kersing@@nlmug.nl.mugnet.org} (Jac Kersing) +Gabor Kiss @code{<kissg@@sztaki.hu>} +@code{gero@@gkminix.han.de} (Gero Kuhlmann) +@code{rob@@pact.nl} (Rob Kurver) +@code{kent@@sparky.IMD.Sterling.COM} (Kent Landfield) +@code{lebaron@@inrs-telecom.uquebec.ca} (Gregory LeBaron) +@code{karl@@sugar.NeoSoft.Com} (Karl Lehenbauer) +@code{alex@@hal.rhein-main.de} (Alexander Lehmann) +@code{merlyn@@digibd.com} (Merlyn LeRoy) +@code{clewis@@ferret.ocunix.on.ca} (Chris Lewis) +@code{gdonl@@ssi1.com} (Don Lewis) +@code{libove@@libove.det.dec.com} (Jay Vassos-Libove) +@code{bruce%blilly@@Broadcast.Sony.COM} (Bruce Lilly) +Ted Lindgreen @code{<tlindgreen@@encore.nl>} +@code{andrew@@cubetech.com} (Andrew Loewenstern) +"Arne Ludwig" @code{<arne@@rrzbu.hanse.de>} +Matthew Lyle @code{<matt@@mips.mitek.com>} +@code{djm@@eng.umd.edu} (David J. MacKenzie) +John R MacMillan @code{<chance!john@@sq.sq.com>} +Giles D Malet @code{<shrdlu!gdm@@provar.kwnet.on.ca>} +@code{mem@@mv.MV.COM} (Mark E. Mallett) +@code{pepe@@dit.upm.es} (Jose A. Manas) +@code{peter@@xpoint.ruessel.sub.org} (Peter Mandrella) +@code{martelli@@cadlab.sublink.org} (Alex Martelli) +W Christopher Martin @code{<wcm@@geek.ca.geac.com>} +Yanek Martinson @code{<yanek@@mthvax.cs.miami.edu>} +@code{jm@@aristote.univ-paris8.fr} (Jean Mehat) +@code{me@@halfab.freiburg.sub.org} (Udo Meyer) +@code{les@@chinet.chi.il.us} (Leslie Mikesell) +@code{mmitchel@@digi.lonestar.org} (Mitch Mitchell) +Emmanuel Mogenet @code{<mgix@@krainte.jpn.thomson-di.fr>} +@code{rmohr@@infoac.rmi.de} (Rupert Mohr) +Jason Molenda @code{<molenda@@sequent.com>} +@code{ianm@@icsbelf.co.uk} (Ian Moran) +@code{brian@@ilinx.wimsey.bc.ca} (Brian J. Murrell) +@code{service@@infohh.rmi.de} (Dirk Musstopf) +@code{lyndon@@cs.athabascau.ca} (Lyndon Nerenberg) +@code{rolf@@saans.north.de} (Rolf Nerstheimer) +@code{tom@@smart.bo.open.de} (Thomas Neumann) +@code{mnichols@@pacesetter.com} +Richard E. Nickle @code{<trystro!rick@@Think.COM>} +@code{stephan@@sunlab.ka.sub.org} (Stephan Niemz) +@code{nolan@@helios.unl.edu} (Michael Nolan) +david nugent @code{<david@@csource.oz.au>} +Jim O'Connor @code{<jim@@bahamut.fsc.com>} +Petri Ojala @code{<ojala@@funet.fi>} +@code{oneill@@cs.ulowell.edu} (Brian 'Doc' O'Neill) +@code{abekas!dragoman!mikep@@decwrl.dec.com} (Mike Park) +Tim Peiffer @code{peiffer@@cs.umn.edu} +@code{don@@blkhole.resun.com} (Don Phillips) +"Mark Pizzolato 415-369-9366" @code{<mark@@infocomm.com>} +John Plate @code{<plate@@infotek.dk>} +@code{dplatt@@ntg.com} (Dave Platt) +@code{eldorado@@tharr.UUCP} (Mark Powell) +Mark Powell @code{<mark@@inet-uk.co.uk>} +@code{pozar@@kumr.lns.com} (Tim Pozar) +@code{putsch@@uicc.com} (Jeff Putsch) +@code{ar@@nvmr.robin.de} (Andreas Raab) +Jarmo Raiha @code{<jarmo@@ksvltd.FI>} +Scott Reynolds @code{<scott@@clmqt.marquette.Mi.US>} +@code{mcr@@Sandelman.OCUnix.On.Ca} (Michael Richardson) +Kenji Rikitake @code{<kenji@@rcac.astem.or.jp>} +@code{arnold@@cc.gatech.edu} (Arnold Robbins) +@code{steve@@Nyongwa.cam.org} (Steve M. Robbins) +Serge Robyns @code{<sr@@denkart.be>} +Lawrence E. Rosenman @code{<ler@@lerami.lerctr.org>} +Jeff Ross @code{<jeff@@wisdom.bubble.org>} +Aleksey P. Rudnev @code{<alex@@kiae.su>} +"Heiko W.Rupp" @code{<hwr@@pilhuhn.ka.sub.org>} +@code{wolfgang@@wsrcc.com} (Wolfgang S. Rupprecht) +@code{tbr@@tfic.bc.ca} (Tom Rushworth) +@code{jsacco@@ssl.com} (Joseph E. Sacco) +@code{rsalz@@bbn.com} (Rich Salz) +@code{sojurn!mike@@hobbes.cert.sei.cmu.edu} (Mike Sangrey) +Nickolay Saukh @code{<nms@@ussr.EU.net>} +@code{heiko@@lotte.sax.de} (Heiko Schlittermann) +Eric Schnoebelen @code{<eric@@cirr.com>} +@code{russell@@alpha3.ersys.edmonton.ab.ca} (Russell Schulz) +@code{scott@@geom.umn.edu} +Igor V. Semenyuk @code{<iga@@argrd0.argonaut.su>} +Christopher Sawtell @code{<chris@@gerty.equinox.gen.nz>} +@code{schuler@@bds.sub.org} (Bernd Schuler) +@code{uunet!gold.sub.org!root} (Christian Seyb) +@code{s4mjs!mjs@@nirvo.nirvonics.com} (M. J. Shannon Jr.) +@code{peter@@ficc.ferranti.com} (Peter da Silva) +@code{vince@@victrola.sea.wa.us} (Vince Skahan) +@code{frumious!pat} (Patrick Smith) +@code{roscom!monty@@bu.edu} (Monty Solomon) +@code{sommerfeld@@orchard.medford.ma.us} (Bill Sommerfeld) +Julian Stacey @code{<stacey@@guug.de>} +Harlan Stenn @code{<harlan@@mumps.pfcs.com>} +Ralf Stephan @code{<ralf@@ark.abg.sub.org>} +@code{johannes@@titan.westfalen.de} (Johannes Stille) +@code{chs@@antic.apu.fi} (Hannu Strang) +@code{ralf@@reswi.ruhr.de} (Ralf E. Stranzenbach) +@code{sullivan@@Mathcom.com} (S. Sullivan) +Shigeya Suzuki @code{<shigeya@@dink.foretune.co.jp>} +@code{swiers@@plains.NoDak.edu} +Oleg Tabarovsky @code{<olg@@olghome.pccentre.msk.su>} +John Theus @code{<john@@theus.rain.com>} +@code{rd@@aii.com} (Bob Thrush) +ppKarsten Thygesen @code{<karthy@@dannug.dk>} +Graham Toal @code{<gtoal@@pizzabox.demon.co.uk>} +@code{rmtodd@@servalan.servalan.com} (Richard Todd) +Martin Tomes @code{<mt00@@controls.eurotherm.co.uk>} +Len Tower @code{<tower-prep@@ai.mit.edu>} +Mark Towfiq @code{<justice!towfiq@@Eingedi.Newton.MA.US>} +@code{mju@@mudos.ann-arbor.mi.us} (Marc Unangst) +Tomi Vainio @code{<tomppa@@fidata.fi>} +Andrew Vignaux @code{<ajv@@ferrari.datamark.co.nz>} +@code{vogel@@omega.ssw.de} (Andreas Vogel) +@code{jos@@bull.nl} (Jos Vos) +@code{jv@@nl.net} (Johan Vromans) +David Vrona @code{<dave@@sashimi.wwa.com>} +@code{Marcel.Waldvogel@@nice.usergroup.ethz.ch} (Marcel Waldvogel) +@code{steve@@nshore.org} (Stephen J. Walick) +@code{syd@@dsinc.dsi.com} (Syd Weinstein) +@code{gerben@@rna.indiv.nluug.nl} (Gerben Wierda) +@code{jbw@@cs.bu.edu} (Joe Wells) +@code{frnkmth!twwells.com!bill} (T. William Wells) +Peter Wemm @code{<Peter_Wemm@@zeus.dialix.oz.au>} +@code{mauxci!eci386!woods@@apple.com} (Greg A. Woods) +Michael Yu.Yaroslavtsev @code{<mike@@yaranga.ipmce.su>} +Alexei K. Yushin @code{<root@@july.elis.crimea.ua>} +@code{jon@@console.ais.org} (Jon Zeeff) +Matthias Zepf @code{<agnus@@amylnd.stgt.sub.org>} +Eric Ziegast @code{<uunet!ziegast>} +@end example + +@node Index (concepts), Index (configuration file), Acknowledgements, Top +@unnumbered Concept Index + +@printindex cp + +@node Index (configuration file), , Index (concepts), Top +@unnumbered Configuration File Index + +@printindex fn + +@contents +@bye diff --git a/gnu/libexec/uucp/libunix/MANIFEST b/gnu/libexec/uucp/libunix/MANIFEST index d64e79922046..c57f466fc988 100644 --- a/gnu/libexec/uucp/libunix/MANIFEST +++ b/gnu/libexec/uucp/libunix/MANIFEST @@ -8,8 +8,9 @@ basnam.c bytfre.c chmod.c cohtty.c -cwd.c +corrup.c cusub.c +cwd.c detach.c dirent.c dup2.c @@ -40,7 +41,9 @@ move.c opensr.c pause.c picksb.c +pipe.c portnm.c +priv.c proctm.c recep.c remove.c diff --git a/gnu/libexec/uucp/libunix/Makefile b/gnu/libexec/uucp/libunix/Makefile index 3a6750b17164..103c99d62e8b 100644 --- a/gnu/libexec/uucp/libunix/Makefile +++ b/gnu/libexec/uucp/libunix/Makefile @@ -1,16 +1,17 @@ # This subdirectory contains Unix specific support functions. -# $Id: Makefile,v 1.1 1993/08/05 18:23:34 conklin Exp $ +# $Id: Makefile,v 1.2 1994/05/07 18:10:03 ache Exp $ LIB= unix -SRCS= access.c addbas.c app3.c app4.c basnam.c bytfre.c cwd.c \ - chmod.c cohtty.c cusub.c detach.c efopen.c epopen.c exists.c \ - filnam.c fsusg.c indir.c init.c isdir.c isfork.c iswait.c \ - jobid.c lcksys.c link.c locfil.c lock.c loctim.c mail.c \ - mkdirs.c mode.c move.c opensr.c pause.c picksb.c portnm.c \ - proctm.c recep.c run.c seq.c serial.c signal.c sindir.c size.c \ - sleep.c spawn.c splcmd.c splnam.c spool.c srmdir.c statsb.c \ - status.c time.c tmpfil.c trunc.c uacces.c ufopen.c ultspl.c \ - unknwn.c uuto.c walk.c wldcrd.c work.c xqtfil.c xqtsub.c ftw.c +SRCS = access.c addbas.c app3.c app4.c basnam.c bytfre.c corrup.c \ + chmod.c cohtty.c cusub.c cwd.c detach.c efopen.c epopen.c \ + exists.c filnam.c fsusg.c indir.c init.c isdir.c isfork.c \ + iswait.c jobid.c lcksys.c link.c locfil.c lock.c loctim.c \ + mail.c mkdirs.c mode.c move.c opensr.c pause.c picksb.c pipe.c \ + portnm.c priv.c proctm.c recep.c run.c seq.c serial.c signal.c \ + sindir.c size.c sleep.c spawn.c splcmd.c splnam.c spool.c \ + srmdir.c statsb.c status.c time.c tmpfil.c trunc.c uacces.c \ + ufopen.c ultspl.c unknwn.c uuto.c walk.c wldcrd.c work.c \ + xqtfil.c xqtsub.c ftw.c CFLAGS+= -I$(.CURDIR)/../common_sources \ -DOWNER=\"$(owner)\" -DSBINDIR=\"$(sbindir)\" diff --git a/gnu/libexec/uucp/libunix/app3.c b/gnu/libexec/uucp/libunix/app3.c index 5c0b58938515..f3c3555a363d 100644 --- a/gnu/libexec/uucp/libunix/app3.c +++ b/gnu/libexec/uucp/libunix/app3.c @@ -19,7 +19,10 @@ zsappend3 (zdir1, zdir2, zfile) cdir2 = strlen (zdir2); cfile = strlen (zfile); zret = zbufalc (cdir1 + cdir2 + cfile + 3); - memcpy (zret, zdir1, cdir1); + if (cdir1 == 1 && *zdir1 == '/') + cdir1 = 0; + else + memcpy (zret, zdir1, cdir1); memcpy (zret + cdir1 + 1, zdir2, cdir2); memcpy (zret + cdir1 + cdir2 + 2, zfile, cfile); zret[cdir1] = '/'; diff --git a/gnu/libexec/uucp/libunix/app4.c b/gnu/libexec/uucp/libunix/app4.c index a3b3787f68fd..d3a243fd7285 100644 --- a/gnu/libexec/uucp/libunix/app4.c +++ b/gnu/libexec/uucp/libunix/app4.c @@ -21,7 +21,10 @@ zsappend4 (zdir1, zdir2, zdir3, zfile) cdir3 = strlen (zdir3); cfile = strlen (zfile); zret = zbufalc (cdir1 + cdir2 + cdir3 + cfile + 4); - memcpy (zret, zdir1, cdir1); + if (cdir1 == 1 && *zdir1 == '/') + cdir1 = 0; + else + memcpy (zret, zdir1, cdir1); memcpy (zret + cdir1 + 1, zdir2, cdir2); memcpy (zret + cdir1 + cdir2 + 2, zdir3, cdir3); memcpy (zret + cdir1 + cdir2 + cdir3 + 3, zfile, cfile); diff --git a/gnu/libexec/uucp/libunix/cohtty.c b/gnu/libexec/uucp/libunix/cohtty.c index a7aec1cae338..5a52df91e57c 100644 --- a/gnu/libexec/uucp/libunix/cohtty.c +++ b/gnu/libexec/uucp/libunix/cohtty.c @@ -37,6 +37,19 @@ * reset the serial device to see if the device needs to be re-enabled. */ +/* May 10, 1993: This function will always return true for the following + * reasons: + * 1) lock files have already been dealt with + * 2) if someone else already has the port open, uucico should fail anyways + * 3) Coherent's disable command return can return '0' or '1', but will + * succeed in any event. + * 4) It doesn't matter if there is a ttys entry for the port in question. + * /etc/ttys generally only lists devices that MAY be enabled for logins. + * If a device will never be used for logins, then there may not be a + * ttys entry, in which case, disable won't be called anyways. + * ---bob@mwc.com + */ + boolean fscoherent_disable_tty (zdevice, pzenable) const char *zdevice; @@ -130,14 +143,14 @@ char enable_device[16]; /* this will hold our device name + strlen (enable_device)); sprintf(*pzenable,"/dev/%s", enable_device); /* ulog(LOG_NORMAL,"Enable string is {%s}",*pzenable); */ - return(x==0? TRUE : FALSE); /* disable either failed - or succeded */ + return TRUE; }else{ - return FALSE; /* device in tty entry not enabled */ + /* device not enabled */ + return TRUE; } } } - return FALSE; /* no ttys entry found */ + return TRUE; /* no ttys entry found */ } /* The following is COHERENT 4.0 specific. It is used to test for any diff --git a/gnu/libexec/uucp/libunix/corrup.c b/gnu/libexec/uucp/libunix/corrup.c new file mode 100644 index 000000000000..87f19e668894 --- /dev/null +++ b/gnu/libexec/uucp/libunix/corrup.c @@ -0,0 +1,33 @@ +/* corrup.c + Save a file in the .Corrupt directory. */ + +#include "uucp.h" + +#include "sysdep.h" +#include "uudefs.h" +#include "system.h" + +char * +zsysdep_save_corrupt_file (zfile) + const char *zfile; +{ + const char *zslash; + char *zto; + + zslash = strrchr (zfile, '/'); + if (zslash == NULL) + zslash = zfile; + else + ++zslash; + + zto = zsappend3 (zSspooldir, CORRUPTDIR, zslash); + + if (! fsysdep_move_file (zfile, zto, TRUE, FALSE, FALSE, + (const char *) NULL)) + { + ubuffree (zto); + return NULL; + } + + return zto; +} diff --git a/gnu/libexec/uucp/libunix/cusub.c b/gnu/libexec/uucp/libunix/cusub.c index d1110fd5c7b4..6505a07ac639 100644 --- a/gnu/libexec/uucp/libunix/cusub.c +++ b/gnu/libexec/uucp/libunix/cusub.c @@ -1,7 +1,7 @@ /* cusub.c System dependent routines for cu. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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 cusub_rcsid[] = "$Id: cusub.c,v 1.1 1993/08/05 18:23:44 conklin Exp $"; +const char cusub_rcsid[] = "$Id: cusub.c,v 1.2 1994/05/07 18:10:14 ache Exp $"; #endif #include "uudefs.h" @@ -37,8 +37,40 @@ const char cusub_rcsid[] = "$Id: cusub.c,v 1.1 1993/08/05 18:23:44 conklin Exp $ #include "conn.h" #include "prot.h" +#if HAVE_FCNTL_H +#include <fcntl.h> +#else +#if HAVE_SYS_FILE_H +#include <sys/file.h> +#endif +#endif + +/* Get definitions for both O_NONBLOCK and O_NDELAY. */ +#ifndef O_NDELAY +#ifdef FNDELAY +#define O_NDELAY FNDELAY +#else /* ! defined (FNDELAY) */ +#define O_NDELAY 0 +#endif /* ! defined (FNDELAY) */ +#endif /* ! defined (O_NDELAY) */ + +#ifndef O_NONBLOCK +#ifdef FNBLOCK +#define O_NONBLOCK FNBLOCK +#else /* ! defined (FNBLOCK) */ +#define O_NONBLOCK 0 +#endif /* ! defined (FNBLOCK) */ +#endif /* ! defined (O_NONBLOCK) */ + #include <errno.h> +/* 4.2 systems don't define SIGUSR2. This should work for them. On + systems which are missing SIGUSR1, or SIGURG, you must find two + signals which you can safely use. */ +#ifndef SIGUSR2 +#define SIGUSR2 SIGURG +#endif + /* Get definitions for EAGAIN, EWOULDBLOCK and ENODATA. */ #ifndef EAGAIN #ifndef EWOULDBLOCK @@ -69,6 +101,7 @@ static char bStstp; static const char *zsport_line P((const struct uuconf_port *qport)); static void uscu_child P((struct sconnection *qconn, int opipe)); +static RETSIGTYPE uscu_child_handler P((int isig)); static RETSIGTYPE uscu_alarm P((int isig)); static int cscu_escape P((char *pbcmd, const char *zlocalname)); static RETSIGTYPE uscu_alarm_kill P((int isig)); @@ -97,6 +130,7 @@ zsport_line (qport) break; case UUCONF_PORTTYPE_TCP: case UUCONF_PORTTYPE_TLI: + case UUCONF_PORTTYPE_PIPE: return NULL; } @@ -556,7 +590,9 @@ uscu_child (qconn, opipe) CATCH_PROTECT int cwrite; CATCH_PROTECT char abbuf[1024]; - /* It would be nice if we could just use fsserial_read, but that + fgot = FALSE; + + /* It would be nice if we could just use fsysdep_conn_read, but that will log signals that we don't want logged. There should be a generic way to extract the file descriptor from the port. */ if (qconn->qport == NULL) @@ -571,8 +607,12 @@ uscu_child (qconn, opipe) oport = -1; break; #endif + case UUCONF_PORTTYPE_PIPE: + /* A read of 0 on a pipe always means EOF (see below). */ + fgot = TRUE; + /* Fall through. */ case UUCONF_PORTTYPE_STDIN: - oport = 0; + oport = ((struct ssysdep_conn *) qconn->psysdep)->ord; break; case UUCONF_PORTTYPE_MODEM: case UUCONF_PORTTYPE_DIRECT: @@ -583,6 +623,10 @@ uscu_child (qconn, opipe) } } + /* Force the descriptor into blocking mode. */ + (void) fcntl (oport, F_SETFL, + fcntl (oport, F_GETFL, 0) &~ (O_NDELAY | O_NONBLOCK)); + usset_signal (SIGUSR1, uscu_child_handler, TRUE, (boolean *) NULL); usset_signal (SIGUSR2, uscu_child_handler, TRUE, (boolean *) NULL); usset_signal (SIGINT, SIG_IGN, TRUE, (boolean *) NULL); @@ -591,7 +635,6 @@ uscu_child (qconn, opipe) usset_signal (SIGTERM, uscu_child_handler, TRUE, (boolean *) NULL); fstopped = FALSE; - fgot = FALSE; iSchild_sig = 0; cwrite = 0; @@ -792,7 +835,7 @@ fsysdep_terminal_raw (flocalecho) sSterm_new.c_lflag &=~ (ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHONL); else sSterm_new.c_lflag &=~ (ICANON | ISIG); - sSterm_new.c_iflag &=~ (INLCR | IGNCR | ICRNL); + sSterm_new.c_iflag &=~ (INLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY); sSterm_new.c_oflag &=~ (OPOST); sSterm_new.c_cc[VMIN] = 1; sSterm_new.c_cc[VTIME] = 0; @@ -808,7 +851,7 @@ fsysdep_terminal_raw (flocalecho) (ICANON | IEXTEN | ISIG | ECHO | ECHOE | ECHOK | ECHONL); else sSterm_new.c_lflag &=~ (ICANON | IEXTEN | ISIG); - sSterm_new.c_iflag &=~ (INLCR | IGNCR | ICRNL); + sSterm_new.c_iflag &=~ (INLCR | IGNCR | ICRNL | IXON | IXOFF); sSterm_new.c_oflag &=~ (OPOST); sSterm_new.c_cc[VMIN] = 1; sSterm_new.c_cc[VTIME] = 0; @@ -1094,8 +1137,9 @@ fsysdep_shell (qconn, zcmd, tcmd) oread = owrite = -1; break; case UUCONF_PORTTYPE_STDIN: - oread = 0; - owrite = 1; + case UUCONF_PORTTYPE_PIPE: + oread = ((struct ssysdep_conn *) qconn->psysdep)->ord; + owrite = ((struct ssysdep_conn *) qconn->psysdep)->owr; break; case UUCONF_PORTTYPE_MODEM: case UUCONF_PORTTYPE_DIRECT: diff --git a/gnu/libexec/uucp/libunix/cwd.c b/gnu/libexec/uucp/libunix/cwd.c index 433025db6c3a..71d05d11f545 100644 --- a/gnu/libexec/uucp/libunix/cwd.c +++ b/gnu/libexec/uucp/libunix/cwd.c @@ -24,14 +24,17 @@ fsysdep_needs_cwd (zfile) consistent with other UUCP packages. */ char * -zsysdep_local_file_cwd (zfile, zpubdir) +zsysdep_local_file_cwd (zfile, zpubdir, pfbadname) const char *zfile; const char *zpubdir; + boolean *pfbadname; { + if (pfbadname != NULL) + *pfbadname = FALSE; if (*zfile == '/') return zbufcpy (zfile); else if (*zfile == '~') - return zsysdep_local_file (zfile, zpubdir); + return zsysdep_local_file (zfile, zpubdir, pfbadname); else return zsysdep_add_cwd (zfile); } diff --git a/gnu/libexec/uucp/libunix/detach.c b/gnu/libexec/uucp/libunix/detach.c index 73144da001d4..9b505af499cc 100644 --- a/gnu/libexec/uucp/libunix/detach.c +++ b/gnu/libexec/uucp/libunix/detach.c @@ -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. */ #include "uucp.h" @@ -100,11 +100,15 @@ usysdep_detach () while (getppid () != 1) sleep (1); - ulog_id (getpid ()); + ipid = getpid (); + ulog_id (ipid); /* Restore SIGHUP catcher if it wasn't being ignored. */ if (! fignored) usset_signal (SIGHUP, ussignal, TRUE, (boolean *) NULL); + + DEBUG_MESSAGE2 (DEBUG_PORT, "Forked; old PID %ld, new pid %ld", + (long) igrp, (long) ipid); } #if ! HAVE_SETSID && HAVE_TIOCNOTTY @@ -146,7 +150,7 @@ usysdep_detach () setpgrp (0, 0) will set our process group to 0 so that we can acquire a new controlling terminal (TIOCNOTTY may or may not have already done that anyhow). */ -#if HAVE_BSD_SETPGRP +#if HAVE_BSD_PGRP if (setpgrp (0, 0) < 0) #else if (setpgrp () < 0) diff --git a/gnu/libexec/uucp/libunix/dirent.c b/gnu/libexec/uucp/libunix/dirent.c index 83db496cabbd..c7e467ec1b1a 100644 --- a/gnu/libexec/uucp/libunix/dirent.c +++ b/gnu/libexec/uucp/libunix/dirent.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/dup2.c b/gnu/libexec/uucp/libunix/dup2.c index 6a7359fe92e8..d1454205125b 100644 --- a/gnu/libexec/uucp/libunix/dup2.c +++ b/gnu/libexec/uucp/libunix/dup2.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/epopen.c b/gnu/libexec/uucp/libunix/epopen.c index dec1b3999d64..8c1f5cd0d854 100644 --- a/gnu/libexec/uucp/libunix/epopen.c +++ b/gnu/libexec/uucp/libunix/epopen.c @@ -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. */ #include "uucp.h" @@ -56,7 +56,7 @@ espopen (pazargs, frd, pipid) } aidescs[2] = SPAWN_NULL; - ipid = ixsspawn (pazargs, aidescs, FALSE, FALSE, + ipid = ixsspawn (pazargs, aidescs, TRUE, FALSE, (const char *) NULL, FALSE, TRUE, (const char *) NULL, (const char *) NULL, (const char *) NULL); diff --git a/gnu/libexec/uucp/libunix/filnam.c b/gnu/libexec/uucp/libunix/filnam.c index 62054767b89a..0b234c06dcca 100644 --- a/gnu/libexec/uucp/libunix/filnam.c +++ b/gnu/libexec/uucp/libunix/filnam.c @@ -1,7 +1,7 @@ /* filnam.c Get names to use for UUCP files. - 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. */ #include "uucp.h" @@ -62,7 +62,7 @@ extern off_t lseek (); #endif #define ZCHARS \ - "0123456789ABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* Local functions. */ diff --git a/gnu/libexec/uucp/libunix/fsusg.c b/gnu/libexec/uucp/libunix/fsusg.c index e2b40a8ad5a5..116ab88fc187 100644 --- a/gnu/libexec/uucp/libunix/fsusg.c +++ b/gnu/libexec/uucp/libunix/fsusg.c @@ -1,5 +1,5 @@ /* fsusage.c -- return space usage of mounted filesystems - Copyright (C) 1991, 1992 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,11 +19,10 @@ for use with Taylor UUCP. */ #include "uucp.h" +#include "uudefs.h" #include "sysdep.h" #include "fsusg.h" -int statfs (); - #if STAT_STATFS2_BSIZE #ifndef _IBMR2 /* 4.3BSD, SunOS 4, HP-UX, AIX PS/2. */ #include <sys/vfs.h> @@ -52,16 +51,19 @@ int statfs (); #endif #endif -#ifdef _AIX -#ifdef _I386 /* AIX PS/2. */ +#if STAT_DUSTAT /* AIX PS/2. */ #include <sys/stat.h> #include <sys/dustat.h> #endif -#endif #if STAT_STATVFS /* SVR4. */ #include <sys/statvfs.h> -int statvfs (); +#endif + +#if STAT_DISK_SPACE /* QNX. */ +#include <sys/disk.h> +#include <fcntl.h> +#include <errno.h> #endif #define STAT_NONE 0 @@ -71,7 +73,9 @@ int statvfs (); #if ! STAT_STATFS2_FSIZE #if ! STAT_STATFS2_FS_DATA #if ! STAT_STATFS4 +#if ! STAT_DUSTAT #if ! STAT_USTAT +#if ! STAT_DISK_SPACE #undef STAT_NONE #define STAT_NONE 1 #endif @@ -80,9 +84,13 @@ int statvfs (); #endif #endif #endif +#endif +#endif #if ! STAT_NONE +static long adjust_blocks P((long blocks, int fromsize, int tosize)); + /* Return the number of TOSIZE-byte blocks used by BLOCKS FROMSIZE-byte blocks, rounding up. */ @@ -121,7 +129,7 @@ get_fs_usage (path, disk, fsp) if (statfs (path, &fsd) != 1) return -1; -#define convert_blocks(b) adjust_blocks ((b), 1024, 512) +#define convert_blocks(b) adjust_blocks ((long) (b), 1024, 512) fsp->fsu_blocks = convert_blocks (fsd.fd_req.btot); fsp->fsu_bfree = convert_blocks (fsd.fd_req.bfree); fsp->fsu_bavail = convert_blocks (fsd.fd_req.bfreen); @@ -129,7 +137,7 @@ get_fs_usage (path, disk, fsp) fsp->fsu_ffree = fsd.fd_req.gfree; #endif -#if STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX. */ +#if STAT_STATFS2_BSIZE || STAT_DUSTAT /* 4.3BSD, SunOS 4, HP-UX, AIX. */ struct statfs fsd; if (statfs (path, &fsd) < 0) @@ -169,23 +177,94 @@ get_fs_usage (path, disk, fsp) adjust_blocks ((b), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512) #endif +#if STAT_DISK_SPACE /* QNX. */ + int o; + int iret; + long cfree_blocks, ctotal_blocks; + char *zpath; + char *zslash; + + zpath = zbufcpy (path); + while ((o = open (zpath, O_RDONLY, 0)) == -1 + && errno == ENOENT) + { + /* The named file doesn't exist, so we can't open it. Try the + directory containing it. */ + if ((strcmp ("/", zpath) == 0) + || (strcmp (zpath, ".") == 0) + || (strcmp (zpath, "") == 0) + /* QNX peculiarity: "//2" means root on node 2 */ + || ((strncmp (zpath, "//", 2) == 0) + && (strchr (zpath + 2, '/') == NULL))) + { + /* We can't shorten this! */ + break; + } + + /* Shorten the pathname by one component and try again. */ + zslash = strrchr (zpath, '/'); + if (zslash == NULL) + { + /* Try the current directory. We can open directories. */ + zpath[0] = '.'; + zpath[1] = '\0'; + } + else if (zslash == zpath) + { + /* Try the root directory. */ + zpath[0] = '/'; + zpath[1] = '\0'; + } + else + { + /* Chop off last path component. */ + zslash[0] = '\0'; + } + } + if (o == -1) + { + ulog (LOG_ERROR, "get_fs_usage: open (%s) failed: %s", zpath, + strerror (errno)); + ubuffree (zpath); + return -1; + } + ubuffree (zpath); + + iret = disk_space (o, &cfree_blocks, &ctotal_blocks); + (void) close (o); + if (iret == -1) + { + ulog (LOG_ERROR, "get_fs_usage: disk_space failed: %s", + strerror (errno)); + return -1; + } + + fsp->fsu_blocks = ctotal_blocks; + fsp->fsu_bfree = cfree_blocks; + fsp->fsu_bavail = cfree_blocks; + + /* QNX has no limit on the number of inodes. Most inodes are stored + directly in the directory entry. */ + fsp->fsu_files = -1; + fsp->fsu_ffree = -1; +#endif /* STAT_DISK_SPACE */ + #if STAT_USTAT - { - struct stat sstat; - struct ustat s; + struct stat sstat; + struct ustat s; - if (stat (path, &sstat) < 0 - || ustat (sstat.st_dev, &s) < 0) - return -1; - fsp->fsu_blocks = -1; - fsp->fsu_bfree = f_tfree; - fsp->fsu_bavail = f_tfree; - fsp->fsu_files = -1; - fsp->fsu_ffree = -1; - } + if (stat (path, &sstat) < 0 + || ustat (sstat.st_dev, &s) < 0) + return -1; + fsp->fsu_blocks = -1; + fsp->fsu_bfree = s.f_tfree; + fsp->fsu_bavail = s.f_tfree; + fsp->fsu_files = -1; + fsp->fsu_ffree = -1; #endif #if ! STAT_STATFS2_FS_DATA /* ! Ultrix */ +#if ! STAT_DISK_SPACE #if ! STAT_USTAT #if ! STAT_NONE fsp->fsu_blocks = convert_blocks (fsd.f_blocks); @@ -196,12 +275,12 @@ get_fs_usage (path, disk, fsp) #endif #endif #endif +#endif return 0; } -#ifdef _AIX -#ifdef _I386 +#if STAT_DUSTAT /* AIX PS/2 does not supply statfs. */ int @@ -227,5 +306,4 @@ statfs (path, fsb) fsb->f_fsid.val[1] = fsd.du_pckno; return 0; } -#endif -#endif /* _AIX && _I386 */ +#endif /* STAT_DUSTAT */ diff --git a/gnu/libexec/uucp/libunix/ftw.c b/gnu/libexec/uucp/libunix/ftw.c index c3372b53ca48..c7af06e04f02 100644 --- a/gnu/libexec/uucp/libunix/ftw.c +++ b/gnu/libexec/uucp/libunix/ftw.c @@ -17,7 +17,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -Modified by Ian Lanc Taylor for Taylor UUCP, June 1992. */ +Modified by Ian Lance Taylor for Taylor UUCP, June 1992, and October 1993. */ #include "uucp.h" @@ -63,7 +63,7 @@ ftw_dir (dirs, level, descriptors, dir, len, func) int descriptors; char *dir; size_t len; - int (*func) P((const char *file, const struct stat *status, int flag)); + int (*func) P((const char *file, struct stat *status, int flag)); { int got; struct dirent *entry; @@ -177,7 +177,7 @@ ftw_dir (dirs, level, descriptors, dir, len, func) int ftw (dir, func, descriptors) const char *dir; - int (*func) P((const char *file, const struct stat *status, int flag)); + int (*func) P((const char *file, struct stat *status, int flag)); int descriptors; { DIR **dirs; @@ -234,7 +234,11 @@ ftw (dir, func, descriptors) if (flag == FTW_D) { if (ret == 0) - ret = ftw_dir (dirs, 0, descriptors, buf, len, func); + { + if (len == 1 && *buf == '/') + len = 0; + ret = ftw_dir (dirs, 0, descriptors, buf, len, func); + } if (dirs[0] != NULL) { int save; diff --git a/gnu/libexec/uucp/libunix/indir.c b/gnu/libexec/uucp/libunix/indir.c index 2484ec23f85d..de1df702cc53 100644 --- a/gnu/libexec/uucp/libunix/indir.c +++ b/gnu/libexec/uucp/libunix/indir.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/init.c b/gnu/libexec/uucp/libunix/init.c index d4a137762813..95822db11684 100644 --- a/gnu/libexec/uucp/libunix/init.c +++ b/gnu/libexec/uucp/libunix/init.c @@ -1,7 +1,7 @@ /* init.c Initialize the system dependent routines. - 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. */ #include "uucp.h" @@ -153,35 +153,39 @@ usysdep_initialize (puuconf,iflags) pointer puuconf; int iflags; { - int cdescs; - int o; int iuuconf; char *z; struct passwd *q; ulog_id (getpid ()); - /* Close everything but stdin, stdout and stderr. */ + if ((iflags & INIT_NOCLOSE) == 0) + { + int cdescs; + int o; + + /* Close everything but stdin, stdout and stderr. */ #if HAVE_GETDTABLESIZE - cdescs = getdtablesize (); + cdescs = getdtablesize (); #else #if HAVE_SYSCONF - cdescs = sysconf (_SC_OPEN_MAX); + cdescs = sysconf (_SC_OPEN_MAX); #else #ifdef OPEN_MAX - cdescs = OPEN_MAX; + cdescs = OPEN_MAX; #else #ifdef NOFILE - cdescs = NOFILE; + cdescs = NOFILE; #else - cdescs = 20; + cdescs = 20; #endif /* ! defined (NOFILE) */ #endif /* ! defined (OPEN_MAX) */ #endif /* ! HAVE_SYSCONF */ #endif /* ! HAVE_GETDTABLESIZE */ - for (o = 3; o < cdescs; o++) - (void) close (o); + for (o = 3; o < cdescs; o++) + (void) close (o); + } /* Make sure stdin, stdout and stderr are open. */ if (fcntl (0, F_GETFD, 0) < 0 diff --git a/gnu/libexec/uucp/libunix/iswait.c b/gnu/libexec/uucp/libunix/iswait.c index d2610aa1f8bd..aa855151c926 100644 --- a/gnu/libexec/uucp/libunix/iswait.c +++ b/gnu/libexec/uucp/libunix/iswait.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/jobid.c b/gnu/libexec/uucp/libunix/jobid.c index 7f22f1d37d75..c8b21cbcf21f 100644 --- a/gnu/libexec/uucp/libunix/jobid.c +++ b/gnu/libexec/uucp/libunix/jobid.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/lcksys.c b/gnu/libexec/uucp/libunix/lcksys.c index 4ece16afe7b5..c1b0efaa3b9e 100644 --- a/gnu/libexec/uucp/libunix/lcksys.c +++ b/gnu/libexec/uucp/libunix/lcksys.c @@ -8,20 +8,32 @@ #include "sysdep.h" #include "system.h" +/* Get the name of a system lock file. */ + +static char *zssys_lock_name P((const struct uuconf_system *qsys, char *z)); + +#define LOCKNAMELEN (sizeof "LCK..12345678") + +static char * +zssys_lock_name (qsys, z) + const struct uuconf_system *qsys; + char *z; +{ + strcpy (z, "LCK.."); + strncpy (z + sizeof "LCK.." - 1, qsys->uuconf_zname, 8); + z[sizeof "LCK.." - 1 + 8] = '\0'; + return z; +} + /* Lock a remote system. */ boolean fsysdep_lock_system (qsys) const struct uuconf_system *qsys; { - char *z; - boolean fret; - - z = zbufalc (strlen (qsys->uuconf_zname) + sizeof "LCK.."); - sprintf (z, "LCK..%.8s", qsys->uuconf_zname); - fret = fsdo_lock (z, FALSE, (boolean *) NULL); - ubuffree (z); - return fret; + char ab[LOCKNAMELEN]; + + return fsdo_lock (zssys_lock_name (qsys, ab), FALSE, (boolean *) NULL); } /* Unlock a remote system. */ @@ -30,12 +42,7 @@ boolean fsysdep_unlock_system (qsys) const struct uuconf_system *qsys; { - char *z; - boolean fret; - - z = zbufalc (strlen (qsys->uuconf_zname) + sizeof "LCK.."); - sprintf (z, "LCK..%.8s", qsys->uuconf_zname); - fret = fsdo_unlock (z, FALSE); - ubuffree (z); - return fret; + char ab[LOCKNAMELEN]; + + return fsdo_unlock (zssys_lock_name (qsys, ab), FALSE); } diff --git a/gnu/libexec/uucp/libunix/locfil.c b/gnu/libexec/uucp/libunix/locfil.c index 0e05af9bcee9..1c4db66520a6 100644 --- a/gnu/libexec/uucp/libunix/locfil.c +++ b/gnu/libexec/uucp/libunix/locfil.c @@ -1,7 +1,7 @@ /* locfil.c Expand a file name on the local system. - 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. */ #include "uucp.h" @@ -41,12 +41,16 @@ extern struct passwd *getpwnam (); and moving any other type of file into the public directory. */ char * -zsysdep_local_file (zfile, zpubdir) +zsysdep_local_file (zfile, zpubdir, pfbadname) const char *zfile; const char *zpubdir; + boolean *pfbadname; { const char *zdir; + if (pfbadname != NULL) + *pfbadname = FALSE; + if (*zfile == '/') return zbufcpy (zfile); @@ -79,6 +83,8 @@ zsysdep_local_file (zfile, zpubdir) { ulog (LOG_ERROR, "User %s not found", zcopy); ubuffree (zcopy); + if (pfbadname != NULL) + *pfbadname = TRUE; return NULL; } ubuffree (zcopy); diff --git a/gnu/libexec/uucp/libunix/lock.c b/gnu/libexec/uucp/libunix/lock.c index d823213017b6..4011534291d7 100644 --- a/gnu/libexec/uucp/libunix/lock.c +++ b/gnu/libexec/uucp/libunix/lock.c @@ -1,7 +1,7 @@ /* lock.c Lock and unlock a file name. - 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 lock_rcsid[] = "$Id: lock.c,v 1.1 1993/08/05 18:24:06 conklin Exp $"; +const char lock_rcsid[] = "$Id: lock.c,v 1.2 1994/05/07 18:10:40 ache Exp $"; #endif #include "uudefs.h" @@ -43,6 +43,19 @@ const char lock_rcsid[] = "$Id: lock.c,v 1.1 1993/08/05 18:24:06 conklin Exp $"; #endif #endif +#if TM_IN_SYS_TIME +#include <sys/time.h> +#else +#include <time.h> +#endif + +#if HAVE_QNX_LOCKFILES +#include <sys/kernel.h> +#include <sys/psinfo.h> +#include <sys/seginfo.h> +#include <sys/vc.h> +#endif + #ifndef O_RDONLY #define O_RDONLY 0 #define O_WRONLY 1 @@ -56,6 +69,15 @@ const char lock_rcsid[] = "$Id: lock.c,v 1.1 1993/08/05 18:24:06 conklin Exp $"; #ifndef SEEK_SET #define SEEK_SET 0 #endif + +#ifndef localtime +extern struct tm *localtime (); +#endif + +#if HAVE_QNX_LOCKFILES +static boolean fsqnx_stale P((unsigned long ipid, unsigned long inme, + unsigned long inid, boolean *pferr)); +#endif /* Lock something. If the fspooldir argument is TRUE, the argument is a file name relative to the spool directory; otherwise the argument @@ -73,13 +95,19 @@ fsdo_lock (zlock, fspooldir, pferr) size_t cslash; pid_t ime; char *ztempfile; - char abtempfile[sizeof "TMP1234567890"]; + char abtempfile[sizeof "TMP12345678901234567890"]; int o; +#if HAVE_QNX_LOCKFILES + nid_t inme; + char ab[23]; + char *zend; +#else #if HAVE_V2_LOCKFILES int i; #else char ab[12]; #endif +#endif int cwrote; const char *zerr; boolean fret; @@ -99,6 +127,9 @@ fsdo_lock (zlock, fspooldir, pferr) } ime = getpid (); +#if HAVE_QNX_LOCKFILES + inme = getnid (); +#endif /* We do the actual lock by creating a file and then linking it to the final file name we want. This avoids race conditions due to @@ -114,7 +145,12 @@ fsdo_lock (zlock, fspooldir, pferr) else cslash = zslash - zpath + 1; +#if HAVE_QNX_LOCKFILES + sprintf (abtempfile, "TMP%010lx%010lx", (unsigned long) ime, + (unsigned long) inme); +#else sprintf (abtempfile, "TMP%010lx", (unsigned long) ime); +#endif ztempfile = zbufalc (cslash + sizeof abtempfile); memcpy (ztempfile, zpath, cslash); memcpy (ztempfile + cslash, abtempfile, sizeof abtempfile); @@ -141,13 +177,18 @@ fsdo_lock (zlock, fspooldir, pferr) } } +#if HAVE_QNX_LOCKFILES + sprintf (ab, "%10ld %10ld\n", (long) ime, (long) inid); + cwrote = write (o, ab, strlen (ab)); +#else #if HAVE_V2_LOCKFILES - i = ime; + i = (int) ime; cwrote = write (o, &i, sizeof i); #else - sprintf (ab, "%10d\n", (int) ime); + sprintf (ab, "%10ld\n", (long) ime); cwrote = write (o, ab, strlen (ab)); #endif +#endif zerr = NULL; if (cwrote < 0) @@ -177,8 +218,13 @@ fsdo_lock (zlock, fspooldir, pferr) while (link (ztempfile, zpath) != 0) { int cgot; - int ipid; + pid_t ipid; boolean freadonly; + struct stat st; + char abtime[sizeof "1991-12-31 12:00:00"]; +#if HAVE_QNX_LOCKFILES + nid_t inid; +#endif fret = FALSE; @@ -228,11 +274,17 @@ fsdo_lock (zlock, fspooldir, pferr) break; } +#if HAVE_QNX_LOCKFILES + ab[cgot] = '\0'; + ipid = (pid_t) strtol (ab, &zend, 10); + inid = (nid_t) strtol (zend, (char **) NULL, 10); +#else #if HAVE_V2_LOCKFILES - ipid = i; + ipid = (pid_t) i; #else ab[cgot] = '\0'; - ipid = strtol (ab, (char **) NULL, 10); + ipid = (pid_t) strtol (ab, (char **) NULL, 10); +#endif #endif /* On NFS, the link might have actually succeeded even though we @@ -247,18 +299,49 @@ fsdo_lock (zlock, fspooldir, pferr) going to worry about this possibility. */ if (ipid == ime) { - fret = TRUE; - break; +#if HAVE_QNX_LOCKFILES + if (inid == inme) +#endif + { + fret = TRUE; + break; + } } +#if HAVE_QNX_LOCKFILES + if (! fsqnx_stale ((unsigned long) ipid, (unsigned long) inme, + (unsigned long) inid, pferr)) + break; +#else /* If the process still exists, we will get EPERM rather than ESRCH. We then return FALSE to indicate that we cannot make the lock. */ if (kill (ipid, 0) == 0 || errno == EPERM) break; +#endif - ulog (LOG_ERROR, "Found stale lock %s held by process %d", - zpath, ipid); + if (fstat (o, &st) < 0) + strcpy (abtime, "unknown"); + else + { + time_t itm; + struct tm *q; + + itm = (time_t) st.st_mtime; + q = localtime (&itm); + sprintf (abtime, "%04d-%02d-%02d %02d:%02d:%02d", + q->tm_year + 1900, q->tm_mon + 1, q->tm_mday, q->tm_hour, + q->tm_min, q->tm_sec); + } + +#if HAVE_QNX_LOCKFILES + ulog (LOG_ERROR, + "Stale lock %s held by process %ld on node %ld created %s", + zpath, (long) ipid, (long) inid, abtime); +#else + ulog (LOG_ERROR, "Stale lock %s held by process %ld created %s", + zpath, (long) ipid, abtime); +#endif /* This is a stale lock, created by a process that no longer exists. @@ -317,6 +400,7 @@ fsdo_lock (zlock, fspooldir, pferr) (void) close (o); o = -1; (void) remove (zpath); + fret = TRUE; continue; } @@ -326,13 +410,18 @@ fsdo_lock (zlock, fspooldir, pferr) break; } +#if HAVE_QNX_LOCKFILES + sprintf (ab, "%10ld %10ld\n", (long) ime, (long) inid); + cwrote = write (o, ab, strlen (ab)); +#else #if HAVE_V2_LOCKFILES - i = ime; + i = (int) ime; cwrote = write (o, &i, sizeof i); #else - sprintf (ab, "%10d\n", (int) ime); + sprintf (ab, "%10ld\n", (long) ime); cwrote = write (o, ab, strlen (ab)); #endif +#endif if (cwrote < 0) { @@ -360,52 +449,63 @@ fsdo_lock (zlock, fspooldir, pferr) break; } +#if HAVE_QNX_LOCKFILES + ab[cgot] = '\0'; + ipid = (pid_t) strtol (ab, &zend, 10); + inid = (nid_t) strtol (zend, (char **) NULL, 10); +#else #if HAVE_V2_LOCKFILES - ipid = i; + ipid = (pid_t) i; #else ab[cgot] = '\0'; - ipid = strtol (ab, (char **) NULL, 10); + ipid = (pid_t) strtol (ab, (char **) NULL, 10); +#endif #endif if (ipid == ime) { - struct stat sfile, sdescriptor; - - /* It looks like we have the lock. Do the final stat - check. */ - if (stat ((char *) zpath, &sfile) < 0) - { - if (errno != ENOENT) - { - zerr = "stat"; - break; - } - /* Loop around and try again. */ - } - else +#if HAVE_QNX_LOCKFILES + if (inid == inme) +#endif { - if (fstat (o, &sdescriptor) < 0) + struct stat sfile, sdescriptor; + + /* It looks like we have the lock. Do the final stat + check. */ + if (stat ((char *) zpath, &sfile) < 0) { - zerr = "fstat"; - break; + if (errno != ENOENT) + { + zerr = "stat"; + break; + } + /* Loop around and try again. */ } - - if (sfile.st_ino == sdescriptor.st_ino - && sfile.st_dev == sdescriptor.st_dev) + else { - /* Close the file before assuming we've succeeded to - pick up any trailing errors. */ - if (close (o) < 0) + if (fstat (o, &sdescriptor) < 0) { - zerr = "close"; + zerr = "fstat"; break; } - o = -1; - - /* We have the lock. */ - fret = TRUE; - break; + if (sfile.st_ino == sdescriptor.st_ino + && sfile.st_dev == sdescriptor.st_dev) + { + /* Close the file before assuming we've + succeeded to pick up any trailing errors. */ + if (close (o) < 0) + { + zerr = "close"; + break; + } + + o = -1; + + /* We have the lock. */ + fret = TRUE; + break; + } } } } @@ -475,3 +575,90 @@ fsdo_unlock (zlock, fspooldir) return FALSE; } } + +#if HAVE_QNX_LOCKFILES + +/* Return TRUE if the lock is stale. */ + +static boolean +fsqnx_stale (ipid, inme, inid, pferr) + unsigned long ipid; + unsigned long inme; + unsigned long inid; + boolean *pferr; +{ + /* A virtual process ID. This virtual process ID, which will exist + on the local node, will represent the process ID of the process + manager process (Proc) on the remote node. */ + pid_t ivid; + /* The return value of the qnx_psinfo function. This is either a + process ID which might or might not be the same as the process + being looked for, or -1 to indicate no process found. */ + pid_t ifound_pid; + /* This holds the actual result of qnx_psinfo. We will ignore + almost all the fields since we're just checking for existence. */ + struct _psinfo spsdata; + + /* Establish connection with a remote process manager if necessary. */ + if (inid != inme) + { + ivid = qnx_vc_attach (inid /* remote node ID */, + PROC_PID /* pid of process manager */, + 1000 /* initial buffer size */, + 0 /* flags */); + if (ivid < 0) + { + ulog (LOG_ERROR, "qnx_vc_attach (%lu, PROC_PID): %s", + inid, strerror (errno)); + if (pferr != NULL) + *pferr = TRUE; + return FALSE; + } + } + else + { + /* Use the local pid of the local process manager. */ + ivid = PROC_PID; + } + + /* Request the process information. */ + ifound_pid = qnx_psinfo (ivid /* process manager handling request */, + ipid /* get info on this process */, + &spsdata /* put info in this struct */, + 0 /* unused */, + (struct _seginfo *) NULL /* unused */); + + /* Deallocate the virtual connection before continuing. */ + { + int isaved_errno = errno; + if (qnx_vc_detach (ivid) < 0) + ulog (LOG_ERROR, "qnx_vd_detach (%ld): %s", (long) ivid, + strerror (errno)); + errno = isaved_errno; + } + + /* If the returned pid matches then the process still holds the lock. */ + if ((ifound_pid == ipid) && (spsdata.pid == ipid)) + return FALSE; + + /* If the returned pid is positive and doesn't match, then the + process doesn't exist and the lock is stale. Continue. */ + + /* If the returned pid is negative (-1) and errno is EINVAL (or ESRCH + in older versions of QNX), then the process doesn't exist and the + lock is stale. Continue. */ + + /* Check for impossible errors. */ + if ((ifound_pid < 0) && (errno != ESRCH) && (errno != EINVAL)) + { + ulog (LOG_ERROR, "qnx_psinfo (%ld, %ld): %s", (long) ivid, + (long) ipid, strerror (errno)); + /* Since we don't know what the hell this means, and we don't + want our system to freeze, we treat this case as a stale + lock. Continue on. */ + } + + return TRUE; +} + +#endif /* HAVE_QNX_LOCKFILES */ diff --git a/gnu/libexec/uucp/libunix/loctim.c b/gnu/libexec/uucp/libunix/loctim.c index da5f32e2d273..7f1f87aa671c 100644 --- a/gnu/libexec/uucp/libunix/loctim.c +++ b/gnu/libexec/uucp/libunix/loctim.c @@ -3,7 +3,9 @@ #include "uucp.h" -#if HAVE_TIME_H +#if TM_IN_SYS_TIME +#include <sys/time.h> +#else #include <time.h> #endif diff --git a/gnu/libexec/uucp/libunix/mail.c b/gnu/libexec/uucp/libunix/mail.c index 74c1aa95adc6..e1fbaa92afee 100644 --- a/gnu/libexec/uucp/libunix/mail.c +++ b/gnu/libexec/uucp/libunix/mail.c @@ -1,7 +1,7 @@ /* mail.c Send mail to a user. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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. */ #include "uucp.h" @@ -48,17 +48,47 @@ fsysdep_mail (zto, zsubject, cstrs, paz) int cstrs; const char **paz; { - const char *az[3]; + char **pazargs; + char *zcopy, *ztok; + size_t cargs, iarg; FILE *e; pid_t ipid; time_t itime; int i; - az[0] = MAIL_PROGRAM; - az[1] = zto; - az[2] = NULL; + /* Parse MAIL_PROGRAM into an array of arguments. */ + zcopy = zbufcpy (MAIL_PROGRAM); + + cargs = 0; + for (ztok = strtok (zcopy, " \t"); + ztok != NULL; + ztok = strtok ((char *) NULL, " \t")) + ++cargs; + + pazargs = (char **) xmalloc ((cargs + 4) * sizeof (char *)); + + memcpy (zcopy, MAIL_PROGRAM, sizeof MAIL_PROGRAM); + for (ztok = strtok (zcopy, " \t"), iarg = 0; + ztok != NULL; + ztok = strtok ((char *) NULL, " \t"), ++iarg) + pazargs[iarg] = ztok; + +#if ! MAIL_PROGRAM_SUBJECT_BODY + pazargs[iarg++] = (char *) "-s"; + pazargs[iarg++] = (char *) zsubject; +#endif + +#if ! MAIL_PROGRAM_TO_BODY + pazargs[iarg++] = (char *) zto; +#endif + + pazargs[iarg] = NULL; + + e = espopen ((const char **) pazargs, FALSE, &ipid); + + ubuffree (zcopy); + xfree ((pointer) pazargs); - e = espopen (az, FALSE, &ipid); if (e == NULL) { ulog (LOG_ERROR, "espopen (%s): %s", MAIL_PROGRAM, @@ -66,10 +96,16 @@ fsysdep_mail (zto, zsubject, cstrs, paz) return FALSE; } - fprintf (e, "Subject: %s\n", zsubject); +#if MAIL_PROGRAM_TO_BODY fprintf (e, "To: %s\n", zto); +#endif +#if MAIL_PROGRAM_SUBJECT_BODY + fprintf (e, "Subject: %s\n", zsubject); +#endif +#if MAIL_PROGRAM_TO_BODY || MAIL_PROGRAM_SUBJECT_BODY fprintf (e, "\n"); +#endif (void) time (&itime); /* Remember that ctime includes a \n, so this skips a line. */ diff --git a/gnu/libexec/uucp/libunix/mkdir.c b/gnu/libexec/uucp/libunix/mkdir.c index f59ad5dfd6e6..2546cbff1e46 100644 --- a/gnu/libexec/uucp/libunix/mkdir.c +++ b/gnu/libexec/uucp/libunix/mkdir.c @@ -38,7 +38,7 @@ mkdir (zdir, imode) aidescs[1] = SPAWN_NULL; aidescs[2] = SPAWN_NULL; - ipid = ixsspawn (azargs, aidescs, FALSE, FALSE, (const char *) NULL, + ipid = ixsspawn (azargs, aidescs, TRUE, FALSE, (const char *) NULL, TRUE, FALSE, (const char *) NULL, (const char *) NULL, (const char *) NULL); diff --git a/gnu/libexec/uucp/libunix/mkdirs.c b/gnu/libexec/uucp/libunix/mkdirs.c index a4e0b67bb8c3..9b5b23ffd7b1 100644 --- a/gnu/libexec/uucp/libunix/mkdirs.c +++ b/gnu/libexec/uucp/libunix/mkdirs.c @@ -29,17 +29,19 @@ fsysdep_make_dirs (zfile, fpublic) if (*z == '/' && z != zcopy) { *z = '\0'; - if (! fsysdep_directory (zcopy)) + if (mkdir (zcopy, imode) != 0 + && errno != EEXIST + && (errno != EACCES || ! fsysdep_directory (zcopy))) { - if (mkdir (zcopy, imode) != 0) - { - ulog (LOG_ERROR, "mkdir (%s): %s", zcopy, - strerror (errno)); - ubuffree (zcopy); - return FALSE; - } + ulog (LOG_ERROR, "mkdir (%s): %s", zcopy, + strerror (errno)); + ubuffree (zcopy); + return FALSE; } - *z = '/'; + *z = '/'; /* replace '/' in its place */ + /* now skips over multiple '/' in name */ + while ( (*(z + 1)) && (*(z + 1)) == '/') + z++; } } diff --git a/gnu/libexec/uucp/libunix/move.c b/gnu/libexec/uucp/libunix/move.c index ccfe6d4d728d..3345bbfa04dc 100644 --- a/gnu/libexec/uucp/libunix/move.c +++ b/gnu/libexec/uucp/libunix/move.c @@ -1,7 +1,7 @@ /* move.c Move a file. - 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. */ #include "uucp.h" @@ -77,14 +77,12 @@ fsysdep_move_file (zorig, zto, fmkdirs, fpublic, fcheck, zuser) if (stat (zcopy, &s) != 0) { ulog (LOG_ERROR, "stat (%s): %s", zcopy, strerror (errno)); - (void) remove (zorig); ubuffree (zcopy); return FALSE; } if (! fsuser_access (&s, W_OK, zuser)) { ulog (LOG_ERROR, "%s: %s", zcopy, strerror (EACCES)); - (void) remove (zorig); ubuffree (zcopy); return FALSE; } @@ -107,10 +105,7 @@ fsysdep_move_file (zorig, zto, fmkdirs, fpublic, fcheck, zuser) if (fmkdirs && errno == ENOENT) { if (! fsysdep_make_dirs (zto, fpublic)) - { - (void) remove (zorig); - return FALSE; - } + return FALSE; if (rename (zorig, zto) == 0) return TRUE; } @@ -127,7 +122,6 @@ fsysdep_move_file (zorig, zto, fmkdirs, fpublic, fcheck, zuser) { ulog (LOG_ERROR, "rename (%s, %s): %s", zorig, zto, strerror (errno)); - (void) remove (zorig); return FALSE; } @@ -135,7 +129,6 @@ fsysdep_move_file (zorig, zto, fmkdirs, fpublic, fcheck, zuser) if (stat ((char *) zorig, &s) < 0) { ulog (LOG_ERROR, "stat (%s): %s", zorig, strerror (errno)); - (void) remove (zorig); return FALSE; } @@ -148,26 +141,19 @@ fsysdep_move_file (zorig, zto, fmkdirs, fpublic, fcheck, zuser) if (fmkdirs && errno == ENOENT) { if (! fsysdep_make_dirs (zto, fpublic)) - { - (void) remove (zorig); - return FALSE; - } + return FALSE; o = creat ((char *) zto, s.st_mode); } if (o < 0) { ulog (LOG_ERROR, "creat (%s): %s", zto, strerror (errno)); - (void) remove (zorig); return FALSE; } } (void) close (o); if (! fcopy_file (zorig, zto, fpublic, fmkdirs)) - { - (void) remove (zorig); - return FALSE; - } + return FALSE; if (remove (zorig) != 0) ulog (LOG_ERROR, "remove (%s): %s", zorig, strerror (errno)); diff --git a/gnu/libexec/uucp/libunix/opensr.c b/gnu/libexec/uucp/libunix/opensr.c index 3a8ca7a8b8ac..15cd5cd13601 100644 --- a/gnu/libexec/uucp/libunix/opensr.c +++ b/gnu/libexec/uucp/libunix/opensr.c @@ -1,7 +1,7 @@ /* opensr.c Open files for sending and receiving. - 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. */ #include "uucp.h" @@ -131,16 +131,18 @@ esysdep_open_send (qsys, zfile, fcheck, zuser) } /* Get a temporary file name to receive into. We use the ztemp - argument to pick the file name, so that we relocate the file if the + argument to pick the file name, so that we restart the file if the transmission is aborted. */ char * -zsysdep_receive_temp (qsys, zto, ztemp) +zsysdep_receive_temp (qsys, zto, ztemp, frestart) const struct uuconf_system *qsys; const char *zto; const char *ztemp; + boolean frestart; { - if (ztemp != NULL + if (frestart + && ztemp != NULL && *ztemp == 'D' && strcmp (ztemp, "D.0") != 0) return zsappend3 (".Temp", qsys->uuconf_zname, ztemp); @@ -148,6 +150,10 @@ zsysdep_receive_temp (qsys, zto, ztemp) return zstemp_file (qsys); } +/* The number of seconds in one week. We must cast to long for this + to be calculated correctly on a machine with 16 bit ints. */ +#define SECS_PER_WEEK ((long) 7 * (long) 24 * (long) 60 * (long) 60) + /* Open a temporary file to receive into. This should, perhaps, check that we have write permission on the receiving directory, but it doesn't. */ @@ -168,8 +174,10 @@ esysdep_open_receive (qsys, zto, ztemp, zreceive, pcrestart) that case, we may have already received some portion of this file. */ o = -1; - *pcrestart = -1; - if (ztemp != NULL + if (pcrestart != NULL) + *pcrestart = -1; + if (pcrestart != NULL + && ztemp != NULL && *ztemp == 'D' && strcmp (ztemp, "D.0") != 0) { @@ -185,7 +193,7 @@ esysdep_open_receive (qsys, zto, ztemp, zreceive, pcrestart) restarted, and they know about this issue, they can touch it to bring it up to date. */ if (fstat (o, &s) < 0 - || s.st_mtime + 7 * 24 * 60 * 60 < time ((time_t *) NULL)) + || s.st_mtime + SECS_PER_WEEK < time ((time_t *) NULL)) { (void) close (o); o = -1; diff --git a/gnu/libexec/uucp/libunix/pause.c b/gnu/libexec/uucp/libunix/pause.c index e774e0897bf2..8155db327260 100644 --- a/gnu/libexec/uucp/libunix/pause.c +++ b/gnu/libexec/uucp/libunix/pause.c @@ -29,7 +29,9 @@ #endif #if HAVE_SELECT +#if HAVE_SYS_TIME_H #include <sys/time.h> +#endif #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif @@ -53,7 +55,7 @@ struct pollfd #endif /* HAVE_POLL */ #if HAVE_TIME_H -#if HAVE_SYS_TIME_AND_TIME_H || ! USE_SELECT_TIMER +#if ! HAVE_SYS_TIME_H || ! HAVE_SELECT || TIME_WITH_SYS_TIME #include <time.h> #endif #endif @@ -87,10 +89,10 @@ usysdep_pause () s.tv_sec = 0; s.tv_usec = 500 * (long) 1000; select (0, (pointer) NULL, (pointer) NULL, (pointer) NULL, &s); -#endif /* USE_SELECT_TIMER */ +#endif /* HAVE_SELECT */ #if ! HAVE_NAPMS && ! HAVE_NAP && ! HAVE_USLEEP -#if ! USE_SELECT_TIMER && ! HAVE_POLL +#if ! HAVE_SELECT && ! HAVE_POLL sleep (1); -#endif /* ! USE_SELECT_TIMER && ! HAVE_POLL */ +#endif /* ! HAVE_SELECT && ! HAVE_POLL */ #endif /* ! HAVE_NAPMS && ! HAVE_NAP && ! HAVE_USLEEP */ } diff --git a/gnu/libexec/uucp/libunix/picksb.c b/gnu/libexec/uucp/libunix/picksb.c index 4d8cc4b2f3b6..a1afd1b8ae59 100644 --- a/gnu/libexec/uucp/libunix/picksb.c +++ b/gnu/libexec/uucp/libunix/picksb.c @@ -1,7 +1,7 @@ /* picksb.c System dependent routines for uupick. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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 picksb_rcsid[] = "$Id: picksb.c,v 1.1 1993/08/05 18:24:15 conklin Exp $"; +const char picksb_rcsid[] = "$Id: picksb.c,v 1.2 1994/05/07 18:10:54 ache Exp $"; #endif #include "uudefs.h" @@ -203,18 +203,22 @@ fsysdep_uupick_free (zsystem, zpubdir) /* Expand a local file name for uupick. */ char * -zsysdep_uupick_local_file (zfile) +zsysdep_uupick_local_file (zfile, pfbadname) const char *zfile; + boolean *pfbadname; { struct passwd *q; + if (pfbadname != NULL) + *pfbadname = FALSE; + /* If this does not start with a simple ~, pass it to zsysdep_local_file_cwd; as it happens, zsysdep_local_file_cwd only uses the zpubdir argument if the file starts with a simple ~, so it doesn't really matter what we pass for zpubdir. */ if (zfile[0] != '~' || (zfile[1] != '/' && zfile[1] != '\0')) - return zsysdep_local_file_cwd (zfile, (const char *) NULL); + return zsysdep_local_file_cwd (zfile, (const char *) NULL, pfbadname); q = getpwuid (getuid ()); if (q == NULL) diff --git a/gnu/libexec/uucp/libunix/pipe.c b/gnu/libexec/uucp/libunix/pipe.c new file mode 100644 index 000000000000..80e9e7f61bd4 --- /dev/null +++ b/gnu/libexec/uucp/libunix/pipe.c @@ -0,0 +1,294 @@ +/* pipe.c + The pipe port communication routines for Unix. + Contributed by Marc Boucher <marc@CAM.ORG>. + + Copyright (C) 1993 Ian Lance Taylor + + This file is part of the Taylor UUCP package. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + The author of the program may be contacted at ian@airs.com or + c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139. + */ + +#include "uucp.h" + +#if USE_RCS_ID +const char pipe_rcsid[] = "$Id: pipe.c,v 1.1 1994/05/07 18:10:56 ache Exp $"; +#endif + +#include "uudefs.h" +#include "uuconf.h" +#include "system.h" +#include "conn.h" +#include "sysdep.h" + +#include <errno.h> + +#if HAVE_FCNTL_H +#include <fcntl.h> +#else +#if HAVE_SYS_FILE_H +#include <sys/file.h> +#endif +#endif + +/* Local functions. */ + +static void uspipe_free P((struct sconnection *qconn)); +static boolean fspipe_open P((struct sconnection *qconn, long ibaud, + boolean fwait)); +static boolean fspipe_close P((struct sconnection *qconn, + pointer puuconf, + struct uuconf_dialer *qdialer, + boolean fsuccess)); +static boolean fspipe_dial P((struct sconnection *qconn, pointer puuconf, + const struct uuconf_system *qsys, + const char *zphone, + struct uuconf_dialer *qdialer, + enum tdialerfound *ptdialer)); + +/* The command table for standard input ports. */ + +static const struct sconncmds spipecmds = +{ + uspipe_free, + NULL, /* pflock */ + NULL, /* pfunlock */ + fspipe_open, + fspipe_close, + fspipe_dial, + fsdouble_read, + fsdouble_write, + fsysdep_conn_io, + NULL, /* pfbreak */ + NULL, /* pfset */ + NULL, /* pfcarrier */ + fsdouble_chat, + NULL /* pibaud */ +}; + +/* Initialize a pipe connection. */ + +boolean +fsysdep_pipe_init (qconn) + struct sconnection *qconn; +{ + struct ssysdep_conn *q; + + 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->iwr_flags = -1; + q->fterminal = FALSE; + q->ftli = FALSE; + q->ibaud = 0; + q->ipid = -1; + qconn->psysdep = (pointer) q; + qconn->qcmds = &spipecmds; + return TRUE; +} + +static void +uspipe_free (qconn) + struct sconnection *qconn; +{ + xfree (qconn->psysdep); +} + +/* Open a pipe port. */ + +/*ARGSUSED*/ +static boolean +fspipe_open (qconn, ibaud, fwait) + struct sconnection *qconn; + long ibaud; + boolean fwait; +{ + /* We don't do incoming waits on pipes. */ + if (fwait) + return FALSE; + + return TRUE; +} + +/* Close a pipe port. */ + +/*ARGSUSED*/ +static boolean +fspipe_close (qconn, puuconf, qdialer, fsuccess) + struct sconnection *qconn; + pointer puuconf; + struct uuconf_dialer *qdialer; + boolean fsuccess; +{ + struct ssysdep_conn *qsysdep; + boolean fret; + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + fret = TRUE; + + /* Close our sides of the pipe. */ + if (qsysdep->ord >= 0 && close (qsysdep->ord) < 0) + { + ulog (LOG_ERROR, "fspipe_close: close read fd: %s", strerror (errno)); + fret = FALSE; + } + if (qsysdep->owr != qsysdep->ord + && qsysdep->owr >= 0 + && close (qsysdep->owr) < 0) + { + ulog (LOG_ERROR, "fspipe_close: close write fd: %s", strerror (errno)); + fret = FALSE; + } + qsysdep->ord = -1; + qsysdep->owr = -1; + + /* Kill dangling child process. */ + if (qsysdep->ipid >= 0) + { + if (kill (qsysdep->ipid, SIGHUP) == 0) + usysdep_sleep (2); +#ifdef SIGPIPE + if (kill (qsysdep->ipid, SIGPIPE) == 0) + usysdep_sleep (2); +#endif + if (kill (qsysdep->ipid, SIGKILL) < 0 && errno == EPERM) + { + ulog (LOG_ERROR, "fspipe_close: Cannot kill child pid %lu: %s", + (unsigned long) qsysdep->ipid, strerror (errno)); + fret = FALSE; + } + else + (void) ixswait ((unsigned long) qsysdep->ipid, (const char *) NULL); + } + qsysdep->ipid = -1; + return fret; +} + +/* Dial out on a pipe port, so to speak: launch connection program + under us. The code alternates q->o between q->ord and q->owr as + appropriate. It is always q->ord before any call to fsblock. */ + +/*ARGSUSED*/ +static boolean +fspipe_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer) + struct sconnection *qconn; + pointer puuconf; + const struct uuconf_system *qsys; + const char *zphone; + struct uuconf_dialer *qdialer; + enum tdialerfound *ptdialer; +{ + struct ssysdep_conn *q; + int aidescs[3]; + const char **pzprog; + + q = (struct ssysdep_conn *) qconn->psysdep; + + *ptdialer = DIALERFOUND_FALSE; + + pzprog = (const char **) qconn->qport->uuconf_u.uuconf_spipe.uuconf_pzcmd; + + if (pzprog == NULL) + { + ulog (LOG_ERROR, "No command for pipe connection"); + return FALSE; + } + + aidescs[0] = SPAWN_WRITE_PIPE; + aidescs[1] = SPAWN_READ_PIPE; + aidescs[2] = SPAWN_NULL; + + /* Pass fkeepuid, fkeepenv and fshell as TRUE. This puts the + responsibility of security on the connection program. */ + q->ipid = ixsspawn (pzprog, aidescs, TRUE, TRUE, (const char *) NULL, + FALSE, TRUE, (const char *) NULL, + (const char *) NULL, (const char *) NULL); + if (q->ipid < 0) + { + ulog (LOG_ERROR, "ixsspawn (%s): %s", pzprog[0], strerror (errno)); + return FALSE; + } + + q->owr = aidescs[0]; + q->ord = aidescs[1]; + q->o = q->ord; + + q->iflags = fcntl (q->ord, F_GETFL, 0); + q->iwr_flags = fcntl (q->owr, F_GETFL, 0); + if (q->iflags < 0 || q->iwr_flags < 0) + { + ulog (LOG_ERROR, "fspipe_dial: fcntl: %s", strerror (errno)); + (void) fspipe_close (qconn, puuconf, qdialer, FALSE); + return FALSE; + } + + return TRUE; +} + +#if 0 + +/* Marc Boucher's contributed code used an alarm to avoid waiting too + long when closing the pipe. However, I believe that it is not + possible for the kernel to sleep when closing a pipe; it is only + possible when closing a device. Therefore, I have removed the + code, but am preserving it in case I am wrong. To reenable it, the + two calls to close in fspipe_close should be changed to call + fspipe_alarmclose. */ + +static RETSIGTYPE +usalarm (isig) + int isig; +{ +#if ! HAVE_SIGACTION && ! HAVE_SIGVEC && ! HAVE_SIGSET + (void) signal (isig, usalarm); +#endif + +#if HAVE_RESTARTABLE_SYSCALLS + longjmp (sSjmp_buf, 1); +#endif +} + +static int +fspipe_alarmclose (fd) + int fd; +{ + int iret = -1; + int ierrno = 0; + + if (fsysdep_catch ()) + { + usysdep_start_catch (); + usset_signal (SIGALRM, usalarm, TRUE, (boolean *) NULL); + (void) alarm (30); + + iret = close (fd); + ierrno = errno; + } + + usset_signal (SIGALRM, SIG_IGN, TRUE, (boolean *) NULL); + (void) alarm (0); + usysdep_end_catch (); + + errno = ierrno; + return iret; +} + +#endif /* 0 */ diff --git a/gnu/libexec/uucp/libunix/priv.c b/gnu/libexec/uucp/libunix/priv.c new file mode 100644 index 000000000000..207bd3dbbb9d --- /dev/null +++ b/gnu/libexec/uucp/libunix/priv.c @@ -0,0 +1,24 @@ +/* priv.c + See if a user is privileged. */ + +#include "uucp.h" + +#include "sysdep.h" +#include "system.h" + +/* See whether the user is privileged (for example, only privileged + users are permitted to kill arbitrary jobs with uustat). This is + true only for root and uucp. We check for uucp by seeing if the + real user ID and the effective user ID are the same; this works + because we should be suid to uucp, so our effective user ID will + always be uucp while our real user ID will be whoever ran the + program. */ + +boolean +fsysdep_privileged () +{ + uid_t iuid; + + iuid = getuid (); + return iuid == 0 || iuid == geteuid (); +} diff --git a/gnu/libexec/uucp/libunix/proctm.c b/gnu/libexec/uucp/libunix/proctm.c index 55cf96f0c972..b9b6eb9e4afc 100644 --- a/gnu/libexec/uucp/libunix/proctm.c +++ b/gnu/libexec/uucp/libunix/proctm.c @@ -1,7 +1,7 @@ /* proctm.c Get the time spent in the process. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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. */ #include "uucp.h" @@ -48,7 +48,7 @@ #define HAVE_FTIME 0 #endif -#if HAVE_TIME_H && (HAVE_SYS_TIME_AND_TIME_H || ! HAVE_GETTIMEOFDAY) +#if HAVE_TIME_H && (TIME_WITH_SYS_TIME || ! HAVE_GETTIMEOFDAY) #include <time.h> #endif diff --git a/gnu/libexec/uucp/libunix/recep.c b/gnu/libexec/uucp/libunix/recep.c index 84a211a7a946..152fd0d0ba1f 100644 --- a/gnu/libexec/uucp/libunix/recep.c +++ b/gnu/libexec/uucp/libunix/recep.c @@ -1,7 +1,7 @@ /* recep.c See whether a file has already been received. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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. */ #include "uucp.h" @@ -103,7 +103,7 @@ fsysdep_remember_reception (qsys, zto, ztemp) { if (errno == ENOENT) { - if (fsysdep_make_dirs (zfile, TRUE)) + if (fsysdep_make_dirs (zfile, FALSE)) { ubuffree (zfile); return FALSE; @@ -133,6 +133,10 @@ fsysdep_remember_reception (qsys, zto, ztemp) return TRUE; } +/* The number of seconds in one week. We must cast to long for this + to be calculated correctly on a machine with 16 bit ints. */ +#define SECS_PER_WEEK ((long) 7 * (long) 24 * (long) 60 * (long) 60) + /* See if we have already received a file. Note that don't delete the marker file here, because we need to know that the sending system has received our denial first. This function returns TRUE if the @@ -161,7 +165,7 @@ fsysdep_already_received (qsys, zto, ztemp) } /* Ignore the file (return FALSE) if it is over one week old. */ - fret = s.st_mtime + 7 * 24 * 60 * 60 >= time ((time_t *) NULL); + fret = s.st_mtime + SECS_PER_WEEK >= time ((time_t *) NULL); if (fret) DEBUG_MESSAGE1 (DEBUG_SPOOLDIR, "fsysdep_already_received: Found %s", diff --git a/gnu/libexec/uucp/libunix/run.c b/gnu/libexec/uucp/libunix/run.c index e21919628372..af9b078d3bd9 100644 --- a/gnu/libexec/uucp/libunix/run.c +++ b/gnu/libexec/uucp/libunix/run.c @@ -1,7 +1,7 @@ /* run.c Run a program. - 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. */ #include "uucp.h" @@ -31,13 +31,11 @@ #include <errno.h> -/* Start up a new program and end the current one. We don't have to - worry about SIGHUP because the current process is either not a - process group leader (uucp, uux) or it does not have a controlling - terminal (uucico). */ +/* Start up a new program. */ boolean -fsysdep_run (zprogram, zarg1, zarg2) +fsysdep_run (ffork, zprogram, zarg1, zarg2) + boolean ffork; const char *zprogram; const char *zarg1; const char *zarg2; @@ -47,6 +45,40 @@ fsysdep_run (zprogram, zarg1, zarg2) int aidescs[3]; pid_t ipid; + /* If we are supposed to fork, fork and then spawn so that we don't + have to worry about zombie processes. */ + if (ffork) + { + ipid = ixsfork (); + if (ipid < 0) + { + ulog (LOG_ERROR, "fork: %s", strerror (errno)); + return FALSE; + } + + if (ipid != 0) + { + /* This is the parent. Wait for the child we just forked to + exit (below) and return. */ + (void) ixswait ((unsigned long) ipid, (const char *) NULL); + + /* Force the log files to be reopened in case the child just + output any error messages and stdio doesn't handle + appending correctly. */ + ulog_close (); + + return TRUE; + } + + /* This is the child. Detach from the terminal to avoid any + unexpected SIGHUP signals. At this point we are definitely + not a process group leader, so usysdep_detach will not fork + again. */ + usysdep_detach (); + + /* Now spawn the program and then exit. */ + } + zlib = zbufalc (sizeof SBINDIR + sizeof "/" + strlen (zprogram)); sprintf (zlib, "%s/%s", SBINDIR, zprogram); @@ -65,11 +97,17 @@ fsysdep_run (zprogram, zarg1, zarg2) FALSE, TRUE, (const char *) NULL, (const char *) NULL, (const char *) NULL); ubuffree (zlib); + if (ipid < 0) { ulog (LOG_ERROR, "ixsspawn: %s", strerror (errno)); + if (ffork) + _exit (EXIT_FAILURE); return FALSE; } + if (ffork) + _exit (EXIT_SUCCESS); + return TRUE; } diff --git a/gnu/libexec/uucp/libunix/seq.c b/gnu/libexec/uucp/libunix/seq.c index 2e01233022a9..5188510b6128 100644 --- a/gnu/libexec/uucp/libunix/seq.c +++ b/gnu/libexec/uucp/libunix/seq.c @@ -1,7 +1,7 @@ /* seq.c Get and increment the conversation sequence number for a system. - 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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/serial.c b/gnu/libexec/uucp/libunix/serial.c index cee90fcc7bb3..cfa28d075a07 100644 --- a/gnu/libexec/uucp/libunix/serial.c +++ b/gnu/libexec/uucp/libunix/serial.c @@ -1,7 +1,7 @@ /* serial.c The serial port communication routines for Unix. - 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 serial_rcsid[] = "$Id: serial.c,v 1.3 1994/02/07 23:47:51 ache Exp $"; +const char serial_rcsid[] = "$Id: serial.c,v 1.4 1994/05/07 18:11:09 ache Exp $"; #endif #include "uudefs.h" @@ -78,19 +78,21 @@ const char serial_rcsid[] = "$Id: serial.c,v 1.3 1994/02/07 23:47:51 ache Exp $" #define FD_CLOEXEC 1 #endif -#if HAVE_SYS_IOCTL_H +#if HAVE_SYS_IOCTL_H || HAVE_TXADDCD #include <sys/ioctl.h> #endif #if HAVE_BSD_TTY +#if HAVE_SYS_TIME_H #include <sys/time.h> +#endif #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif #endif #if HAVE_TIME_H -#if HAVE_SYS_TIME_AND_TIME_H || ! HAVE_BSD_TTY +#if ! HAVE_SYS_TIME_H || ! HAVE_BSD_TTY || TIME_WITH_SYS_TIME #include <time.h> #endif #endif @@ -117,6 +119,10 @@ const char serial_rcsid[] = "$Id: serial.c,v 1.3 1994/02/07 23:47:51 ache Exp $" #endif /* ! MAJOR_IN_MKDEV && ! MAJOR_IN_SYSMACROS */ #endif /* HAVE_SVR4_LOCKFILES */ +#if HAVE_DEV_INFO +#include <sys/dev.h> +#endif + /* Get definitions for both O_NONBLOCK and O_NDELAY. */ #ifndef O_NDELAY #ifdef FNDELAY @@ -180,38 +186,46 @@ extern int t_nerr; /* Determine bits to clear for the various terminal control fields for HAVE_SYSV_TERMIO and HAVE_POSIX_TERMIOS. */ + +/* These fields are defined on some systems, and I am told that it + does not hurt to clear them, and it sometimes helps. */ +#ifndef IMAXBEL +#define IMAXBEL 0 +#endif + +#ifndef PENDIN +#define PENDIN 0 +#endif + #if HAVE_SYSV_TERMIO #define ICLEAR_IFLAG (IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK \ | ISTRIP | INLCR | IGNCR | ICRNL | IUCLC \ - | IXON | IXANY | IXOFF) + | IXON | IXANY | IXOFF | IMAXBEL) #define ICLEAR_OFLAG (OPOST | OLCUC | ONLCR | OCRNL | ONOCR | ONLRET \ | OFILL | OFDEL | NLDLY | CRDLY | TABDLY | BSDLY \ | VTDLY | FFDLY) -#define ICLEAR_CFLAG (CBAUD | CLOCAL | CSIZE | PARENB | PARODD) +#define ICLEAR_CFLAG (CBAUD | CSIZE | PARENB | PARODD) #define ISET_CFLAG (CS8 | CREAD | HUPCL) #define ICLEAR_LFLAG (ISIG | ICANON | XCASE | ECHO | ECHOE | ECHOK \ - | ECHONL | NOFLSH) + | ECHONL | NOFLSH | PENDIN) #endif #if HAVE_POSIX_TERMIOS -#ifdef IMAXBEL -#define CI_ADD1 IMAXBEL -#else -#define CI_ADD1 0 -#endif #define ICLEAR_IFLAG (BRKINT | ICRNL | IGNBRK | IGNCR | IGNPAR \ | INLCR | INPCK | ISTRIP | IXOFF | IXON \ - | PARMRK | CI_ADD1) + | PARMRK | IMAXBEL) #define ICLEAR_OFLAG (OPOST) -#define ICLEAR_CFLAG (CLOCAL | CSIZE | PARENB | PARODD) +#define ICLEAR_CFLAG (CSIZE | PARENB | PARODD) #define ISET_CFLAG (CS8 | CREAD | HUPCL) -#ifdef PENDIN -#define CL_ADD1 PENDIN -#else -#define CL_ADD1 0 -#endif #define ICLEAR_LFLAG (ECHO | ECHOE | ECHOK | ECHONL | ICANON | IEXTEN \ - | ISIG | NOFLSH | TOSTOP | CL_ADD1) + | ISIG | NOFLSH | TOSTOP | PENDIN) #endif + +enum tclocal_setting +{ + SET_CLOCAL, + CLEAR_CLOCAL, + IGNORE_CLOCAL +}; /* Local functions. */ @@ -226,7 +240,7 @@ static boolean fsserial_lock P((struct sconnection *qconn, boolean fin)); static boolean fsserial_unlock P((struct sconnection *qconn)); static boolean fsserial_open P((struct sconnection *qconn, long ibaud, - boolean fwait)); + boolean fwait, enum tclocal_setting tlocal)); static boolean fsstdin_open P((struct sconnection *qconn, long ibaud, boolean fwait)); static boolean fsmodem_open P((struct sconnection *qconn, long ibaud, @@ -247,13 +261,6 @@ static boolean fsdirect_close P((struct sconnection *qconn, pointer puuconf, struct uuconf_dialer *qdialer, boolean fsuccess)); -static boolean fsserial_reset P((struct sconnection *qconn)); -static boolean fsstdin_reset P((struct sconnection *qconn)); -static boolean fsstdin_read P((struct sconnection *qconn, - char *zbuf, size_t *pclen, size_t cmin, - int ctimeout, boolean freport)); -static boolean fsstdin_write P((struct sconnection *qconn, - const char *zwrite, size_t cwrite)); static boolean fsserial_break P((struct sconnection *qconn)); static boolean fsstdin_break P((struct sconnection *qconn)); static boolean fsserial_set P((struct sconnection *qconn, @@ -266,9 +273,9 @@ static boolean fsstdin_set P((struct sconnection *qconn, enum txonxoffsetting txonxoff)); static boolean fsmodem_carrier P((struct sconnection *qconn, boolean fcarrier)); +static boolean fsserial_hardflow P((struct sconnection *qconn, + boolean fhardflow)); static boolean fsrun_chat P((int oread, int owrite, char **pzprog)); -static boolean fsstdin_chat P((struct sconnection *qconn, - char **pzprog)); static long isserial_baud P((struct sconnection *qconn)); /* The command table for standard input ports. */ @@ -280,15 +287,14 @@ static const struct sconncmds sstdincmds = NULL, /* pfunlock */ fsstdin_open, fsstdin_close, - fsstdin_reset, NULL, /* pfdial */ - fsstdin_read, - fsstdin_write, + fsdouble_read, + fsdouble_write, fsysdep_conn_io, fsstdin_break, fsstdin_set, NULL, /* pfcarrier */ - fsstdin_chat, + fsdouble_chat, isserial_baud }; @@ -301,7 +307,6 @@ static const struct sconncmds smodemcmds = fsserial_unlock, fsmodem_open, fsmodem_close, - fsserial_reset, fmodem_dial, fsysdep_conn_read, fsysdep_conn_write, @@ -322,7 +327,6 @@ static const struct sconncmds sdirectcmds = fsserial_unlock, fsdirect_open, fsdirect_close, - fsserial_reset, NULL, /* pfdial */ fsysdep_conn_read, fsysdep_conn_write, @@ -499,6 +503,8 @@ fsserial_init (qconn, qcmds, zdevice) q->zdevice[sizeof "/dev/" + clen - 1] = '\0'; } q->o = -1; + q->ord = -1; + q->owr = -1; q->ftli = FALSE; qconn->psysdep = (pointer) q; qconn->qcmds = qcmds; @@ -548,6 +554,12 @@ usserial_free (qconn) qconn->psysdep = NULL; } +#if HAVE_SEQUENT_LOCKFILES +#define LCK_TEMPLATE "LCK..tty" +#else +#define LCK_TEMPLATE "LCK.." +#endif + /* This routine is used for both locking and unlocking. It is the only routine which knows how to translate a device name into the name of a lock file. If it can't figure out a name, it does @@ -571,6 +583,39 @@ fsserial_lockfile (flok, qconn) zalc = NULL; if (z == NULL) { +#if HAVE_QNX_LOCKFILES + { + nid_t idevice_nid; + char abdevice_nid[13]; /* length of long, a period, and a NUL */ + size_t cdevice_nid; + const char *zbase; + size_t clen; + + /* If the node ID is explicitly specified as part of the + pathname to the device, use that. Otherwise, presume the + device is local to the current node. */ + if (qsysdep->zdevice[0] == '/' && qsysdep->zdevice[1] == '/') + idevice_nid = (nid_t) strtol (qsysdep->zdevice + 2, + (char **) NULL, 10); + else + idevice_nid = getnid (); + + sprintf (abdevice_nid, "%ld.", (long) idevice_nid); + cdevice_nid = strlen (abdevice_nid); + + zbase = strrchr (qsysdep->zdevice, '/') + 1; + clen = strlen (zbase); + + zalc = zbufalc (sizeof LCK_TEMPLATE + cdevice_nid + clen); + + memcpy (zalc, LCK_TEMPLATE, sizeof LCK_TEMPLATE - 1); + memcpy (zalc + sizeof LCK_TEMPLATE - 1, abdevice_nid, cdevice_nid); + memcpy (zalc + sizeof LCK_TEMPLATE - 1 + cdevice_nid, + zbase, clen + 1); + + z = zalc; + } +#else /* ! HAVE_QNX_LOCKFILES */ #if ! HAVE_SVR4_LOCKFILES { const char *zbase; @@ -578,22 +623,21 @@ fsserial_lockfile (flok, qconn) zbase = strrchr (qsysdep->zdevice, '/') + 1; clen = strlen (zbase); - zalc = zbufalc (sizeof "LCK.." + clen); - memcpy (zalc, "LCK..", sizeof "LCK.." - 1); - memcpy (zalc + sizeof "LCK.." - 1, zbase, clen + 1); + zalc = zbufalc (sizeof LCK_TEMPLATE + clen); + memcpy (zalc, LCK_TEMPLATE, sizeof LCK_TEMPLATE - 1); + memcpy (zalc + sizeof LCK_TEMPLATE - 1, zbase, clen + 1); #if HAVE_SCO_LOCKFILES { char *zl; - for (zl = zalc + sizeof "LCK.." - 1; *zl != '\0'; zl++) + for (zl = zalc + sizeof LCK_TEMPLATE - 1; *zl != '\0'; zl++) if (isupper (*zl)) *zl = tolower (*zl); } #endif z = zalc; } -#else /* ! HAVE_SVR4_LOCKFILES */ -#if HAVE_SVR4_LOCKFILES +#else /* HAVE_SVR4_LOCKFILES */ { struct stat s; @@ -608,10 +652,8 @@ fsserial_lockfile (flok, qconn) major (s.st_rdev), minor (s.st_rdev)); z = zalc; } -#else /* ! HAVE_SVR4_LOCKFILES */ - z = strrchr (qsysdep->zdevice, '/') + 1; -#endif /* ! HAVE_SVR4_LOCKFILES */ -#endif /* ! HAVE_SVR4_LOCKFILES */ +#endif /* HAVE_SVR4_LOCKFILES */ +#endif /* ! HAVE_QNX_LOCKFILES */ } if (flok) @@ -624,13 +666,15 @@ fsserial_lockfile (flok, qconn) { if (flok) { - if (lockttyexist (z)) + if (lockttyexist (z + sizeof LCK_TEMPLATE - 1)) { - ulog (LOG_NORMAL, "%s: port already locked", z+5); + ulog (LOG_NORMAL, "%s: port already locked", + z + sizeof LCK_TEMPLATE - 1); fret = FALSE; } else - fret = !(fscoherent_disable_tty (z, &qsysdep->zenable)); + fret = fscoherent_disable_tty (z + sizeof LCK_TEMPLATE - 1, + &qsysdep->zenable); } else { @@ -689,7 +733,7 @@ fsserial_lock (qconn, fin) if (! fsserial_lockfile (TRUE, qconn)) return FALSE; -#if HAVE_TIOCSINUSE || HAVE_TIOCEXCL +#if HAVE_TIOCSINUSE || HAVE_TIOCEXCL || HAVE_DEV_INFO /* Open the line and try to mark it in use. */ { struct ssysdep_conn *qsysdep; @@ -740,6 +784,38 @@ fsserial_lock (qconn, fin) } #endif +#if HAVE_DEV_INFO + /* QNX programs "lock" a serial port by simply opening it and + checking if some other program also has the port open. If the + count of openers is greater than one, the program presumes the + port is "locked" and backs off. This isn't really "locking" of + course, but it pretty much seems to work. This can result in + dropping incoming connections if an outgoing connection is + started at exactly the same time. It would probably be better + to stop using the lock files at all for this case, but that + would involve more complex changes to the code, and I'm afraid + I would break something. -- Joe Wells <jbw@cs.bu.edu> */ + { + struct _dev_info_entry sdevinfo; + + if (dev_info (qsysdep->o, &sdevinfo) == -1) + { + ulog (LOG_ERROR, "dev_info: %s", strerror (errno)); + sdevinfo.open_count = 2; /* force presumption of "locked" */ + } + if (sdevinfo.open_count != 1) + { +#ifdef TIOCNOTTY + (void) ioctl (qsysdep->o, TIOCNOTTY, (char *) NULL); +#endif /* TIOCNOTTY */ + (void) close (qsysdep->o); + qsysdep->o = -1; + (void) fsserial_lockfile (FALSE, qconn); + return FALSE; + } + } +#endif /* HAVE_DEV_INFO */ + if (fcntl (qsysdep->o, F_SETFD, fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0) { @@ -752,11 +828,6 @@ fsserial_lock (qconn, fin) (void) fsserial_lockfile (FALSE, qconn); return FALSE; } - -#ifdef TIOCSCTTY - /* On BSD 4.4, make it our controlling terminal. */ - (void) ioctl (qsysdep->o, TIOCSCTTY, 0); -#endif } #endif /* HAVE_TIOCSINUSE || HAVE_TIOCEXCL */ @@ -796,8 +867,7 @@ fsserial_unlock (qconn) return fret; } -/* Open a serial line. This sets the terminal settings. We begin in - seven bit mode and let the protocol change if necessary. */ +/* A table to map baud rates into index numbers. */ #if HAVE_POSIX_TERMIOS typedef speed_t baud_code; @@ -858,11 +928,18 @@ static struct sbaud_table static int cSmin; #endif /* HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS */ +/* Open a serial line. This sets the terminal settings. We begin in + seven bit mode and let the protocol change if necessary. If fwait + is FALSE we open the terminal in non-blocking mode. If flocal is + TRUE we set CLOCAL on the terminal when using termio[s]; this is + supposedly required on some versions of BSD/386. */ + static boolean -fsserial_open (qconn, ibaud, fwait) +fsserial_open (qconn, ibaud, fwait, tlocal) struct sconnection *qconn; long ibaud; boolean fwait; + enum tclocal_setting tlocal; { struct ssysdep_conn *q; baud_code ib; @@ -870,7 +947,19 @@ fsserial_open (qconn, ibaud, fwait) q = (struct ssysdep_conn *) qconn->psysdep; if (q->zdevice != NULL) - ulog_device (strrchr (q->zdevice, '/') + 1); + { +#if LOG_DEVICE_PREFIX + ulog_device (q->zdevice); +#else + const char *z; + + if (strncmp (q->zdevice, "/dev/", sizeof "/dev/" - 1) == 0) + z = q->zdevice + sizeof "/dev/" - 1; + else + z = q->zdevice; + ulog_device (z); +#endif + } else { const char *zport; @@ -945,7 +1034,7 @@ fsserial_open (qconn, ibaud, fwait) ulog (LOG_ERROR, "fcntl: %s", strerror (errno)); return FALSE; } - q->istdout_flags = -1; + q->iwr_flags = -1; if (! fgetterminfo (q->o, &q->sorig)) { @@ -1025,13 +1114,11 @@ fsserial_open (qconn, ibaud, fwait) q->snew.c_iflag &=~ ICLEAR_IFLAG; q->snew.c_oflag &=~ ICLEAR_OFLAG; q->snew.c_cflag &=~ ICLEAR_CFLAG; - if (!fwait) - q->snew.c_cflag |= CLOCAL; - q->snew.c_cflag |= (ib | ISET_CFLAG); + q->snew.c_cflag |= ib | ISET_CFLAG; q->snew.c_lflag &=~ ICLEAR_LFLAG; cSmin = 1; q->snew.c_cc[VMIN] = cSmin; - q->snew.c_cc[VTIME] = 0; + q->snew.c_cc[VTIME] = 1; #ifdef TCFLSH /* Flush pending input. */ @@ -1048,13 +1135,11 @@ fsserial_open (qconn, ibaud, fwait) q->snew.c_iflag &=~ ICLEAR_IFLAG; q->snew.c_oflag &=~ ICLEAR_OFLAG; q->snew.c_cflag &=~ ICLEAR_CFLAG; - if (!fwait) - q->snew.c_cflag |= CLOCAL; q->snew.c_cflag |= ISET_CFLAG; q->snew.c_lflag &=~ ICLEAR_LFLAG; cSmin = 1; q->snew.c_cc[VMIN] = cSmin; - q->snew.c_cc[VTIME] = 0; + q->snew.c_cc[VTIME] = 1; (void) cfsetospeed (&q->snew, ib); (void) cfsetispeed (&q->snew, ib); @@ -1064,6 +1149,20 @@ fsserial_open (qconn, ibaud, fwait) #endif /* HAVE_POSIX_TERMIOS */ +#if HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS + switch (tlocal) + { + case SET_CLOCAL: + q->snew.c_cflag |= CLOCAL; + break; + case CLEAR_CLOCAL: + q->snew.c_cflag &=~ CLOCAL; + break; + case IGNORE_CLOCAL: + break; + } +#endif /* HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS */ + if (! fsetterminfo (q->o, &q->snew)) { ulog (LOG_ERROR, "Can't set terminal settings: %s", strerror (errno)); @@ -1098,8 +1197,9 @@ fsserial_open (qconn, ibaud, fwait) return TRUE; } -/* Open a standard input port. The code alternates q->o between 0 and - 1 as appropriate. It is always 0 before any call to fsblock. */ +/* Open a standard input port. The code alternates q->o between + q->ord and q->owr as appropriate. It is always q->ord before any + call to fsblock. */ static boolean fsstdin_open (qconn, ibaud, fwait) @@ -1110,11 +1210,14 @@ fsstdin_open (qconn, ibaud, fwait) struct ssysdep_conn *q; q = (struct ssysdep_conn *) qconn->psysdep; - q->o = 0; - if (! fsserial_open (qconn, ibaud, fwait)) + q->ord = 0; + q->owr = 1; + + q->o = q->ord; + if (! fsserial_open (qconn, ibaud, fwait, IGNORE_CLOCAL)) return FALSE; - q->istdout_flags = fcntl (1, F_GETFL, 0); - if (q->istdout_flags < 0) + q->iwr_flags = fcntl (q->owr, F_GETFL, 0); + if (q->iwr_flags < 0) { ulog (LOG_ERROR, "fcntl: %s", strerror (errno)); return FALSE; @@ -1130,9 +1233,26 @@ fsmodem_open (qconn, ibaud, fwait) long ibaud; boolean fwait; { + struct uuconf_modem_port *qm; + + qm = &qconn->qport->uuconf_u.uuconf_smodem; if (ibaud == (long) 0) - ibaud = qconn->qport->uuconf_u.uuconf_smodem.uuconf_ibaud; - return fsserial_open (qconn, ibaud, fwait); + ibaud = qm->uuconf_ibaud; + + if (! fsserial_open (qconn, ibaud, fwait, + fwait ? CLEAR_CLOCAL : SET_CLOCAL)) + return FALSE; + + /* If we are waiting for carrier, then turn on hardware flow + control. We don't turn on hardware flow control when dialing + out, because some modems don't assert the necessary signals until + they see carrier. Instead, we turn on hardware flow control in + fsmodem_carrier. */ + if (fwait + && ! fsserial_hardflow (qconn, qm->uuconf_fhardflow)) + return FALSE; + + return TRUE; } /* Open a direct port. */ @@ -1143,9 +1263,18 @@ fsdirect_open (qconn, ibaud, fwait) long ibaud; boolean fwait; { + struct uuconf_direct_port *qd; + + qd = &qconn->qport->uuconf_u.uuconf_sdirect; if (ibaud == (long) 0) - ibaud = qconn->qport->uuconf_u.uuconf_sdirect.uuconf_ibaud; - return fsserial_open (qconn, ibaud, fwait); + ibaud = qd->uuconf_ibaud; + if (! fsserial_open (qconn, ibaud, fwait, + qd->uuconf_fcarrier ? CLEAR_CLOCAL : SET_CLOCAL)) + return FALSE; + + /* Always turn on hardware flow control for a direct port when it is + opened. There is no other sensible time to turn it on. */ + return fsserial_hardflow (qconn, qd->uuconf_fhardflow); } /* Change the blocking status of the port. We keep track of the @@ -1188,14 +1317,14 @@ fsblock (qs, fblock) qs->iflags = iwant; - if (qs->istdout_flags >= 0) + if (qs->iwr_flags >= 0 && qs->ord != qs->owr) { if (fblock) - iwant = qs->istdout_flags &~ (O_NDELAY | O_NONBLOCK); + iwant = qs->iwr_flags &~ (O_NDELAY | O_NONBLOCK); else - iwant = qs->istdout_flags | iSunblock; + iwant = qs->iwr_flags | iSunblock; - if (fcntl (1, F_SETFL, iwant) < 0) + if (fcntl (qs->owr, F_SETFL, iwant) < 0) { /* We don't bother to fix up iSunblock here, since we succeeded above. */ @@ -1203,7 +1332,7 @@ fsblock (qs, fblock) return FALSE; } - qs->istdout_flags = iwant; + qs->iwr_flags = iwant; } return TRUE; @@ -1274,9 +1403,9 @@ fsstdin_close (qconn, puuconf, qdialer, fsuccess) struct ssysdep_conn *qsysdep; qsysdep = (struct ssysdep_conn *) qconn->psysdep; - (void) close (1); + (void) close (qsysdep->owr); (void) close (2); - qsysdep->o = 0; + qsysdep->o = qsysdep->ord; return fsserial_close (qsysdep); } @@ -1442,68 +1571,6 @@ fsdirect_close (qconn, puuconf, qdialer, fsuccess) return fsserial_close ((struct ssysdep_conn *) qconn->psysdep); } -/* Reset a serial port by hanging up. */ - -static boolean -fsserial_reset (qconn) - struct sconnection *qconn; -{ - struct ssysdep_conn *q; - sterminal sbaud; - - q = (struct ssysdep_conn *) qconn->psysdep; - - if (! q->fterminal) - return TRUE; - - sbaud = q->snew; - -#if HAVE_BSD_TTY - sbaud.stty.sg_ispeed = B0; - sbaud.stty.sg_ospeed = B0; -#endif -#if HAVE_SYSV_TERMIO - sbaud.c_cflag = (sbaud.c_cflag &~ CBAUD) | B0; -#endif -#if HAVE_POSIX_TERMIOS - if (cfsetospeed (&sbaud, B0) < 0) - { - ulog (LOG_ERROR, "Can't set baud rate: %s", strerror (errno)); - return FALSE; - } -#endif - - if (! fsetterminfodrain (q->o, &sbaud)) - { - ulog (LOG_ERROR, "Can't hangup terminal: %s", strerror (errno)); - return FALSE; - } - - /* Give the terminal a chance to settle. */ - sleep (2); - - if (! fsetterminfo (q->o, &q->snew)) - { - ulog (LOG_ERROR, "Can't reopen terminal: %s", strerror (errno)); - return FALSE; - } - - return TRUE; -} - -/* Reset a standard input port. */ - -static boolean -fsstdin_reset (qconn) - struct sconnection *qconn; -{ - struct ssysdep_conn *qsysdep; - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - qsysdep->o = 0; - return fsserial_reset (qconn); -} - /* Begin dialing out on a modem port. This opens the dialer device if there is one. */ @@ -1536,7 +1603,27 @@ fsysdep_modem_begin_dial (qconn, qdial) sleep (2); (void) ioctl (qsysdep->o, TIOCSDTR, 0); #else /* ! defined (TIOCCDTR) */ - (void) fconn_reset (qconn); + if (qsysdep->fterminal) + { + sterminal sbaud; + + sbaud = qsysdep->snew; + +#if HAVE_BSD_TTY + sbaud.stty.sg_ispeed = B0; + sbaud.stty.sg_ospeed = B0; +#endif +#if HAVE_SYSV_TERMIO + sbaud.c_cflag = (sbaud.c_cflag &~ CBAUD) | B0; +#endif +#if HAVE_POSIX_TERMIOS + (void) cfsetospeed (&sbaud, B0); +#endif + + (void) fsetterminfodrain (qsysdep->o, &sbaud); + sleep (2); + (void) fsetterminfo (qsysdep->o, &qsysdep->snew); + } #endif /* ! defined (TIOCCDTR) */ if (qdial->uuconf_fdtr_toggle_wait) @@ -1598,15 +1685,17 @@ fsmodem_carrier (qconn, fcarrier) boolean fcarrier; { register struct ssysdep_conn *q; + struct uuconf_modem_port *qm; q = (struct ssysdep_conn *) qconn->psysdep; if (! q->fterminal) return TRUE; + qm = &qconn->qport->uuconf_u.uuconf_smodem; if (fcarrier) { - if (qconn->qport->uuconf_u.uuconf_smodem.uuconf_fcarrier) + if (qm->uuconf_fcarrier) { #ifdef TIOCCAR /* Tell the modem to pay attention to carrier. */ @@ -1619,18 +1708,18 @@ fsmodem_carrier (qconn, fcarrier) #if HAVE_BSD_TTY #ifdef LNOMDM - /* IS68K Unix uses a local LNOMDM bit. */ - { - int iparam; - - iparam = LNOMDM; - if (ioctl (q->o, TIOCLBIC, &iparam) < 0) + /* IS68K Unix uses a local LNOMDM bit. */ { - ulog (LOG_ERROR, "ioctl (TIOCLBIC, LNOMDM): %s", - strerror (errno)); - return FALSE; + int iparam; + + iparam = LNOMDM; + if (ioctl (q->o, TIOCLBIC, &iparam) < 0) + { + ulog (LOG_ERROR, "ioctl (TIOCLBIC, LNOMDM): %s", + strerror (errno)); + return FALSE; + } } - } #endif /* LNOMDM */ #endif /* HAVE_BSD_TTY */ @@ -1644,9 +1733,20 @@ fsmodem_carrier (qconn, fcarrier) } #endif /* HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS */ } + + /* Turn on hardware flow control after turning on carrier. We + don't do it until now because some modems don't assert the + right signals until they see carrier. */ + if (! fsserial_hardflow (qconn, qm->uuconf_fhardflow)) + return FALSE; } else { + /* Turn off any hardware flow control before turning off + carrier. */ + if (! fsserial_hardflow (qconn, FALSE)) + return FALSE; + #ifdef TIOCNCAR /* Tell the modem to ignore carrier. */ if (ioctl (q->o, TIOCNCAR, 0) < 0) @@ -1714,6 +1814,104 @@ fsmodem_carrier (qconn, fcarrier) return TRUE; } +/* Tell the port to use hardware flow control. There is no standard + mechanism for controlling this. This implementation supports + CRTSCTS on SunOS, RTS/CTSFLOW on 386(ish) unix, CTSCD on the 3b1, + and TXADDCD/TXDELCD on AIX. If you know how to do it on other + systems, please implement it and send me the patches. */ + +static boolean +fsserial_hardflow (qconn, fhardflow) + struct sconnection *qconn; + boolean fhardflow; +{ + register struct ssysdep_conn *q; + + q = (struct ssysdep_conn *) qconn->psysdep; + + if (! q->fterminal) + return TRUE; + + /* Don't do anything if we don't know what to do. */ +#if HAVE_BSD_TTY +#define HAVE_HARDFLOW 0 +#endif +#if HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS +#if ! HAVE_TXADDCD +#ifndef CRTSFL +#ifndef CRTSCTS +#ifndef CTSCD +#define HAVE_HARDFLOW 0 +#endif +#endif +#endif +#endif +#endif + +#ifndef HAVE_HARDFLOW +#define HAVE_HARDFLOW 1 +#endif + +#if HAVE_HARDFLOW + if (fhardflow) + { +#if HAVE_TXADDCD + /* The return value does not reliably indicate whether this + actually succeeded. */ + (void) ioctl (q->o, TXADDCD, "rts"); +#else /* ! HAVE_TXADDCD */ +#if HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS +#ifdef CRTSFL + q->snew.c_cflag |= CRTSFL; + q->snew.c_cflag &=~ (RTSFLOW | CTSFLOW); +#endif /* defined (CRTSFL) */ +#ifdef CRTSCTS + q->snew.c_cflag |= CRTSCTS; +#endif /* defined (CRTSCTS) */ +#ifdef CTSCD + q->snew.c_cflag |= CTSCD; +#endif /* defined (CTSCD) */ +#endif /* HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS */ + if (! fsetterminfo (q->o, &q->snew)) + { + ulog (LOG_ERROR, "Can't enable hardware flow control: %s", + strerror (errno)); + return FALSE; + } +#endif /* ! HAVE_TXADDCD */ + } + else + { +#if HAVE_TXADDCD + /* The return value does not reliably indicate whether this + actually succeeded. */ + (void) ioctl (q->o, TXDELCD, "rts"); +#else /* ! HAVE_TXADDCD */ +#if HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS +#ifdef CRTSFL + q->snew.c_cflag &=~ CRTSFL; + q->snew.c_cflag &=~ (RTSFLOW | CTSFLOW); +#endif /* defined (CRTSFL) */ +#ifdef CRTSCTS + q->snew.c_cflag &=~ CRTSCTS; +#endif /* defined (CRTSCTS) */ +#ifdef CTSCD + q->snew.c_cflag &=~ CTSCD; +#endif /* defined (CTSCD) */ +#endif /* HAVE_SYSV_TERMIO || HAVE_POSIX_TERMIOS */ + if (! fsetterminfo (q->o, &q->snew)) + { + ulog (LOG_ERROR, "Can't disable hardware flow control: %s", + strerror (errno)); + return FALSE; + } +#endif /* ! HAVE_TXADDCD */ + } +#endif /* HAVE_HARDFLOW */ + + return TRUE; +} + /* Finish dialing out on a modem by closing any dialer device and waiting for carrier. */ @@ -1795,7 +1993,50 @@ fsysdep_modem_end_dial (qconn, qdial) return FALSE; } -#endif /* TIOCWONLINE */ +#else /* ! defined (TIOCWONLINE) */ + + /* Try to open the port again without using O_NDELAY. In + principle, the open should delay until carrier is available. + This may not work on some systems, so we just ignore any + errors. */ + { + int onew; + + onew = open (q->zdevice, O_RDWR); + if (onew >= 0) + { + boolean fbad; + int iflags; + + fbad = FALSE; + + if (fcntl (onew, F_SETFD, + fcntl (onew, F_GETFD, 0) | FD_CLOEXEC) < 0) + fbad = TRUE; + + if (! fbad) + { + iflags = fcntl (onew, F_GETFL, 0); + if (iflags < 0 + || ! fsetterminfo (onew, &q->snew)) + fbad = TRUE; + } + + if (fbad) + (void) close (onew); + else + { + (void) close (q->o); + q->o = onew; + q->iflags = iflags; +#if HAVE_TIOCSINUSE + (void) ioctl (onew, TIOCSINUSE, 0); +#endif + } + } + } + +#endif /* ! defined (TIOCWONLINE) */ } return TRUE; @@ -1855,6 +2096,7 @@ fsysdep_conn_read (qconn, zbuf, pclen, cmin, ctimeout, freport) boolean fret; register struct ssysdep_conn * const q = (struct ssysdep_conn *) qconn->psysdep; + int cwouldblock; cwant = *pclen; *pclen = 0; @@ -1893,6 +2135,7 @@ fsysdep_conn_read (qconn, zbuf, pclen, cmin, ctimeout, freport) fret = FALSE; + cwouldblock = 0; while (TRUE) { int cgot; @@ -2009,10 +2252,26 @@ fsysdep_conn_read (qconn, zbuf, pclen, cmin, ctimeout, freport) (normally we would have received SIGHUP, but we can't count on that). We turn off the signals before calling ulog to reduce problems with interrupted system calls. */ - if (cgot <= 0) + if (cgot > 0) + cwouldblock = 0; + else { if (cgot < 0 && errno == EINTR) cgot = 0; + else if (cgot < 0 + && (errno == EAGAIN || errno == EWOULDBLOCK) + && cwouldblock < 2) + { + /* Incomprehensibly, on some systems the read will + return EWOULDBLOCK even though the descriptor has + been set to blocking mode. We permit the read call + to do this twice in a row, and then error out. We + don't want to permit an arbitrary number of + EWOULDBLOCK errors, since that could hang us up + indefinitely. */ + ++cwouldblock; + cgot = 0; + } else { int ierr; @@ -2128,10 +2387,10 @@ fsysdep_conn_read (qconn, zbuf, pclen, cmin, ctimeout, freport) return fret; } -/* Read from a stdin port. */ +/* Read from a port with separate read/write file descriptors. */ -static boolean -fsstdin_read (qconn, zbuf, pclen, cmin, ctimeout, freport) +boolean +fsdouble_read (qconn, zbuf, pclen, cmin, ctimeout, freport) struct sconnection *qconn; char *zbuf; size_t *pclen; @@ -2142,7 +2401,7 @@ fsstdin_read (qconn, zbuf, pclen, cmin, ctimeout, freport) struct ssysdep_conn *qsysdep; qsysdep = (struct ssysdep_conn *) qconn->psysdep; - qsysdep->o = 0; + qsysdep->o = qsysdep->ord; return fsysdep_conn_read (qconn, zbuf, pclen, cmin, ctimeout, freport); } @@ -2180,7 +2439,7 @@ fsysdep_conn_write (qconn, zwrite, cwrite) #if HAVE_TLI if (q->ftli) { - cdid = t_snd (q->o, zwrite, cwrite, 0); + cdid = t_snd (q->o, (char *) zwrite, cwrite, 0); if (cdid < 0 && t_errno != TSYSERR) { ulog (LOG_ERROR, "t_snd: %s", @@ -2239,10 +2498,10 @@ fsysdep_conn_write (qconn, zwrite, cwrite) return TRUE; } -/* Write to a stdin port. */ +/* Write to a port with separate read/write file descriptors. */ -static boolean -fsstdin_write (qconn, zwrite, cwrite) +boolean +fsdouble_write (qconn, zwrite, cwrite) struct sconnection *qconn; const char *zwrite; size_t cwrite; @@ -2250,10 +2509,10 @@ fsstdin_write (qconn, zwrite, cwrite) struct ssysdep_conn *qsysdep; qsysdep = (struct ssysdep_conn *) qconn->psysdep; - qsysdep->o = 0; + qsysdep->o = qsysdep->ord; if (! fsblock (qsysdep, TRUE)) return FALSE; - qsysdep->o = 1; + qsysdep->o = qsysdep->owr; return fsysdep_conn_write (qconn, zwrite, cwrite); } @@ -2317,8 +2576,8 @@ fsysdep_conn_io (qconn, zwrite, pcwrite, zread, pcread) /* If we are running on standard input, we switch the file descriptors by hand. */ - if (q->istdout_flags >= 0) - q->o = 0; + if (q->ord >= 0) + q->o = q->ord; /* Do an unblocked read. */ if (! fsblock (q, FALSE)) @@ -2392,8 +2651,8 @@ fsysdep_conn_io (qconn, zwrite, pcwrite, zread, pcread) cdo = SINGLE_WRITE; #endif - if (q->istdout_flags >= 0) - q->o = 1; + if (q->owr >= 0) + q->o = q->owr; /* Loop until we get something besides EINTR. */ while (TRUE) @@ -2405,7 +2664,7 @@ fsysdep_conn_io (qconn, zwrite, pcwrite, zread, pcread) #if HAVE_TLI if (q->ftli) { - cdid = t_snd (q->o, zwrite, cdo, 0); + cdid = t_snd (q->o, (char *) zwrite, cdo, 0); if (cdid < 0) { if (t_errno == TFLOW) @@ -2460,8 +2719,8 @@ fsysdep_conn_io (qconn, zwrite, pcwrite, zread, pcread) { /* We didn't write any data. Do a blocking write. */ - if (q->istdout_flags >= 0) - q->o = 0; + if (q->ord >= 0) + q->o = q->ord; if (! fsblock (q, TRUE)) return FALSE; @@ -2471,11 +2730,11 @@ fsysdep_conn_io (qconn, zwrite, pcwrite, zread, pcread) cdo = SINGLE_WRITE; DEBUG_MESSAGE1 (DEBUG_PORT, - "fsysdep_conn_io: Blocking write of %lud", + "fsysdep_conn_io: Blocking write of %lu", (unsigned long) cdo); - if (q->istdout_flags >= 0) - q->o = 1; + if (q->owr >= 0) + q->o = q->owr; /* Loop until we get something besides EINTR. */ while (TRUE) @@ -2487,7 +2746,7 @@ fsysdep_conn_io (qconn, zwrite, pcwrite, zread, pcread) #if HAVE_TLI if (q->ftli) { - cdid = t_snd (q->o, zwrite, cdo, 0); + cdid = t_snd (q->o, (char *) zwrite, cdo, 0); if (cdid < 0 && t_errno != TSYSERR) { ulog (LOG_ERROR, "t_snd: %s", @@ -2576,7 +2835,7 @@ fsstdin_break (qconn) struct ssysdep_conn *qsysdep; qsysdep = (struct ssysdep_conn *) qconn->psysdep; - qsysdep->o = 1; + qsysdep->o = qsysdep->owr; return fsserial_break (qconn); } @@ -2805,6 +3064,22 @@ fsserial_set (qconn, tparity, tstrip, txonxoff) } #endif /* HAVE_POSIX_TERMIOS */ #endif /* defined (CRTSCTS) */ +#ifdef CRTSFL + if ((q->snew.c_cflag & CRTSFL) != 0) + { + iset = IXON; + iclear = IXOFF; + /* SCO says we cant have CRTSFL **and** RTSFLOW/CTSFLOW */ +#ifdef RTSFLOW + iclear |= RTSFLOW; +#endif +#ifdef CTSFLOW + iclear |= CTSFLOW; +#endif + fdo = TRUE; + break; + } +#endif /* defined(CRTSFL) */ iset = IXON | IXOFF; iclear = 0; fdo = TRUE; @@ -2890,7 +3165,7 @@ fsstdin_set (qconn, tparity, tstrip, txonxoff) struct ssysdep_conn *qsysdep; qsysdep = (struct ssysdep_conn *) qconn->psysdep; - qsysdep->o = 0; + qsysdep->o = qsysdep->ord; return fsserial_set (qconn, tparity, tstrip, txonxoff); } @@ -2954,15 +3229,22 @@ fsrun_chat (oread, owrite, pzprog) return ixswait ((unsigned long) ipid, "Chat program") == 0; } -/* Run a chat program on a stdin port. */ +/* Run a chat program on a port using separate read/write file + descriptors. */ -/*ARGSUSED*/ -static boolean -fsstdin_chat (qconn, pzprog) +boolean +fsdouble_chat (qconn, pzprog) struct sconnection *qconn; char **pzprog; { - return fsrun_chat (0, 1, pzprog); + struct ssysdep_conn *qsysdep; + boolean fret; + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + fret = fsrun_chat (qsysdep->ord, qsysdep->owr, pzprog); + if (qsysdep->fterminal) + (void) fgetterminfo (qsysdep->ord, &qsysdep->snew); + return fret; } /* Run a chat program on any general type of connection. */ @@ -2973,9 +3255,13 @@ fsysdep_conn_chat (qconn, pzprog) char **pzprog; { struct ssysdep_conn *qsysdep; + boolean fret; qsysdep = (struct ssysdep_conn *) qconn->psysdep; - return fsrun_chat (qsysdep->o, qsysdep->o, pzprog); + fret = fsrun_chat (qsysdep->o, qsysdep->o, pzprog); + if (qsysdep->fterminal) + (void) fgetterminfo (qsysdep->o, &qsysdep->snew); + return fret; } /* Return baud rate of a serial port. */ diff --git a/gnu/libexec/uucp/libunix/signal.c b/gnu/libexec/uucp/libunix/signal.c index 33e24a724574..75016c30e116 100644 --- a/gnu/libexec/uucp/libunix/signal.c +++ b/gnu/libexec/uucp/libunix/signal.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/sindir.c b/gnu/libexec/uucp/libunix/sindir.c index d98750818915..7c9da50045ff 100644 --- a/gnu/libexec/uucp/libunix/sindir.c +++ b/gnu/libexec/uucp/libunix/sindir.c @@ -18,7 +18,10 @@ zsysdep_in_dir (zdir, zfile) cdir = strlen (zdir); cfile = strlen (zfile); zret = zbufalc (cdir + cfile + 2); - memcpy (zret, zdir, cdir); + if (cdir == 1 && *zdir == '/') + cdir = 0; + else + memcpy (zret, zdir, cdir); memcpy (zret + cdir + 1, zfile, cfile); zret[cdir] = '/'; zret[cdir + cfile + 1] = '\0'; diff --git a/gnu/libexec/uucp/libunix/sleep.c b/gnu/libexec/uucp/libunix/sleep.c index b232f9674ff0..910c9292e198 100644 --- a/gnu/libexec/uucp/libunix/sleep.c +++ b/gnu/libexec/uucp/libunix/sleep.c @@ -10,5 +10,17 @@ void usysdep_sleep (c) int c; { +#if HAVE_NAPMS || HAVE_NAP || HAVE_USLEEP || HAVE_SELECT || HAVE_POLL + int i; + + /* In this case, usysdep_pause is accurate. */ + for (i = 2 * c; i > 0; i--) + usysdep_pause (); +#else + /* On some system sleep (1) may not sleep at all. Avoid this sort + of problem by always doing at least sleep (2). */ + if (c < 2) + c = 2; (void) sleep (c); +#endif } diff --git a/gnu/libexec/uucp/libunix/spawn.c b/gnu/libexec/uucp/libunix/spawn.c index 7ab080d1a9ca..67b915fc66a1 100644 --- a/gnu/libexec/uucp/libunix/spawn.c +++ b/gnu/libexec/uucp/libunix/spawn.c @@ -1,7 +1,7 @@ /* spawn.c Spawn a program securely. - 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. */ #include "uucp.h" @@ -102,6 +102,9 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, char *azenv[9]; char **pazenv; boolean ferr; +#if HAVE_FULLDUPLEX_PIPES + boolean ffullduplex; +#endif int ierr = 0; int onull; int aichild_descs[3]; @@ -196,6 +199,11 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, cpar_close = 0; cchild_close = 0; +#if HAVE_FULLDUPLEX_PIPES + ffullduplex = (aidescs[0] == SPAWN_WRITE_PIPE + && aidescs[1] == SPAWN_READ_PIPE); +#endif + for (i = 0; i < 3; i++) { if (aidescs[i] == SPAWN_NULL) @@ -224,6 +232,16 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, { int aipipe[2]; +#if HAVE_FULLDUPLEX_PIPES + if (ffullduplex && i == 1) + { + /* Just use the fullduplex pipe. */ + aidescs[i] = aidescs[0]; + aichild_descs[i] = aichild_descs[0]; + continue; + } +#endif + if (pipe (aipipe) < 0) { ierr = errno; @@ -249,8 +267,10 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, ++cpar_close; ++cchild_close; - if (fcntl (aidescs[i], F_SETFD, - fcntl (aidescs[i], F_GETFD, 0) | FD_CLOEXEC) < 0) + if (fcntl (aipipe[0], F_SETFD, + fcntl (aipipe[0], F_GETFD, 0) | FD_CLOEXEC) < 0 + || fcntl (aipipe[1], F_SETFD, + fcntl (aipipe[1], F_GETFD, 0) | FD_CLOEXEC) < 0) { ierr = errno; ferr = TRUE; @@ -332,9 +352,21 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, if (! fkeepuid) { + /* Return to the uid of the invoking user. */ (void) setuid (getuid ()); (void) setgid (getgid ()); } + else + { + /* Try to force the UUCP uid to be both real and effective user + ID, in order to present a consistent environment regardless + of the invoking user. This won't work on System V based + systems, but it will do no harm. It would be possible to use + a setuid root program to force the UID setting, but I don't + think the efficiency loss is worth it. */ + (void) setuid (geteuid ()); + (void) setgid (getegid ()); + } if (zchdir != NULL) (void) chdir (zchdir); @@ -352,11 +384,24 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell, #endif } +#ifdef isc386 +#ifdef _POSIX_SOURCE + /* ISC has a remarkably stupid notion of environments. If a program + is compiled in the POSIX environment, it sets a process state. + If you then exec a program which expects the USG environment, the + process state is not reset, so the execed program fails. The + __setostype call is required to change back to the USG + environment. This ought to be a switch in policy.h, but it seems + too trivial, so I will leave this code here and wait for it to + break in some fashion in the next version of ISC. */ + __setostype (0); +#endif +#endif + (void) execve ((char *) zcmd, (char **) pazargs, pazenv); /* The exec failed. If permitted, try using /bin/sh to execute a shell script. */ - if (errno == ENOEXEC && fshell) { char *zto; diff --git a/gnu/libexec/uucp/libunix/splcmd.c b/gnu/libexec/uucp/libunix/splcmd.c index 9f6616a36dd0..774066119967 100644 --- a/gnu/libexec/uucp/libunix/splcmd.c +++ b/gnu/libexec/uucp/libunix/splcmd.c @@ -1,7 +1,7 @@ /* splcmd.c Spool a command. - 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. */ #include "uucp.h" @@ -44,10 +44,12 @@ zsysdep_spool_commands (qsys, bgrade, ccmds, pascmds) int ccmds; const struct scmd *pascmds; { - char *z; + char abtempfile[sizeof "TMP1234567890"]; + char *ztemp; FILE *e; int i; const struct scmd *q; + char *z; char *zjobid; #if DEBUG > 0 @@ -55,14 +57,17 @@ zsysdep_spool_commands (qsys, bgrade, ccmds, pascmds) ulog (LOG_FATAL, "Bad grade %d", bgrade); #endif - z = zscmd_file (qsys, bgrade); - if (z == NULL) + /* Write the commands into a temporary file and then rename it to + avoid a race with uucico reading the file. */ + sprintf (abtempfile, "TMP%010lx", (unsigned long) getpid ()); + ztemp = zsfind_file (abtempfile, qsys->uuconf_zname, bgrade); + if (ztemp == NULL) return NULL; - e = esysdep_fopen (z, FALSE, FALSE, TRUE); + e = esysdep_fopen (ztemp, FALSE, FALSE, TRUE); if (e == NULL) { - ubuffree (z); + ubuffree (ztemp); return NULL; } @@ -93,8 +98,8 @@ zsysdep_spool_commands (qsys, bgrade, ccmds, pascmds) "zsysdep_spool_commands: Unrecognized type %d", q->bcmd); (void) fclose (e); - (void) remove (z); - ubuffree (z); + (void) remove (ztemp); + ubuffree (ztemp); return NULL; } } @@ -102,11 +107,30 @@ zsysdep_spool_commands (qsys, bgrade, ccmds, pascmds) if (fclose (e) != 0) { ulog (LOG_ERROR, "fclose: %s", strerror (errno)); - (void) remove (z); + (void) remove (ztemp); + ubuffree (ztemp); + return NULL; + } + + z = zscmd_file (qsys, bgrade); + if (z == NULL) + { + (void) remove (ztemp); + ubuffree (ztemp); + return NULL; + } + + if (! fsysdep_move_file (ztemp, z, FALSE, FALSE, FALSE, + (const char *) NULL)) + { + (void) remove (ztemp); + ubuffree (ztemp); ubuffree (z); return NULL; } + ubuffree (ztemp); + zjobid = zsfile_to_jobid (qsys, z, bgrade); if (zjobid == NULL) (void) remove (z); diff --git a/gnu/libexec/uucp/libunix/spool.c b/gnu/libexec/uucp/libunix/spool.c index a3e50f7747f1..fa1d8e6b34c2 100644 --- a/gnu/libexec/uucp/libunix/spool.c +++ b/gnu/libexec/uucp/libunix/spool.c @@ -1,7 +1,7 @@ /* spool.c Find a file in the spool directory. - 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 spool_rcsid[] = "$Id: spool.c,v 1.1 1993/08/05 18:24:31 conklin Exp $"; +const char spool_rcsid[] = "$Id: spool.c,v 1.2 1994/05/07 18:11:24 ache Exp $"; #endif #include "uudefs.h" @@ -194,7 +194,12 @@ zsfind_file (zsimple, zsystem, bgrade) const char *zsystem; int bgrade; { - if (! fspool_file (zsimple)) + /* zsysdep_spool_commands calls this with TMPXXX which we must treat + as a C. file. */ + if ((zsimple[0] != 'T' + || zsimple[1] != 'M' + || zsimple[2] != 'P') + && ! fspool_file (zsimple)) { ulog (LOG_ERROR, "Unrecognized file name %s", zsimple); return NULL; @@ -203,7 +208,9 @@ zsfind_file (zsimple, zsystem, bgrade) #if ! SPOOLDIR_HDB && ! SPOOLDIR_SVR4 && ! SPOOLDIR_TAYLOR if (*zsimple == 'X') { - size_t clen; + static char *zbuf; + static size_t cbuf; + size_t clen, cwant; /* Files beginning with X. are execute files. It is important for security reasons that we know the system which created @@ -216,22 +223,19 @@ zsfind_file (zsimple, zsystem, bgrade) too short, but hopefully no problem will occur since any System V systems will be using HDB or SVR4 or TAYLOR. */ clen = strlen (zsimple); - if (clen <= 7 || strncmp (zsimple + 2, zsystem, clen - 7) != 0) + if (clen < 5) { - static char *zbuf; - static size_t cbuf; - size_t cwant; - - cwant = strlen (zsystem) + 8; - if (cwant > cbuf) - { - zbuf = (char *) xrealloc ((pointer) zbuf, cwant); - cbuf = cwant; - } - sprintf (zbuf, "X.%s%s", zsystem, - clen < 5 ? zsimple : zsimple + clen - 5); - zsimple = zbuf; + ulog (LOG_ERROR, "Bad file name (too short) %s", zsimple); + return NULL; } + cwant = strlen (zsystem) + 8; + if (cwant > cbuf) + { + zbuf = (char *) xrealloc ((pointer) zbuf, cwant); + cbuf = cwant; + } + sprintf (zbuf, "X.%s%s", zsystem, zsimple + clen - 5); + zsimple = zbuf; } #endif /* ! SPOOLDIR_HDB && ! SPOOLDIR_SVR4 && ! SPOOLDIR_TAYLOR */ @@ -264,6 +268,7 @@ zsfind_file (zsimple, zsystem, bgrade) switch (*zsimple) { case 'C': + case 'T': #if SPOOLDIR_BSD42 || SPOOLDIR_BSD43 return zsysdep_in_dir ("C.", zsimple); #endif /* SPOOLDIR_BSD42 || SPOOLDIR_BSD43 */ diff --git a/gnu/libexec/uucp/libunix/srmdir.c b/gnu/libexec/uucp/libunix/srmdir.c index 28487ef30970..6110b003fc25 100644 --- a/gnu/libexec/uucp/libunix/srmdir.c +++ b/gnu/libexec/uucp/libunix/srmdir.c @@ -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. */ #include "uucp.h" @@ -35,7 +35,7 @@ #include <ftw.h> #endif -static int isremove_dir P((const char *, const struct stat *, int)); +static int isremove_dir P((const char *, struct stat *, int)); /* Keep a list of directories to be removed. */ @@ -90,7 +90,7 @@ fsysdep_rmdir (zdir) static int isremove_dir (zfile, qstat, iflag) const char *zfile; - const struct stat *qstat; + struct stat *qstat; int iflag; { if (iflag == FTW_D || iflag == FTW_DNR) diff --git a/gnu/libexec/uucp/libunix/statsb.c b/gnu/libexec/uucp/libunix/statsb.c index aa17f9e9df07..733cad260fa3 100644 --- a/gnu/libexec/uucp/libunix/statsb.c +++ b/gnu/libexec/uucp/libunix/statsb.c @@ -1,7 +1,7 @@ /* statsb.c System dependent routines for uustat. - 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 statsb_rcsid[] = "$Id: statsb.c,v 1.1 1993/08/05 18:24:34 conklin Exp $"; +const char statsb_rcsid[] = "$Id: statsb.c,v 1.2 1994/05/07 18:11:29 ache Exp $"; #endif #include "uudefs.h" @@ -73,32 +73,16 @@ const char statsb_rcsid[] = "$Id: statsb.c,v 1.1 1993/08/05 18:24:34 conklin Exp /* Local functions. */ -static int ussettime P((const char *z, time_t inow)); +static int issettime P((const char *z, time_t inow)); static boolean fskill_or_rejuv P((pointer puuconf, const char *zid, boolean fkill)); -/* See whether the user is permitted to kill arbitrary jobs. This is - true only for root and uucp. We check for uucp by seeing if the - real user ID and the effective user ID are the same; this works - because we should be suid to uucp, so our effective user ID will - always be uucp while our real user ID will be whoever ran the - program. */ - -boolean -fsysdep_privileged () -{ - uid_t iuid; - - iuid = getuid (); - return iuid == 0 || iuid == geteuid (); -} - /* Set file access time to the present. On many systems this could be done by passing NULL to utime, but on some that doesn't work. This routine is not time critical, so we never rely on NULL. */ static int -ussettime(z, inow) +issettime(z, inow) const char *z; time_t inow; { @@ -238,7 +222,7 @@ fskill_or_rejuv (puuconf, zid, fkill) if (fkill) isys = remove (ztemp); else - isys = ussettime (ztemp, inow); + isys = issettime (ztemp, inow); if (isys != 0 && errno != ENOENT) { @@ -261,7 +245,7 @@ fskill_or_rejuv (puuconf, zid, fkill) if (fkill) isys = remove (zfile); else - isys = ussettime (zfile, inow); + isys = issettime (zfile, inow); if (isys != 0 && errno != ENOENT) { @@ -313,6 +297,21 @@ ixsysdep_file_time (zfile) return (long) s.st_mtime; } + +/* Set the time of a file to the current time. */ + +boolean +fsysdep_touch_file (zfile) + const char *zfile; +{ + if (issettime (zfile, time ((time_t *) NULL)) != 0) + { + ulog (LOG_ERROR, "utime (%s): %s", zfile, strerror (errno)); + return FALSE; + } + + return TRUE; +} /* Start getting the status files. */ @@ -399,7 +398,10 @@ fsysdep_lock_status () DIR *qdir; struct dirent *qentry; int calc; - int *pai; + pid_t *pai; +#if HAVE_QNX_LOCKFILES + nid_t *painid; +#endif int cgot; int aidescs[3]; char *zcopy, *ztok; @@ -420,18 +422,28 @@ fsysdep_lock_status () calc = 0; pai = NULL; cgot = 0; +#if HAVE_QNX_LOCKFILES + painid = NULL; +#endif while ((qentry = readdir (qdir)) != NULL) { char *zname; int o; +#if HAVE_QNX_LOCKFILES + nid_t inid; + char ab[23]; + char *zend; +#else #if HAVE_V2_LOCKFILES int i; #else char ab[12]; #endif +#endif int cread; int ierr; - int ipid; + pid_t ipid; + int icheck; if (strncmp (qentry->d_name, "LCK..", sizeof "LCK.." - 1) != 0) continue; @@ -464,22 +476,45 @@ fsysdep_lock_status () ubuffree (zname); +#if HAVE_QNX_LOCKFILES + ab[cread] = '\0'; + ipid = (pid_t) strtol (ab, &zend, 10); + inid = (nid_t) strtol (zend, (char **) NULL, 10); +#else #if HAVE_V2_LOCKFILES - ipid = i; + ipid = (pid_t) i; #else ab[cread] = '\0'; - ipid = strtol (ab, (char **) NULL, 10); + ipid = (pid_t) strtol (ab, (char **) NULL, 10); +#endif #endif - printf ("%s: %d\n", qentry->d_name, ipid); +#if HAVE_QNX_LOCKFILES + printf ("%s: %ld %ld\n", qentry->d_name, (long) inid, (long) ipid); +#else + printf ("%s: %ld\n", qentry->d_name, (long) ipid); +#endif + + for (icheck = 0; icheck < cgot; icheck++) + if (pai[icheck] == ipid) + break; + if (icheck < cgot) + continue; if (cgot >= calc) { calc += 10; - pai = (int *) xrealloc ((pointer) pai, calc * sizeof (int)); + pai = (pid_t *) xrealloc ((pointer) pai, calc * sizeof (pid_t)); +#if HAVE_QNX_LOCKFILES + painid = (nid_t *) xrealloc ((pointer) painid, + calc * sizeof (nid_t)); +#endif } pai[cgot] = ipid; +#if HAVE_QNX_LOCKFILES + painid[cgot] = inid; +#endif ++cgot; } @@ -513,16 +548,40 @@ fsysdep_lock_status () { int i; char *zlast, *zset; +#if HAVE_QNX_LOCKFILES + char *zpenultimate, *zsetnid; +#endif /* HAVE_QNX_LOCKFILES */ zlast = pazargs[cargs - 1]; zset = zbufalc (strlen (zlast) + 20); + +#if HAVE_QNX_LOCKFILES + /* We assume in this case that PS_PROGRAM ends with " -n -p". + Thus, the last argument is "-p" and the second-to-last + (penultimate) argument is "-n". We modify them to read "-n###" + and "-p###" where "###" is the node ID and the process ID, + respectively. This seems like quite a roundabout way of doing + things. Why don't we just leave the " -n -p" part out of + PS_PROGRAM and construct the "-n###" and "-p###" arguments here + from scratch? Because that would not fit as well with how the + code works for the other systems and would require larger + changes. */ + zpenultimate = pazargs[cargs - 2]; + zsetnid = zbufalc (strlen (zpenultimate) + 20); +#endif + for (i = 0; i < cgot; i++) { pid_t ipid; - sprintf (zset, "%s%d", zlast, pai[i]); + sprintf (zset, "%s%ld", zlast, (long) pai[i]); pazargs[cargs - 1] = zset; +#if HAVE_QNX_LOCKFILES + sprintf (zsetnid, "%s%ld", zpenultimate, (long) painid[i]); + pazargs[cargs - 2] = zsetnid; +#endif + ipid = ixsspawn ((const char **) pazargs, aidescs, FALSE, FALSE, (const char *) NULL, FALSE, TRUE, (const char *) NULL, (const char *) NULL, @@ -533,6 +592,9 @@ fsysdep_lock_status () (void) ixswait ((unsigned long) ipid, PS_PROGRAM); } ubuffree (zset); +#if HAVE_QNX_LOCKFILES + ubuffree (zsetnid); +#endif } #else { @@ -546,7 +608,7 @@ fsysdep_lock_status () { char ab[20]; - sprintf (ab, "%d", pai[i]); + sprintf (ab, "%ld", (long) pai[i]); strcat (zlast, ab); if (i + 1 < cgot) strcat (zlast, ","); @@ -563,7 +625,7 @@ fsysdep_lock_status () (void) ixswait ((unsigned long) ipid, PS_PROGRAM); ubuffree (zlast); } -#endif +#endif ubuffree (zcopy); xfree ((pointer) pazargs); diff --git a/gnu/libexec/uucp/libunix/status.c b/gnu/libexec/uucp/libunix/status.c index f403068a7094..a967085e08ff 100644 --- a/gnu/libexec/uucp/libunix/status.c +++ b/gnu/libexec/uucp/libunix/status.c @@ -1,7 +1,7 @@ /* status.c Routines to get and set the status for a system. - 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. */ #include "uucp.h" @@ -41,7 +41,7 @@ static const int aiMapstatus[] = { - 0, 13, 7, 6, 4, 20, 3, 2 + 0, 13, 7, 6, 20, 4, 3, 2 }; #define CMAPENTRIES (sizeof (aiMapstatus) / sizeof (aiMapstatus[0])) diff --git a/gnu/libexec/uucp/libunix/strerr.c b/gnu/libexec/uucp/libunix/strerr.c index d2a6c2128d04..8e7480f1ec5c 100644 --- a/gnu/libexec/uucp/libunix/strerr.c +++ b/gnu/libexec/uucp/libunix/strerr.c @@ -12,6 +12,8 @@ extern int sys_nerr; extern char *sys_errlist[]; #endif +#undef strerror + char * strerror (ierr) int ierr; diff --git a/gnu/libexec/uucp/libunix/tmpfil.c b/gnu/libexec/uucp/libunix/tmpfil.c index 2dac0024388a..b10e8096df4e 100644 --- a/gnu/libexec/uucp/libunix/tmpfil.c +++ b/gnu/libexec/uucp/libunix/tmpfil.c @@ -1,7 +1,7 @@ /* tmpfil.c Get a temporary file name. - 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,11 +20,12 @@ 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" +#include "uudefs.h" #include "uuconf.h" #include "system.h" #include "sysdep.h" diff --git a/gnu/libexec/uucp/libunix/uacces.c b/gnu/libexec/uucp/libunix/uacces.c index c92c78eae354..d99ead36674b 100644 --- a/gnu/libexec/uucp/libunix/uacces.c +++ b/gnu/libexec/uucp/libunix/uacces.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/ufopen.c b/gnu/libexec/uucp/libunix/ufopen.c index 5a7b6f22b0d0..76ee1d1394d5 100644 --- a/gnu/libexec/uucp/libunix/ufopen.c +++ b/gnu/libexec/uucp/libunix/ufopen.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libunix/walk.c b/gnu/libexec/uucp/libunix/walk.c index ab96123127dd..85b94dae8a98 100644 --- a/gnu/libexec/uucp/libunix/walk.c +++ b/gnu/libexec/uucp/libunix/walk.c @@ -11,8 +11,7 @@ #include <ftw.h> #endif -static int iswalk_dir P((const char *zname, const struct stat *qstat, - int iflag)); +static int iswalk_dir P((const char *zname, struct stat *qstat, int iflag)); /* Walk a directory tree. */ @@ -41,7 +40,7 @@ usysdep_walk_tree (zdir, pufn, pinfo) static int iswalk_dir (zname, qstat, iflag) const char *zname; - const struct stat *qstat; + struct stat *qstat; int iflag; { char *zcopy; diff --git a/gnu/libexec/uucp/libunix/wldcrd.c b/gnu/libexec/uucp/libunix/wldcrd.c index cfbd15eb848a..13faa29b9c43 100644 --- a/gnu/libexec/uucp/libunix/wldcrd.c +++ b/gnu/libexec/uucp/libunix/wldcrd.c @@ -1,7 +1,7 @@ /* wldcrd.c Expand wildcards. - 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. */ #include "uucp.h" @@ -113,9 +113,10 @@ fsysdep_wildcard_start (zfile) azargs[2] = zcmd; azargs[3] = NULL; + e = espopen (azargs, TRUE, &ipid); + ubuffree (zcmd); - e = espopen (azargs, TRUE, &ipid); if (e == NULL) { ulog (LOG_ERROR, "espopen: %s", strerror (errno)); diff --git a/gnu/libexec/uucp/libunix/work.c b/gnu/libexec/uucp/libunix/work.c index 8744347aeb44..f5cdb7969e17 100644 --- a/gnu/libexec/uucp/libunix/work.c +++ b/gnu/libexec/uucp/libunix/work.c @@ -1,7 +1,7 @@ /* work.c Routines to read command files. - 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 work_rcsid[] = "$Id: work.c,v 1.1 1993/08/05 18:24:45 conklin Exp $"; +const char work_rcsid[] = "$Id: work.c,v 1.2 1994/05/07 18:11:41 ache Exp $"; #endif #include "uudefs.h" @@ -55,10 +55,25 @@ static int iswork_cmp P((constpointer pkey, constpointer pdatum)); /* These functions can support multiple actions going on at once. This allows the UUCP package to send and receive multiple files at - the same time. This is a very flexible feature, but I'm not sure - it will actually be used all that much. + the same time. */ - The ssfile structure holds a command file name and all the lines +/* To avoid wasting a lot of time scanning the spool directory, which + might cause the remote system to time out, we limit each scan to + pick up at most a certain number of files. */ +#define COMMANDS_PER_SCAN (200) + +/* The ssfilename structure holds the name of a work file, as well as + its grade. */ + +struct ssfilename +{ + char *zfile; + char bgrade; + /* Some compiler may need this, and it won't normally hurt. */ + char bdummy; +}; + +/* The ssfile structure holds a command file name and all the lines read in from that command file. The union within the ssline structure initially holds a line from the file and then holds a pointer back to the ssfile structure; a pointer to this union is @@ -77,6 +92,9 @@ struct ssline struct ssfile { char *zfile; + char bgrade; + /* bdummy is needed for some buggy compilers. */ + char bdummy; int clines; int cdid; struct ssline aslines[CFILELINES]; @@ -84,7 +102,7 @@ struct ssfile /* Static variables for the work scan. */ -static char **azSwork_files; +static struct ssfilename *asSwork_files; static size_t cSwork_files; static size_t iSwork_file; static struct ssfile *qSwork_file; @@ -182,10 +200,10 @@ iswork_cmp (pkey, pdatum) constpointer pkey; constpointer pdatum; { - const char * const *pzkey = (const char * const *) pkey; - const char * const *pzdatum = (const char * const *) pdatum; + const struct ssfilename *qkey = (const struct ssfilename *) pkey; + const struct ssfilename *qdatum = (const struct ssfilename *) pdatum; - return strcmp (*pzkey, *pzdatum); + return strcmp (qkey->zfile, qdatum->zfile); } /* See whether there is any work to do for a particular system. */ @@ -309,7 +327,8 @@ fsysdep_get_work_init (qsys, bgrade) (bad) qsort implementations are very slow when given a sorted array, which causes particularly bad effects here. */ if (chad > 0) - qsort ((pointer) azSwork_files, chad, sizeof (char *), iswork_cmp); + qsort ((pointer) asSwork_files, chad, sizeof (struct ssfilename), + iswork_cmp); #if SPOOLDIR_SVR4 qgdir = qdir; @@ -342,6 +361,7 @@ fsysdep_get_work_init (qsys, bgrade) { char bfilegrade; char *zname; + struct ssfilename slook; #if ! SPOOLDIR_SVR4 zname = zbufcpy (qentry->d_name); @@ -350,13 +370,14 @@ fsysdep_get_work_init (qsys, bgrade) bfilegrade = qgentry->d_name[0]; #endif + slook.zfile = zname; if (! fswork_file (qsys->uuconf_zname, qentry->d_name, &bfilegrade) || UUCONF_GRADE_CMP (bgrade, bfilegrade) < 0 - || (azSwork_files != NULL - && bsearch ((pointer) &zname, - (pointer) azSwork_files, - chad, sizeof (char *), + || (asSwork_files != NULL + && bsearch ((pointer) &slook, + (pointer) asSwork_files, + chad, sizeof (struct ssfilename), iswork_cmp) != NULL)) ubuffree (zname); else @@ -368,18 +389,24 @@ fsysdep_get_work_init (qsys, bgrade) if (cSwork_files >= callocated) { callocated += CWORKFILES; - azSwork_files = - (char **) xrealloc ((pointer) azSwork_files, - callocated * sizeof (char *)); + asSwork_files = + ((struct ssfilename *) + xrealloc ((pointer) asSwork_files, + (callocated * sizeof (struct ssfilename)))); } - azSwork_files[cSwork_files] = zname; + asSwork_files[cSwork_files].zfile = zname; + asSwork_files[cSwork_files].bgrade = bfilegrade; ++cSwork_files; + if (cSwork_files - chad > COMMANDS_PER_SCAN) + break; } } #if SPOOLDIR_SVR4 closedir (qdir); + if (cSwork_files - chad > COMMANDS_PER_SCAN) + break; } qdir = qgdir; #endif @@ -389,10 +416,10 @@ fsysdep_get_work_init (qsys, bgrade) /* Sorting the files alphabetically will get the grades in the right order, since all the file prefixes are the same. */ - - if (cSwork_files > chad) - qsort ((pointer) (azSwork_files + chad), cSwork_files - chad, - sizeof (char *), iswork_cmp); + if (cSwork_files > iSwork_file) + qsort ((pointer) (asSwork_files + iSwork_file), + cSwork_files - iSwork_file, + sizeof (struct ssfilename), iswork_cmp); return TRUE; } @@ -417,7 +444,7 @@ fsysdep_get_work (qsys, bgrade, qcmd) if (qSwork_file != NULL && qSwork_file->cdid >= qSwork_file->clines) qSwork_file = NULL; - if (azSwork_files == NULL) + if (asSwork_files == NULL) { qcmd->bcmd = 'H'; return TRUE; @@ -437,6 +464,7 @@ fsysdep_get_work (qsys, bgrade, qcmd) char *zline; size_t cline; char *zname; + char bfilegrade; /* Read all the lines of a command file into memory. */ do @@ -464,7 +492,8 @@ fsysdep_get_work (qsys, bgrade, qcmd) return FALSE; } - zname = zsysdep_in_dir (zdir, azSwork_files[iSwork_file]); + zname = zsysdep_in_dir (zdir, asSwork_files[iSwork_file].zfile); + bfilegrade = asSwork_files[iSwork_file].bgrade; ++iSwork_file; @@ -521,6 +550,7 @@ fsysdep_get_work (qsys, bgrade, qcmd) } qfile->zfile = zname; + qfile->bgrade = bfilegrade; qfile->clines = iline; qfile->cdid = 0; qSwork_file = qfile; @@ -554,6 +584,7 @@ fsysdep_get_work (qsys, bgrade, qcmd) qSwork_file->aslines[iline].zline = NULL; continue; } + qcmd->bgrade = qSwork_file->bgrade; qSwork_file->aslines[iline].qfile = qSwork_file; qcmd->pseq = (pointer) (&qSwork_file->aslines[iline]); @@ -652,14 +683,14 @@ void usysdep_get_work_free (qsys) const struct uuconf_system *qsys; { - if (azSwork_files != NULL) + if (asSwork_files != NULL) { size_t i; for (i = 0; i < cSwork_files; i++) - ubuffree ((pointer) azSwork_files[i]); - xfree ((pointer) azSwork_files); - azSwork_files = NULL; + ubuffree ((pointer) asSwork_files[i].zfile); + xfree ((pointer) asSwork_files); + asSwork_files = NULL; cSwork_files = 0; iSwork_file = 0; } @@ -710,6 +741,7 @@ zsysdep_save_temp_file (pseq) if (! fsysdep_move_file (qline->ztemp, zto, TRUE, FALSE, FALSE, (const char *) NULL)) { + /* Leave the file where it was, not that is much help. */ ubuffree (zto); return "Could not move file to preservation directory"; } @@ -743,7 +775,7 @@ zsysdep_jobid (qsys, pseq) this is a remote file; returning -1 will cause zsfind_file to do the right thing. */ -char +int bsgrade (pseq) pointer pseq; { diff --git a/gnu/libexec/uucp/libunix/xqtfil.c b/gnu/libexec/uucp/libunix/xqtfil.c index 9edb40f23fef..75cbc5393472 100644 --- a/gnu/libexec/uucp/libunix/xqtfil.c +++ b/gnu/libexec/uucp/libunix/xqtfil.c @@ -1,7 +1,7 @@ /* xqtfil.c Routines to read execute files. - 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 xqtfil_rcsid[] = "$Id: xqtfil.c,v 1.1 1993/08/05 18:24:46 conklin Exp $"; +const char xqtfil_rcsid[] = "$Id: xqtfil.c,v 1.2 1994/05/07 18:11:42 ache Exp $"; #endif #include "uudefs.h" @@ -144,9 +144,8 @@ zsysdep_get_xqt (pzsystem, pferr) return NULL; } - /* No system name may start with a dot (this is enforced by - tisystem in sysinf.c). This allows us to quickly skip - impossible directories. */ + /* No system name may start with a dot This allows us to + quickly skip impossible directories. */ if (qtop->d_name[0] == '.') continue; diff --git a/gnu/libexec/uucp/libunix/xqtsub.c b/gnu/libexec/uucp/libunix/xqtsub.c index 87b558b83086..a7aca2a60efb 100644 --- a/gnu/libexec/uucp/libunix/xqtsub.c +++ b/gnu/libexec/uucp/libunix/xqtsub.c @@ -1,7 +1,7 @@ /* xqtsub.c System dependent functions used only by uuxqt. - 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 xqtsub_rcsid[] = "$Id: xqtsub.c,v 1.1 1993/08/05 18:24:47 conklin Exp $"; +const char xqtsub_rcsid[] = "$Id: xqtsub.c,v 1.2 1994/05/07 18:11:43 ache Exp $"; #endif #include "uudefs.h" @@ -89,6 +89,7 @@ zsysdep_find_command (zcmd, pzcmds, pzpath, pferr) boolean *pferr; { char **pz; + struct stat s; *pferr = FALSE; @@ -110,7 +111,16 @@ zsysdep_find_command (zcmd, pzcmds, pzpath, pferr) /* If we already have an absolute path, we can get out immediately. */ if (**pz == '/') - return zbufcpy (*pz); + { + /* Quick error check. */ + if (stat (*pz, &s) != 0) + { + ulog (LOG_ERROR, "%s: %s", *pz, strerror (errno)); + *pferr = TRUE; + return NULL; + } + return zbufcpy (*pz); + } break; } } @@ -124,14 +134,12 @@ zsysdep_find_command (zcmd, pzcmds, pzpath, pferr) for (pz = pzpath; *pz != NULL; pz++) { char *zname; - struct stat s; zname = zsysdep_in_dir (*pz, zcmd); if (stat (zname, &s) == 0) return zname; } - *pferr = FALSE; return NULL; } @@ -159,7 +167,8 @@ zsysdep_xqt_local_file (qsys, zfile) memcpy (zret, zfile + 1, clen); return zret; } - return zsysdep_local_file (zfile, qsys->uuconf_zpubdir); + return zsysdep_local_file (zfile, qsys->uuconf_zpubdir, + (boolean *) NULL); } #if ! ALLOW_FILENAME_ARGUMENTS @@ -177,9 +186,12 @@ fsysdep_xqt_check_file (qsys, zfile) { size_t clen; + /* Disallow exact "..", prefix "../", suffix "/..", internal "/../", + and restricted absolute paths. */ clen = strlen (zfile); - if ((clen == sizeof "../" - 1 - && strcmp (zfile, "../") == 0) + if ((clen == sizeof ".." - 1 + && strcmp (zfile, "..") == 0) + || strncmp (zfile, "../", sizeof "../" - 1) == 0 || (clen >= sizeof "/.." - 1 && strcmp (zfile + clen - (sizeof "/.." - 1), "/..") == 0) || strstr (zfile, "/../") != NULL @@ -358,7 +370,7 @@ fsysdep_execute (qsys, zuser, pazargs, zfullcmd, zinput, zoutput, /* Pass zchdir as zxqtdir, fnosigs as TRUE, fshell as TRUE if we aren't already using the shell. */ - ipid = ixsspawn (pazargs, aidescs, FALSE, FALSE, zxqtdir, TRUE, + ipid = ixsspawn (pazargs, aidescs, TRUE, FALSE, zxqtdir, TRUE, ! fshell, zpath, qsys->uuconf_zname, zuser); ierr = errno; diff --git a/gnu/libexec/uucp/libuuconf/MANIFEST b/gnu/libexec/uucp/libuuconf/MANIFEST index 8d1eb3646632..98787b59489a 100644 --- a/gnu/libexec/uucp/libuuconf/MANIFEST +++ b/gnu/libexec/uucp/libuuconf/MANIFEST @@ -61,6 +61,7 @@ rdlocs.c rdperm.c reliab.c remunk.c +runuxq.c sinfo.c snams.c split.c diff --git a/gnu/libexec/uucp/libuuconf/Makefile b/gnu/libexec/uucp/libuuconf/Makefile index f990bef51581..52a5be2142b9 100644 --- a/gnu/libexec/uucp/libuuconf/Makefile +++ b/gnu/libexec/uucp/libuuconf/Makefile @@ -1,19 +1,19 @@ # This is the Makefile for the Taylor UUCP uuconf library -# $Id: Makefile,v 1.1 1993/08/05 18:24:52 conklin Exp $ +# $Id: Makefile,v 1.2 1994/05/07 18:11:49 ache Exp $ LIB= uuconf -SRCS= addblk.c addstr.c allblk.c alloc.c base.c bool.c callin.c \ - calout.c chatc.c cmdarg.c cmdfil.c cmdlin.c debfil.c deblev.c \ - diacod.c dial.c diasub.c dnams.c errno.c errstr.c filnam.c \ - freblk.c fredia.c free.c freprt.c fresys.c grdcmp.c hdial.c \ - hdnams.c hinit.c hlocnm.c hport.c hrmunk.c hsinfo.c hsnams.c \ - hsys.c hunk.c iniglb.c init.c int.c lckdir.c lineno.c llocnm.c \ - local.c locnm.c logfil.c maxuxq.c mrgblk.c paramc.c port.c \ - prtsub.c pubdir.c rdlocs.c rdperm.c reliab.c remunk.c sinfo.c \ - snams.c split.c spool.c stafil.c syssub.c tcalou.c tdial.c \ - tdialc.c tdnams.c tgcmp.c thread.c time.c tinit.c tlocnm.c \ - tport.c tportc.c tsinfo.c tsnams.c tsys.c tval.c ugtlin.c \ - unk.c val.c vinit.c vport.c vsinfo.c vsnams.c vsys.c +SRCS = addblk.c addstr.c allblk.c alloc.c base.c bool.c callin.c \ + calout.c chatc.c cmdarg.c cmdfil.c cmdlin.c debfil.c deblev.c \ + diacod.c dial.c diasub.c dnams.c errno.c errstr.c filnam.c \ + freblk.c fredia.c free.c freprt.c fresys.c grdcmp.c hdial.c \ + hdnams.c hinit.c hlocnm.c hport.c hrmunk.c hsinfo.c hsnams.c \ + hsys.c hunk.c iniglb.c init.c int.c lckdir.c lineno.c llocnm.c \ + local.c locnm.c logfil.c maxuxq.c mrgblk.c paramc.c port.c \ + prtsub.c pubdir.c rdlocs.c rdperm.c reliab.c remunk.c runuxq.c \ + sinfo.c snams.c split.c spool.c stafil.c syssub.c tcalou.c \ + tdial.c tdialc.c tdnams.c tgcmp.c thread.c time.c tinit.c \ + tlocnm.c tport.c tportc.c tsinfo.c tsnams.c tsys.c tval.c \ + ugtlin.c unk.c val.c vinit.c vport.c vsinfo.c vsnams.c vsys.c CFLAGS+= -I$(.CURDIR)/../common_sources \ -DNEWCONFIGLIB=\"$(newconfigdir)\"\ -DOLDCONFIGLIB=\"$(oldconfigdir)\" diff --git a/gnu/libexec/uucp/libuuconf/README b/gnu/libexec/uucp/libuuconf/README index 64a5eecf03a5..b9a2156c86dc 100644 --- a/gnu/libexec/uucp/libuuconf/README +++ b/gnu/libexec/uucp/libuuconf/README @@ -1,8 +1,8 @@ This is the README file for the beta release of the uuconf library. It was written by Ian Lance Taylor. I can be reached at ian@airs.com, -or, equivalently, uunet!airs!ian, or c/o Infinity Development Systems, -P.O. Box 520, Waltham MA, 02254. +or, equivalently, uunet!cygint!airs!ian, or c/o Cygnus Support, 4th +Floor, Building 200, 1 Kendall Square, Cambridge MA, 02139, USA. This package is covered by the Gnu Library General Public License. See the file COPYING.LIB for details. If you would like to do diff --git a/gnu/libexec/uucp/libuuconf/addblk.c b/gnu/libexec/uucp/libuuconf/addblk.c index 49517273c924..4a3ecdd3f024 100644 --- a/gnu/libexec/uucp/libuuconf/addblk.c +++ b/gnu/libexec/uucp/libuuconf/addblk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_addblk_rcsid[] = "$Id: addblk.c,v 1.1 1993/08/05 18:24:56 conklin Exp $"; +const char _uuconf_addblk_rcsid[] = "$Id: addblk.c,v 1.2 1994/05/07 18:11:51 ache Exp $"; #endif #include "alloc.h" diff --git a/gnu/libexec/uucp/libuuconf/addstr.c b/gnu/libexec/uucp/libuuconf/addstr.c index 635b63ebd67d..17f62af06976 100644 --- a/gnu/libexec/uucp/libuuconf/addstr.c +++ b/gnu/libexec/uucp/libuuconf/addstr.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_addstr_rcsid[] = "$Id: addstr.c,v 1.1 1993/08/05 18:24:57 conklin Exp $"; +const char _uuconf_addstr_rcsid[] = "$Id: addstr.c,v 1.2 1994/05/07 18:11:52 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/allblk.c b/gnu/libexec/uucp/libuuconf/allblk.c index 1c61331e6c80..4fe467cb0a88 100644 --- a/gnu/libexec/uucp/libuuconf/allblk.c +++ b/gnu/libexec/uucp/libuuconf/allblk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_allblk_rcsid[] = "$Id: allblk.c,v 1.1 1993/08/05 18:24:58 conklin Exp $"; +const char _uuconf_allblk_rcsid[] = "$Id: allblk.c,v 1.2 1994/05/07 18:11:53 ache Exp $"; #endif #include "alloc.h" diff --git a/gnu/libexec/uucp/libuuconf/alloc.c b/gnu/libexec/uucp/libuuconf/alloc.c index 9b9c90649646..ed789403a3ed 100644 --- a/gnu/libexec/uucp/libuuconf/alloc.c +++ b/gnu/libexec/uucp/libuuconf/alloc.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_alloc_rcsid[] = "$Id: alloc.c,v 1.1 1993/08/05 18:24:59 conklin Exp $"; +const char _uuconf_alloc_rcsid[] = "$Id: alloc.c,v 1.2 1994/05/07 18:11:54 ache Exp $"; #endif #include "alloc.h" diff --git a/gnu/libexec/uucp/libuuconf/alloc.h b/gnu/libexec/uucp/libuuconf/alloc.h index c5c9cad8e32b..d6949ab5005a 100644 --- a/gnu/libexec/uucp/libuuconf/alloc.h +++ b/gnu/libexec/uucp/libuuconf/alloc.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. */ /* This header file is private to the uuconf memory allocation diff --git a/gnu/libexec/uucp/libuuconf/base.c b/gnu/libexec/uucp/libuuconf/base.c index 9ab35826539d..0cd9e2c36177 100644 --- a/gnu/libexec/uucp/libuuconf/base.c +++ b/gnu/libexec/uucp/libuuconf/base.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_base_rcsid[] = "$Id: base.c,v 1.1 1993/08/05 18:25:01 conklin Exp $"; +const char _uuconf_base_rcsid[] = "$Id: base.c,v 1.2 1994/05/07 18:11:57 ache Exp $"; #endif /* This turns a cmdtab_offset table into a uuconf_cmdtab table. Each diff --git a/gnu/libexec/uucp/libuuconf/bool.c b/gnu/libexec/uucp/libuuconf/bool.c index fa6e5f666b99..66958c30d169 100644 --- a/gnu/libexec/uucp/libuuconf/bool.c +++ b/gnu/libexec/uucp/libuuconf/bool.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_bool_rcsid[] = "$Id: bool.c,v 1.1 1993/08/05 18:25:03 conklin Exp $"; +const char _uuconf_bool_rcsid[] = "$Id: bool.c,v 1.2 1994/05/07 18:11:58 ache Exp $"; #endif /* Parse a boolean string into a variable. This is called by diff --git a/gnu/libexec/uucp/libuuconf/callin.c b/gnu/libexec/uucp/libuuconf/callin.c index 94c6130d4972..e8699b1af507 100644 --- a/gnu/libexec/uucp/libuuconf/callin.c +++ b/gnu/libexec/uucp/libuuconf/callin.c @@ -1,7 +1,7 @@ /* callin.c Check a login name and password against the UUCP password file. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -20,35 +20,46 @@ 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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_callin_rcsid[] = "$Id: callin.c,v 1.1 1993/08/05 18:25:04 conklin Exp $"; +const char _uuconf_callin_rcsid[] = "$Id: callin.c,v 1.2 1994/05/07 18:11:58 ache Exp $"; #endif #include <errno.h> -static int iplogin P((pointer pglobal, int argc, char **argv, +static int ipcheck P((pointer pglobal, int argc, char **argv, pointer pvar, pointer pinfo)); + +struct sinfo +{ + int (*pcmpfn) P((int, pointer, const char *)); + pointer pinfo; + boolean ffound; + boolean fmatched; +}; /* Check a login name and password against the UUCP password file. This looks at the Taylor UUCP password file, but will work even if - uuconf_taylor_init was not called. */ + uuconf_taylor_init was not called. It accepts either spaces or + colons as field delimiters. */ int -uuconf_callin (pglobal, zlogin, zpassword) +uuconf_callin (pglobal, pcmpfn, pinfo) pointer pglobal; - const char *zlogin; - const char *zpassword; + int (*pcmpfn) P((int, pointer, const char *)); + pointer pinfo; { struct sglobal *qglobal = (struct sglobal *) pglobal; int iret; char **pz; - struct uuconf_cmdtab as[2]; - char *zfilepass; + struct uuconf_cmdtab as[1]; + struct sinfo s; + char *zline; + size_t cline; /* If we have no password file names, fill in the default name. */ if (qglobal->qprocess->pzpwdfiles == NULL) @@ -66,14 +77,15 @@ uuconf_callin (pglobal, zlogin, zpassword) return iret; } - as[0].uuconf_zcmd = zlogin; - as[0].uuconf_itype = UUCONF_CMDTABTYPE_FN | 2; - as[0].uuconf_pvar = (pointer) &zfilepass; - as[0].uuconf_pifn = iplogin; + as[0].uuconf_zcmd = NULL; - as[1].uuconf_zcmd = NULL; + s.pcmpfn = pcmpfn; + s.pinfo = pinfo; + s.ffound = FALSE; + s.fmatched = FALSE; - zfilepass = NULL; + zline = NULL; + cline = 0; iret = UUCONF_SUCCESS; @@ -91,52 +103,82 @@ uuconf_callin (pglobal, zlogin, zpassword) break; } - iret = uuconf_cmd_file (pglobal, e, as, (pointer) NULL, - (uuconf_cmdtabfn) NULL, - UUCONF_CMDTABFLAG_CASE, (pointer) NULL); + qglobal->ilineno = 0; + + iret = UUCONF_SUCCESS; + + while (getline (&zline, &cline, e) > 0) + { + char *zcolon; + + ++qglobal->ilineno; + + /* Turn the first two colon characters into spaces. This is + a hack to make Unix style passwd files work. */ + zcolon = strchr (zline, ':'); + if (zcolon != NULL) + { + *zcolon = ' '; + zcolon = strchr (zcolon, ':'); + if (zcolon != NULL) + *zcolon = ' '; + } + iret = uuconf_cmd_line (pglobal, zline, as, (pointer) &s, + ipcheck, 0, (pointer) NULL); + if ((iret & UUCONF_CMDTABRET_EXIT) != 0) + { + iret &=~ UUCONF_CMDTABRET_EXIT; + if (iret != UUCONF_SUCCESS) + iret |= UUCONF_ERROR_LINENO; + break; + } + + iret = UUCONF_SUCCESS; + } + (void) fclose (e); - if (iret != UUCONF_SUCCESS || zfilepass != NULL) + if (iret != UUCONF_SUCCESS || s.ffound) break; } + if (zline != NULL) + free ((pointer) zline); + if (iret != UUCONF_SUCCESS) { qglobal->zfilename = *pz; iret |= UUCONF_ERROR_FILENAME; } - else if (zfilepass == NULL - || strcmp (zfilepass, zpassword) != 0) + else if (! s.ffound || ! s.fmatched) iret = UUCONF_NOT_FOUND; - if (zfilepass != NULL) - free ((pointer) zfilepass); - return iret; } -/* This is called if it is the name we are looking for. The pvar - argument points to zfilepass, and we set it to the password. */ +/* This is called on each line of the file. It checks to see if the + login name from the file is the one we are looking for. If it is, + it sets ffound, and then sets fmatched according to whether the + password matches or not. */ static int -iplogin (pglobal, argc, argv, pvar, pinfo) +ipcheck (pglobal, argc, argv, pvar, pinfo) pointer pglobal; int argc; char **argv; pointer pvar; pointer pinfo; { - struct sglobal *qglobal = (struct sglobal *) pglobal; - char **pzpass = (char **) pvar; + struct sinfo *q = (struct sinfo *) pinfo; - *pzpass = strdup (argv[1]); - if (*pzpass == NULL) - { - qglobal->ierrno = errno; - return (UUCONF_MALLOC_FAILED - | UUCONF_ERROR_ERRNO - | UUCONF_CMDTABRET_EXIT); - } + if (argc != 2) + return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT; + + if (! (*q->pcmpfn) (0, q->pinfo, argv[0])) + return UUCONF_CMDTABRET_CONTINUE; + + q->ffound = TRUE; + q->fmatched = (*q->pcmpfn) (1, q->pinfo, argv[1]) != 0; return UUCONF_CMDTABRET_EXIT; } diff --git a/gnu/libexec/uucp/libuuconf/calout.c b/gnu/libexec/uucp/libuuconf/calout.c index d73382aedb19..9e847551b911 100644 --- a/gnu/libexec/uucp/libuuconf/calout.c +++ b/gnu/libexec/uucp/libuuconf/calout.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_calout_rcsid[] = "$Id: calout.c,v 1.1 1993/08/05 18:25:05 conklin Exp $"; +const char _uuconf_calout_rcsid[] = "$Id: calout.c,v 1.2 1994/05/07 18:12:00 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/chatc.c b/gnu/libexec/uucp/libuuconf/chatc.c index f19f589d2254..409c9b7652d7 100644 --- a/gnu/libexec/uucp/libuuconf/chatc.c +++ b/gnu/libexec/uucp/libuuconf/chatc.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_chatc_rcsid[] = "$Id: chatc.c,v 1.1 1993/08/05 18:25:06 conklin Exp $"; +const char _uuconf_chatc_rcsid[] = "$Id: chatc.c,v 1.2 1994/05/07 18:12:01 ache Exp $"; #endif #include <ctype.h> diff --git a/gnu/libexec/uucp/libuuconf/cmdarg.c b/gnu/libexec/uucp/libuuconf/cmdarg.c index 39c8d30b4dd3..fbe687063095 100644 --- a/gnu/libexec/uucp/libuuconf/cmdarg.c +++ b/gnu/libexec/uucp/libuuconf/cmdarg.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_cmdarg_rcsid[] = "$Id: cmdarg.c,v 1.1 1993/08/05 18:25:07 conklin Exp $"; +const char _uuconf_cmdarg_rcsid[] = "$Id: cmdarg.c,v 1.2 1994/05/07 18:12:02 ache Exp $"; #endif #include <ctype.h> diff --git a/gnu/libexec/uucp/libuuconf/cmdfil.c b/gnu/libexec/uucp/libuuconf/cmdfil.c index 074359dbcf41..a116b82652b1 100644 --- a/gnu/libexec/uucp/libuuconf/cmdfil.c +++ b/gnu/libexec/uucp/libuuconf/cmdfil.c @@ -1,7 +1,7 @@ /* cmdfil.c Read and parse commands from a file. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_cmdfil_rcsid[] = "$Id: cmdfil.c,v 1.1 1993/08/05 18:25:08 conklin Exp $"; +const char _uuconf_cmdfil_rcsid[] = "$Id: cmdfil.c,v 1.2 1994/05/07 18:12:03 ache Exp $"; #endif #include <errno.h> @@ -99,5 +99,8 @@ uuconf_cmd_file (pglobal, e, qtab, pinfo, pfiunknown, iflags, pblock) iret = UUCONF_SUCCESS; } + if (zline != NULL) + free ((pointer) zline); + return iret; } diff --git a/gnu/libexec/uucp/libuuconf/cmdlin.c b/gnu/libexec/uucp/libuuconf/cmdlin.c index cb7f81c92ded..069ed37b64c3 100644 --- a/gnu/libexec/uucp/libuuconf/cmdlin.c +++ b/gnu/libexec/uucp/libuuconf/cmdlin.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_cmdlin_rcsid[] = "$Id: cmdlin.c,v 1.1 1993/08/05 18:25:09 conklin Exp $"; +const char _uuconf_cmdlin_rcsid[] = "$Id: cmdlin.c,v 1.2 1994/05/07 18:12:04 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/debfil.c b/gnu/libexec/uucp/libuuconf/debfil.c index c03df4413a58..42ea999ec280 100644 --- a/gnu/libexec/uucp/libuuconf/debfil.c +++ b/gnu/libexec/uucp/libuuconf/debfil.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_debfil_rcsid[] = "$Id: debfil.c,v 1.1 1993/08/05 18:25:10 conklin Exp $"; +const char _uuconf_debfil_rcsid[] = "$Id: debfil.c,v 1.2 1994/05/07 18:12:05 ache Exp $"; #endif /* Get the name of the UUCP debugging file. */ diff --git a/gnu/libexec/uucp/libuuconf/deblev.c b/gnu/libexec/uucp/libuuconf/deblev.c index 8d00f67a5ffd..38956820404f 100644 --- a/gnu/libexec/uucp/libuuconf/deblev.c +++ b/gnu/libexec/uucp/libuuconf/deblev.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_deblev_rcsid[] = "$Id: deblev.c,v 1.1 1993/08/05 18:25:10 conklin Exp $"; +const char _uuconf_deblev_rcsid[] = "$Id: deblev.c,v 1.2 1994/05/07 18:12:06 ache Exp $"; #endif /* Get the UUCP debugging level. */ diff --git a/gnu/libexec/uucp/libuuconf/diacod.c b/gnu/libexec/uucp/libuuconf/diacod.c index 5a5015062129..f5076ea353eb 100644 --- a/gnu/libexec/uucp/libuuconf/diacod.c +++ b/gnu/libexec/uucp/libuuconf/diacod.c @@ -1,7 +1,7 @@ /* diacod.c Translate a dialcode. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_diacod_rcsid[] = "$Id: diacod.c,v 1.1 1993/08/05 18:25:11 conklin Exp $"; +const char _uuconf_diacod_rcsid[] = "$Id: diacod.c,v 1.2 1994/05/07 18:12:07 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/dial.c b/gnu/libexec/uucp/libuuconf/dial.c index fa2c449885c5..f7f641366487 100644 --- a/gnu/libexec/uucp/libuuconf/dial.c +++ b/gnu/libexec/uucp/libuuconf/dial.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_dial_rcsid[] = "$Id: dial.c,v 1.1 1993/08/05 18:25:12 conklin Exp $"; +const char _uuconf_dial_rcsid[] = "$Id: dial.c,v 1.2 1994/05/07 18:12:08 ache Exp $"; #endif /* Find a dialer by name. */ diff --git a/gnu/libexec/uucp/libuuconf/diasub.c b/gnu/libexec/uucp/libuuconf/diasub.c index 5b99c4aa3d0a..9e49bfb4c711 100644 --- a/gnu/libexec/uucp/libuuconf/diasub.c +++ b/gnu/libexec/uucp/libuuconf/diasub.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_diasub_rcsid[] = "$Id: diasub.c,v 1.1 1993/08/05 18:25:13 conklin Exp $"; +const char _uuconf_diasub_rcsid[] = "$Id: diasub.c,v 1.2 1994/05/07 18:12:09 ache Exp $"; #endif /* Clear the information in a dialer. */ diff --git a/gnu/libexec/uucp/libuuconf/dnams.c b/gnu/libexec/uucp/libuuconf/dnams.c index 35b56ec4f605..3eac1159eae5 100644 --- a/gnu/libexec/uucp/libuuconf/dnams.c +++ b/gnu/libexec/uucp/libuuconf/dnams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_dnams_rcsid[] = "$Id: dnams.c,v 1.1 1993/08/05 18:25:14 conklin Exp $"; +const char _uuconf_dnams_rcsid[] = "$Id: dnams.c,v 1.2 1994/05/07 18:12:10 ache Exp $"; #endif /* Get all known dialer names. */ diff --git a/gnu/libexec/uucp/libuuconf/errno.c b/gnu/libexec/uucp/libuuconf/errno.c index 911052894da1..350a26b7e742 100644 --- a/gnu/libexec/uucp/libuuconf/errno.c +++ b/gnu/libexec/uucp/libuuconf/errno.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_errno_rcsid[] = "$Id: errno.c,v 1.1 1993/08/05 18:25:15 conklin Exp $"; +const char _uuconf_errno_rcsid[] = "$Id: errno.c,v 1.2 1994/05/07 18:12:11 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/errstr.c b/gnu/libexec/uucp/libuuconf/errstr.c index e04db886fea2..4bca654a2f15 100644 --- a/gnu/libexec/uucp/libuuconf/errstr.c +++ b/gnu/libexec/uucp/libuuconf/errstr.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_errstr_rcsid[] = "$Id: errstr.c,v 1.1 1993/08/05 18:25:16 conklin Exp $"; +const char _uuconf_errstr_rcsid[] = "$Id: errstr.c,v 1.2 1994/05/07 18:12:12 ache Exp $"; #endif static char *zeprint_num P((char *zbuf, size_t cbuf, int ival)); diff --git a/gnu/libexec/uucp/libuuconf/filnam.c b/gnu/libexec/uucp/libuuconf/filnam.c index 7f02f3e2c569..003fb5257ed5 100644 --- a/gnu/libexec/uucp/libuuconf/filnam.c +++ b/gnu/libexec/uucp/libuuconf/filnam.c @@ -20,18 +20,18 @@ 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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_filnam_rcsid[] = "$Id: filnam.c,v 1.1 1993/08/05 18:25:17 conklin Exp $"; +const char _uuconf_filnam_rcsid[] = "$Id: filnam.c,v 1.2 1994/05/07 18:12:13 ache Exp $"; #endif /* Return the saved file name. */ -const char * +UUCONF_CONST char * uuconf_error_filename (pglobal) pointer pglobal; { diff --git a/gnu/libexec/uucp/libuuconf/freblk.c b/gnu/libexec/uucp/libuuconf/freblk.c index ab16cb78377b..215d0949ae36 100644 --- a/gnu/libexec/uucp/libuuconf/freblk.c +++ b/gnu/libexec/uucp/libuuconf/freblk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_freblk_rcsid[] = "$Id: freblk.c,v 1.1 1993/08/05 18:25:18 conklin Exp $"; +const char _uuconf_freblk_rcsid[] = "$Id: freblk.c,v 1.2 1994/05/07 18:12:14 ache Exp $"; #endif #include "alloc.h" diff --git a/gnu/libexec/uucp/libuuconf/fredia.c b/gnu/libexec/uucp/libuuconf/fredia.c index 26d376b916e3..4f6532ec105f 100644 --- a/gnu/libexec/uucp/libuuconf/fredia.c +++ b/gnu/libexec/uucp/libuuconf/fredia.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_fredia_rcsid[] = "$Id: fredia.c,v 1.1 1993/08/05 18:25:19 conklin Exp $"; +const char _uuconf_fredia_rcsid[] = "$Id: fredia.c,v 1.2 1994/05/07 18:12:15 ache Exp $"; #endif /* Free the memory allocated for a dialer. */ diff --git a/gnu/libexec/uucp/libuuconf/free.c b/gnu/libexec/uucp/libuuconf/free.c index 77985645ba6f..b1ac98fb2b3c 100644 --- a/gnu/libexec/uucp/libuuconf/free.c +++ b/gnu/libexec/uucp/libuuconf/free.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_free_rcsid[] = "$Id: free.c,v 1.1 1993/08/05 18:25:20 conklin Exp $"; +const char _uuconf_free_rcsid[] = "$Id: free.c,v 1.2 1994/05/07 18:12:17 ache Exp $"; #endif #include "alloc.h" diff --git a/gnu/libexec/uucp/libuuconf/freprt.c b/gnu/libexec/uucp/libuuconf/freprt.c index 30764f64339d..6fdda5aaf0df 100644 --- a/gnu/libexec/uucp/libuuconf/freprt.c +++ b/gnu/libexec/uucp/libuuconf/freprt.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_freprt_rcsid[] = "$Id: freprt.c,v 1.1 1993/08/05 18:25:21 conklin Exp $"; +const char _uuconf_freprt_rcsid[] = "$Id: freprt.c,v 1.2 1994/05/07 18:12:18 ache Exp $"; #endif /* Free the memory allocated for a port. */ diff --git a/gnu/libexec/uucp/libuuconf/fresys.c b/gnu/libexec/uucp/libuuconf/fresys.c index 1bd8635f2d79..a880ec9e9bab 100644 --- a/gnu/libexec/uucp/libuuconf/fresys.c +++ b/gnu/libexec/uucp/libuuconf/fresys.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_fresys_rcsid[] = "$Id: fresys.c,v 1.1 1993/08/05 18:25:21 conklin Exp $"; +const char _uuconf_fresys_rcsid[] = "$Id: fresys.c,v 1.2 1994/05/07 18:12:19 ache Exp $"; #endif /* Free the memory allocated for a system. */ diff --git a/gnu/libexec/uucp/libuuconf/grdcmp.c b/gnu/libexec/uucp/libuuconf/grdcmp.c index 9d80242266f1..ce29d98ba5ab 100644 --- a/gnu/libexec/uucp/libuuconf/grdcmp.c +++ b/gnu/libexec/uucp/libuuconf/grdcmp.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_grdcmp_rcsid[] = "$Id: grdcmp.c,v 1.1 1993/08/05 18:25:22 conklin Exp $"; +const char _uuconf_grdcmp_rcsid[] = "$Id: grdcmp.c,v 1.2 1994/05/07 18:12:20 ache Exp $"; #endif #include <ctype.h> diff --git a/gnu/libexec/uucp/libuuconf/hdial.c b/gnu/libexec/uucp/libuuconf/hdial.c index 6d070401cba1..dc242e0084a9 100644 --- a/gnu/libexec/uucp/libuuconf/hdial.c +++ b/gnu/libexec/uucp/libuuconf/hdial.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hdial_rcsid[] = "$Id: hdial.c,v 1.1 1993/08/05 18:25:23 conklin Exp $"; +const char _uuconf_hdial_rcsid[] = "$Id: hdial.c,v 1.2 1994/05/07 18:12:20 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/hdnams.c b/gnu/libexec/uucp/libuuconf/hdnams.c index 8b87944351da..eec16e96d7f6 100644 --- a/gnu/libexec/uucp/libuuconf/hdnams.c +++ b/gnu/libexec/uucp/libuuconf/hdnams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hdnams_rcsid[] = "$Id: hdnams.c,v 1.1 1993/08/05 18:25:24 conklin Exp $"; +const char _uuconf_hdnams_rcsid[] = "$Id: hdnams.c,v 1.2 1994/05/07 18:12:21 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/hinit.c b/gnu/libexec/uucp/libuuconf/hinit.c index 785434d03508..3dcf36a5ca89 100644 --- a/gnu/libexec/uucp/libuuconf/hinit.c +++ b/gnu/libexec/uucp/libuuconf/hinit.c @@ -1,7 +1,7 @@ /* hinit.c Initialize for reading HDB configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1994 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hinit_rcsid[] = "$Id: hinit.c,v 1.1 1993/08/05 18:25:25 conklin Exp $"; +const char _uuconf_hinit_rcsid[] = "$Id: hinit.c,v 1.2 1994/05/07 18:12:23 ache Exp $"; #endif #include <errno.h> @@ -125,7 +125,7 @@ uuconf_hdb_init (ppglobal, zprogram) --cchars; if (zline[cchars] == '\n') zline[cchars] = '\0'; - if (isspace (BUCHAR (zline[0])) || zline[0] == '#') + if (zline[0] == '#') continue; ctypes = _uuconf_istrsplit (zline, '\0', &pzargs, &cargs); diff --git a/gnu/libexec/uucp/libuuconf/hlocnm.c b/gnu/libexec/uucp/libuuconf/hlocnm.c index 810f42a0f60c..a2b02ab083e0 100644 --- a/gnu/libexec/uucp/libuuconf/hlocnm.c +++ b/gnu/libexec/uucp/libuuconf/hlocnm.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hlocnm_rcsid[] = "$Id: hlocnm.c,v 1.1 1993/08/05 18:25:26 conklin Exp $"; +const char _uuconf_hlocnm_rcsid[] = "$Id: hlocnm.c,v 1.2 1994/05/07 18:12:23 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/hport.c b/gnu/libexec/uucp/libuuconf/hport.c index 77563214a4d1..c2f9593d31f1 100644 --- a/gnu/libexec/uucp/libuuconf/hport.c +++ b/gnu/libexec/uucp/libuuconf/hport.c @@ -1,7 +1,7 @@ /* hport.c Find a port in the HDB configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hport_rcsid[] = "$Id: hport.c,v 1.1 1993/08/05 18:25:27 conklin Exp $"; +const char _uuconf_hport_rcsid[] = "$Id: hport.c,v 1.2 1994/05/07 18:12:25 ache Exp $"; #endif #include <errno.h> @@ -85,6 +85,7 @@ uuconf_hdb_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) char *z, *zprotos, *zport; long ilow, ihigh; pointer pblock; + char ***ppzdialer; ++qglobal->ilineno; @@ -202,6 +203,9 @@ uuconf_hdb_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) qport->uuconf_ttype = UUCONF_PORTTYPE_DIRECT; qport->uuconf_u.uuconf_sdirect.uuconf_zdevice = pzsplit[1]; qport->uuconf_u.uuconf_sdirect.uuconf_ibaud = ilow; + qport->uuconf_u.uuconf_sdirect.uuconf_fcarrier = FALSE; + qport->uuconf_u.uuconf_sdirect.uuconf_fhardflow = TRUE; + ppzdialer = NULL; } else if (strcmp (pzsplit[0], "TCP") == 0) { @@ -213,43 +217,23 @@ uuconf_hdb_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) | UUCONF_RELIABLE_EIGHT | UUCONF_RELIABLE_FULLDUPLEX | UUCONF_RELIABLE_SPECIFIED); qport->uuconf_u.uuconf_stcp.uuconf_zport = pzsplit[1]; + ppzdialer = &qport->uuconf_u.uuconf_stcp.uuconf_pzdialer; } else if (ctoks >= 5 && (strcmp (pzsplit[4], "TLI") == 0 || strcmp (pzsplit[4], "TLIS") == 0)) { - size_t c; - char **pzd; - qport->uuconf_ttype = UUCONF_PORTTYPE_TLI; qport->uuconf_u.uuconf_stli.uuconf_zdevice = pzsplit[1]; qport->uuconf_u.uuconf_stli.uuconf_fstream = strcmp (pzsplit[4], "TLIS") == 0; qport->uuconf_u.uuconf_stli.uuconf_pzpush = NULL; - pblock = uuconf_malloc_block (); - if (pblock == NULL) - { - qglobal->ierrno = errno; - iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO; - break; - } - c = (ctoks - 4) * sizeof (char *); - pzd = (char **) uuconf_malloc (pblock, c + sizeof (char *)); - if (pzd == NULL) - { - qglobal->ierrno = errno; - uuconf_free_block (pblock); - iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO; - break; - } - memcpy ((pointer) pzd, (pointer) (pzsplit + 4), c); - pzd[ctoks - 4] = NULL; - qport->uuconf_u.uuconf_stli.uuconf_pzdialer = pzd; qport->uuconf_u.uuconf_stli.uuconf_zservaddr = NULL; qport->uuconf_ireliable = (UUCONF_RELIABLE_ENDTOEND | UUCONF_RELIABLE_RELIABLE | UUCONF_RELIABLE_EIGHT | UUCONF_RELIABLE_FULLDUPLEX | UUCONF_RELIABLE_SPECIFIED); + ppzdialer = &qport->uuconf_u.uuconf_stli.uuconf_pzdialer; } else { @@ -273,8 +257,15 @@ uuconf_hdb_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud = ihigh; } qport->uuconf_u.uuconf_smodem.uuconf_fcarrier = TRUE; + qport->uuconf_u.uuconf_smodem.uuconf_fhardflow = TRUE; + qport->uuconf_u.uuconf_smodem.uuconf_qdialer = NULL; + ppzdialer = &qport->uuconf_u.uuconf_smodem.uuconf_pzdialer; + } + + if (ppzdialer != NULL) + { if (ctoks < 5) - qport->uuconf_u.uuconf_smodem.uuconf_pzdialer = NULL; + *ppzdialer = NULL; else { size_t c; @@ -299,9 +290,8 @@ uuconf_hdb_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) memcpy ((pointer) pzd, (pointer) (pzsplit + 4), c); pzd[ctoks - 4] = NULL; - qport->uuconf_u.uuconf_smodem.uuconf_pzdialer = pzd; + *ppzdialer = pzd; } - qport->uuconf_u.uuconf_smodem.uuconf_qdialer = NULL; } if (pifn != NULL) diff --git a/gnu/libexec/uucp/libuuconf/hrmunk.c b/gnu/libexec/uucp/libuuconf/hrmunk.c index c028049c1b77..9c88e8af3b0f 100644 --- a/gnu/libexec/uucp/libuuconf/hrmunk.c +++ b/gnu/libexec/uucp/libuuconf/hrmunk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hrmunk_rcsid[] = "$Id: hrmunk.c,v 1.1 1993/08/05 18:25:28 conklin Exp $"; +const char _uuconf_hrmunk_rcsid[] = "$Id: hrmunk.c,v 1.2 1994/05/07 18:12:26 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/hsinfo.c b/gnu/libexec/uucp/libuuconf/hsinfo.c index 9e50cbec6a77..d20c00ff9067 100644 --- a/gnu/libexec/uucp/libuuconf/hsinfo.c +++ b/gnu/libexec/uucp/libuuconf/hsinfo.c @@ -1,7 +1,7 @@ /* hsinfo.c Get information about a system from the HDB configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hsinfo_rcsid[] = "$Id: hsinfo.c,v 1.1 1993/08/05 18:25:29 conklin Exp $"; +const char _uuconf_hsinfo_rcsid[] = "$Id: hsinfo.c,v 1.2 1994/05/07 18:12:27 ache Exp $"; #endif #include <errno.h> @@ -112,6 +112,8 @@ _uuconf_ihdb_system_internal (qglobal, zsystem, qsys) FILE *e; int cchars; + qglobal->ilineno = 0; + e = fopen (*pz, "r"); if (e == NULL) { @@ -122,8 +124,6 @@ _uuconf_ihdb_system_internal (qglobal, zsystem, qsys) break; } - qglobal->ilineno = 0; - while ((cchars = _uuconf_getline (qglobal, &zline, &cline, e)) > 0) { int ctoks, ctimes, i; @@ -258,6 +258,11 @@ _uuconf_ihdb_system_internal (qglobal, zsystem, qsys) pblock); if (iret != UUCONF_SUCCESS) break; + + /* Treat any time/grade setting as both a timegrade and + a call-timegrade. */ + if (bgrade != UUCONF_GRADE_LOW) + qset->uuconf_qcalltimegrade = qset->uuconf_qtimegrade; } if (iret != UUCONF_SUCCESS) @@ -355,7 +360,7 @@ _uuconf_ihdb_system_internal (qglobal, zsystem, qsys) if (iret != UUCONF_SUCCESS) { qglobal->zfilename = *pz; - return iret | UUCONF_ERROR_FILENAME; + return iret | UUCONF_ERROR_FILENAME | UUCONF_ERROR_LINENO; } if (pblock == NULL) diff --git a/gnu/libexec/uucp/libuuconf/hsnams.c b/gnu/libexec/uucp/libuuconf/hsnams.c index dae09d993c73..a86909fe8725 100644 --- a/gnu/libexec/uucp/libuuconf/hsnams.c +++ b/gnu/libexec/uucp/libuuconf/hsnams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hsnams_rcsid[] = "$Id: hsnams.c,v 1.1 1993/08/05 18:25:30 conklin Exp $"; +const char _uuconf_hsnams_rcsid[] = "$Id: hsnams.c,v 1.2 1994/05/07 18:12:28 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/hsys.c b/gnu/libexec/uucp/libuuconf/hsys.c index 683978d281fb..dc8d637a436f 100644 --- a/gnu/libexec/uucp/libuuconf/hsys.c +++ b/gnu/libexec/uucp/libuuconf/hsys.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hsys_rcsid[] = "$Id: hsys.c,v 1.1 1993/08/05 18:25:31 conklin Exp $"; +const char _uuconf_hsys_rcsid[] = "$Id: hsys.c,v 1.2 1994/05/07 18:12:29 ache Exp $"; #endif /* Get system information from the HDB configuration files. This is a diff --git a/gnu/libexec/uucp/libuuconf/hunk.c b/gnu/libexec/uucp/libuuconf/hunk.c index df5fd4fcbbb9..2b471ba238b3 100644 --- a/gnu/libexec/uucp/libuuconf/hunk.c +++ b/gnu/libexec/uucp/libuuconf/hunk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_hunk_rcsid[] = "$Id: hunk.c,v 1.1 1993/08/05 18:25:33 conklin Exp $"; +const char _uuconf_hunk_rcsid[] = "$Id: hunk.c,v 1.2 1994/05/07 18:12:30 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/iniglb.c b/gnu/libexec/uucp/libuuconf/iniglb.c index 7642d779de32..6fea99988cae 100644 --- a/gnu/libexec/uucp/libuuconf/iniglb.c +++ b/gnu/libexec/uucp/libuuconf/iniglb.c @@ -1,7 +1,7 @@ /* iniglb.c Initialize the global information structure. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1994 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_iniglb_rcsid[] = "$Id: iniglb.c,v 1.1 1993/08/05 18:25:35 conklin Exp $"; +const char _uuconf_iniglb_rcsid[] = "$Id: iniglb.c,v 1.2 1994/05/07 18:12:31 ache Exp $"; #endif #include <errno.h> @@ -84,6 +84,7 @@ _uuconf_iinit_global (pqglobal) qprocess->zdebugfile = DEBUGFILE; qprocess->zdebug = ""; qprocess->cmaxuuxqts = 0; + qprocess->zrunuuxqt = NULL; qprocess->fv2 = TRUE; qprocess->fhdb = TRUE; qprocess->pzdialcodefiles = NULL; diff --git a/gnu/libexec/uucp/libuuconf/init.c b/gnu/libexec/uucp/libuuconf/init.c index ccd2ad1d4e6f..65a84406ceda 100644 --- a/gnu/libexec/uucp/libuuconf/init.c +++ b/gnu/libexec/uucp/libuuconf/init.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_init_rcsid[] = "$Id: init.c,v 1.1 1993/08/05 18:25:36 conklin Exp $"; +const char _uuconf_init_rcsid[] = "$Id: init.c,v 1.2 1994/05/07 18:12:32 ache Exp $"; #endif /* Initialize the UUCP configuration file reading routines. This is diff --git a/gnu/libexec/uucp/libuuconf/int.c b/gnu/libexec/uucp/libuuconf/int.c index 93a274cb546a..dacd75517bff 100644 --- a/gnu/libexec/uucp/libuuconf/int.c +++ b/gnu/libexec/uucp/libuuconf/int.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_int_rcsid[] = "$Id: int.c,v 1.1 1993/08/05 18:25:37 conklin Exp $"; +const char _uuconf_int_rcsid[] = "$Id: int.c,v 1.2 1994/05/07 18:12:33 ache Exp $"; #endif /* Parse a string into a variable. This is called by uuconf_cmd_args, diff --git a/gnu/libexec/uucp/libuuconf/lckdir.c b/gnu/libexec/uucp/libuuconf/lckdir.c index 286f38a2b5d6..ffba44c221ab 100644 --- a/gnu/libexec/uucp/libuuconf/lckdir.c +++ b/gnu/libexec/uucp/libuuconf/lckdir.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_lckdir_rcsid[] = "$Id: lckdir.c,v 1.1 1993/08/05 18:25:38 conklin Exp $"; +const char _uuconf_lckdir_rcsid[] = "$Id: lckdir.c,v 1.2 1994/05/07 18:12:34 ache Exp $"; #endif /* Get the name of the UUCP lock directory. */ diff --git a/gnu/libexec/uucp/libuuconf/lineno.c b/gnu/libexec/uucp/libuuconf/lineno.c index fdba3b51dace..4c5646bda013 100644 --- a/gnu/libexec/uucp/libuuconf/lineno.c +++ b/gnu/libexec/uucp/libuuconf/lineno.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_lineno_rcsid[] = "$Id: lineno.c,v 1.1 1993/08/05 18:25:39 conklin Exp $"; +const char _uuconf_lineno_rcsid[] = "$Id: lineno.c,v 1.2 1994/05/07 18:12:35 ache Exp $"; #endif /* Return the saved line number. */ diff --git a/gnu/libexec/uucp/libuuconf/llocnm.c b/gnu/libexec/uucp/libuuconf/llocnm.c index bb0d70df6c77..d7b7c0cc1ff7 100644 --- a/gnu/libexec/uucp/libuuconf/llocnm.c +++ b/gnu/libexec/uucp/libuuconf/llocnm.c @@ -1,7 +1,7 @@ /* llocnm.c Get the local name to use, given a login name. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_llocnm_rcsid[] = "$Id: llocnm.c,v 1.1 1993/08/05 18:25:40 conklin Exp $"; +const char _uuconf_llocnm_rcsid[] = "$Id: llocnm.c,v 1.2 1994/05/07 18:12:36 ache Exp $"; #endif #include <errno.h> @@ -49,9 +49,12 @@ uuconf_login_localname (pglobal, zlogin, pzname) #endif #if HAVE_HDB_CONFIG - iret = uuconf_hdb_login_localname (pglobal, zlogin, pzname); - if (iret != UUCONF_NOT_FOUND) - return iret; + if (qglobal->qprocess->fhdb) + { + iret = uuconf_hdb_login_localname (pglobal, zlogin, pzname); + if (iret != UUCONF_NOT_FOUND) + return iret; + } #endif if (qglobal->qprocess->zlocalname != NULL) diff --git a/gnu/libexec/uucp/libuuconf/local.c b/gnu/libexec/uucp/libuuconf/local.c index 2e2c843585e9..0cd93b83ac89 100644 --- a/gnu/libexec/uucp/libuuconf/local.c +++ b/gnu/libexec/uucp/libuuconf/local.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_local_rcsid[] = "$Id: local.c,v 1.1 1993/08/05 18:25:40 conklin Exp $"; +const char _uuconf_local_rcsid[] = "$Id: local.c,v 1.2 1994/05/07 18:12:37 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/locnm.c b/gnu/libexec/uucp/libuuconf/locnm.c index 14cf4dd5fb8b..76b2e8702b87 100644 --- a/gnu/libexec/uucp/libuuconf/locnm.c +++ b/gnu/libexec/uucp/libuuconf/locnm.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_locnm_rcsid[] = "$Id: locnm.c,v 1.1 1993/08/05 18:25:41 conklin Exp $"; +const char _uuconf_locnm_rcsid[] = "$Id: locnm.c,v 1.2 1994/05/07 18:12:38 ache Exp $"; #endif /* Get the local node name. */ diff --git a/gnu/libexec/uucp/libuuconf/logfil.c b/gnu/libexec/uucp/libuuconf/logfil.c index bcfb4fa1b104..677d8d4a428f 100644 --- a/gnu/libexec/uucp/libuuconf/logfil.c +++ b/gnu/libexec/uucp/libuuconf/logfil.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_logfil_rcsid[] = "$Id: logfil.c,v 1.1 1993/08/05 18:25:42 conklin Exp $"; +const char _uuconf_logfil_rcsid[] = "$Id: logfil.c,v 1.2 1994/05/07 18:12:39 ache Exp $"; #endif /* Get the name of the UUCP log file. */ diff --git a/gnu/libexec/uucp/libuuconf/maxuxq.c b/gnu/libexec/uucp/libuuconf/maxuxq.c index d581e4536ad9..66b0db004c61 100644 --- a/gnu/libexec/uucp/libuuconf/maxuxq.c +++ b/gnu/libexec/uucp/libuuconf/maxuxq.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_maxuxq_rcsid[] = "$Id: maxuxq.c,v 1.1 1993/08/05 18:25:43 conklin Exp $"; +const char _uuconf_maxuxq_rcsid[] = "$Id: maxuxq.c,v 1.2 1994/05/07 18:12:40 ache Exp $"; #endif /* Get the maximum number of simultaneous uuxqt executions. When diff --git a/gnu/libexec/uucp/libuuconf/mrgblk.c b/gnu/libexec/uucp/libuuconf/mrgblk.c index 297969724b82..f34ab58c8b22 100644 --- a/gnu/libexec/uucp/libuuconf/mrgblk.c +++ b/gnu/libexec/uucp/libuuconf/mrgblk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_mrgblk_rcsid[] = "$Id: mrgblk.c,v 1.1 1993/08/05 18:25:44 conklin Exp $"; +const char _uuconf_mrgblk_rcsid[] = "$Id: mrgblk.c,v 1.2 1994/05/07 18:12:41 ache Exp $"; #endif #include "alloc.h" diff --git a/gnu/libexec/uucp/libuuconf/paramc.c b/gnu/libexec/uucp/libuuconf/paramc.c index a9c4a3d97382..772f802d8486 100644 --- a/gnu/libexec/uucp/libuuconf/paramc.c +++ b/gnu/libexec/uucp/libuuconf/paramc.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_paramc_rcsid[] = "$Id: paramc.c,v 1.1 1993/08/05 18:25:45 conklin Exp $"; +const char _uuconf_paramc_rcsid[] = "$Id: paramc.c,v 1.2 1994/05/07 18:12:42 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/port.c b/gnu/libexec/uucp/libuuconf/port.c index 8a704b7628cd..047fe4547b0d 100644 --- a/gnu/libexec/uucp/libuuconf/port.c +++ b/gnu/libexec/uucp/libuuconf/port.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_port_rcsid[] = "$Id: port.c,v 1.1 1993/08/05 18:25:46 conklin Exp $"; +const char _uuconf_port_rcsid[] = "$Id: port.c,v 1.2 1994/05/07 18:12:43 ache Exp $"; #endif /* Find a port by name, baud rate, and special purpose function. */ diff --git a/gnu/libexec/uucp/libuuconf/prtsub.c b/gnu/libexec/uucp/libuuconf/prtsub.c index ee8ca916a30f..d961f736ad33 100644 --- a/gnu/libexec/uucp/libuuconf/prtsub.c +++ b/gnu/libexec/uucp/libuuconf/prtsub.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_prtsub_rcsid[] = "$Id: prtsub.c,v 1.1 1993/08/05 18:25:47 conklin Exp $"; +const char _uuconf_prtsub_rcsid[] = "$Id: prtsub.c,v 1.2 1994/05/07 18:12:44 ache Exp $"; #endif /* Clear the information in a port. This can only clear the type diff --git a/gnu/libexec/uucp/libuuconf/pubdir.c b/gnu/libexec/uucp/libuuconf/pubdir.c index fcf5207d02ea..4eca22a3eab2 100644 --- a/gnu/libexec/uucp/libuuconf/pubdir.c +++ b/gnu/libexec/uucp/libuuconf/pubdir.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_pubdir_rcsid[] = "$Id: pubdir.c,v 1.1 1993/08/05 18:25:48 conklin Exp $"; +const char _uuconf_pubdir_rcsid[] = "$Id: pubdir.c,v 1.2 1994/05/07 18:12:45 ache Exp $"; #endif /* Get the name of the UUCP public directory. */ diff --git a/gnu/libexec/uucp/libuuconf/rdlocs.c b/gnu/libexec/uucp/libuuconf/rdlocs.c index 488673f4dad6..0f5f0a03871a 100644 --- a/gnu/libexec/uucp/libuuconf/rdlocs.c +++ b/gnu/libexec/uucp/libuuconf/rdlocs.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_rdlocs_rcsid[] = "$Id: rdlocs.c,v 1.1 1993/08/05 18:25:49 conklin Exp $"; +const char _uuconf_rdlocs_rcsid[] = "$Id: rdlocs.c,v 1.2 1994/05/07 18:12:46 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/rdperm.c b/gnu/libexec/uucp/libuuconf/rdperm.c index 950ba3bf943b..712dc6fef47e 100644 --- a/gnu/libexec/uucp/libuuconf/rdperm.c +++ b/gnu/libexec/uucp/libuuconf/rdperm.c @@ -1,7 +1,7 @@ /* rdperm.c Read the HDB Permissions file. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_rdperm_rcsid[] = "$Id: rdperm.c,v 1.1 1993/08/05 18:25:50 conklin Exp $"; +const char _uuconf_rdperm_rcsid[] = "$Id: rdperm.c,v 1.2 1994/05/07 18:12:48 ache Exp $"; #endif #include <errno.h> @@ -165,7 +165,7 @@ _uuconf_ihread_permissions (qglobal) --cchars; if (zline[cchars] == '\n') zline[cchars] = '\0'; - if (isspace (BUCHAR (zline[0])) || zline[0] == '#') + if (zline[0] == '#') continue; centries = _uuconf_istrsplit (zline, '\0', &pzsplit, &csplit); @@ -427,19 +427,25 @@ ihadd_norw (qglobal, ppz, pzno) char *znew; int iret; - csize = strlen (*pz) + 1; - znew = (char *) uuconf_malloc (qglobal->pblock, csize + 1); - if (znew == NULL) + /* Ignore an attempt to say NOREAD or NOWRITE with an empty + string, since it will be interpreted as an attempt to deny + everything. */ + if (**pz != '\0') { - qglobal->ierrno = errno; - return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO; + csize = strlen (*pz) + 1; + znew = (char *) uuconf_malloc (qglobal->pblock, csize + 1); + if (znew == NULL) + { + qglobal->ierrno = errno; + return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO; + } + znew[0] = '!'; + memcpy ((pointer) (znew + 1), (pointer) *pz, csize); + iret = _uuconf_iadd_string (qglobal, znew, FALSE, FALSE, ppz, + qglobal->pblock); + if (iret != UUCONF_SUCCESS) + return iret; } - znew[0] = '!'; - memcpy ((pointer) (znew + 1), (pointer) *pz, csize); - iret = _uuconf_iadd_string (qglobal, znew, FALSE, FALSE, ppz, - qglobal->pblock); - if (iret != UUCONF_SUCCESS) - return iret; } return UUCONF_SUCCESS; diff --git a/gnu/libexec/uucp/libuuconf/reliab.c b/gnu/libexec/uucp/libuuconf/reliab.c index 048c13d4e66b..faf4d74001c5 100644 --- a/gnu/libexec/uucp/libuuconf/reliab.c +++ b/gnu/libexec/uucp/libuuconf/reliab.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_reliab_rcsid[] = "$Id: reliab.c,v 1.1 1993/08/05 18:25:51 conklin Exp $"; +const char _uuconf_reliab_rcsid[] = "$Id: reliab.c,v 1.2 1994/05/07 18:12:49 ache Exp $"; #endif /* Handle the "seven-bit" command for a port or a dialer. The pvar diff --git a/gnu/libexec/uucp/libuuconf/remunk.c b/gnu/libexec/uucp/libuuconf/remunk.c index 1e5b714aa265..c88d49b24cb9 100644 --- a/gnu/libexec/uucp/libuuconf/remunk.c +++ b/gnu/libexec/uucp/libuuconf/remunk.c @@ -1,7 +1,7 @@ /* remunk.c Get the name of the remote.unknown shell script. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_remunk_rcsid[] = "$Id: remunk.c,v 1.1 1993/08/05 18:25:52 conklin Exp $"; +const char _uuconf_remunk_rcsid[] = "$Id: remunk.c,v 1.2 1994/05/07 18:12:50 ache Exp $"; #endif /* Get the name of the remote.unknown shell script. */ @@ -37,9 +37,18 @@ uuconf_remote_unknown (pglobal, pzname) pointer pglobal; char **pzname; { -#if HAVE_TAYLOR_CONFIG || ! HAVE_HDB_CONFIG +#if ! HAVE_HDB_CONFIG return UUCONF_NOT_FOUND; #else +#if HAVE_TAYLOR_CONFIG + struct sglobal *qglobal = (struct sglobal *) pglobal; + + /* If ``unknown'' commands were used in the config file, then ignore + any remote.unknown script. */ + if (qglobal->qprocess->qunknown != NULL) + return UUCONF_NOT_FOUND; +#endif /* HAVE_TAYLOR_CONFIG */ + return uuconf_hdb_remote_unknown (pglobal, pzname); -#endif +#endif /* HAVE_HDB_CONFIG */ } diff --git a/gnu/libexec/uucp/libuuconf/runuxq.c b/gnu/libexec/uucp/libuuconf/runuxq.c new file mode 100644 index 000000000000..01c368b98d33 --- /dev/null +++ b/gnu/libexec/uucp/libuuconf/runuxq.c @@ -0,0 +1,77 @@ +/* maxuxq.c + Return how often to spawn a uuxqt process. + + Copyright (C) 1994 Ian Lance Taylor + + This file is part of the Taylor UUCP uuconf library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + The author of the program may be contacted at ian@airs.com or + c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139. + */ + +#include "uucnfi.h" + +#if USE_RCS_ID +const char _uuconf_runuxq_rcsid[] = "$Id: runuxq.c,v 1.1 1994/05/07 18:12:51 ache Exp $"; +#endif + +/* Return how often to spawn a uuxqt process. This is either a + positive number representing the number of execution files to be + received between spawns, or a special code. When using + TAYLOR_CONFIG, this is from the ``run-uuxqt'' command in config + (the default is UUCONF_RUNUUXQT_ONCE, for compatibility). + Otherwise, we return UUCONF_RUNUUXQT_PERCALL for HDB_CONFIG and 10 + for V2_CONFIG, to emulate traditional HDB and V2 emulations. */ + +int +uuconf_runuuxqt (pglobal, pirunuuxqt) + pointer pglobal; + int *pirunuuxqt; +{ +#if HAVE_TAYLOR_CONFIG + { + struct sglobal *qglobal = (struct sglobal *) pglobal; + const char *zrun; + + zrun = qglobal->qprocess->zrunuuxqt; + if (zrun == NULL + || strcasecmp (zrun, "once") == 0) + *pirunuuxqt = UUCONF_RUNUUXQT_ONCE; + else if (strcasecmp (zrun, "never") == 0) + *pirunuuxqt = UUCONF_RUNUUXQT_NEVER; + else if (strcasecmp (zrun, "percall") == 0) + *pirunuuxqt = UUCONF_RUNUUXQT_PERCALL; + else + { + char *zend; + + *pirunuuxqt = strtol ((char *) qglobal->qprocess->zrunuuxqt, + &zend, 10); + if (*zend != '\0' || *pirunuuxqt <= 0) + *pirunuuxqt = UUCONF_RUNUUXQT_ONCE; + } + } +#else /* ! HAVE_TAYLOR_CONFIG */ +#if HAVE_HDB_CONFIG + *pirunuuxqt = UUCONF_RUNUUXQT_PERCALL; +#else /* ! HAVE_HDB_CONFIG */ + *pirunuuxqt = 10; +#endif /* ! HAVE_HDB_CONFIG */ +#endif /* ! HAVE_TAYLOR_CONFIG */ + + return UUCONF_SUCCESS; +} diff --git a/gnu/libexec/uucp/libuuconf/sinfo.c b/gnu/libexec/uucp/libuuconf/sinfo.c index 6eef6f811199..bb503820894e 100644 --- a/gnu/libexec/uucp/libuuconf/sinfo.c +++ b/gnu/libexec/uucp/libuuconf/sinfo.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_sinfo_rcsid[] = "$Id: sinfo.c,v 1.1 1993/08/05 18:25:52 conklin Exp $"; +const char _uuconf_sinfo_rcsid[] = "$Id: sinfo.c,v 1.2 1994/05/07 18:12:52 ache Exp $"; #endif /* Get information about a particular system. We combine the diff --git a/gnu/libexec/uucp/libuuconf/snams.c b/gnu/libexec/uucp/libuuconf/snams.c index 190e5cd7f4f7..9e130691a3fc 100644 --- a/gnu/libexec/uucp/libuuconf/snams.c +++ b/gnu/libexec/uucp/libuuconf/snams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_snams_rcsid[] = "$Id: snams.c,v 1.1 1993/08/05 18:25:53 conklin Exp $"; +const char _uuconf_snams_rcsid[] = "$Id: snams.c,v 1.2 1994/05/07 18:12:53 ache Exp $"; #endif /* Get all known system names. */ diff --git a/gnu/libexec/uucp/libuuconf/split.c b/gnu/libexec/uucp/libuuconf/split.c index 2a14753c382e..f9b825a154ca 100644 --- a/gnu/libexec/uucp/libuuconf/split.c +++ b/gnu/libexec/uucp/libuuconf/split.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_split_rcsid[] = "$Id: split.c,v 1.1 1993/08/05 18:25:54 conklin Exp $"; +const char _uuconf_split_rcsid[] = "$Id: split.c,v 1.2 1994/05/07 18:12:54 ache Exp $"; #endif #include <ctype.h> diff --git a/gnu/libexec/uucp/libuuconf/spool.c b/gnu/libexec/uucp/libuuconf/spool.c index 933f3c102ca5..176e77107243 100644 --- a/gnu/libexec/uucp/libuuconf/spool.c +++ b/gnu/libexec/uucp/libuuconf/spool.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_spool_rcsid[] = "$Id: spool.c,v 1.1 1993/08/05 18:25:55 conklin Exp $"; +const char _uuconf_spool_rcsid[] = "$Id: spool.c,v 1.2 1994/05/07 18:12:55 ache Exp $"; #endif /* Get the name of the UUCP spool directory. */ diff --git a/gnu/libexec/uucp/libuuconf/stafil.c b/gnu/libexec/uucp/libuuconf/stafil.c index db95f05aff90..5757c0f885cd 100644 --- a/gnu/libexec/uucp/libuuconf/stafil.c +++ b/gnu/libexec/uucp/libuuconf/stafil.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_stafil_rcsid[] = "$Id: stafil.c,v 1.1 1993/08/05 18:25:56 conklin Exp $"; +const char _uuconf_stafil_rcsid[] = "$Id: stafil.c,v 1.2 1994/05/07 18:12:56 ache Exp $"; #endif /* Get the name of the UUCP statistics file. */ diff --git a/gnu/libexec/uucp/libuuconf/syshdr.h b/gnu/libexec/uucp/libuuconf/syshdr.h index 8ff18a6ca49e..b5a759fd1a6c 100644 --- a/gnu/libexec/uucp/libuuconf/syshdr.h +++ b/gnu/libexec/uucp/libuuconf/syshdr.h @@ -1,7 +1,7 @@ /* syshdr.unx -*- C -*- Unix system header for the uuconf library. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 root directory (used when setting local-send and local-receive @@ -82,6 +82,40 @@ extern char *sys_errlist[]; #endif /* ! HAVE_STRERROR */ +/* This macro is used to make a filename found in a configuration file + into an absolute path. The zdir argument is the directory to put it + in. The zset argument is set to the new string. The fallocated + argument is set to TRUE if the new string was allocated. */ +#define MAKE_ABSOLUTE(zset, fallocated, zfile, zdir, pblock) \ + do \ + { \ + if (*(zfile) == '/') \ + { \ + (zset) = (zfile); \ + (fallocated) = FALSE; \ + } \ + else \ + { \ + size_t abs_cdir, abs_cfile; \ + char *abs_zret; \ +\ + abs_cdir = strlen (zdir); \ + abs_cfile = strlen (zfile); \ + abs_zret = (char *) uuconf_malloc ((pblock), \ + abs_cdir + abs_cfile + 2); \ + (zset) = abs_zret; \ + (fallocated) = TRUE; \ + if (abs_zret != NULL) \ + { \ + memcpy ((pointer) abs_zret, (pointer) (zdir), abs_cdir); \ + abs_zret[abs_cdir] = '/'; \ + memcpy ((pointer) (abs_zret + abs_cdir + 1), \ + (pointer) (zfile), abs_cfile + 1); \ + } \ + } \ + } \ + while (0) + /* We want to be able to mark the Taylor UUCP system files as close on exec. */ #if HAVE_FCNTL_H diff --git a/gnu/libexec/uucp/libuuconf/syssub.c b/gnu/libexec/uucp/libuuconf/syssub.c index 2a0894950e5f..b27c0eb9747c 100644 --- a/gnu/libexec/uucp/libuuconf/syssub.c +++ b/gnu/libexec/uucp/libuuconf/syssub.c @@ -1,7 +1,7 @@ /* syssub.c System information subroutines. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_syssub_rcsid[] = "$Id: syssub.c,v 1.1 1993/08/05 18:25:59 conklin Exp $"; +const char _uuconf_syssub_rcsid[] = "$Id: syssub.c,v 1.2 1994/05/07 18:12:59 ache Exp $"; #endif #include <errno.h> @@ -231,6 +231,71 @@ _uuconf_isystem_default (qglobal, qset, qdefault, faddalternates) if (qalt->uuconf_qproto_params == (struct uuconf_proto_param *) &_uuconf_unset) qalt->uuconf_qproto_params = qdefault->uuconf_qproto_params; + else if (qdefault->uuconf_qproto_params != NULL) + { + int cnew, ca; + struct uuconf_proto_param *qd, *qa; + + /* Merge in the default protocol parameters, so that a + system with 'g' protocol parameters won't lose the + default 'i' protocol parameters. */ + ca = 0; + cnew = 0; + for (qd = qdefault->uuconf_qproto_params; + qd->uuconf_bproto != '\0'; + qd++) + { + int c; + + c = 0; + for (qa = qalt->uuconf_qproto_params; + (qa->uuconf_bproto != '\0' + && qa->uuconf_bproto != qd->uuconf_bproto); + qa++) + ++c; + if (qa->uuconf_bproto == '\0') + { + ++cnew; + ca = c; + } + } + + if (cnew > 0) + { + struct uuconf_proto_param *qnew; + + qnew = ((struct uuconf_proto_param *) + uuconf_malloc (qset->uuconf_palloc, + ((ca + cnew + 1) + * sizeof (struct uuconf_proto_param)))); + if (qnew == NULL) + { + qglobal->ierrno = errno; + return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO; + } + memcpy ((pointer) qnew, (pointer) qalt->uuconf_qproto_params, + ca * sizeof (struct uuconf_proto_param)); + cnew = 0; + for (qd = qdefault->uuconf_qproto_params; + qd->uuconf_bproto != '\0'; + qd++) + { + for (qa = qalt->uuconf_qproto_params; + (qa->uuconf_bproto != '\0' + && qa->uuconf_bproto != qd->uuconf_bproto); + qa++) + ; + if (qa->uuconf_bproto == '\0') + { + qnew[ca + cnew] = *qd; + ++cnew; + } + } + qnew[ca + cnew].uuconf_bproto = '\0'; + uuconf_free (qset->uuconf_palloc, qalt->uuconf_qproto_params); + qalt->uuconf_qproto_params = qnew; + } + } if (qdefault->uuconf_qalternate != NULL) qdefault = qdefault->uuconf_qalternate; diff --git a/gnu/libexec/uucp/libuuconf/tcalou.c b/gnu/libexec/uucp/libuuconf/tcalou.c index 85f58a9fe89d..9caec19a1257 100644 --- a/gnu/libexec/uucp/libuuconf/tcalou.c +++ b/gnu/libexec/uucp/libuuconf/tcalou.c @@ -1,7 +1,7 @@ /* tcalou.c Find callout login name and password from Taylor UUCP configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tcalou_rcsid[] = "$Id: tcalou.c,v 1.1 1993/08/05 18:26:00 conklin Exp $"; +const char _uuconf_tcalou_rcsid[] = "$Id: tcalou.c,v 1.2 1994/05/07 18:13:00 ache Exp $"; #endif #include <errno.h> @@ -99,7 +99,7 @@ uuconf_taylor_callout (pglobal, qsys, pzlog, pzpass) } as[0].uuconf_zcmd = qsys->uuconf_zname; - as[0].uuconf_itype = UUCONF_CMDTABTYPE_FN | 3; + as[0].uuconf_itype = UUCONF_CMDTABTYPE_FN | 0; if (*pzlog == NULL) as[0].uuconf_pvar = (pointer) pzlog; else @@ -168,6 +168,9 @@ icsys (pglobal, argc, argv, pvar, pinfo) char **pzlog = (char **) pvar; char **pzpass = (char **) pinfo; + if (argc < 2 || argc > 3) + return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT; + if (pzlog != NULL) { *pzlog = strdup (argv[1]); @@ -182,7 +185,10 @@ icsys (pglobal, argc, argv, pvar, pinfo) if (pzpass != NULL) { - *pzpass = strdup (argv[2]); + if (argc < 3) + *pzpass = strdup (""); + else + *pzpass = strdup (argv[2]); if (*pzpass == NULL) { qglobal->ierrno = errno; diff --git a/gnu/libexec/uucp/libuuconf/tdial.c b/gnu/libexec/uucp/libuuconf/tdial.c index dbc3f831100b..0ac9117bb5b9 100644 --- a/gnu/libexec/uucp/libuuconf/tdial.c +++ b/gnu/libexec/uucp/libuuconf/tdial.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tdial_rcsid[] = "$Id: tdial.c,v 1.1 1993/08/05 18:26:01 conklin Exp $"; +const char _uuconf_tdial_rcsid[] = "$Id: tdial.c,v 1.2 1994/05/07 18:13:01 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/tdialc.c b/gnu/libexec/uucp/libuuconf/tdialc.c index 208cbe11fc48..7ae94800a35f 100644 --- a/gnu/libexec/uucp/libuuconf/tdialc.c +++ b/gnu/libexec/uucp/libuuconf/tdialc.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tdialc_rcsid[] = "$Id: tdialc.c,v 1.1 1993/08/05 18:26:03 conklin Exp $"; +const char _uuconf_tdialc_rcsid[] = "$Id: tdialc.c,v 1.2 1994/05/07 18:13:02 ache Exp $"; #endif static int idchat P((pointer pglobal, int argc, char **argv, pointer pvar, diff --git a/gnu/libexec/uucp/libuuconf/tdnams.c b/gnu/libexec/uucp/libuuconf/tdnams.c index 85328f586d61..bc8efa272644 100644 --- a/gnu/libexec/uucp/libuuconf/tdnams.c +++ b/gnu/libexec/uucp/libuuconf/tdnams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tdnams_rcsid[] = "$Id: tdnams.c,v 1.1 1993/08/05 18:26:04 conklin Exp $"; +const char _uuconf_tdnams_rcsid[] = "$Id: tdnams.c,v 1.2 1994/05/07 18:13:03 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/tgcmp.c b/gnu/libexec/uucp/libuuconf/tgcmp.c index 896b71d89c6d..0d6383a26681 100644 --- a/gnu/libexec/uucp/libuuconf/tgcmp.c +++ b/gnu/libexec/uucp/libuuconf/tgcmp.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tgcmp_rcsid[] = "$Id: tgcmp.c,v 1.1 1993/08/05 18:26:05 conklin Exp $"; +const char _uuconf_tgcmp_rcsid[] = "$Id: tgcmp.c,v 1.2 1994/05/07 18:13:04 ache Exp $"; #endif /* A comparison function to pass to _uuconf_itime_parse. This diff --git a/gnu/libexec/uucp/libuuconf/thread.c b/gnu/libexec/uucp/libuuconf/thread.c index 24f1caee8c1a..bf5dce7f8897 100644 --- a/gnu/libexec/uucp/libuuconf/thread.c +++ b/gnu/libexec/uucp/libuuconf/thread.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_thread_rcsid[] = "$Id: thread.c,v 1.1 1993/08/05 18:26:06 conklin Exp $"; +const char _uuconf_thread_rcsid[] = "$Id: thread.c,v 1.2 1994/05/07 18:13:05 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/time.c b/gnu/libexec/uucp/libuuconf/time.c index 33ce3f442c3c..e61bbf2ecee4 100644 --- a/gnu/libexec/uucp/libuuconf/time.c +++ b/gnu/libexec/uucp/libuuconf/time.c @@ -1,7 +1,7 @@ /* time.c Parse a time string into a uuconf_timespan structure. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_time_rcsid[] = "$Id: time.c,v 1.1 1993/08/05 18:26:07 conklin Exp $"; +const char _uuconf_time_rcsid[] = "$Id: time.c,v 1.2 1994/05/07 18:13:06 ache Exp $"; #endif #include <ctype.h> @@ -61,6 +61,7 @@ static const struct { "fr", 5, 5 }, { "sa", 6, 6 }, { "never", -1, -2 }, + { "none", -1, -2 }, { NULL, 0, 0 } }; @@ -106,7 +107,7 @@ _uuconf_itime_parse (qglobal, ztime, ival, cretry, picmp, pqspan, pblock) { if ((bfirst == (*pz)[0] || (isupper (BUCHAR ((*pz)[0])) - && bfirst == tolower (BUCHAR ((*pz)[0])))) + && (int) bfirst == (int) tolower (BUCHAR ((*pz)[0])))) && strcasecmp (ztime, *pz) == 0) zfound = pz[1]; pz += 2; diff --git a/gnu/libexec/uucp/libuuconf/tinit.c b/gnu/libexec/uucp/libuuconf/tinit.c index d8331c810c9a..28b2b5fdd143 100644 --- a/gnu/libexec/uucp/libuuconf/tinit.c +++ b/gnu/libexec/uucp/libuuconf/tinit.c @@ -1,7 +1,7 @@ /* tinit.c Initialize for reading Taylor UUCP configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993, 1994 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tinit_rcsid[] = "$Id: tinit.c,v 1.1 1993/08/05 18:26:08 conklin Exp $"; +const char _uuconf_tinit_rcsid[] = "$Id: tinit.c,v 1.2 1994/05/07 18:13:07 ache Exp $"; #endif #include <errno.h> @@ -35,8 +35,10 @@ const char _uuconf_tinit_rcsid[] = "$Id: tinit.c,v 1.1 1993/08/05 18:26:08 conkl static int itset_default P((struct sglobal *qglobal, char ***ppzvar, const char *zfile)); -static int itadd P((pointer pglobal, int argc, char **argv, pointer pvar, - pointer pinfo)); +static int itdebug P((pointer pglobal, int argc, char **argv, pointer pvar, + pointer pinfo)); +static int itaddfile P((pointer pglobal, int argc, char **argv, pointer pvar, + pointer pinfo)); static int itunknown P((pointer pglobal, int argc, char **argv, pointer pvar, pointer pinfo)); static int itprogram P((pointer pglobal, int argc, char **argv, pointer pvar, @@ -62,22 +64,24 @@ static const struct cmdtab_offset asCmds[] = offsetof (struct sprocess, zstatsfile), NULL }, { "debugfile", UUCONF_CMDTABTYPE_STRING, offsetof (struct sprocess, zdebugfile), NULL }, - { "debug", UUCONF_CMDTABTYPE_STRING, - offsetof (struct sprocess, zdebug), NULL }, + { "debug", UUCONF_CMDTABTYPE_FN | 0, + offsetof (struct sprocess, zdebug), itdebug }, { "max-uuxqts", UUCONF_CMDTABTYPE_INT, offsetof (struct sprocess, cmaxuuxqts), NULL }, + { "run-uuxqt", UUCONF_CMDTABTYPE_STRING, + offsetof (struct sprocess, zrunuuxqt), NULL }, { "sysfile", UUCONF_CMDTABTYPE_FN | 0, - offsetof (struct sprocess, pzsysfiles), itadd }, + offsetof (struct sprocess, pzsysfiles), itaddfile }, { "portfile", UUCONF_CMDTABTYPE_FN | 0, - offsetof (struct sprocess, pzportfiles), itadd }, + offsetof (struct sprocess, pzportfiles), itaddfile }, { "dialfile", UUCONF_CMDTABTYPE_FN | 0, - offsetof (struct sprocess, pzdialfiles), itadd }, + offsetof (struct sprocess, pzdialfiles), itaddfile }, { "dialcodefile", UUCONF_CMDTABTYPE_FN | 0, - offsetof (struct sprocess, pzdialcodefiles), itadd }, + offsetof (struct sprocess, pzdialcodefiles), itaddfile }, { "callfile", UUCONF_CMDTABTYPE_FN | 0, - offsetof (struct sprocess, pzcallfiles), itadd }, + offsetof (struct sprocess, pzcallfiles), itaddfile }, { "passwdfile", UUCONF_CMDTABTYPE_FN | 0, - offsetof (struct sprocess, pzpwdfiles), itadd }, + offsetof (struct sprocess, pzpwdfiles), itaddfile }, { "unknown", UUCONF_CMDTABTYPE_FN, offsetof (struct sprocess, qunknown), itunknown }, { "v2-files", UUCONF_CMDTABTYPE_BOOLEAN, @@ -227,11 +231,29 @@ uuconf_taylor_init (ppglobal, zprogram, zname) return UUCONF_SUCCESS; } -/* Add new strings to a variable. */ +/* Local interface to the _uuconf_idebug_cmd function, which handles + the "debug" command. */ + +static int +itdebug (pglobal, argc, argv, pvar, pinfo) + pointer pglobal; + int argc; + char **argv; + pointer pvar; + pointer pinfo; +{ + struct sglobal *qglobal = (struct sglobal *) pglobal; + char **pzdebug = (char **) pvar; + + return _uuconf_idebug_cmd (qglobal, pzdebug, argc, argv, + qglobal->pblock); +} + +/* Add new filenames to a list of files. */ /*ARGSUSED*/ static int -itadd (pglobal, argc, argv, pvar, pinfo) +itaddfile (pglobal, argc, argv, pvar, pinfo) pointer pglobal; int argc; char **argv; @@ -254,7 +276,19 @@ itadd (pglobal, argc, argv, pvar, pinfo) { for (i = 1; i < argc; i++) { - iret = _uuconf_iadd_string (qglobal, argv[i], TRUE, FALSE, ppz, + char *z; + boolean fallocated; + + MAKE_ABSOLUTE (z, fallocated, argv[i], NEWCONFIGLIB, + qglobal->pblock); + if (z == NULL) + { + qglobal->ierrno = errno; + return (UUCONF_MALLOC_FAILED + | UUCONF_ERROR_ERRNO + | UUCONF_CMDTABRET_EXIT); + } + iret = _uuconf_iadd_string (qglobal, z, ! fallocated, FALSE, ppz, qglobal->pblock); if (iret != UUCONF_SUCCESS) return iret; @@ -368,3 +402,60 @@ itset_default (qglobal, ppzvar, zfile) return _uuconf_iadd_string (qglobal, zadd, FALSE, FALSE, ppzvar, qglobal->pblock); } + +/* Handle the "debug" command which is documented to take multiple + arguments. This is also called by the ``debug'' command in a sys + file. It returns a CMDTABRET code. This should probably be in its + own file, but the only other place it is called is from tsinfo.c, + and any user of tsinfo.c it sure to link in this file as well. */ + +int +_uuconf_idebug_cmd (qglobal, pzdebug, argc, argv, pblock) + struct sglobal *qglobal; + char **pzdebug; + int argc; + char **argv; + pointer pblock; +{ + if (argc == 1) + { + *pzdebug = NULL; + return UUCONF_CMDTABRET_CONTINUE; + } + else if (argc == 2) + { + *pzdebug = argv[1]; + return UUCONF_CMDTABRET_KEEP; + } + else + { + size_t cdebug; + int i; + char *zdebug; + + cdebug = 0; + for (i = 1; i < argc; i++) + cdebug += strlen (argv[i]) + 1; + zdebug = (char *) uuconf_malloc (pblock, cdebug); + if (zdebug == NULL) + { + qglobal->ierrno = errno; + return (UUCONF_MALLOC_FAILED + | UUCONF_ERROR_ERRNO + | UUCONF_CMDTABRET_EXIT); + } + cdebug = 0; + for (i = 1; i < argc; i++) + { + size_t clen; + + clen = strlen (argv[i]); + memcpy (zdebug + cdebug, argv[i], clen); + zdebug[cdebug + clen] = ' '; + cdebug += clen + 1; + } + zdebug[cdebug - 1] = '\0'; + *pzdebug = zdebug; + return UUCONF_CMDTABRET_CONTINUE; + } +} diff --git a/gnu/libexec/uucp/libuuconf/tlocnm.c b/gnu/libexec/uucp/libuuconf/tlocnm.c index be237ea2af6c..aa5cc2c9d466 100644 --- a/gnu/libexec/uucp/libuuconf/tlocnm.c +++ b/gnu/libexec/uucp/libuuconf/tlocnm.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tlocnm_rcsid[] = "$Id: tlocnm.c,v 1.1 1993/08/05 18:26:09 conklin Exp $"; +const char _uuconf_tlocnm_rcsid[] = "$Id: tlocnm.c,v 1.2 1994/05/07 18:13:08 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/tport.c b/gnu/libexec/uucp/libuuconf/tport.c index 45f1cb7c07f7..71ac0b3d188a 100644 --- a/gnu/libexec/uucp/libuuconf/tport.c +++ b/gnu/libexec/uucp/libuuconf/tport.c @@ -1,7 +1,7 @@ /* tport.c Find a port in the Taylor UUCP configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tport_rcsid[] = "$Id: tport.c,v 1.1 1993/08/05 18:26:11 conklin Exp $"; +const char _uuconf_tport_rcsid[] = "$Id: tport.c,v 1.2 1994/05/07 18:13:09 ache Exp $"; #endif #include <errno.h> @@ -290,6 +290,10 @@ ipunknown (pglobal, argc, argv, pvar, pinfo) { struct sglobal *qglobal = (struct sglobal *) pglobal; struct uuconf_port *qport = (struct uuconf_port *) pinfo; + int iret; - return _uuconf_iport_cmd (qglobal, argc, argv, qport); + iret = _uuconf_iport_cmd (qglobal, argc, argv, qport); + if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS) + iret |= UUCONF_CMDTABRET_EXIT; + return iret; } diff --git a/gnu/libexec/uucp/libuuconf/tportc.c b/gnu/libexec/uucp/libuuconf/tportc.c index 6a97870af7c0..394f027878e1 100644 --- a/gnu/libexec/uucp/libuuconf/tportc.c +++ b/gnu/libexec/uucp/libuuconf/tportc.c @@ -1,7 +1,7 @@ /* tportc.c Handle a Taylor UUCP port command. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tportc_rcsid[] = "$Id: tportc.c,v 1.1 1993/08/05 18:26:12 conklin Exp $"; +const char _uuconf_tportc_rcsid[] = "$Id: tportc.c,v 1.2 1994/05/07 18:13:11 ache Exp $"; #endif #include <errno.h> @@ -50,7 +50,8 @@ static const char * const azPtype_names[] = "modem", "direct", "tcp", - "tli" + "tli", + "pipe" }; #define CPORT_TYPES (sizeof azPtype_names / sizeof azPtype_names[0]) @@ -104,6 +105,9 @@ static const struct cmdtab_offset asPmodem_cmds[] = { "carrier", UUCONF_CMDTABTYPE_BOOLEAN, offsetof (struct uuconf_port, uuconf_u.uuconf_smodem.uuconf_fcarrier), NULL }, + { "hardflow", UUCONF_CMDTABTYPE_BOOLEAN, + offsetof (struct uuconf_port, uuconf_u.uuconf_smodem.uuconf_fhardflow), + NULL }, { "dial-device", UUCONF_CMDTABTYPE_STRING, offsetof (struct uuconf_port, uuconf_u.uuconf_smodem.uuconf_zdial_device), @@ -130,6 +134,12 @@ static const struct cmdtab_offset asPdirect_cmds[] = { "speed", UUCONF_CMDTABTYPE_LONG, offsetof (struct uuconf_port, uuconf_u.uuconf_sdirect.uuconf_ibaud), NULL }, + { "carrier", UUCONF_CMDTABTYPE_BOOLEAN, + offsetof (struct uuconf_port, uuconf_u.uuconf_sdirect.uuconf_fcarrier), + NULL }, + { "hardflow", UUCONF_CMDTABTYPE_BOOLEAN, + offsetof (struct uuconf_port, uuconf_u.uuconf_sdirect.uuconf_fhardflow), + NULL }, { NULL, 0, 0, NULL } }; @@ -141,6 +151,9 @@ static const struct cmdtab_offset asPtcp_cmds[] = { "service", UUCONF_CMDTABTYPE_STRING, offsetof (struct uuconf_port, uuconf_u.uuconf_stcp.uuconf_zport), NULL }, + { "dialer-sequence", UUCONF_CMDTABTYPE_FULLSTRING, + offsetof (struct uuconf_port, uuconf_u.uuconf_stcp.uuconf_pzdialer), + NULL }, { NULL, 0, 0, NULL } }; @@ -169,11 +182,22 @@ static const struct cmdtab_offset asPtli_cmds[] = #define CTLI_CMDS (sizeof asPtli_cmds / sizeof asPtli_cmds[0]) +/* The pipe port command table. */ +static const struct cmdtab_offset asPpipe_cmds[] = +{ + { "command", UUCONF_CMDTABTYPE_FULLSTRING, + offsetof (struct uuconf_port, uuconf_u.uuconf_spipe.uuconf_pzcmd), + NULL }, + { NULL, 0, 0, NULL} +}; + +#define CPIPE_CMDS (sizeof asPpipe_cmds / sizeof asPpipe_cmds[0]) + #undef max #define max(i1, i2) ((i1) > (i2) ? (i1) : (i2)) #define CCMDS \ max (max (max (CPORT_CMDS, CSTDIN_CMDS), CMODEM_CMDS), \ - max (max (CDIRECT_CMDS, CTCP_CMDS), CTLI_CMDS)) + max (max (CDIRECT_CMDS, CTCP_CMDS), max (CTLI_CMDS, CPIPE_CMDS))) /* Handle a command passed to a port from a Taylor UUCP configuration file. This can be called when reading either the port file or the @@ -243,15 +267,19 @@ _uuconf_iport_cmd (qglobal, argc, argv, qport) qport->uuconf_u.uuconf_smodem.uuconf_ilowbaud = 0L; qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud = 0L; qport->uuconf_u.uuconf_smodem.uuconf_fcarrier = TRUE; + qport->uuconf_u.uuconf_smodem.uuconf_fhardflow = TRUE; qport->uuconf_u.uuconf_smodem.uuconf_pzdialer = NULL; qport->uuconf_u.uuconf_smodem.uuconf_qdialer = NULL; break; case UUCONF_PORTTYPE_DIRECT: qport->uuconf_u.uuconf_sdirect.uuconf_zdevice = NULL; qport->uuconf_u.uuconf_sdirect.uuconf_ibaud = -1; + qport->uuconf_u.uuconf_sdirect.uuconf_fcarrier = FALSE; + qport->uuconf_u.uuconf_sdirect.uuconf_fhardflow = TRUE; break; case UUCONF_PORTTYPE_TCP: qport->uuconf_u.uuconf_stcp.uuconf_zport = (char *) "uucp"; + qport->uuconf_u.uuconf_stcp.uuconf_pzdialer = NULL; qport->uuconf_ireliable = (UUCONF_RELIABLE_SPECIFIED | UUCONF_RELIABLE_ENDTOEND | UUCONF_RELIABLE_RELIABLE @@ -270,6 +298,9 @@ _uuconf_iport_cmd (qglobal, argc, argv, qport) | UUCONF_RELIABLE_EIGHT | UUCONF_RELIABLE_FULLDUPLEX); break; + case UUCONF_PORTTYPE_PIPE: + qport->uuconf_u.uuconf_spipe.uuconf_pzcmd = NULL; + break; } if (fgottype) @@ -310,6 +341,10 @@ _uuconf_iport_cmd (qglobal, argc, argv, qport) qcmds = asPtli_cmds; ccmds = CTLI_CMDS; break; + case UUCONF_PORTTYPE_PIPE: + qcmds = asPpipe_cmds; + ccmds = CPIPE_CMDS; + break; default: return UUCONF_SYNTAX_ERROR; } @@ -410,23 +445,28 @@ ipdialer (pglobal, argc, argv, pvar, pinfo) _uuconf_uclear_dialer (qnew); - clen = strlen (qport->uuconf_zname); - qnew->uuconf_zname = (char *) uuconf_malloc (qport->uuconf_palloc, - (clen - + sizeof " dialer")); - if (qnew->uuconf_zname == NULL) + if (qport->uuconf_zname == NULL) + qnew->uuconf_zname = (char *) "default port file dialer"; + else { - qglobal->ierrno = errno; - return (UUCONF_MALLOC_FAILED - | UUCONF_ERROR_ERRNO - | UUCONF_CMDTABRET_EXIT); + clen = strlen (qport->uuconf_zname); + qnew->uuconf_zname = + (char *) uuconf_malloc (qport->uuconf_palloc, + clen + sizeof " dialer"); + if (qnew->uuconf_zname == NULL) + { + qglobal->ierrno = errno; + return (UUCONF_MALLOC_FAILED + | UUCONF_ERROR_ERRNO + | UUCONF_CMDTABRET_EXIT); + } + + memcpy ((pointer) qnew->uuconf_zname, + (pointer) qport->uuconf_zname, clen); + memcpy ((pointer) (qnew->uuconf_zname + clen), + (pointer) " dialer", sizeof " dialer"); } - memcpy ((pointer) qnew->uuconf_zname, - (pointer) qport->uuconf_zname, clen); - memcpy ((pointer) (qnew->uuconf_zname + clen), (pointer) " dialer", - sizeof " dialer"); - qnew->uuconf_palloc = qport->uuconf_palloc; qmodem->uuconf_qdialer = qnew; diff --git a/gnu/libexec/uucp/libuuconf/tsinfo.c b/gnu/libexec/uucp/libuuconf/tsinfo.c index 0a04ea0469f2..8d69f6ab05c5 100644 --- a/gnu/libexec/uucp/libuuconf/tsinfo.c +++ b/gnu/libexec/uucp/libuuconf/tsinfo.c @@ -1,7 +1,7 @@ /* tsinfo.c Get information about a system from the Taylor UUCP configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tsinfo_rcsid[] = "$Id: tsinfo.c,v 1.1 1993/08/05 18:26:13 conklin Exp $"; +const char _uuconf_tsinfo_rcsid[] = "$Id: tsinfo.c,v 1.2 1994/05/07 18:13:12 ache Exp $"; #endif #include <errno.h> @@ -54,6 +54,7 @@ CMDTABFN (iisize); CMDTABFN (iibaud_range); CMDTABFN (iiport); CMDTABFN (iichat); +CMDTABFN (iidebug); CMDTABFN (iicalled_login); CMDTABFN (iiproto_param); CMDTABFN (iirequest); @@ -136,8 +137,8 @@ static const struct cmdtab_offset asIcmds[] = offsetof (struct uuconf_system, uuconf_qproto_params), iiproto_param }, { "called-chat", UUCONF_CMDTABTYPE_PREFIX | 0, offsetof (struct uuconf_system, uuconf_scalled_chat), iichat }, - { "debug", UUCONF_CMDTABTYPE_STRING, - offsetof (struct uuconf_system, uuconf_zdebug), NULL }, + { "debug", UUCONF_CMDTABTYPE_FN | 0, + offsetof (struct uuconf_system, uuconf_zdebug), iidebug }, { "max-remote-debug", UUCONF_CMDTABTYPE_STRING, offsetof (struct uuconf_system, uuconf_zmax_remote_debug), NULL }, { "send-request", UUCONF_CMDTABTYPE_BOOLEAN, @@ -708,6 +709,25 @@ iichat (pglobal, argc, argv, pvar, pinfo) return iret; } +/* Local interface to the _uuconf_idebug_cmd function, which handles + the "debug" command. */ + +static int +iidebug (pglobal, argc, argv, pvar, pinfo) + pointer pglobal; + int argc; + char **argv; + pointer pvar; + pointer pinfo; +{ + struct sglobal *qglobal = (struct sglobal *) pglobal; + struct sinfo *qinfo = (struct sinfo *) pinfo; + char **pzdebug = (char **) pvar; + + return _uuconf_idebug_cmd (qglobal, pzdebug, argc, argv, + qinfo->qsys->uuconf_palloc); +} + /* Handle the "called-login" command. This only needs to be in a function because there can be additional arguments listing the remote systems which are permitted to use this login name. The diff --git a/gnu/libexec/uucp/libuuconf/tsnams.c b/gnu/libexec/uucp/libuuconf/tsnams.c index 2c2029cab6a7..67ec1f969fad 100644 --- a/gnu/libexec/uucp/libuuconf/tsnams.c +++ b/gnu/libexec/uucp/libuuconf/tsnams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tsnams_rcsid[] = "$Id: tsnams.c,v 1.1 1993/08/05 18:26:14 conklin Exp $"; +const char _uuconf_tsnams_rcsid[] = "$Id: tsnams.c,v 1.2 1994/05/07 18:13:13 ache Exp $"; #endif /* Get all the system names from the Taylor UUCP configuration files. diff --git a/gnu/libexec/uucp/libuuconf/tsys.c b/gnu/libexec/uucp/libuuconf/tsys.c index 5d337a9233c3..69a8de2765f2 100644 --- a/gnu/libexec/uucp/libuuconf/tsys.c +++ b/gnu/libexec/uucp/libuuconf/tsys.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tsys_rcsid[] = "$Id: tsys.c,v 1.1 1993/08/05 18:26:15 conklin Exp $"; +const char _uuconf_tsys_rcsid[] = "$Id: tsys.c,v 1.2 1994/05/07 18:13:14 ache Exp $"; #endif /* Get system information from the Taylor UUCP configuration files. diff --git a/gnu/libexec/uucp/libuuconf/tval.c b/gnu/libexec/uucp/libuuconf/tval.c index 7e263f5d7f17..f02199ed2974 100644 --- a/gnu/libexec/uucp/libuuconf/tval.c +++ b/gnu/libexec/uucp/libuuconf/tval.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_tval_rcsid[] = "$Id: tval.c,v 1.1 1993/08/05 18:26:16 conklin Exp $"; +const char _uuconf_tval_rcsid[] = "$Id: tval.c,v 1.2 1994/05/07 18:13:15 ache Exp $"; #endif /* Validate a login name for a system using Taylor UUCP configuration diff --git a/gnu/libexec/uucp/libuuconf/ugtlin.c b/gnu/libexec/uucp/libuuconf/ugtlin.c index 79fbec8a97eb..ea85c199c3c6 100644 --- a/gnu/libexec/uucp/libuuconf/ugtlin.c +++ b/gnu/libexec/uucp/libuuconf/ugtlin.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_ugtlin_rcsid[] = "$Id: ugtlin.c,v 1.1 1993/08/05 18:26:17 conklin Exp $"; +const char _uuconf_ugtlin_rcsid[] = "$Id: ugtlin.c,v 1.2 1994/05/07 18:13:16 ache Exp $"; #endif /* Read a line from a file with backslash continuations. This updates diff --git a/gnu/libexec/uucp/libuuconf/unk.c b/gnu/libexec/uucp/libuuconf/unk.c index 9b3d95369f52..c7eee61de189 100644 --- a/gnu/libexec/uucp/libuuconf/unk.c +++ b/gnu/libexec/uucp/libuuconf/unk.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_unk_rcsid[] = "$Id: unk.c,v 1.1 1993/08/05 18:26:18 conklin Exp $"; +const char _uuconf_unk_rcsid[] = "$Id: unk.c,v 1.2 1994/05/07 18:13:18 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/uucnfi.h b/gnu/libexec/uucp/libuuconf/uucnfi.h index 9ce6a62dc763..98122794f104 100644 --- a/gnu/libexec/uucp/libuuconf/uucnfi.h +++ b/gnu/libexec/uucp/libuuconf/uucnfi.h @@ -1,7 +1,7 @@ /* uucnfi.h Internal header file for the uuconf package. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993, 1994 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 is the internal header file for the uuconf package. It should @@ -80,6 +80,8 @@ struct sprocess const char *zdebug; /* The maximum number of simultaneously executing uuxqts. */ int cmaxuuxqts; + /* How often to spawn a uuxqt process. */ + const char *zrunuuxqt; /* Whether we are reading the V2 configuration files. */ boolean fv2; /* Whether we are reading the HDB configuration files. */ @@ -334,6 +336,12 @@ extern int _uuconf_itime_parse P((struct sglobal *qglobal, char *ztime, /* A grade comparison function to pass to _uuconf_itime_parse. */ extern int _uuconf_itime_grade_cmp P((long, long)); +/* Parse a debugging string. */ + +extern int _uuconf_idebug_cmd P((struct sglobal *qglobal, + char **pzdebug, int argc, + char **argv, pointer pblock)); + /* Add a string to a NULL terminated list of strings. */ extern int _uuconf_iadd_string P((struct sglobal *qglobal, char *zadd, boolean fcopy, diff --git a/gnu/libexec/uucp/libuuconf/val.c b/gnu/libexec/uucp/libuuconf/val.c index 7ead37b9e96e..7f886bcfd6da 100644 --- a/gnu/libexec/uucp/libuuconf/val.c +++ b/gnu/libexec/uucp/libuuconf/val.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_val_rcsid[] = "$Id: val.c,v 1.1 1993/08/05 18:26:20 conklin Exp $"; +const char _uuconf_val_rcsid[] = "$Id: val.c,v 1.2 1994/05/07 18:13:20 ache Exp $"; #endif /* Validate a login name for a system. */ diff --git a/gnu/libexec/uucp/libuuconf/vinit.c b/gnu/libexec/uucp/libuuconf/vinit.c index 6a76351d709a..22e05b6fccb5 100644 --- a/gnu/libexec/uucp/libuuconf/vinit.c +++ b/gnu/libexec/uucp/libuuconf/vinit.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_vinit_rcsid[] = "$Id: vinit.c,v 1.1 1993/08/05 18:26:21 conklin Exp $"; +const char _uuconf_vinit_rcsid[] = "$Id: vinit.c,v 1.2 1994/05/07 18:13:21 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/vport.c b/gnu/libexec/uucp/libuuconf/vport.c index 38ece0f7dfce..b090001ea8ab 100644 --- a/gnu/libexec/uucp/libuuconf/vport.c +++ b/gnu/libexec/uucp/libuuconf/vport.c @@ -1,7 +1,7 @@ /* vport.c Find a port in the V2 configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_vport_rcsid[] = "$Id: vport.c,v 1.1 1993/08/05 18:26:22 conklin Exp $"; +const char _uuconf_vport_rcsid[] = "$Id: vport.c,v 1.2 1994/05/07 18:13:22 ache Exp $"; #endif #include <errno.h> @@ -140,6 +140,8 @@ uuconf_v2_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) qport->uuconf_ttype = UUCONF_PORTTYPE_DIRECT; qport->uuconf_u.uuconf_sdirect.uuconf_zdevice = pzsplit[1]; qport->uuconf_u.uuconf_sdirect.uuconf_ibaud = ilow; + qport->uuconf_u.uuconf_sdirect.uuconf_fcarrier = FALSE; + qport->uuconf_u.uuconf_sdirect.uuconf_fhardflow = TRUE; } else { @@ -162,6 +164,7 @@ uuconf_v2_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport) qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud = ihigh; } qport->uuconf_u.uuconf_smodem.uuconf_fcarrier = TRUE; + qport->uuconf_u.uuconf_smodem.uuconf_fhardflow = TRUE; if (ctoks < 5) qport->uuconf_u.uuconf_smodem.uuconf_pzdialer = NULL; else diff --git a/gnu/libexec/uucp/libuuconf/vsinfo.c b/gnu/libexec/uucp/libuuconf/vsinfo.c index 4e929e092695..99784b2b9711 100644 --- a/gnu/libexec/uucp/libuuconf/vsinfo.c +++ b/gnu/libexec/uucp/libuuconf/vsinfo.c @@ -1,7 +1,7 @@ /* vsinfo.c Get information about a system from the V2 configuration files. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP uuconf library. @@ -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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_vsinfo_rcsid[] = "$Id: vsinfo.c,v 1.1 1993/08/05 18:26:23 conklin Exp $"; +const char _uuconf_vsinfo_rcsid[] = "$Id: vsinfo.c,v 1.2 1994/05/07 18:13:23 ache Exp $"; #endif #include <errno.h> @@ -77,7 +77,7 @@ _uuconf_iv2_system_internal (qglobal, zsystem, qsys) qglobal->ilineno = 0; - while ((cchars = getline (&zline, &cline, e)) > 0) + while ((cchars = _uuconf_getline (qglobal, &zline, &cline, e)) > 0) { int ctoks, ctimes, i; struct uuconf_system *qset; @@ -174,7 +174,7 @@ _uuconf_iv2_system_internal (qglobal, zsystem, qsys) here. */ zretry = strchr (pzsplit[1], ';'); if (zretry == NULL) - cretry = 0; + cretry = 55; else { *zretry = '\0'; @@ -212,6 +212,11 @@ _uuconf_iv2_system_internal (qglobal, zsystem, qsys) pblock); if (iret != UUCONF_SUCCESS) break; + + /* Treat any time/grade setting as both a timegrade and a + call-timegrade. */ + if (bgrade != UUCONF_GRADE_LOW) + qset->uuconf_qcalltimegrade = qset->uuconf_qtimegrade; } if (iret != UUCONF_SUCCESS) @@ -259,6 +264,7 @@ _uuconf_iv2_system_internal (qglobal, zsystem, qsys) else qset->uuconf_qport->uuconf_u.uuconf_stcp.uuconf_zport = pzsplit[3]; + qset->uuconf_qport->uuconf_u.uuconf_stcp.uuconf_pzdialer = NULL; } if (ctoks < 4) diff --git a/gnu/libexec/uucp/libuuconf/vsnams.c b/gnu/libexec/uucp/libuuconf/vsnams.c index 68baf9f626b5..ffc477846fd7 100644 --- a/gnu/libexec/uucp/libuuconf/vsnams.c +++ b/gnu/libexec/uucp/libuuconf/vsnams.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_vsnams_rcsid[] = "$Id: vsnams.c,v 1.1 1993/08/05 18:26:24 conklin Exp $"; +const char _uuconf_vsnams_rcsid[] = "$Id: vsnams.c,v 1.2 1994/05/07 18:13:24 ache Exp $"; #endif #include <errno.h> diff --git a/gnu/libexec/uucp/libuuconf/vsys.c b/gnu/libexec/uucp/libuuconf/vsys.c index 476ff7ca0003..a156564e6683 100644 --- a/gnu/libexec/uucp/libuuconf/vsys.c +++ b/gnu/libexec/uucp/libuuconf/vsys.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 "uucnfi.h" #if USE_RCS_ID -const char _uuconf_vsys_rcsid[] = "$Id: vsys.c,v 1.1 1993/08/05 18:26:25 conklin Exp $"; +const char _uuconf_vsys_rcsid[] = "$Id: vsys.c,v 1.2 1994/05/07 18:13:25 ache Exp $"; #endif /* Get system information from the V2 configuration files. This is a diff --git a/gnu/libexec/uucp/libuucp/MANIFEST b/gnu/libexec/uucp/libuucp/MANIFEST index 093924858eac..4fe9c3b318e0 100644 --- a/gnu/libexec/uucp/libuucp/MANIFEST +++ b/gnu/libexec/uucp/libuucp/MANIFEST @@ -22,6 +22,7 @@ strncs.c strrch.c strstr.c strtol.c +strtou.c xfree.c xmall.c xreall.c diff --git a/gnu/libexec/uucp/libuucp/Makefile b/gnu/libexec/uucp/libuucp/Makefile index 604ea21c089d..e709431abc6a 100644 --- a/gnu/libexec/uucp/libuucp/Makefile +++ b/gnu/libexec/uucp/libuucp/Makefile @@ -1,9 +1,10 @@ # This is the Makefile for the libuucp subdirectory of Taylor UUCP -# $Id: Makefile,v 1.2 1993/08/16 16:22:34 jtc Exp $ +# $Id: Makefile,v 1.3 1994/05/07 18:13:29 ache Exp $ LIB= uucp -SRCS= buffer.c crc.c debug.c escape.c getopt.c getop1.c parse.c \ - spool.c status.c xfree.c xmall.c xreall.c getlin.c +SRCS = buffer.c crc.c debug.c escape.c getopt.c getop1.c parse.c spool.c \ + status.c xfree.c xmall.c xreall.c \ + getlin.c CFLAGS+= -I$(.CURDIR)/../common_sources NOMAN= noman diff --git a/gnu/libexec/uucp/libuucp/buffer.c b/gnu/libexec/uucp/libuucp/buffer.c index c44fa4513942..8ddb2219cf4f 100644 --- a/gnu/libexec/uucp/libuucp/buffer.c +++ b/gnu/libexec/uucp/libuucp/buffer.c @@ -1,7 +1,7 @@ /* buffer.c Manipulate buffers used to hold strings. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1993 Ian Lance Taylor This file is part of Taylor UUCP. @@ -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. */ #include "uucp.h" @@ -97,13 +97,31 @@ void ubuffree (z) char *z; { - size_t ioff; struct sbuf *q; + /* The type of ioff should be size_t, but making it int avoids a bug + in some versions of the HP/UX compiler, and will always work. */ + int ioff; if (z == NULL) return; ioff = offsetof (struct sbuf, u); q = (struct sbuf *) (pointer) (z - ioff); + +#ifdef DEBUG_BUFFER + { + struct sbuf *qlook; + + for (qlook = qBlist; qlook != NULL; qlook = qlook->qnext) + { + if (qlook == q) + { + ulog (LOG_ERROR, "ubuffree: Attempt to free buffer twice"); + abort (); + } + } + } +#endif + q->qnext = qBlist; qBlist = q; } diff --git a/gnu/libexec/uucp/libuucp/debug.c b/gnu/libexec/uucp/libuucp/debug.c index 86f784154ab6..16c1b54891a8 100644 --- a/gnu/libexec/uucp/libuucp/debug.c +++ b/gnu/libexec/uucp/libuucp/debug.c @@ -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. */ #include "uucp.h" @@ -29,6 +29,8 @@ #include "uudefs.h" +#if DEBUG > 1 + /* The debugging level. */ int iDebug; @@ -63,9 +65,9 @@ idebug_parse (z) iret = 0; - for (ztok = strtok (zcopy, ","); + for (ztok = strtok (zcopy, ", \t"); ztok != NULL; - ztok = strtok ((char *) NULL, ",")) + ztok = strtok ((char *) NULL, ", \t")) { if (strcasecmp (ztok, "all") == 0) { @@ -91,6 +93,8 @@ idebug_parse (z) return iret; } +#endif /* DEBUG > 1 */ + /* A debugging routine used when displaying buffers. */ size_t diff --git a/gnu/libexec/uucp/libuucp/getlin.c b/gnu/libexec/uucp/libuucp/getlin.c index 1c204e74ee30..983da7d18751 100644 --- a/gnu/libexec/uucp/libuucp/getlin.c +++ b/gnu/libexec/uucp/libuucp/getlin.c @@ -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. */ #include "uucp.h" diff --git a/gnu/libexec/uucp/libuucp/parse.c b/gnu/libexec/uucp/libuucp/parse.c index e4b72435f5c6..a77350a68773 100644 --- a/gnu/libexec/uucp/libuucp/parse.c +++ b/gnu/libexec/uucp/libuucp/parse.c @@ -1,7 +1,7 @@ /* parse.c Parse a UUCP command string. - 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 parse_rcsid[] = "$Id: parse.c,v 1.1 1993/08/05 18:26:43 conklin Exp $"; +const char parse_rcsid[] = "$Id: parse.c,v 1.2 1994/05/07 18:13:33 ache Exp $"; #endif #include "uudefs.h" @@ -59,6 +59,7 @@ fparse_cmd (zcmd, qcmd) && qcmd->bcmd != 'P') return FALSE; + qcmd->bgrade = '\0'; qcmd->pseq = NULL; qcmd->zfrom = NULL; qcmd->zto = NULL; @@ -164,10 +165,21 @@ fparse_cmd (zcmd, qcmd) z = strtok ((char *) NULL, " \t\n"); if (z == NULL) return FALSE; - qcmd->imode = (int) strtol (z, &zend, 8); + qcmd->imode = (int) strtol (z, &zend, 0); if (*zend != '\0') return FALSE; + /* As a magic special case, if the mode came out as the decimal + values 666 or 777, assume that they actually meant the octal + values. Most systems use a leading zero, but a few do not. + Since both 666 and 777 are greater than the largest legal mode + value, which is 0777 == 511, this hack does not restrict any + legal values. */ + if (qcmd->imode == 666) + qcmd->imode = 0666; + else if (qcmd->imode == 777) + qcmd->imode = 0777; + z = strtok ((char *) NULL, " \t\n"); if (qcmd->bcmd == 'E' && z == NULL) return FALSE; diff --git a/gnu/libexec/uucp/libuucp/status.c b/gnu/libexec/uucp/libuucp/status.c index bee5f83dd08f..65e854ebdca2 100644 --- a/gnu/libexec/uucp/libuucp/status.c +++ b/gnu/libexec/uucp/libuucp/status.c @@ -7,6 +7,22 @@ /* Status strings. These must match enum tstatus_type. */ +#if USE_TRADITIONAL_STATUS + +const char *azStatus[] = +{ + "SUCCESSFUL", + "DEVICE FAILED", + "DIAL FAILED", + "LOGIN FAILED", + "STARTUP FAILED", + "CONVERSATION FAILED", + "TALKING", + "WRONG TIME TO CALL" +}; + +#else + const char *azStatus[] = { "Conversation complete", @@ -18,3 +34,5 @@ const char *azStatus[] = "Talking", "Wrong time to call" }; + +#endif diff --git a/gnu/libexec/uucp/libuucp/strtou.c b/gnu/libexec/uucp/libuucp/strtou.c new file mode 100644 index 000000000000..cd22506da301 --- /dev/null +++ b/gnu/libexec/uucp/libuucp/strtou.c @@ -0,0 +1,21 @@ +/* Copyright (C) 1991 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#define UNSIGNED 1 + +#include "lib/strtol.c" diff --git a/gnu/libexec/uucp/sample/Makefile b/gnu/libexec/uucp/sample/Makefile index c3917289933f..dda3a5939dfe 100644 --- a/gnu/libexec/uucp/sample/Makefile +++ b/gnu/libexec/uucp/sample/Makefile @@ -1,6 +1,8 @@ -# $Id: Makefile,v 1.1 1993/10/14 12:18:29 rgrimes Exp $ +# $Id: Makefile,v 1.2 1994/04/25 16:17:59 jkh Exp $ + +FILES= call.sample config.sample dial.sample dialcode.sample passwd.sample \ + port.sample sys1.sample sys2.sample -FILES= call config dial dialcode passwd port sys1 sys2 NOOBJ= noobj BINOWN= $(owner) diff --git a/gnu/libexec/uucp/sample/call b/gnu/libexec/uucp/sample/call.sample index de4190ce6125..de4190ce6125 100644 --- a/gnu/libexec/uucp/sample/call +++ b/gnu/libexec/uucp/sample/call.sample diff --git a/gnu/libexec/uucp/sample/config b/gnu/libexec/uucp/sample/config.sample index e7d683bb0367..e7d683bb0367 100644 --- a/gnu/libexec/uucp/sample/config +++ b/gnu/libexec/uucp/sample/config.sample diff --git a/gnu/libexec/uucp/sample/dial b/gnu/libexec/uucp/sample/dial.sample index f0d4bdd8aa54..7eb00871b458 100644 --- a/gnu/libexec/uucp/sample/dial +++ b/gnu/libexec/uucp/sample/dial.sample @@ -23,13 +23,17 @@ dialer hayes # 4) send "ATDT", then the telephone number (after translating any # dialcodes). # 5) wait until the modem echoes "CONNECT" -chat "" ATZ\r\d\c OK ATDT\T CONNECT +# 6) Wait a little more, if your modem give CONNECT before carrier up +chat "" ATZ\r\d\c OK ATDT\T CONNECT \p\c # If we get "BUSY" or "NO CARRIER" during the dial chat script we # abort the dial immediately. chat-fail BUSY +chat-fail ERROR +chat-fail NO\sDIALTONE chat-fail NO\sCARRIER # When the call is over, we make sure we hangup the modem. +# You don't need this stuff, if you modem can handle DTR drop properly complete \d\d+++\d\dATH\r\c abort \d\d+++\d\dATH\r\c diff --git a/gnu/libexec/uucp/sample/dialcode b/gnu/libexec/uucp/sample/dialcode.sample index 710a07bf7343..710a07bf7343 100644 --- a/gnu/libexec/uucp/sample/dialcode +++ b/gnu/libexec/uucp/sample/dialcode.sample diff --git a/gnu/libexec/uucp/sample/passwd b/gnu/libexec/uucp/sample/passwd.sample index 2b04e13a3435..2b04e13a3435 100644 --- a/gnu/libexec/uucp/sample/passwd +++ b/gnu/libexec/uucp/sample/passwd.sample diff --git a/gnu/libexec/uucp/sample/port b/gnu/libexec/uucp/sample/port.sample index 8e481869b568..8e481869b568 100644 --- a/gnu/libexec/uucp/sample/port +++ b/gnu/libexec/uucp/sample/port.sample diff --git a/gnu/libexec/uucp/sample/sys1 b/gnu/libexec/uucp/sample/sys1.sample index fa9e7709e1cf..fa9e7709e1cf 100644 --- a/gnu/libexec/uucp/sample/sys1 +++ b/gnu/libexec/uucp/sample/sys1.sample diff --git a/gnu/libexec/uucp/sample/sys2 b/gnu/libexec/uucp/sample/sys2.sample index 856529a500a0..856529a500a0 100644 --- a/gnu/libexec/uucp/sample/sys2 +++ b/gnu/libexec/uucp/sample/sys2.sample diff --git a/gnu/libexec/uucp/tstuu.c b/gnu/libexec/uucp/tstuu.c index ec1066a32e49..3ea3fc435c50 100644 --- a/gnu/libexec/uucp/tstuu.c +++ b/gnu/libexec/uucp/tstuu.c @@ -1,7 +1,7 @@ /* tstuu.c Test the uucp package on a UNIX system. - 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 tstuu_rcsid[] = "$Id: tstuu.c,v 1.1 1993/08/05 18:22:27 conklin Exp $"; +const char tstuu_rcsid[] = "$Id: tstuu.c,v 1.2 1994/05/07 18:08:16 ache Exp $"; #endif #include "sysdep.h" @@ -46,7 +46,9 @@ const char tstuu_rcsid[] = "$Id: tstuu.c,v 1.1 1993/08/05 18:22:27 conklin Exp $ #endif #if HAVE_SELECT +#if HAVE_SYS_TIME_H #include <sys/time.h> +#endif #if HAVE_SYS_SELECT_H #include <sys/select.h> #endif @@ -75,9 +77,11 @@ const char tstuu_rcsid[] = "$Id: tstuu.c,v 1.1 1993/08/05 18:22:27 conklin Exp $ #define O_RDWR 2 #endif -#if HAVE_TIME_H && (HAVE_SYS_TIME_AND_TIME_H || ! HAVE_SELECT) +#if HAVE_TIME_H +#if ! HAVE_SYS_TIME_H || ! HAVE_SELECT || TIME_WITH_SYS_TIME #include <time.h> #endif +#endif #if HAVE_SYS_WAIT_H #include <sys/wait.h> @@ -264,7 +268,7 @@ main (argc, argv) break; default: fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + "Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); fprintf (stderr, "Usage: tstuu [-xn] [-t #] [-u] [-1 cmd] [-2 cmd]\n"); @@ -501,6 +505,9 @@ main (argc, argv) if (close (oslave1) < 0) perror ("close"); + /* This is said to improve the tests on Linux. */ + sleep (3); + if (zDebug != NULL) fprintf (stderr, "About to exec first process\n"); @@ -538,6 +545,9 @@ main (argc, argv) if (close (oslave2) < 0) perror ("close"); + /* This is said to improve the tests on Linux. */ + sleep (5); + if (zDebug != NULL) fprintf (stderr, "About to exec second process\n"); @@ -959,14 +969,13 @@ uprepare_test (fmake, itest, fcall_uucico, zsys) fprintf (e, "port stdin\n"); fprintf (e, "type stdin\n"); - fprintf (e, "pty true\n"); xfclose (e); e = xfopen ("/usr/tmp/tstuu/Call1", "w"); fprintf (e, "Call out password file\n"); - fprintf (e, "%s test1 pass1\n", zsys); + fprintf (e, "%s test1 pass\\s1\n", zsys); xfclose (e); @@ -1035,7 +1044,7 @@ uprepare_test (fmake, itest, fcall_uucico, zsys) e = xfopen ("/usr/tmp/tstuu/Pass2", "w"); fprintf (e, "# Call in password file\n"); - fprintf (e, "test1 pass1\n"); + fprintf (e, "test1 pass\\s1\n"); xfclose (e); } diff --git a/gnu/libexec/uucp/uuchk/Makefile b/gnu/libexec/uucp/uuchk/Makefile index 7081d94e2a22..8757ec68a731 100644 --- a/gnu/libexec/uucp/uuchk/Makefile +++ b/gnu/libexec/uucp/uuchk/Makefile @@ -1,8 +1,10 @@ # Makefile for uuchk -# $Id: Makefile,v 1.1 1993/08/05 18:27:05 conklin Exp $ +# $Id: Makefile,v 1.3 1994/05/31 05:46:20 ache Exp $ BINDIR= $(sbindir) BINOWN= $(owner) +BINGRP= $(group) +BINMODE= 550 PROG= uuchk SRCS= uuchk.c diff --git a/gnu/libexec/uucp/uuchk/uuchk.c b/gnu/libexec/uucp/uuchk/uuchk.c index 5df394aa2f3c..30d84f892ed3 100644 --- a/gnu/libexec/uucp/uuchk/uuchk.c +++ b/gnu/libexec/uucp/uuchk/uuchk.c @@ -1,7 +1,7 @@ /* uuchk.c Display what we think the permissions of systems are. - 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 uuchk_rcsid[] = "$Id: uuchk.c,v 1.1 1993/08/05 18:27:06 conklin Exp $"; +const char uuchk_rcsid[] = "$Id: uuchk.c,v 1.2 1994/05/07 18:13:37 ache Exp $"; #endif #include "getopt.h" @@ -36,6 +36,7 @@ const char uuchk_rcsid[] = "$Id: uuchk.c,v 1.1 1993/08/05 18:27:06 conklin Exp $ /* Local functions. */ static void ukusage P((void)); +static void ukhelp P((void)); static void ukshow P((const struct uuconf_system *qsys, pointer puuconf)); static int ikshow_port P((struct uuconf_port *qport, pointer pinfo)); @@ -44,6 +45,7 @@ static void ukshow_chat P((const struct uuconf_chat *qchat, const char *zhdr)); static void ukshow_size P((struct uuconf_timespan *q, boolean fcall, boolean flocal)); +static void ukshow_reliable P ((int i, const char *zhdr)); static void ukshow_proto_params P((struct uuconf_proto_param *pas, int cindent)); static void ukshow_time P((const struct uuconf_timespan *)); @@ -62,8 +64,18 @@ struct sinfo boolean fgot; }; +/* Program name. */ +static const char *zKprogram; + /* Long getopt options. */ -static const struct option asKlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asKlongopts[] = +{ + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -77,7 +89,9 @@ main (argc, argv) pointer puuconf; char **pzsystems; - while ((iopt = getopt_long (argc, argv, "I:x:", asKlongopts, + zKprogram = argv[0]; + + while ((iopt = getopt_long (argc, argv, "I:vx:", asKlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -92,18 +106,34 @@ main (argc, argv) information for this program. */ break; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zKprogram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + ukhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: ukusage (); - break; + /*NOTREACHED*/ } } if (optind != argc) - ukusage (); + { + fprintf (stderr, "%s: too many arguments", zKprogram); + ukusage (); + } iret = uuconf_init (&puuconf, (const char *) NULL, zconfig); if (iret != UUCONF_SUCCESS) @@ -113,6 +143,12 @@ main (argc, argv) if (iret != UUCONF_SUCCESS) ukuuconf_error (puuconf, iret); + if (*pzsystems == NULL) + { + fprintf (stderr, "%s: no systems found\n", zKprogram); + exit (EXIT_FAILURE); + } + while (*pzsystems != NULL) { struct uuconf_system ssys; @@ -136,18 +172,26 @@ main (argc, argv) /* Print a usage message and die. */ -static void -ukusage () +static void ukusage () { - fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", - VERSION); - fprintf (stderr, - "Usage: uuchk [-I file]\n"); - fprintf (stderr, - " -I file: Set configuration file to use\n"); + fprintf (stderr, "Usage: %s [{-I,--config} file]\n", zKprogram); + fprintf (stderr, "Use %s --help for help\n", zKprogram); exit (EXIT_FAILURE); } + +/* Print a help message. */ + +static void +ukhelp () +{ + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + VERSION); + printf ("Usage: %s [{-I,--config} file] [-v] [--version] [--help]\n", + zKprogram); + printf (" -I,--config file: Set configuration file to use\n"); + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); +} /* Dump out the information for a system. */ @@ -310,6 +354,8 @@ ukshow (qsys, puuconf) iret = uuconf_callout (puuconf, qsys, &zlogin, &zpass); if (iret == UUCONF_NOT_FOUND) printf (" Can not determine login name or password\n"); + else if (UUCONF_ERROR_VALUE (iret) == UUCONF_FOPEN_FAILED) + printf (" Can not read call out file\n"); else if (iret != UUCONF_SUCCESS) ukuuconf_error (puuconf, iret); else @@ -401,7 +447,7 @@ ukshow (qsys, puuconf) if (fcalled) { ukshow_size (qsys->uuconf_qcalled_local_size, FALSE, TRUE); - ukshow_size (qsys->uuconf_qcalled_remote_size, FALSE, TRUE); + ukshow_size (qsys->uuconf_qcalled_remote_size, FALSE, FALSE); } if (fcall) @@ -498,7 +544,9 @@ ikshow_port (qport, pinfo) struct sinfo *qi = (struct sinfo *) pinfo; char **pz; struct uuconf_modem_port *qmodem; + struct uuconf_tcp_port *qtcp; struct uuconf_tli_port *qtli; + struct uuconf_pipe_port *qpipe; qi->fgot = TRUE; @@ -513,13 +561,21 @@ ikshow_port (qport, pinfo) if (qport->uuconf_u.uuconf_sdirect.uuconf_zdevice != NULL) printf (" Device %s\n", qport->uuconf_u.uuconf_sdirect.uuconf_zdevice); + else + printf (" Using port name as device name\n"); printf (" Speed %ld\n", qport->uuconf_u.uuconf_sdirect.uuconf_ibaud); + printf (" Carrier %savailable\n", + qport->uuconf_u.uuconf_sdirect.uuconf_fcarrier ? "" : "not "); + printf (" Hardware flow control %savailable\n", + qport->uuconf_u.uuconf_sdirect.uuconf_fhardflow ? "" : "not "); break; case UUCONF_PORTTYPE_MODEM: qmodem = &qport->uuconf_u.uuconf_smodem; printf (" Port type modem\n"); if (qmodem->uuconf_zdevice != NULL) printf (" Device %s\n", qmodem->uuconf_zdevice); + else + printf (" Using port name as device name\n"); if (qmodem->uuconf_zdial_device != NULL) printf (" Dial device %s\n", qmodem->uuconf_zdial_device); printf (" Speed %ld\n", qmodem->uuconf_ibaud); @@ -528,6 +584,8 @@ ikshow_port (qport, pinfo) qmodem->uuconf_ihighbaud); printf (" Carrier %savailable\n", qmodem->uuconf_fcarrier ? "" : "not "); + printf (" Hardware flow control %savailable\n", + qmodem->uuconf_fhardflow ? "" : "not "); if (qmodem->uuconf_qdialer != NULL) { printf (" Specially defined dialer\n"); @@ -589,9 +647,17 @@ ikshow_port (qport, pinfo) printf (" *** No dialer information\n"); break; case UUCONF_PORTTYPE_TCP: + qtcp = &qport->uuconf_u.uuconf_stcp; printf (" Port type tcp\n"); - printf (" TCP service %s\n", - qport->uuconf_u.uuconf_stcp.uuconf_zport); + printf (" TCP service %s\n", qtcp->uuconf_zport); + if (qtcp->uuconf_pzdialer != NULL + && qtcp->uuconf_pzdialer[0] != NULL) + { + printf (" Dialer sequence"); + for (pz = qtcp->uuconf_pzdialer; *pz != NULL; pz++) + printf (" %s", *pz); + printf ("\n"); + } break; case UUCONF_PORTTYPE_TLI: qtli = &qport->uuconf_u.uuconf_stli; @@ -599,6 +665,8 @@ ikshow_port (qport, pinfo) qtli->uuconf_fstream ? "S" : ""); if (qtli->uuconf_zdevice != NULL) printf (" Device %s\n", qtli->uuconf_zdevice); + else + printf (" Using port name as device name\n"); if (qtli->uuconf_pzpush != NULL) { printf (" Push"); @@ -617,6 +685,17 @@ ikshow_port (qport, pinfo) if (qtli->uuconf_zservaddr != NULL) printf (" Server address %s\n", qtli->uuconf_zservaddr); break; + case UUCONF_PORTTYPE_PIPE: + qpipe = &qport->uuconf_u.uuconf_spipe; + printf (" Port type pipe\n"); + if (qpipe->uuconf_pzcmd != NULL) + { + printf (" Command"); + for (pz = qpipe->uuconf_pzcmd; *pz != NULL; pz++) + printf (" %s", *pz); + printf ("\n"); + } + break; default: fprintf (stderr, " CAN'T HAPPEN\n"); break; @@ -628,6 +707,9 @@ ikshow_port (qport, pinfo) if (qport->uuconf_zlockname != NULL) printf (" Will use lockname %s\n", qport->uuconf_zlockname); + if ((qport->uuconf_ireliable & UUCONF_RELIABLE_SPECIFIED) != 0) + ukshow_reliable (qport->uuconf_ireliable, " "); + if (qport->uuconf_qproto_params != NULL) ukshow_proto_params (qport->uuconf_qproto_params, 3); @@ -656,6 +738,8 @@ ukshow_dialer (q) } ukshow_chat (&q->uuconf_scomplete, " When complete chat"); ukshow_chat (&q->uuconf_sabort, " When aborting chat"); + if ((q->uuconf_ireliable & UUCONF_RELIABLE_SPECIFIED) != 0) + ukshow_reliable (q->uuconf_ireliable, " "); if (q->uuconf_qproto_params != NULL) ukshow_proto_params (q->uuconf_qproto_params, 4); } @@ -744,6 +828,29 @@ ukshow_size (qspan, fcall, flocal) printf (" (At other times may send files of any size)\n"); } +/* Show reliability information. */ + +static void +ukshow_reliable (i, zhdr) + int i; + const char *zhdr; +{ + printf ("%sCharacteristics:", zhdr); + if ((i & UUCONF_RELIABLE_EIGHT) != 0) + printf (" eight-bit-clean"); + else + printf (" not-eight-bit-clean"); + if ((i & UUCONF_RELIABLE_RELIABLE) != 0) + printf (" reliable"); + if ((i & UUCONF_RELIABLE_ENDTOEND) != 0) + printf (" end-to-end"); + if ((i & UUCONF_RELIABLE_FULLDUPLEX) != 0) + printf (" fullduplex"); + else + printf (" halfduplex"); + printf ("\n"); +} + /* Show protocol parameters. */ static void @@ -849,8 +956,8 @@ ukuuconf_error (puuconf, iret) (void) uuconf_error_string (puuconf, iret, ab, sizeof ab); if ((iret & UUCONF_ERROR_FILENAME) == 0) - fprintf (stderr, "uuchk: %s\n", ab); + fprintf (stderr, "%s: %s\n", zKprogram, ab); else - fprintf (stderr, "uuchk:%s\n", ab); + fprintf (stderr, "%s:%s\n", zKprogram, ab); exit (EXIT_FAILURE); } diff --git a/gnu/libexec/uucp/uucico/Makefile b/gnu/libexec/uucp/uucico/Makefile index 6cd270934bbf..f6ba17130d0c 100644 --- a/gnu/libexec/uucp/uucico/Makefile +++ b/gnu/libexec/uucp/uucico/Makefile @@ -1,9 +1,9 @@ # Makefile for uucico -# $Id: Makefile,v 1.2 1993/08/06 23:38:23 rgrimes Exp $ +# $Id: Makefile,v 1.6 1994/05/31 15:55:43 ache Exp $ BINDIR= $(sbindir) BINOWN= $(owner) -BINMODE= 4555 +BINMODE= 4555 PROG= uucico SRCS= uucico.c trans.c send.c rec.c xcmd.c prot.c protg.c protf.c \ @@ -12,7 +12,7 @@ SRCS= uucico.c trans.c send.c rec.c xcmd.c prot.c protg.c protf.c \ LDADD+= $(LIBUNIX) $(LIBUUCONF) $(LIBUUCP) DPADD+= $(LIBUNIX) $(LIBUUCONF) $(LIBUUCP) CFLAGS+= -I$(.CURDIR)/../common_sources\ - -DVERSION=\"$(VERSION)\" + -DVERSION=\"$(VERSION)\" -DOWNER=\"$(owner)\" MAN8= uucico.8 diff --git a/gnu/libexec/uucp/uucico/prote.c b/gnu/libexec/uucp/uucico/prote.c index 9b824651c2f7..c5cb0cf649ad 100644 --- a/gnu/libexec/uucp/uucico/prote.c +++ b/gnu/libexec/uucp/uucico/prote.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 prote_rcsid[] = "$Id: prote.c,v 1.1 1993/08/05 18:27:09 conklin Exp $"; +const char prote_rcsid[] = "$Id: prote.c,v 1.2 1994/05/07 18:13:43 ache Exp $"; #endif #include "uudefs.h" diff --git a/gnu/libexec/uucp/uucico/protf.c b/gnu/libexec/uucp/uucico/protf.c index 96b213157cee..8ba786ea127c 100644 --- a/gnu/libexec/uucp/uucico/protf.c +++ b/gnu/libexec/uucp/uucico/protf.c @@ -1,7 +1,7 @@ /* protf.c The 'f' protocol. - 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 protf_rcsid[] = "$Id: protf.c,v 1.1 1993/08/05 18:27:10 conklin Exp $"; +const char protf_rcsid[] = "$Id: protf.c,v 1.2 1994/05/07 18:13:45 ache Exp $"; #endif #include <ctype.h> @@ -340,6 +340,10 @@ ffprocess_data (qdaemon, pfexit, pcneed) { for (i = iPrecstart; i < CRECBUFLEN && i != iPrecend; i++) { + /* Some systems seem to send characters with parity, so + strip the parity bit. */ + abPrecbuf[i] &= 0x7f; + if (abPrecbuf[i] == '\r') { int istart; @@ -395,7 +399,9 @@ ffprocess_data (qdaemon, pfexit, pcneed) { int b; - b = *zfrom++ & 0xff; + /* Some systems seem to send characters with parity, so + strip the parity bit. */ + b = *zfrom++ & 0x7f; if (b < 040 || b > 0176) { ulog (LOG_ERROR, "Illegal byte %d", b); diff --git a/gnu/libexec/uucp/uucico/protg.c b/gnu/libexec/uucp/uucico/protg.c index 39a79212cf77..0b58197a1da1 100644 --- a/gnu/libexec/uucp/uucico/protg.c +++ b/gnu/libexec/uucp/uucico/protg.c @@ -1,7 +1,7 @@ /* protg.c The 'g' protocol. - 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 protg_rcsid[] = "$Id: protg.c,v 1.1 1993/08/05 18:27:11 conklin Exp $"; +const char protg_rcsid[] = "$Id: protg.c,v 1.2 1994/05/07 18:13:46 ache Exp $"; #endif #include <ctype.h> @@ -346,6 +346,12 @@ static long cGbad_order; received). */ static long cGremote_rejects; +/* Number of duplicate RR packets treated as RJ packets. Some UUCP + packages appear to never send RJ packets, but only RR packets. If + no RJ has been seen, fgprocess_data treats a duplicate RR as an RJ + and increments this variable. */ +static long cGremote_duprrs; + /* The error level. This is the total number of errors as adjusted by cGerror_decay. */ static long cGerror_level; @@ -419,6 +425,7 @@ fgstart (qdaemon, pzlog) cGbad_checksum = 0; cGbad_order = 0; cGremote_rejects = 0; + cGremote_duprrs = 0; cGerror_level = 0; cGexpect_bad_order = 0; @@ -440,6 +447,13 @@ fgstart (qdaemon, pzlog) iseg = 1; } + if (iGrequest_winsize <= 0 || iGrequest_winsize > 7) + { + ulog (LOG_ERROR, "Illegal window size %d for '%c' protocol", + iGrequest_winsize, qdaemon->qproto->bname); + iGrequest_winsize = IWINDOW; + } + fgota = FALSE; fgotb = FALSE; for (i = 0; i < cGstartup_retries; i++) @@ -503,10 +517,14 @@ fgstart (qdaemon, pzlog) if (! fginit_sendbuffers (TRUE)) return FALSE; - *pzlog = zbufalc (sizeof "protocol '' packet size window " + 50); - sprintf (*pzlog, "protocol '%c' packet size %d window %d", + *pzlog = + zbufalc (sizeof "protocol '' sending packet/window / receiving /" + + 64); + sprintf (*pzlog, + "protocol '%c' sending packet/window %d/%d receiving %d/%d", qdaemon->qproto->bname, (int) iGremote_packsize, - (int) iGremote_winsize); + (int) iGremote_winsize, (int) iGrequest_packsize, + (int) iGrequest_winsize); return TRUE; } @@ -528,6 +546,22 @@ fbiggstart (qdaemon, pzlog) fGshort_packets = FALSE; return fgstart (qdaemon, pzlog); } + +/* The 'v' protocol is identical to the 'g' protocol, except that the + packet size defaults to 512 bytes. Rather than really get it + right, we automatically switch from the usual default of 64 to 512. + This won't work correctly if somebody does protocol-parameter v + packet-size 64. */ + +boolean +fvstart (qdaemon, pzlog) + struct sdaemon *qdaemon; + char **pzlog; +{ + if (iGrequest_packsize == IPACKSIZE) + iGrequest_packsize = 1024; + return fgstart (qdaemon, pzlog); +} /* Exchange initialization messages with the other system. @@ -671,10 +705,12 @@ fgshutdown (qdaemon) if (cGbad_hdr != 0 || cGbad_checksum != 0 || cGbad_order != 0 - || cGremote_rejects != 0) + || cGremote_rejects != 0 + || cGremote_duprrs != 0) ulog (LOG_NORMAL, "Errors: header %ld, checksum %ld, order %ld, remote rejects %ld", - cGbad_hdr, cGbad_checksum, cGbad_order, cGremote_rejects); + cGbad_hdr, cGbad_checksum, cGbad_order, + cGremote_duprrs + cGremote_rejects); /* Reset all the parameters to their default values, so that the protocol parameters used for this connection do not affect the @@ -739,7 +775,8 @@ fgsendcmd (qdaemon, z, ilocal, iremote) } memcpy (zpacket, z, clen); - bzero (zpacket + clen, csize - clen); + if (csize > clen) + bzero (zpacket + clen, csize - clen); fagain = FALSE; if (! fgsenddata (qdaemon, zpacket, csize, 0, 0, (long) 0)) @@ -894,7 +931,8 @@ fgsenddata (qdaemon, zdata, cdata, ilocal, iremote, ipos) --zdata; zdata[0] = (char) cshort; zdata[-1] = '\0'; - bzero (zdata + cdata + 1, cshort - 1); + if (cshort > 1) + bzero (zdata + cdata + 1, cshort - 1); } else { @@ -1568,12 +1606,15 @@ fgprocess_data (qdaemon, fdoacks, freturncontrol, pfexit, pcneed, pffound) /* Annoyingly, some UUCP packages appear to send an RR packet rather than an RJ packet when they want a packet to be - resent. If we get a duplicate RR, we treat it as an RJ. */ + resent. If we get a duplicate RR and we've never seen an RJ, + we treat the RR as an RJ. */ fduprr = FALSE; - if (CONTROL_TT (ab[IFRAME_CONTROL]) == CONTROL + if (cGremote_rejects == 0 + && CONTROL_TT (ab[IFRAME_CONTROL]) == CONTROL && CONTROL_XXX (ab[IFRAME_CONTROL]) == RR && iGremote_ack == CONTROL_YYY (ab[IFRAME_CONTROL]) - && INEXTSEQ (iGremote_ack) != iGsendseq) + && INEXTSEQ (iGremote_ack) != iGsendseq + && iGretransmit_seq != -1) { DEBUG_MESSAGE0 (DEBUG_PROTO | DEBUG_ABNORMAL, "fgprocess_data: Treating duplicate RR as RJ"); @@ -1581,11 +1622,12 @@ fgprocess_data (qdaemon, fdoacks, freturncontrol, pfexit, pcneed, pffound) } /* Update the received sequence number from the yyy field of a - data packet or an RR control packet. If we've been delaying - sending packets until we received an ack, this may send out - some packets. */ - if (CONTROL_TT (ab[IFRAME_CONTROL]) != CONTROL - || CONTROL_XXX (ab[IFRAME_CONTROL]) == RR) + data packet (if it is the one we are expecting) or an RR + control packet. If we've been delaying sending packets until + we received an ack, this may send out some packets. */ + if ((CONTROL_TT (ab[IFRAME_CONTROL]) != CONTROL + && CONTROL_XXX (ab[IFRAME_CONTROL]) == INEXTSEQ (iGrecseq)) + || (CONTROL_XXX (ab[IFRAME_CONTROL]) == RR && ! fduprr)) { if (! fggot_ack (qdaemon, CONTROL_YYY (ab[IFRAME_CONTROL]))) return FALSE; @@ -1773,7 +1815,10 @@ fgprocess_data (qdaemon, fdoacks, freturncontrol, pfexit, pcneed, pffound) iGsendseq, iGretransmit_seq); ++cGresent_packets; - ++cGremote_rejects; + if (fduprr) + ++cGremote_duprrs; + else + ++cGremote_rejects; ++cGerror_level; if (! fgcheck_errors (qdaemon)) return FALSE; diff --git a/gnu/libexec/uucp/uucico/proti.c b/gnu/libexec/uucp/uucico/proti.c index d14d42b42db0..fd243de23731 100644 --- a/gnu/libexec/uucp/uucico/proti.c +++ b/gnu/libexec/uucp/uucico/proti.c @@ -1,7 +1,7 @@ /* proti.c The 'i' protocol. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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 proti_rcsid[] = "$Id: proti.c,v 1.1 1993/08/05 18:27:12 conklin Exp $"; +const char proti_rcsid[] = "$Id: proti.c,v 1.2 1994/05/07 18:13:48 ache Exp $"; #endif #include <ctype.h> @@ -153,7 +153,10 @@ const char proti_rcsid[] = "$Id: proti.c,v 1.1 1993/08/05 18:27:12 conklin Exp $ #define IMAXSEQ 32 /* Get the next sequence number given a sequence number. */ -#define INEXTSEQ(i) ((i + 1) & (IMAXSEQ - 1)) +#define INEXTSEQ(i) (((i) + 1) & (IMAXSEQ - 1)) + +/* Get the previous sequence number given a sequence number. */ +#define IPREVSEQ(i) (((i) + IMAXSEQ - 1) & (IMAXSEQ - 1)) /* Compute i1 - i2 in sequence space (i.e., the number of packets from i2 to i1). */ @@ -216,17 +219,14 @@ static int iIremote_packsize; static int iIalc_packsize; /* Forced remote packet size, used if non-zero (protocol parameter - ``remote-packet-size''). */ + ``remote-packet-size''). There is no forced remote window size + because the ACK strategy requires that both sides agree on the + window size. */ static int iIforced_remote_packsize = 0; -/* Remote window size (set from SYNC packet or from - iIforced_remote_winsize). */ +/* Remote window size (set from SYNC packet). */ static int iIremote_winsize; -/* Forced remote window size, used if non-zero (protocol parameter - ``remote-window''). */ -static int iIforced_remote_winsize = 0; - /* Timeout to use when sending the SYNC packet (protocol parameter ``sync-timeout''). */ int cIsync_timeout = CSYNC_TIMEOUT; @@ -251,6 +251,11 @@ static int cIerrors = CERRORS; the error level by one (protocol parameter ``error-decay''). */ static int cIerror_decay = CERROR_DECAY; +/* The number of packets we should wait to receive before sending an + ACK; this is set by default to half the window size we have + requested (protocol parameter ``ack-frequency''). */ +static int cIack_frequency = 0; + /* The set of characters to avoid (protocol parameter ``avoid''). This is actually part of the 'j' protocol; it is defined in this file because the 'i' and 'j' protocols use the same protocol @@ -334,8 +339,6 @@ struct uuconf_cmdtab asIproto_params[] = { "window", UUCONF_CMDTABTYPE_INT, (pointer) &iIrequest_winsize, NULL }, { "remote-packet-size", UUCONF_CMDTABTYPE_INT, (pointer) &iIforced_remote_packsize, NULL }, - { "remote-window", UUCONF_CMDTABTYPE_INT, - (pointer) &iIforced_remote_winsize, NULL }, { "sync-timeout", UUCONF_CMDTABTYPE_INT, (pointer) &cIsync_timeout, NULL }, { "sync-retries", UUCONF_CMDTABTYPE_INT, (pointer) &cIsync_retries, @@ -344,6 +347,7 @@ struct uuconf_cmdtab asIproto_params[] = { "retries", UUCONF_CMDTABTYPE_INT, (pointer) &cIretries, NULL }, { "errors", UUCONF_CMDTABTYPE_INT, (pointer) &cIerrors, NULL }, { "error-decay", UUCONF_CMDTABTYPE_INT, (pointer) &cIerror_decay, NULL }, + { "ack-frequency", UUCONF_CMDTABTYPE_INT, (pointer) &cIack_frequency, NULL }, /* The ``avoid'' protocol parameter is part of the 'j' protocol, but it is convenient for the 'i' and 'j' protocols to share the same protocol parameter table. */ @@ -398,7 +402,7 @@ fijstart (qdaemon, pzlog, imaxpacksize, pfsend, pfreceive) boolean (*pfreceive) P((struct sconnection *qconn, size_t cneed, size_t *pcrec, int ctimeout, boolean freport)); { - char ab[CHDRLEN + 3 + CCKSUMLEN]; + char ab[CHDRLEN + 4 + CCKSUMLEN]; unsigned long icksum; int ctries; int csyncs; @@ -414,10 +418,6 @@ fijstart (qdaemon, pzlog, imaxpacksize, pfsend, pfreceive) else iIremote_packsize = iIforced_remote_packsize; iIalc_packsize = 0; - if (iIforced_remote_winsize <= 0 || iIforced_remote_winsize >= IMAXSEQ) - iIforced_remote_winsize = 0; - else - iIremote_winsize = iIforced_remote_winsize; iIsendseq = 1; iIrecseq = 0; @@ -435,16 +435,41 @@ fijstart (qdaemon, pzlog, imaxpacksize, pfsend, pfreceive) cIbad_cksum = 0; cIremote_rejects = 0; + if (iIrequest_packsize < 0 || iIrequest_packsize > imaxpacksize) + { + ulog (LOG_ERROR, "Illegal protocol '%c' packet size; using %d", + qdaemon->qproto->bname, imaxpacksize); + iIrequest_packsize = imaxpacksize; + } + + /* The maximum permissible window size is 16. Otherwise the + protocol can get confused because a duplicated packet may arrive + out of order. If the window size is large in such a case, the + duplicate packet may be treated as a packet in the upcoming + window, causing the protocol to assume that all intermediate + packets have been lost, leading to immense confusion. */ + if (iIrequest_winsize < 0 || iIrequest_winsize > IMAXSEQ / 2) + { + ulog (LOG_ERROR, "Illegal protocol '%c' window size; using %d", + qdaemon->qproto->bname, IREQUEST_WINSIZE); + iIrequest_winsize = IREQUEST_WINSIZE; + } + + /* The default for the ACK frequency is half the window size. */ + if (cIack_frequency <= 0 || cIack_frequency >= iIrequest_winsize) + cIack_frequency = iIrequest_winsize / 2; + ab[IHDR_INTRO] = IINTRO; ab[IHDR_LOCAL] = ab[IHDR_REMOTE] = IHDRWIN_SET (0, 0); - ab[IHDR_CONTENTS1] = IHDRCON_SET1 (SYNC, qdaemon->fcaller, 3); - ab[IHDR_CONTENTS2] = IHDRCON_SET2 (SYNC, qdaemon->fcaller, 3); + ab[IHDR_CONTENTS1] = IHDRCON_SET1 (SYNC, qdaemon->fcaller, 4); + ab[IHDR_CONTENTS2] = IHDRCON_SET2 (SYNC, qdaemon->fcaller, 4); ab[IHDR_CHECK] = IHDRCHECK_VAL (ab); ab[CHDRLEN + 0] = (iIrequest_packsize >> 8) & 0xff; ab[CHDRLEN + 1] = iIrequest_packsize & 0xff; ab[CHDRLEN + 2] = iIrequest_winsize; - icksum = icrc (ab + CHDRLEN, 3, ICRCINIT); - UCKSUM_SET (ab + CHDRLEN + 3, icksum); + ab[CHDRLEN + 3] = qdaemon->cchans; + icksum = icrc (ab + CHDRLEN, 4, ICRCINIT); + UCKSUM_SET (ab + CHDRLEN + 4, icksum); /* The static cIsyncs is incremented each time a SYNC packet is received. */ @@ -455,11 +480,11 @@ fijstart (qdaemon, pzlog, imaxpacksize, pfsend, pfreceive) { boolean ftimedout; - DEBUG_MESSAGE2 (DEBUG_PROTO, - "fistart: Sending SYNC packsize %d winsize %d", - iIrequest_packsize, iIrequest_winsize); + DEBUG_MESSAGE3 (DEBUG_PROTO, + "fistart: Sending SYNC packsize %d winsize %d channels %d", + iIrequest_packsize, iIrequest_winsize, qdaemon->cchans); - if (! (*pfIsend) (qdaemon->qconn, ab, CHDRLEN + 3 + CCKSUMLEN, + if (! (*pfIsend) (qdaemon->qconn, ab, CHDRLEN + 4 + CCKSUMLEN, TRUE)) return FALSE; @@ -509,11 +534,15 @@ fijstart (qdaemon, pzlog, imaxpacksize, pfsend, pfreceive) if (iseq >= IMAXSEQ) { - *pzlog = zbufalc (sizeof "protocol 'i' packet size %d window %d" - + 50); - sprintf (*pzlog, "protocol '%c' packet size %d window %d", - qdaemon->qproto->bname, iIremote_packsize, - iIremote_winsize); + *pzlog = + zbufalc (sizeof "protocol '' sending packet/window / receiving /" + + 64); + sprintf (*pzlog, + "protocol '%c' sending packet/window %d/%d receiving %d/%d", + qdaemon->qproto->bname, (int) iIremote_packsize, + (int) iIremote_winsize, (int) iIrequest_packsize, + (int) iIrequest_winsize); + iIalc_packsize = iIremote_packsize; return TRUE; @@ -575,13 +604,13 @@ fishutdown (qdaemon) iIrequest_packsize = IREQUEST_PACKSIZE; iIrequest_winsize = IREQUEST_WINSIZE; iIforced_remote_packsize = 0; - iIforced_remote_winsize = 0; cIsync_timeout = CSYNC_TIMEOUT; cIsync_retries = CSYNC_RETRIES; cItimeout = CTIMEOUT; cIretries = CRETRIES; cIerrors = CERRORS; cIerror_decay = CERROR_DECAY; + cIack_frequency = 0; zJavoid_parameter = ZAVOID; return TRUE; @@ -835,8 +864,9 @@ fisenddata (qdaemon, zdata, cdata, ilocal, iremote, ipos) iIlocal_ack = iIrecseq; zhdr[IHDR_CHECK] = IHDRCHECK_VAL (zhdr); - DEBUG_MESSAGE2 (DEBUG_PROTO, "fisenddata: Sending packet %d (%d bytes)", - iIsendseq, (int) cdata); + DEBUG_MESSAGE4 (DEBUG_PROTO, + "fisenddata: Sending packet %d size %d local %d remote %d", + iIsendseq, (int) cdata, ilocal, iremote); iIsendseq = INEXTSEQ (iIsendseq); ++cIsent_packets; @@ -977,6 +1007,8 @@ ficheck_errors (qdaemon) char absync[CHDRLEN + 3 + CCKSUMLEN]; unsigned long icksum; + /* Don't bother sending the number of channels in this + packet. */ iIrequest_packsize /= 2; absync[IHDR_INTRO] = IINTRO; absync[IHDR_LOCAL] = IHDRWIN_SET (0, 0); @@ -1127,9 +1159,9 @@ fiprocess_data (qdaemon, pfexit, pffound, pcneed) if (iIrequest_winsize > 0 && CSEQDIFF (iseq, iIlocal_ack) > iIrequest_winsize) { - DEBUG_MESSAGE1 (DEBUG_PROTO | DEBUG_ABNORMAL, - "fiprocess_data: Out of order packet %d", - iseq); + DEBUG_MESSAGE2 (DEBUG_PROTO | DEBUG_ABNORMAL, + "fiprocess_data: Out of order packet %d (ack %d)", + iseq, iIlocal_ack); ++cIbad_order; if (! ficheck_errors (qdaemon)) @@ -1253,7 +1285,27 @@ fiprocess_data (qdaemon, pfexit, pffound, pcneed) if (iseq != -1) { - afInaked[iseq] = FALSE; + /* If we already sent a NAK for this packet, and we have not + seen the previous packet, then forget that we sent a NAK + for this and any preceding packets. This is to handle + the following sequence: + receive packet 0 + packets 1 and 2 lost + receive packet 3 + send NAK 1 + send NAK 2 + packet 1 lost + receive packet 2 + At this point we want to send NAK 1. */ + if (afInaked[iseq] + && azIrecbuffers[IPREVSEQ (iseq)] == NULL) + { + for (i = INEXTSEQ (iIrecseq); + i != iseq; + i = INEXTSEQ (i)) + afInaked[i] = FALSE; + afInaked[iseq] = FALSE; + } /* If we haven't handled all previous packets, we must save off this packet and deal with it later. */ @@ -1263,16 +1315,16 @@ fiprocess_data (qdaemon, pfexit, pffound, pcneed) || (iIrequest_winsize > 0 && CSEQDIFF (iseq, iIrecseq) > iIrequest_winsize)) { - DEBUG_MESSAGE1 (DEBUG_PROTO | DEBUG_ABNORMAL, - "fiprocess_data: Ignoring out of order packet %d", - iseq); + DEBUG_MESSAGE2 (DEBUG_PROTO | DEBUG_ABNORMAL, + "fiprocess_data: Ignoring out of order packet %d (recseq %d)", + iseq, iIrecseq); continue; } else { - DEBUG_MESSAGE1 (DEBUG_PROTO | DEBUG_ABNORMAL, - "fiprocess_data: Saving unexpected packet %d", - iseq); + DEBUG_MESSAGE2 (DEBUG_PROTO | DEBUG_ABNORMAL, + "fiprocess_data: Saving unexpected packet %d (recseq %d)", + iseq, iIrecseq); if (azIrecbuffers[iseq] == NULL) { @@ -1352,7 +1404,7 @@ fiprocess_data (qdaemon, pfexit, pffound, pcneed) However, it can happen if we receive a burst of short packets, such as a set of command acknowledgements. */ if (iIrequest_winsize > 0 - && CSEQDIFF (iIrecseq, iIlocal_ack) >= iIrequest_winsize / 2) + && CSEQDIFF (iIrecseq, iIlocal_ack) >= cIack_frequency) { char aback[CHDRLEN]; @@ -1401,9 +1453,11 @@ fiprocess_packet (qdaemon, zhdr, zfirst, cfirst, zsecond, csecond, pfexit) boolean fret; iseq = IHDRWIN_GETSEQ (zhdr[IHDR_LOCAL]); - DEBUG_MESSAGE2 (DEBUG_PROTO, - "fiprocess_packet: Got DATA packet %d size %d", - iseq, cfirst + csecond); + DEBUG_MESSAGE4 (DEBUG_PROTO, + "fiprocess_packet: Got DATA packet %d size %d local %d remote %d", + iseq, cfirst + csecond, + IHDRWIN_GETCHAN (zhdr[IHDR_REMOTE]), + IHDRWIN_GETCHAN (zhdr[IHDR_LOCAL])); fret = fgot_data (qdaemon, zfirst, (size_t) cfirst, zsecond, (size_t) csecond, IHDRWIN_GETCHAN (zhdr[IHDR_REMOTE]), @@ -1417,7 +1471,7 @@ fiprocess_packet (qdaemon, zhdr, zfirst, cfirst, zsecond, csecond, pfexit) case SYNC: { - int ipack, iwin; + int ipack, iwin, cchans; /* We accept a SYNC packet to adjust the packet and window sizes at any time. */ @@ -1436,16 +1490,31 @@ fiprocess_packet (qdaemon, zhdr, zfirst, cfirst, zsecond, csecond, pfexit) else iwin = zsecond[2 - cfirst]; - DEBUG_MESSAGE2 (DEBUG_PROTO, - "fiprocess_packet: Got SYNC packsize %d winsize %d", - ipack, iwin); + /* The fourth byte in a SYNC packet is the number of channels + to use. This is optional. Switching the number of + channels in the middle of a conversation may cause + problems. */ + if (cfirst + csecond <= 3) + cchans = 0; + else + { + if (cfirst > 3) + cchans = zfirst[3]; + else + cchans = zsecond[3 - cfirst]; + if (cchans > 0 && cchans < 8) + qdaemon->cchans = cchans; + } + + DEBUG_MESSAGE3 (DEBUG_PROTO, + "fiprocess_packet: Got SYNC packsize %d winsize %d channels %d", + ipack, iwin, cchans); if (iIforced_remote_packsize == 0 && (iIalc_packsize == 0 || ipack <= iIalc_packsize)) iIremote_packsize = ipack; - if (iIforced_remote_winsize == 0) - iIremote_winsize = iwin; + iIremote_winsize = iwin; /* We increment a static variable to tell the initialization code that a SYNC was received, and we set *pfexit to TRUE @@ -1477,44 +1546,68 @@ fiprocess_packet (qdaemon, zhdr, zfirst, cfirst, zsecond, csecond, pfexit) iseq = IHDRWIN_GETSEQ (zhdr[IHDR_LOCAL]); - /* The timeout code will send a NAK for the packet the remote - side wants. So we may see a NAK here for the packet we are - about to send. */ - if (iseq == iIsendseq - || (iIremote_winsize > 0 - && (CSEQDIFF (iseq, iIremote_ack) > iIremote_winsize - || CSEQDIFF (iIsendseq, iseq) > iIremote_winsize))) + /* If the remote side times out while waiting for a packet, it + will send a NAK for the next packet it wants to see. If we + have not sent that packet yet, and we have no + unacknowledged data, it implies that the remote side has a + window full of data to send, which implies that our ACK has + been lost. Therefore, we send an ACK. */ + if (iseq == iIsendseq && + INEXTSEQ (iIremote_ack) == iIsendseq) { - DEBUG_MESSAGE1 (DEBUG_PROTO | DEBUG_ABNORMAL, - "fiprocess_packet: Ignoring out of order NAK %d", - iseq); - return TRUE; - } + char aback[CHDRLEN]; + + aback[IHDR_INTRO] = IINTRO; + aback[IHDR_LOCAL] = IHDRWIN_SET (0, 0); + aback[IHDR_REMOTE] = IHDRWIN_SET (iIrecseq, 0); + iIlocal_ack = iIrecseq; + aback[IHDR_CONTENTS1] = IHDRCON_SET1 (ACK, qdaemon->fcaller, 0); + aback[IHDR_CONTENTS2] = IHDRCON_SET2 (ACK, qdaemon->fcaller, 0); + aback[IHDR_CHECK] = IHDRCHECK_VAL (aback); - DEBUG_MESSAGE1 (DEBUG_PROTO | DEBUG_ABNORMAL, - "fiprocess_packet: Got NAK %d; resending packet", - iseq); + DEBUG_MESSAGE1 (DEBUG_PROTO, "fiprocess_packet: Sending ACK %d", + iIrecseq); - /* Update the received sequence number. */ - zsend = azIsendbuffers[iseq] + CHDROFFSET; - if (IHDRWIN_GETSEQ (zsend[IHDR_REMOTE]) != iIrecseq) + return (*pfIsend) (qdaemon->qconn, aback, CHDRLEN, TRUE); + } + else { - int iremote; + if (iseq == iIsendseq + || (iIremote_winsize > 0 + && (CSEQDIFF (iseq, iIremote_ack) > iIremote_winsize + || CSEQDIFF (iIsendseq, iseq) > iIremote_winsize))) + { + DEBUG_MESSAGE2 (DEBUG_PROTO | DEBUG_ABNORMAL, + "fiprocess_packet: Ignoring out of order NAK %d (sendseq %d)", + iseq, iIsendseq); + return TRUE; + } - iremote = IHDRWIN_GETCHAN (zsend[IHDR_REMOTE]); - zsend[IHDR_REMOTE] = IHDRWIN_SET (iIrecseq, iremote); - zsend[IHDR_CHECK] = IHDRCHECK_VAL (zsend); - iIlocal_ack = iIrecseq; - } + DEBUG_MESSAGE1 (DEBUG_PROTO | DEBUG_ABNORMAL, + "fiprocess_packet: Got NAK %d; resending packet", + iseq); + + /* Update the received sequence number. */ + zsend = azIsendbuffers[iseq] + CHDROFFSET; + if (IHDRWIN_GETSEQ (zsend[IHDR_REMOTE]) != iIrecseq) + { + int iremote; + + iremote = IHDRWIN_GETCHAN (zsend[IHDR_REMOTE]); + zsend[IHDR_REMOTE] = IHDRWIN_SET (iIrecseq, iremote); + zsend[IHDR_CHECK] = IHDRCHECK_VAL (zsend); + iIlocal_ack = iIrecseq; + } - ++cIresent_packets; + ++cIresent_packets; - clen = CHDRCON_GETBYTES (zsend[IHDR_CONTENTS1], - zsend[IHDR_CONTENTS2]); + clen = CHDRCON_GETBYTES (zsend[IHDR_CONTENTS1], + zsend[IHDR_CONTENTS2]); - return (*pfIsend) (qdaemon->qconn, zsend, - CHDRLEN + clen + (clen > 0 ? CCKSUMLEN : 0), - TRUE); + return (*pfIsend) (qdaemon->qconn, zsend, + CHDRLEN + clen + (clen > 0 ? CCKSUMLEN : 0), + TRUE); + } } case SPOS: diff --git a/gnu/libexec/uucp/uucico/protj.c b/gnu/libexec/uucp/uucico/protj.c index 5717bb916dfb..e61b499f1c73 100644 --- a/gnu/libexec/uucp/uucico/protj.c +++ b/gnu/libexec/uucp/uucico/protj.c @@ -1,7 +1,7 @@ /* protj.c The 'j' protocol. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 1992, 1994 Ian Lance Taylor This file is part of the Taylor UUCP package. @@ -20,19 +20,20 @@ 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 protj_rcsid[] = "$Id: protj.c,v 1.1 1993/08/05 18:27:14 conklin Exp $"; +const char protj_rcsid[] = "$Id: protj.c,v 1.2 1994/05/07 18:13:50 ache Exp $"; #endif #include <ctype.h> #include <errno.h> #include "uudefs.h" +#include "uuconf.h" #include "conn.h" #include "trans.h" #include "system.h" diff --git a/gnu/libexec/uucp/uucico/prott.c b/gnu/libexec/uucp/uucico/prott.c index 44763958349a..bbbd7616eed6 100644 --- a/gnu/libexec/uucp/uucico/prott.c +++ b/gnu/libexec/uucp/uucico/prott.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 prott_rcsid[] = "$Id: prott.c,v 1.1 1993/08/05 18:27:15 conklin Exp $"; +const char prott_rcsid[] = "$Id: prott.c,v 1.2 1994/05/07 18:13:51 ache Exp $"; #endif #include "uudefs.h" @@ -133,7 +133,8 @@ ftsendcmd (qdaemon, z, ilocal, iremote) zalc = zbufalc (csend); memcpy (zalc, z, clen); - bzero (zalc + clen, csend - clen); + if (csend > clen) + bzero (zalc + clen, csend - clen); fret = fsend_data (qdaemon->qconn, zalc, csend, TRUE); ubuffree (zalc); diff --git a/gnu/libexec/uucp/uucico/protz.c b/gnu/libexec/uucp/uucico/protz.c index 6510df7d798e..c99ea8fb8d91 100644 --- a/gnu/libexec/uucp/uucico/protz.c +++ b/gnu/libexec/uucp/uucico/protz.c @@ -181,7 +181,7 @@ #include "uucp.h" #if USE_RCS_ID -const char protz_rcsid[] = "$Id: protz.c,v 1.1 1993/08/05 18:27:16 conklin Exp $"; +const char protz_rcsid[] = "$Id: protz.c,v 1.2 1994/05/07 18:13:52 ache Exp $"; #endif #include <errno.h> @@ -2084,7 +2084,7 @@ fifi: cZheaders_received++; break; } - DEBUG_MESSAGE2 (DEBUG_PROTO, "izrecv_hdr: %s, data = 0x%x", + DEBUG_MESSAGE2 (DEBUG_PROTO, "izrecv_hdr: %s, data = 0x%lx", ZZHEADER_NAME(c), rclhdr (hdr)); return c; diff --git a/gnu/libexec/uucp/uucico/rec.c b/gnu/libexec/uucp/uucico/rec.c index b55d7f2c401f..c85647d56787 100644 --- a/gnu/libexec/uucp/uucico/rec.c +++ b/gnu/libexec/uucp/uucico/rec.c @@ -1,7 +1,7 @@ /* rec.c Routines to receive a 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,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 rec_rcsid[] = "$Id: rec.c,v 1.1 1993/08/05 18:27:18 conklin Exp $"; +const char rec_rcsid[] = "$Id: rec.c,v 1.2 1994/05/07 18:13:55 ache Exp $"; #endif #include <errno.h> @@ -308,13 +308,22 @@ flocal_rec_send_request (qtrans, qdaemon) boolean fret; qinfo->ztemp = zsysdep_receive_temp (qdaemon->qsys, qinfo->zfile, - (const char *) NULL); + (const char *) NULL, + (qdaemon->qproto->frestart + && (qdaemon->ifeatures + & FEATURE_RESTART) != 0)); if (qinfo->ztemp == NULL) { urrec_free (qtrans); return FALSE; } + qtrans->fcmd = TRUE; + qtrans->precfn = flocal_rec_await_reply; + + if (! fqueue_receive (qdaemon, qtrans)) + return FALSE; + /* Check the amount of free space available for both the temporary file and the real file. */ cbytes = csysdep_bytes_free (qinfo->ztemp); @@ -354,16 +363,11 @@ flocal_rec_send_request (qtrans, qdaemon) fret = (*qdaemon->qproto->pfsendcmd) (qdaemon, zsend, qtrans->ilocal, qtrans->iremote); ubuffree (zsend); - if (! fret) - { - urrec_free (qtrans); - return FALSE; - } - qtrans->fcmd = TRUE; - qtrans->precfn = flocal_rec_await_reply; + if (! fret) + urrec_free (qtrans); - return fqueue_receive (qdaemon, qtrans); + return fret; } /* This is called when a reply is received for the request. */ @@ -377,8 +381,8 @@ flocal_rec_await_reply (qtrans, qdaemon, zdata, cdata) size_t cdata; { struct srecinfo *qinfo = (struct srecinfo *) qtrans->pinfo; - long crestart; const char *zlog; + char *zend; if (zdata[0] != 'R' || (zdata[1] != 'Y' && zdata[1] != 'N')) @@ -407,6 +411,18 @@ flocal_rec_await_reply (qtrans, qdaemon, zdata, cdata) zerr = "too large to receive now"; fnever = FALSE; } + else if (zdata[2] == '9') + { + /* Remote has run out of channels. */ + zerr = "too many channels for remote"; + fnever = FALSE; + + /* Drop one channel; using exactly one channel causes + slightly different behahaviour in a few places, so don't + decrement to one. */ + if (qdaemon->cchans > 2) + --qdaemon->cchans; + } else zerr = "unknown reason"; @@ -423,16 +439,25 @@ flocal_rec_await_reply (qtrans, qdaemon, zdata, cdata) /* The mode should have been sent as "RY 0%o". If it wasn't, we use 0666. */ qtrans->s.imode = (unsigned int) strtol ((char *) (zdata + 2), - (char **) NULL, 8); + &zend, 8); if (qtrans->s.imode == 0) qtrans->s.imode = 0666; + /* If there is an M after the mode, the remote has requested a + hangup. */ + if (*zend == 'M' && qdaemon->fmaster) + { + DEBUG_MESSAGE0 (DEBUG_UUCP_PROTO, + "flocal_rec_await_reply: Remote has requested transfer of control"); + qdaemon->fhangup_requested = TRUE; + } + /* Open the file to receive into. We just ignore any restart count, since we have no way to tell it to the other side. SVR4 may have some way to do this, but I don't know what it is. */ qtrans->e = esysdep_open_receive (qdaemon->qsys, qinfo->zfile, (const char *) NULL, qinfo->ztemp, - &crestart); + (long *) NULL); if (! ffileisopen (qtrans->e)) return flocal_rec_fail (qtrans, &qtrans->s, qdaemon->qsys, "cannot open file"); @@ -570,7 +595,15 @@ fremote_send_file_init (qdaemon, qcmd, iremote) } else { - zfile = zsysdep_local_file (qcmd->zto, qsys->uuconf_zpubdir); + boolean fbadname; + + zfile = zsysdep_local_file (qcmd->zto, qsys->uuconf_zpubdir, + &fbadname); + if (zfile == NULL && fbadname) + { + ulog (LOG_ERROR, "%s: bad local file name", qcmd->zto); + return fremote_send_fail (qdaemon, qcmd, FAILURE_PERM, iremote); + } if (zfile != NULL) { char *zadd; @@ -603,7 +636,10 @@ fremote_send_file_init (qdaemon, qcmd, iremote) } } - ztemp = zsysdep_receive_temp (qsys, zfile, qcmd->ztemp); + ztemp = zsysdep_receive_temp (qsys, zfile, qcmd->ztemp, + (qdaemon->qproto->frestart + && (qdaemon->ifeatures + & FEATURE_RESTART) != 0)); /* Adjust the number of bytes we are prepared to receive according to the amount of free space we are supposed to leave available @@ -646,7 +682,13 @@ fremote_send_file_init (qdaemon, qcmd, iremote) /* Open the file to receive into. This may find an old copy of the file, which will be used for file restart if the other side supports it. */ - e = esysdep_open_receive (qsys, zfile, qcmd->ztemp, ztemp, &crestart); + crestart = -1; + e = esysdep_open_receive (qsys, zfile, qcmd->ztemp, ztemp, + ((qdaemon->qproto->frestart + && (qdaemon->ifeatures + & FEATURE_RESTART) != 0) + ? &crestart + : (long *) NULL)); if (! ffileisopen (e)) { ubuffree (ztemp); @@ -656,21 +698,16 @@ fremote_send_file_init (qdaemon, qcmd, iremote) if (crestart > 0) { - if ((qdaemon->ifeatures & FEATURE_RESTART) == 0) - crestart = -1; - else + DEBUG_MESSAGE1 (DEBUG_UUCP_PROTO, + "fremote_send_file_init: Restarting receive from %ld", + crestart); + if (! ffileseek (e, crestart)) { - DEBUG_MESSAGE1 (DEBUG_UUCP_PROTO, - "fremote_send_file_init: Restarting receive from %ld", - crestart); - if (! ffileseek (e, crestart)) - { - ulog (LOG_ERROR, "seek: %s", strerror (errno)); - (void) ffileclose (e); - ubuffree (ztemp); - ubuffree (zfile); - return FALSE; - } + ulog (LOG_ERROR, "seek: %s", strerror (errno)); + (void) ffileclose (e); + ubuffree (ztemp); + ubuffree (zfile); + return FALSE; } } @@ -705,8 +742,24 @@ fremote_send_file_init (qdaemon, qcmd, iremote) else zlog = qinfo->zfile; } - qtrans->zlog = zbufalc (sizeof "Receiving " + strlen (zlog)); + qtrans->zlog = zbufalc (sizeof "Receiving ( bytes resume at )" + + strlen (zlog) + 50); sprintf (qtrans->zlog, "Receiving %s", zlog); + if (crestart > 0 || qcmd->cbytes > 0) + { + strcat (qtrans->zlog, " ("); + if (qcmd->cbytes > 0) + { + sprintf (qtrans->zlog + strlen (qtrans->zlog), "%ld bytes", + qcmd->cbytes); + if (crestart > 0) + strcat (qtrans->zlog, " "); + } + if (crestart > 0) + sprintf (qtrans->zlog + strlen (qtrans->zlog), "resume at %ld", + crestart); + strcat (qtrans->zlog, ")"); + } return fqueue_remote (qdaemon, qtrans); } @@ -719,8 +772,20 @@ fremote_send_reply (qtrans, qdaemon) struct sdaemon *qdaemon; { struct srecinfo *qinfo = (struct srecinfo *) qtrans->pinfo; + boolean fret; char ab[50]; + /* If the file has been completely received, we just want to send + the final confirmation. Otherwise, we must wait for the file + first. */ + qtrans->psendfn = frec_file_send_confirm; + if (qinfo->freceived) + fret = fqueue_send (qdaemon, qtrans); + else + fret = fqueue_receive (qdaemon, qtrans); + if (! fret) + return FALSE; + ab[0] = qtrans->s.bcmd; ab[1] = 'Y'; if (qtrans->ipos <= 0) @@ -751,18 +816,9 @@ fremote_send_reply (qtrans, qdaemon) urrec_free (qtrans); return FALSE; } - if (fhandled) - return TRUE; } - /* If the file has been completely received, we just want to send - the final confirmation. Otherwise, we must wait for the file - first. */ - qtrans->psendfn = frec_file_send_confirm; - if (qinfo->freceived) - return fqueue_send (qdaemon, qtrans); - else - return fqueue_receive (qdaemon, qtrans); + return TRUE; } /* If we can't receive a file, queue up a response to the remote @@ -784,7 +840,7 @@ fremote_send_fail (qdaemon, qcmd, twhy, iremote) /* If the protocol does not support multiple channels (cchans <= 1), then we have essentially already received the entire file. */ - qinfo->freceived = qdaemon->qproto->cchans <= 1; + qinfo->freceived = qdaemon->cchans <= 1; qtrans = qtransalc (qcmd); qtrans->psendfn = fremote_send_fail_send; @@ -807,6 +863,13 @@ fremote_send_fail_send (qtrans, qdaemon) char ab[4]; boolean fret; + /* Wait for the end of file marker if we haven't gotten it yet. */ + if (! qinfo->freceived) + { + if (! fqueue_receive (qdaemon, qtrans)) + return FALSE; + } + ab[0] = qtrans->s.bcmd; ab[1] = 'N'; @@ -840,13 +903,7 @@ fremote_send_fail_send (qtrans, qdaemon) qinfo->fsent = TRUE; - /* Wait for the end of file marker if we haven't gotten it yet. */ - if (! qinfo->freceived) - { - if (! fqueue_receive (qdaemon, qtrans)) - fret = FALSE; - } - else + if (qinfo->freceived) { xfree (qtrans->pinfo); utransfree (qtrans); @@ -902,6 +959,7 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) size_t cdata; { struct srecinfo *qinfo = (struct srecinfo *) qtrans->pinfo; + char *zalc; const char *zerr; boolean fnever; @@ -929,10 +987,13 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) fnever = FALSE; + zalc = NULL; + if (! ffileclose (qtrans->e)) { zerr = strerror (errno); ulog (LOG_ERROR, "%s: close: %s", qtrans->s.zto, zerr); + (void) remove (qinfo->ztemp); } else if (! fsysdep_move_file (qinfo->ztemp, qinfo->zfile, qinfo->fspool, FALSE, ! qinfo->fspool, @@ -940,7 +1001,49 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) ? qtrans->s.zuser : (const char *) NULL))) { - zerr = "could not move to final location"; + long cspace; + + /* Keep the temporary file if there is 1.5 times the amount of + required free space. This is just a random guess, to make an + unusual situtation potentially less painful. */ + cspace = csysdep_bytes_free (qinfo->ztemp); + if (cspace == -1) + cspace = FREE_SPACE_DELTA; + cspace -= (qdaemon->qsys->uuconf_cfree_space + + qdaemon->qsys->uuconf_cfree_space / 2); + if (cspace < 0) + { + (void) remove (qinfo->ztemp); + zerr = "could not move to final location"; + } + else + { + const char *az[20]; + int i; + + zalc = zbufalc (sizeof "could not move to final location (left as )" + + strlen (qinfo->ztemp)); + sprintf (zalc, "could not move to final location (left as %s)", + qinfo->ztemp); + zerr = zalc; + + i = 0; + az[i++] = "The file\n\t"; + az[i++] = qinfo->ztemp; + az[i++] = + "\nwas saved because the move to the final location failed.\n"; + az[i++] = "See the UUCP logs for more details.\n"; + az[i++] = "The file transfer was from\n\t"; + az[i++] = qdaemon->qsys->uuconf_zname; + az[i++] = "!"; + az[i++] = qtrans->s.zfrom; + az[i++] = "\nto\n\t"; + az[i++] = qtrans->s.zto; + az[i++] = "\nand was requested by\n\t"; + az[i++] = qtrans->s.zuser; + az[i++] = "\n"; + (void) fsysdep_mail (OWNER, "UUCP temporary file saved", i, az); + } ulog (LOG_ERROR, "%s: %s", qinfo->zfile, zerr); fnever = TRUE; } @@ -963,12 +1066,10 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) zerr = NULL; } - if (zerr != NULL) - (void) remove (qinfo->ztemp); - ustats (zerr == NULL, qtrans->s.zuser, qdaemon->qsys->uuconf_zname, FALSE, qtrans->cbytes, qtrans->isecs, qtrans->imicros, qdaemon->fmaster); + qdaemon->creceived += qtrans->cbytes; if (zerr == NULL) { @@ -1011,6 +1112,8 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) } } + ubuffree (zalc); + /* If this is an execution request, we must create the execution file itself. */ if (qtrans->s.bcmd == 'E' && zerr == NULL) @@ -1040,7 +1143,10 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) uuxqt might pick up the file before we have finished writing it. */ e = NULL; - ztemp = zsysdep_receive_temp (qdaemon->qsys, zxqtfile, "D.0"); + ztemp = zsysdep_receive_temp (qdaemon->qsys, zxqtfile, "D.0", + (qdaemon->qproto->frestart + && (qdaemon->ifeatures + & FEATURE_RESTART) != 0)); if (ztemp != NULL) e = esysdep_fopen (ztemp, FALSE, FALSE, TRUE); @@ -1077,7 +1183,10 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) { if (! fsysdep_move_file (ztemp, zxqtfile, TRUE, FALSE, FALSE, (const char *) NULL)) - fbad = TRUE; + { + (void) remove (ztemp); + fbad = TRUE; + } } ubuffree (zxqtfile); @@ -1090,6 +1199,21 @@ frec_file_end (qtrans, qdaemon, zdata, cdata) } } + /* See if we should spawn a uuxqt process. */ + if (zerr == NULL + && (qtrans->s.bcmd == 'E' + || (qinfo->fspool && qtrans->s.zto[0] == 'X'))) + { + ++qdaemon->cxfiles_received; + if (qdaemon->irunuuxqt > 0 + && qdaemon->cxfiles_received >= qdaemon->irunuuxqt) + { + if (fspawn_uuxqt (TRUE, qdaemon->qsys->uuconf_zname, + qdaemon->zconfig)) + qdaemon->cxfiles_received = 0; + } + } + /* Prepare to send the completion string to the remote system. If we have not yet replied to the remote send request, we leave the transfer structure on the remote queue. Otherwise we add it to diff --git a/gnu/libexec/uucp/uucico/send.c b/gnu/libexec/uucp/uucico/send.c index 8e2c55ef3724..60c3924ec694 100644 --- a/gnu/libexec/uucp/uucico/send.c +++ b/gnu/libexec/uucp/uucico/send.c @@ -1,7 +1,7 @@ /* send.c Routines to send a 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,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 send_rcsid[] = "$Id: send.c,v 1.1 1993/08/05 18:27:19 conklin Exp $"; +const char send_rcsid[] = "$Id: send.c,v 1.2 1994/05/07 18:13:57 ache Exp $"; #endif #include <errno.h> @@ -51,7 +51,9 @@ struct ssendinfo boolean flocal; /* TRUE if this is a spool directory file. */ boolean fspool; - /* TRUE if the file has been completely sent. */ + /* TRUE if the file has been completely sent. Also used in + flocal_send_cancelled to mean that the file send will never + succeed. */ boolean fsent; /* Execution file for sending an unsupported E request. */ char *zexec; @@ -62,7 +64,7 @@ struct ssendinfo static void usfree_send P((struct stransfer *qtrans)); static boolean flocal_send_fail P((struct stransfer *qtrans, struct scmd *qcmd, - const struct uuconf_system *qsys, + struct sdaemon *qdaemon, const char *zwhy)); static boolean flocal_send_request P((struct stransfer *qtrans, struct sdaemon *qdaemon)); @@ -150,10 +152,9 @@ usfree_send (qtrans) flocal_send_request. If flocal_send_await_reply is called before the entire file has - been sent: if it gets an SN, it calls flocal_send_cancelled to send - an empty data block to inform the remote system that the file - transfer has stopped. If it gets a file position request, it must - adjust the file position accordingly. + been sent: if it gets an SN, it sets the file position to the end + and arranges to call flocal_send_cancelled. If it gets a file + position request, it must adjust the file position accordingly. If flocal_send_await_reply is called after the entire file has been sent: if it gets an SN, it can simply delete the request. It can @@ -197,7 +198,7 @@ flocal_send_file_init (qdaemon, qcmd) is possible, but it might have changed since then. */ if (! qsys->uuconf_fcall_transfer && ! qsys->uuconf_fcalled_transfer) - return flocal_send_fail ((struct stransfer *) NULL, qcmd, qsys, + return flocal_send_fail ((struct stransfer *) NULL, qcmd, qdaemon, "not permitted to transfer files"); /* We can't do the request now, but it may get done later. */ @@ -214,7 +215,7 @@ flocal_send_file_init (qdaemon, qcmd) qsys->uuconf_pzlocal_send, qsys->uuconf_zpubdir, TRUE, TRUE, qcmd->zuser)) - return flocal_send_fail ((struct stransfer *) NULL, qcmd, qsys, + return flocal_send_fail ((struct stransfer *) NULL, qcmd, qdaemon, "not permitted to send"); zfile = zbufcpy (qcmd->zfrom); } @@ -234,12 +235,13 @@ flocal_send_file_init (qdaemon, qcmd) { ubuffree (zfile); if (cbytes != -1) - return FALSE; + return flocal_send_fail ((struct stransfer *) NULL, qcmd, qdaemon, + "can not get size"); /* A cbytes value of -1 means that the file does not exist. This can happen legitimately if it has already been sent from the spool directory. */ if (! fspool) - return flocal_send_fail ((struct stransfer *) NULL, qcmd, qsys, + return flocal_send_fail ((struct stransfer *) NULL, qcmd, qdaemon, "does not exist"); (void) fsysdep_did_work (qcmd->pseq); return TRUE; @@ -264,7 +266,7 @@ flocal_send_file_init (qdaemon, qcmd) if (qdaemon->cmax_ever != -1 && qdaemon->cmax_ever < qcmd->cbytes) - return flocal_send_fail ((struct stransfer *) NULL, qcmd, qsys, + return flocal_send_fail ((struct stransfer *) NULL, qcmd, qdaemon, "too large to send"); return TRUE; @@ -280,7 +282,7 @@ flocal_send_file_init (qdaemon, qcmd) qinfo->zmail = zbufcpy (qcmd->zuser); qinfo->zfile = zfile; qinfo->cbytes = cbytes; - qinfo->flocal = TRUE; + qinfo->flocal = strchr (qcmd->zuser, '!') == NULL; qinfo->fspool = fspool; qinfo->fsent = FALSE; qinfo->zexec = NULL; @@ -296,32 +298,48 @@ flocal_send_file_init (qdaemon, qcmd) this reports an error to the log file and to the user. */ static boolean -flocal_send_fail (qtrans, qcmd, qsys, zwhy) +flocal_send_fail (qtrans, qcmd, qdaemon, zwhy) struct stransfer *qtrans; struct scmd *qcmd; - const struct uuconf_system *qsys; + struct sdaemon *qdaemon; const char *zwhy; { if (zwhy != NULL) { + const char *zfrom; char *zfree; + const char *ztemp; if (qcmd->bcmd != 'E') - zfree = NULL; + { + zfrom = qcmd->zfrom; + zfree = NULL; + } else { - zfree = zbufalc (sizeof "Execution of \"\": " - + strlen (qcmd->zcmd) - + strlen (zwhy)); - sprintf (zfree, "Execution of \"%s\": %s", qcmd->zcmd, zwhy); - zwhy = zfree; + zfree = zbufalc (strlen (qcmd->zfrom) + + sizeof " (execution of \"\")" + + strlen (qcmd->zcmd)); + sprintf (zfree, "%s (execution of \"%s\")", qcmd->zfrom, + qcmd->zcmd); + zfrom = zfree; } - ulog (LOG_ERROR, "%s: %s", qcmd->zfrom, zwhy); + ulog (LOG_ERROR, "%s: %s", zfrom, zwhy); + + /* We only save the temporary file if this is a request from the + local system; otherwise a remote system could launch a denial + of service attack by filling up the .Preserve directory + (local users have much simpler methods for this type of + denial of service attack, so there is little point to using a + more sophisticated scheme). */ + if (strchr (qcmd->zuser, '!') == NULL) + ztemp = zsysdep_save_temp_file (qcmd->pseq); + else + ztemp = NULL; (void) fmail_transfer (FALSE, qcmd->zuser, (const char *) NULL, - zwhy, qcmd->zfrom, (const char *) NULL, - qcmd->zto, qsys->uuconf_zname, - zsysdep_save_temp_file (qcmd->pseq)); + zwhy, zfrom, (const char *) NULL, + qcmd->zto, qdaemon->qsys->uuconf_zname, ztemp); ubuffree (zfree); } @@ -353,9 +371,37 @@ flocal_send_request (qtrans, qdaemon) /* Make sure the file meets any remote size restrictions. */ if (qdaemon->cmax_receive != -1 && qdaemon->cmax_receive < qinfo->cbytes) - return flocal_send_fail (qtrans, &qtrans->s, qdaemon->qsys, + return flocal_send_fail (qtrans, &qtrans->s, qdaemon, "too large for receiver"); + /* Make sure the file still exists--it may have been removed between + the conversation startup and now. After we have sent over the S + command we must give an error if we can't find the file. */ + if (! fsysdep_file_exists (qinfo->zfile)) + { + (void) fsysdep_did_work (qtrans->s.pseq); + usfree_send (qtrans); + return TRUE; + } + + /* If we are using a protocol which can make multiple channels, then + we can open and send the file whenever we are ready. This is + because we will be able to distinguish the response by the + channel it is directed to. This assumes that every protocol + which supports multiple channels also supports sending the file + position in mid-stream, since otherwise we would not be able to + restart files. */ + qtrans->fcmd = TRUE; + qtrans->psendfn = flocal_send_open_file; + qtrans->precfn = flocal_send_await_reply; + + if (qdaemon->cchans > 1) + fret = fqueue_send (qdaemon, qtrans); + else + fret = fqueue_receive (qdaemon, qtrans); + if (! fret) + return FALSE; + /* Construct the notify string to send. If we are going to send a size or an execution command, it must be non-empty. */ znotify = qtrans->s.znotify; @@ -452,27 +498,11 @@ flocal_send_request (qtrans, qdaemon) fret = (*qdaemon->qproto->pfsendcmd) (qdaemon, zsend, qtrans->ilocal, qtrans->iremote); ubuffree (zsend); - if (! fret) - { - usfree_send (qtrans); - return FALSE; - } - /* If we are using a protocol which can make multiple channels, then - we can open and send the file whenever we are ready. This is - because we will be able to distinguish the response by the - channel it is directed to. This assumes that every protocol - which supports multiple channels also supports sending the file - position in mid-stream, since otherwise we would not be able to - restart files. */ - qtrans->fcmd = TRUE; - qtrans->psendfn = flocal_send_open_file; - qtrans->precfn = flocal_send_await_reply; + if (! fret) + usfree_send (qtrans); - if (qdaemon->qproto->cchans > 1) - return fqueue_send (qdaemon, qtrans); - else - return fqueue_receive (qdaemon, qtrans); + return fret; } /* This is called when a reply is received for the send request. As @@ -535,21 +565,36 @@ flocal_send_await_reply (qtrans, qdaemon, zdata, cdata) is no need to resend the file. */ zerr = NULL; } + else if (zdata[2] == '9') + { + /* Remote has run out of channels. */ + zerr = "too many channels for remote"; + fnever = FALSE; + + /* Drop one channel; using exactly one channel causes + slightly different behahaviour in a few places, so don't + decrement to one. */ + if (qdaemon->cchans > 2) + --qdaemon->cchans; + } else zerr = "unknown reason"; - if (! fnever) + if (! fnever + || (qtrans->s.bcmd == 'E' + && (qdaemon->ifeatures & FEATURE_EXEC) == 0 + && qinfo->zexec == NULL)) { if (qtrans->s.bcmd == 'E') - ulog (LOG_ERROR, "Execution of \"%s\": %s", qtrans->s.zcmd, - zerr); + ulog (LOG_ERROR, "%s (execution of \"%s\"): %s", + qtrans->s.zfrom, qtrans->s.zcmd, zerr); else ulog (LOG_ERROR, "%s: %s", qtrans->s.zfrom, zerr); } else { if (! flocal_send_fail ((struct stransfer *) NULL, &qtrans->s, - qdaemon->qsys, zerr)) + qdaemon, zerr)) return FALSE; } @@ -558,16 +603,39 @@ flocal_send_await_reply (qtrans, qdaemon, zdata, cdata) the remote side knows that we have finished sending the file data. If we have already sent the entire file, there will be no confusion. */ - if (qdaemon->qproto->cchans == 1 || qinfo->fsent) + if (qdaemon->cchans == 1 || qinfo->fsent) { + /* If we are breaking a 'E' command into two 'S' commands, + and that was for the first 'S' command, we still have to + send the second one. */ + if (fnever + && qtrans->s.bcmd == 'E' + && (qdaemon->ifeatures & FEATURE_EXEC) == 0 + && qinfo->zexec == NULL) + return fsend_exec_file_init (qtrans, qdaemon); + usfree_send (qtrans); return TRUE; } else { + /* Seek to the end of the file so that the next read will + send end of file. We have to be careful here, because we + may have actually already sent end of file--we could be + being called because of data received while the end of + file block was sent. */ + if (! ffileseekend (qtrans->e)) + { + ulog (LOG_ERROR, "seek to end: %s", strerror (errno)); + usfree_send (qtrans); + return FALSE; + } qtrans->psendfn = flocal_send_cancelled; qtrans->precfn = NULL; - qtrans->fsendfile = FALSE; + + /* Reuse fsent to pass fnever to flocal_send_cancelled. */ + qinfo->fsent = fnever; + return fqueue_send (qdaemon, qtrans); } } @@ -603,7 +671,7 @@ flocal_send_await_reply (qtrans, qdaemon, zdata, cdata) qtrans->precfn = fsend_await_confirm; if (qinfo->fsent) return fqueue_receive (qdaemon, qtrans); - else if (qdaemon->qproto->cchans <= 1) + else if (qdaemon->cchans <= 1) return fqueue_send (qdaemon, qtrans); else return TRUE; @@ -638,7 +706,9 @@ flocal_send_open_file (qtrans, qdaemon) qtrans->s.zfrom, (const char *) NULL, qtrans->s.zto, qdaemon->qsys->uuconf_zname, - zsysdep_save_temp_file (qtrans->s.pseq)); + (qinfo->flocal + ? zsysdep_save_temp_file (qtrans->s.pseq) + : (const char *) NULL)); (void) fsysdep_did_work (qtrans->s.pseq); usfree_send (qtrans); @@ -688,8 +758,15 @@ flocal_send_open_file (qtrans, qdaemon) sprintf (zalc, "%s (%s)", qtrans->s.zcmd, qtrans->s.zfrom); zsend = zalc; } - qtrans->zlog = zbufalc (sizeof "Sending " + strlen (zsend)); - sprintf (qtrans->zlog, "Sending %s", zsend); + + qtrans->zlog = zbufalc (sizeof "Sending ( bytes resume at )" + + strlen (zsend) + 50); + sprintf (qtrans->zlog, "Sending %s (%ld bytes", zsend, qinfo->cbytes); + if (qtrans->ipos > 0) + sprintf (qtrans->zlog + strlen (qtrans->zlog), " resume at %ld", + qtrans->ipos); + strcat (qtrans->zlog, ")"); + ubuffree (zalc); } @@ -698,7 +775,8 @@ flocal_send_open_file (qtrans, qdaemon) boolean fhandled; if (! (*qdaemon->qproto->pffile) (qdaemon, qtrans, TRUE, TRUE, - qinfo->cbytes, &fhandled)) + qinfo->cbytes - qtrans->ipos, + &fhandled)) { usfree_send (qtrans); return FALSE; @@ -719,32 +797,29 @@ flocal_send_open_file (qtrans, qdaemon) return fqueue_send (qdaemon, qtrans); } -/* Cancel a file send by sending an empty buffer. This is only called - for a protocol which supports multiple channels. It is needed - so that both systems agree as to when a channel is no longer - needed. */ +/* Cancel a file send. This is only called for a protocol which + supports multiple channels. It is needed so that both systems + agree as to when a channel is no longer needed. */ static boolean flocal_send_cancelled (qtrans, qdaemon) struct stransfer *qtrans; struct sdaemon *qdaemon; { - char *zdata; - size_t cdata; - boolean fret; - - zdata = (*qdaemon->qproto->pzgetspace) (qdaemon, &cdata); - if (zdata == NULL) - { - usfree_send (qtrans); - return FALSE; - } + struct ssendinfo *qinfo = (struct ssendinfo *) qtrans->pinfo; + + /* If we are breaking a 'E' command into two 'S' commands, and that + was for the first 'S' command, and the first 'S' command will + never be sent (passed as qinfo->fsent), we still have to send the + second one. */ + if (qinfo->fsent + && qtrans->s.bcmd == 'E' + && (qdaemon->ifeatures & FEATURE_EXEC) == 0 + && qinfo->zexec == NULL) + return fsend_exec_file_init (qtrans, qdaemon); - fret = (*qdaemon->qproto->pfsenddata) (qdaemon, zdata, (size_t) 0, - qtrans->ilocal, qtrans->iremote, - qtrans->ipos); usfree_send (qtrans); - return fret; + return TRUE; } /* A remote request to receive a file (meaning that we have to send a @@ -765,6 +840,7 @@ fremote_rec_file_init (qdaemon, qcmd, iremote) { const struct uuconf_system *qsys; char *zfile; + boolean fbadname; long cbytes; unsigned int imode; openfile_t e; @@ -786,7 +862,12 @@ fremote_rec_file_init (qdaemon, qcmd, iremote) return fremote_rec_fail (qdaemon, FAILURE_PERM, iremote); } - zfile = zsysdep_local_file (qcmd->zfrom, qsys->uuconf_zpubdir); + zfile = zsysdep_local_file (qcmd->zfrom, qsys->uuconf_zpubdir, &fbadname); + if (zfile == NULL && fbadname) + { + ulog (LOG_ERROR, "%s: bad local file name", qcmd->zfrom); + return fremote_rec_fail (qdaemon, FAILURE_PERM, iremote); + } if (zfile != NULL) { char *zbased; @@ -875,8 +956,24 @@ fremote_rec_reply (qtrans, qdaemon) struct ssendinfo *qinfo = (struct ssendinfo *) qtrans->pinfo; char absend[50]; - sprintf (absend, "RY 0%o 0x%lx", qtrans->s.imode, - (unsigned long) qinfo->cbytes); + qtrans->fsendfile = TRUE; + qtrans->psendfn = fsend_file_end; + qtrans->precfn = fsend_await_confirm; + + if (! fqueue_send (qdaemon, qtrans)) + return FALSE; + + /* We send the file size because SVR4 UUCP does. We don't look for + it. We send a trailing M if we want to request a hangup. We + send it both after the mode and at the end of the entire string; + I don't know where programs look for it. */ + if (qdaemon->frequest_hangup) + DEBUG_MESSAGE0 (DEBUG_UUCP_PROTO, + "fremote_rec_reply: Requesting remote to transfer control"); + sprintf (absend, "RY 0%o%s 0x%lx%s", qtrans->s.imode, + qdaemon->frequest_hangup ? "M" : "", + (unsigned long) qinfo->cbytes, + qdaemon->frequest_hangup ? "M" : ""); if (! (*qdaemon->qproto->pfsendcmd) (qdaemon, absend, qtrans->ilocal, qtrans->iremote)) { @@ -885,8 +982,10 @@ fremote_rec_reply (qtrans, qdaemon) return FALSE; } - qtrans->zlog = zbufalc (sizeof "Sending " + strlen (qtrans->s.zfrom)); - sprintf (qtrans->zlog, "Sending %s", qtrans->s.zfrom); + qtrans->zlog = zbufalc (sizeof "Sending ( bytes) " + + strlen (qtrans->s.zfrom) + 25); + sprintf (qtrans->zlog, "Sending %s (%ld bytes)", qtrans->s.zfrom, + qinfo->cbytes); if (qdaemon->qproto->pffile != NULL) { @@ -898,16 +997,9 @@ fremote_rec_reply (qtrans, qdaemon) usfree_send (qtrans); return FALSE; } - - if (fhandled) - return TRUE; } - qtrans->fsendfile = TRUE; - qtrans->psendfn = fsend_file_end; - qtrans->precfn = fsend_await_confirm; - - return fqueue_send (qdaemon, qtrans); + return TRUE; } /* If we can't send a file as requested by the remote system, queue up @@ -1057,6 +1149,7 @@ fsend_await_confirm (qtrans, qdaemon, zdata, cdata) ustats (zerr == NULL, qtrans->s.zuser, qdaemon->qsys->uuconf_zname, TRUE, qtrans->cbytes, qtrans->isecs, qtrans->imicros, qdaemon->fmaster); + qdaemon->csent += qtrans->cbytes; if (zerr == NULL) { diff --git a/gnu/libexec/uucp/uucico/time.c b/gnu/libexec/uucp/uucico/time.c index 4305e990e245..727a4c8066c6 100644 --- a/gnu/libexec/uucp/uucico/time.c +++ b/gnu/libexec/uucp/uucico/time.c @@ -1,7 +1,7 @@ /* time.c Routines to deal with UUCP time spans. - 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,18 +20,20 @@ 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 time_rcsid[] = "$Id: time.c,v 1.1 1993/08/05 18:27:20 conklin Exp $"; +const char time_rcsid[] = "$Id: time.c,v 1.2 1994/05/07 18:13:58 ache Exp $"; #endif #include <ctype.h> -#if HAVE_TIME_H +#if TM_IN_SYS_TIME +#include <sys/time.h> +#else #include <time.h> #endif diff --git a/gnu/libexec/uucp/uucico/trans.c b/gnu/libexec/uucp/uucico/trans.c index 2bb4d228195c..f53aa3b1244f 100644 --- a/gnu/libexec/uucp/uucico/trans.c +++ b/gnu/libexec/uucp/uucico/trans.c @@ -1,7 +1,7 @@ /* trans.c Routines to handle file transfers. - Copyright (C) 1992 Ian Lance Taylor + Copyright (C) 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 trans_rcsid[] = "$Id: trans.c,v 1.1 1993/08/05 18:27:21 conklin Exp $"; +const char trans_rcsid[] = "$Id: trans.c,v 1.2 1994/05/07 18:13:59 ache Exp $"; #endif #include <errno.h> @@ -233,7 +233,39 @@ fqueue_send (qdaemon, qtrans) ulog (LOG_FATAL, "fqueue_send: Bad call"); #endif utdequeue (qtrans); - utqueue (&qTsend, qtrans, FALSE); + + /* Sort the send queue to always send commands before files, and to + sort jobs by grade. */ + if (qTsend == NULL) + utqueue (&qTsend, qtrans, FALSE); + else + { + register struct stransfer *q; + boolean ffirst; + + ffirst = TRUE; + q = qTsend; + do + { + if (! qtrans->fsendfile && q->fsendfile) + break; + if ((! qtrans->fsendfile || q->fsendfile) + && UUCONF_GRADE_CMP (qtrans->s.bgrade, q->s.bgrade) < 0) + break; + + ffirst = FALSE; + q = q->qnext; + } + while (q != qTsend); + + qtrans->qnext = q; + qtrans->qprev = q->qprev; + q->qprev = qtrans; + qtrans->qprev->qnext = qtrans; + if (ffirst) + qTsend = qtrans; + qtrans->pqqueue = &qTsend; + } /* Since we're now going to wait to send data, don't charge this transfer for receive time. */ @@ -273,7 +305,7 @@ utchanalc (qdaemon, qtrans) do { ++iTchan; - if (iTchan > qdaemon->qproto->cchans) + if (iTchan > qdaemon->cchans) iTchan = 1; } while (aqTchan[iTchan] != NULL); @@ -388,6 +420,7 @@ utransfree (q) } #if DEBUG > 0 + q->e = EFILECLOSED; q->zcmd = NULL; q->s.zfrom = NULL; q->s.zto = NULL; @@ -625,18 +658,12 @@ static boolean fcheck_queue (qdaemon) struct sdaemon *qdaemon; { - int cchans; - /* Only check if we are the master, or if there are multiple channels, or if we aren't already trying to get the other side to hang up. Otherwise, there's nothing we can do with any new jobs we might find. */ - if ((qdaemon->ireliable & UUCONF_RELIABLE_FULLDUPLEX) == 0) - cchans = 1; - else - cchans = qdaemon->qproto->cchans; if (qdaemon->fmaster - || cchans > 1 + || qdaemon->cchans > 1 || ! qdaemon->frequest_hangup) { boolean fany; @@ -649,7 +676,7 @@ fcheck_queue (qdaemon) /* If we found something to do, and we're not the master, and we don't have multiple channels to send new jobs over, try to get the other side to hang up. */ - if (fany && ! qdaemon->fmaster && cchans <= 1) + if (fany && ! qdaemon->fmaster && qdaemon->cchans <= 1) qdaemon->frequest_hangup = TRUE; } @@ -663,17 +690,8 @@ boolean floop (qdaemon) struct sdaemon *qdaemon; { - int cchans; boolean fret; - /* If we are using a half-duplex line, act as though we have only a - single channel; otherwise we might start a send and a receive at - the same time. */ - if ((qdaemon->ireliable & UUCONF_RELIABLE_FULLDUPLEX) == 0) - cchans = 1; - else - cchans = qdaemon->qproto->cchans; - fret = TRUE; while (! qdaemon->fhangup) @@ -759,9 +777,9 @@ floop (qdaemon) /* If we are the master, or if we have multiple channels, try to queue up additional local jobs. */ - if (qdaemon->fmaster || cchans > 1) + if (qdaemon->fmaster || qdaemon->cchans > 1) { - while (qTlocal != NULL && cTchans < cchans) + while (qTlocal != NULL && cTchans < qdaemon->cchans) { /* We have room for an additional channel. */ q = qTlocal; @@ -821,11 +839,14 @@ floop (qdaemon) q->zlog = NULL; } - /* We can read the file in a tight loop until qTremote - changes or until we have transferred the entire file. - We can disregard any changes to qTlocal since we - already have something to send anyhow. */ - while (qTremote == NULL) + /* We can read the file in a tight loop until we have a + command to send, or the file send has been cancelled, + or we have a remote job to deal with. We can + disregard any changes to qTlocal since we already + have something to send anyhow. */ + while (q == qTsend + && q->fsendfile + && qTremote == NULL) { char *zdata; size_t cdata; @@ -865,11 +886,6 @@ floop (qdaemon) break; } - /* It is possible that this transfer has just been - cancelled. */ - if (q != qTsend || ! q->fsendfile) - break; - if (cdata == 0) { /* We must update the time now, because this @@ -978,7 +994,6 @@ fgot_data (qdaemon, zfirst, cfirst, zsecond, csecond, ilocal, iremote, ipos, else { /* Get the transfer structure this data is intended for. */ - q = qtchan (ilocal); } @@ -1014,7 +1029,8 @@ fgot_data (qdaemon, zfirst, cfirst, zsecond, csecond, ilocal, iremote, ipos, else cnew = cfirst; znew = zbufalc (q->ccmd + cnew + 1); - memcpy (znew, q->zcmd, q->ccmd); + if (q->ccmd > 0) + memcpy (znew, q->zcmd, q->ccmd); memcpy (znew + q->ccmd, zfirst, cnew); znew[q->ccmd + cnew] = '\0'; ubuffree (q->zcmd); @@ -1206,6 +1222,12 @@ ftadd_cmd (qdaemon, z, clen, iremote, flast) return TRUE; } + /* Some systems seem to sometimes send garbage at the end of the + command. Avoid interpreting it as a size if sizes are not + supported. */ + if ((qdaemon->ifeatures & FEATURE_SIZES) == 0) + s.cbytes = -1; + if (s.bcmd != 'H' && s.bcmd != 'Y' && s.bcmd != 'N') ulog_user (s.zuser); else @@ -1391,9 +1413,15 @@ ufailed (qdaemon) { if ((q->fsendfile || q->frecfile) && q->cbytes > 0) - ustats (FALSE, q->s.zuser, qdaemon->qsys->uuconf_zname, - q->fsendfile, q->cbytes, q->isecs, q->imicros, - FALSE); + { + ustats (FALSE, q->s.zuser, qdaemon->qsys->uuconf_zname, + q->fsendfile, q->cbytes, q->isecs, q->imicros, + FALSE); + if (q->fsendfile) + qdaemon->csent += q->cbytes; + else + qdaemon->creceived += q->cbytes; + } if (q->frecfile) (void) frec_discard_temp (qdaemon, q); q = q->qnext; @@ -1408,9 +1436,15 @@ ufailed (qdaemon) { if ((q->fsendfile || q->frecfile) && q->cbytes > 0) - ustats (FALSE, q->s.zuser, qdaemon->qsys->uuconf_zname, - q->fsendfile, q->cbytes, q->isecs, q->imicros, - FALSE); + { + ustats (FALSE, q->s.zuser, qdaemon->qsys->uuconf_zname, + q->fsendfile, q->cbytes, q->isecs, q->imicros, + FALSE); + if (q->fsendfile) + qdaemon->csent += q->cbytes; + else + qdaemon->creceived += q->cbytes; + } if (q->frecfile) (void) frec_discard_temp (qdaemon, q); q = q->qnext; diff --git a/gnu/libexec/uucp/uucico/uucico.8 b/gnu/libexec/uucp/uucico/uucico.8 index ccc93afab563..3915e82f163c 100644 --- a/gnu/libexec/uucp/uucico/uucico.8 +++ b/gnu/libexec/uucp/uucico/uucico.8 @@ -1,5 +1,5 @@ -''' $Id: uucico.8,v 1.1.2.1 1994/05/01 16:02:47 jkh Exp $ -.TH uucico 8 "Taylor UUCP 1.04" +''' $Id: uucico.8,v 1.3 1994/05/07 18:14:01 ache Exp $ +.TH uucico 8 "Taylor UUCP 1.05" .SH NAME uucico \- UUCP file transfer daemon .SH SYNOPSIS @@ -23,17 +23,17 @@ entries in the .I crontab table(s). -When invoked with the -.B \-r1 -option or the -.B \-s +When invoked with +.B \-r1, +.B \-\-master, +.B \-s, +.B \-\-system, or -.B \-S -option, the daemon will place a call to a remote system, running in -master mode. -Otherwise the daemon will start in slave mode, accepting a -call from a remote system. Typically a special login name will be set -up for UUCP which automatically invokes +.B \-S, +the daemon will place a call to a remote system, running in master +mode. Otherwise the daemon will start in slave mode, accepting a call +from a remote system. Typically a special login name will be set up +for UUCP which automatically invokes .I uucico when a call is made. @@ -43,6 +43,8 @@ terminates, it invokes the .I uuxqt (8) daemon, unless the .B \-q +or +.B \-\-nouuxqt option is given; .I uuxqt (8) executes any work orders created by @@ -54,29 +56,48 @@ If a call fails, .I uucico will normally refuse to retry the call until a certain (configurable) amount of time -has passed. This may be overridden by the -.B -f -or the +has passed. This may be overriden by the +.B -f, +.B --force, +or .B -S option. The -.B \-l +.B \-l, +.B \-\-prompt, +.B \-e, or -.B \-e -option may be used to force +.B \-\-loop +options may be used to force .I uucico to produce its own prompts of "login: " and "Password:". When another -daemon calls in, it will see these prompts and log in as usual; the -login name and password will be checked against a separate list kept -specially for +daemon calls in, it will see these prompts and log in as usual. The +login name and password will normally be checked against a separate +list kept specially for .I uucico rather than the .I /etc/passwd +file; it is possible on some systems to direct +.I uucico +to use the +.I /etc/passwd file. The .B \-l -option will prompt once and then exit. The +or +.B \--prompt +option will prompt once and then exit; in this mode the UUCP +administrator or the superuser may use the +.B \-u +or +.B \--login +option to force a login name, in which case +.I uucico +will not prompt for one. +The .B \-e +or +.B \--loop option will prompt again after the first session is over; in this mode .I uucico will permanently control a port. @@ -87,9 +108,13 @@ receives a SIGQUIT, SIGTERM or SIGPIPE signal, it will cleanly abort any current conversation with a remote system and exit. If it receives a SIGHUP signal it will abort any current conversation, but will continue to place calls to (if invoked with -.B \-r1) +.B \-r1 +or +.B \-\-master) and accept calls from (if invoked with -.B \-e) +.B \-e +or +.B \-\-loop) other systems. If it receives a SIGINT signal it will finish the current conversation, but will not place or accept any more calls. @@ -97,72 +122,91 @@ place or accept any more calls. The following options may be given to .I uucico. .TP 5 -.B \-r1 +.B \-r1, \-\-master Start in master mode (call out to a system); implied by -.B \-s +.B \-s, +.B \-\-system, or .B \-S. If no system is specified, call any system for which work is waiting to be done. .TP 5 -.B \-r0 +.B \-r0, \-\-slave Start in slave mode. This is the default. .TP 5 -.B \-s system +.B \-s system, \-\-system system Call the named system. .TP 5 .B \-S system -Call the named system, ignoring any required wait. +Call the named system, ignoring any required wait. This is equivalent +to +.B \-s system \-f. .TP 5 -.B \-f +.B \-f, \-\-force Ignore any required wait for any systems to be called. .TP 5 -.B \-l +.B \-l, \-\-prompt Prompt for login name and password using "login: " and "Password:". This allows .I uucico to be easily run from .I inetd (8). The login name and password are checked against the UUCP -password file, which has no connection to the file +password file, which probably has no connection to the file .I /etc/passwd. +The +.B \-\-login +option may be used to force a login name, in which cause +.I uucico +will only prompt for a password. .TP 5 -.B \-p port -Specify a port to call out on or to listen to. In slave mode, this -implies -.B \-e. +.B \-p port, \-\-port port +Specify a port to call out on or to listen to. .TP 5 -.B \-e +.B \-e, \-\-loop Enter endless loop of login/password prompts and slave mode daemon execution. The program will not stop by itself; you must use .I kill (1) to shut it down. .TP 5 -.B \-w +.B \-w, \-\-wait After calling out (to a particular system when -.B \-s +.B \-s, +.B \-\-system, or .B \-S -is specified, or to all systems which have work when +is specifed, or to all systems which have work when just .B \-r1 -is specified), begin an endless loop as with -.B \-e. +or +.B \-\-master +is specifed), begin an endless loop as with +.B \-\-loop. .TP 5 -.B \-q +.B \-q, \-\-nouuxqt Do not start the .I uuxqt (8) daemon when finished. .TP 5 -.B \-c +.B \-c, \-\-quiet If no calls are permitted at this time, then don't make the call, but also do not put an error message in the log file and do not update the system status (as reported by .I uustat (1)). This can be convenient for automated polling scripts, which may want to simply attempt to call every system rather than worry about -which particular systems may be called at the moment. +which particular systems may be called at the moment. This option +also suppresses the log message indicating that there is no work to be +done. .TP 5 -.B \-D +.B \-C, \-\-ifwork +Only call the system named by +.B \-s, +.B \-\-system +or +.B \-S +if there is work for that system. +.TP 5 +.B \-D, \-\-nodetach Do not detach from the controlling terminal. Normally .I uucico detaches from the terminal before each call out to another system and @@ -170,29 +214,57 @@ before invoking .I uuxqt. This option prevents this. .TP 5 -.B \-x type, \-X type +.B \-u name, \-\-login name +Set the login name to use instead of that of the invoking user. This +option may only be used by the UUCP administrator or the superuser. +If used with +.B \-\-prompt, +this will cause +.I uucico +to prompt only for the password, not the login name. +.TP 5 +.B \-z, \-\-try-next +If a call fails after the remote system is reached, try the next +alternate rather than simply exiting. +.TP 5 +.B \-i type, \-\-stdin type +Set the type of port to use when using standard input. The only +support port type is TLI, and this is only available on machines which +support the TLI networking interface. Specifying +.B \-iTLI +causes +.I uucico +to use TLI calls to perform I/O. +.TP 5 +.B \-x type, \-X type, \-\-debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. Multiple types may be given, separated by commas, and the -.B \-x +.B \-\-debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, -.B \-x 2 +.B \-\-debug 2 is equivalent to -.B \-x abnormal,chat. +.B \-\-debug abnormal,chat. The debugging output is sent to the debugging file, usually one of /usr/spool/uucp/Debug, /usr/spool/uucp/DEBUG, or /usr/spool/uucp/.Admin/audit.local. .TP 5 -.B \-I file +.B \-I file, \-\-config file Set configuration file to use. This option may not be available, depending upon how .I uucico was compiled. .TP 5 +.B \-v, \-\-version +Report version information and exit. +.TP 5 +.B \-\-help +Print a help message and exit. +.TP 5 .B \-u login This option is ignored. It is only included because some versions of uucpd invoke @@ -222,4 +294,4 @@ Debugging file. kill(1), uucp(1), uux(1), uustat(1), uuxqt(8) .SH AUTHOR Ian Lance Taylor -(ian@airs.com or uunet!airs!ian) +<ian@airs.com> diff --git a/gnu/libexec/uucp/uucico/uucico.c b/gnu/libexec/uucp/uucico/uucico.c index 01717c4bcf4f..29a42573e859 100644 --- a/gnu/libexec/uucp/uucico/uucico.c +++ b/gnu/libexec/uucp/uucico/uucico.c @@ -1,7 +1,7 @@ /* uucico.c This is the main UUCP communication program. - 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 uucico_rcsid[] = "$Id: uucico.c,v 1.1 1993/08/05 18:27:24 conklin Exp $"; +const char uucico_rcsid[] = "$Id: uucico.c,v 1.3 1994/05/25 20:14:52 ache Exp $"; #endif #include <ctype.h> @@ -45,10 +45,21 @@ const char uucico_rcsid[] = "$Id: uucico.c,v 1.1 1993/08/05 18:27:24 conklin Exp #include "prot.h" #include "trans.h" #include "system.h" - -/* The program name. */ -char abProgram[] = "uucico"; +#if HAVE_ENCRYPTED_PASSWORDS +#ifndef crypt +extern char *crypt (); +#endif +#endif + +/* Coherent already had a different meaning for the -c option. What a + pain. */ +#ifdef __COHERENT__ +#define COHERENT_C_OPTION 1 +#else +#define COHERENT_C_OPTION 0 +#endif + /* Define the known protocols. */ #define TCP_PROTO \ @@ -58,30 +69,33 @@ char abProgram[] = "uucico"; static const struct sprotocol asProtocols[] = { - { 't', TCP_PROTO, 1, + { 't', TCP_PROTO, 1, TRUE, asTproto_params, ftstart, ftshutdown, ftsendcmd, ztgetspace, ftsenddata, ftwait, ftfile }, - { 'e', TCP_PROTO, 1, + { 'e', TCP_PROTO, 1, TRUE, asEproto_params, festart, feshutdown, fesendcmd, zegetspace, fesenddata, fewait, fefile }, - { 'i', UUCONF_RELIABLE_EIGHT, 7, + { 'i', UUCONF_RELIABLE_EIGHT, 7, TRUE, asIproto_params, fistart, fishutdown, fisendcmd, zigetspace, fisenddata, fiwait, NULL }, - { 'a', UUCONF_RELIABLE_EIGHT, 1, + { 'a', UUCONF_RELIABLE_EIGHT, 1, TRUE, asZproto_params, fzstart, fzshutdown, fzsendcmd, zzgetspace, fzsenddata, fzwait, fzfile }, - { 'g', UUCONF_RELIABLE_EIGHT, 1, + { 'g', UUCONF_RELIABLE_EIGHT, 1, TRUE, asGproto_params, fgstart, fgshutdown, fgsendcmd, zggetspace, fgsenddata, fgwait, NULL }, - { 'G', UUCONF_RELIABLE_EIGHT, 1, + { 'G', UUCONF_RELIABLE_EIGHT, 1, TRUE, asGproto_params, fbiggstart, fgshutdown, fgsendcmd, zggetspace, fgsenddata, fgwait, NULL }, - { 'j', UUCONF_RELIABLE_EIGHT, 7, + { 'j', UUCONF_RELIABLE_EIGHT, 7, TRUE, asIproto_params, fjstart, fjshutdown, fisendcmd, zigetspace, fisenddata, fiwait, NULL }, - { 'f', UUCONF_RELIABLE_RELIABLE, 1, + { 'f', UUCONF_RELIABLE_RELIABLE, 1, FALSE, asFproto_params, ffstart, ffshutdown, ffsendcmd, zfgetspace, ffsenddata, ffwait, fffile }, + { 'v', UUCONF_RELIABLE_EIGHT, 1, TRUE, + asGproto_params, fvstart, fgshutdown, fgsendcmd, zggetspace, + fgsenddata, fgwait, NULL } }; #define CPROTOCOLS (sizeof asProtocols / sizeof asProtocols[0]) @@ -112,12 +126,13 @@ struct spass /* Local functions. */ static void uusage P((void)); +static void uhelp P((void)); static void uabort P((void)); -static boolean fcall P((pointer puuconf, +static boolean fcall P((pointer puuconf, const char *zconfig, boolean fuuxqt, const struct uuconf_system *qsys, struct uuconf_port *qport, boolean fifwork, boolean fforce, boolean fdetach, - boolean ftimewarn)); + boolean fquiet, boolean ftrynext)); static boolean fconn_call P((struct sdaemon *qdaemon, struct uuconf_port *qport, struct sstatus *qstat, int cretry, @@ -127,11 +142,19 @@ static boolean fdo_call P((struct sdaemon *qdaemon, const struct uuconf_dialer *qdialer, boolean *pfcalled, enum tstatus_type *pterr)); static int iuport_lock P((struct uuconf_port *qport, pointer pinfo)); -static boolean flogin_prompt P((pointer puuconf, - struct sconnection *qconn)); -static boolean faccept_call P((pointer puuconf, const char *zlogin, +static boolean flogin_prompt P((pointer puuconf, const char *zconfig, + boolean fuuxqt, struct sconnection *qconn, + const char *zlogin)); +static int icallin_cmp P((int iwhich, pointer pinfo, const char *zfile)); +static boolean faccept_call P((pointer puuconf, const char *zconfig, + boolean fuuxqt, const char *zlogin, struct sconnection *qconn, const char **pzsystem)); +static void uaccept_call_cleanup P((pointer puuconf, + struct uuconf_system *qfreesys, + struct uuconf_port *qport, + struct uuconf_port *qfreeport, + char *zloc)); static void uapply_proto_params P((pointer puuconf, int bproto, struct uuconf_cmdtab *qcmds, struct uuconf_proto_param *pas)); @@ -142,21 +165,47 @@ static char *zget_uucp_cmd P((struct sconnection *qconn, static char *zget_typed_line P((struct sconnection *qconn)); /* Long getopt options. */ -static const struct option asLongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asLongopts[] = +{ + { "quiet", no_argument, NULL, 2 }, + { "ifwork", no_argument, NULL, 'C' }, + { "nodetach", no_argument, NULL, 'D' }, + { "loop", no_argument, NULL, 'e' }, + { "force", no_argument, NULL, 'f'}, + { "stdin", required_argument, NULL, 'i' }, + { "prompt", no_argument, NULL, 'l' }, + { "port", required_argument, NULL, 'p' }, + { "nouuxqt", no_argument, NULL, 'q' }, + { "master", no_argument, NULL, 3 }, + { "slave", no_argument, NULL, 4 }, + { "system", required_argument, NULL, 's' }, + { "login", required_argument, NULL, 'u' }, + { "wait", no_argument, NULL, 'w' }, + { "try-next", no_argument, NULL, 'z' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) int argc; char **argv; { - /* -c: Whether to warn if a call is attempted at a bad time. */ - boolean ftimewarn = TRUE; + /* -c: Whether to be quiet. */ + boolean fquiet = FALSE; + /* -C: Only call the system if there is work. */ + boolean fifwork = FALSE; /* -D: don't detach from controlling terminal. */ boolean fdetach = TRUE; /* -e: Whether to do an endless loop of accepting calls. */ boolean fendless = FALSE; /* -f: Whether to force a call despite status of previous call. */ boolean fforce = FALSE; + /* -i type: type of port to use for stdin. */ + enum uuconf_porttype tstdintype = UUCONF_PORTTYPE_STDIN; /* -I file: configuration file name. */ const char *zconfig = NULL; /* -l: Whether to give a single login prompt. */ @@ -172,8 +221,13 @@ main (argc, argv) boolean fmaster = FALSE; /* -s,-S system: system to call. */ const char *zsystem = NULL; + /* -u: Login name to use. */ + const char *zlogin = NULL; /* -w: Whether to wait for a call after doing one. */ boolean fwait = FALSE; + /* -z: Try next alternate if call fails. */ + boolean ftrynext = FALSE; + const char *zopts; int iopt; struct uuconf_port *qport; struct uuconf_port sport; @@ -184,15 +238,40 @@ main (argc, argv) int iholddebug; #endif - while ((iopt = getopt_long (argc, argv, - "cDefI:lp:qr:s:S:u:x:X:w", + zProgram = argv[0]; + + /* When uucico is invoked by login, the first character of the + program will be a dash. We don't want that. */ + if (*zProgram == '-') + ++zProgram; + +#if COHERENT_C_OPTION + zopts = "c:CDefi:I:lp:qr:s:S:u:x:X:vwz"; +#else + zopts = "cCDefi:I:lp:qr:s:S:u:x:X:vwz"; +#endif + + while ((iopt = getopt_long (argc, argv, zopts, asLongopts, (int *) NULL)) != EOF) { +#if COHERENT_C_OPTION + if (iopt == 'c') + { + iopt = 's'; + fifwork = TRUE; + } +#endif switch (iopt) { + case 2: case 'c': - /* Don't warn if a call is attempted at a bad time. */ - ftimewarn = FALSE; + /* Don't warn if a call is attempted at a bad time, and + don't print the "No work" message. */ + fquiet = TRUE; + break; + + case 'C': + fifwork = TRUE; break; case 'D': @@ -211,10 +290,23 @@ main (argc, argv) fforce = TRUE; break; - case 'I': - /* Set configuration file name (default is in sysdep.h). */ - if (fsysdep_other_config (optarg)) - zconfig = optarg; + case 'i': + /* Type of port to use for standard input. Only TLI is + supported here, and only if HAVE_TLI is true. This + permits the Network Listener to tell uucico to use TLI + I/O calls. */ + if (strcasecmp (optarg, "tli") != 0) + fprintf (stderr, "%s: unsupported port type \"%s\"\n", + zProgram, optarg); + else + { +#if HAVE_TLI + tstdintype = UUCONF_PORTTYPE_TLI; +#else + fprintf (stderr, "%s: not compiled with TLI support\n", + zProgram); +#endif + } break; case 'l': @@ -257,31 +349,71 @@ main (argc, argv) case 'u': /* Some versions of uucpd invoke uucico with a -u argument - specifying the login name. I'm told it is safe to ignore - this value, although perhaps we should use it rather than - zsysdep_login_name (). */ + specifying the login name. If invoked by a privileged + user, we use it instead of the result of + zsysdep_login_name. */ + if (fsysdep_privileged ()) + zlogin = optarg; + else + fprintf (stderr, + "%s: ignoring command line login name: not a privileged user\n", + zProgram); + break; + + case 'w': + /* Call out and then wait for a call in */ + fwait = TRUE; + break; + + case 'z': + /* Try next alternate if call fails. */ + ftrynext = TRUE; + break; + + case 'I': + /* Set configuration file name (default is in sysdep.h). */ + if (fsysdep_other_config (optarg)) + zconfig = optarg; break; case 'x': case 'X': #if DEBUG > 1 - /* Set debugging level */ + /* Set debugging level. */ iDebug |= idebug_parse (optarg); #endif break; - case 'w': - /* Call out and then wait for a call in */ - fwait = TRUE; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 4: + /* --slave. */ + fmaster = FALSE; + break; + + case 3: + /* --master. */ + fmaster = TRUE; break; + case 1: + /* --help. */ + uhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found, and flag value set. */ break; default: uusage (); - break; + /*NOTREACHED*/ } } @@ -290,7 +422,7 @@ main (argc, argv) if (fwait && zport == NULL) { - ulog (LOG_ERROR, "-w requires -e"); + fprintf (stderr, "%s: -w requires -p", zProgram); uusage (); } @@ -321,7 +453,7 @@ main (argc, argv) pointer))) NULL, (pointer) NULL, &sport); if (iuuconf == UUCONF_NOT_FOUND) - ulog (LOG_FATAL, "%s: Port not found", zport); + ulog (LOG_FATAL, "%s: port not found", zport); else if (iuuconf != UUCONF_SUCCESS) ulog_uuconf (LOG_FATAL, puuconf, iuuconf); qport = &sport; @@ -384,8 +516,8 @@ main (argc, argv) else { fLocked_system = TRUE; - fret = fcall (puuconf, &sLocked_system, qport, FALSE, - fforce, fdetach, ftimewarn); + fret = fcall (puuconf, zconfig, fuuxqt, &sLocked_system, qport, + fifwork, fforce, fdetach, fquiet, ftrynext); if (fLocked_system) { (void) fsysdep_unlock_system (&sLocked_system); @@ -468,8 +600,9 @@ main (argc, argv) else { fLocked_system = TRUE; - if (! fcall (puuconf, &sLocked_system, qport, TRUE, - fforce, fdetach, ftimewarn)) + if (! fcall (puuconf, zconfig, fuuxqt, &sLocked_system, + qport, TRUE, fforce, fdetach, fquiet, + ftrynext)) fret = FALSE; /* Now ignore any SIGHUP that we got. */ @@ -493,7 +626,7 @@ main (argc, argv) xfree ((pointer) pznames); - if (! fdidone) + if (! fdidone && ! fquiet) ulog (LOG_NORMAL, "No work"); } @@ -520,7 +653,7 @@ main (argc, argv) fret = TRUE; zsystem = NULL; - if (! fconn_init (qport, &sconn)) + if (! fconn_init (qport, &sconn, tstdintype)) fret = FALSE; if (qport != NULL) @@ -531,9 +664,6 @@ main (argc, argv) if (fdetach && qport->uuconf_ttype != UUCONF_PORTTYPE_STDIN) usysdep_detach (); - - /* If a port was given, we loop forever. */ - fendless = TRUE; } if (fconn_lock (&sconn, TRUE)) @@ -558,17 +688,14 @@ main (argc, argv) if (fendless) { while (! FGOT_SIGNAL () - && flogin_prompt (puuconf, &sconn)) + && flogin_prompt (puuconf, zconfig, fuuxqt, &sconn, + (const char *) NULL)) { - /* Now ignore any SIGHUP that we got. */ - afSignal[INDEXSIG_SIGHUP] = FALSE; - - if (fLocked_system) - { - (void) fsysdep_unlock_system (&sLocked_system); - fLocked_system = FALSE; - } - if (! fconn_reset (&sconn)) + /* Close and reopen the port in between calls. */ + if (! fconn_close (&sconn, puuconf, + (struct uuconf_dialer *) NULL, + TRUE) + || ! fconn_open (&sconn, (long) 0, (long) 0, TRUE)) break; } fret = FALSE; @@ -576,13 +703,16 @@ main (argc, argv) else { if (flogin) - fret = flogin_prompt (puuconf, &sconn); + fret = flogin_prompt (puuconf, zconfig, fuuxqt, &sconn, + zlogin); else { #if DEBUG > 1 iholddebug = iDebug; #endif - fret = faccept_call (puuconf, zsysdep_login_name (), + if (zlogin == NULL) + zlogin = zsysdep_login_name (); + fret = faccept_call (puuconf, zconfig, fuuxqt, zlogin, &sconn, &zsystem); #if DEBUG > 1 iDebug = iholddebug; @@ -602,12 +732,6 @@ main (argc, argv) if (flocked) (void) fconn_unlock (&sconn); - if (fLocked_system) - { - (void) fsysdep_unlock_system (&sLocked_system); - fLocked_system = FALSE; - } - uconn_free (&sconn); } @@ -622,19 +746,19 @@ main (argc, argv) if (fuuxqt) { - /* Detach from the controlling terminal before starting up uuxqt, - so that it runs as a true daemon. */ - if (fdetach) - usysdep_detach (); - if (zsystem == NULL) - { - if (! fsysdep_run ("uuxqt", (const char *) NULL, - (const char *) NULL)) - fret = FALSE; - } - else + int irunuuxqt; + + iuuconf = uuconf_runuuxqt (puuconf, &irunuuxqt); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + else if (irunuuxqt == UUCONF_RUNUUXQT_ONCE) { - if (! fsysdep_run ("uuxqt", "-s", zsystem)) + /* Detach from the controlling terminal before starting up uuxqt, + so that it runs as a true daemon. */ + if (fdetach) + usysdep_detach (); + + if (! fspawn_uuxqt (FALSE, zsystem, zconfig)) fret = FALSE; } } @@ -645,40 +769,46 @@ main (argc, argv) return 0; } -/* Print out a usage message. */ +/* Print out a usage message and die. */ static void uusage () { - fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + fprintf (stderr, "Usage: %s [options]\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print a help message. */ + +static void +uhelp () +{ + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); - fprintf (stderr, - "Usage: uucico [options]\n"); - fprintf (stderr, - " -s,-S system: Call system (-S implies -f)\n"); - fprintf (stderr, - " -f: Force call despite system status\n"); - fprintf (stderr, - " -r state: 1 for master, 0 for slave (default)\n"); - fprintf (stderr, - " -p port: Specify port (implies -e)\n"); - fprintf (stderr, - " -l: prompt for login name and password\n"); - fprintf (stderr, - " -e: Endless loop of login prompts and daemon execution\n"); - fprintf (stderr, - " -w: After calling out, wait for incoming calls\n"); - fprintf (stderr, - " -q: Don't start uuxqt when done\n"); - fprintf (stderr, - " -x,-X debug: Set debugging level\n"); + printf ("Usage: %s [options]\n", zProgram); + printf (" -s,-S,--system system: Call system (-S implies -f)\n"); + printf (" -f,--force: Force call despite system status\n"); + printf (" -r state: 1 for master, 0 for slave (default)\n"); + printf (" --master: Act as master\n"); + printf (" --slave: Act as slave (default)\n"); + printf (" -p,--port port: Specify port\n"); + printf (" -l,--prompt: prompt for login name and password\n"); + printf (" -e,--loop: Endless loop of login prompts and daemon execution\n"); + printf (" -w,--wait: After calling out, wait for incoming calls\n"); + printf (" -q,--nouuxqt: Don't start uuxqt when done\n"); + printf (" -c,--quiet: Don't log bad time or no work warnings\n"); + printf (" -C,--ifwork: Only call named system if there is work\n"); + printf (" -D,--nodetach: Don't detach from controlling terminal\n"); + printf (" -u,--login: Set login name (privileged users only)\n"); + printf (" -i,--stdin type: Type of standard input (only TLI supported)\n"); + printf (" -z,--try-next: If a call fails, try the next alternate\n"); + printf (" -x,-X,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); + printf (" -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ - - exit (EXIT_FAILURE); + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); } /* This function is called when a LOG_FATAL error occurs. */ @@ -713,28 +843,36 @@ uabort () usysdep_exit (FALSE); } +/* The number of seconds in one day. We must cast to long for this + to be calculated correctly on a machine with 16 bit ints. */ +#define SECS_PER_DAY ((long) 24 * (long) 60 * (long) 60) + /* Call another system, trying all the possible sets of calling instructions. The qsys argument is the system to call. The qport argument is the port to use, and may be NULL. If the fifwork argument is TRUE, the call is only placed if there is work to be done. If the fforce argument is TRUE, a call is forced even if not - enough time has passed since the last failed call. If the - ftimewarn argument is TRUE (the normal case), then a warning is - given if calls are not permitted at this time. */ + enough time has passed since the last failed call. If the fquiet + argument is FALSE (the normal case), then a warning is given if + calls are not permitted at this time. */ static boolean -fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) +fcall (puuconf, zconfig, fuuxqt, qorigsys, qport, fifwork, fforce, fdetach, + fquiet, ftrynext) pointer puuconf; + const char *zconfig; + boolean fuuxqt; const struct uuconf_system *qorigsys; struct uuconf_port *qport; boolean fifwork; boolean fforce; boolean fdetach; - boolean ftimewarn; + boolean fquiet; + boolean ftrynext; { struct sstatus sstat; long inow; - boolean fbadtime, fnevertime; + boolean fbadtime, fnevertime, ffoundwork; const struct uuconf_system *qsys; if (! fsysdep_get_status (qorigsys, &sstat, (boolean *) NULL)) @@ -744,21 +882,24 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) that we haven't exceeded the maximum number of retries. Even if we are over the limit on retries, we permit a call to be made if 24 hours have passed. This 24 hour limit is still controlled by - the retry time. */ + the retry time. We ignore times in the future, presumably the + result of some sort of error. */ inow = ixsysdep_time ((long *) NULL); if (! fforce) { if (qorigsys->uuconf_cmax_retries > 0 && sstat.cretries >= qorigsys->uuconf_cmax_retries - && sstat.ilast + 24 * 60 * 60 < inow) + && sstat.ilast <= inow + && sstat.ilast + SECS_PER_DAY > inow) { ulog (LOG_ERROR, "Too many retries"); return FALSE; } - if (sstat.ttype == STATUS_COMPLETE - ? sstat.ilast + qorigsys->uuconf_csuccess_wait > inow - : sstat.ilast + sstat.cwait > inow) + if ((sstat.ttype == STATUS_COMPLETE + ? sstat.ilast + qorigsys->uuconf_csuccess_wait > inow + : sstat.ilast + sstat.cwait > inow) + && sstat.ilast <= inow) { ulog (LOG_NORMAL, "Retry time not reached"); return FALSE; @@ -766,25 +907,21 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) } sDaemon.puuconf = puuconf; - sDaemon.qsys = NULL; - sDaemon.zlocalname = NULL; - sDaemon.qconn = NULL; - sDaemon.qproto = NULL; - sDaemon.clocal_size = -1; - sDaemon.cremote_size = -1; - sDaemon.cmax_ever = -2; - sDaemon.cmax_receive = -1; - sDaemon.ifeatures = 0; - sDaemon.frequest_hangup = FALSE; - sDaemon.fhangup_requested = FALSE; - sDaemon.fhangup = FALSE; - sDaemon.fmaster = TRUE; - sDaemon.fcaller = TRUE; - sDaemon.ireliable = 0; - sDaemon.bgrade = '\0'; + sDaemon.zconfig = zconfig; + if (! fuuxqt) + sDaemon.irunuuxqt = UUCONF_RUNUUXQT_NEVER; + else + { + int iuuconf; + + iuuconf = uuconf_runuuxqt (puuconf, &sDaemon.irunuuxqt); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + } fbadtime = TRUE; fnevertime = TRUE; + ffoundwork = FALSE; for (qsys = qorigsys; qsys != NULL; qsys = qsys->uuconf_qalternate) { @@ -804,7 +941,28 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) &cretry)) continue; + fbadtime = FALSE; + sDaemon.qsys = qsys; + sDaemon.zlocalname = NULL; + sDaemon.qconn = NULL; + sDaemon.qproto = NULL; + sDaemon.cchans = 1; + sDaemon.clocal_size = -1; + sDaemon.cremote_size = -1; + sDaemon.cmax_ever = -2; + sDaemon.cmax_receive = -1; + sDaemon.csent = 0; + sDaemon.creceived = 0; + sDaemon.cxfiles_received = 0; + sDaemon.ifeatures = 0; + sDaemon.frequest_hangup = FALSE; + sDaemon.fhangup_requested = FALSE; + sDaemon.fhangup = FALSE; + sDaemon.fmaster = TRUE; + sDaemon.fcaller = TRUE; + sDaemon.ireliable = 0; + sDaemon.bgrade = '\0'; /* Queue up any work there is to do. */ if (! fqueue (&sDaemon, &fany)) @@ -820,7 +978,7 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) continue; } - fbadtime = FALSE; + ffoundwork = TRUE; fret = fconn_call (&sDaemon, qport, &sstat, cretry, &fcalled); @@ -828,7 +986,7 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) if (fret) return TRUE; - if (fcalled) + if (fcalled && ! ftrynext) return FALSE; /* Now we have to dump that port so that we can aquire a new @@ -845,9 +1003,16 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) } } - if (fbadtime && ftimewarn) + /* We only get here if no call succeeded. If fbadtime is TRUE it + was the wrong time for all the alternates. Otherwise, if + ffoundwork is FALSE there was no work for any of the alternates. + Otherwise, we attempted a call and fconn_call logged an error + message. */ + + if (fbadtime) { - ulog (LOG_NORMAL, "Wrong time to call"); + if (! fquiet) + ulog (LOG_NORMAL, "Wrong time to call"); /* Update the status, unless the system can never be called. If the system can never be called, there is little point to @@ -862,6 +1027,12 @@ fcall (puuconf, qorigsys, qport, fifwork, fforce, fdetach, ftimewarn) (void) fsysdep_set_status (qorigsys, &sstat); } } + else if (! ffoundwork) + { + if (! fquiet) + ulog (LOG_NORMAL, "No work"); + return TRUE; + } return FALSE; } @@ -905,7 +1076,7 @@ fconn_call (qdaemon, qport, qstat, cretry, pfcalled) qport = qsys->uuconf_qport; if (qport != NULL) { - if (! fconn_init (qport, &sconn)) + if (! fconn_init (qport, &sconn, UUCONF_PORTTYPE_UNKNOWN)) return FALSE; if (! fconn_lock (&sconn, FALSE)) { @@ -972,6 +1143,7 @@ fconn_call (qdaemon, qport, qstat, cretry, pfcalled) if (! fconn_dial (&sconn, puuconf, qsys, qsys->uuconf_zphone, &sdialer, &tdialer)) { + tdialer = DIALERFOUND_FALSE; terr = STATUS_DIAL_FAILED; fret = FALSE; } @@ -1068,7 +1240,8 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr) if (strncmp (zstr, "Shere", 5) != 0) { - ulog (LOG_ERROR, "Bad initialization string"); + ulog (LOG_ERROR, "Bad startup string (expected \"Shere\" got \"%s\")", + zstr); ubuffree (zstr); return FALSE; } @@ -1218,7 +1391,7 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr) if (zstr[0] != 'R') { - ulog (LOG_ERROR, "Bad reponse to handshake string (%s)", + ulog (LOG_ERROR, "Bad response to handshake string (%s)", zstr); ubuffree (zstr); return FALSE; @@ -1376,6 +1549,14 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr) qdaemon->qproto = &asProtocols[i]; + /* If we are using a half-duplex line, act as though we have only + a single channel; otherwise we might start a send and a receive + at the same time. */ + if ((qdaemon->ireliable & UUCONF_RELIABLE_FULLDUPLEX) == 0) + qdaemon->cchans = 1; + else + qdaemon->cchans = asProtocols[i].cchans; + sprintf (ab, "U%c", qdaemon->qproto->bname); if (! fsend_uucp_cmd (qconn, ab)) return FALSE; @@ -1449,8 +1630,12 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr) iend_time = ixsysdep_time ((long *) NULL); - ulog (LOG_NORMAL, "Call complete (%ld seconds)", - iend_time - istart_time); + ulog (LOG_NORMAL, "Call complete (%ld seconds %ld bytes %ld bps)", + iend_time - istart_time, + qdaemon->csent + qdaemon->creceived, + (iend_time != istart_time + ? (qdaemon->csent + qdaemon->creceived) / (iend_time - istart_time) + : 0)); if (fret) { @@ -1459,6 +1644,11 @@ fdo_call (qdaemon, qstat, qdialer, pfcalled, pterr) (void) fsysdep_set_status (qsys, qstat); } + if (qdaemon->irunuuxqt == UUCONF_RUNUUXQT_PERCALL + || (qdaemon->irunuuxqt > 0 && qdaemon->cxfiles_received > 0)) + (void) fspawn_uuxqt (TRUE, qdaemon->qsys->uuconf_zname, + qdaemon->zconfig); + return fret; } } @@ -1477,7 +1667,7 @@ iuport_lock (qport, pinfo) q->fmatched = TRUE; - if (! fconn_init (qport, q->qconn)) + if (! fconn_init (qport, q->qconn, UUCONF_PORTTYPE_UNKNOWN)) return UUCONF_NOT_FOUND; else if (! fconn_lock (q->qconn, FALSE)) { @@ -1491,31 +1681,49 @@ iuport_lock (qport, pinfo) } } +/* The information structure used for the uuconf_callin comparison + function. */ + +struct scallin_info +{ + const char *zuser; + const char *zpass; +}; + /* Prompt for a login name and a password, and run as the slave. */ static boolean -flogin_prompt (puuconf, qconn) +flogin_prompt (puuconf, zconfig, fuuxqt, qconn, zlogin) pointer puuconf; + const char *zconfig; + boolean fuuxqt; struct sconnection *qconn; + const char *zlogin; { char *zuser, *zpass; boolean fret; int iuuconf; + struct scallin_info s; DEBUG_MESSAGE0 (DEBUG_HANDSHAKE, "flogin_prompt: Waiting for login"); zuser = NULL; - do + if (zlogin == NULL) { - ubuffree (zuser); - if (! fconn_write (qconn, "login: ", sizeof "login: " - 1)) - return FALSE; - zuser = zget_typed_line (qconn); - } - while (zuser != NULL && *zuser == '\0'); + do + { + ubuffree (zuser); + if (! fconn_write (qconn, "login: ", sizeof "login: " - 1)) + return FALSE; + zuser = zget_typed_line (qconn); + } + while (zuser != NULL && *zuser == '\0'); - if (zuser == NULL) - return TRUE; + if (zuser == NULL) + return TRUE; + + zlogin = zuser; + } if (! fconn_write (qconn, "Password:", sizeof "Password:" - 1)) { @@ -1532,8 +1740,12 @@ flogin_prompt (puuconf, qconn) fret = TRUE; - iuuconf = uuconf_callin (puuconf, zuser, zpass); + s.zuser = zlogin; + s.zpass = zpass; + iuuconf = uuconf_callin (puuconf, icallin_cmp, &s); + ubuffree (zpass); + if (iuuconf == UUCONF_NOT_FOUND) ulog (LOG_ERROR, "Bad login"); else if (iuuconf != UUCONF_SUCCESS) @@ -1553,7 +1765,8 @@ flogin_prompt (puuconf, qconn) #if DEBUG > 1 iholddebug = iDebug; #endif - (void) faccept_call (puuconf, zuser, qconn, (const char **) NULL); + (void) faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, + (const char **) NULL); #if DEBUG > 1 iDebug = iholddebug; #endif @@ -1564,12 +1777,43 @@ flogin_prompt (puuconf, qconn) return fret; } +/* The comparison function which we pass to uuconf_callin. This + expands escape sequences in the login name, and either encrypts or + expands escape sequences in the password. */ + +static int +icallin_cmp (iwhich, pinfo, zfile) + int iwhich; + pointer pinfo; + const char *zfile; +{ + struct scallin_info *qinfo = (struct scallin_info *) pinfo; + char *zcopy; + int icmp; + +#if HAVE_ENCRYPTED_PASSWORDS + if (iwhich != 0) + return strcmp (crypt (qinfo->zpass, zfile), zfile) == 0; +#endif + + zcopy = zbufcpy (zfile); + (void) cescape (zcopy); + if (iwhich == 0) + icmp = strcmp (qinfo->zuser, zcopy); + else + icmp = strcmp (qinfo->zpass, zcopy); + ubuffree (zcopy); + return icmp == 0; +} + /* Accept a call from a remote system. If pqsys is not NULL, *pqsys will be set to the system that called in if known. */ static boolean -faccept_call (puuconf, zlogin, qconn, pzsystem) +faccept_call (puuconf, zconfig, fuuxqt, zlogin, qconn, pzsystem) pointer puuconf; + const char *zconfig; + boolean fuuxqt; const char *zlogin; struct sconnection *qconn; const char **pzsystem; @@ -1635,6 +1879,9 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) else if (iuuconf != UUCONF_SUCCESS) { ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + (struct uuconf_port *) NULL, + &sport, (char *) NULL); return FALSE; } else @@ -1669,14 +1916,27 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) } sDaemon.puuconf = puuconf; + sDaemon.zconfig = zconfig; + if (! fuuxqt) + sDaemon.irunuuxqt = UUCONF_RUNUUXQT_NEVER; + else + { + iuuconf = uuconf_runuuxqt (puuconf, &sDaemon.irunuuxqt); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + } sDaemon.qsys = NULL; sDaemon.zlocalname = NULL; sDaemon.qconn = qconn; sDaemon.qproto = NULL; + sDaemon.cchans = 1; sDaemon.clocal_size = -1; sDaemon.cremote_size = -1; sDaemon.cmax_ever = -2; sDaemon.cmax_receive = -1; + sDaemon.csent = 0; + sDaemon.creceived = 0; + sDaemon.cxfiles_received = 0; sDaemon.ifeatures = 0; sDaemon.frequest_hangup = FALSE; sDaemon.fhangup_requested = FALSE; @@ -1695,11 +1955,17 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { sDaemon.zlocalname = zsysdep_localname (); if (sDaemon.zlocalname == NULL) - return FALSE; + { + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, (char *) NULL); + return FALSE; + } } else { ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, (char *) NULL); return FALSE; } @@ -1709,16 +1975,26 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) fret = fsend_uucp_cmd (qconn, zsend); ubuffree (zsend); if (! fret) - return FALSE; + { + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); + return FALSE; + } zstr = zget_uucp_cmd (qconn, TRUE); if (zstr == NULL) - return FALSE; + { + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); + return FALSE; + } if (zstr[0] != 'S') { ulog (LOG_ERROR, "Bad introduction string"); ubuffree (zstr); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); return FALSE; } @@ -1740,6 +2016,8 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) xfree ((pointer) zscript); (void) fsend_uucp_cmd (qconn, "RYou are unknown to me"); ubuffree (zstr); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); return FALSE; } xfree ((pointer) zscript); @@ -1748,6 +2026,8 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { ulog_uuconf (LOG_ERROR, puuconf, iuuconf); ubuffree (zstr); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); return FALSE; } @@ -1756,6 +2036,8 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) (void) fsend_uucp_cmd (qconn, "RYou are unknown to me"); ulog (LOG_ERROR, "Call from unknown system %s", zstr + 1); ubuffree (zstr); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); return FALSE; } } @@ -1763,6 +2045,8 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { ulog_uuconf (LOG_ERROR, puuconf, iuuconf); ubuffree (zstr); + uaccept_call_cleanup (puuconf, (struct uuconf_system *) NULL, + qport, &sport, zloc); return FALSE; } @@ -1791,6 +2075,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { ulog_uuconf (LOG_ERROR, puuconf, iuuconf); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } } @@ -1801,6 +2086,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) ulog (LOG_ERROR, "System %s used wrong login name %s", zstr + 1, zlogin); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -1834,15 +2120,25 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) ubuffree (zsysdep_spool_commands (qsys, UUCONF_GRADE_HIGH, 0, (const struct scmd *) NULL)); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return TRUE; } /* We only permit one call at a time from a remote system. Lock it. */ if (! fsysdep_lock_system (qsys)) { + if (qsys->uuconf_fsequence) + { + /* At this point the calling system has already incremented + its sequence number, so we increment ours. This will + only cause a mismatch if the other system is not what it + says it is. */ + (void) ixsysdep_get_sequence (qsys); + } (void) fsend_uucp_cmd (qconn, "RLCK"); ulog (LOG_ERROR, "System already locked"); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } sLocked_system = *qsys; @@ -1946,6 +2242,8 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) (void) fsysdep_set_status (qsys, &sstat); xfree ((pointer) paz); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, + zloc); return FALSE; } fgotseq = TRUE; @@ -1983,6 +2281,8 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) iwant = (1 << iwant) - 1; if (qsys->uuconf_zmax_remote_debug != NULL) iwant &= idebug_parse (qsys->uuconf_zmax_remote_debug); + else + iwant &= DEBUG_ABNORMAL | DEBUG_CHAT | DEBUG_HANDSHAKE; if ((iDebug | iwant) != iDebug) { iDebug |= iwant; @@ -2009,6 +2309,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) ulog (LOG_ERROR, "No sequence number (call rejected)"); sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -2047,6 +2348,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } } @@ -2122,6 +2424,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -2131,15 +2434,17 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) { sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } - if (zstr[0] != 'U' || zstr[2] != '\0') + if (zstr[0] != 'U') { ulog (LOG_ERROR, "Bad protocol response string"); sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -2149,6 +2454,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); ubuffree (zstr); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -2163,11 +2469,20 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) ulog (LOG_ERROR, "No supported protocol"); sstat.ttype = STATUS_FAILED; (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } sDaemon.qproto = &asProtocols[i]; + /* If we are using a half-duplex line, act as though we have only a + single channel; otherwise we might start a send and a receive at + the same time. */ + if ((sDaemon.ireliable & UUCONF_RELIABLE_FULLDUPLEX) == 0) + sDaemon.cchans = 1; + else + sDaemon.cchans = asProtocols[i].cchans; + /* Run the chat script for when a call is received. */ if (! fchat (qconn, puuconf, &qsys->uuconf_scalled_chat, qsys, (const struct uuconf_dialer *) NULL, (const char *) NULL, @@ -2176,6 +2491,7 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) sstat.ttype = STATUS_FAILED; sstat.ilast = ixsysdep_time ((long *) NULL); (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -2202,15 +2518,16 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) if (qdialer == &sdialer) (void) uuconf_dialer_free (puuconf, &sdialer); - /* Get any jobs queued for the system, and turn on the selected - protocol. */ - if (! fqueue (&sDaemon, (boolean *) NULL) - || ! (*sDaemon.qproto->pfstart) (&sDaemon, &zlog)) + /* Turn on the selected protocol and get any jobs queued for the + system. */ + if (! (*sDaemon.qproto->pfstart) (&sDaemon, &zlog) + || ! fqueue (&sDaemon, (boolean *) NULL)) { uclear_queue (&sDaemon); sstat.ttype = STATUS_FAILED; sstat.ilast = ixsysdep_time ((long *) NULL); (void) fsysdep_set_status (qsys, &sstat); + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return FALSE; } @@ -2276,8 +2593,12 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) iend_time = ixsysdep_time ((long *) NULL); - ulog (LOG_NORMAL, "Call complete (%ld seconds)", - iend_time - istart_time); + ulog (LOG_NORMAL, "Call complete (%ld seconds %ld bytes %ld bps)", + iend_time - istart_time, + sDaemon.csent + sDaemon.creceived, + (iend_time != istart_time + ? (sDaemon.csent + sDaemon.creceived) / (iend_time - istart_time) + : 0)); uclear_queue (&sDaemon); @@ -2288,14 +2609,38 @@ faccept_call (puuconf, zlogin, qconn, pzsystem) sstat.ilast = iend_time; (void) fsysdep_set_status (qsys, &sstat); - (void) uuconf_system_free (puuconf, &ssys); - if (qport == &sport) - (void) uuconf_port_free (puuconf, &sport); - xfree ((pointer) zloc); + if (sDaemon.irunuuxqt == UUCONF_RUNUUXQT_PERCALL + || (sDaemon.irunuuxqt > 0 && sDaemon.cxfiles_received > 0)) + (void) fspawn_uuxqt (TRUE, qsys->uuconf_zname, zconfig); + + uaccept_call_cleanup (puuconf, &ssys, qport, &sport, zloc); return fret; } } + +/* Clean up after faccept_call. */ + +static void +uaccept_call_cleanup (puuconf, qfreesys, qport, qfreeport, zloc) + pointer puuconf; + struct uuconf_system *qfreesys; + struct uuconf_port *qport; + struct uuconf_port *qfreeport; + char *zloc; +{ + if (fLocked_system) + { + (void) fsysdep_unlock_system (&sLocked_system); + fLocked_system = FALSE; + } + if (qfreesys != NULL) + (void) uuconf_system_free (puuconf, qfreesys); + if (qport == qfreeport) + (void) uuconf_port_free (puuconf, qfreeport); + xfree ((pointer) zloc); + ulog_system ((const char *) NULL); +} /* Apply protocol parameters, once we know the protocol. */ @@ -2482,7 +2827,8 @@ zget_uucp_cmd (qconn, frequired) calc += CINCREMENT; znew = zbufalc (calc); - memcpy (znew, zalc, cgot); + if (cgot > 0) + memcpy (znew, zalc, cgot); ubuffree (zalc); zalc = znew; } @@ -2518,13 +2864,16 @@ zget_uucp_cmd (qconn, frequired) return NULL; } -/* Read a sequence of characters up to a newline or carriage return, and - return the line without the line terminating character. */ +/* Read a sequence of characters up to a newline or carriage return, + and return the line without the line terminating character. + Remember whether the last string we returned ended in \r; if it + did, ignore a leading \n to account for \r\n pairs. */ static char * zget_typed_line (qconn) struct sconnection *qconn; { + static boolean flastcr; char *zalc; size_t calc; size_t cgot; @@ -2563,11 +2912,15 @@ zget_typed_line (qconn) } #endif ubuffree (zalc); + flastcr = FALSE; return NULL; } if (b == -1) - continue; + { + flastcr = FALSE; + continue; + } #if DEBUG > 1 if (FDEBUGGING (DEBUG_CHAT)) @@ -2586,19 +2939,34 @@ zget_typed_line (qconn) } #endif + if (b == '\n' && cgot == 0 && flastcr) + { + /* Ignore \n in \r\n pair. */ + flastcr = FALSE; + continue; + } + + flastcr = FALSE; + if (cgot >= calc) { char *znew; calc += CINCREMENT; znew = zbufalc (calc); - memcpy (znew, zalc, cgot); + if (cgot > 0) + memcpy (znew, zalc, cgot); ubuffree (zalc); zalc = znew; } - if (b == '\r' || b == '\n') + if (b == '\n') b = '\0'; + else if (b == '\r') + { + flastcr = TRUE; + b = '\0'; + } zalc[cgot] = (char) b; ++cgot; @@ -2616,3 +2984,45 @@ zget_typed_line (qconn) } } } + +/* Spawn a uuxqt job. This probably belongs in some other file, but I + don't have a good place for it. */ + +boolean +fspawn_uuxqt (ffork, zsys, zconfig) + boolean ffork; + const char *zsys; + const char *zconfig; +{ + char *zsysarg; + char *zconfigarg; + boolean fret; + + if (zsys == NULL) + zsysarg = NULL; + else + { + zsysarg = zbufalc (sizeof "-s" + strlen (zsys)); + sprintf (zsysarg, "-s%s", zsys); + } + + if (zconfig == NULL) + zconfigarg = NULL; + else + { + zconfigarg = zbufalc (sizeof "-I" + strlen (zconfig)); + sprintf (zconfigarg, "-I%s", zconfig); + if (zsysarg == NULL) + { + zsysarg = zconfigarg; + zconfigarg = NULL; + } + } + + fret = fsysdep_run (ffork, "uuxqt", zsysarg, zconfigarg); + + ubuffree (zsysarg); + ubuffree (zconfigarg); + + return fret; +} diff --git a/gnu/libexec/uucp/uucico/xcmd.c b/gnu/libexec/uucp/uucico/xcmd.c index cadf6383dff9..a3dc8671d052 100644 --- a/gnu/libexec/uucp/uucico/xcmd.c +++ b/gnu/libexec/uucp/uucico/xcmd.c @@ -1,7 +1,7 @@ /* xcmd.c Routines to handle work requests. - 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 xcmd_rcsid[] = "$Id: xcmd.c,v 1.1 1993/08/05 18:27:25 conklin Exp $"; +const char xcmd_rcsid[] = "$Id: xcmd.c,v 1.2 1994/05/07 18:14:04 ache Exp $"; #endif #include <errno.h> @@ -77,6 +77,13 @@ flocal_xcmd_request (qtrans, qdaemon) ulog (LOG_NORMAL, "Requesting work: %s to %s", qtrans->s.zfrom, qtrans->s.zto); + + qtrans->fcmd = TRUE; + qtrans->precfn = flocal_xcmd_await_reply; + + if (! fqueue_receive (qdaemon, qtrans)) + return FALSE; + /* We send the string X from to user options We put a dash in front of options. */ @@ -89,16 +96,11 @@ flocal_xcmd_request (qtrans, qdaemon) fret = (*qdaemon->qproto->pfsendcmd) (qdaemon, zsend, qtrans->ilocal, qtrans->iremote); ubuffree (zsend); - if (! fret) - { - utransfree (qtrans); - return FALSE; - } - qtrans->fcmd = TRUE; - qtrans->precfn = flocal_xcmd_await_reply; + if (! fret) + utransfree (qtrans); - return fqueue_receive (qdaemon, qtrans); + return fret; } /* Get a reply to an execution request from the remote system. */ @@ -179,7 +181,8 @@ fremote_xcmd_init (qdaemon, qcmd, iremote) else zconst = zexclam + 1; - zdestfile = zsysdep_local_file (zconst, qsys->uuconf_zpubdir); + zdestfile = zsysdep_local_file (zconst, qsys->uuconf_zpubdir, + (boolean *) NULL); if (zdestfile == NULL) return FALSE; @@ -252,7 +255,8 @@ fremote_xcmd_init (qdaemon, qcmd, iremote) /* Now we have to process each source file. The source specification may or may use wildcards. */ - zfrom = zsysdep_local_file (qcmd->zfrom, qsys->uuconf_zpubdir); + zfrom = zsysdep_local_file (qcmd->zfrom, qsys->uuconf_zpubdir, + (boolean *) NULL); if (zfrom == NULL) { ubuffree (zdestfile); @@ -341,6 +345,7 @@ fremote_xcmd_init (qdaemon, qcmd, iremote) char *zjobid; ssend.bcmd = 'S'; + ssend.bgrade = BDEFAULT_UUCP_GRADE; ssend.pseq = NULL; ssend.zfrom = zfile; ssend.zto = zdestfile; diff --git a/gnu/libexec/uucp/uuconv/Makefile b/gnu/libexec/uucp/uuconv/Makefile index 3bac702630d6..ad5ede05357f 100644 --- a/gnu/libexec/uucp/uuconv/Makefile +++ b/gnu/libexec/uucp/uuconv/Makefile @@ -1,8 +1,10 @@ # Makefile for uuconv -# $Id: Makefile,v 1.1 1993/08/05 18:27:28 conklin Exp $ +# $Id: Makefile,v 1.3 1994/05/31 05:46:34 ache Exp $ BINDIR= $(sbindir) BINOWN= $(owner) +BINGRP= $(group) +BINMODE= 550 PROG= uuconv SRCS= uuconv.c diff --git a/gnu/libexec/uucp/uuconv/uuconv.c b/gnu/libexec/uucp/uuconv/uuconv.c index d91a4e6c7a57..6001000295c4 100644 --- a/gnu/libexec/uucp/uuconv/uuconv.c +++ b/gnu/libexec/uucp/uuconv/uuconv.c @@ -1,7 +1,7 @@ /* uuconv.c Convert one type of UUCP configuration file to another. - 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 "uucnfi.h" #if USE_RCS_ID -const char uuconv_rcsid[] = "$Id: uuconv.c,v 1.1 1993/08/05 18:27:29 conklin Exp $"; +const char uuconv_rcsid[] = "$Id: uuconv.c,v 1.2 1994/05/07 18:14:06 ache Exp $"; #endif #include "getopt.h" @@ -34,6 +34,7 @@ const char uuconv_rcsid[] = "$Id: uuconv.c,v 1.1 1993/08/05 18:27:29 conklin Exp /* Local functions. */ static void uvusage P((void)); +static void uvhelp P((void)); static void uvwrite_time P((FILE *e, struct uuconf_timespan *qtime)); static void uvwrite_string P((FILE *e, const char *zarg, const char *zcmd)); static void uvwrite_size P((FILE *e, struct uuconf_timespan *qsize, @@ -76,6 +77,9 @@ static void uvwrite_taylor_dialer P((FILE *e, struct uuconf_dialer *qdialer, static void uvwrite_hdb_dialer P((FILE *e, struct uuconf_dialer *qdialer)); static void uvuuconf_error P((pointer puuconf, int iret)); +/* The program name. */ +const char *zProgram; + /* A list of Permissions entries built when writing out HDB system information. */ static struct shpermissions *qVperms; @@ -89,7 +93,17 @@ enum tconfig }; /* Long getopt options. */ -static const struct option asVlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asVlongopts[] = +{ + { "input", required_argument, NULL, 'i' }, + { "output", required_argument, NULL, 'o' }, + { "program", required_argument, NULL, 'p' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -109,7 +123,9 @@ main (argc, argv) int iret; pointer pinput; - while ((iopt = getopt_long (argc, argv, "i:I:o:p:x:", asVlongopts, + zProgram = argv[0]; + + while ((iopt = getopt_long (argc, argv, "i:I:o:p:vx:", asVlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -138,8 +154,23 @@ main (argc, argv) /* Set the debugging level. */ break; + case 'v': + /* Print version and exit. */ + fprintf + (stderr, + "%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + uvhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: - /* Long option found and flag set. */ + /* Long option found, and flag value set. */ break; default: @@ -471,6 +502,9 @@ main (argc, argv) } exit (EXIT_SUCCESS); + + /* Avoid complaints about not returning. */ + return 0; } /* Print out a usage message and die. */ @@ -478,20 +512,35 @@ main (argc, argv) static void uvusage () { + fprintf (stderr, "Usage: %s -i input-type -o output-type [-p program]\n", + zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print a help message. */ + +static void +uvhelp () +{ fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + "Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); + fprintf (stderr, "Converts UUCP configuration files from one format to another.\n"); fprintf (stderr, - "Usage: uuconv -i input -o output [-p program] [-I file]\n"); + "Usage: %s -i input -o output [-p program] [-I file]\n", zProgram); fprintf (stderr, - " -i input: Set input type (one of taylor, v2, hdb)\n"); + " -i,--input input: Set input type (one of taylor, v2, hdb)\n"); fprintf (stderr, - " -o output: Set output type (one of taylor, v2, hdb)\n"); + " -o,--output output: Set output type (one of taylor, v2, hdb)\n"); fprintf (stderr, - " -p program: Program to convert (e.g., uucp or cu)\n"); + " -p,--program program: Program to convert (e.g., uucp or cu)\n"); fprintf (stderr, - " -I file: Set Taylor UUCP configuration file to use\n"); - exit (EXIT_FAILURE); + " -I,--config file: Set Taylor UUCP configuration file to use\n"); + fprintf (stderr, + " -v,--version: Print version and exit\n"); + fprintf (stderr, + " --help: Print help and exit\n"); } /* Write out a timespan. */ @@ -1229,18 +1278,17 @@ uvwrite_hdb_system (e, qsys) /* Compare two strings from a Permissions entry, returning TRUE if they are the same. */ + static boolean fvperm_string_cmp (z1, z2) const char *z1; const char *z2; { - if (z1 == NULL - ? z2 != NULL - : z2 == NULL) - return FALSE; - if (z1 == NULL) - return TRUE; + return z2 == NULL; + + if (z2 == NULL) + return FALSE; return strcmp (z1, z2) == 0; } @@ -1253,13 +1301,11 @@ fvperm_array_cmp (pz1, pz2) const char **pz1; const char **pz2; { - if (pz1 == NULL - ? pz2 != NULL - : pz2 == NULL) - return FALSE; - if (pz1 == NULL) - return TRUE; + return pz2 == NULL; + + if (pz2 == NULL) + return FALSE; for (; *pz1 != NULL && *pz2 != NULL; pz1++, pz2++) if (strcmp (*pz1, *pz2) != 0) @@ -1629,6 +1675,9 @@ uvwrite_taylor_port (e, qport, zprefix) case UUCONF_PORTTYPE_TLI: ztype = "tli"; break; + case UUCONF_PORTTYPE_PIPE: + ztype = "pipe"; + break; } fprintf (e, "%stype %s\n", zprefix, ztype); @@ -1681,6 +1730,8 @@ uvwrite_taylor_port (e, qport, zprefix) qm->uuconf_ihighbaud); if (! qm->uuconf_fcarrier) fprintf (e, "%scarrier false\n", zprefix); + if (! qm->uuconf_fhardflow) + fprintf (e, "%shardflow false\n", zprefix); if (qm->uuconf_pzdialer != NULL) { if (qm->uuconf_pzdialer[1] == NULL) @@ -1707,12 +1758,23 @@ uvwrite_taylor_port (e, qport, zprefix) fprintf (e, "%sdevice %s\n", zprefix, qd->uuconf_zdevice); if (qd->uuconf_ibaud != 0) fprintf (e, "%sbaud %ld\n", zprefix, qd->uuconf_ibaud); + if (qd->uuconf_fcarrier) + fprintf (e, "%scarrier true\n", zprefix); + if (! qd->uuconf_fhardflow) + fprintf (e, "%shardflow false\n", zprefix); } break; case UUCONF_PORTTYPE_TCP: if (qport->uuconf_u.uuconf_stcp.uuconf_zport != NULL) fprintf (e, "%sservice %s\n", zprefix, qport->uuconf_u.uuconf_stcp.uuconf_zport); + if (qport->uuconf_u.uuconf_stcp.uuconf_pzdialer != NULL) + { + sprintf (ab, "%sdialer-sequence", zprefix); + uvwrite_string_array (e, + qport->uuconf_u.uuconf_stcp.uuconf_pzdialer, + ab); + } break; case UUCONF_PORTTYPE_TLI: { @@ -1738,6 +1800,18 @@ uvwrite_taylor_port (e, qport, zprefix) qt->uuconf_zservaddr); } break; + case UUCONF_PORTTYPE_PIPE: + { + struct uuconf_pipe_port *qp; + + qp = &qport->uuconf_u.uuconf_spipe; + if (qp->uuconf_pzcmd != NULL) + { + sprintf (ab, "%scommad", zprefix); + uvwrite_string_array (e, qp->uuconf_pzcmd, ab); + } + } + break; } } @@ -1849,6 +1923,8 @@ ivwrite_hdb_port (qport, pinfo) } else if (qport->uuconf_ttype == UUCONF_PORTTYPE_TCP) { + char **pz; + fprintf (e, "TCP"); if (qport->uuconf_zprotocols != NULL) fprintf (e, ",%s", qport->uuconf_zprotocols); @@ -1858,6 +1934,10 @@ ivwrite_hdb_port (qport, pinfo) else fprintf (e, "%s", qport->uuconf_u.uuconf_stcp.uuconf_zport); fprintf (e, " - -"); + pz = qport->uuconf_u.uuconf_stcp.uuconf_pzdialer; + if (pz != NULL) + for (; *pz != NULL; pz++) + fprintf (e, " %s", *pz); } else if (qport->uuconf_ttype == UUCONF_PORTTYPE_TLI) { diff --git a/gnu/libexec/uucp/uucp/Makefile b/gnu/libexec/uucp/uucp/Makefile index 26f2450a48bb..b6af00ea421a 100644 --- a/gnu/libexec/uucp/uucp/Makefile +++ b/gnu/libexec/uucp/uucp/Makefile @@ -1,9 +1,9 @@ # Makefile for uucp -# $Id: Makefile,v 1.1 1993/08/05 18:27:34 conklin Exp $ +# $Id: Makefile,v 1.3 1994/05/31 07:37:14 ache Exp $ BINDIR= $(bindir) BINOWN= $(owner) -BINMODE= 4555 +BINMODE= 4555 PROG= uucp SRCS= uucp.c util.c log.c copy.c diff --git a/gnu/libexec/uucp/uucp/uucp.1 b/gnu/libexec/uucp/uucp/uucp.1 index dec039160de0..36d748b92962 100644 --- a/gnu/libexec/uucp/uucp/uucp.1 +++ b/gnu/libexec/uucp/uucp/uucp.1 @@ -1,5 +1,5 @@ -''' $Id: uucp.1,v 1.1 1993/08/05 18:27:35 conklin Exp $ -.TH uucp 1 "Taylor UUCP 1.04" +''' $Id: uucp.1,v 1.2 1994/05/07 18:14:08 ache Exp $ +.TH uucp 1 "Taylor UUCP 1.05" .SH NAME uucp \- Unix to Unix copy .SH SYNOPSIS @@ -34,6 +34,8 @@ system1!system2!path. Any pathname that does not begin with / or ~ will be appended to the current directory (unless the .B \-W +or +.B \--noexpand option is used); this resulting path will not necessarily exist on a remote system. A pathname beginning with a simple ~ starts at the UUCP public directory; a pathname beginning with ~name starts at the @@ -51,13 +53,15 @@ The copy does not take place immediately, but is queued up for the .I uucico (8) daemon; the daemon is started immediately unless the .B \-r +or +.B \-\-nouucico switch is given. In any case, the next time the remote system is called the file(s) will be copied. .SH OPTIONS The following options may be given to .I uucp. .TP 5 -.B \-c +.B \-c, \-\-nocopy Do not copy local source files to the spool directory. If they are removed before being processed by the .I uucico @@ -65,40 +69,40 @@ removed before being processed by the .I uucico (8) daemon, and by the invoking user. .TP 5 -.B \-C +.B \-C, \-\-copy Copy local source files to the spool directory. This is the default. .TP 5 -.B \-d +.B \-d, \-\-directories Create all necessary directories when doing the copy. This is the default. .TP 5 -.B \-f +.B \-f, \-\-nodirectories If any necessary directories do not exist for the destination path, abort the copy. .TP 5 -.B \-g grade +.B \-g grade, \-\-grade grade Set the grade of the file transfer command. Jobs of a higher grade are executed first. Grades run 0 ... 9 A ... Z a ... z from high to low. .TP 5 -.B \-m +.B \-m, \-\-mail Report completion or failure of the file transfer by .I mail (1). .TP 5 -.B \-n user +.B \-n user, \-\-notify user Report completion or failure of the file transfer by .I mail (1) to the named user on the remote system. .TP 5 -.B \-r +.B \-r, \-\-nouucico Do not start .I uucico (8) daemon immediately; merely queue up the file transfer for later execution. .TP 5 -.B \-j +.B \-j, \-\-jobid Print jobid on standard output. The job may be later cancelled by passing the jobid to the .B \-k @@ -108,18 +112,21 @@ switch of It is possible for some complex operations to produce more than one jobid, in which case each will be printed on a separate line. For example -.EX -uucp sys1!~user1/file1 sys2!~user2/file2 /usr/spool/uucppublic -.EE +.br +.in +0.5i +.nf +uucp sys1!~user1/file1 sys2!~user2/file2 ~user3 +.fi +.in -0.5i will generate two separate jobs, one for the system .I sys1 and one for the system .I sys2. .TP 5 -.B \-W +.B \-W, \-\-noexpand Do not prepend remote relative path names with the current directory. .TP 5 -.B \-x type +.B \-x type, \-\-debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. Only abnormal, config, @@ -127,18 +134,24 @@ spooldir and execute are meaningful for .I uucp. Multiple types may be given, separated by commas, and the -.B \-x +.B \-\-debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, -.B \-x 2 +.B \-\-debug 2 is equivalent to -.B \-x abnormal,chat. +.B \-\-debug abnormal,chat. .TP 5 -.B \-I file +.B \-I file, \-\-config file Set configuration file to use. This option may not be available, depending upon how .I uucp was compiled. +.TP 5 +.B \-v, \-\-version +Report version information and exit. +.TP 5 +.B \-\-help +Print a help message and exit. .SH FILES The file names may be changed at compilation time or by the configuration file, so these are only approximations. @@ -172,4 +185,4 @@ File modes are not preserved, except for the execute bit. The resulting file is owned by the uucp user. .SH AUTHOR Ian Lance Taylor -(ian@airs.com or uunet!airs!ian) +<ian@airs.com> diff --git a/gnu/libexec/uucp/uucp/uucp.c b/gnu/libexec/uucp/uucp/uucp.c index 931c84e7b338..53681071dba9 100644 --- a/gnu/libexec/uucp/uucp/uucp.c +++ b/gnu/libexec/uucp/uucp/uucp.c @@ -1,7 +1,7 @@ /* uucp.c Prepare to copy a file to or from a remote system. - 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 uucp_rcsid[] = "$Id: uucp.c,v 1.1 1993/08/05 18:27:36 conklin Exp $"; +const char uucp_rcsid[] = "$Id: uucp.c,v 1.2 1994/05/07 18:14:10 ache Exp $"; #endif #include <ctype.h> @@ -41,6 +41,7 @@ const char uucp_rcsid[] = "$Id: uucp.c,v 1.1 1993/08/05 18:27:36 conklin Exp $"; /* Local functions. */ static void ucusage P((void)); +static void uchelp P((void)); static void ucdirfile P((const char *zdir, const char *zfile, pointer pinfo)); static void uccopy P((const char *zfile, const char *zdest)); @@ -51,11 +52,29 @@ static const char *zcone_system P((boolean *pfany)); static void ucrecord_file P((const char *zfile)); static void ucabort P((void)); -/* The program name. */ -char abProgram[] = "uucp"; - /* Long getopt options. */ -static const struct option asClongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asClongopts[] = +{ + { "copy", no_argument, NULL, 'C' }, + { "nocopy", no_argument, NULL, 'c' }, + { "directories", no_argument, NULL, 'd' }, + { "nodirectories", no_argument, NULL, 'f' }, + { "grade", required_argument, NULL, 'g' }, + { "jobid", no_argument, NULL, 'j' }, + { "mail", no_argument, NULL, 'm' }, + { "notify", required_argument, NULL, 'n' }, + { "nouucico", no_argument, NULL, 'r' }, + { "recursive", no_argument, NULL, 'R' }, + { "status", required_argument, NULL, 's' }, + { "uuto", no_argument, NULL, 't' }, + { "user", required_argument, NULL, 'u' }, + { "noexpand", no_argument, NULL, 'w' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; /* Local variables. There are a bunch of these, mostly set by the options and the last (the destination) argument. These have file @@ -137,13 +156,16 @@ main (argc, argv) int iuuconf; int i; boolean fgetcwd; + struct uuconf_system slocalsys; char *zexclam; char *zdestfile; const char *zdestsys; char *zoptions; boolean fexit; - while ((iopt = getopt_long (argc, argv, "cCdfg:I:jmn:prRs:tu:Wx:", + zProgram = argv[0]; + + while ((iopt = getopt_long (argc, argv, "cCdfg:I:jmn:prRs:tu:Wvx:", asClongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -232,13 +254,26 @@ main (argc, argv) #endif break; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + uchelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: ucusage (); - break; + /*NOTREACHED*/ } } @@ -335,6 +370,18 @@ main (argc, argv) else if (iuuconf != UUCONF_SUCCESS) ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + /* Get the local system information. */ + iuuconf = uuconf_system_info (puuconf, zClocalname, &slocalsys); + if (iuuconf != UUCONF_SUCCESS) + { + if (iuuconf != UUCONF_NOT_FOUND) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + iuuconf = uuconf_system_local (puuconf, &slocalsys); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + slocalsys.uuconf_zname = (char *) zClocalname; + } + /* If we are emulating uuto, translate the destination argument, and notify the destination user. This had better not turn into something that requires the current directory, or we may have @@ -378,6 +425,8 @@ main (argc, argv) *zoptions++ = 'm'; *zoptions = '\0'; + argv[argc - 1] = zremove_local_sys (&slocalsys, argv[argc - 1]); + zexclam = strchr (argv[argc - 1], '!'); if (zexclam == NULL) { @@ -445,7 +494,8 @@ main (argc, argv) /* Turn the destination into an absolute path, unless it is on a remote system and -W was used. */ if (fClocaldest) - zdestfile = zsysdep_local_file_cwd (zdestfile, sCdestsys.uuconf_zpubdir); + zdestfile = zsysdep_local_file_cwd (zdestfile, sCdestsys.uuconf_zpubdir, + (boolean *) NULL); else if (fCexpand) zdestfile = zsysdep_add_cwd (zdestfile); if (zdestfile == NULL) @@ -462,6 +512,8 @@ main (argc, argv) fCneeds_cwd = FALSE; + argv[i] = zremove_local_sys (&slocalsys, argv[i]); + if (strchr (argv[i], '!') != NULL) { flocal = FALSE; @@ -476,7 +528,8 @@ main (argc, argv) if (fsysdep_needs_cwd (argv[i])) fCneeds_cwd = TRUE; zfrom = zsysdep_local_file_cwd (argv[i], - sCdestsys.uuconf_zpubdir); + sCdestsys.uuconf_zpubdir, + (boolean *) NULL); if (zfrom == NULL) ucabort (); } @@ -524,12 +577,35 @@ main (argc, argv) boolean fany; zsys = zcone_system (&fany); - if (zsys != NULL) - fexit = fsysdep_run ("uucico", "-s", zsys); - else if (fany) - fexit = fsysdep_run ("uucico", "-r1", (const char *) NULL); - else + + if (zsys == NULL && ! fany) fexit = TRUE; + else + { + const char *zarg; + char *zconfigarg; + + if (zsys == NULL) + zarg = "-r1"; + else + { + char *z; + + z = zbufalc (sizeof "-Cs" + strlen (zsys)); + sprintf (z, "-Cs%s", zsys); + zarg = z; + } + + if (zconfig == NULL) + zconfigarg = NULL; + else + { + zconfigarg = zbufalc (sizeof "-I" + strlen (zconfig)); + sprintf (zconfigarg, "-I%s", zconfig); + } + + fexit = fsysdep_run (FALSE, "uucico", zarg, zconfigarg); + } } usysdep_exit (fexit); @@ -538,49 +614,45 @@ main (argc, argv) return 0; } +/* Print usage message and die. */ + static void ucusage () { fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + "Usage: %s [options] file1 [file2 ...] dest\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print help message. */ + +static void +uchelp () +{ + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); - fprintf (stderr, - "Usage: uucp [options] file1 [file2 ...] dest\n"); - fprintf (stderr, - " -c: Do not copy local files to spool directory\n"); - fprintf (stderr, - " -C, -p: Copy local files to spool directory (default)\n"); - fprintf (stderr, - " -d: Create necessary directories (default)\n"); - fprintf (stderr, - " -f: Do not create directories (fail if they do not exist)\n"); - fprintf (stderr, - " -g grade: Set job grade (must be alphabetic)\n"); - fprintf (stderr, - " -m: Report status of copy by mail\n"); - fprintf (stderr, - " -n user: Report status of copy by mail to remote user\n"); - fprintf (stderr, - " -R: Copy directories recursively\n"); - fprintf (stderr, - " -r: Do not start uucico daemon\n"); - fprintf (stderr, - " -s file: Report completion status to file\n"); - fprintf (stderr, - " -j: Report job id\n"); - fprintf (stderr, - " -W: Do not add current directory to remote filenames\n"); - fprintf (stderr, - " -t: Emulate uuto\n"); - fprintf (stderr, - " -u name: Set user name\n"); - fprintf (stderr, - " -x debug: Set debugging level\n"); + printf ("Usage: %s [options] file1 [file2 ...] dest\n", zProgram); + printf (" -c,--nocopy: Do not copy local files to spool directory\n"); + printf (" -C,-p,--copy: Copy local files to spool directory (default)\n"); + printf (" -d,--directories: Create necessary directories (default)\n"); + printf (" -f,--nodirectories: Do not create directories (fail if they do not exist)\n"); + printf (" -g,--grade grade: Set job grade (must be alphabetic)\n"); + printf (" -m,--mail: Report status of copy by mail\n"); + printf (" -n,--notify user: Report status of copy by mail to remote user\n"); + printf (" -R,--recursive: Copy directories recursively\n"); + printf (" -r,--nouucico: Do not start uucico daemon\n"); + printf (" -s,--status file: Report completion status to file\n"); + printf (" -j,--jobid: Report job id\n"); + printf (" -W,--noexpand: Do not add current directory to remote filenames\n"); + printf (" -t,--uuto: Emulate uuto\n"); + printf (" -u,--usage name: Set user name\n"); + printf (" -x,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); + printf (" -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ - exit (EXIT_FAILURE); + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); } /* This is called for each file in a directory heirarchy. */ @@ -713,7 +785,9 @@ uccopy (zfile, zdest) (fCremote ? (const char *) NULL : zCuser))) - ulog (LOG_FATAL, "Not permitted to send %s", zfile); + ulog (LOG_FATAL, + "Daemon not permitted to send %s (suggest --copy)", + zfile); } else { @@ -730,6 +804,7 @@ uccopy (zfile, zdest) { /* We're not forwarding. Just send the file. */ s.bcmd = 'S'; + s.bgrade = bCgrade; s.pseq = NULL; s.zfrom = zbufcpy (zfile); s.zto = zbufcpy (zdest); @@ -794,6 +869,7 @@ uccopy (zfile, zdest) /* Send the execution file. */ s.bcmd = 'S'; + s.bgrade = bCgrade; s.pseq = NULL; s.zfrom = zbufcpy (abxtname); s.zto = zbufcpy (abxname); @@ -815,6 +891,7 @@ uccopy (zfile, zdest) /* Send the data file. */ s.bcmd = 'S'; + s.bgrade = bCgrade; s.pseq = NULL; s.zfrom = zbufcpy (zfile); s.zto = zbufcpy (abdname); @@ -851,6 +928,7 @@ uccopy (zfile, zdest) clen = zfrom - zexclam - 1; zforward = zbufalc (clen + 1); memcpy (zforward, zexclam + 1, clen); + zforward[clen] = '\0'; } ++zfrom; @@ -925,6 +1003,7 @@ uccopy (zfile, zdest) zto = zbufcpy (zdest); } + s.bgrade = bCgrade; s.pseq = NULL; s.zfrom = zfrom; s.zto = zto; @@ -999,6 +1078,7 @@ uccopy (zfile, zdest) /* Send the execution file. */ s.bcmd = 'S'; + s.bgrade = bCgrade; s.pseq = NULL; s.zfrom = zbufcpy (abtname); s.zto = zbufcpy (abxname); diff --git a/gnu/libexec/uucp/uulog/uulog.c b/gnu/libexec/uucp/uulog/uulog.c index 8756e523bbba..73862a05cb73 100644 --- a/gnu/libexec/uucp/uulog/uulog.c +++ b/gnu/libexec/uucp/uulog/uulog.c @@ -1,7 +1,7 @@ /* uulog.c Display the UUCP log 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,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 uulog_rcsid[] = "$Id: uulog.c,v 1.1 1993/08/05 18:27:40 conklin Exp $"; +const char uulog_rcsid[] = "$Id: uulog.c,v 1.2 1994/05/07 18:14:12 ache Exp $"; #endif #include <ctype.h> @@ -42,15 +42,27 @@ const char uulog_rcsid[] = "$Id: uulog.c,v 1.1 1993/08/05 18:27:40 conklin Exp $ is a very useful program anyhow. It only takes a single -s and/or -u switch. When using HAVE_HDB_LOGGING it requires a system. */ -/* The program name. */ -char abProgram[] = "uulog"; - /* Local functions. */ static void ulusage P((void)); +static void ulhelp P((void)); /* Long getopt options. */ -static const struct option asLlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asLlongopts[] = +{ + { "debuglog", no_argument, NULL, 'D' }, + { "follow", optional_argument, NULL, 2 }, + { "lines", required_argument, NULL, 'n' }, + { "system", required_argument, NULL, 's' }, + { "statslog", no_argument, NULL, 'S' }, + { "user", required_argument, NULL, 'u' }, + { "uuxqtlog", no_argument, NULL, 'x' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'X' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -89,6 +101,8 @@ main (argc, argv) char *zline; size_t cline; + zProgram = argv[0]; + /* Look for a straight number argument, and convert it to -n before passing the arguments to getopt. */ for (i = 0; i < argc; i++) @@ -107,7 +121,7 @@ main (argc, argv) } } - while ((iopt = getopt_long (argc, argv, "Df:FI:n:s:Su:xX:", asLlongopts, + while ((iopt = getopt_long (argc, argv, "Df:FI:n:s:Su:vxX:", asLlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -170,13 +184,35 @@ main (argc, argv) #endif break; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 2: + /* --follow. */ + fforever = TRUE; + if (cshow == 0) + cshow = 10; + if (optarg != NULL) + zsystem = optarg; + break; + + case 1: + /* --help. */ + ulhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: ulusage (); - break; + /*NOTREACHED*/ } } @@ -211,7 +247,7 @@ main (argc, argv) if (iuuconf != UUCONF_SUCCESS) ulog_uuconf (LOG_FATAL, puuconf, iuuconf); - usysdep_initialize (puuconf, 0); + usysdep_initialize (puuconf, INIT_NOCHDIR); if (zsystem != NULL) { @@ -221,15 +257,16 @@ main (argc, argv) { struct uuconf_system ssys; + /* Canonicalize the system name. If we can't find the + system information, just use whatever we were given so + that people can check on systems that logged in + anonymously. */ iuuconf = uuconf_system_info (puuconf, zsystem, &ssys); - if (iuuconf != UUCONF_SUCCESS) + if (iuuconf == UUCONF_SUCCESS) { - if (iuuconf != UUCONF_NOT_FOUND) - ulog_uuconf (LOG_FATAL, puuconf, iuuconf); - ulog (LOG_FATAL, "%s: System not found", zsystem); + zsystem = zbufcpy (ssys.uuconf_zname); + (void) uuconf_system_free (puuconf, &ssys); } - zsystem = zbufcpy (ssys.uuconf_zname); - (void) uuconf_system_free (puuconf, &ssys); } } @@ -247,7 +284,8 @@ main (argc, argv) /* We need a system to find a HDB log file. */ if (zsystem == NULL) - ulusage (); + ulog (LOG_FATAL, + "system name (-s argument) required for HDB format log files"); if (fuuxqt) zprogram = "uuxqt"; @@ -261,6 +299,9 @@ main (argc, argv) sprintf (zalc, zlogfile, zprogram, zsystem); zfile = zalc; + if (! fsysdep_file_exists (zfile)) + ulog (LOG_FATAL, "no log file available for system %s", zsystem); + if (strcmp (zsystem, "ANY") == 0) zsystem = NULL; #endif @@ -344,7 +385,7 @@ main (argc, argv) zlsys = znext; clsys = strcspn (znext, "!"); znext += clsys + 1; - zlsys = znext; + zluser = znext; clsys = strcspn (znext, " \t"); #endif } @@ -411,34 +452,41 @@ static void ulusage () { fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + "Usage: %s [-n #] [-sf system] [-u user] [-xDSF] [-I file] [-X debug]\n", + zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print a help message. */ + +static void +ulhelp () +{ + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); - fprintf (stderr, - "Usage: uulog [-n #] [-sf system] [-u user] [-xDSF] [-I file] [-X debug]\n"); - fprintf (stderr, - " -n: show given number of lines from end of log\n"); - fprintf (stderr, - " -s: print entries for named system\n"); - fprintf (stderr, - " -f: follow entries for named system\n"); - fprintf (stderr, - " -u: print entries for named user\n"); #if HAVE_HDB_LOGGING - fprintf (stderr, - " -x: print uuxqt log rather than uucico log\n"); + printf ("Usage: %s [-n #] [-sf system] [-u user] [-xDS] [-I file] [-X debug]\n", + zProgram); #else - fprintf (stderr, - " -F: follow entries for any system\n"); + printf ("Usage: %s [-n #] [-sf system] [-u user] [-DSF] [-I file] [-X debug]\n", + zProgram); #endif - fprintf (stderr, - " -S: show statistics file\n"); - fprintf (stderr, - " -D: show debugging file\n"); - fprintf (stderr, - " -X debug: Set debugging level (0 for none, 9 is max)\n"); + printf (" -n,--lines: show given number of lines from end of log\n"); + printf (" -s,--system: print entries for named system\n"); + printf (" -f system,--follow=system: follow entries for named system\n"); + printf (" -u,--user user: print entries for named user\n"); +#if HAVE_HDB_LOGGING + printf (" -x,--uuxqt: print uuxqt log rather than uucico log\n"); +#else + printf (" -F,--follow: follow entries for any system\n"); +#endif + printf (" -S,--statslog: show statistics file\n"); + printf (" -D,--debuglog: show debugging file\n"); + printf (" -X,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); + printf (" -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ - exit (EXIT_FAILURE); + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); } diff --git a/gnu/libexec/uucp/uuname/uuname.c b/gnu/libexec/uucp/uuname/uuname.c index 27e34fa0386e..489170e7512e 100644 --- a/gnu/libexec/uucp/uuname/uuname.c +++ b/gnu/libexec/uucp/uuname/uuname.c @@ -1,7 +1,7 @@ /* uuname.c List the names of known remote UUCP sites. - 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 uuname_rcsid[] = "$Id: uuname.c,v 1.1 1993/08/05 18:27:43 conklin Exp $"; +const char uuname_rcsid[] = "$Id: uuname.c,v 1.2 1994/05/07 18:14:13 ache Exp $"; #endif #include "getopt.h" @@ -35,16 +35,22 @@ const char uuname_rcsid[] = "$Id: uuname.c,v 1.1 1993/08/05 18:27:43 conklin Exp #include "uuconf.h" #include "system.h" -/* The program name. */ -char abProgram[] = "uuname"; - /* Local functions. */ static void unusage P((void)); -static void unuuconf_error P((pointer puuconf, int iuuconf)); +static void unhelp P((void)); /* Long getopt options. */ -static const struct option asNlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asNlongopts[] = +{ + { "aliases", no_argument, NULL, 'a' }, + { "local", no_argument, NULL, 'l' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -61,7 +67,9 @@ main (argc, argv) pointer puuconf; int iuuconf; - while ((iopt = getopt_long (argc, argv, "alI:x:", asNlongopts, + zProgram = argv[0]; + + while ((iopt = getopt_long (argc, argv, "alI:vx:", asNlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -89,13 +97,26 @@ main (argc, argv) #endif break; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + unhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: unusage (); - break; + /*NOTREACHED*/ } } @@ -104,7 +125,7 @@ main (argc, argv) iuuconf = uuconf_init (&puuconf, (const char *) NULL, zconfig); if (iuuconf != UUCONF_SUCCESS) - unuuconf_error (puuconf, iuuconf); + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); #if DEBUG > 1 { @@ -118,7 +139,7 @@ main (argc, argv) } #endif - usysdep_initialize (puuconf, INIT_SUID); + usysdep_initialize (puuconf, INIT_SUID | INIT_NOCHDIR); if (flocal) { @@ -132,7 +153,7 @@ main (argc, argv) usysdep_exit (FALSE); } else if (iuuconf != UUCONF_SUCCESS) - unuuconf_error (puuconf, iuuconf); + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); printf ("%s\n", zlocalname); } else @@ -141,7 +162,7 @@ main (argc, argv) iuuconf = uuconf_system_names (puuconf, &pznames, falias); if (iuuconf != UUCONF_SUCCESS) - unuuconf_error (puuconf, iuuconf); + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); for (pz = pznames; *pz != NULL; pz++) printf ("%s\n", *pz); @@ -159,34 +180,23 @@ static void unusage () { fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", - VERSION); - fprintf (stderr, - "Usage: uuname [-a] [-l] [-I file]\n"); - fprintf (stderr, - " -a: display aliases\n"); - fprintf (stderr, - " -l: print local name\n"); -#if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); -#endif /* HAVE_TAYLOR_CONFIG */ + "Usage: %s [-a] [-l] [-I file]\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); exit (EXIT_FAILURE); } -/* Display a uuconf error and exit. */ +/* Print a help message. */ -static void -unuuconf_error (puuconf, iret) - pointer puuconf; - int iret; +static void unhelp () { - char ab[512]; - - (void) uuconf_error_string (puuconf, iret, ab, sizeof ab); - if ((iret & UUCONF_ERROR_FILENAME) == 0) - fprintf (stderr, "uuname: %s\n", ab); - else - fprintf (stderr, "uuname:%s\n", ab); - exit (EXIT_FAILURE); + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + VERSION); + printf ("Usage: %s [-a] [-l] [-I file]\n", zProgram); + printf (" -a,--aliases: display aliases\n"); + printf (" -l,--local: print local name\n"); +#if HAVE_TAYLOR_CONFIG + printf (" -I,--config file: Set configuration file to use\n"); +#endif /* HAVE_TAYLOR_CONFIG */ + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); } diff --git a/gnu/libexec/uucp/uupick/uupick.c b/gnu/libexec/uucp/uupick/uupick.c index a28c265abed1..d31e63780e1b 100644 --- a/gnu/libexec/uucp/uupick/uupick.c +++ b/gnu/libexec/uucp/uupick/uupick.c @@ -1,7 +1,7 @@ /* uupick.c Get files stored in the public directory by uucp -t. - 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 uupick_rcsid[] = "$Id: uupick.c,v 1.1 1993/08/05 18:27:50 conklin Exp $"; +const char uupick_rcsid[] = "$Id: uupick.c,v 1.2 1994/05/07 18:14:15 ache Exp $"; #endif #include <errno.h> @@ -43,15 +43,21 @@ static void upmovedir P((const char *zfull, const char *zrelative, pointer pinfo)); static void upmove P((const char *zfrom, const char *zto)); -/* The program name. */ -char abProgram[] = "uupick"; - /* Long getopt options. */ -static const struct option asPlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asPlongopts[] = +{ + { "system", required_argument, NULL, 's' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; /* Local functions. */ static void upusage P((void)); +static void uphelp P((void)); int main (argc, argv) @@ -72,7 +78,9 @@ main (argc, argv) char ab[1000]; boolean fquit; - while ((iopt = getopt_long (argc, argv, "I:s:x:", asPlongopts, + zProgram = "uupick"; + + while ((iopt = getopt_long (argc, argv, "I:s:vx:", asPlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -95,13 +103,28 @@ main (argc, argv) #endif break; + case 'v': + /* Print version and exit. */ + fprintf + (stderr, + "%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + uphelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: upusage (); - break; + /*NOTREACHED*/ } } @@ -152,6 +175,8 @@ main (argc, argv) do { + boolean fbadname; + fcontinue = FALSE; if (zallsys == NULL @@ -196,9 +221,15 @@ main (argc, argv) case 'a': zto = ab + 1 + strspn (ab + 1, " \t"); zto[strcspn (zto, " \t\n")] = '\0'; - zlocal = zsysdep_uupick_local_file (zto); + zlocal = zsysdep_uupick_local_file (zto, &fbadname); if (zlocal == NULL) - usysdep_exit (FALSE); + { + if (! fbadname) + usysdep_exit (FALSE); + ulog (LOG_ERROR, "%s: bad local file name", zto); + fcontinue = TRUE; + break; + } zto = zsysdep_in_dir (zlocal, zfile); ubuffree (zlocal); if (zto == NULL) @@ -271,25 +302,37 @@ main (argc, argv) return 0; } -/* Print usage message. */ +/* Print usage message and die. */ static void upusage () { fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", - VERSION); + "Usage: %s [-s system] [-I config] [-x debug]\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print help message. */ + +static void +uphelp () +{ fprintf (stderr, - "Usage: uupick [-s system] [-I config] [-x debug]\n"); + "Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + VERSION); fprintf (stderr, - " -s system: Only consider files from named system\n"); + " -s,--system system: Only consider files from named system\n"); fprintf (stderr, - " -x debug: Set debugging level\n"); + " -x,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG fprintf (stderr, - " -I file: Set configuration file to use\n"); + " -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ - exit (EXIT_FAILURE); + fprintf (stderr, + " -v,--version: Print version and exit\n"); + fprintf (stderr, + " --help: Print help and exit\n"); } /* This routine is called by usysdep_walk_tree when moving the diff --git a/gnu/libexec/uucp/uusched/uusched.in b/gnu/libexec/uucp/uusched/uusched.in index e539b902fbab..5acb86a5c484 100644 --- a/gnu/libexec/uucp/uusched/uusched.in +++ b/gnu/libexec/uucp/uusched/uusched.in @@ -1,8 +1,8 @@ -: +#!/bin/sh # uusched # Call all systems which have work in a random order # -# Copyright (C) 1992 Ian Lance Taylor +# Copyright (C) 1992, 1993 Ian Lance Taylor # # Please feel free do whatever you like with this exciting shell # script. @@ -10,4 +10,4 @@ # This is pretty trivial, since all the functionality was moved into # uucico itself. # -@SBINDIR@/uucico -r1 $* +exec @SBINDIR@/uucico -r1 $* diff --git a/gnu/libexec/uucp/uustat/uustat.1 b/gnu/libexec/uucp/uustat/uustat.1 index 5d0ed2a08bbc..39b434c00f0e 100644 --- a/gnu/libexec/uucp/uustat/uustat.1 +++ b/gnu/libexec/uucp/uustat/uustat.1 @@ -1,38 +1,102 @@ -''' $Id: uustat.1,v 1.1 1993/08/05 18:28:04 conklin Exp $ -.TH uustat 1 "Taylor UUCP 1.04" +''' $Id: uustat.1,v 1.2 1994/05/07 18:14:22 ache Exp $ +.TH uustat 1 "Taylor UUCP 1.05" .SH NAME uustat \- UUCP status inquiry and control .SH SYNOPSIS .B uustat \-a .PP +.B uustat \-\-all +.PP .B uustat [ -.B \-eKiMNQ ] [ +.B \-eKRiMNQ ] [ .B \-sS system ] [ .B \-uU user ] [ .B \-cC command ] [ -.B \-o -hours ] [ -.B \-y +.B \-oy hours ] [ .B \-B +lines ] [ +.B \-\-executions +] [ +.B \-\-kill-all +] [ +.B \-\-rejuvenate-all +] [ +.B \-\-prompt +] [ +.B \-\-mail +] [ +.B \-\-notify +] [ +.B \-\-no-list +] [ +.B \-\-system +system ] [ +.B \-\-not-system +system ] [ +.B \-\-user +user ] [ +.B \-\-not-user +user ] [ +.B \-\-command +command ] [ +.B \-\-not-command +command ] [ +.B \-\-older-than +hours ] [ +.B \-\-younger-than +hours ] [ +.B \-\-mail-lines lines ] .PP .B uustat [ -.B \-k +.B \-kr jobid ] [ -.B \-r +.B \-\-kill +jobid ] [ +.B \-\-rejuvenate jobid ] .PP -.B uustat \-q +.B uustat \-q [ +.B \-sS +system ] [ +.B \-oy +hours ] [ +.B \-\-system +system ] [ +.B \-\-not-system +system ] [ +.B \-\-older-than +hours ] [ +.B \-\-younger-than +hours ] +.PP +.B uustat \-\-list [ +.B \-sS +system ] [ +.B \-oy +hours ] [ +.B \-\-system +system ] [ +.B \-\-not-system +system ] [ +.B \-\-older-than +hours ] [ +.B \-\-younger-than +hours ] .PP .B uustat \-m .PP +.B uustat \-\-status +.PP .B uustat \-p +.PP +.B uustat \-\-ps .SH DESCRIPTION The .I uustat @@ -46,35 +110,47 @@ system. It can also be used to cancel or rejuvenate requests made by By default .I uustat displays all jobs queued up for the invoking user, as if given the -.B \-u +.B \-\-user option with the appropriate argument. If any of the .B \-a, +.B \-\-all, .B \-e, +.B \-\-executions, .B \-s, +.B \-\-system, .B \-S, +.B \-\-not-system, .B \-u, +.B \-\-user, .B \-U, +.B \-\-not-user, .B \-c, +.B \-\-command, .B \-C, +.B \-\-not-command, .B \-o, -.B \-y +.B \-\-older-than, +.B \-y, +.B \-\-younger-than options are given, then all jobs which match the combined specifications are displayed. The .B \-K +or +.B \-\-kill-all option may be used to kill off a selected group of jobs, such as all jobs more than 7 days old. .SH OPTIONS The following options may be given to .I uustat. .TP 5 -.B \-a +.B \-a, \-\-all List all queued file transfer requests. .TP 5 -.B \-e +.B \-e, \-\-executions List queued execution requests rather than queued file transfer requests. Queued execution requests are processed by .I uuxqt @@ -86,62 +162,82 @@ of .I uux (1). .TP 5 -.B \-s system -List all jobs queued up for the named system. This option may be +.B \-s system, \-\-system system +List all jobs queued up for the named system. These options may be specified multiple times, in which case all jobs for all the systems -will be listed. +will be listed. If used with +.B \-\-list +only the systems named will be listed. .TP 5 -.B \-S system -List all jobs queued for systems other than the one named. This -option may be specified multiple times, in which case no jobs from any -of the specified systems will be listed. This option may not be used -with -.B \-s. +.B \-S system, \-\-not-system system +List all jobs queued for systems other than the one named. These +options may be specified multiple times, in which case no jobs from +any of the specified systems will be listed. If used with +.B \-\-list +only the systems not named will be listed. These options may not be +used with +.B \-s +or +.B \-\-system. .TP 5 -.B \-u user -List all jobs queued up for the named user. This option may be +.B \-u user, \-\-user user +List all jobs queued up for the named user. These options may be specified multiple times, in which case all jobs for all the users will be listed. .TP 5 -.B \-U user -List all jobs queued up for users other than the one named. This -option may be specified multiple times, in which case no jobs from any -of the specified users will be listed. This option may not be used -with -.B \-u. +.B \-U user, \-\-not-user user +List all jobs queued up for users other than the one named. These +options may be specified multiple times, in which case no jobs from +any of the specified users will be listed. These options may not be +used with +.B \-u +or +.B \-\-user. .TP 5 -.B \-c command +.B \-c command, \-\-command command List all jobs requesting the execution of the named command. If .B command is .I ALL this will list all jobs requesting the execution of some command (as -opposed to simply requesting a file transfer). This option may be +opposed to simply requesting a file transfer). These options may be specified multiple times, in which case all jobs requesting any of the commands will be listed. .TP 5 -.B \-C command +.B \-C command, \-\-not-command command List all jobs requesting execution of some command other than the named command, or, if .B command is .I ALL, list all jobs that simply request a file transfer (as opposed to -requesting the execution of some command). This option may be +requesting the execution of some command). These options may be specified multiple times, in which case no job requesting one of the -specified commands will be listed. This option may not be used with -.B \-c. +specified commands will be listed. These options may not be used with +.B \-c +or +.B \-\-command. .TP 5 -.B \-o hours -List all queued jobs older than the given number of hours. +.B \-o hours, \-\-older-than hours +List all queued jobs older than the given number of hours. If used +with +.B \-\-list +only systems whose oldest job is older than the given number of hours +will be listed. .TP 5 -.B \-y hours -List all queued jobs younger than the given number of hours. +.B \-y hours, \-\-younger-than hours +List all queued jobs younger than the given number of hours. If used +with +.B \-\-list +only systems whose oldest job is younger than the given number of +hours will be listed. .TP 5 -.B \-k jobid +.B \-k jobid, \-\-kill jobid Kill the named job. The job id is shown by the default output format, as well as by the .B \-j +or +.B \-\-jobid option to .I uucp (1) or @@ -149,40 +245,59 @@ option to (1). A job may only be killed by the user who created the job, or by the UUCP administrator or the superuser. The .B \-k -option may be used multiple times on the command line to kill several +or +.B \-\-kill +options may be used multiple times on the command line to kill several jobs. .TP 5 -.B \-r jobid +.B \-r jobid, \-\-rejuvenate jobid Rejuvenate the named job. This will mark it as having been invoked at the current time, affecting the output of the -.B \-o +.B \-o, +.B \-\-older-than, +.B \-y, or -.B \-y +.B \-\-younger-than options and preserving it from any automated cleanup daemon. The job id is shown by the default output format, as well as by the .B \-j -option to +or +.B \-\-jobid +options to .I uucp (1) or .I uux (1). A job may only be rejuvenated by the user who created the job, or by the UUCP administrator or the superuser. The .B \-r -option may be used multiple times on the command line to rejuvenate +or +.B \-\-rejuvenate +options may be used multiple times on the command line to rejuvenate several jobs. .TP 5 -.B \-q +.B \-q, \-\-list Display the status of commands, executions and conversations for all -remote systems for which commands or executions are queued. +remote systems for which commands or executions are queued. The +.B \-s, +.B \-\-system, +.B \-S, +.B \-\-not-system, +.B \-o, +.B \-\-older-than, +.B \-y, +and +.B \-\-younger-than +options may be used to restrict the systems which are listed. Systems +for which no commands or executions are queued will never be listed. .TP 5 -.B \-m +.B \-m, \-\-status Display the status of conversations for all remote systems. .TP 5 -.B \-p +.B \-p, \-\-ps Display the status of all processes holding UUCP locks on systems or ports. .TP 5 -.B \-i +.B \-i, \-\-prompt For each listed job, prompt whether to kill the job or not. If the first character of the input line is .I y @@ -190,53 +305,66 @@ or .I Y the job will be killed. .TP 5 -.B \-K +.B \-K, \-\-kill-all Automatically kill each listed job. This can be useful for automatic cleanup scripts, in conjunction with the -.B \-M +.B \-\-mail and -.B \-N +.B \-\-notify options. .TP 5 -.B \-M +.B \-R, \-\-rejuvenate-all +Automatically rejuvenate each listed job. This may not be used with +.B \-\-kill-all. +.TP 5 +.B \-M, \-\-mail For each listed job, send mail to the UUCP administrator. If the job is killed (due to -.B \-K +.B \-\-kill-all or -.B \-i +.B \-\-prompt with an affirmative response) the mail will indicate that. A comment specified by the -.B \-W +.B \-\-comment option may be included. If the job is an execution, the initial portion of its standard input will be included in the mail message; the number of lines to include may be set with the -.B \-B +.B \-\-mail-lines option (the default is 100). If the standard input contains null characters, it is assumed to be a binary file and is not included. .TP 5 -.B \-N +.B \-N, \-\-notify For each listed job, send mail to the user who requested the job. The mail is identical to that sent by the .B \-M -option. +or +.B \-\-mail +options. .TP 5 -.B \-W +.B \-W, \-\-comment Specify a comment to be included in mail sent with the -.B \-M +.B \-M, +.B \-\-mail, +.B \-N, or -.B \-N +.B \-\-notify options. .TP 5 -.B \-Q +.B \-Q, \-\-no-list Do not actually list the job, but only take any actions indicated by the .B \-i, +.B \-\-prompt, .B \-K, +.B \-\-kill-all, .B \-M, +.B \-\-mail, .B \-N +or +.B \-\-notify options. .TP 5 -.B \-x type +.B \-x type, \-\-debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. Only abnormal, config, @@ -244,94 +372,122 @@ spooldir and execute are meaningful for .I uustat. Multiple types may be given, separated by commas, and the -.B \-x +.B \-\-debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, -.B \-x 2 +.B \-\-debug 2 is equivalent to -.B \-x abnormal,chat. +.B \-\-debug abnormal,chat. .TP 5 -.B \-I file +.B \-I file, \-\-config file Set configuration file to use. This option may not be available, depending upon how .I uustat was compiled. +.TP 5 +.B \-v, \-\-version +Report version information and exit. +.TP 5 +.B \-\-help +Print a help message and exit. .SH EXAMPLES -.EX -uustat -a -.EE +.br +.nf +uustat --all +.fi Display status of all jobs. A sample output line is as follows: -.EX +.br +.in +0.5i +.nf bugsA027h bugs ian 04-01 13:50 Executing rmail ian@airs.com (sending 1283 bytes) -.EE +.fi +.in -0.5i The format is -.EX +.br +.in +0.5i +.nf jobid system user queue-date command (size) -.EE +.fi +.in -0.5i The jobid may be passed to the -.B \-k +.B \-\-kill or -.B \-r +.B \-\-rejuvenate options. The size indicates how much data is to be transferred to the remote system, and is absent for a file receive request. The -.B \-s, -.B \-S, -.B \-u, -.B \-U, -.B \-c, -.B \-C, -.B \-o, +.B \-\-system, +.B \-\-not-system, +.B \-\-user, +.B \-\-not-user, +.B \-\-command, +.B \-\-not-command, +.B \-\-older-than, and -.B \-y +.B \-\-younger-than options may be used to control which jobs are listed. -.EX -uustat -e -.EE +.br +.nf +uustat --executions +.fi Display status of queued up execution requests. A sample output line is as follows: -.EX +.br +.in +0.5i +.nf bugs bugs!ian 05-20 12:51 rmail ian -.EE +.fi +.in -0.5i The format is -.EX +.br +.in +0.5i +.nf system requestor queue-date command -.EE +.fi +.in -0.5i The -.B \-s, -.B \-S, -.B \-u, -.B \-U, -.B \-c, -.B \-C, -.B \-o, +.B \-\-system, +.B \-\-not-system, +.B \-\-user, +.B \-\-not-user, +.B \-\-command, +.B \-\-not-command, +.B \-\-older-than, and -.B \-y +.B \-\-younger-than options may be used to control which requests are listed. -.EX -uustat -q -.EE +.br +.nf +uustat --list +.fi Display status for all systems with queued up commands. A sample output line is as follows: -.EX +.br +.in +0.5i +.nf bugs 4C (1 hour) 0X (0 secs) 04-01 14:45 Dial failed -.EE +.fi +.in -0.5i This indicates the system, the number of queued commands, the age of the oldest queued command, the number of queued local executions, the age of the oldest queued execution, the date of the last conversation, and the status of that conversation. -.EX -uustat -m -.EE +.br +.nf +uustat --status +.fi Display conversation status for all remote systems. A sample output line is as follows: -.EX +.br +.in +0.5i +.nf bugs 04-01 15:51 Conversation complete -.EE +.fi +.in -0.5i This indicates the system, the date of the last conversation, and the status of that conversation. If the last conversation failed, .I uustat @@ -340,9 +496,10 @@ the retry period is currently preventing calls to that system, .I uustat also displays the time when the next call will be permitted. -.EX -uustat -p -.EE +.br +.nf +uustat --ps +.fi Display the status of all processes holding UUCP locks. The output format is system dependent, as .I uustat @@ -350,18 +507,21 @@ simply invokes .I ps (1) on each process holding a lock. -.EX -uustat -c rmail -o 168 -K -Q -M -N -W"Queued for over 1 week" -.EE +.br +.in +0.5i +.nf +uustat --command rmail --older-than 168 --kill-all --no-list --mail --notify --comment "Queued for over 1 week" +.fi +.in -0.5i This will kill all .I rmail commands that have been queued up waiting for delivery for over 1 week (168 hours). For each such command, mail will be sent both to the UUCP administrator and to the user who requested the rmail execution. The mail message sent will include the string given by the -.B \-W +.B \-\-comment option. The -.B \-Q +.B \-\-no-list option prevents any of the jobs from being listed on the terminal, so any output from the program will be error messages. .SH FILES @@ -377,4 +537,4 @@ UUCP spool directory. ps(1), rmail(1), uucp(1), uux(1), uucico(8), uuxqt(8) .SH AUTHOR Ian Lance Taylor -(ian@airs.com or uunet!airs!ian) +(ian@airs.com) diff --git a/gnu/libexec/uucp/uustat/uustat.c b/gnu/libexec/uucp/uustat/uustat.c index 450f9e03e521..5bba1a9f5df6 100644 --- a/gnu/libexec/uucp/uustat/uustat.c +++ b/gnu/libexec/uucp/uustat/uustat.c @@ -1,7 +1,7 @@ /* uustat.c UUCP status program - 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,19 +20,21 @@ 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 uustat_rcsid[] = "$Id: uustat.c,v 1.1 1993/08/05 18:28:05 conklin Exp $"; +const char uustat_rcsid[] = "$Id: uustat.c,v 1.2 1994/05/07 18:14:24 ache Exp $"; #endif #include <ctype.h> #include <errno.h> -#if HAVE_TIME_H +#if TM_IN_SYS_TIME +#include <sys/time.h> +#else #include <time.h> #endif @@ -71,16 +73,14 @@ const char uustat_rcsid[] = "$Id: uustat.c,v 1.1 1993/08/05 18:28:05 conklin Exp -xdebug set debugging level -yhour report jobs younger than specified number of hours */ -/* The program name. */ -char abProgram[] = "uustat"; - /* What to do with a job that matches the selection criteria; these values may be or'red together. */ #define JOB_SHOW (01) #define JOB_INQUIRE (02) #define JOB_KILL (04) -#define JOB_MAIL (010) -#define JOB_NOTIFY (020) +#define JOB_REJUVENATE (010) +#define JOB_MAIL (020) +#define JOB_NOTIFY (040) /* This structure is used to accumulate all the lines in a single command file, so that they can all be displayed at once and so that @@ -96,6 +96,7 @@ struct scmdlist /* Local functions. */ static void ususage P((void)); +static void ushelp P((void)); static boolean fsxqt_file_read P((pointer puuconf, const char *zfile)); static void usxqt_file_free P((void)); static int isxqt_cmd P((pointer puuconf, int argc, char **argv, pointer pvar, @@ -139,16 +140,48 @@ static boolean fsexecutions P((pointer puuconf, int icmd, int csystems, static boolean fsnotify P((pointer puuconf, int icmd, const char *zcomment, int cstdin, boolean fkilled, const char *zcmd, struct scmdlist *qcmd, const char *zid, - const char *zuser, + long itime, const char *zuser, const struct uuconf_system *qsys, const char *zstdin, pointer pstdinseq, const char *zrequestor)); -static boolean fsquery P((pointer puuconf)); +static boolean fsquery P((pointer puuconf, int csystems, + char **pazsystems, boolean fnotsystems, + long iold, long iyoung)); static int csunits_show P((long idiff)); static boolean fsmachines P((void)); /* Long getopt options. */ -static const struct option asSlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asSlongopts[] = +{ + { "all", no_argument, NULL, 'a' }, + { "mail-lines", required_argument, NULL, 'B' }, + { "command", required_argument, NULL, 'c' }, + { "not-command", required_argument, NULL, 'C' }, + { "executions", no_argument, NULL, 'e' }, + { "prompt", no_argument, NULL, 'i' }, + { "kill", required_argument, NULL, 'k' }, + { "kill-all", no_argument, NULL, 'K' }, + { "status", no_argument, NULL, 'm' }, + { "mail", no_argument, NULL, 'M' }, + { "notify", no_argument, NULL, 'N' }, + { "older-than", required_argument, NULL, 'o' }, + { "ps", no_argument, NULL, 'p' }, + { "list", no_argument, NULL, 'q' }, + { "no-list", no_argument, NULL, 'Q' }, + { "rejuvenate", required_argument, NULL, 'r' }, + { "rejuvenate-all", no_argument, NULL, 'R' }, + { "system", required_argument, NULL, 's' }, + { "not-system", required_argument, NULL, 'S' }, + { "user", required_argument, NULL, 'u' }, + { "not-user", required_argument, NULL, 'U' }, + { "comment", required_argument, NULL, 'W' }, + { "younger-than", required_argument, NULL, 'y' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -204,8 +237,10 @@ main (argc, argv) const char *azoneuser[1]; boolean fret; + zProgram = argv[0]; + while ((iopt = getopt_long (argc, argv, - "aB:c:C:eiI:k:KmMNo:pqQr:s:S:u:U:W:x:y:", + "aB:c:C:eiI:k:KmMNo:pqQr:Rs:S:u:U:vW:x:y:", asSlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -304,6 +339,11 @@ main (argc, argv) pazrejuvs[crejuvs - 1] = optarg; break; + case 'R': + /* Rejuvenate each listed job. */ + icmd |= JOB_REJUVENATE; + break; + case 'S': /* List jobs for other than specified system. */ fnotsystems = TRUE; @@ -345,13 +385,26 @@ main (argc, argv) iyounghours = (int) strtol (optarg, (char **) NULL, 10); break; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + ushelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; default: ususage (); - break; + /*NOTREACHED*/ } } @@ -371,15 +424,23 @@ main (argc, argv) ++ccmds; if (fps) ++ccmds; - if (fquery) - ++ccmds; - if (fexecute || csystems > 0 || cusers > 0 || ioldhours != -1 + if (fexecute || fquery || csystems > 0 || cusers > 0 || ioldhours != -1 || iyounghours != -1 || ccommands > 0) ++ccmds; + if (fexecute && fquery) + ++ccmds; if (ccmds > 1) { - ulog (LOG_ERROR, "Too many options"); + fprintf (stderr, "%s: too many options\n", zProgram); + ususage (); + } + + if ((icmd & JOB_KILL) != 0 + && (icmd & JOB_REJUVENATE) != 0) + { + fprintf (stderr, "%s: can not both rejuvenate and kill jobs\n", + zProgram); ususage (); } @@ -453,6 +514,7 @@ main (argc, argv) } if (! fexecute + && ! fquery && (fall || csystems > 0 || cusers > 0 @@ -471,12 +533,22 @@ main (argc, argv) else if (icmd != JOB_SHOW) { ulog (LOG_ERROR, - "-i, -K, -M, -N, -Q not supported with -k, -m, -p, -q, -r"); + "-i, -K, -M, -N, -Q, -R not supported with -k, -m, -p, -q, -r"); ususage (); fret = FALSE; } else if (fquery) - fret = fsquery (puuconf); + { + if (cusers > 0 || ccommands > 0) + { + ulog (LOG_ERROR, "-u, -c not supported with -q"); + ususage (); + fret = FALSE; + } + else + fret = fsquery (puuconf, csystems, pazsystems, fnotsystems, + iold, iyoung); + } else if (fmachine) fret = fsmachines (); else if (ckills > 0 || crejuvs > 0) @@ -515,62 +587,48 @@ main (argc, argv) static void ususage () { - fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", - VERSION); - fprintf (stderr, - "Usage: uustat [options]\n"); - fprintf (stderr, - " -a: list all UUCP jobs\n"); - fprintf (stderr, - " -B num: number of lines to return in -M or -N mail message\n"); - fprintf (stderr, - " -c command: list requests for named command\n"); - fprintf (stderr, - " -C command: list requests for other than named command\n"); - fprintf (stderr, - " -e: list queued executions rather than job requests\n"); - fprintf (stderr, - " -i: prompt for whether to kill each listed job\n"); - fprintf (stderr, - " -k job: kill specified UUCP job\n"); - fprintf (stderr, - " -K: kill each listed job\n"); - fprintf (stderr, - " -m: report status for all remote machines\n"); - fprintf (stderr, - " -M: mail report on each listed job to UUCP administrator\n"); - fprintf (stderr, - " -N: mail report on each listed job to requestor\n"); - fprintf (stderr, - " -o hours: list all jobs older than given number of hours\n"); - fprintf (stderr, - " -p: show status of all processes holding UUCP locks\n"); - fprintf (stderr, - " -q: list number of jobs for each system\n"); - fprintf (stderr, - " -Q: don't list jobs, just take actions (-i, -K, -M, -N)\n"); - fprintf (stderr, - " -r job: rejuvenate specified UUCP job\n"); - fprintf (stderr, - " -s system: list all jobs for specified system\n"); - fprintf (stderr, - " -S system: list all jobs for other than specified system\n"); - fprintf (stderr, - " -u user: list all jobs for specified user\n"); - fprintf (stderr, - " -U user: list all jobs for other than specified user\n"); - fprintf (stderr, - " -W comment: comment to include in mail messages\n"); - fprintf (stderr, - " -y hours: list all jobs younger than given number of hours\n"); - fprintf (stderr, - " -x debug: Set debugging level (0 for none, 9 is max)\n"); + fprintf (stderr, "Usage: %s [options]\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); + exit (EXIT_FAILURE); +} + +/* Print a help message. */ + +static void +ushelp () +{ + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + VERSION); + printf ("Usage: %s [options]\n", zProgram); + printf (" -a,--all: list all UUCP jobs\n"); + printf (" -B,--mail-lines num: number of lines to return in -M or -N mail message\n"); + printf (" -c,--command command: list requests for named command\n"); + printf (" -C,--not-command command: list requests for other than named command\n"); + printf (" -e,--executions: list queued executions rather than job requests\n"); + printf (" -i,--prompt: prompt for whether to kill each listed job\n"); + printf (" -k,--kill job: kill specified UUCP job\n"); + printf (" -K,--kill-all: kill each listed job\n"); + printf (" -m,--status: report status for all remote machines\n"); + printf (" -M,--mail: mail report on each listed job to UUCP administrator\n"); + printf (" -N,--notify: mail report on each listed job to requestor\n"); + printf (" -o,--older-than hours: list all jobs older than given number of hours\n"); + printf (" -p,--ps: show status of all processes holding UUCP locks\n"); + printf (" -q,--list: list number of jobs for each system\n"); + printf (" -Q,--no-list: don't list jobs, just take actions (-i, -K, -M, -N)\n"); + printf (" -r,--rejuvenate job: rejuvenate specified UUCP job\n"); + printf (" -R,--rejuvenate-all: rejuvenate each listed job\n"); + printf (" -s,--system system: list all jobs for specified system\n"); + printf (" -S,--not-system system: list all jobs for other than specified system\n"); + printf (" -u,--user user: list all jobs for specified user\n"); + printf (" -U,--not-user user: list all jobs for other than specified user\n"); + printf (" -W,--comment comment: comment to include in mail messages\n"); + printf (" -y,--younger-than hours: list all jobs younger than given number of hours\n"); + printf (" -x,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); + printf (" -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ - exit (EXIT_FAILURE); + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); } /* We need to be able to read information from an execution file. */ @@ -1051,15 +1109,12 @@ fsworkfile_show (puuconf, icmd, qsys, qcmd, itime, ccommands, pazcommands, else zfile = zbufcpy (qshow->s.zfrom); if (zfile == NULL) - cbytes = 0; + cbytes = -1; else - { - cbytes = csysdep_size (zfile); - if (cbytes < 0) - cbytes = 0; - } - printf ("Sending %s (%ld bytes) to %s", - qshow->s.zfrom, cbytes, qshow->s.zto); + cbytes = csysdep_size (zfile); + if (cbytes >= 0) + printf ("Sending %s (%ld bytes) to %s", + qshow->s.zfrom, cbytes, qshow->s.zto); ubuffree (zfile); break; case 'R': @@ -1206,25 +1261,28 @@ fsworkfile_show (puuconf, icmd, qsys, qcmd, itime, ccommands, pazcommands, if (fmatch) { - boolean fkill; + boolean fkill_or_rejuv; - fkill = FALSE; + fkill_or_rejuv = FALSE; if ((icmd & JOB_INQUIRE) != 0) { int b; /* Ask stdin whether this job should be killed. */ - fprintf (stderr, "%s: Kill %s? ", abProgram, zlistid); + fprintf (stderr, "%s: %s %s?", + (icmd & JOB_REJUVENATE) != 0 ? "Rejuvenate" : "Kill", + zProgram, zlistid); (void) fflush (stderr); b = getchar (); - fkill = b == 'y' || b == 'Y'; + fkill_or_rejuv = b == 'y' || b == 'Y'; while (b != EOF && b != '\n') b = getchar (); } - else if ((icmd & JOB_KILL) != 0) - fkill = TRUE; + else if ((icmd & JOB_KILL) != 0 + || (icmd & JOB_REJUVENATE) != 0) + fkill_or_rejuv = TRUE; - if (fkill + if (fkill_or_rejuv && (qlist->s.zuser == NULL || strcmp (zsysdep_login_name (), qlist->s.zuser) != 0) && ! fsysdep_privileged ()) @@ -1233,16 +1291,27 @@ fsworkfile_show (puuconf, icmd, qsys, qcmd, itime, ccommands, pazcommands, { if ((icmd & (JOB_MAIL | JOB_NOTIFY)) != 0) { - if (! fsnotify (puuconf, icmd, zcomment, cstdin, fkill, - zcmd, qlist, zlistid, qlist->s.zuser, - qsys, zstdin, qlist->s.pseq, zrequestor)) + if (! fsnotify (puuconf, icmd, zcomment, cstdin, + (fkill_or_rejuv && + (icmd & JOB_REJUVENATE) == 0), + zcmd, qlist, zlistid, qlist->itime, + qlist->s.zuser, qsys, zstdin, + qlist->s.pseq, zrequestor)) return FALSE; } - if (fkill) + if (fkill_or_rejuv) { - if (! fsysdep_kill_job (puuconf, zlistid)) - return FALSE; + if ((icmd & JOB_REJUVENATE) == 0) + { + if (! fsysdep_kill_job (puuconf, zlistid)) + return FALSE; + } + else + { + if (! fsysdep_rejuvenate_job (puuconf, zlistid)) + return FALSE; + } } } } @@ -1433,7 +1502,7 @@ fsexecutions (puuconf, icmd, csystems, pazsystems, fnotsystems, cusers, if (fmatch) { - boolean fbad, fkill; + boolean fbad, fkill_or_rejuv; struct uuconf_system ssys; fbad = FALSE; @@ -1456,23 +1525,26 @@ fsexecutions (puuconf, icmd, csystems, pazsystems, fnotsystems, cusers, printf ("%s\n", zSxqt_cmd); } - fkill = FALSE; + fkill_or_rejuv = FALSE; if ((icmd & JOB_INQUIRE) != 0) { int b; /* Ask stdin whether this job should be killed. */ - fprintf (stderr, "%s: Kill %s? ", abProgram, zSxqt_cmd); + fprintf (stderr, "%s: %s %s?", + (icmd & JOB_REJUVENATE) != 0 ? "Rejuvenate" : "Kill", + zProgram, zSxqt_cmd); (void) fflush (stderr); b = getchar (); - fkill = b == 'y' || b == 'Y'; + fkill_or_rejuv = b == 'y' || b == 'Y'; while (b != EOF && b != '\n') b = getchar (); } - else if ((icmd & JOB_KILL) != 0) - fkill = TRUE; + else if ((icmd & JOB_KILL) != 0 + || (icmd & JOB_REJUVENATE) != 0) + fkill_or_rejuv = TRUE; - if (fkill) + if (fkill_or_rejuv) { if ((strcmp (zSxqt_user, zsysdep_login_name ()) != 0 || strcmp (zsystem, zlocalname) != 0) @@ -1513,9 +1585,10 @@ fsexecutions (puuconf, icmd, csystems, pazsystems, fnotsystems, cusers, if (! fbad && (icmd & (JOB_MAIL | JOB_NOTIFY)) != 0) { - if (! fsnotify (puuconf, icmd, zcomment, cstdin, fkill, + if (! fsnotify (puuconf, icmd, zcomment, cstdin, + fkill_or_rejuv && (icmd & JOB_REJUVENATE) == 0, zSxqt_cmd, (struct scmdlist *) NULL, - (const char *) NULL, zSxqt_user, &ssys, + (const char *) NULL, itime, zSxqt_user, &ssys, zSxqt_stdin, (pointer) NULL, zSxqt_requestor)) { ferr = TRUE; @@ -1526,7 +1599,7 @@ fsexecutions (puuconf, icmd, csystems, pazsystems, fnotsystems, cusers, } } - if (! fbad && fkill) + if (! fbad && fkill_or_rejuv) { for (i = 0; i < cSxqt_files; i++) { @@ -1536,13 +1609,21 @@ fsexecutions (puuconf, icmd, csystems, pazsystems, fnotsystems, cusers, (pointer) NULL); if (z != NULL) { - (void) remove (z); + if ((icmd & JOB_REJUVENATE) != 0) + (void) fsysdep_touch_file (z); + else + (void) remove (z); ubuffree (z); } } - if (remove (zfile) != 0) - ulog (LOG_ERROR, "remove (%s): %s", zfile, - strerror (errno)); + if ((icmd & JOB_REJUVENATE) != 0) + (void) fsysdep_touch_file (zfile); + else + { + if (remove (zfile) != 0) + ulog (LOG_ERROR, "remove (%s): %s", zfile, + strerror (errno)); + } } if (! fbad) @@ -1562,8 +1643,8 @@ fsexecutions (puuconf, icmd, csystems, pazsystems, fnotsystems, cusers, /* When a job is killed, send mail to the appropriate people. */ static boolean -fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, zuser, - qsys, zstdin, pstdinseq, zrequestor) +fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, itime, + zuser, qsys, zstdin, pstdinseq, zrequestor) pointer puuconf; int icmd; const char *zcomment; @@ -1572,6 +1653,7 @@ fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, zuser, const char *zcmd; struct scmdlist *qcmd; const char *zid; + long itime; const char *zuser; const struct uuconf_system *qsys; const char *zstdin; @@ -1581,6 +1663,8 @@ fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, zuser, const char **pz; int cgot; int i, istdin; + struct tm stime; + char ab[sizeof "1991-12-31 12:00:00"]; const char *zsubject; boolean fret; @@ -1615,7 +1699,14 @@ fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, zuser, pz[i++] = "\n"; } - pz[i++] = "The job "; + pz[i++] = "The job was queued at "; + usysdep_localtime (itime, &stime); + sprintf (ab, "%04d-%02d-%02d %02d:%02d:%02d", + stime.tm_year + 1900, stime.tm_mon + 1, stime.tm_mday, + stime.tm_hour, stime.tm_min, stime.tm_sec); + pz[i++] = ab; + pz[i++] = ".\nIt "; + if (fkilled) pz[i++] = "was\n"; else @@ -1651,6 +1742,7 @@ fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, zuser, break; case 'P': pz[i++] = "\tpoll "; + break; #if DEBUG > 0 case 'E': ulog (LOG_FATAL, "fsnotify: Can't happen"); @@ -1677,7 +1769,8 @@ fsnotify (puuconf, icmd, zcomment, cstdin, fkilled, zcmd, qcmd, zid, zuser, if (fspool) zfile = zsysdep_spool_file_name (qsys, zstdin, pstdinseq); else - zfile = zsysdep_local_file (zstdin, qsys->uuconf_zpubdir); + zfile = zsysdep_local_file (zstdin, qsys->uuconf_zpubdir, + (boolean *) NULL); if (zfile != NULL && (fspool @@ -1827,15 +1920,23 @@ struct sxqtlist static boolean fsquery_system P((const struct uuconf_system *qsys, struct sxqtlist **pq, - long inow, const char *zlocalname)); + long inow, const char *zlocalname, + int csystems, char **pazsystems, + boolean fnotsystems, long iold, long iyoung)); static boolean fsquery_show P((const struct uuconf_system *qsys, int cwork, - long ifirstwork, - struct sxqtlist *qxqt, - long inow, const char *zlocalname)); + long ifirstwork, struct sxqtlist *qxqt, + long inow, const char *zlocalname, + int csystems, char **pazsystems, + boolean fnotsystems, long iold, long iyoung)); static boolean -fsquery (puuconf) +fsquery (puuconf, csystems, pazsystems, fnotsystems, iold, iyoung) pointer puuconf; + int csystems; + char **pazsystems; + boolean fnotsystems; + long iold; + long iyoung; { int iuuconf; const char *zlocalname; @@ -1926,7 +2027,8 @@ fsquery (puuconf) continue; } - if (! fsquery_system (&ssys, &qlist, inow, zlocalname)) + if (! fsquery_system (&ssys, &qlist, inow, zlocalname, csystems, + pazsystems, fnotsystems, iold, iyoung)) fret = FALSE; (void) uuconf_system_free (puuconf, &ssys); @@ -1965,7 +2067,9 @@ fsquery (puuconf) ssys.uuconf_zname = (char *) zlocalname; } - if (! fsquery_show (&ssys, 0, 0L, *pq, inow, zlocalname)) + if (! fsquery_show (&ssys, 0, 0L, *pq, inow, zlocalname, + csystems, pazsystems, fnotsystems, + iold, iyoung)) fret = FALSE; (void) uuconf_system_free (puuconf, &ssys); qfree = *pq; @@ -1991,7 +2095,8 @@ fsquery (puuconf) break; } - if (! fsquery_show (&ssys, 0, 0L, qlist, inow, zlocalname)) + if (! fsquery_show (&ssys, 0, 0L, qlist, inow, zlocalname, + csystems, pazsystems, fnotsystems, iold, iyoung)) fret = FALSE; (void) uuconf_system_free (puuconf, &ssys); qnext = qlist->qnext; @@ -2006,11 +2111,17 @@ fsquery (puuconf) /* Query a single known system. */ static boolean -fsquery_system (qsys, pq, inow, zlocalname) +fsquery_system (qsys, pq, inow, zlocalname, csystems, pazsystems, + fnotsystems, iold, iyoung) const struct uuconf_system *qsys; struct sxqtlist **pq; long inow; const char *zlocalname; + int csystems; + char **pazsystems; + boolean fnotsystems; + long iold; + long iyoung; { int cwork; long ifirstwork; @@ -2065,7 +2176,9 @@ fsquery_system (qsys, pq, inow, zlocalname) if (cwork == 0 && *pq == NULL) return TRUE; - fret = fsquery_show (qsys, cwork, ifirstwork, *pq, inow, zlocalname); + fret = fsquery_show (qsys, cwork, ifirstwork, *pq, inow, + zlocalname, csystems, pazsystems, fnotsystems, + iold, iyoung); if (*pq != NULL) { @@ -2084,13 +2197,19 @@ fsquery_system (qsys, pq, inow, zlocalname) local system specially. */ static boolean -fsquery_show (qsys, cwork, ifirstwork, qxqt, inow, zlocalname) +fsquery_show (qsys, cwork, ifirstwork, qxqt, inow, zlocalname, + csystems, pazsystems, fnotsystems, iold, iyoung) const struct uuconf_system *qsys; int cwork; long ifirstwork; struct sxqtlist *qxqt; long inow; const char *zlocalname; + int csystems; + char **pazsystems; + boolean fnotsystems; + long iold; + long iyoung; { boolean flocal; struct sstatus sstat; @@ -2098,6 +2217,34 @@ fsquery_show (qsys, cwork, ifirstwork, qxqt, inow, zlocalname) struct tm stime; int cpad; + /* Make sure this is one of the systems we are printing. */ + if (csystems > 0) + { + boolean fmatch; + int i; + + fmatch = fnotsystems; + for (i = 0; i < csystems; i++) + { + if (strcmp (pazsystems[i], qsys->uuconf_zname) == 0) + { + fmatch = ! fmatch; + break; + } + } + if (! fmatch) + return TRUE; + } + + /* Make sure the commands are within the time bounds. */ + if ((iold != (long) -1 + && (cwork == 0 || ifirstwork > iold) + && (qxqt == NULL || qxqt->ifirst > iold)) + || (iyoung != (long) -1 + && (cwork == 0 || ifirstwork < iyoung) + && (qxqt == NULL || qxqt->ifirst < iyoung))) + return TRUE; + flocal = strcmp (qsys->uuconf_zname, zlocalname) == 0; if (! flocal) diff --git a/gnu/libexec/uucp/uuto/uuto.in b/gnu/libexec/uucp/uuto/uuto.in index 2d7d96a95870..26a0dc7c15f5 100644 --- a/gnu/libexec/uucp/uuto/uuto.in +++ b/gnu/libexec/uucp/uuto/uuto.in @@ -1,8 +1,8 @@ -: +#!/bin/sh # uuto # Send files to a user on another system. # -# Copyright (C) 1992 Ian Lance Taylor +# Copyright (C) 1992, 1993 Ian Lance Taylor # # Please feel free do whatever you like with this exciting shell # script. @@ -13,4 +13,4 @@ # -c means to not copy the files to the spool directory (may be # overriden by -C or -p). # -@BINDIR@/uucp -t -R -c $* +exec @BINDIR@/uucp -t -R -c $* diff --git a/gnu/libexec/uucp/uux/Makefile b/gnu/libexec/uucp/uux/Makefile index fdb54f87b70a..1fe92f2fa2c2 100644 --- a/gnu/libexec/uucp/uux/Makefile +++ b/gnu/libexec/uucp/uux/Makefile @@ -1,9 +1,9 @@ # Makefile for uux -# $Id: Makefile,v 1.1 1993/08/05 18:28:14 conklin Exp $ +# $Id: Makefile,v 1.3 1994/05/31 07:37:25 ache Exp $ BINDIR= $(bindir) BINOWN= $(owner) -BINMODE= 4555 +BINMODE= 4555 PROG= uux SRCS= uux.c util.c log.c copy.c diff --git a/gnu/libexec/uucp/uux/uux.1 b/gnu/libexec/uucp/uux/uux.1 index d52c77e4d94c..eb8c90de5a24 100644 --- a/gnu/libexec/uucp/uux/uux.1 +++ b/gnu/libexec/uucp/uux/uux.1 @@ -1,5 +1,5 @@ -''' $Id: uux.1,v 1.1 1993/08/05 18:28:17 conklin Exp $ -.TH uux 1 "Taylor UUCP 1.04" +''' $Id: uux.1,v 1.2 1994/05/07 18:14:33 ache Exp $ +.TH uux 1 "Taylor UUCP 1.05" .SH NAME uux \- Remote command execution over UUCP .SH SYNOPSIS @@ -14,9 +14,11 @@ The command is not executed immediately; the request is queued until the .I uucico (8) daemon calls the system and executes it. The daemon is -started automatically unless the +started automatically unless one of the .B \-r -switch is given. +or +.B \-\-nouucico +options is given. The actual command execution is done by the .I uuxqt @@ -54,9 +56,12 @@ not work. All specified files are gathered together into a single directory before execution of the command begins. This means that each file must have a distinct base name. For example, -.EX +.br +.in +0.5i +.nf uux 'sys1!diff sys2!~user1/foo sys3!~user2/foo >!foo.diff' -.EE +.fi +.in -0.5i will fail because both files will be copied to sys1 and stored under the name foo. @@ -68,11 +73,11 @@ command on a remote system. The following options may be given to .I uux. .TP 5 -.B \-,\-p +.B \-, \-p, \-\-stdin Read standard input and use it as the standard input for the command to be executed. .TP 5 -.B \-c +.B \-c, \-\-nocopy Do not copy local files to the spool directory. This is the default. If they are removed before being processed by the @@ -83,20 +88,22 @@ removed before being processed by the as well as the by the invoker of .I uux. .TP 5 -.B \-C +.B \-C, \-\-copy Copy local files to the spool directory. .TP 5 -.B \-l +.B \-l, \-\-link Link local files into the spool directory. If a file can not be linked because it is on a different device, it will be copied unless -the +one of the .B \-c -option also appears (in other words, use of -.B \-l +or +.B \-\-nocopy +options also appears (in other words, use of +.B \-\-link switches the default from -.B \-c +.B \-\-nocopy to -.B \-C). +.B \-\-copy). If the files are changed before being processed by the .I uucico (8) daemon, the changed versions will be used. The files must be @@ -105,51 +112,50 @@ readable by the (8) daemon, as well as by the invoker of .I uux. .TP 5 -.B \-g grade +.B \-g grade, \-\-grade grade Set the grade of the file transfer command. Jobs of a higher grade are executed first. Grades run 0 ... 9 A ... Z a ... z from high to low. .TP 5 -.B \-n +.B \-n, \-\-notification=no Do not send mail about the status of the job, even if it fails. .TP 5 -.B \-z +.B \-z, \-\-notification=error Send mail about the status of the job if an error occurs. For many .I uuxqt daemons, including the Taylor UUCP .I uuxqt, this is the default action; for those, -.B \-z +.B \-\-notification=error will have no effect. However, some .I uuxqt daemons will send mail if the job succeeds unless the -.B \-z +.B \-\-notification=error option is used, and some other .I uuxqt daemons will not send mail if the job fails unless the -.B \-z +.B \-\-notification=error option is used. .TP 5 -.B \-r +.B \-r, \-\-nouucico Do not start the .I uucico (8) daemon immediately; merely queue up the execution request for later processing. .TP 5 -.B \-j +.B \-j, \-\-jobid Print jobids on standard output. A jobid will be generated for each file copy operation required to perform the operation. These file -copies may be cancelled by -passing the jobid to the -.B \-k +copies may be cancelled by passing the jobid to the +.B \-\-kill switch of .I uustat (1), which will make the execution impossible to complete. .TP 5 -.B \-a address +.B \-a address, \-\-requestor address Report job status to the specified e-mail address. .TP 5 -.B \-x type +.B \-x type, \-\-debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. Only abnormal, config, @@ -157,40 +163,51 @@ spooldir and execute are meaningful for .I uux. Multiple types may be given, separated by commas, and the -.B \-x +.B \-\-debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, -.B \-x 2 +.B \-\-debug 2 is equivalent to -.B \-x abnormal,chat. +.B \-\-debug abnormal,chat. .TP 5 -.B \-I file +.B \-I file, \-\-config file Set configuration file to use. This option may not be available, depending upon how .I uux was compiled. +.TP 5 +.B \-v, \-\-version +Report version information and exit. +.TP 5 +.B \-\-help +Print a help message and exit. .SH EXAMPLES -.EX +.br +.nf uux -z - sys1!rmail user1 -.EE +.fi Execute the command ``rmail user1'' on the system sys1, giving it as standard input whatever is given to .I uux as standard input. If a failure occurs, send a message using .I mail (1). -.EX + +.br +.nf uux 'diff -c sys1!~user1/file1 sys2!~user2/file2 >!file.diff' -.EE +.fi Fetch the two named files from system sys1 and system sys2 and execute .I diff putting the result in file.diff in the current directory. The current directory must be writable by the .I uuxqt (8) daemon for this to work. -.EX + +.br +.nf uux 'sys1!uucp ~user1/file1 (sys2!~user2/file2)' -.EE +.fi Execute .I uucp on the system sys1 copying file1 (on system sys1) to sys2. This @@ -226,9 +243,9 @@ mail(1), uustat(1), uucp(1), uucico(8), uuxqt(8) Files can not be referenced across multiple systems. Too many jobids are output by -.B \-j, +.B \-\-jobid, and there is no good way to cancel a local execution requiring remote files. .SH AUTHOR Ian Lance Taylor -(ian@airs.com or uunet!airs!ian) +(ian@airs.com) diff --git a/gnu/libexec/uucp/uux/uux.c b/gnu/libexec/uucp/uux/uux.c index cdcd5f454a6c..8ae0a2e02c60 100644 --- a/gnu/libexec/uucp/uux/uux.c +++ b/gnu/libexec/uucp/uux/uux.c @@ -1,7 +1,7 @@ /* uux.c Prepare to execute a command on a remote system. - 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 uux_rcsid[] = "$Id: uux.c,v 1.1 1993/08/05 18:28:19 conklin Exp $"; +const char uux_rcsid[] = "$Id: uux.c,v 1.4 1994/05/07 18:14:35 ache Exp $"; #endif #include "uudefs.h" @@ -54,9 +54,6 @@ const char uux_rcsid[] = "$Id: uux.c,v 1.1 1993/08/05 18:28:19 conklin Exp $"; operators. */ #define ZSHELLNONREDIRSEPS ";&*| \t" -/* The program name. */ -char abProgram[] = "uux"; - /* The name of the execute file. */ const char *zXxqt_name; @@ -69,9 +66,14 @@ static int cXcmds; /* A file to close if we're forced to exit. */ static FILE *eXclose; + +/* A list of file names which will match the file names which appear + in the uucico logs. */ +static char *zXnames; /* Local functions. */ static void uxusage P((void)); +static void uxhelp P((void)); static void uxadd_xqt_line P((int bchar, const char *z1, const char *z2)); static void uxadd_send_file P((const char *zfrom, const char *zto, const char *zoptions, const char *ztemp, @@ -82,9 +84,29 @@ static void uxadd_send_file P((const char *zfrom, const char *zto, static void uxcopy_stdin P((FILE *e)); static void uxrecord_file P((const char *zfile)); static void uxabort P((void)); +static void uxadd_name P((const char *)); /* Long getopt options. */ -static const struct option asXlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asXlongopts[] = +{ + { "requestor", required_argument, NULL, 'a' }, + { "return-stdin", no_argument, NULL, 'b' }, + { "nocopy", no_argument, NULL, 'c' }, + { "copy", no_argument, NULL, 'C' }, + { "grade", required_argument, NULL, 'g' }, + { "jobid", no_argument, NULL, 'j' }, + { "link", no_argument, NULL, 'l' }, + { "notification", required_argument, NULL, 2 }, + { "stdin", no_argument, NULL, 'p' }, + { "nouucico", no_argument, NULL, 'r' }, + { "status", required_argument, NULL, 's' }, + { "noexpand", no_argument, NULL, 'W' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; /* The main routine. */ @@ -153,40 +175,31 @@ main (argc, argv) struct uuconf_system slocalsys; boolean fneedshell; char *zfullcmd; + char aboptions[10]; boolean fexit; + zProgram = argv[0]; + /* We need to be able to read a single - as an option, which getopt - won't do. So that we can still use getopt, we run through the - options looking for an option "-"; if we find one we change it to - "-p", which is equivalent to "-". */ - for (i = 1; i < argc; i++) + won't do. We handle this by using getopt to scan the argument + list multiple times, replacing any single "-" with "-p". */ + opterr = 0; + while (1) { - if (argv[i][0] != '-') + while (getopt_long (argc, argv, "+a:bcCg:I:jlnprs:Wvx:z", + asXlongopts, (int *) NULL) != EOF) + ; + if (optind >= argc || strcmp (argv[optind], "-") != 0) break; - if (argv[i][1] == '\0') - argv[i] = zbufcpy ("-p"); - else - { - const char *z; - - for (z = argv[i] + 1; *z != '\0'; z++) - { - /* If the option takes an argument, and the argument is - not appended, then skip the next argument. */ - if (*z == 'a' || *z == 'g' || *z == 'I' - || *z == 's' || *z == 'x') - { - if (z[1] == '\0') - i++; - break; - } - } - } + argv[optind] = zbufcpy ("-p"); + optind = 0; } + opterr = 1; + optind = 0; /* The leading + in the getopt string means to stop processing options as soon as a non-option argument is seen. */ - while ((iopt = getopt_long (argc, argv, "+a:bcCg:I:jlnprs:Wx:z", + while ((iopt = getopt_long (argc, argv, "+a:bcCg:I:jlnprs:Wvx:z", asXlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -271,6 +284,41 @@ main (argc, argv) ferror_ack = TRUE; break; + case 2: + /* --notify={true,false,error}. */ + if (*optarg == 't' + || *optarg == 'T' + || *optarg == 'y' + || *optarg == 'Y' + || *optarg == 'e' + || *optarg == 'E') + { + ferror_ack = TRUE; + fno_ack = FALSE; + } + else if (*optarg == 'f' + || *optarg == 'F' + || *optarg == 'n' + || *optarg == 'N') + { + ferror_ack = FALSE; + fno_ack = TRUE; + } + break; + + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + uxhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; @@ -444,32 +492,12 @@ main (argc, argv) iuuconf = uuconf_system_local (puuconf, &slocalsys); if (iuuconf != UUCONF_SUCCESS) ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + slocalsys.uuconf_zname = (char *) zlocalname; } - /* Figure out which system the command is to be executed on. Some - mailers apparently pass local!rmail, so we must explicitly check - for that. */ + /* Figure out which system the command is to be executed on. */ + zcmd = zremove_local_sys (&slocalsys, zcmd); zexclam = strchr (zcmd, '!'); - while (zexclam != NULL) - { - *zexclam = '\0'; - if (strcmp (zcmd, zlocalname) == 0) - ; - else if (slocalsys.uuconf_pzalias == NULL) - break; - else - { - char **pzal; - - for (pzal = slocalsys.uuconf_pzalias; *pzal != NULL; pzal++) - if (strcmp (zcmd, *pzal) == 0) - break; - if (*pzal == NULL) - break; - } - zcmd = zexclam + 1; - zexclam = strchr (zcmd, '!'); - } if (zexclam == NULL) { zsys = zlocalname; @@ -478,6 +506,7 @@ main (argc, argv) } else { + *zexclam = '\0'; zsys = zcmd; zcmd = zexclam + 1; fxqtlocal = FALSE; @@ -587,6 +616,12 @@ main (argc, argv) if (zexclam == NULL && ! finput && ! foutput) continue; + if (zexclam != NULL) + { + pzargs[i] = zremove_local_sys (&slocalsys, pzargs[i]); + zexclam = strchr (pzargs[i], '!'); + } + /* Get the system name and file name for this file. */ if (zexclam == NULL) { @@ -599,22 +634,13 @@ main (argc, argv) { *zexclam = '\0'; zsystem = pzargs[i]; - if (*zsystem != '\0') - flocal = FALSE; - else - { - zsystem = zlocalname; - flocal = TRUE; - } zfile = zexclam + 1; + flocal = FALSE; zexclam = strrchr (zfile, '!'); if (zexclam == NULL) zforw = NULL; else { - if (flocal) - ulog (LOG_FATAL, "!%s: Can't figure out where to get file", - zfile); *zexclam = '\0'; zforw = zfile; zfile = zexclam + 1; @@ -653,7 +679,8 @@ main (argc, argv) /* Turn the file into an absolute path. */ if (flocal) - zfile = zsysdep_local_file_cwd (zfile, sxqtsys.uuconf_zpubdir); + zfile = zsysdep_local_file_cwd (zfile, sxqtsys.uuconf_zpubdir, + (boolean *) NULL); else if (fexpand) zfile = zsysdep_add_cwd (zfile); if (zfile == NULL) @@ -918,6 +945,7 @@ main (argc, argv) spool directory; normally such requests are rejected. This privilege is easy to abuse. */ s.bcmd = 'R'; + s.bgrade = bgrade; s.pseq = NULL; s.zfrom = zfile; s.zto = zbufcpy (abtname); @@ -1113,11 +1141,11 @@ main (argc, argv) if (eXxqt_file == NULL && zinput_from != NULL && zforward == NULL) { struct scmd s; - char aboptions[10]; char *zoptions; /* Set up an E command. */ s.bcmd = 'E'; + s.bgrade = bgrade; s.pseq = NULL; s.zuser = zuser; s.zfrom = zinput_from; @@ -1147,6 +1175,8 @@ main (argc, argv) pasXcmds = (struct scmd *) xrealloc ((pointer) pasXcmds, cXcmds * sizeof (struct scmd)); pasXcmds[cXcmds - 1] = s; + + uxadd_name (zinput_from); } else { @@ -1225,20 +1255,41 @@ main (argc, argv) ulog_system (sxqtsys.uuconf_zname); ulog_user (zuser); - ulog (LOG_NORMAL, "Queuing %s", zfullcmd); + if (zXnames == NULL) + ulog (LOG_NORMAL, "Queuing %s", zfullcmd); + else + ulog (LOG_NORMAL, "Queuing %s (%s)", zfullcmd, zXnames); ulog_close (); - if (! fuucico) + if (! fuucico + || (zcall_system == NULL && ! fcall_any)) fexit = TRUE; else { - if (zcall_system != NULL) - fexit = fsysdep_run ("uucico", "-s", zcall_system); - else if (fcall_any) - fexit = fsysdep_run ("uucico", "-r1", (const char *) NULL); + const char *zcicoarg; + char *zconfigarg; + + if (zcall_system == NULL) + zcicoarg = "-r1"; + else + { + char *z; + + z = zbufalc (sizeof "-Cs" + strlen (zcall_system)); + sprintf (z, "-Cs%s", zcall_system); + zcicoarg = z; + } + + if (zconfig == NULL) + zconfigarg = NULL; else - fexit = TRUE; + { + zconfigarg = zbufalc (sizeof "-I" + strlen (zconfig)); + sprintf (zconfigarg, "-I%s", zconfig); + } + + fexit = fsysdep_run (FALSE, "uucico", zcicoarg, zconfigarg); } usysdep_exit (fexit); @@ -1250,43 +1301,37 @@ main (argc, argv) /* Report command usage. */ static void -uxusage () +uxhelp () { - fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", - VERSION); - fprintf (stderr, - "Usage: uux [options] [-] command\n"); - fprintf (stderr, - " -,-p: Read standard input for standard input of command\n"); - fprintf (stderr, - " -c: Do not copy local files to spool directory (default)\n"); - fprintf (stderr, - " -C: Copy local files to spool directory\n"); - fprintf (stderr, - " -l: link local files to spool directory\n"); - fprintf (stderr, - " -g grade: Set job grade (must be alphabetic)\n"); - fprintf (stderr, - " -n: Do not report completion status\n"); - fprintf (stderr, - " -z: Report completion status only on error\n"); - fprintf (stderr, - " -r: Do not start uucico daemon\n"); - fprintf (stderr, - " -a address: Address to mail status report to\n"); - fprintf (stderr, - " -b: Return standard input with status report\n"); - fprintf (stderr, - " -s file: Report completion status to file\n"); - fprintf (stderr, - " -j: Report job id\n"); - fprintf (stderr, - " -x debug: Set debugging level\n"); + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + VERSION); + printf ("Usage: %s [options] [-] command\n", zProgram); + printf (" -,-p,--stdin: Read standard input for standard input of command\n"); + printf (" -c,--nocopy: Do not copy local files to spool directory (default)\n"); + printf (" -C,--copy: Copy local files to spool directory\n"); + printf (" -l,--link: link local files to spool directory\n"); + printf (" -g,--grade grade: Set job grade (must be alphabetic)\n"); + printf (" -n,--notification=no: Do not report completion status\n"); + printf (" -z,--notification=error: Report completion status only on error\n"); + printf (" -r,--nouucico: Do not start uucico daemon\n"); + printf (" -a,--requestor address: Address to mail status report to\n"); + printf (" -b,--return-stdin: Return standard input with status report\n"); + printf (" -s,--status file: Report completion status to file\n"); + printf (" -j,--jobid: Report job id\n"); + printf (" -x,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); + printf (" -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); +} + +static void +uxusage () +{ + fprintf (stderr, + "Usage: %s [options] [-] command\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); exit (EXIT_FAILURE); } @@ -1366,6 +1411,7 @@ uxadd_send_file (zfrom, zto, zoptions, ztemp, zforward, qxqtsys, zxqtloc, /* Send the execution file. */ s.bcmd = 'S'; + s.bgrade = bgrade; s.pseq = NULL; s.zfrom = zbufcpy (abtname); s.zto = zbufcpy (abxname); @@ -1383,12 +1429,15 @@ uxadd_send_file (zfrom, zto, zoptions, ztemp, zforward, qxqtsys, zxqtloc, cXcmds * sizeof (struct scmd)); pasXcmds[cXcmds - 1] = s; + uxadd_name (abtname); + /* Send the data file to abdname where the execution file will expect it. */ zto = abdname; } s.bcmd = 'S'; + s.bgrade = bgrade; s.pseq = NULL; s.zfrom = zbufcpy (zfrom); s.zto = zbufcpy (zto); @@ -1405,6 +1454,8 @@ uxadd_send_file (zfrom, zto, zoptions, ztemp, zforward, qxqtsys, zxqtloc, pasXcmds = (struct scmd *) xrealloc ((pointer) pasXcmds, cXcmds * sizeof (struct scmd)); pasXcmds[cXcmds - 1] = s; + + uxadd_name (zfrom); } /* Copy stdin to a file. This is a separate function because it may @@ -1500,3 +1551,31 @@ uxabort () ulog_close (); usysdep_exit (FALSE); } + +/* Add a name to the list of file names we are going to log. We log + all the file names which will appear in the uucico log file. This + permits people to associate the file send in the uucico log with + the uux entry which created the file. Normally only one file name + will appear. */ + +static void +uxadd_name (z) + const char *z; +{ + if (zXnames == NULL) + zXnames = zbufcpy (z); + else + { + size_t cold, cadd; + char *znew; + + cold = strlen (zXnames); + cadd = strlen (z); + znew = zbufalc (cold + 2 + cadd); + memcpy (znew, zXnames, cold); + znew[cold] = ' '; + memcpy (znew + cold + 1, z, cadd + 1); + ubuffree (zXnames); + zXnames = znew; + } +} diff --git a/gnu/libexec/uucp/uuxqt/Makefile b/gnu/libexec/uucp/uuxqt/Makefile index 13de6ccfd94a..dd28c2c91ac7 100644 --- a/gnu/libexec/uucp/uuxqt/Makefile +++ b/gnu/libexec/uucp/uuxqt/Makefile @@ -1,16 +1,17 @@ # Makefile for uuxqt -# $Id: Makefile,v 1.2 1993/08/06 23:38:29 rgrimes Exp $ +# $Id: Makefile,v 1.5 1994/05/31 05:46:42 ache Exp $ BINDIR= $(sbindir) BINOWN= $(owner) -BINMODE= 4555 +BINGRP= $(group) +BINMODE= 4550 PROG= uuxqt SRCS= uuxqt.c util.c log.c copy.c LDADD+= $(LIBUNIX) $(LIBUUCONF) $(LIBUUCP) DPADD+= $(LIBUNIX) $(LIBUUCONF) $(LIBUUCP) CFLAGS+= -I$(.CURDIR)/../common_sources\ - -DVERSION=\"$(VERSION)\" + -DVERSION=\"$(VERSION)\" -DOWNER=\"$(owner)\" MAN8= uuxqt.8 diff --git a/gnu/libexec/uucp/uuxqt/uuxqt.8 b/gnu/libexec/uucp/uuxqt/uuxqt.8 index 3664a81f0821..dc48bbb6ca94 100644 --- a/gnu/libexec/uucp/uuxqt/uuxqt.8 +++ b/gnu/libexec/uucp/uuxqt/uuxqt.8 @@ -1,5 +1,5 @@ -''' $Id: uuxqt.8,v 1.1 1993/08/05 18:28:26 conklin Exp $ -.TH uuxqt 8 "Taylor UUCP 1.04" +''' $Id: uuxqt.8,v 1.2 1994/05/07 18:14:41 ache Exp $ +.TH uuxqt 8 "Taylor UUCP 1.05" .SH NAME uuxqt \- UUCP execution daemon .SH SYNOPSIS @@ -17,6 +17,8 @@ It is started automatically by the .I uucico (8) is given the .B \-q +or +.B \-\-nouuxqt option). There is normally no need to run this command, since it will be @@ -34,16 +36,19 @@ configuration command. The following options may be given to .I uuxqt. .TP 5 -.B \-c command +.B \-c command, \-\-command command Only execute requests for the specified command. For example: -.EX -uuxqt -c rmail -.EE +.br +.in +0.5i +.nf +uuxqt --command rmail +.fi +.in -0.5i .TP 5 -.B \-s system +.B \-s system, \-\-system system Only execute requests originating from the specified system. .TP 5 -.B \-x type +.B \-x type, \-\-debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. Only abnormal, config, @@ -51,22 +56,28 @@ spooldir and execute are meaningful for .I uuxqt. Multiple types may be given, separated by commas, and the -.B \-x +.B \-\-debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, -.B \-x 2 +.B \-\-debug 2 is equivalent to -.B \-x abnormal,chat. +.B \-\-debug abnormal,chat. The debugging output is sent to the debugging file, usually one of /usr/spool/uucp/Debug, /usr/spool/uucp/DEBUG, or /usr/spool/uucp/.Admin/audit.local. .TP 5 -.B \-I file +.B \-I file, \-\-config Set configuration file to use. This option may not be available, depending upon how .I uuxqt was compiled. +.TP 5 +.B \-v, \-\-version +Report version information and exit. +.TP 5 +.B \-\-help +Print a help message and exit. .SH FILES The file names may be changed at compilation time or by the configuration file, so these are only approximations. @@ -89,4 +100,4 @@ Debugging file. uucp(1), uux(1), uucico(8) .SH AUTHOR Ian Lance Taylor -(ian@airs.com or uunet!airs!ian) +(ian@airs.com) diff --git a/gnu/libexec/uucp/uuxqt/uuxqt.c b/gnu/libexec/uucp/uuxqt/uuxqt.c index e645e1f242e4..f1c29e02de81 100644 --- a/gnu/libexec/uucp/uuxqt/uuxqt.c +++ b/gnu/libexec/uucp/uuxqt/uuxqt.c @@ -1,7 +1,7 @@ /* uuxqt.c Run uux commands. - 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 uuxqt_rcsid[] = "$Id: uuxqt.c,v 1.1 1993/08/05 18:28:27 conklin Exp $"; +const char uuxqt_rcsid[] = "$Id: uuxqt.c,v 1.2 1994/05/07 18:14:43 ache Exp $"; #endif #include <errno.h> @@ -38,9 +38,6 @@ const char uuxqt_rcsid[] = "$Id: uuxqt.c,v 1.1 1993/08/05 18:28:27 conklin Exp $ #include "uuconf.h" #include "system.h" -/* The program name. */ -char abProgram[] = "uuxqt"; - /* Static variables used to unlock things if we get a fatal error. */ static int iQlock_seq = -1; static const char *zQunlock_cmd; @@ -54,6 +51,7 @@ static char *zQmail; /* Local functions. */ static void uqusage P((void)); +static void uqhelp P((void)); static void uqabort P((void)); static void uqdo_xqt_file P((pointer puuconf, const char *zfile, const char *zbase, @@ -65,7 +63,16 @@ static boolean fqforward P((const char *zfile, char **pzallowed, const char *zlog, const char *zmail)); /* Long getopt options. */ -static const struct option asQlongopts[] = { { NULL, 0, NULL, 0 } }; +static const struct option asQlongopts[] = +{ + { "command", required_argument, 0, 'c' }, + { "system", required_argument, 0, 's' }, + { "config", required_argument, NULL, 'I' }, + { "debug", required_argument, NULL, 'x' }, + { "version", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 1 }, + { NULL, 0, NULL, 0 } +}; int main (argc, argv) @@ -88,7 +95,9 @@ main (argc, argv) boolean fsys; struct uuconf_system ssys; - while ((iopt = getopt_long (argc, argv, "c:I:s:x:", asQlongopts, + zProgram = argv[0]; + + while ((iopt = getopt_long (argc, argv, "c:I:s:vx:", asQlongopts, (int *) NULL)) != EOF) { switch (iopt) @@ -115,6 +124,19 @@ main (argc, argv) #endif break; + case 'v': + /* Print version and exit. */ + printf ("%s: Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", + zProgram, VERSION); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + + case 1: + /* --help. */ + uqhelp (); + exit (EXIT_SUCCESS); + /*NOTREACHED*/ + case 0: /* Long option found and flag set. */ break; @@ -181,15 +203,28 @@ main (argc, argv) fsys = FALSE; - /* If we were given a system name, canonicalize it, since the system - dependent layer will not be returning aliases. */ + /* If we were given a system name, canonicalize it. */ if (zdosys != NULL) { iuuconf = uuconf_system_info (puuconf, zdosys, &ssys); - if (iuuconf == UUCONF_NOT_FOUND) - ulog (LOG_FATAL, "%s: System not found", zdosys); - else if (iuuconf != UUCONF_SUCCESS) - ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + if (iuuconf != UUCONF_SUCCESS) + { + if (iuuconf != UUCONF_NOT_FOUND) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + + if (strcmp (zdosys, zlocalname) == 0) + { + iuuconf = uuconf_system_local (puuconf, &ssys); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + ssys.uuconf_zname = (char *) zlocalname; + } + else + { + if (! funknown_system (puuconf, zdosys, &ssys)) + ulog (LOG_FATAL, "%s: system not found", zdosys); + } + } zdosys = zbufcpy (ssys.uuconf_zname); fsys = TRUE; @@ -225,15 +260,8 @@ main (argc, argv) boolean fprocessed; char *zbase; - /* It would be more efficient to pass zdosys down to the - routines which retrieve execute files. */ - if (zdosys != NULL && strcmp (zdosys, zgetsys) != 0) - { - ubuffree (z); - ubuffree (zgetsys); - continue; - } - + /* Get the system information for the system returned by + zsysdep_get_xqt. */ if (! fsys || strcmp (ssys.uuconf_zname, zgetsys) != 0) { if (fsys) @@ -260,6 +288,7 @@ main (argc, argv) ubuffree (zgetsys); continue; } + ssys.uuconf_zname = (char *) zlocalname; } else { @@ -287,6 +316,15 @@ main (argc, argv) break; } + /* Make sure we are supposed to be executing jobs for this + system. */ + if (zdosys != NULL && strcmp (zdosys, ssys.uuconf_zname) != 0) + { + ubuffree (z); + ubuffree (zgetsys); + continue; + } + zloc = ssys.uuconf_zlocalname; if (zloc == NULL) zloc = zlocalname; @@ -323,23 +361,27 @@ main (argc, argv) } static void -uqusage () +uqhelp () { - fprintf (stderr, - "Taylor UUCP version %s, copyright (C) 1991, 1992 Ian Lance Taylor\n", + printf ("Taylor UUCP %s, copyright (C) 1991, 1992, 1993, 1994 Ian Lance Taylor\n", VERSION); - fprintf (stderr, - "Usage: uuxqt [-c cmd] [-I file] [-s system] [-x debug]\n"); - fprintf (stderr, - " -c cmd: Set type of command to execute\n"); - fprintf (stderr, - " -s system: Execute commands only for named system\n"); - fprintf (stderr, - " -x debug: Set debugging level (0 for none, 9 is max)\n"); + printf ("Usage: %s [-c,--command cmd] [-s,--system system]\n", zProgram); + printf (" -c,--command cmd: Set type of command to execute\n"); + printf (" -s,--system system: Execute commands only for named system\n"); + printf (" -x,--debug debug: Set debugging level\n"); #if HAVE_TAYLOR_CONFIG - fprintf (stderr, - " -I file: Set configuration file to use\n"); + printf (" -I,--config file: Set configuration file to use\n"); #endif /* HAVE_TAYLOR_CONFIG */ + printf (" -v,--version: Print version and exit\n"); + printf (" --help: Print help and exit\n"); +} + +static void +uqusage () +{ + fprintf (stderr, + "Usage: %s [-c,--command cmd] [-s,--system system]\n", zProgram); + fprintf (stderr, "Use %s --help for help\n", zProgram); exit (EXIT_FAILURE); } @@ -449,23 +491,25 @@ static int iquser P((pointer puuconf, int argc, char **argv, pointer pvar, static int iqset P((pointer puuconf, int argc, char **argv, pointer pvar, pointer pinfo)); +/* We are lax about the number of arguments the functions accept, + because there is a lot of variation in what other (buggy) UUCP + packages generate. Unused arguments are ignored. */ + static const struct uuconf_cmdtab asQcmds[] = { { "C", UUCONF_CMDTABTYPE_FN | 0, NULL, iqcmd }, { "I", UUCONF_CMDTABTYPE_STRING, (pointer) &zQinput, NULL }, { "O", UUCONF_CMDTABTYPE_FN | 0, NULL, iqout }, { "F", UUCONF_CMDTABTYPE_FN | 0, NULL, iqfile }, - { "R", UUCONF_CMDTABTYPE_FN, NULL, iqrequestor }, - { "U", UUCONF_CMDTABTYPE_FN | 3, NULL, iquser }, - { "N", UUCONF_CMDTABTYPE_FN | 1, (pointer) &fQno_ack, iqset }, - { "n", UUCONF_CMDTABTYPE_FN | 1, (pointer) &fQsuccess_ack, iqset }, - /* Some systems create execution files in which B takes an argument; - I don't know what it means, so I just ignore it. */ + { "R", UUCONF_CMDTABTYPE_FN | 0, NULL, iqrequestor }, + { "U", UUCONF_CMDTABTYPE_FN | 0, NULL, iquser }, + { "N", UUCONF_CMDTABTYPE_FN | 0, (pointer) &fQno_ack, iqset }, + { "n", UUCONF_CMDTABTYPE_FN | 0, (pointer) &fQsuccess_ack, iqset }, { "B", UUCONF_CMDTABTYPE_FN | 0, (pointer) &fQsend_input, iqset }, #if ALLOW_SH_EXECUTION - { "e", UUCONF_CMDTABTYPE_FN | 1, (pointer) &fQuse_sh, iqset }, + { "e", UUCONF_CMDTABTYPE_FN | 0, (pointer) &fQuse_sh, iqset }, #endif - { "E", UUCONF_CMDTABTYPE_FN | 1, (pointer) &fQuse_exec, iqset }, + { "E", UUCONF_CMDTABTYPE_FN | 0, (pointer) &fQuse_exec, iqset }, { "M", UUCONF_CMDTABTYPE_STRING, (pointer) &zQstatus_file, NULL }, { NULL, 0, NULL, NULL } }; @@ -519,17 +563,9 @@ iqout (puuconf, argc, argv, pvar, pinfo) pointer pvar; pointer pinfo; { - const char *zbase = (const char *) pinfo; - - if (argc != 2 && argc != 3) - { - ulog (LOG_ERROR, "%s: %s: Wrong number of arguments", - zbase, argv[0]); - return UUCONF_CMDTABRET_CONTINUE; - } - - zQoutfile = zbufcpy (argv[1]); - if (argc == 3) + if (argc > 1) + zQoutfile = zbufcpy (argv[1]); + if (argc > 2) zQoutsys = zbufcpy (argv[2]); return UUCONF_CMDTABRET_CONTINUE; @@ -546,14 +582,8 @@ iqfile (puuconf, argc, argv, pvar, pinfo) pointer pvar; pointer pinfo; { - const char *zbase = (const char *) pinfo; - - if (argc != 2 && argc != 3) - { - ulog (LOG_ERROR, "%s: %s: Wrong number of arguments", - zbase, argv[0]); - return UUCONF_CMDTABRET_CONTINUE; - } + if (argc < 2) + return UUCONF_CMDTABRET_CONTINUE; /* If this file is not in the spool directory, just ignore it. */ if (! fspool_file (argv[1])) @@ -566,7 +596,7 @@ iqfile (puuconf, argc, argv, pvar, pinfo) cQfiles * sizeof (char *)); azQfiles[cQfiles - 1] = zbufcpy (argv[1]); - if (argc == 3) + if (argc > 2) azQfiles_to[cQfiles - 1] = zbufcpy (argv[2]); else azQfiles_to[cQfiles - 1] = NULL; @@ -585,22 +615,13 @@ iqrequestor (puuconf, argc, argv, pvar, pinfo) pointer pvar; pointer pinfo; { - const char *zbase = (const char *) pinfo; - - if (argc != 2 && argc != 3) - { - ulog (LOG_ERROR, "%s: %s: Wrong number of arguments", - zbase, argv[0]); - return UUCONF_CMDTABRET_CONTINUE; - } - /* We normally have a single argument, which is the ``requestor'' address, to which we should send any success or error messages. Apparently the DOS program UUPC sends two arguments, which are the username and the host. */ if (argc == 2) zQrequestor = zbufcpy (argv[1]); - else + else if (argc > 2) { zQrequestor = zbufalc (strlen (argv[1]) + strlen (argv[2]) + sizeof "!"); @@ -621,8 +642,10 @@ iquser (puuconf, argc, argv, pvar, pinfo) pointer pvar; pointer pinfo; { - zQuser = argv[1]; - zQsystem = argv[2]; + if (argc > 1) + zQuser = argv[1]; + if (argc > 2) + zQsystem = argv[2]; return UUCONF_CMDTABRET_KEEP; } @@ -680,6 +703,7 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) const char *zmail; char *zoutput; char *zinput; + boolean fbadname; char abtemp[CFILE_NAME_LEN]; char abdata[CFILE_NAME_LEN]; char *zerror; @@ -724,6 +748,40 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) if (iuuconf != UUCONF_SUCCESS) { ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + + /* If we got a non-transient error, we notify the administrator. + We can't bounce it back to the original requestor, because we + don't know how to read the file to figure out who it is (it + would probably be possible to read the file and work it out, + but it doesn't seem worth it for such an unlikely error). */ + if (UUCONF_ERROR_VALUE (iuuconf) == UUCONF_SYNTAX_ERROR + || UUCONF_ERROR_VALUE (iuuconf) == UUCONF_UNKNOWN_COMMAND) + { + const char *az[20]; + char *znew; + + i = 0; + az[i++] = "The execution file\n\t"; + az[i++] = zfile; + az[i++] = "\nfor system\n\t"; + az[i++] = qsys->uuconf_zname; + az[i++] = "\nwas corrupt. "; + znew = zsysdep_save_corrupt_file (zfile); + if (znew == NULL) + { + az[i++] = "The file could not be preserved.\n"; + (void) remove (zfile); + } + else + { + az[i++] = "It has been moved to\n\t"; + az[i++] = znew; + az[i++] = "\n"; + } + (void) fsysdep_mail (OWNER, "Corrupt execution file", i, az); + ubuffree (znew); + } + return; } @@ -780,6 +838,16 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) else ulog_user ("unknown"); + /* zQsystem, if it is set, comes from the execution file, which + means that we do not trust it. We only retain it if + qsys->uuconf_zname is a prefix of it, since that can happen with + a job from an anonymous system on certain spool directory types, + and is unlikely to cause any trouble anyhow. */ + if (zQsystem == NULL + || strncmp (zQsystem, qsys->uuconf_zname, + strlen (qsys->uuconf_zname)) != 0) + zQsystem = qsys->uuconf_zname; + /* Make sure that all the required files exist, and get their full names in the spool directory. */ for (i = 0; i < cQfiles; i++) @@ -823,7 +891,6 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) else if (zQuser != NULL) zmail = zQuser; if (zmail != NULL - && zQsystem != NULL #if HAVE_INTERNET_MAIL && strchr (zmail, '@') == NULL #endif @@ -846,7 +913,7 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) char *zfrom, *zto; boolean fmany; char **azargs; - const char *zuser, *zsystem; + const char *zuser; zfrom = NULL; zto = NULL; @@ -904,12 +971,9 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) zuser = zQuser; if (zuser == NULL) zuser = "uucp"; - zsystem = zQsystem; - if (zsystem == NULL) - zsystem = qsys->uuconf_zname; - azargs[1] = zbufalc (strlen (zsystem) + strlen (zuser) + azargs[1] = zbufalc (strlen (zQsystem) + strlen (zuser) + sizeof "-u!"); - sprintf (azargs[1], "-u%s!%s", zsystem, zuser); + sprintf (azargs[1], "-u%s!%s", zQsystem, zuser); memcpy (azargs + 2, azQargs + 1, i * sizeof (char *)); xfree ((pointer) azQargs); azQargs = azargs; @@ -1067,11 +1131,14 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) char *zreal; fspool = fspool_file (zQinput); - if (fspool) - zreal = zsysdep_spool_file_name (qsys, zQinput, (pointer) NULL); + if (! fspool) + zreal = zsysdep_local_file (zQinput, qsys->uuconf_zpubdir, &fbadname); else - zreal = zsysdep_local_file (zQinput, qsys->uuconf_zpubdir); - if (zreal == NULL) + { + zreal = zsysdep_spool_file_name (qsys, zQinput, (pointer) NULL); + fbadname = FALSE; + } + if (zreal == NULL && ! fbadname) { /* If we get an error, try again later. */ uqcleanup (zfile, iclean &~ (REMOVE_FILE | REMOVE_NEEDED)); @@ -1079,13 +1146,17 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) return; } - zQinput = zreal; - iclean |= FREE_QINPUT; + if (zreal != NULL) + { + zQinput = zreal; + iclean |= FREE_QINPUT; + } - if (! fspool - && ! fin_directory_list (zQinput, qsys->uuconf_pzremote_send, - qsys->uuconf_zpubdir, TRUE, TRUE, - (const char *) NULL)) + if (zreal == NULL + || (! fspool + && ! fin_directory_list (zQinput, qsys->uuconf_pzremote_send, + qsys->uuconf_zpubdir, TRUE, TRUE, + (const char *) NULL))) { ulog (LOG_ERROR, "Not permitted to read %s", zQinput); @@ -1176,22 +1247,30 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) fok = FALSE; else { - zoutput = zsysdep_local_file (zQoutfile, qsys->uuconf_zpubdir); + zoutput = zsysdep_local_file (zQoutfile, qsys->uuconf_zpubdir, + &fbadname); if (zoutput == NULL) { - /* If we get an error, try again later. */ - uqcleanup (zfile, iclean &~ (REMOVE_FILE | REMOVE_NEEDED)); - *pfprocessed = FALSE; - return; + if (! fbadname) + { + /* If we get an error, try again later. */ + uqcleanup (zfile, iclean &~ (REMOVE_FILE | REMOVE_NEEDED)); + *pfprocessed = FALSE; + return; + } + fok = FALSE; + } + else + { + ubuffree (zQoutfile); + zQoutfile = zoutput; + + /* Make sure it's OK to receive this file. */ + fok = fin_directory_list (zQoutfile, + qsys->uuconf_pzremote_receive, + qsys->uuconf_zpubdir, TRUE, FALSE, + (const char *) NULL); } - ubuffree (zQoutfile); - zQoutfile = zoutput; - - /* Make sure it's OK to receive this file. */ - fok = fin_directory_list (zQoutfile, - qsys->uuconf_pzremote_receive, - qsys->uuconf_zpubdir, TRUE, FALSE, - (const char *) NULL); } if (! fok) @@ -1369,6 +1448,7 @@ uqdo_xqt_file (puuconf, zfile, zbase, qsys, zlocalname, zcmd, pfprocessed) /* Fill in the command structure. */ s.bcmd = 'S'; + s.bgrade = BDEFAULT_UUX_GRADE; s.pseq = NULL; s.zfrom = abtemp; s.zto = zQoutfile; |
