diff options
Diffstat (limited to 'gnu/libexec/uucp')
301 files changed, 81222 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/COPYING b/gnu/libexec/uucp/COPYING new file mode 100644 index 000000000000..e77696ae8ddf --- /dev/null +++ b/gnu/libexec/uucp/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, 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 show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/gnu/libexec/uucp/ChangeLog b/gnu/libexec/uucp/ChangeLog new file mode 100644 index 000000000000..48a52b75a285 --- /dev/null +++ b/gnu/libexec/uucp/ChangeLog @@ -0,0 +1,3152 @@ +Sat Feb 13 15:57:30 1993 Ian Lance Taylor (ian@comton.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) + + * 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) + + * Makefile.in (doc-dist): New target. + +Wed Jan 27 22:55:26 1993 Ian Lance Taylor (ian@comton.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) + + * proti.c (fiprocess_data): always send an ACK after receiving + half a window, rather than sometimes resending a packet. Half a + window of short packets can arrive very quickly. + + * 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) + + * trans.c (ufailed): don't report statistics if no bytes + transferred. + + * Makefile.in (install): simplified somewhat. + (dist): distribute the sample directory. + +Sat Jan 23 19:47:12 1993 Ian Lance Taylor (ian@comton.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) + + * 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) + + * uux.c (main): don't use E command if forwarding. + +Wed Jan 20 00:22:38 1993 Ian Lance Taylor (ian@comton.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) + + * trans.h, trans.c (ftcharge, floop, fgot_data): rewrote timing + code. + + * trans.h, trans.c, send.c, rec.c, xcmd.c, protf.c, protz.c + (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) + + * uucico.c (fdo_call, faccept_call): Ted Lindgreen, Chip + Salzenberg: wait for remote hangup string before hanging up. + + * 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) + + * system.h, uucico.c (main), uuxqt.c (main), unix/init.c: Ted + Lindgreen: eliminated INIT_DAEMON. + + * log.c (ulog): don't log SIGINT if fLog_sighup is FALSE. + + * unix/move.c (fsysdep_move_file), unix/xqtsub.c + (fsysdep_move_uuxqt_files): the system call rename seems to fail + on some systems for arbitrary reasons, so always try to copy the + file by hand, not just if we get EXDEV. + + * 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) + + * unix/serial.c (fsserial_lockfile): create HDB lock files when + using HAVE_COHERENT_LOCKING. + unix/cohtty.c (fscoherent_disable_tty): consistently return FALSE + on error. + + * 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) + + * 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) + + * policy.h, unix/proctm.c: Steven S. Dick: use sysconf + (_SC_CLK_TCK) for TIMES_TICK if possible. + + * uuconf/diacod.c: Gregory Gulik: accept an empty dialcode string. + + * system.h, uucico.c (main), uucp.c (main), uux.c (main), + 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) + + * unix/link.c: Andrey G Blochintsev: don't fail just because + destination directories do not exist. + + * send.c (flocal_send_open_file): Scott Ballantyne: record file + name when logging send of execution command. + + * protz.c: Chip Salzenberg: reformatted to 80 columns. + +Tue Dec 29 23:50:52 1992 Ian Lance Taylor (ian@comton.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) + + * system.h, uucp.c (uccopy), uux.c (main), cu.c (icuput, icutake), + unix/ufopen.c (esysdep_user_fopen): Doug Evans: open files used + for %put and %take using esysdep_user_fopen, rather than with + 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) + + * unix/picksb.c (zsysdep_uupick): Peter Wemm: allocation error. + + * uupick.c (main): Peter Wemm: pass INIT_GETCWD to + usysdep_initialize; really quit if 'q' is typed. + + * uulog.c (main): Peter Wemm: always canonicalize system name, not + just if using HDB_LOGGING. + + * uudefs.h, log.c (ustats), trans.c (ufailed), send.c + (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) + + * 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) + + * uuconv.c (uvwrite_taylor_system): mnichols@pacesetter.com: use + command-path rather than path. + + * trans.c (floop): Marc Unangst: don't clear frequested_hangup if + we didn't manage to hang up. + + * uucp.h, rec.c (fremote_send_file_init): Oleg Girko: patches to + make code compile if USE_STDIO is 0. + + * unix/proctm.c: Tim Peiffer: reverse sense of TIMES_TICK check in + hopes of avoiding ISC preprocessor bug. + + * unix/fsusg.h, unix/fsusg.c, unix/bytfre.c, system.h, conf.h.in, + configure.in, unix/Makefile.in, unix/MANIFEST: use new disk space + checking routines from GNU fileutils 3.4. + * unix/opensr.c (zsysdep_receive_temp): don't check free space + here any more. + * policy.h, trans.h, trans.c, rec.c, uucico.c, uudefs.h: Chip + Salzenberg: check amount of remaining space on disk every + 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) + + * 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) + + * 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) + + * lib/buffer.c (ubuffree): scott@geom.umn.edu, Richard Gumpertz: + use a temporary variable to hold the offsetof result. + + * configure.in: scott@geom.umn.edu: define HAVE_SYS_SELECT_H + correctly. + + * protg.c (fgsend_control): Niels Baggesen: report all non-RR + packets if DEBUG_ABNORMAL. + + * unix/cusub.c (uscu_child): Ed Carp: apparently the read and + write calls can get EAGAIN on some systems. + + * unix/status.c (fsysdep_get_status, fsysdep_set_status): Chip + Salzenberg: map status values when using SPOOLDIR_HDB. + + * 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) + + * 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) + + * uuconf/freblk.c: Niels Baggesen: loop over the right list. + + * uulog.c (main): Peter Wemm: added -D, -F and -S options, made -f + 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) + + * rec.c (frec_file_end): Andrey G Blochintsev: call + fsysdep_remember_reception as soon as the file has been moved to + the final destination; write fake execution file via a temporary + file to prevent uuxqt from getting at it early. + * trans.c (usent_receive_ack): don't call + fsysdep_remember_reception here. + + * 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) + + * uustat.c (fsquery_show, csunits_show): Marc Unangst, Chip + Salzenberg: line up uustat -q output. + + * sysh.unx, ftw.c (ftw_dir, ftw), srmdir.c (isremove_dir), walk.c + (iswalk_dir): Marc Unangst: stat argument to function argument to + ftw is const. + + * unix/serial.c (fsserial_set): Mike Bernson: set CSIZE correctly + when changing parity. + + * uux.c (main): Andrew A. Chernov: check for executions which name + the local system, to handle dumb mailers. + + * uucp.h: Doug Evans: #undef strerror if HAVE_STRERROR is 0, to + avoid macro definition on Xenix. + + * unix/serial.c (fsserial_set): Peter Wemm: only check CRTSCTS if + HAVE_POSIX_TERMIOS. + + * cu.c (main): Peter Wemm: use alternates for systems if a call + fails. + + * tstuu.c (uprepare_test): Gerben Wierda: set execute bits for + Chat1 and Chat2. + + * trans.c (floop): Marc Unangst: don't hang up when requested + unless the send queue is empty. + + * uuxqt.c (iqrequestor): Marc Boucher: new function to accept R + command with two arguments, as generated by UUPC. + + * uucico.c (faccept_call): Christian Seyb: don't free the system + info until after writing the status. + + * configure.in: Marc Boucher: check -lsocket and -lnsl together. + + * unix/portnm.c: Stephen J. Walick: it's types.tcp.h, not + tcp.types.h. + + * configure.in: Brian Campbell: check for /usr/bin/mailx. + +Sat Nov 14 11:11:04 1992 Ian Lance Taylor (ian@comton.airs.com) + + * uuconf/hlocnm.c (uuconf_hdb_login_localname): Christian Seyb: + check for _uuconf_unset as well as NULL. + + * conn.c (fconn_dial): initialize *ptdialerfound. + + * many files: rearranged header files to include "sysdep.h" before + system header files. Also eliminated various pedantic warnings, + and made _uuconf_unset char * to avoid possible alignment + problems. + +Tue Nov 10 00:16:35 1992 Ian Lance Taylor (ian@comton.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 + uclear_queue, and call it instead of just doing + usysdep_get_work_free. + + * unix/serial.c (fsserial_lockfile): Marc Unangst: bad #endif + 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) + + * 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) + + * Released gamma version 1.04. + + * configure.in: check that sys/select.h and sys/time.h work + together, since that's how they are currently used. + + * cu.c, uustat.c, uuconf/diacod.c: add casts to eliminate + warnings. + + * configure.in: don't add strlwr to LIBOBJS. + + * 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) + + * tstuu.c: Ralf Stephan: check HAVE_POLL_H and HAVE_STROPTS_H. + + * Nickolay Saukh: accept SVR4 style R request file position. + uudefs.h: added ipos field to struct scmd. + lib/parse.c: accept SVR4 style R request with file position to + start from. + send.c (fremote_rec_file_init): start transferring file from + 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) + + * unix/serial.c (fsysdep_conn_write, fsysdep_conn_io): T. William + Wells: take special care to ensure we don't write after SIGHUP. + + * policy.h, sysh.unx, unix/MANIFEST, unix/Makefile.in, + unix/serial.c (fsserial_lockfile), unix/cohtty.c (new file): Bob + Hemedinger: added HAVE_COHERENT_LOCKFILES. + + * 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) + + * proti.c: various tweaks for bad connections. + + * uucp.h: T. William Wells: rename strcasecmp and strncasecmp, if + the system doesn't provide them, to avoid the ANSI C name space. + + * lib/buffer.c: Bob Hemedinger: put ab in union so that offsetof + will not take the address of an array. + + * 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) + + * uustat.c (fsnotify): Gert Doering: if the file appears to be + binary, don't include it in any mail message. + + * unix/mkdir.c: Michael Yu.Yaroslavtsev: check whether directory + already exists before spawning /bin/mkdir. + + * proti.c: Michael Yu.Yaroslavtsev: iIsendpos and iIrecpos should + be long. + + * send.c (flocal_send_await_reply): Gert Doering: improved error + messages. + + * tli.c, unix/detach.c: include "sysdep.h" before <sys/ioctl.h>. + + * configure.in, conf.h.in: added some system specific checks + provided by autoconf. + + * tstuu.c, unix/serial.c: Merlyn LeRoy: check for ENODATA as well + as EAGAIN and EWOULDBLOCK. + + * uucico.c (faccept_call): Zacharias J. Beckman: if calling back, + clear status first. + + * 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) + + * serial.c (fsmodem_carrier): Hans-Dieter Doll: use IS68K LNOMDM + bit if available. + + * chat.c (fcsend): Hans-Dieter Doll: advance z after EOT. + + * cu.c: T. William Wells: beep on connected and disconnected + messages (only if ANSI_C, to use \a). + + * 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) + + * policy.h, unix/serial.c (fsmodem_close): Stephen J. Walick: + added HAVE_RESET_BUG for SCO Xenix. + + * configure.in: Igor V. Semenyuk: avoid looking in -linet for + getline, since ISC has a different function there by that name. + + * unix/ufopen.c: Igor V. Semenyuk: handle unsigned uid_t. + +Sat Oct 17 11:00:30 1992 Ian Lance Taylor (ian@comton.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) + + * 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) + + * unix/cusub.c (fsysdep_terminal_puts): don't modify zalc before + freeing it up. + + * 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) + + * unix/lock.c: Tomi Vainio: make sure SEEK_SET is defined. + + * tcp.c (ftcp_dial): print a better error message if gethostbyname + doesn't set errno. + + * Stephen J. Walick: configure.in, conf.h.in: check for + <sys/types.tcp.h>. + tcp.c, unix/opensr.c: include <sys/types.tcp.h> if available. + 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) + + * 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) + + * policy.h, unix/serial.c (fsserial_set): added HAVE_STRIP_BUG to + policy.h to get around stupid Ultrix bug. + + * sysh.unx, unix/cusub.c, unix/serial.c (fsserial_open): for + 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) + + * 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) + + * unix/lock.c: check for running process before doing kill. + +Thu Oct 8 00:20:12 1992 Ian Lance Taylor (ian@comton.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. + + * uustat.c (fsnotify): Marc Boucher: don't free string from + uuconf_localname, and only prepend remote system name to execution + requests, not to local UUCP commands. + + * unix/lock.c (fsdo_lock): Marc Boucher: set fret to TRUE before + going around the loop again. + + * uucico.c: Marc Boucher: use 'a' protocol before 'g'. + + * 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) + + * uuname.c (main): Marc Boucher: reverse sense of -a, and do not + display aliases by default. + + * uucico.c (fdo_call): Marc Boucher: some systems only provide 14 + characters in the Shere line. + + * tstuu.c (main): Marc Boucher: add support for STREAMS ptys. + +Tue Oct 6 23:16:15 1992 Ian Lance Taylor (ian@comton.airs.com) + + * policy.h: Marc Boucher: improve comments to describe SVR4. + + * chat.c (fcsend, fcecho_send, fcecho_send_strip, + fcecho_send_nostrip): Marc Boucher: don't send CR after BREAK or + EOT, and let chat-seven-bit apply to echo checking. + + * 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) + + * sysh.unx, unix/serial.c (fsserial_init): Marc Boucher: avoid + freeing unallocated string. + + * unix/serial.c (fsmodem_carrier): Peter Wemm: eliminated useless + undeclared variable which only appeared if HAVE_CLOCAL_BUG. + + * cu.c (main): don't require carrier when opening a direct line. + (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) + + * */Makefile.in: T. William Wells: use ar qc rather than ar rc. + + * many: T. William Wells: renamed isysdep_* functions to + ixsysdep_*, and renamed isfork, isspawn, and isswait similarly, to + avoid ANSI C namespace restrictions. + + * uucp.h: T. William Wells: default size_t to unsigned, not int. + + * configure.in: T. William Wells: new definition for + AC_RETSIGTYPE. + + * configure.in: T. William Wells: test for sh builtin echo. + conf.h.in: default ECHO_PROGRAM to undefined. + + * proti.c (fiprocess_data, fiprocess_packet): fix confusion + between iIremote_winsize and iIrequest_winsize. + + * proti.c (fiwindow_wait, fisenddata): wait for a window opening + before sending SPOS. + + * proti.c (fiprocess_data): don't send a NAK for a duplicate of + the most recent packet. + + * configure.in: Stephen J. Walick: don't use AC_PREFIX, check for + /usr/bin/mail. + + * system.h, sysh.unx, send.c (flocal_send_file_init, + fsend_exec_file_init), rec.c (flocal_rec_file_init, + fremote_send_file_init, frec_file_end), xcmd.c + (fremote_xcmd_init), uuxqt.c (uqdo_xqt_file, uqcleanup), uux.c + (main, uxadd_send_file), uucp.c (main, uccopy), uustat.c + (fsworkfile_show, fsexecutions, fsnotify), unix/filnam.c + (zsfile_name, zsysdep_data_file_name, zsysdep_xqt_file_name), + unix/jobid.c (zsfile_to_jobid, zsjobid_to_file), unix/splcmd.c + (zsysdep_spool_commands), unix/splnam.c (zsysdep_spool_file_name), + spool.c (zsfind_file), statsb.c (fskill_or_rejuv, + isysdep_work_time), work.c (fswork_file, fsysdep_get_work, + zsysdep_jobid, bsgrade): Marc Unangst, Brian Murrell: Corrected + support for SPOOLDIR_SVR4, since SVR4 doesn't use grades in file + names. Changed flocal argument to pseq argument in + zsysdep_spool_file_name, and changed flocal argument to bgrade + argument in zfind_file. Added fxqt argument to + zsysdep_data_file_name. Added bsgrade function. Added bgrade + 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) + + * MANIFEST, Makefile.in, lib/MANIFEST, lib/Makefile.in, + lib/parse.c: moved parse.c from main directory to lib. + + * system.h, unix/size.c, unix/Makefile.in, unix/MANIFEST: moved + csysdep_size into its own file, made it return -1 if the file does + not exist or -2 on other errors. + uustat.c (fsworkfile_show): handle errors from csysdep_size. + send.c (flocal_send_file_init): handle errors from csysdep_size, + removed unneeded calls to fsysdep_file_exists. + + * trans.c (flocal_poll_file), tcp.c (ftcp_dial): Bob Cunningham: + declare functions consistently static. + + * Makefile.in: Marc Unangst: don't run config.status + unnecessarily. + + * configure.in: Marc Unangst: check for socket and t_open in + -lsocket, -lnsl and -lxti. + + * 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) + + * trans.h, uucico.c (fdo_call, faccept_call), parse.c + (fparse_cmd), send.c (flocal_send_request): Gert Doering: SVR4 + UUCP uses a dummy string between the notify field and the size, + for some reason. + + * 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) + + * protg.c (fgsenddata): T. William Wells: clear bytes correctly so + that resending a packet doesn't get a completely incorrect size. + + * 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) + + * 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) + + * uuconf/init.c, uuconf/syssub.c: Lele Gaifax: moved + declaration of _uuconf_unset from syssub.c to addstr.c because + NeXT linker does not pull in object files solely because of + variable declarations. + + * sysh.unx: Lele Gaifax: typo in ftw declaration. + + * 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) + + * Released beta version 1.04. + +Wed Sep 16 01:02:55 1992 Ian Lance Taylor (ian@comton.airs.com) + + * uux.c (main): null terminate the options list for an 'E' + command. + + * ustat.c (fsexecutions): allow privileged users to kill remote + execution files, and handle local executions correctly. + + * uuconf/hinit.c: added parens to avoid warning. + + * unix/splcmd.c: cast to avoid warning. + + * unix/serial.c (fsmodem_close): fixed HAVE_SYSV_TERMIO typo. + + * trans.c (uqueue_receive, floop, fgot_data): improved timing code + to make fewer system calls. + + * send.c (fsend_exec_file_init, fsend_exec_file): handle separate + E file correctly, and make a good statistics file entry for it. + + * Makefile.in, unix/Makefile.in, uuconf/Makefile.in, + 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) + + * 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) + + * uuxqt.c (main): Gregory Bond: canonicalize the system name given + by the -s argument. + + * system.h, uuconf.h, uucico.c (faccept_call), unix/unknwn.c, + unix/Makefile.in, unix/MANIFEST, uuconf/syshdr.unx, + uuconf/remunk.c, uuconf/hrmunk.c, uuconf/Makefile.in, + uuconf/MANIFEST: support HDB remote.unknown shell script. + + * protg.c (igchecksum, igchecksum2): Inspired by Mark Pizzolato, + put in new, improved checksum routines. + + * uuxqt.c (uqdo_xqt_file): make sure the execution file still + exists after locking it. + + * unix/lock.c (fsdo_lock): don't fail if the lock file is removed + between the link and the open. + + * unix/xqtsub.c (fsysdep_execute, fsysdep_lock_uuxqt_dir, + 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) + + * trans.h, uucico.c (fdo_call, faccept_call), send.c + (flocal_send_request), rec.c (flocal_rec_send_request) parse.c + (fparse_cmd): send file size in hex for SVR4 compatibility. + Required new FEATURE_V103 for 1.03 backward compatibility, since + 1.03 requires decimal size. + + * various: eliminated remaining calls to alloca. + + * tcp.c (ftcp_open), tli.c (ftli_open): set FD_CLOEXEC for sockets + and TLI descriptors. + + * tcp.c (ftcp_open): switch to real user ID before binding the + socket when running as a server. This will permit uucico invoked + by root to open privileged TCP ports. Don't switch to real ID if + effective ID is already root, to permit an suid root program to be + invoked by anybody. + + * uuxqt.c (uqdo_xqt_file): removed special case for system which + does not permit any commands: unnecessary and unusual. + + * uucico.c (fconn_call): Ed Carp: clear the SIGHUP signal + indication before opening the modem. + + * trans.h, trans.c (fqueue, fcheck_queue, floop, fgot_data), + send.c (fsend_await_confirm), rec.c (frec_file_send_confirm), + uucico.c (fcall, faccept_call): recheck the work queue every 10 + 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) + + * Makefile.in: use $(MAKE) instead of make for recursive calls. + + * system.h, uucp.c (main), uux.c (main), unix/ufopen.c, + 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) + + * uudefs.h, copy.c: added fcopy_open_file. + + * policy.h: added HAVE_SAVED_SETUID. + + * configure.in, conf.h.in: check for setreuid. + +Tue Sep 8 00:11:10 1992 Ian Lance Taylor (ian@comton.airs.com) + + * protf.c (ffsendcmd), prott.c (ftsendcmd): eliminate calls to + alloca. + + * uucico.c (main), uuxqt.c (main), uux.c (main), uucp.c (main), + uustat.c (main), uuchk.c (main), uuconv.c (main), uuname.c (main), + uulog.c (main), uupick.c (main), cu.c (main), lib/getop1.c, + 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) + + * getopt.h, lib/getopt.c, lib/Makefile.in: bring getopt up to + glibc 1.04; call malloc instead of alloca in exchange. + + * system.h, uucico.c (main), uuxqt.c (main), uux.c (main), uucp.c + (main), uustat.c (main), cu.c (main), uuname.c (main), unix/init.c + (usysdep_initialize): added INIT_SUID, for old systems which don't + do setuid correctly for root. + + * cu.c, unix/cusub.c: various minor improvements. + +Sun Sep 6 20:25:20 1992 Ian Lance Taylor (ian@comton.airs.com) + + * uux.c (uxcopy_stdin): use getchar rather than fread to avoid + SVR4 bug. + + * uucico.c (fsend_uucp_cmd): Niels Baggesen: report message when + DEBUG_HANDSHAKE. + + * 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) + + * 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) + + * system.h, uuxqt.c (uqdo_xqt_file), unix/xqtsub.c + (zsysdep_xqt_local_file): Jarmo Raiha: expand ~name in uuxqt.c. + + * send.c (fremote_rec_reply): SVR4 sends the size of the file with + the RY string, so we do too. We don't look for it, though. + + * uustat.c, uustat.1: Don Phillips: removed all printing of years + and seconds. Hope nobody complains. + + * uucico.c (fdo_call): don't set the status to TALKING until we + see the Shere string. + + * configure.in, conf.h.in, unix/wldcrd.c: if the system has glob, + use it for wildcards. If it doesn't, quote special characters in + the wildcard string. + + * uucico.c (fdo_call): Zacharias Beckman: don't report ``Login + successful'' until we see the Shere string. + + * prot.c (fsend_data): Don Lewis: bug in crec calculation. + + * uustat.c (fsworkfile_show, usworkfile_header, fsnotify): Don + Lewis: show poll files. + + * unix/init.c: check LOGNAME and USER environment variables before + invoking getlogin. + + * 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) + + * chat.c (fcsend), tstuu.c (uchild): Chip Salzenberg: call sleep + (2) instead of sleep (1). Hopefully this won't break any chat + scripts. + + * system.h, parse.c, trans.c (fqueue, flocal_poll_file), uustat.c + (fsworkfiles_system, fsquery_system), unix/work.c + (fsysdep_get_work, fsysdep_get_work_init): don't delete poll files + immediately, but instead return a 'P' command and delete them when + the command is passed to fsysdep_did_work. + + * tstuu.c (uprepare_test): change ``call-request'' to ``request''. + + * uuconf/iniglb.c (_uuconf_itimetable): return CMDTABRET_KEEP so + we don't lose the timetable name and definition. + + * uuconf.h, send.c (fremote_rec_file_init), rec.c + (fremote_send_file_init), uuchk.c (ukshow), uuconv.c + (uvwrite_taylor_system, uvwrite_hdb_system), uuconf/tsinfo.c + (iirequest), uuconf/hsinfo.c, uuconf/hunk.c, uuconf/syssub.c: + added ``send-request'' and ``receive-request'' commands, + eliminated ``call-request'' and ``called-request'' commands. + + * uux.c (main): make sure we are permitted to transfer files + before queuing requests. + + * uuconf.h, uucico.c (fcall), uuconf/tsinfo.c, uuconf/syssub.c: + David Nugent: added ``success-wait'' command for systems, to set a + minimum time between successful calls. + + * send.c (fremote_rec_file_init): Don Phillips: let a request only + specify the file base name in the TO argument. + + * uucico.c (main): Don Lewis: don't exit with success just because + we were able to start uuxqt. + + * unix/serial.c (fsmodem_close, fsserial_read): always drop DTR + 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) + + * uuconf/time.c: Stephen Walick: don't require a comma between + time strings, since HDB doesn't seem to. + + * protg.c (fgcheck_errors): added "error-decay" protocol parameter + to decay errors as packets are successfully received. + + * uustat.c (fsmachines), uustat.1: Chris Lewis: don't display the + year or seconds for uustat -m. Probably uustat -q should be + changed as well. + + * tstuu.c: Larry Fahnoe: don't report EWOULDBLOCK errors when + writing to a pty. Also removed functions which are now in lib. + + * MANIFEST, Makefile.in, uusched.in: added a simple uusched shell + script. + + * parse.c: Heiko Rupp: don't die if there is trailing garbage in + an 'R' command. + + * policy.h, system.h, sysh.unx, send.c, rec.c, uuxqt.c, uux.c, + unix/filnam.c, unix/init.c, unix/jobid.c, unix/splnam.c, + unix/spool.c, unix/statsb.c, unix/tmpfil.c, unix/work.c, + 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) + + * 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) + + * log.c (ustats): Scott Blachowicz: avoid overflow when reporting + bytes per second. + + * unix/lock.c (fsdo_lock): Chip Salzenberg: sometimes other + programs create lock files that uucp can't write. + + * trans.h, system.h, trans.c (floop, fgot_data, usent_receive_ack, + uwindow_acked), send.c (flocal_send_await_reply, + flocal_send_fail), rec.c (fremote_send_fail_send, + frec_file_send_confirm), prote.c, protf.c, protg.c, proti.c, + prott.c, protz.c (calls to fgot_data), unix/recep.c, + unix/MANIFEST, unix/Makefile.in: keep trace of whether we have + already received a file, in case the other side never sees our + 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) + + * 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) + + * 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) + + * 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) + + * 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) + + * proti.c (firesend, fisenddata, ficheck_errors): made several + changes to improve performance on a lossy line: can now shrink + packet size using SYNC packets, avoids multiple bad header errors + in a sequence of INTRO characters, avoids letting one side lock up + if a NAK is lost. + + * configure.in: set HAVE_LONG_FILE_NAMES to 0 if + cross-configuring. + + * tstuu.c: changed -p option to be mod 1000, not mod 100. + + * 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) + + * policy.h, uuconf.h, uucico.c (fcall), uuconf/tsinfo.c, + uuconf/hsinfo.c, uuconf/syssub.c: added "max-retries" command for + systems, eliminated CMAXRETRIES configuration parameter, set + max_retries to 0 for HDB if retry time given, (from Chris Lewis) + call once a day even if max_retries has been exceeded. + + * prot.h, uucico.c (fdo_call, faccept_call), prott.c, prote.c, + proti.c, protg.c, protf.c: added pzlog argument to pfstart + protocol entry point, changed handshake successful message to + display it. + +Tue Aug 4 00:04:31 1992 Ian Lance Taylor (ian@comton.airs.com) + + * prot.h, uucico.c, protg.c (fbiggstart, cGshort_packets): Chip + Salzenberg: added support for 'G' protocol. Added "short-packets" + protocol parameter for 'g' and 'G' protocols. + + * uuconf.h, rec.c (flocal_rec_file_init), uucp.c, uux.c, uuxqt.c, + uuchk.c, uuconv.c, uuconf/local.c, uuconf/tsinfo.c, + uuconf/syssub.c: support UUCP forwarding. Added "forward-from", + "forward-to", and "forward" commands for systems. + + * 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) + + * trans.c (fremote_hangup_reply): don't hangup if a file transfer + is in progress. + + * 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) + + * unix/work.c (fsysdep_get_work_init): return TRUE if there is no + work directory. + + * configure.in, sysh.unx: don't run any programs in configure if + we are cross-configuring; this applies to HAVE_FTIME and + HAVE_RESTARTABLE_SYSCALLS. The code can cope with the buggy + ftime. If we are cross-configuring, HAVE_RESTARTABLE_SYSCALLS is + set to -1, and sysh.unx guesses that if the system has sigvec but + not sigaction or SV_INTERRUPT it is on 4.2BSD and system calls are + automatically restarted. + + * configure.in, conf.h.in, tstuu.c, unix/serial.c: removed + COMBINED_UNBLOCK configuration parameter, and changed the code + which sets O_NONBLOCK and O_NDELAY to drop back to using just + O_NONBLOCK if it gets an EINVAL error. + + * configure.in, conf.h.in, uucp.h, protg.c (fgsenddata), cu.c + (icutake), chat.c (icexpect), lib/MANIFEST: removed all calls to + 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) + + * 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 + files to include uudefs.h and uuconf.h as necessary. + + * uuconf/syshdr.unx, uuconf/callin.c, uuconf/diacod.c + uuconf/hdial.c, uuconf/hdnams.c, uuconf/hport.c, uuconf/hsinfo.c, + uuconf/hsnams.c uuconf/rdlocs.c, uuconf/tcalou.c, uuconf/tdial.c, + uuconf/tdnams.c, uuconf/tport.c, uuconf/vport.c, uuconf/vsinfo.c, + uuconf/vsnams.c: changed uuconf library to not return an error if + a configuration file does not exist; it now acts as though + whatever it is is not found. + + * tstuu.c (main): use perror if execl fails. + + * configure.in, conf.h.in, uucp.h, uuconf.h, sysh.unx, conn.h, + MANIFEST, Makefile.in, tli.c, chat.c (ccescape), conn.c + (fconn_init), tcp.c, uucico.c (faccept_call), uuconv.c, uuchk.c, + lib/MANIFEST, lib/Makefile.in, lib/escape.c, unix/cusub.c, + unix/serial.c, uuconf/hport.c, uuconf/tportc.c: added support for + TLI connections. Moved ccescape from chat.c to cescape in + 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) + + * uucp.h, trans.h, uucico.c (fdo_call, faccept_call), uuxqt.c + (uqdo_xqt_file), uucp.c (main), uux.c (main), uustat.c + (fsworkfile_show), parse.c (fparse_cmd), trans.c (fqueue, + fgot_data, ftadd_cmd), send.c, rec.c, xcmd.c, protf.c + (ffprocess_data), proti.c (fiprocess_data), tstuu.c + (uprepare_tests), unix/splcmd.c (zsysdep_spool_commands), + unix/statsb.c (fskill_or_rejuv), unix/work.c (fsysdep_get_work): + 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) + + * 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, + rec.c, xcmd.c, unix/opensr.c: added 'i' protocol. Added local and + remote channel arguments to protocol sendcmd and senddata entry + 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) + + * 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) + + * 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) + + * 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) + + * 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) + + * uuconv.c (uvwrite_time): Chris Lewis: don't output two commas in + a row. + + * 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) + + * xcmd.c (fremote_xcmd_init): Chris Lewis: use qdaemon->puuconf, + since puuconf is not defined. + + * uuconf/syshdr.unx, uuconf/hinit.c (uuconf_hdb_init): Chris + Lewis: added HDB_SEPARATOR to insert between oldconfiglib and + strings in HDB Sysfiles. + + * uuconf/syshdr.unx: Chris Lewis: define strerror as a macro. + + * 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) + + * prot.h, uucico.c (fdo_call, faccept_call), prote.c (festart), + protf.c (ffstart), protg.c (fgstart), prott.c (ftstart): no need + to pass fmaster as a separate argument to protocol start routine. + + * 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) + + * unix/srmdir.c (fsysdep_rmdir), unix/walk.c (usysdep_walk_tree): + cast to char * to avoid warning. + + * cu.c (main): don't compare boolean to NULL. + + * unix/serial.c (isblocksigs), unix/signal.c (usset_signal): use + extra parens to avoid bug in SCO 3.2.2 sys/signal.h header file. + + * sysh.unx: always define struct ssysdep_tcp, for the benefit of + systems for which HAVE_TCP is 0. + + * MANIFEST, Makefile.in, unix/Makefile.in, uuconf/Makefile.in, + lib/Makefile.in: updated automatic distribution code for multiple + directories. + + * unix/cusub.c, unix/serial.c: don't clobber CR when using TERMIO + or TERMIOS, and default MIN to 1 to the convenience of cu. + + * Makefile.in, uucp.h, system.h, prot.h, trans.h, uucico.c, + trans.c, send.c, rec.c, xcmd.c, prot.c, protg.c, protf.c, prote.c, + prott.c, log.c, file.c, unix/opensr.c, unix/work.c: rewrote file + transfer internals to support bidirectional transfers. Keep queue + 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) + + * Makefile.in: Stephen J. Walick: copy uustat.1 to + uustat.$(manext), not uucp.($manext). Also try to create + $(infodir). + + * 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) + + * configure.in, Makefile.in: updated to autoconf 0.118. + +Wed Jun 17 14:22:11 1992 Ian Lance Taylor (ian@comton.airs.com) + + * unix/serial.c (fsserial_init): add /dev if necessary to device + as well as to port name. + + * cu.c (main): set zdevice to NULL when faking line. + + * 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) + + * 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) + + * everything: integrated uuconf library. Split out lib and unix + libraries. Made many changes, including defaults for port and + dialer files, better handling of changed local name, better + 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) + + * 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) + + * 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) + + * policy.h: changed description of LOCKDIR, which now need not + always be defined. + + * uuconf.h, uuconf/uucnfi.h, uuconf/lckdir.c, uuconf/iniglb.c, + 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) + + * configure.in: updated to autoconf 0.115, added code to set + LIBOBJS. + + * uuconf/Makefile.in, uuconf/uucnfi.h: removed references to + 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) + + * 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) + + * uuconf.h, uuconf/Makefile.in, uuconf/deblev.c, uuconf/maxuxq.c, + uuconf/pubdir.c, uuconf/spool.c: wrote uuconf_debuglevel, + uuconf_maxuuxqts, uuconf_pubdir, uuconf_spooldir. + + * configure.in: updated to autoconf 0.114. + + * uuconf/tportc.c: default TCP ports to being fully reliable. + +Mon Jun 1 17:03:22 1992 Ian Lance Taylor (ian@comton.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) + + * uuconf.h, uuconf/Makefile.in, uuconf/diacod.c: wrote + uuconf_dialcode. + + * uuconf.h, uuconf/Makefile.in, uuconf/logfil.c, uuconf/debfil.c, + uuconf/stafil.c: wrote uuconf_logfile, uuconf_debugfile, + uuconf_statsfile. + + * uuconf.h, uuconf/Makefile.in, uuconf/callin.c: wrote + uuconf_callin. + + * uuconf/chatc.c, uuconf/time.c: Jean Mehat: only call tolower if + isupper is true. + + * 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) + + * system.h, sys1.unx: changed zsysdep_local_name to + zsysdep_localname, and made it fatal out rather than return NULL. + + * uuconf.h, uuconf/Makefile.in, uuconf/uucnfi.h, uuconf/iniglb.c, + uuconf/rdlocs.c, uuconf/locnm.c, uuconf/tlocnm.c, uuconf/hlocnm.c: + wrote uuconf_localname, uuconf_taylor_localname, + uuconf_hdb_localname. + + * uuconf.h, uuconf/Makefile.in, uuconf/uucnfi.h, uuconf/iniglb.c, + uuconf/tinit.c, uuconf/tsinfo.c, uuconf/hunk.c, uuconf/unk.c: + wrote uuconf_system_unknown, uuconf_hdb_system_unknown, + uuconf_taylor_system_unknown. + + * log.c, time.c: always include <sys/types.h> in uucp.h. + + * configure.in, conf.h.in: check for size_t, renamed checks for + time_t. + + * configure.in, conf.h.in: check for <stddef.h>. + +Fri May 29 00:03:05 1992 Ian Lance Taylor (ian@comton.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) + + * sys3.unx (zsysdep_real_file_name): Ted Lindgreen: check return + value of zstilde_expand. + + * copy.c, sys1.unx (usysdep_detach), sys2.unx (fsserial_close), + sys3.unx, sys5.unx, sys7.unx: opening /dev/tty in usysdep_detach + confuses the NeXT, so instead we just call TIOCNOTTY on 0. In + fsserial_close we call TIOCNOTTY on the port before closing it, to + make sure that we have ditched it under BSD. Also added O_NOCTTY + to every open call other than opening a port, although there are + still several fopen calls which should probably have it somehow. + + * system.h, uucico.c (fcall), uustat.c (fsquery_system, + fsquery_show), sys3.unx (fsysdep_get_status), sys7.unx + (zsysdep_all_status): Bob Izenberg: changed output of uustat -q to + count number of commands rather than number of files being + transferred, and to not report a non-existent status. Added + pfnone argument to fsysdep_get_status, and changed all calls. + + * uucico.c, sys1.unx, sys2.unx, sys3.unx, sys5.unx, sys6.unx, + sys7.unx: Rolf Nerstheimer: cast a bunch of arguments to open, + creat, stat and chmod to avoid compiler warnings. + + * uucp.h, log.c (ulog), port.c (fport_close), prot.c (fgetcmd): + Chip Salzenberg: don't log a SIGHUP signal while we're closing + down the connection, since the other side might hang up faster + than we do (we still react to it correctly, we just don't put it + in the log file). + + * sys1.unx (usysdep_detach), tcp.c (ftcp_open): Petri Helenius: + update the process ID we log after a fork. + + * Makefile.in, sys1.unx: Chip Salzenberg: changed LIBDIR to + SBINDIR. + + * uucp.c (main, uccopy): Andreas Vogel: check local-receive of the + correct system, rather than always using sLocalsys. + + * configure.in, conf.h.in, sys2.unx, tstuu.c: Rob Janssen: look + for <sys/select.h>, and include it if it exists and we are using + select. + + * protg.c: Rob Janssen: rearrange macros to avoid bug in XENIX + compiler. + + * configure.in: Scott Blachowicz: check WIFEXITED before assuming + HAVE_UNION_WAIT, to avoid problems on HP/UX. + + * 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) + + * 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) + + * uustat.c, uustat.1: added a bunch of options to support uuclean: + -e, -i, -K, -M, -N, -W, -Q. + + * 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) + + * 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) + + * sys1.unx (usysdep_detach): close the statistics file when + detaching. + + * policy.h, sys3.unx (fsdo_lock, fsdo_unlock), sys7.unx + (fsysdep_lock_status): force LOCKDIR to always be defined. + + * uucp.h: put in an extern for alloca. + + * sysh.unx, sys1.unx, sys5.unx, sys6.unx: defined all the ?_OK + macros in sysh.unx, which means that <unistd.h> must be included + before "sysdep.h" when they are both included. + + * sys2.unx (fsserial_set): corrected case in termio switch + expression. + + * chat.c (fcsend): simplified expression for old compilers. + + * sys1.unx (rmdir): wrote rmdir replacement which invokes + /bin/rmdir for old systems. + + * configure.in, conf.h.in, Makefile.in: updated for autoconf + 0.112, added checks for ftw, ftw.h, and rmdir. + + * sys1.unx: added extern for ctime, removed externs for functions + returning int, protected externs with ifndefs. + + * uucp.h, prot.h, system.h, uucico.c (fuucp), uuxqt.c + (uqdo_xqt_file), prot.c (freceive_file), file.c (freceived_file), + sys3.unx (fsysdep_move_file, fsysdep_change_mode), sys4.unx + (zsysdep_save_temp_file): changed fsysdep_move_file to not set the + file mode, and added fsysdep_change_mode to do it instead. + + * system.h, uucp.c (main, ucdirfile, uccopy), sys6.unx + (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) + + * sys3.unx: changed zsysdep_in_dir to always append the filename + to the directory, even if the directory did not already exist. + + * 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) + + * 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) + + * 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) + + * 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) + + * sysh.unx, sys2.unx (fsserial_open, fsblock): preserve file + status flags. + + * 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) + + * system.h: added several routines for cu. + + * cu.c, cu.h, sys8.unx: checked into RCS. + + * 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) + + * sys1.unx: changed HAVE_LONG_NAMES to HAVE_LONG_FILENAMES for new + version of autoconf. + + * sys7.unx: check UTIME_NULL_MISSING with #if rather than #ifdef. + + * sys3.unx: check FS_* macros with #if rather than #ifdef. + + * uucp.h, sysh.unx: changed standard type definitions for new + version of autoconf. + + * sysh.unx, sys1.unx, sys2.unx, tstuu.c: changed SIGtype to + RETSIGTYPE for new version of autoconf. + + * sys1.unx, tstuu.c: make include of <sys/times.h> optional. + + * sys2.unx: get the right versions of major and minor. + +Wed Apr 22 11:19:11 1992 Ian Lance Taylor (ian@comton.airs.com) + + * protg.c (fgsenddata, fggot_ack): Michael Haberler: the slow + start after error code was essentially shrinking the window size. + + * sysh.unx, system.h, sys1.unx (usysdep_initialize), uuchk.c, + uucico.c, uucp.c, uulog.c, uuname.c, uustat.c, uux.c, uuxqt.c: + changed usysdep_initialize to take a single argument with bit + flags, added INIT_NOCHDIR as one of the flags. + + * uucp.h, log.c (ulog): added pfLstart and pfLend functions for + ulog, so that cu can use them to restore the terminal settings. + + * bnu.c (ubnu_read_systems, fbnu_read_dialer_info), v2.c + (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) + + * uucico.c (faccept_call): Chris Lewis: a successful call in + should clear the number of retries. + + * sys2.unx (fsserial_set): set LLITOUT if going to CBREAK mode. + + * port.h, prote.c (festart), protf.c (ffstart), protg.c (fgstart), + prott.c (ftstart), port.c (fport_set), sys2.unx + (fsysdep_stdin_set, fsysdep_modem_set, fsysdep_direct_set, + fsserial_set): gave fport_set independent control over output + 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) + + * 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) + + * 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) + + * 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) + + * uucico.c (main, fcall): Petri Helenius: must relock system after + detaching from terminal when trying different alternates. + + * system.h, uucico.c (fuucp), uustat.c (fsworkfiles_system, + fsquery_system), sys4.unx (fsysdep_get_work_init, + fsysdep_get_work): Marty Shannon: uustat would remove empty + command files. + + * bnu.c (ubadd_perm_alternate): John Harkin: permit ALIAS in + Permissions. + + * Makefile.in: John Harkin: add sys?.c dependencies to sys?.o to + work around old makes which don't handle transitive .SUFFIXES. + + * sys2.unx: cast some function calls to void. + + * time.c (qttime_parse): cast to void warning. + + * sys1.unx (iswait): cast waitpid argument to avoid warning. + + * configure.in, policy.h, uucp.h, sys7.unx, tstuu.c: Zacharias + Beckman: minor touchups for NeXT. + + * sys1.unx (usysdep_initialize), sys6.unx (zsysdep_add_cwd), uux.c + (main): Jarmo Raiha: heuristic for whether to get the current + directory can fail. + + * sys1.unx: pass argument to uudir, cast sigemptyset calls to + void. + + * uucp.texi: Harlan Stenn: correct case of references. + +Tue Apr 7 01:02:17 1992 Ian Lance Taylor (ian@comton.airs.com) + + * Released version 1.03. + +Mon Apr 6 15:49:08 1992 Ian Lance Taylor (ian@comton.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) + + * sys2.unx: Petri Helenius: only clear known bits in termio or + termios structure; didn't change HAVE_BSD_TTY handling--maybe next + version. + + * configure.in: test TIMES_DECLARATION_OK correctly. + + * Makefile.in: update version to 1.03, remove distclean, add + mostlyclean per GNU standards. + + * sys1.unx, chat.c: minor cleanups for gcc 2.1. + +Thu Apr 2 17:51:36 1992 Ian Lance Taylor (ian@comton.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) + + * sys3.unx (esysdep_open_receive): David J. MacKenzie: some + USG_STATFS systems use 512 as the block size of f_bfree, despite + the existence of f_bsize. + + * port.c (fport_open): initialize stdin port. + + * policy.h, log.c: added CLOSE_LOGFILES configuration parameter. + + * sys2.unx: T. William Wells: handle a system without <poll.h> or + <stropts.h>. + + * configure.in: Franc,ois Pinard: warn if none of napms, nap, + usleep, poll or select are available, since \p will sleep for a + full second. + + * Makefile.in: Gerben Wierda: fixed uninstall to set file owner + and mode correctly. Also changed install to handle uucp.info-4 + and uustat.1. + + * MANIFEST: added uucp.info-4 and uustat.1. + + * uustat.1: Wrote. + + * 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) + + * sys1.unx (usysdep_initialize): use $PWD to get the current + working directory if it's defined and correct. + + * sys1.unx (usysdep_initialize): Brian Antoine: use name from + getpwname rather than getlogin. + + * uucp.texi: David J. MacKenzie: put in a number of corrections. + Also split sys file and config file nodes, and rearranged several + nodes. + + * 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) + + * tcp.c (ftcp_reset): Petri Helenius: TCP server never started + uuxqt, because it exited in ftcp_reset. + + * policy.h, sysh.unx, sys2.unx (fsserial_lockfile): added + HAVE_SVR4_LOCKFILES configuration parameter. + + * 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) + + * uucp.h, sysinf.c, prot.c, prote.c, protf.c, protg.c, prott.c: + Niels Baggesen: added new debugging types abnormal and uucp-proto. + + * uucico.c (fuucp), prot.c (freceive_file), file.c + (fstore_recfile): Dirk Musstopf: if a file receive fails before it + starts, perhaps because the file was too large, remember to remove + the temporary file. + + * sys2.unx (fsserial_lock, fsserial_open, fsserial_write, + 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) + + * uustat.c: allow multiple systems and users to be specified at + once; likewise for kills and rejuvenates. Allow old and young to + be combined with systems and users. As suggested by Niels + Baggesen, make machine status output more columnar. + + * uucp.h, uucico.c, config.c, sys3.unx: Michael I Bushnell: + renamed enum tstatus to tstatus_type to avoid conflict with + <sys/ioctl.h> on some systems. + + * config.c, sysinf.c, prtinf.c, chat.c: David J. MacKenzie: allow + backslash newline quoting in all TAYLOR_CONFIG configuration + files. + + * chat.c (fchat): David J. MacKenzie: handle empty subexpect + strings correctly. + + * uucico.c (main, fcall): Petri Helenius: must dump controlling + terminal before going to next alternate. Also fixed David J. + MacKenzie bug in which a signal did not prevent the next + alternates from being tried. Also made sure qtime was always + freed up. + + * uucp.h, uucico.c (fdo_call), sysinf.c (tialternate), uuchk.c + (ukshow): Franc,ois Pinard: allow a name to be given to an + alternate, and display the name when placing a call. + + * chat.c (fcprogram), port.c (fport_open, fport_close): David J. + MacKenzie: send port device rather than port name to a chat + program using \Y; make sure port device is reset if port open + fails and when port is closed. + + * 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) + + * uucico.c (fdo_call): Mark Mallett: minor cleanup. + + * uuname.c (main): Franc,ois Pinard: output aliases, added -a + switch. + + * uucico.8, uuxqt.8, uux.1, uucp.1: David J. MacKenzie: changed + .TP5 to .TP 5; also updated to 1.03. + + * tstuu.c: Roberto Biancardi: if SIGCHLD is not defined, define it + as SIGCLD. + + * config.c: David J. MacKenzie: cMaxuuxqts is independent of + HAVE_TAYLOR_CONFIG. + + * uucp.h: Gerben Wierda: don't always declare bzero. + + * sys7.unx (ussettime, fsysdep_lock_status): Niels Baggesen, + Gerben Wierda: minor patches. + + * sys2.unx: Gerben Wierda: minor cleanups. + + * uucp.h: Niels Baggesen: simplified debugging message macros to + avoid broken compilers. + + * sys2.unx: don't use TIOCEXCL locking. + + * sys2.unx: rework HAVE_UNBLOCKED_WRITES == 0 to work even if + writes are unblocked. Correct initialization of fwrite_blocking. + + * 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. + + * policy.h: David J. MacKenzie: various cleanups. + +Thu Mar 26 12:17:41 1992 Ian Lance Taylor (ian@comton.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) + + * 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) + + * 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) + + * config.c (tprocess_one_cmd): handle CMDTABTYPE_FULLSTRING + correctly if there are no arguments. + + * Released beta version 1.03 + + * 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) + + * uucico.c (fdo_call, faccept_call): T. William Wells: set current + time in status file when call completes. + + * sys1.unx (iswait), sys2.unx (fsserial_read, fsserial_write, + fsserial_io): log signals when they occur, even if we continue + some sort of loop, rather than waiting for the next ulog call. + + * 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) + + * system.h, uuxqt.c (uqdo_xqt_file), sys5.unx (fsysdep_execute): + pass command to fsysdep_execute as first element of argument + array. + + * tcp.c: declare _exit. + + * uucp.h: move definition of const before use for non ANSI C. + + * uucp.h, sys1.unx: undefine remove in uucp.h if the system does + not have it to avoid conflict with macro definitions. + + * uucico.c, uuxqt.c, protf.c, prott.c, prote.c, config.c, chat.c, + port.c, sys2.unx: miscellaneous cleanups. + + * tcp.c (ftcp_open): cast argument to bzero. + + * time.c (qtimegrade_parse): cast argument to qttime_parse to + long. + + * file.c: changed iRecmode to unsigned int. + + * configure.in, uucp.h: on SCO 3.2.2 sig_atomic_t is defined in + <sys/types.h> but not <signal.h>. + + * sys1.unx: undefined remove before the function definition to + avoid trouble on systems for which it is a macro. + + * Makefile.in: removed dependencies of getopt.o. + + * sys1.unx, sys7.unx, tstuu.c: adjusted external declarations. + + * getopt.h, getopt.c: get new versions from glibc 1.01. + + * sys1.unx: don't declare sigemptyset. + + * version.c: updated to beta 1.03. + + * chat.c (fcsend): Scott Ballantyne: go ahead and send a character + for an illegal escape sequence rather than failing out. + + * uuxqt.c (uqdo_xqt_file), sys5.unx (zsysdep_find_command): cast + result of alloca. + + * protg.c (fgprocess_data): Niels Baggesen: improved debugging + information. Also tweaked fgprocess_data code to use memchr to + find the next DLE rather than searching for it by hand. + + * uucico.c (faccept_call, fuucp): accept SVR4 -U flag giving + 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) + + * sysinf.c (titime, titimegrade): permit a retry time to be + specified as an optional additional argument. + + * uucico.c (zget_uucp_cmd, zget_typed_line): turn off DEBUG_PORT + when doing DEBUG_HANDSHAKE. + + * policy.h, sysh.unx, sys1.unx, sys2.unx (fsblock_writes, + fsserial_write, fsserial_io): added configuration parameters + HAVE_UNBLOCKED_WRITES and SINGLE_WRITE. Also blocked signals + while clearing afSignal in fsysdep_modem_close. + + * chat.c (icexpect, fcsend): turn off DEBUG_PORT while doing chat + script debugging. + + * sysh.unx, sys2.unx (fsserial_lock, fsserial_open, + fsserial_write, fsserial_io, fsysdep_tcp_read, fsysdep_tcp_write, + fsysdep_tcp_io): T. William Wells: some systems don't support + unblocked writes, so don't use them. + + * port.c (fport_read, fport_write): show calls to fport_read and + fport_write under DEBUG_PORT. + + * 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) + + * 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 + (ftcp_open), log.c (ulog, ulog_close), sys1.unx (ussignal), + sys2.unx (fsserial_close, fsysdep_modem_end_dial, fsserial_read, + fsserial_write, fsserial_io, fsysdep_tcp_read, fsysdep_tcp_write, + fsysdep_tcp_io): T. William Wells and Chip Salzenberg: keep an + array of signals so that a new signal doesn't obliterate our + knowledge of an old signal. Johan Vromans: if we get SIGINT + continue the current session but don't start any new ones. + + * sysh.unx, sys1.unx (isspawn, espopen, iswait, fsysdep_mail, + fsysdep_run, getcwd, mkdir), sys2.unx (fsrun_chat), sys3.unx + (fsysdep_wildcard_start), sys5.unx (fsysdep_execute), sys7.unx + (fsysdep_lock_status), uuxqt.c (uqdo_xqt_file), tcp.c (ftcp_open), + 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) + + * sysinf.c (uset_system_defaults): Chip Salzenberg: changed + default login script timeout to 10 seconds. + + * prot.h, prot.c (freceive_data, breceive_char), protg.c, protf.c, + prott.c, prote.c: changed breceive_char to go through + freceive_data rather than calling fport_read directly. Added an + 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) + + * uucp.h: added a padding byte to scmd structure, since at least + one compiler needs it. + + * uucp.c (main): use fake local name (from ``myname'' command) + when generating an execution request intended for the local + system. + + * sysh.unx: corrected readdir prototype. + + * sys2.unx: moved local header files ahead of sleep routine + determination. + + * General overhaul to change debugging system. Debugging is now + done by type rather than by number. iDebug is now interpreted as + a bit sequence. DEBUG may only be 0 (no checks or debugging), 1 + (checks, no debugging) or 2 (checks and debugging). The debugging + names are parsed by idebug_parse and tidebug_parse in config.c. + 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) + + * policy.h, uuxqt.c (uqdo_xqt_file): Chip Salzenberg: support + Internet mail addresses in uuxqt replies (added configuration + parameter HAVE_INTERNET_MAIL to control this). + + * sys7.unx (fskill_or_rejuv): permit uucp user to delete any job. + + * uucp.h, system.h, sysh.unx, config.c, uuxqt.c (main, uqabort), + sys5.unx (isysdep_lock_uuxqt, fsysdep_unlock_uuxqt), bnu.c + (ubnu_read_sysfiles): Marty Shannon: added max-uuxqts command, + along with support for BNU Maxuuxqts, to limit number of + concurrent uuxqt processes. + + * chat.c (icexpect, fcsend), uucico.c (zget_uucp_cmd, + zget_typed_line): improved debugging by avoiding incredibly long + lines. + + * system.h, sys5.unx (fsysdep_execute), uuxqt.c (uqdo_xqt_file): + 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) + + * sysh.unx, sys1.unx (isfork), sys2.unx, sys5.unx, tcp.c: + Franc,ois Pinard: retry fork several times before giving up. + + * uucp.h, prot.c (fploop, fgot_data), file.c (usendfile_error, + urecfile_error, frecfile_rewind): Niels Baggesen: if we can't read + or write a file, treat it as a temporary error rather than a + permanent error; if we get an error on write, drop the connection + rather they try to continue. + + * uucp.h, system.h, sysh.unx, uucico.c (fuucp), prot.c + (fsend_file, freceive_file), file.c (fsent_file, usendfile_error, + freceived_file, urecfile_error, fmail_transfer), sys1.unx + (usmake_spool_dir), sys4.unx (zsysdep_save_temp_file): if a file + send fails, save the file away rather than lose it forever. + + * uucico.c (main): don't run uuxqt if we got a SIGTERM. + + * tcp.c (ftcp_open): Petri Helenius: have server fork twice to + avoid zombies. + + * port.h, prtinf.c, v2.c, bnu.c (fbnu_find_port), uucico.c + (fdo_call, faccept_call), uuchk.c (fkshow_port): added protocol + command for ports, mostly to support BNU. Also modified uuchk to + make the absence of any matching port or dialer more obvious. + + * sys3.unx (esysdep_open_receive): check size of destination file + system as well as temporary file system; handle f_bsize field + under FS_MNTENT. + + * configure.in, sysh.unx: test for including <termios.h> and + <sys/ioctl.h> in the same file, setting new configuration + 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) + + * sys2.unx (fsserial_close): Franc,ois Pinard: sleep for a second + after closing the serial port to give it a chance to settle. + + * sysh.unx (fsetterminfodrain), sys2.unx (fsserial_close, + fsserial_reset, fsserial_set): wait for terminal output to drain + before closing it, resetting it, or changing its parameters. + + * uucico.c (zget_uucp_cmd): Ted Lindgreen: strip parity bit from + initial handshake strings. + + * system.h, sys3.unx (esysdep_open_send), uucico.c (fuucp): Ted + Lindgreen: don't send a mail message if a file to send has been + removed, since it might have been sent in a previous session. + + * uuchk.c (ukshow): Zacharias Beckman: put list of permitted + programs and execution path on separate lines. + + * uucico.c (fdo_call, faccept_call): only look for hangup string + in debugging mode, since there's nothing to be done with it + anyhow. + + * uucico.c (faccept_call): Ted Lindgreen: report the minimum + transfer grade requested during an incoming call in the log file. + + * uucp.h, uutime.h, config.c, uucico.c (fcall), time.c + (ftimespan_match, btimegrade, cmax_size_now): added a new status + type for ``wrong time to call''. If a system can never be called, + 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) + + * uucico.c (main, flogin_prompt, faccept_call): Ted Lindgreen: if + we were asked to call a single system, or if a single system + called in, then start uuxqt with -s for just that system. + + * uucico.c (main): Ted Lindgreen: ignore the -u option. + + * tstuu.c: Ted Lindgreen: don't include <sys/ioct.h> if it's not + there. Also removed the ``ignore this error'' message from the + chat scripts since it's no longer marked as an error. + + * sys2.unx (fsserial_set): Ted Lindgreen: if CRTSCTS is defined + and turned on, then don't turn on IXOFF. + + * uucp.h, log.c, uucico.c (fdo_call, faccept_call): Ted Lindgreen: + 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) + + * port.h, prtinf.c, sys2.unx (fsserial_lockfile, fsserial_lock): + Peter da Silva: added ``lockname'' command to ports to permit + specification of the file name to use when locking. + + * sys1.unx (usysdep_detach): let setpgrp fail silently. + + * sys2.unx: always include <sys/ioctl.h> if it's present on the + system. + + * time.c (btimegrade, cmax_size_now): removed extraneous + semicolons. + + * sys2.unx (fsserial_lock, fsserial_open, fsserial_close): support + TIOCEXCL locking. + + * sys2.unx (fsserial_open): preserve unknown bits in c_cflag when + using HAVE_SYSV_TERMIO or HAVE_POSIX_TERMIOS. + + * prot.h: never included more than once. + +Fri Mar 6 21:53:28 1992 Ian Lance Taylor (ian@comton.airs.com) + + * uucp.h: Eric Ziegast: some systems don't define EXIT_SUCCESS or + EXIT_FAILURE in stdlib.h. + + * uucp.h, uutime.h, uucico.c (fuucp), sysinf.c (uinittimetables, + uaddtimetable), uuchk.c (main, ukshow_size, ukshow_time, + qcompress_span), time.c (all new): rewrote time routines + completely for consistency and simplicity. Fixed bug causing + incorrect maximum possible transfer size. Added new file + uutime.h. + +Wed Mar 4 10:06:13 1992 Ian Lance Taylor (ian@comton.airs.com) + + * sys2.unx (fsserial_lockfile, fsserial_lock, fsysdep_modem_open, + fsysdep_direct_open, fsysdep_modem_close, fsysdep_direct_close): + Petri Helenius: if the open failed on a serial port, the lock + files were not removed. + + * config.c (igradecmp): the local variables in igradecmp have to + be integers; signed characters might not work correctly (although + they would in all normal cases). + + * sys4.unx (fsysdep_has_work): Johan Vromans: set *pbgrade + correctly if we still have work left over that we haven't looked + at yet. + + * tstuu.c (main, uchoose, fwriteable): Roberto Biancardi: use poll + if we haven't got select. + + * 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) + + * uuxqt.c (main, uqdo_xqt_file): permit local executions, don't + get grade out of system dependent file name. + + * sys4.unx (fsysdep_get_work): Bob Denny: warn if we can't open a + command file. + + * v2.c (uv2_read_systems): Jeff Putsch: infinite loop when reading + time string. + + * uucp.h, sys1.unx, sys2.unx, sys3.unx, tstuu.c, configure.in: + Thomas Fischer: some NeXT compatibility stuff: removed externs of + sleep and alarm, included <libc.h> in uucp.h. + + * uucp.h, port.h, uucico.c (zget_uucp_cmd, zget_typed_line), + port.c (cdebug_char, udebug_buffer), chat.c (icexpect, fcsend, + fcphone), log.c (ulog): Michael Richardson: added LOG_DEBUG_START, + LOG_DEBUG_CONTINUE and LOG_DEBUG_END to allow a debugging line in + the log file to be built character by character. Used this new + feature in chat script debugging, rather than having each + character appear on a separate line. Added fPort_debug variable + to control port debugging. + + * uustat.c (fsquery, fsquery_system, fsquery_show): handle + execution files queued up for the local system correctly when + using -q option (they still don't show up on any other option). + + * uucp.texi, protg.c (fgstart, fgshutdown): Aleksey P. Rudnev: + added remote-window and remote-packet-size 'g' protocol + parameters. Reset the parameters to their default values in + fgshutdown. + + * sysh.unx, sys2.unx (fsserial_read, usalarm), sys1.unx + (usset_signal, usysdep_detach), uucico.c (main): overhauled + fsserial_read yet again. The timeout passed in is now an absolute + bound. A special SIGALRM handler does some wierd stuff to avoid + any possible race. + + * config.c (uread_config), sysinf.c (uiread_systems, + fcallout_login, fcheck_login), prtinf.c (ffind_port, + fread_dialer_info), chat.c (fctranslate), uucico.c (faccept_call): + T. William Wells: when using HAVE_TAYLOR_CONFIG in combination + 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) + + * sys2.unx (fsserial_read): T. William Wells: don't arbitrarily + extend read timeout. + + * 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) + + * 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) + + * system.h, uucico.c (faccept_call, fdo_xcmd), uuxqt.c + (uqdo_xqt_file), uux.c (main), uucp.c (main, ucspool_cmds), + sys3.unx (zsysdep_spool_cmds), uux.1, uucp.1: added -j switch to + uucp and uux to display the jobid of the spooled job. + + * uucp.h, system.h, sysh.unx, uucico.c (fuucp, fdo_xcmd, + fok_to_send, fok_to_receive), uuxqt.c (uqdo_xqt_files), uux.c + (main, uxcopy_stdin), uucp.c (main), file.c (freceived_file), + config.c (fin_directory_list), sys1.unx (fsysdep_file_exists, + fsuser_access, fsysdep_in_directory), sys3.unx (esysdep_open_send, + fsysdep_move_file), sys5.unx (fsysdep_xqt_check_file): Chip + Salzenberg: recheck file access permissions before sending, to try + to avoid symbolic link games. Check that the user has search + access on all directories down to the file, and read or write + access to the file or directory itself. Check in uucp and uux as + well as uucico, to provide early messages. Check the standard + input file in uuxqt. Be more careful about creating files in the + spool directory. This eliminates all security problems I know of, + except for a very short race in fsysdep_move_file. + + * sys3.unx (esysdep_open_send): give an error message if we try to + send a directory (used to just fail silently). + + * system.h, sysh.unx, sys1.unx (usysdep_detach, ussignal, + fsysdep_catch, usysdep_start_catch), sys2.unx + (fsysdep_modem_end_dial, fsserial_read), uux.c (main): T. William + Wells: fsysdep_catch obviously must be a macro, since it calls + 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) + + * sys1.unx, sys6.unx, sys7.unx: added some extern definitions. + + * configure.in, uucp.h, system.h, sysh.unx, uucico.c (main, + ucatch, uabort, zget_typed_line, zget_uucp_cmd), uuxqt.c (main, + uqcatch, uqabort), uux.c (main, uxcatch, uxrecord_file, uxabort), + uucp.c (main, uccatch, ucrecord_file, ucabort), uustat.c (main, + uscatch), uulog.c (main, ulcatch), uuname.c (main, uncatch), + uucheck.c (main, ukcatch), log.c (ulog_fatal_fn, ulog, + ulog_close), tstuu.c (main, uchild, uprepare_test), sys1.unx + (usysdep_initialize, usysdep_detach, usysdep_signal, + fsysdep_catch, usysdep_end_catch, ussignal, fsset_signal, + fsysdep_run, raise), sys2.unx (usalarm, usysdep_pause, + fsserial_lock, fsserial_open, fsysdep_stdin_close, + fsysdep_modem_close, fsysdep_modem_end_dial, fsserial_read, + fsserial_write, fsserial_io), sys5.unx (fsysdep_execute): T. + William Wells: overhaul to support detaching from the terminal and + completely reliable signals. uucico now calls usysdep_detach at + various points; new option -D prevents detaching. The signal + handling code all goes through usysdep_signal, fsysdep_catch and + usysdep_end_catch. A signal now just sets iSignal, which is + 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) + + * protg.c (fgwait_for_packet): Bob Denny: reset the count of + timeouts only when data is recognized, so that we aren't fooled by + a sequence of imperfect echoes. + + * 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) + + * uucico.c (main, uusage): don't treat an extra argument as a port + name. + + * sys3.unx (esysdep_truncate): Roberto Biancardi: support F_CHSIZE + and F_FREESP in esysdep_truncate. + + * configure.in, sys2.unx (fsserial_read, usysdep_pause): Roberto + Biancardi: use poll to sleep less than a second if we haven't got + anything else. + + * v2.c (uv2_read_systems, fv2_find_port), bnu.c + (ubnu_read_systems, fbnu_find_port, fbnu_read_dialer_info), + uustat.c (fsworkfile_show): Roberto Biancardi: skip spaces and + tabs after doing a strtok ((char *) NULL, ""). + + * copy.c (fcopy_file), sys1.unx (esysdep_fopen), sys2.unx, + sys3.unx (esysdep_open_receive, esysdep_truncate, fsdo_lock, + fscmd_seq), sys5.unx (fsysdep_execute), sys7.unx, tstuu.c: John + Theus: some systems use <sys/file.h> instead of <fcntl.h>. Also + changed the code to call creat instead of open when appropriate. + Should now work on V7, with the exception of O_NONBLOCK and + O_NDELAY in sys2.unx and tstuu.c. + + * 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) + + * uucp.h, system.h, bnu.c (ubnu_read_systems), config.c + (fin_directory_list), sys1.unx (fsysdep_in_directory), sys5.unx + (fsysdep_xqt_check_file), uucp.c (main), uuxqt.c (uqdo_xqt_file), + uucico.c (fdo_xcmd, fok_to_send, fok_to_receive), tstuu.c + (uprepare_test): only permit files to be received into directories + that are world writeable. Check for this in fsysdep_in_directory, + with a new argument. Changed calls appropriately. In tstuu + create /usr/tmp/tstuu as world writeable. + + * bnu.c (ubadd_perm_alternate): Doug Evans: after all that, I got + it wrong: WRITE only applies to remote requests. + + * uucp.h, uucico.c (fuucp, fdo_xcmd, fok_to_send, fok_to_receive), + uuxqt.c (uqdo_xqt_file), uuchk.c (ukshow), sysinf.c + (uset_system_defaults, tialternate), sys5.unx + (fsysdep_xqt_check_file), bnu.c (ubadd_perm_alternate): fixed READ + and WRITE handling to match BNU semantics. Added + zcalled_local_send, zcalled_local_receive, zcalled_remote_send and + 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) + + * Complete overhaul of configuration to use automatic shell + script. Eliminated conf.h, now generated by configure. Renamed + Makefile to Makefile.in. Added policy.h for administrative + 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) + + * 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) + + * sys7.unx (fskill_or_rejuv): make sure that only the submitter or + the superuser is permitted to cancel (or rejuvenate) a request. + + * system.h, sysh.unx, sys3.unx (zsfile_to_jobid, zsjobid_to_file), + sys4.unx (zsysdep_jobid), sys7.unx, uustat.c, Makefile, MANIFEST: + wrote uustat. Changed CSEQLEN in sys3.unx from 5 to 4. Added + several new system dependent functions, mostly in sys7.unx. + + * system.h, sys1.unx, log.c, file.c, chat.c, protg.c, uucico.c: + rearranged the time functions for the convenience of uustat. Made + isysdep_time take an optional pimicros arguments. Renamed + usysdep_full_time to isysdep_process_time, and made clear that it + need only work within a single process. Changed usysdep_localtime + 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) + + * 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) + + * uuxqt.c (uqdo_xqt_file): T. William Wells: make sure sh uses + absolute path of command, rather than relying on PATH. + + * sys5.unx (zsysdep_find_command): Michael Nolan: allow full + command name to be specified by remote system, not just basename, + if command is not in path. + + * log.c (ulog): don't use headers when outputting to terminal. + + * 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) + + * uucico.c (ucatch), uuxqt.c (uqcatch): Neils Baggesen: under + HAVE_BNU_LOGGING, don't lose the system name when dieing. + + * uulog.c, Makefile, MANIFEST: wrote uulog. + + * uuname.c, Makefile, MANIFEST: wrote uuname. + + * bnu.c (ubadd_perm_alternate): T. William Wells: must xstrdup the + system name before calling uadd_validate. + + * log.c (ulog_close): Micheal Nolan: don't refer to eLdebug if the + DEBUG configuration parameter is 0. + + * 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) + + * uucico.c (fuucp), prot.c (fsend_file, freceive_file): Bob Denny: + call fmail_transfer before calling fsysdep_did_work, because the + latter frees up strings used by the former. + + * sysh.unx, sys1.unx (mkdir), uudir.c (new file), Makefile: added + HAVE_MKDIR configuration parameter for systems without the mkdir + system call. The emulation function in sys1.unx invokes the new + 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) + + * sysh.unx, sys1.unx (opendir, readdir, closedir), sys4.unx, + sys5.unx: added HAVE_OLD_DIRECTORIES configuration parameter to + support systems without opendir/readdir/closedir which use + original Unix directory format. + + * sysh.unx, sys1.unx (dup2): added HAVE_DUP2 configuration + parameter and dup2 emulation function. + + * sys1.unx (zsysdep_local_name): put utsname structure on stack + rather than making it static. + + * sysh.unx, sys1.unx (usysdep_initialize, getcwd): if we have + neither getcwd nor getwd, fork /bin/pwd to get the current working + directory. + + * system.h, uucico.c (main), uuxqt.c (main), uux.c (main), uucp.c + (main), uuchk.c (main), sys1.unx (usysdep_initialize), sys6.unx + (fsysdep_needs_cwd, zsysdep_add_cwd): because getting the current + working directory can be expensive on Unix, since some + implementation of getcwd fork a shell to execute pwd, only try to + get the cwd if it is going to be needed by uux or uucp. + + * uucico.c (main), uuxqt.c (main), uux.c (main), uucp.c (main), + uuchk.c (main), log.c (ulog): handle all possible signals raised + by abort, namely SIGABRT, SIGILL and SIGIOT. In ulog always call + abort rather than raise (SIGABRT). + + * sys4.unx (usysdep_get_work_free): the qSwork_file information + was freed up incorrectly if a file transfer failed. + + * sysh.unx, sys2.unx: Archaic Zilog System III computers use + setret and longret rather than setjmp and longjmp, so I added a + HAVE_SETRET configuration option. + + * prott.c (ftstart, ftsenddata): shifts of integers by more than + 15 are not portable. + + * prot.c (fsend_file, freceive_file, fploop, fgot_data): I ran + into an old compiler which couldn't handle the calls to pffile, so + I simplified them to use a variable. + + * port.c (fmodem_dial): cast result of alloca. + + * getopt.h, getopt.c: Jay Vassos-Libove: renamed getopt and + 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) + + * everything: added HAVE_STRING_H and HAVE_STRINGS_H. Removed + include of <string.h> in every source file and put it in uucp.h. + Since I had to change everything anyhow, added 1992 to the + copyright date. + + * 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) + + * uucp.c (main): Get the file name for the destination of a local + copy using zsysdep_real_file_name rather than zsysdep_in_dir, + since the latter doesn't get the basename of the argument. + + * sys3.unx (fsysdep_get_status): Niels Baggesen: cast enum to int + before comparison. + + * system.h, uucp.c (main), uux.c (main), sys6.unx (fsysdep_access, + fsysdep_daemon_access): Niels Baggesen: check user access to file + since programs are running setuid. Previously uucp and uux + permitted a file readable only by uucp to be transferred to + another system by user request! + + * chat.c (fchat): Michael Nolan: portions of a chat string might + 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) + + * protg.c: Chip Salzenberg: change default window size to 7. + + * sys3.unx (fsdo_unlock): Michael Nolan: cast result of alloca to + (char *), not that it really matters. + + * 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) + + * 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) + + * uucico.c (zget_uucp_cmd): Patrick Smith: only wait a short time + for the hangup string. + + * 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) + + * sys1.unx, sys3.unx, tstuu.c: Jay Vassos-Libove: removed some + declarations of system functions that conflict with system header + files on BSD/386 alpha. + + * Makefile: Jeff Ross: make sure the uninstall target restores the + original file owner and mode. + + * 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) + + * log.c (ustats): Marty Shannon: don't report a failed transfer + under USE_BNU_LOGGING. + + * sys3.unx (zsysdep_real_file_name): Marty Shannon: a trailing '/' + on the name means that it is a directory, even if the directory + does not already exist. + + * uucico.c (fuucp): Marty Shannon: the -f flag indicating that + directories should not be created was not being handled correctly. + + * uucico.c (fcall): Chip Salzenberg: set .Status correctly if + wrong time to call. + + * protg.c (fgsendcmd): John Antypas: didn't handle null byte at + 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) + + * Released version 1.02. + + * system.h, uucico.c (main), uux.c (main), uucp.c (main, + 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) + + * sys1.unx (fsysdep_make_dirs): don't try to create a directory + with no name. + + * version.c: change version number to 1.02. + + * uucico.8, uuxqt.8, uucp.1, uux.1: change version number to 1.02. + + * MANIFEST: removed texinfo.tex; it's twice the size of any other + file, so I think it's just to large to distribute. + + * uucico.c (fcall, fdo_call): Marty Shannon: update the time in + 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) + + * protg.c (fgsendcmd, fgsenddata): Dave Platt: if the remote UUCP + accepts packets larger than 64 bytes, assume it can handle + differing packet sizes, so if we have a small amount of data to + send, use a small packet. Besides the two routines mentioned, + also made minor changes to other routines to get the packet length + out of the packet data rather than always assuming the same packet + size. + + * conf.h, uucp.h: Matthew Lyle: some systems don't declare errno + in <errno.h>, so I added HAVE_ERRNO_DECLARATION. + + * 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) + + * tstuu.c (utransfer): Mike Park: don't sleep when the input + buffer is full; it's too slow. + + * Makefile: when making a distribution,change the mode of separate + copies of the configuration files Makefile, conf.h and sysh.unx. + + * uucico.c (faccept_call): Marty Shannon: update .Status file on + incoming calls. + + * uucp.h, prot.h, uucico.c (fuucp), prot.c (fsend_file, + fpsendfile_confirm, freceive_file, fprecfile_confirm, fxcmd, + ustats_failed), file.c (fsent_file, usendfile_error, + freceived_file, urecfile_error, frecfile_rewind, fmail_transfer): + reworked calls to fsydep_did_work and sending of mail messages to + be more sensible. Now sends mail to requestor if request fails + 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) + + * protg.c (fgsendcmd, fgsenddata): zero out unused bytes in short + packets. + + * prot.c (zgetcmd), protf.c (ffsendcmd), prott.c (ftsendcmd), + prote.c (fesendcmd): Niels Baggesen: added some debugging + messages. + + * protg.c (fgsendcmd): corrected misspelling in debugging message. + + * log.c (ustats): Niels Baggesen: add FAILED to end of xferstats + line if appropriate. + + * uuxqt.c (uqdo_xqt_file): Niels Baggesen: was checking strcmp + return value incorrectly, so messages to other systems were not + being sent. + + * 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) + + * sys1.unx: put \n at end of fsysdep_run error message. + + * sysh.unx, sys1.unx, sys2.unx, tstuu.c: Mike Park: on some + systems <sys/time.h> includes <time.h> but <time.h> can only be + included once; added HAVE_SYS_TIME_AND_TIME_H to sysh.unx. + + * tstuu.c: Mike Park: removed prototype for times since some + systems don't have clock_t. + + * conf.h, sys2.unx, util.c: Mike Park: some systems don't have + <limits.h>. Every macro used from it already had a check to make + sure it was defined anyhow. + + * tstuu.c (uprepare_test): Mike Park: sh on NeXT interprets a + leading ~, so we have to quote the argument to system(3). + Incredible. + + * conf.h, uucp.h: Mike Park: if HAVE_ALLOCA is 0 when compiling + with gcc, don't define alloca as a macro. This will let the NeXT + define it in some header file. + + * sysh.unx, sys2.unx, sys5.unx, tstuu.c: Mike Park: handle + HAVE_UNION_WAIT completely. Assume that system(3) returns an int + which should be put into the w_status field. Define macros for + union wait if they are not already defined. Move all this stuff + into sysh.unx rather than duplicating it in three different files. + + * conf.h, uucp.h, sysh.unx, config.c, bnu.c, v2.c, uucico.c, + uuxqt.c, uux.c, uucp.c, uuchk.c, Makefile: set directory to look + for configuration files in in Makefile rather than in sysh.unx. + This forced a number of changes, as now all new style + 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) + + * sys3.unx: David Nugent: don't declare chmod, since it may be + prototyped to take an argument that is smaller than an int. + + * uucico.c (faccept_call): Chip Salzenberg: only declare sportinfo + if it will be used (if HAVE_TAYLOR_CONFIG is true). + + * sys3.unx (isysdep_get_sequence): Chip Salzenberg: avoid use + before set warning from gcc. + + * protf.c (ffprocess_data): Chip Salzenberg: avoid use before set + warning from gcc. + + * sysh.unx, sys2.unx (fsserial_read, usysdep_pause): Chip + Salzenberg: added HAVE_USLEEP configuration parameter for the AIX + usleep routine. + + * uuchk.c, prtinf.c, config.c: Chip Salzenberg: strcmp is a macro + on AIX, so avoid declaring it and undef it in config.c where we + want to declare it because we want to take its address. + + * uucp.h, sys3.unx (fsysdep_get_status, fsysdep_set_status): Chip + Salzenberg: handle out of range status codes in status files. + + * Makefile, sysh.unx: defined LIBDIR in the Makefile, rather than + forcing the user to define it in two different places. + + * sys.unx, tstuu.c: Chip Salzenberg: can't declare execl, since it + is varadic. + + * sys1.unx, sys2.unx, sys3.unx, sys5.unx, tstuu.c: David Nugent: + can't declare open or fcntl, since they may use ... in header file + prototype; added declaration for popen; added casts of first mkdir + argument to char *. + + * sysh.unx, tstuu.c (uchild): Mike Park: added HAVE_WAITPID and + HAVE_WAIT4 configuration parameters to allow the use of wait4 as + found on the NeXT. + + * tstuu.c (uprepare_test): Mike Park: use IPUBLIC_DIRECTORY_MODE + rather than S_IRWXU | S_IRWXG | S_IRWXO. + + * 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) + + * Eliminated CONFIG, INSTALL and THANKS. They are now included in + uucp.texi. Changed README and MANIFEST accordingly. Added + uucp.info* and texinfo.tex to MANIFEST. + + * Makefile, uucp.texi: renamed taylor.texi to uucp.texi. + + * uucico.c (fcall, fdo_call): John Antypas: pass in sportinfo + structure for fdo_call to use for an unknown port. + + * 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) + + * Makefile: changed to correspond to GNU standards, according to + standards.text of 24 Nov 91. + + * Makefile: Franc,ois Pinard: use $(INSTALL_PROGRAM) and + $(INSTALL) rather than cp to install the programs. + + * time.c (ftime_now), sys1.unx (usysdep_localtime): John Antypas: + use memcpy to get the result of localtime rather than relying on + structure assignment. + + * sysh.unx, prtinf.c: Hannu Strang: changed definition of + SYSDEP_STDIN_CMDS to pass structure instead of address of + 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) + + * Released beta 1.02. + + * protg.c (fgcheck_errors): discount out of order packets in the + total error count, and allow a negative error count to mean that + any number of errors are accepted. + + * 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) + + * log.c (ulog): tweaked HAVE_V2_LOGGING slightly. + + * v2.c (uv2_read_systems): set chat script correctly. + + * uucp.h, sys3.unx: avoid redefining SEEK_SET if it appears in + <unistd.h> but not <stdio.h>. + + * chat.c (fcsend): made fcsend into a static function. + + * uucp.h, uucico.c, uuxqt.c, uux.c, uucp.c, uuchk.c, version.c: + changed abProgram and abVersion from const char [] to char [] + because the Microsoft compiler on SCO can't handle const char [] + arrays correctly. + + * uux.c (main): allocate enough space for log message. + + * sys1.unx (usysdep_localtime): to get the current time, we can't + call usysdep_full_time if the latter uses times. + + * sys1.unx, sys3.unx: added a couple more extern definitions for + SCO 3.2.2. + + * uucico.c (main): start uuxqt even if a call fails. + + * sysh.unx, system.h, uuxqt.c (uqdo_xqt_file), sys5.unx + (fsysdep_xqt_check_file): Chip Salzenberg: added configuration + 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) + + * system.h, uuxqt.c (uqdo_xqt_file), sys5.unx + (fsysdep_xqt_check_file): David J. Fiander: make sure that if an + argument looks like a filename we are permitted to access it. + + * 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) + + * 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) + + * protg.c (fgstart): Franc,ois Pinard: forgot to initialize + cGdelayed_packets. + + * prot.h, uucico.c, prote.c: added the 'e' protocol, creating the + new file prote.c + + * prot.c (freceive_data), protf.c (fffile), prott.c (ftfile): + changed pffile protocol entry point to pass number of bytes being + 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) + + * 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) + + * uucp.h, prot.c (fploop): John Theus: check for EOF before + reading from file to work around bug in Tektronix library. + + * protg.c (fprocess_data): don't send RR packets when an error + occurs; the other side will probably ignore them, and it may + confuse some Telebit modems. + + * sys1.unx (usysdep_localtime): don't take the address of a cast + value. + + * 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) + + * uuxqt.c (uqdo_xqt_file): forgot to initialize zmail. + + * uucp.h, time.c, copy.c, sys1.unx, sys2.unx, sys3.unx, sys4.unx, + sys5.unx, config.c, log.c, uuxqt.c, uux.c, tstuu.c: added a bunch + of externs to decrease the number of implicit function + definitions. + + * system.h, sys1.unx (usysdep_localtime), log.c (zldate_and_time): + Lele Gaifax: put the full year in the log file, using the format + YYYY-MM-DD HH:MM:SS.HH (ending in hundredths of seconds). + + * config.c (uprocesscmds): Terry Gardner: allow a # to be quoted + in a configuration file. Also made uprocesscmds reentrant. + + * sysh.unx, sys2.unx (fsrun_chat), sys5.unx (fsysdep_execute), + tstuu.c (uchild): Monty Solomon: added HAVE_UNION_WAIT + configuration option to pass a variable of type union wait to the + wait and waitpid system calls. + + * sysh.unx, sys1.unx (usysdep_initialize): John Theus: added + HAVE_GETWD to use getwd instead of getcwd. + + * sysh.unx, sys1.unx (usysdep_full_time): added HAVE_FTIME + configuration option. + + * tstuu.c (uchild): use TIMES_TICK from sysh.unx rather than + CLK_TCK. + + * 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) + + * uucico.c (fuucp): set fmasterdone correctly when running as a + slave. + + * port.c (cpshow, upshow, fport_read, fport_write, fport_io): + cleaned up debugging code by isolating out upshow and by making + cpshow handle backslash. + + * tstuu.c (uprepare_test): create spool directories by hand, to + make sure test 6 can be done and to test creating needed + directories. + + * conf.h, uucp.h, bnu.c, v2.c, chat.c, protg.c, prott.c, sysinf.c, + tcp.c, getopt.c, tstuu.c, util.c: added HAVE_MEMFNS and HAVE_BFNS + to conf.h. Changed memset calls to use bzero. + + * protg.c (fgcheck_errors, fgprocess_data): added protocol + 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) + + * 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) + + * 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) + + * 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 + conf.h for systems which don't have <unistd.h>. Also added + externs for all functions from <unistd.h>, which required adding + definitions for pid_t, uid_t and off_t to sysh.unx. + + * config.c, prtinf.c, time.c, uuchk.c: added externs for + strcasecmp or strncasecmp, to avoid implicit function definitions + now that I took the prototypes out of uucp.h. + + * sys3.unx (fsysdep_get_status): Franc,ois Pinard: the code added + to avoid scanf had a stupid bug. + + * 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) + + * uucp.h, uucico.c (ucatch), prot.c (fpsendfile_confirm, + fprecfile_confirm, ustats_failed), file.c (fsent_file, + freceived_file), log.c (ustats): Terry Gardner: record failed file + transfers in the statistics file. + + * uucico.c: change protocol ordering to 't', 'g', 'f'. + + * uucico.c (faccept_call), tstuu.c (uprepare_test): John Theus: + don't warn if the port file doesn't exist when the slave mode + uucico looks up the port. + + * sys1.unx, sys5.unx: moved fsysdep_file_exists from sys5.unx to + sys1.unx so that uucico can call it. + + * uux.c: Fran,cois Pinard: remove parentheses from ZSHELLSEPS so + that they may be used to quote arguments as documented. This + means that may not be used to start subshell, but that is no great + loss. + + * uux.c (main): use ulog to report illegal grade error message. + + * 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) + + * uucico.c (fdo_call, faccept_call): Terry Gardner: put the length + of the conversation in the ``Call complete'' log file message. + + * uux.c: added space and tab to ZSHELLSEPS, because otherwise the + command was parsed to include whitespace. + + * protg.c, protf.c: Oleg Tabarovsky: added statistical logging + messages to the 'g' and 'f' protocols. These go to the main log + file right now, but I'm not sure if that's appropriate. + + * sys2.unx (fsserial_set): don't change terminal settings if we + don't have to. + + * port.c (fport_io): add complete diagnostics for fport_io so we + can see every byte that goes in or out. + + * uucico.c (fuucp): don't give user name in errors produced by + getting the next command. + + * uuxqt.c (main): don't process execute files for unknown systems. + This is not unreasonable, I hope, and it avoids errors caused by + an uninitialized sUnknown structure. + + * sys4.unx (fsysdep_get_work_init): sort the previously found + files all together so we can correctly check new files using + bsearch. + + * protf.c (pfprocess, pfprocess_data, pfwait): Franc,ois Pinard: + don't kill 'f' protocol because of an illegal byte. Also slightly + 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) + + * sysh.unx, sys2.unx, tstuu.c: Terry Gardner: added + USE_FOR_UNBLOCKED configuration parameter to support systems that + don't permit O_NONBLOCK and O_NDELAY to both be set. + + * tstuu.c (uchild): give the uucico processes a chance to die on + their own rather than killing them immediately. + + * uuxqt.c (main, uqdo_xqt_file): David Nugent: keep rescanning the + list of execute files until nothing can be done. Also, don't + remove the execute file if we get some sort of internal error. + + * sys4.unx (fsysdep_get_work, usysdep_get_work_free): David + Nugent: after we've processed all the work files we found + initially, rescan the work directory to pick up any that may have + come in in the meantime. Also, reset iSwork_file to 0 in + usysdep_get_work_free so that we can handle more than one system. + + * tstuu.c, uucico.c (main, fwait_for_calls, flogin_prompt): added + -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) + + * uucp.h, uucico.c, uuxqt.c, uux.c, uucp.c, config.c + (uread_config), log.c (ulog): eliminated ulog_program and added + abProgram and ulog_to_file. Made log messages output to stderr + more Unix like. + + * log.c (ulog): use a fixed number of fields in a log file message + by replacing a missing system or user with '-'. + + * port.h, chat.c (renamed fchat_send to fcsend), bnu.c + (fbnu_read_dialer_info), prtinf.c (tpcomplete), sys2.unx + (fsysdep_modem_close), uuchk.c (ukshow_dialer): T. William Wells: + change the modem complete and abort strings into chat scripts. + + * sys2.unx (fsserial_open): on BSD start in RAW mode to avoid + dropping characters when we switch over. I originally thought + being able to use XON/XOFF was worth the risk; I no longer think + so. + + * tstuu.c (uprepare_test): have shell script sleep before printing + the login name to make sure the second system has finished + flushing its input buffer. + + * protg.c (fginit_sendbuffers), prott.c (ftsendcmd): David Nugent: + avoid sending confidential information by zeroing out memory + buffers before using them. + + * sysinf.c (tirequest, titransfer), prtinf.c (tpseven_bit, + tpreliable, tpdtr_toggle): Marc Unangst: several functions did not + accept true and false as boolean strings, contradicting the + documentation. + + * uucp.h, system.h, sysh.unx, sys1.unx (usysdep_full_time), file.c + (fstore_sendfile, fsent_file, fstore_recfile, freceived_file), + log.c (ustats): generate statistics in microseconds instead of + seconds for more accurate time keeping. + + * sys2.unx (fsserial_open): David Nugent: flush pending input + 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) + + * uucico.c (main), uuxqt.c (main), tstuu.c (main, uchild): David + Nugent: ignore SIGHUP in uucico and uuxqt, so that they are + unaffected by the parent shell closing down and by the remote + terminal dropping the connection. + + * bnu.c (ubnu_read_sysfiles, ubnu_read_systems, fbnu_find_port, + 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) + + * sys2.unx (fsserial_open): don't turn on ISTRIP initially. + + * uucp.h, sysinf.c, chat.c (icexpect), uuchk.c (ukshow_chat): + added chat-seven-bit command to allow control over whether + parity bits are stripped out of chat scripts. + + * uucp.h, port.h, chat.c (fchat, fcprogram), + config.c (tprocess_one_cmd), prtinf.c, + sysinf.c (tichat, tprocess_chat_cmd), + bnu.c (fbnu_read_dialer_info), port.c (fpdo_dial), + uucico.c (fdo_call, faccept_call) uuchk.c (ukshow_chat): + changed processing of chat commands to go through + tprocess_chat_cmd, avoiding repetition. All chat script + information is now held in an schat_info structure. + Eliminated the fchat_program function, renaming it fcprogram + and making it static to chat.c (it is now called via fchat). + Added CMDTABTYPE_PREFIX. Added INIT_CHAT macro to initialize + chat script information. Added TTYPE_CMDTABTYPE and + CARGS_CMDTABTYPE to eliminate hex constants in + tprocess_one_cmd. + + * sys5.unx (zsysdep_get_xqt): Oleg Tabarovsky: don't stop + 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) + + * 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) + + * 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 + doesn't send it. + + * chat.c (icexpect, fchat_send): Franc,ois Pinard: add some chat + script debugging messages. + + * log.c (ulog): David Nugent: move ERROR: from the start of the + line to after the date and time; this makes it easier to use awk + on log files. + + * sys3.unx (fsdo_lock), sys1.unx (usysdep_initialize): do locking + using link rather than O_CREAT | O_EXCL to avoid race conditions + and to safely run as the superuser. + + * sys3.unx (fsysdep_move_file): fcopyfile now creates the + destination file with IPRIVATE_MODE, so we don't need to chmod to + it. + + * sys1.unx (usysdep_initialize, fsysdep_other_config): set the + 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) + + * conf.h, uucp.h, util.c (strtol): Mark Powell: added my own + version of strtol to util.c, for systems which lack it. + + * protg.c (fgstart, fgexchange_init): if we start resending + packets during initialization, don't forget which packets we have + 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) + + * 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 + style logging, with some minor additions and changes. + + * sys1.unx, sys3.unx, sys5.unx, uux.c, uucp.c, uucico.c, copy.c, + uucp.h, system.h: create directories when necessary rather than + assuming that they exist. Added fmkdirs argument to esysdep_fopen + and fcopy_file, changing all calls. Added fpublic argument to + fsysdep_make_dirs, changing all calls. Moved fsysdep_make_dirs + and fsdirectory_exists from sys3.unx to sys1.unx. Added checks + for ENOENT in several places in sys3.unx and sys5.unx. + + * log.c, port.c (fport_open), sys2.unx (fsserial_open): added + ulog_device routine to record device name. This is currently only + used for the BNU statistics file, but more uses might arise later. + + * file.c, log.c, uucp.h: moved statistics file routines from + 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) + + * bnu.c (ubnu_read_systems): Arne Ludwig: the device entry for a + system can be followed by a comma and a list of protocols. + + * sysh.unx, sys3.unx (fsdo_lock): Richard Todd: add + HAVE_V2_LOCKFILES, in which the process ID is written out in + binary. + + * uuxqt.c (uqdo_xqt_file): Richard Todd: the requestor address is + relative to the requesting system. + + * config.c (uprocesscmds, umulti_pushback): Richard Todd: each + line pushed back because of "#" is local to a particular + smulti_file structure. + + * prtinf.c (asPdialer_cmds): Richard Todd: exit the current dialer + if the special command "#" is seen. A similar thing should be put + in for ports, but it's marginally more complex. + + * 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) + + * config.c (uprocesscmds): Franc,ois Pinard: don't limit the + number of arguments to a command! + + * 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) + + * sys5.unx (fsysdep_execute): David J. Fiander: if execve fails + with ENOEXEC, try using /bin/sh with a quoted argument. + + * uux.c (main): split arguments the way /bin/sh does. If any + shell metacharacters appears, request uuxqt to execute the command + using /bin/sh. + + * tstuu.c (uprepare_test): allow the uux to test to send a failure + message. + + * uuxqt.c (uqdo_xqt_file): don't send mail on successful execution + unless specifically requested; pay attention to the 'n' line + which requests mail on success; ignore the 'Z' line because it + now specifies the default action. + + * sys1.unx (usysdep_initialize), sys6.unx (zsysdep_add_cwd): + Franc,ois Pinard: getcwd may legitimately fail, so only give an + error if we really need the result. + + * chat.c (ccescape): Franc,ois Pinard: ccescape should never + 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) + + * bnu.c (ubnu_read_systems): Dave Buck: time strings with grades + were parsed in an endless loop! + + * sys3.unx (fsdo_lock, fsdo_unlock): the alloca when using LOCKDIR + was one byte too small. + + * config.c (tprocess_one_cmd): pass 10 to strtol rather than 0 to + avoid surprises if a leading zero is used. + + * prtinf.c (tpproto_param, tpdialer_proto_param): Niels Baggesen: + 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) + + * tstuu.c: don't use the fd_set typedef at all. + + * tstuu.c (uprepare_test): don't read V2 or BNU configuration + files while testing. + + * bnu.c, v2.c, config.c (uread_config): David Nugent: even if the + code was compiled with HAVE_TAYLOR_CONFIG, read the V2 and BNU + configuration files if the code was compiled to support them. + + * 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) + + * tstuu.c: Bob Izenberg: copied over conditional definitions of + EAGAIN and EWOULDBLOCK from sys2.unx. + + * bnu.c (fbnu_read_dialer_info): Niels Baggesen: accept dialers + with no substitutions. + + * bnu.c (ubnu_read_systems, ubadd_perm): Niels Baggesen: don't + free up zline in ubadd_perm; in fact, changed the calling sequence + to not even pass zline in at all. + + * bnu.c (ubadd_perm): Niels Baggesen: didn't handle multiple + MACHINE= and multiple LOGNAME= values in a single Permissions + line, because it was clobbering the machine name while processing + the first logname. + + * bnu.c: Made zread and zwrite elements of sperm structure const + char * to avoid warning. + + * copy.c, sys1.unx, sys2.unx, sys3.unx, sys5.unx, tstuu.c: Niels + Baggesen: don't multiply include <unistd.h>. Eventually there + should be a macro controlling whether it gets included at all, for + non-POSIX systems. + + * sys3.unx (fsysdep_get_status, isysdep_get_sequence): Marty + Shannon: accept a truncated status file. I also eliminated scanf + calls in sys3.unx, since that was the only place it was called; + this was to make the executables smaller for systems which cared. + + * bnu.c (ubnu_read_sysfiles): Marty Shannon: accept comment + characters in Sysfiles. + + * sysh.unx, sys3.unx: Marty Shannon: added HAVE_RENAME, put a fake + rename system call in sys3.unx. + + * prtinf.c (ffind_port): Marty Shannon: failed to handle multiple + ports in the port file since I forgot to reset my pointer + variable. + + * bnu.c (ubnu_read_systems): Marty Shannon: don't initialize the + 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) + + * tstuu.c: Bob Denny: add definitions for FD_SET, FD_ZERO and + FD_ISSET. + + * config.c: Bob Denny: add explicit externs for strcmp and + strcasecmp. + + * sys2.unx: the fread_blocking and fwrite_blocking fields were + not getting initialized correctly in the TCP support routines. + + * sysh.unx, sys2.unx, sys5.unx, tstuu.c: Marty Shannon: added + configuration option HAVE_SYSWAIT_H. + + * bnu.c (fbnu_find_port, fbnu_read_dialer_info), v2.c + (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) + + * 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) + + * Released version 1.01 to alt.sources and uunet + diff --git a/gnu/libexec/uucp/Makefile b/gnu/libexec/uucp/Makefile new file mode 100644 index 000000000000..0ba0cc2402f1 --- /dev/null +++ b/gnu/libexec/uucp/Makefile @@ -0,0 +1,9 @@ +# This is the Makefile for Taylor UUCP +# $Id: Makefile,v 1.2 1993/10/14 12:17:57 rgrimes Exp $ + +SUBDIR= libunix libuucp libuuconf \ + cu sample \ + uuchk uucico uuconv uucp uulog uuname uupick uusched \ + uustat uuto uux uuxqt + +.include <bsd.subdir.mk> diff --git a/gnu/libexec/uucp/Makefile.inc b/gnu/libexec/uucp/Makefile.inc new file mode 100644 index 000000000000..b9bac708a1ab --- /dev/null +++ b/gnu/libexec/uucp/Makefile.inc @@ -0,0 +1,31 @@ +.if exists(${.CURDIR}/../libunix/obj) +LIBUNIX= $(.CURDIR)/../libunix/obj/libunix.a +.else +LIBUNIX= $(.CURDIR)/../libunix/libunix.a +.endif + +.if exists(${.CURDIR}/../libuuconf/obj) +LIBUUCONF= $(.CURDIR)/../libuuconf/obj/libuuconf.a +.else +LIBUUCONF= $(.CURDIR)/../libuuconf/libuuconf.a +.endif + +.if exists(${.CURDIR}/../libuucp/obj) +LIBUUCP= $(.CURDIR)/../libuucp/obj/libuucp.a +.else +LIBUUCP= $(.CURDIR)/../libuucp/libuucp.a +.endif + +VERSION= 1.04 +owner= uucp +group= wheel +bindir= /usr/bin +sbindir= /usr/libexec/uucp + +# The directory to look in for new style configuration files (when +# using HAVE_TAYLOR_CONFIG). +newconfigdir= /etc/uucp + +# The directory to look in for BNU (when using HAVE_BNU_CONFIG) or +# V2 (when using HAVE_V2_CONFIG) style configuration files. +oldconfigdir= /etc/uucp diff --git a/gnu/libexec/uucp/README b/gnu/libexec/uucp/README new file mode 100644 index 000000000000..bfcd46c3f2ae --- /dev/null +++ b/gnu/libexec/uucp/README @@ -0,0 +1,207 @@ +This is the README file for version 1.04 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. + +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. +Mail to this address is answered by a person, not a program. When +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. + +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 +license, contact me to see if we can work it out. + +WHAT IT IS + +This is the complete source code for a Unix UUCP package. It provides +everything you need to make a UUCP connection. It includes versions +of uucico, uusched, uuxqt, uux, uucp, uustat, uulog, uuname, uuto, +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. + +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 +new bidirectional protocols. If you have a Berkeley sockets library, +it can make TCP connections. If you have TLI libraries, it can make +TLI connections. It supports a new configuration file mechanism which +I like (but other people dislike). + +The package has a few advantages over regular UUCP: + + You get the source code. + + It uses significantly less CPU time than many UUCP packages. + + You can specify a chat script to run when a system calls in, + allowing adjustment of modem parameters on a per system basis. + + You can specify failure strings for chat scripts, allowing the + chat script to fail immediately if the modem returns ``BUSY''. + + If you are talking to another instance of the package, you can use + the new bidirectional protocol for rapid data transfer in both + directions at once. You can also restrict file transfers by size + based on the time of day and who placed the call. + +On the other hand: + + It only runs on Unix. The code is carefully divided into system + dependent and system independent portions, so it should be + possible to port it to other systems. It would not be trivial. + + You don't get uuclean, uusend, uuq, uusnap, uumonitor, uutry, + uupoll, etc. If you have current copies of these programs, you + may be able to use them. Shell scripts versions of uuclean and + uutry are provided, with most, if not all, of the functionality of + the usual programs. I believe the supplied uustat program allows + you to do everything that uuq, uusnap and uumonitor do. uupoll + could be written as a shell script. + + The package does not read modemcap or acucap files, although you + can use V2 configuration files with a BNU Dialers file or a dialer + file written in my new configuration file format. + + The package cannot use SCO dialer programs directly, although it + can with a simple shell script interface. + +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. + +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 +suggestions for new things to do. + +The compilation instructions are in uucp.texi. Here is a summary. + + Edit Makefile.in to set installation directories. + + Type ``sh configure''. You can pass a number of arguments in the + environment (using bash or sh, enter something like ``CC=gcc + configure''; using csh, enter something like ``setenv CC gcc; sh + configure''): + CC: C compiler to use; default is gcc if it exists, else cc + CFLAGS: Flags to pass to $CC when compiling; default -g + LDFLAGS: Flags to pass to $CC when only linking; default none + LIBS: Library arguments to pass to $CC; default none + INSTALL: Install program; default install -c or cp + INSTALLDATA: Install data; default install -c -m 0644 or cp + The configure script will compile a number of test programs to see + 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 + 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 + later versions. + + Igor V. Semenyuk provided this (lightly edited) note about ISC + Unix 3.0. The configure script will default to passing -posix to + gcc. However, using -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 + mailertable.{dir,pag}. Notice these names are 15 characters long. + When uuxqt compiled with -posix executes rmail, which in turn + executes sendmail, the later is run under POSIX environment too! + This leads to sendmail bombing out with '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 -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. + + Edit policy.h for your local system. + + Type ``make''. + + Use ``uuchk'' to check configuration files. You can use + ``uuconv'' to convert between configuration file formats. + + Type ``make install'' to install. diff --git a/gnu/libexec/uucp/TODO b/gnu/libexec/uucp/TODO new file mode 100644 index 000000000000..a1cc643ab52f --- /dev/null +++ b/gnu/libexec/uucp/TODO @@ -0,0 +1,573 @@ +This is a list of things to do for the Taylor UUCP package. Please +feel free to work on any of them. You may want to check with me first +to make sure that nobody else is working on them as well. + +Some of these are my thoughts, but most are suggestions from other +people; I have tried to give credit. They are in the order I received +them; the missing numbers have already been implemented. + +Just because something is on the list doesn't mean that I necessarily +think it is a good idea. It does mean that I think it's worth +thinking about. + +2. + +John Cowan <cowan@snark.thyrsus.com> says: + +>I think you should accept a broader range of time specifications. +>Consider using getdate() (from your handy Usenet news source code) +>with its high-powered yacc parser. + +Of course, getdate() accepts a single date, but we want a range. A +better syntax would be certainly be nice. + +9. + +Gordon Burditt <gordon@sneaky.lonestar.org> warns about modifications +to the TZ environment variable, to fool uucico into dialing out at an +inappropriate time. + +10. + +Gordon Burditt <gordon@sneaky.lonestar.org> says: + +>(4) Less important, because few people will have this problem, is a +>port-specific dialcodes file. Why? Well, one system I had was connected +>to 2 inside lines "dial 9 for outside line", and one outside line (which +>doesn't want the 9). A number of the systems called were "inside", so +>you didn't add the 9 on those lines dialing from inside, but you did add +>"390" to the 4-digit number if you dialed it via "outside". Also not +>unheard of are systems with 2 outside lines that are local to different +>area codes, or one local outside line and one WATS line (which MUST +>have an area code). +>Example: +> inside-line Dialcodes outside-line Dialcodes +> pbx "" pbx "390" +> local "9" local "" +> nyc "9-1212" nyc "1212" + +12. + +Ralf E. Stranzenbach <ralf@reswi.ruhr.de> says: + +>It would be nice to also have the option of running a shell script each time +>uucico connects/disconnects a systen. I do not mean shell scripts for dial/in. +>I would like to do some accounting and batching when the connection +>establishes. + +13. + +les@chinet.chi.il.us (Leslie Mikesell) writes: + +>>local-send /usr/spool/uucppublic !/usr/spool/uucpublic/private +>> +>>The directories are searched from left to right, and the last one to +>>match determines whether the file may be sent or not. This is +>>slightly more general than NOWRITE, since it permits a public +>>directory within a private directory within a public directory, +>>although probably nobody will ever want that. +> +>Interesting... The obvious enhancement is to generalize to shell-like +>wild cards for the READ/WRITE/COMMANDS entries. + +14. + +Should there be a way for chat scripts to specify the parity to +generate? I don't think there's much point to specifying what parity +to accept. + +17. + +The -b and -s switches to uux are not implemented by uuxqt. + +18. + +If we are supposed to call a system back, we should do it immediately +rather than merely queuing up an empty command file. + +22. + +Add an ftp port type which uses anonymous ftp rather than any of the +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. +This is complicated by the possibility of wanting to wait for any of +several different lines, and one would really want some sort of +semaphore function to do it right. If the available lines could be +sorted, then each could be assigned to a byte in a line lock file. +Looking for a line could be done by sleeping on a read lock on all +possible lines. Once it came through, write locks would be attempted. +If they all failed, somebody else snuck in, so you would sleep on a +read lock again. This isn't great because a process could be starved, +but it might be better than nothing. + +This could be tied in to uucp and uux, such that they wouldn't +actually fire up uucico unless a line was known to be available; an +additional switch would be used to fire up uucico anyhow (or one could +switch the default behaviour and the switch). + +So how do you sort the lines? You could just use the index in the +port (or Devices) file, but what if multiple ports used the same +physical device? Hmmm. + +43. + +David Nugent: it would be nice to be able to set debugging, log, and +statistics files on a site by site basis. +Brian Murrell: heck, set those files on a port by port basis as well. + +74. + +Yanek Martinson: allow each system to independently choose whether to +permit shell execution. + +81. + +Marty Shannon: log reason for dial failure (chat-fail string) in +.Status file. + +83. + +Switch between 'M' and 'S' correctly in the BNU log file output. + +86. + +Les Mikesell: allow a separate program to be specified to handle the +communications with a particular system. + +105. + +T. William Wells: close and open the Debug file after each file +transfer. Alternatively, cycle through a series of Debug file names +every 1000 lines or so. + +106. + +Marty Shannon: add a time command for ports, to specify when they may +be used. + +115. + +T. William Wells: new options for uustat: + -i display job ids only +Also, there should perhaps be a configuration option to request uustat +to only display jobs submitted by the user running uustat, except for +root and uucp. + +117. + +Marc Unangst: provide some way to change the debugging level of a +running uucico. T. William Wells suggests having it read a file to +change arbitrary configuration information, although obviously one has +to be careful of what gets changed while a connection is active. + +120. + +Jarmo Raiha: new chat-fail commands: one to not update the status file +and require a retry wait, and one to permit the string to occur a few +times before reporting an error. + +124. + +Peter da Silva: perhaps there should be a ``chat-end-program'' command +to let a program be run after the initial handshake has been completed +and the protocol has been selected and turned on. This would let +people run stty to change their terminal parameters. + +128. + +Richard Stallman: have an interactive program to set up a chat script. +It would let you type directly to the port, recording what you type as +send strings and recording what comes back from the other side as +expect strings. + +129. + +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 +the line number reached in current C. file processing. This is a +hack, and won't work right with size control anyhow, but +fsysdep_did_work could, for example, clobber the first byte in the +line to a # or something to mark that it had been finished. Still a +hack, but a better one. + +139. + +Patrick Smith: incorporate patches to generate full debugging traces +with less debugging file overhead. The debugging file repeats too +much information at great length right now--not good. + +141. + +Franc,ois Pinard: batch up pauses and delays in chat scripts and do +them all at once in a single system call. This is particularly useful +for pauses on systems which don't support subsecond sleeps. For +everything else it's a fairly minor optimization. + +142. + +Franc,ois Pinard: give uustat an option to requeue jobs to another +system. This only makes a lot of sense for rmail executions, but it's +fairly easy to do for any type of command. I think uucico does all +the file checking needed to ensure that this doesn't break security, +but that should be double-checked. + +144. + +T. William Wells: add a -g option to uucico to permit specifying the +maximum grade to be transferred at that time. This could restrict the +timegrade command further, but should not be permitted to override it. + +145. + +T. William Wells: if uucico or uuxqt get started with bad arguments, +put an indication in the log file since stderr may be /dev/null. + +146. + +Richard Todd: it would be nice to sometimes be able to request the +other side to turn on debugging. + +147. + +Bart Schaefer: some more possible options for uucico: + -R reverse roles (hangup immediately). Not too exciting. + some method to restrict calling to particular systems. + +148. + +Jarmo Raiha: some method to control the work queue at the remote end. +This could get awfully general, though. + +149. + +The interaction of the time command and defaults can be confusing, +since any time command in the actual system entry, even a fairly +specific one, will wipe out the default entry. Not sure what can be +done about this. + +150. + +Jarmo Raiha: should there be some way to specify modem initialization +strings when uucico is hanging on a port with -l or -e? This would +presumably require a new type of chat script associated with a dialer. + +151. + +Petri Helenius: log complete CONNECT string reported by modem, so that +the baud rate is recorded in the log file. + +152. + +Marc Evans: let the protocol selection be based on the CONNECT string, +so that different protocols could be selected based on what type of +connection was made. + +153. + +Chris Lewis: provide a signal to get a core dump even on systems which +won't do core dumps if the uid is not the euid. One could catch a +signal, call setuid (getuid ()), and then raise the signal again. +Unfortunately the core dump has to wind up in a directory which is +world writable, so that the process is able to create the core file, +but is not world readable, since that would permit anybody to read the +core dump file and extract private information from it. + +154. + +Les Mikesell: write a new version of dial.o, with provisions for +running a chat script. + +155. + +Scott Blachowicz: perhaps there should be some way to telling uucico +to not log certain errors. This could get fairly complex, though. + +156. + +Franc,ois Pinard: have uustat -m report the time of the last +successful conversation when reporting a failure. + +158. + +Thomas Fischer: should there be a way to completely disable an entry +in the sys, port or dial file? Such as a ``disable'' command? + +159. + +Petri Helenius: when uuxqt -s is invoked, lock uuxqt for the system so +that only one uuxqt is invoked per system. If the -c option is used, +don't lock on a per system basis, and ignore any per system locks +(regardless of -s). If neither option is used, respect existing +system and command locks, and do any other type of file. + +161. + +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. + +165. + +Marc Sheldon: use exit codes from <sysexits.h> in uux and uucp. + +166. + +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 +hang up the connection. This requires a protocol extension, since +there's no way to force the other side to hang up. The best we can do +without an extension is refuse to send any new jobs ourselves. Of +course, we could just drop the connection. + +169. + +Franc,ois Pinard: when given uustat -k00FC, check each possible job ID +and use it if there is an unambiguous one. + +170. + +T. William Wells: if ! HAVE_SETREUID && ! HAVE_SAVED_SETUID, fork a +subprocesses to revoke setuid and read the file over a pipe. + +171. + +Provide some option to have the internal uuconf functions not start +with an underscore. + +172. + +T. William Wells: have some way to configure the parity for cu. + +173. + +Gert Doering: uuchk should display unknown system information. + +175. + +T. William Wells: +Cu will not let itself be interrupted before the connection is +established. If the chat script doesn't write something, cu does +something odd, I've forgotten exactly what. Cu takes an +inordinate amount of time after the line drops to exit. Somebody, +cu, I think, but maybe uucico, drops dtr twice sometimes. Again, +somebody will attempt to write after a hangup signal has been +received. Once a hangup has been received, I/O should not be +attempted. Among other things this will save the bacon of those +who have brain damaged serial drivers (FAS, sigh, is among them) +that don't handle output properly on a dropped line. + +Me: +Note that sometimes you do want to write to a line after receiving a +hangup signal. For example, you might want to use ATZ to reset a +modem. + +176. + +Hans-Dieter Doll: provide some way (another escape sequence) to pass +the protocol to a chat-program. Or, allow the protocol as an argument +to the chat script command, which is more general, but maybe a bit too +fancy. + +177. + +Nickolay Saukh: use a default port for cu, you can just do ``cu +number''. + +178. + +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 +system to start sending from that point. We currently accept SVR4 +style remote file positioning requests, but we do not generate them. + +181. + +Mark Powell: provide some way to restrict file transfer by size as +well as grade? One way would be to let uux select the grade based on +the file size. + +182. + +Mark Powell: permit using multiple timetables in a single time +statement. + +183. + +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 +hold up the queue. Unfortunately, I don't know what can be done +except deny the command and report it. Reporting a garbled command +error should report the command correctly, rather than just the first +character. + +186. + +Franc,ois Pinard: have an option to control nostop vs. stop on the cu +command line. + +187. + +Fix the notion of %nostop to be SVID compatible. + +188. + +Frank Conrad: provide a means to set the strip mode for a port, to +make it easy to use it from cu. + +189. + +Marc Unangst: there should be a way to specify that a system should +only be called if there are jobs of a certain grade, but if the system +is called then jobs of any grade should be transferred. This +basically means splitting the ``timegrade'' command into two commands: +``place-call-timegrade'' and ``transfer-timegrade''. Or maybe another +optional argument to ``timegrade'': + timegrade grade time-string [retry] [transfer-any] +not to mention + time time-string [retry] [transfer-any] +Or maybe a separate command for a system or port like + transfer-any BOOL + +190. + +Chip Salzenberg: it would be really nice if uucico could automatically +figure out when it could use an E command, so that uux didn't have to +generate it and so that uucico could use with other versions of uux. +Unfortunately, it would require uucico to read the execution file to +see if it were suitable; this would be complex, but it would probably +be worth it since normally the execution file would wind up not being +sent. Of course, the current method works too; it's just harder to +combine with other versions of UUCP. + +191. + +Brian J. Murrell: should there be a way to cu a specific alternate? + +192. + +Andrew A. Chernov: Perhaps cu -pport system should be able to try +different alternates for the system, because there might be different +phone numbers to try. + +193. + +Brian J. Murrell: it would be nice to be able to ^C a cu chat script +if you know it's going to fail. Right now you have to use ^\. + +194. + +Steven S. Dick: have some way to force uucico off the phone at a +certain time. If that is done, it might be cool to have some way to +predict how long a file transfer will take, and not do it if it will +take too long. But, if doing file restart, you can just quit and then +pick it up later. + +195. + +Franc,ois Pinard: if the disk fills up, or some other error occurs, +while receiving a file, perhaps it would make sense to turn the +connection around immediately and see if the other side had anything +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. + +198. + +Lele Gaifax: mention the device in Stats, and provide some way to +associate the entry in Log with the entry in Stats. + +199. + +Michael Richardson: provide some way to turn on parity for the login +chat, since some systems apparently require it. Provide some way for +cu to control parity after connecting. + +200. + +Chip Salzenberg: add max-remote-debug to config. + +201. + +Gert Doering: change the timeout message in chat scripts to reflect +which chat script timed out (dialer or login). + +202. + +Bill Foote: have uuchk check whether a system is defined more than +once. + +203. diff --git a/gnu/libexec/uucp/VERSION b/gnu/libexec/uucp/VERSION new file mode 100644 index 000000000000..99fd8f0eef77 --- /dev/null +++ b/gnu/libexec/uucp/VERSION @@ -0,0 +1,4 @@ +Version 1.04 + +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 new file mode 100644 index 000000000000..8544ed2e2027 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/chat.c @@ -0,0 +1,1429 @@ +/* chat.c + Chat routine for the UUCP package. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#include <ctype.h> +#include <errno.h> + +#include "uudefs.h" +#include "uuconf.h" +#include "conn.h" +#include "prot.h" +#include "system.h" + +/* Local functions. */ + +static int icexpect P((struct sconnection *qconn, int cstrings, + char **azstrings, size_t *aclens, + int ctimeout, boolean fstrip)); +static boolean fcsend P((struct sconnection *qconn, pointer puuconf, + const char *zsend, + const struct uuconf_system *qsys, + const struct uuconf_dialer *qdial, + const char *zphone, + boolean ftranslate, boolean fstrip)); +static boolean fcecho_send_strip P((struct sconnection *qconn, + const char *z, size_t clen)); +static boolean fcecho_send_nostrip P((struct sconnection *qconn, + const char *z, size_t clen)); +static boolean fcecho_send P((struct sconnection *qconn, const char *z, + size_t clen, boolean fstrip)); +static boolean fcphone P((struct sconnection *qconn, + pointer puuconf, + const struct uuconf_dialer *qdial, + const char *zphone, + boolean (*pfwrite) P((struct sconnection *qc, + const char *zwrite, + size_t cwrite)), + boolean ftranslate, boolean *pfquote)); +static boolean fctranslate P((pointer puuconf, const char *zphone, + const char **pzprefix, + const char **pzsuffix)); +static boolean fcprogram P((struct sconnection *qconn, pointer puuconf, + char **pzprogram, + const struct uuconf_system *qsys, + const struct uuconf_dialer *qdial, + const char *zphone, const char *zport, + long ibaud)); + +/* Run a chat script with the other system. The chat script is a + series of expect send pairs. We wait for the expect string to show + up, and then we send the send string. The chat string for a system + holds the expect and send strings separated by a single space. */ + +boolean +fchat (qconn, puuconf, qchat, qsys, qdial, zphone, ftranslate, zport, ibaud) + struct sconnection *qconn; + pointer puuconf; + const struct uuconf_chat *qchat; + const struct uuconf_system *qsys; + const struct uuconf_dialer *qdial; + const char *zphone; + boolean ftranslate; + const char *zport; + long ibaud; +{ + int cstrings; + char **azstrings; + size_t *aclens; + char **pzchat; + char *zbuf; + size_t cbuflen; + boolean fret; + int i; + + /* First run the program, if any. */ + if (qchat->uuconf_pzprogram != NULL) + { + if (! fcprogram (qconn, puuconf, qchat->uuconf_pzprogram, qsys, qdial, + zphone, zport, ibaud)) + return FALSE; + } + + /* If there's no chat script, we're done. */ + if (qchat->uuconf_pzchat == NULL) + return TRUE; + + if (qchat->uuconf_pzfail == NULL) + { + cstrings = 1; + azstrings = (char **) xmalloc (sizeof (char *)); + aclens = (size_t *) xmalloc (sizeof (size_t)); + } + else + { + char **pz; + + /* We leave string number 0 for the chat script. */ + cstrings = 1; + for (pz = qchat->uuconf_pzfail; *pz != NULL; pz++) + ++cstrings; + + azstrings = (char **) xmalloc (cstrings * sizeof (char *)); + aclens = (size_t *) xmalloc (cstrings * sizeof (size_t)); + + /* Get the strings into the array, and handle all the escape + characters. */ + for (cstrings = 1, pz = qchat->uuconf_pzfail; + *pz != NULL; + cstrings++, pz++) + { + azstrings[cstrings] = zbufcpy (*pz); + aclens[cstrings] = cescape (azstrings[cstrings]); + } + } + + cbuflen = 0; + zbuf = NULL; + fret = TRUE; + + pzchat = qchat->uuconf_pzchat; + + while (*pzchat != NULL) + { + size_t clen; + + /* Loop over subexpects and subsends. */ + while (TRUE) + { + /* Copy the expect string into the buffer so that we can + modify it in cescape. */ + clen = strlen (*pzchat); + if (clen >= cbuflen) + { + ubuffree (zbuf); + zbuf = zbufalc (clen + 1); + cbuflen = clen; + } + memcpy (zbuf, *pzchat, clen + 1); + + azstrings[0] = zbuf; + if (azstrings[0][0] == '-') + ++azstrings[0]; + aclens[0] = cescape (azstrings[0]); + + if (aclens[0] == 0 + || (aclens[0] == 2 + && strcmp (azstrings[0], "\"\"") == 0)) + { + /* There is no subexpect sequence. If there is a + subsend sequence we move on to it. Otherwise we let + this expect succeed. This is somewhat inconsistent, + but it seems to be the traditional approach. */ + if (pzchat[1] == NULL || pzchat[1][0] != '-') + break; + } + else + { + int istr; + + istr = icexpect (qconn, cstrings, azstrings, aclens, + qchat->uuconf_ctimeout, + qchat->uuconf_fstrip); + + /* If we found the string, break out of the + subexpect/subsend loop. */ + if (istr == 0) + break; + + /* If we got an error, return FALSE. */ + if (istr < -1) + { + fret = FALSE; + break; + } + + /* If we found a failure string, log it and get out. */ + if (istr > 0) + { + ulog (LOG_ERROR, "Chat script failed: Got \"%s\"", + qchat->uuconf_pzfail[istr - 1]); + fret = FALSE; + break; + } + + /* We timed out; look for a send subsequence. If none, + the chat script has failed. */ + if (pzchat[1] == NULL || pzchat[1][0] != '-') + { + ulog (LOG_ERROR, "Timed out in chat script"); + fret = FALSE; + break; + } + } + + /* Send the send subsequence without the leading '-'. A + \"\" will send nothing. An empty string will send a + carriage return. */ + ++pzchat; + if (! fcsend (qconn, puuconf, *pzchat + 1, qsys, qdial, zphone, + ftranslate, qchat->uuconf_fstrip)) + { + fret = FALSE; + break; + } + + /* If there is no expect subsequence, we are done. */ + if (pzchat[1] == NULL || pzchat[1][0] != '-') + break; + + /* Move on to next expect subsequence. */ + ++pzchat; + } + + if (! fret) + break; + + /* Move on to the send string. If there is none, we have + succeeded. */ + do + { + ++pzchat; + } + while (*pzchat != NULL && (*pzchat)[0] == '-'); + + if (*pzchat == NULL) + break; + + if (**pzchat != '\0') + { + if (! fcsend (qconn, puuconf, *pzchat, qsys, qdial, zphone, + ftranslate, qchat->uuconf_fstrip)) + { + fret = FALSE; + break; + } + } + + ++pzchat; + } + + ubuffree (zbuf); + for (i = 1; i < cstrings; i++) + ubuffree (azstrings[i]); + xfree ((pointer) azstrings); + xfree ((pointer) aclens); + + return fret; +} + +/* Read characters and wait for one of a set of memory strings to come + in. This returns the index into the array of the string that + arrives, or -1 on timeout, or -2 on error. */ + +static int +icexpect (qconn, cstrings, azstrings, aclens, ctimeout, fstrip) + struct sconnection *qconn; + int cstrings; + char **azstrings; + size_t *aclens; + int ctimeout; + boolean fstrip; +{ + int i; + size_t cmax; + char *zhave; + size_t chave; + long iendtime; +#if DEBUG > 1 + int cchars; + int iolddebug; +#endif + + cmax = aclens[0]; + for (i = 1; i < cstrings; i++) + if (cmax < aclens[i]) + cmax = aclens[i]; + + zhave = zbufalc (cmax); + chave = 0; + + iendtime = ixsysdep_time ((long *) NULL) + ctimeout; + +#if DEBUG > 1 + cchars = 0; + iolddebug = iDebug; + if (FDEBUGGING (DEBUG_CHAT)) + { + udebug_buffer ("icexpect: Looking for", azstrings[0], + aclens[0]); + ulog (LOG_DEBUG_START, "icexpect: Got \""); + iDebug &=~ (DEBUG_INCOMING | DEBUG_PORT); + } +#endif + + while (TRUE) + { + int bchar; + + /* If we have no more time, get out. */ + if (ctimeout <= 0) + { +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_CHAT)) + { + ulog (LOG_DEBUG_END, "\" (timed out)"); + iDebug = iolddebug; + } +#endif + ubuffree (zhave); + return -1; + } + + /* Read one character at a time. We could use a more complex + algorithm to read in larger batches, but it's probably not + worth it. If the buffer is full, shift it left; we already + know that no string matches, and the buffer holds the largest + string, so this can't lose a match. */ + if (chave >= cmax) + { + size_t imove; + + for (imove = 0; imove < cmax - 1; imove++) + zhave[imove] = zhave[imove + 1]; + --chave; + } + + /* The timeout/error return values from breceive_char are the + same as for this function. */ + bchar = breceive_char (qconn, ctimeout, TRUE); + if (bchar < 0) + { +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_CHAT)) + { + /* If there was an error, it will probably be logged in + the middle of our string, but this is only debugging + so it's not a big deal. */ + ulog (LOG_DEBUG_END, "\" (%s)", + bchar == -1 ? "timed out" : "error"); + iDebug = iolddebug; + } +#endif + ubuffree (zhave); + return bchar; + } + + /* Strip the parity bit if desired. */ + if (fstrip) + bchar &= 0x7f; + + zhave[chave] = (char) bchar; + ++chave; + +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_CHAT)) + { + char ab[5]; + + ++cchars; + if (cchars > 60) + { + ulog (LOG_DEBUG_END, "\""); + ulog (LOG_DEBUG_START, "icexpect: Got \""); + cchars = 0; + } + (void) cdebug_char (ab, bchar); + ulog (LOG_DEBUG_CONTINUE, "%s", ab); + } +#endif + + /* See if any of the strings can be found in the buffer. Since + we read one character at a time, the string can only be found + at the end of the buffer. */ + for (i = 0; i < cstrings; i++) + { + if (aclens[i] <= chave + && memcmp (zhave + chave - aclens[i], azstrings[i], + aclens[i]) == 0) + { +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_CHAT)) + { + if (i == 0) + ulog (LOG_DEBUG_END, "\" (found it)"); + else + { + ulog (LOG_DEBUG_END, "\""); + udebug_buffer ("icexpect: Found", azstrings[i], + aclens[i]); + } + iDebug = iolddebug; + } +#endif + ubuffree (zhave); + return i; + } + } + + ctimeout = (int) (iendtime - ixsysdep_time ((long *) NULL)); + } +} + +#if DEBUG > 1 + +/* Debugging function for fcsend. This takes the fquote variable, the + length of the string (0 if this an informational string which can + be printed directly) and the string itself. It returns the new + value for fquote. The fquote variable is TRUE if the debugging + output is in the middle of a quoted string. */ + +static size_t cCsend_chars; +static int iColddebug; + +static boolean fcsend_debug P((boolean, size_t, const char *)); + +static boolean +fcsend_debug (fquote, clen, zbuf) + boolean fquote; + size_t clen; + const char *zbuf; +{ + size_t cwas; + + if (! FDEBUGGING (DEBUG_CHAT)) + return TRUE; + + cwas = cCsend_chars; + if (clen > 0) + cCsend_chars += clen; + else + cCsend_chars += strlen (zbuf); + if (cCsend_chars > 60 && cwas > 10) + { + ulog (LOG_DEBUG_END, "%s", fquote ? "\"" : ""); + fquote = FALSE; + ulog (LOG_DEBUG_START, "fcsend: Writing"); + cCsend_chars = 0; + } + + if (clen == 0) + { + ulog (LOG_DEBUG_CONTINUE, "%s %s", fquote ? "\"" : "", zbuf); + return FALSE; + } + else + { + int i; + + if (! fquote) + ulog (LOG_DEBUG_CONTINUE, " \""); + for (i = 0; i < clen; i++) + { + char ab[5]; + + (void) cdebug_char (ab, zbuf[i]); + ulog (LOG_DEBUG_CONTINUE, "%s", ab); + } + + return TRUE; + } +} + +/* Finish up the debugging information for fcsend. */ + +static void ucsend_debug_end P((boolean, boolean)); + +static void +ucsend_debug_end (fquote, ferr) + boolean fquote; + boolean ferr; +{ + if (! FDEBUGGING (DEBUG_CHAT)) + return; + + if (fquote) + ulog (LOG_DEBUG_CONTINUE, "\""); + + if (ferr) + ulog (LOG_DEBUG_CONTINUE, " (error)"); + + ulog (LOG_DEBUG_END, "%s", ""); + + iDebug = iColddebug; +} + +#else /* DEBUG <= 1 */ + +/* Use macro definitions to make fcsend look neater. */ + +#define fcsend_debug(fquote, clen, zbuf) TRUE + +#define ucsend_debug_end(fquote, ferror) + +#endif /* DEBUG <= 1 */ + +/* Send a string out. This has to parse escape sequences as it goes. + Note that it handles the dialer escape sequences (\e, \E, \D, \T) + although they make no sense for chatting with a system. */ + +static boolean +fcsend (qconn, puuconf, z, qsys, qdial, zphone, ftranslate, fstrip) + struct sconnection *qconn; + pointer puuconf; + const char *z; + const struct uuconf_system *qsys; + const struct uuconf_dialer *qdial; + const char *zphone; + boolean ftranslate; + boolean fstrip; +{ + boolean fnocr; + boolean (*pfwrite) P((struct sconnection *, const char *, size_t)); + char *zcallout_login; + char *zcallout_pass; + boolean fquote; + + if (strcmp (z, "\"\"") == 0) + return TRUE; + + fnocr = FALSE; + pfwrite = fconn_write; + zcallout_login = NULL; + zcallout_pass = NULL; + +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_CHAT)) + { + ulog (LOG_DEBUG_START, "fcsend: Writing"); + fquote = FALSE; + cCsend_chars = 0; + iColddebug = iDebug; + iDebug &=~ (DEBUG_OUTGOING | DEBUG_PORT); + } +#endif + + while (*z != '\0') + { + const char *zlook; + boolean fsend; + char bsend; + + zlook = z + strcspn ((char *) z, "\\BE"); + + if (zlook > z) + { + size_t c; + + c = zlook - z; + fquote = fcsend_debug (fquote, c, z); + if (! (*pfwrite) (qconn, z, c)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + } + + if (*zlook == '\0') + break; + + z = zlook; + + fsend = FALSE; + switch (*z) + { + case 'B': + if (strncmp (z, "BREAK", 5) == 0) + { + fquote = fcsend_debug (fquote, (size_t) 0, "break"); + if (! fconn_break (qconn)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + fnocr = TRUE; + z += 5; + } + else + { + fsend = TRUE; + bsend = 'B'; + ++z; + } + break; + case 'E': + if (strncmp (z, "EOT", 3) == 0) + { + fsend = TRUE; + bsend = '\004'; + fnocr = TRUE; + z += 3; + } + else + { + fsend = TRUE; + bsend = 'E'; + ++z; + } + break; + case '\\': + ++z; + switch (*z) + { + case '-': + fsend = TRUE; + bsend = '-'; + break; + case 'b': + fsend = TRUE; + bsend = '\b'; + break; + case 'c': + fnocr = TRUE; + break; + case 'd': + fquote = fcsend_debug (fquote, (size_t) 0, "sleep"); + usysdep_sleep (2); + break; + case 'e': + fquote = fcsend_debug (fquote, (size_t) 0, "echo-check-off"); + pfwrite = fconn_write; + break; + case 'E': + fquote = fcsend_debug (fquote, (size_t) 0, "echo-check-on"); + if (fstrip) + pfwrite = fcecho_send_strip; + else + pfwrite = fcecho_send_nostrip; + break; + case 'K': + fquote = fcsend_debug (fquote, (size_t) 0, "break"); + if (! fconn_break (qconn)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + break; + case 'n': + fsend = TRUE; + bsend = '\n'; + break; + case 'N': + fsend = TRUE; + bsend = '\0'; + break; + case 'p': + fquote = fcsend_debug (fquote, (size_t) 0, "pause"); + usysdep_pause (); + break; + case 'r': + fsend = TRUE; + bsend = '\r'; + break; + case 's': + fsend = TRUE; + bsend = ' '; + break; + case 't': + fsend = TRUE; + bsend = '\t'; + break; + case '\0': + --z; + /* Fall through. */ + case '\\': + fsend = TRUE; + bsend = '\\'; + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + fsend = TRUE; + bsend = *z - '0'; + if (z[1] >= '0' && z[1] <= '7') + bsend = (char) (8 * bsend + *++z - '0'); + if (z[1] >= '0' && z[1] <= '7') + bsend = (char) (8 * bsend + *++z - '0'); + break; + case 'x': + fsend = TRUE; + bsend = 0; + while (isxdigit (BUCHAR (z[1]))) + { + if (isdigit (BUCHAR (z[1]))) + bsend = (char) (16 * bsend + *++z - '0'); + else if (isupper (BUCHAR (z[1]))) + bsend = (char) (16 * bsend + *++z - 'A'); + else + bsend = (char) (16 * bsend + *++z - 'a'); + } + break; + case 'L': + { + const char *zlog; + + if (qsys == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "Illegal use of \\L"); + return FALSE; + } + zlog = qsys->uuconf_zcall_login; + if (zlog == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "No login defined"); + return FALSE; + } + if (zlog[0] == '*' && zlog[1] == '\0') + { + if (zcallout_login == NULL) + { + int iuuconf; + + iuuconf = uuconf_callout (puuconf, qsys, + &zcallout_login, + &zcallout_pass); + if (iuuconf == UUCONF_NOT_FOUND + || zcallout_login == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "No login defined"); + return FALSE; + } + else if (iuuconf != UUCONF_SUCCESS) + { + ucsend_debug_end (fquote, TRUE); + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + return FALSE; + } + } + zlog = zcallout_login; + } + fquote = fcsend_debug (fquote, (size_t) 0, "login"); + fquote = fcsend_debug (fquote, strlen (zlog), zlog); + if (! (*pfwrite) (qconn, zlog, strlen (zlog))) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + } + break; + case 'P': + { + const char *zpass; + + if (qsys == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "Illegal use of \\P"); + return FALSE; + } + zpass = qsys->uuconf_zcall_password; + if (zpass == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "No password defined"); + return FALSE; + } + if (zpass[0] == '*' && zpass[1] == '\0') + { + if (zcallout_pass == NULL) + { + int iuuconf; + + iuuconf = uuconf_callout (puuconf, qsys, + &zcallout_login, + &zcallout_pass); + if (iuuconf == UUCONF_NOT_FOUND + || zcallout_pass == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "No password defined"); + return FALSE; + } + else if (iuuconf != UUCONF_SUCCESS) + { + ucsend_debug_end (fquote, TRUE); + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + return FALSE; + } + } + zpass = zcallout_pass; + } + fquote = fcsend_debug (fquote, (size_t) 0, "password"); + fquote = fcsend_debug (fquote, strlen (zpass), zpass); + if (! (*pfwrite) (qconn, zpass, strlen (zpass))) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + } + break; + case 'D': + if (qdial == NULL || zphone == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "Illegal use of \\D"); + return FALSE; + } + fquote = fcsend_debug (fquote, (size_t) 0, "\\D"); + if (! fcphone (qconn, puuconf, qdial, zphone, pfwrite, + ftranslate, &fquote)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + break; + case 'T': + if (qdial == NULL || zphone == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "Illegal use of \\T"); + return FALSE; + } + fquote = fcsend_debug (fquote, (size_t) 0, "\\T"); + if (! fcphone (qconn, puuconf, qdial, zphone, pfwrite, TRUE, + &fquote)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + break; + case 'M': + if (qdial == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "Illegal use of \\M"); + return FALSE; + } + fquote = fcsend_debug (fquote, (size_t) 0, "ignore-carrier"); + if (! fconn_carrier (qconn, FALSE)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + break; + case 'm': + if (qdial == NULL) + { + ucsend_debug_end (fquote, TRUE); + ulog (LOG_ERROR, "Illegal use of \\m"); + return FALSE; + } + if (qdial->uuconf_fcarrier) + { + fquote = fcsend_debug (fquote, (size_t) 0, "need-carrier"); + if (! fconn_carrier (qconn, TRUE)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + } + break; + default: + /* This error message will screw up any debugging + information, but it's easily avoidable. */ + ulog (LOG_ERROR, + "Unrecognized escape sequence \\%c in send string", + *z); + fsend = TRUE; + bsend = *z; + break; + } + ++z; + break; +#if DEBUG > 0 + default: + ulog (LOG_FATAL, "fcsend: Can't happen"); + break; +#endif + } + + if (fsend) + { + fquote = fcsend_debug (fquote, (size_t) 1, &bsend); + if (! (*pfwrite) (qconn, &bsend, (size_t) 1)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + } + } + + xfree ((pointer) zcallout_login); + xfree ((pointer) zcallout_pass); + + /* Output a final carriage return, unless there was a \c. Don't + bother to check for an echo. */ + if (! fnocr) + { + char b; + + b = '\r'; + fquote = fcsend_debug (fquote, (size_t) 1, &b); + if (! fconn_write (qconn, &b, (size_t) 1)) + { + ucsend_debug_end (fquote, TRUE); + return FALSE; + } + } + + ucsend_debug_end (fquote, FALSE); + + return TRUE; +} + +/* Write out a phone number with optional dialcode translation. The + pfquote argument is only used for debugging. */ + +static boolean +fcphone (qconn, puuconf, qdial, zphone, pfwrite, ftranslate, pfquote) + struct sconnection *qconn; + pointer puuconf; + const struct uuconf_dialer *qdial; + const char *zphone; + boolean (*pfwrite) P((struct sconnection *qc, const char *zwrite, + size_t cwrite)); + boolean ftranslate; + boolean *pfquote; +{ + const char *zprefix, *zsuffix; + + if (ftranslate) + { + if (! fctranslate (puuconf, zphone, &zprefix, &zsuffix)) + return FALSE; + } + else + { + zprefix = zphone; + zsuffix = NULL; + } + + while (zprefix != NULL) + { + while (TRUE) + { + const char *z; + const char *zstr; + + z = zprefix + strcspn ((char *) zprefix, "=-"); + if (z > zprefix) + { + size_t clen; + + clen = z - zprefix; + *pfquote = fcsend_debug (*pfquote, clen, zprefix); + if (! (*pfwrite) (qconn, zprefix, clen)) + return FALSE; + } + + if (*z == '=') + zstr = qdial->uuconf_zdialtone; + else if (*z == '-') + zstr = qdial->uuconf_zpause; + else /* *z == '\0' */ + break; + + if (zstr != NULL) + { + *pfquote = fcsend_debug (*pfquote, strlen (zstr), zstr); + if (! (*pfwrite) (qconn, zstr, strlen (zstr))) + return FALSE; + } + + zprefix = z + 1; + } + + zprefix = zsuffix; + zsuffix = NULL; + } + + return TRUE; +} + +/* Given a phone number, run it through dial code translation + returning two strings. */ + +static boolean +fctranslate (puuconf, zphone, pzprefix, pzsuffix) + pointer puuconf; + const char *zphone; + const char **pzprefix; + const char **pzsuffix; +{ + int iuuconf; + char *zdialcode, *zto; + const char *zfrom; + char *ztrans; + + *pzprefix = zphone; + *pzsuffix = NULL; + + zdialcode = zbufalc (strlen (zphone) + 1); + zfrom = zphone; + zto = zdialcode; + while (*zfrom != '\0' && isalpha (BUCHAR (*zfrom))) + *zto++ = *zfrom++; + *zto = '\0'; + + if (*zdialcode == '\0') + { + ubuffree (zdialcode); + return TRUE; + } + + iuuconf = uuconf_dialcode (puuconf, zdialcode, &ztrans); + + ubuffree (zdialcode); + + if (iuuconf == UUCONF_NOT_FOUND) + return TRUE; + else if (iuuconf != UUCONF_SUCCESS) + { + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + return FALSE; + } + else + { + /* We really should figure out a way to free up ztrans here. */ + *pzprefix = ztrans; + *pzsuffix = zfrom; + return TRUE; + } +} + +/* Write out a string making sure the each character is echoed back. + There are two versions of this function, one which strips the + parity bit from the characters and one which does not. This is so + that I can use a single function pointer in fcsend, and to avoid + using any static variables so that I can put chat scripts in a + library some day. */ + +static boolean +fcecho_send_strip (qconn, zwrite, cwrite) + struct sconnection *qconn; + const char *zwrite; + size_t cwrite; +{ + return fcecho_send (qconn, zwrite, cwrite, TRUE); +} + +static boolean +fcecho_send_nostrip (qconn, zwrite, cwrite) + struct sconnection *qconn; + const char *zwrite; + size_t cwrite; +{ + return fcecho_send (qconn, zwrite, cwrite, FALSE); +} + +static boolean +fcecho_send (qconn, zwrite, cwrite, fstrip) + struct sconnection *qconn; + const char *zwrite; + size_t cwrite; + boolean fstrip; +{ + const char *zend; + + zend = zwrite + cwrite; + + for (; zwrite < zend; zwrite++) + { + int b; + char bwrite; + + bwrite = *zwrite; + if (! fconn_write (qconn, &bwrite, (size_t) 1)) + return FALSE; + if (fstrip) + bwrite &= 0x7f; + do + { + /* We arbitrarily wait five seconds for the echo. */ + b = breceive_char (qconn, 5, TRUE); + /* Now b == -1 on timeout, -2 on error. */ + if (b < 0) + { + if (b == -1) + ulog (LOG_ERROR, "Character not echoed"); + return FALSE; + } + if (fstrip) + b &= 0x7f; + } + while (b != BUCHAR (bwrite)); + } + + return TRUE; +} + +/* Run a chat program. Expand any escape sequences and call a system + dependent program to run it. */ + +static boolean +fcprogram (qconn, puuconf, pzprogram, qsys, qdial, zphone, zport, ibaud) + struct sconnection *qconn; + pointer puuconf; + char **pzprogram; + const struct uuconf_system *qsys; + const struct uuconf_dialer *qdial; + const char *zphone; + const char *zport; + long ibaud; +{ + size_t cargs; + char **pzpass, **pzarg; + char **pz; + char *zcallout_login; + char *zcallout_pass; + boolean fret; + + cargs = 1; + for (pz = pzprogram; *pz != NULL; pz++) + ++cargs; + + pzpass = (char **) xmalloc (cargs * sizeof (char *)); + + zcallout_login = NULL; + zcallout_pass = NULL; + fret = TRUE; + + /* Copy the string into memory expanding escape sequences. */ + for (pz = pzprogram, pzarg = pzpass; *pz != NULL; pz++, pzarg++) + { + const char *zfrom; + size_t calc, clen; + char *zto; + + if (strchr (*pz, '\\') == NULL) + { + *pzarg = zbufcpy (*pz); + continue; + } + + *pzarg = NULL; + zto = NULL; + calc = 0; + clen = 0; + + for (zfrom = *pz; *zfrom != '\0'; zfrom++) + { + const char *zadd = NULL; + size_t cadd; + char abadd[15]; + + if (*zfrom != '\\') + { + if (clen + 2 > calc) + { + char *znew; + + calc = clen + 50; + znew = zbufalc (calc); + memcpy (znew, *pzarg, clen); + ubuffree (*pzarg); + *pzarg = znew; + zto = znew + clen; + } + *zto++ = *zfrom; + ++clen; + continue; + } + + ++zfrom; + switch (*zfrom) + { + case '\0': + --zfrom; + /* Fall through. */ + case '\\': + zadd = "\\"; + break; + case 'L': + { + const char *zlog; + + if (qsys == NULL) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\L"); + fret = FALSE; + break; + } + zlog = qsys->uuconf_zcall_login; + if (zlog == NULL) + { + ulog (LOG_ERROR, "chat-program: No login defined"); + fret = FALSE; + break; + } + if (zlog[0] == '*' && zlog[1] == '\0') + { + if (zcallout_login == NULL) + { + int iuuconf; + + iuuconf = uuconf_callout (puuconf, qsys, + &zcallout_login, + &zcallout_pass); + if (iuuconf == UUCONF_NOT_FOUND + || zcallout_login == NULL) + { + ulog (LOG_ERROR, + "chat-program: No login defined"); + fret = FALSE; + break; + } + else if (iuuconf != UUCONF_SUCCESS) + { + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + fret = FALSE; + break; + } + } + zlog = zcallout_login; + } + zadd = zlog; + } + break; + case 'P': + { + const char *zpass; + + if (qsys == NULL) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\P"); + fret = FALSE; + break; + } + zpass = qsys->uuconf_zcall_password; + if (zpass == NULL) + { + ulog (LOG_ERROR, "chat-program: No password defined"); + fret = FALSE; + break; + } + if (zpass[0] == '*' && zpass[1] == '\0') + { + if (zcallout_pass == NULL) + { + int iuuconf; + + iuuconf = uuconf_callout (puuconf, qsys, + &zcallout_login, + &zcallout_pass); + if (iuuconf == UUCONF_NOT_FOUND + || zcallout_pass == NULL) + { + ulog (LOG_ERROR, + "chat-program: No password defined"); + fret = FALSE; + break; + } + else if (iuuconf != UUCONF_SUCCESS) + { + ulog_uuconf (LOG_ERROR, puuconf, iuuconf); + fret = FALSE; + break; + } + } + zpass = zcallout_pass; + } + zadd = zpass; + } + break; + case 'D': + if (qdial == NULL || zphone == NULL) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\D"); + fret = FALSE; + break; + } + zadd = zphone; + break; + case 'T': + { + const char *zprefix, *zsuffix; + + if (qdial == NULL || zphone == NULL) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\T"); + fret = FALSE; + break; + } + + if (! fctranslate (puuconf, zphone, &zprefix, &zsuffix)) + { + fret = FALSE; + break; + } + + if (zsuffix == NULL) + zadd = zprefix; + else + { + size_t cprefix; + + cprefix = strlen (zprefix); + if (clen + cprefix + 1 > calc) + { + char *znew; + + calc = clen + cprefix + 20; + znew = zbufalc (calc); + memcpy (znew, *pzarg, clen); + ubuffree (*pzarg); + *pzarg = znew; + zto = znew + clen; + } + memcpy (zto, zprefix, cprefix); + zto += cprefix; + clen += cprefix; + zadd = zsuffix; + } + } + break; + case 'Y': + if (zLdevice == NULL && zport == NULL) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\Y"); + fret = FALSE; + break; + } + /* zLdevice will generally make more sense than zport, but + it might not be set yet. */ + zadd = zLdevice; + if (zadd == NULL) + zadd = zport; + break; + case 'Z': + if (qsys == NULL) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\Z"); + fret = FALSE; + break; + } + zadd = qsys->uuconf_zname; + break; + case 'S': + { + if (ibaud == 0) + { + ulog (LOG_ERROR, "chat-program: Illegal use of \\S"); + fret = FALSE; + break; + } + sprintf (abadd, "%ld", ibaud); + zadd = abadd; + } + break; + default: + { + ulog (LOG_ERROR, + "chat-program: Unrecognized escape sequence \\%c", + *zfrom); + abadd[0] = *zfrom; + abadd[1] = '\0'; + zadd = abadd; + } + break; + } + + if (! fret) + break; + + cadd = strlen (zadd); + if (clen + cadd + 1 > calc) + { + char *znew; + + calc = clen + cadd + 20; + znew = zbufalc (calc); + memcpy (znew, *pzarg, clen); + ubuffree (*pzarg); + *pzarg = znew; + zto = znew + clen; + } + memcpy (zto, zadd, cadd + 1); + zto += cadd; + clen += cadd; + } + + if (! fret) + break; + + *zto++ = '\0'; + ++clen; + } + + *pzarg = NULL; + + if (fret) + fret = fconn_run_chat (qconn, pzpass); + + for (pz = pzpass; *pz != NULL; pz++) + ubuffree (*pz); + xfree ((pointer) pzpass); + xfree ((pointer) zcallout_login); + xfree ((pointer) zcallout_pass); + + return fret; +} diff --git a/gnu/libexec/uucp/common_sources/conf.h b/gnu/libexec/uucp/common_sources/conf.h new file mode 100644 index 000000000000..9053c4423e0a --- /dev/null +++ b/gnu/libexec/uucp/common_sources/conf.h @@ -0,0 +1,444 @@ +/* conf.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" + +/* Set ECHO_PROGRAM to a program which echoes its arguments; if echo + is a shell builtin you can just use "echo". */ +#define ECHO_PROGRAM "echo" + +/* The following macros indicate what header files you have. Set the + 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_STRING_H 1 /* <string.h> */ +#define HAVE_STRINGS_H 1 /* <strings.h> */ +#define HAVE_UNISTD_H 1 /* <unistd.h> */ +#define HAVE_STDLIB_H 1 /* <stdlib.h> */ +#define HAVE_LIMITS_H 1 /* <limits.h> */ +#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_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_TIMES_H 1 /* <sys/times.h> */ +#define HAVE_LIBC_H 0 /* <libc.h> */ +#define HAVE_SYSEXITS_H 1 /* <sysexits.h> */ +#define HAVE_POLL_H 0 /* <poll.h> */ +#define HAVE_TIUSER_H 0 /* <tiuser.h> */ +#define HAVE_XTI_H 0 /* <xti.h> */ +#define HAVE_SYS_TLI_H 0 /* <sys/tli.h> */ +#define HAVE_STROPTS_H 0 /* <stropts.h> */ +#define HAVE_FTW_H 0 /* <ftw.h> */ +#define HAVE_GLOB_H 1 /* <glob.h> */ +#define HAVE_SYS_SELECT_H 0 /* <sys/select.h> */ +#define HAVE_SYS_TYPES_TCP_H 0 /* <sys/types.tcp.h> */ + +/* If major and minor are not defined in <sys/types.h>, but are in + <sys/mkdev.h>, set MAJOR_IN_MKDEV to 1. If they are in + <sys/sysmacros.h>, set MAJOR_IN_SYSMACROS to 1. */ +#define MAJOR_IN_MKDEV 0 +#define MAJOR_IN_SYSMACROS 0 + +/* If the macro offsetof is not defined in <stddef.h>, you may give it + a definition here. If you do not, the code will use a definition + (in uucp.h) that should be fairly portable. */ +/* #define offsetof */ + +/* Set RETSIGTYPE to the return type of a signal handler. On newer + 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 + +/* 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 + or both of them, it doesn't matter what you set this to. */ +#define HAVE_TERMIOS_AND_SYS_IOCTL_H 1 + +/* If you are configuring by hand, you should set one of the terminal + driver options in policy.h. If you are autoconfiguring, the script + will check whether your system defines CBREAK, which is a terminal + setting; if your system supports CBREAK, and you don't set a terminal + driver in policy.h, the code will assume that you have a BSD style + terminal driver. */ +#define HAVE_CBREAK 1 + +/* The package needs several standard types. If you are using the + configure script, it will look in standard places for these types, + and give default definitions for them here if it doesn't find them. + The default definitions should work on most systems, but you may + want to check them. If you are configuring by hand, you will have + to figure out whether the types are defined on your system, and + what they should be defined to. + + Any type that is not defined on your system should get a macro + definition. The definition should be of the name of the type in + all capital letters. For example, #define PID_T int. If the type + is defined in a standard header file, the macro name should not be + defined. */ + +/* 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 + +/* 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 + +/* 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 + +/* 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 + +/* Set HAVE_SIG_ATOMIC_T_IN_SIGNAL_H if the type sig_atomic_t is defined + in <signal.h> as required by ANSI C. */ +#define HAVE_SIG_ATOMIC_T_IN_SIGNAL_H 0 + +/* Set HAVE_SIG_ATOMIC_T_IN_TYPES_H if the type sig_atomic_t is defined + in <sys/types.h>. This is ignored if HAVE_SIG_ATOMIC_T_IN_SIGNAL_H is + set to 1. */ +#define HAVE_SIG_ATOMIC_T_IN_TYPES_H 0 + +/* The type sig_atomic_t is used to hold a value which may be + referenced in a single atomic operation. If it is not defined in + either <signal.h> or <sys/types.h>, you may want to give it a + definition here. If you don't, the code will use char. If your + 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 + +/* Set HAVE_SIZE_T_IN_STDDEF_H to 1 if the type size_t is defined in + <stddef.h> as required by ANSI C. */ +#define HAVE_SIZE_T_IN_STDDEF_H 1 + +/* Set HAVE_SIZE_T_IN_TYPES_H to 1 if the type size_t is defined in + <sys/types.h>. This is ignored if HAVE_SIZE_T_IN_STDDEF_H is set + to 1. */ +#define HAVE_SIZE_T_IN_TYPES_H 1 + +/* The type size_t is used to hold the size of an object. In + particular, an argument of this type is passed as the size argument + 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 + +/* 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. */ +#define HAVE_TIME_T_IN_TIME_H 1 + +/* Set HAVE_TIME_T_IN_TYPES_H to 1 if the type time_t is defined in + <sys/types.h>. This is ignored if HAVE_TIME_T_IN_TIME_H is set to + 1. */ +#define HAVE_TIME_T_IN_TYPES_H 1 + +/* When Taylor UUCP is talking to another instance of itself, it will + tell the other side the size of a file before it is transferred. + If the package can determine how much disk space is available, it + will use this information to avoid filling up the disk. Define one + of the following macros to tell the code how to determine the + amount of available disk space. It is possible that none of these + are appropriate; it will do no harm to use none of them, but, of + course, nothing will then prevent the package from filling up the + disk. Note that this space check is only useful when talking to + another instance of Taylor UUCP. + + STAT_STATVFS statvfs function + STAT_STATFS2_BSIZE two argument statfs function with f_bsize field + 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_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_USTAT 0 + +/* Set HAVE_VOID to 1 if the compiler supports declaring functions with + a return type of void and casting values to void. */ +#define HAVE_VOID 1 + +/* Set HAVE_UNSIGNED_CHAR to 1 if the compiler supports the type unsigned + char. */ +#define HAVE_UNSIGNED_CHAR 1 + +/* Set HAVE_ERRNO_DECLARATION to 1 if errno is declared in <errno.h>. */ +#define HAVE_ERRNO_DECLARATION 1 + +/* 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 + has vfprintf, 0 otherwise. */ + +/* Taylor UUCP will take advantage of the following functions if they + are available, but knows how to deal with their absence. */ +#define HAVE_VFPRINTF 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_LTRUNC 0 +#define HAVE_WAITPID 1 +#define HAVE_WAIT4 1 +#define HAVE_GLOB 1 +#define HAVE_SETREUID 1 + +/* There are several functions which are replaced in the subdirectory + lib. If they are missing, the configure script will automatically + add them to lib/Makefile to force them to be recompiled. If you + are configuring by hand, you will have to do this yourself. The + string @LIBOBJS@ in lib/Makefile.in should be replaced by a list of + object files in lib/Makefile. The following comments tell you + which object file names to add (they are generally fairly obvious, + given that the file names have no more than six characters before + the period). */ + +/* For each of these functions, if it does not exist, the indicated + object file should be added to lib/Makefile. */ +#define HAVE_BSEARCH 1 /* bsrch.o */ +#define HAVE_GETLINE 0 /* getlin.o */ +#define HAVE_MEMCHR 1 /* memchr.o */ +#define HAVE_STRDUP 1 /* strdup.o */ +#define HAVE_STRSTR 1 /* strstr.o */ +#define HAVE_STRTOL 1 /* strtol.o */ + +/* If neither of these functions exists, you should add bzero.o to + lib/Makefile. */ +#define HAVE_BZERO 1 +#define HAVE_MEMSET 1 + +/* If neither of these functions exists, you should add memcmp.o to + lib/Makefile. */ +#define HAVE_MEMCMP 1 +#define HAVE_BCMP 1 + +/* If neither of these functions exists, you should add memcpy.o to + lib/Makefile. */ +#define HAVE_MEMCPY 1 +#define HAVE_BCOPY 1 + +/* If neither of these functions exists, you should add strcas.o to + lib/Makefile. */ +#define HAVE_STRCASECMP 1 +#define HAVE_STRICMP 0 + +/* If neither of these functions exists, you should add strncs.o to + lib/Makefile. */ +#define HAVE_STRNCASECMP 1 +#define HAVE_STRNICMP 0 + +/* If neither of these functions exists, you should add strchr.o to + lib/Makefile. */ +#define HAVE_STRCHR 1 +#define HAVE_INDEX 1 + +/* If neither of these functions exists, you should add strrch.o to + lib/Makefile. */ +#define HAVE_STRRCHR 1 +#define HAVE_RINDEX 1 + +/* There are also Unix specific functions which are replaced in the + subdirectory unix. If they are missing, the configure script will + automatically add them to unix/Makefile to force them to be + recompiled. If you are configuring by hand, you will have to do + this yourself. The string @UNIXOBJS@ in unix/Makefile.in should be + replaced by a list of object files in unix/Makefile. The following + comments tell you which object file names to add. */ + +/* For each of these functions, if it does not exist, the indicated + object file should be added to unix/Makefile. */ +#define HAVE_OPENDIR 1 /* dirent.o */ +#define HAVE_DUP2 1 /* dup2.o */ +#define HAVE_FTW 0 /* ftw.o */ +#define HAVE_REMOVE 1 /* remove.o */ +#define HAVE_RENAME 1 /* rename.o */ +#define HAVE_STRERROR 1 /* strerr.o */ + +/* The code needs to know how to create directories. If you have the + mkdir function, set HAVE_MKDIR to 1 and replace @UUDIR@ in + Makefile.in with '# ' (the configure script will set @UUDIR@ + according to the variable UUDIR). Otherwise, set HAVE_MKDIR to 0, + remove @UUDIR@ from Makefile.in, set MKDIR_PROGRAM to the name of + the program which will create a directory named on the command line + (e.g., "/bin/mkdir"), and add mkdir.o to the @UNIXOBJS@ string in + unix/Makefile.in. */ +#define HAVE_MKDIR 1 +#define MKDIR_PROGRAM unused + +/* The code also needs to know how to remove directories. If you have + the rmdir function, set HAVE_RMDIR to 1. Otherwise, set + RMDIR_PROGRAM to the name of the program which will remove a + directory named on the command line (e.g., "/bin/rmdir") and add + rmdir.o to the @UNIXOBJS@ string in unix/Makefile.in. */ +#define HAVE_RMDIR 1 +#define RMDIR_PROGRAM unused + +/* The code needs to know to how to get the name of the current + directory. If getcwd is available it will be used, otherwise if + getwd is available it will be used. Otherwise, set PWD_PROGRAM to + the name of the program which will print the name of the current + working directory (e.g., "/bin/pwd") and add getcwd.o to the + @UNIXOBJS@ string in unix/Makefile.in. */ +#define HAVE_GETCWD 1 +#define HAVE_GETWD 1 +#define PWD_PROGRAM unused + +/* If you have either sigsetjmp or setret, it will be used instead of + 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_SETRET 0 + +/* The code needs to know what function to use to set a signal + handler. If will try to use each of the following functions in + turn. If none are available, it will use signal, which is assumed + to always exist. */ +#define HAVE_SIGACTION 1 +#define HAVE_SIGVEC 1 +#define HAVE_SIGSET 0 + +/* If the code is going to use sigvec (HAVE_SIGACTION is 0 and + HAVE_SIGVEC is 1), then HAVE_SIGVEC_SV_FLAGS must be set to 1 if + the sigvec structure contains the sv_flags field, or 0 if the + sigvec structure contains the sv_onstack field. If the code is not + going to use sigvec, it doesn't matter what this is set to. */ +#define HAVE_SIGVEC_SV_FLAGS 1 + +/* The code will try to use each of the following functions in turn + when blocking signals from delivery. If none are available, a + relatively unimportant race condition will exist. */ +#define HAVE_SIGPROCMASK 1 +#define HAVE_SIGBLOCK 1 +#define HAVE_SIGHOLD 0 + +/* If you have either of the following functions, it will be used to + determine the number of file descriptors which may be open. + Otherwise, the code will use OPEN_MAX if defined, then NOFILE if + defined, then 20. */ +#define HAVE_GETDTABLESIZE 1 +#define HAVE_SYSCONF 0 + +/* 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_SETSID 1 + +/* If you do not specify the local node name in the main configuration + file, Taylor UUCP will try to use each of the following functions + 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 + +/* 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 + time, which is assumed to always exist. */ +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_FTIME 0 + +/* If neither gettimeofday nor ftime is available, the code will use + times (if available) to measure a span of time. See also the + discussion of TIMES_TICK in policy.h. */ +#define HAVE_TIMES 1 + +/* When a chat script requests a pause of less than a second with \p, + Taylor UUCP will try to use each of the following functions in + turn. If none are available, it will sleep for a full second. + Also, the (non-portable) tstuu program requires either select or + poll. */ +#define HAVE_NAPMS 0 +#define HAVE_NAP 0 +#define HAVE_USLEEP 1 +#define HAVE_POLL 0 +#define HAVE_SELECT 1 + +/* If the getgrent function is available, it will be used to determine + all the groups a user belongs to when checking file access + permissions. */ +#define HAVE_GETGRENT 1 + +/* If the socket function is available, TCP support code will be + compiled in. */ +#define HAVE_SOCKET 1 + +/* If the t_open function is available, TLI support code will be + compiled in. This may require adding a library, such as -lnsl or + -lxti, to the Makefile variables LIBS. */ +#define HAVE_T_OPEN 0 + +/* That's the end of the list of the functions. Now there are a few + last miscellaneous items. */ + +/* On some systems the following functions are declared in such a way + that the code cannot make a simple extern. On other systems, these + functions are not declared at all, and the extern is required. If + a declaration of the function, as shown, compiles on your system, + set the value to 1. Not all functions declared externally are + listed here, only the ones with which I have had trouble. */ +/* extern long times (); */ +#define TIMES_DECLARATION_OK 0 +/* extern struct passwd *getpwnam (); */ +#define GETPWNAM_DECLARATION_OK 1 +/* extern struct passwd *getpwuid (); */ +#define GETPWUID_DECLARATION_OK 0 +/* extern struct group *getgrent (); */ +#define GETGRENT_DECLARATION_OK 1 + +/* Set HAVE_BSD_PGRP to 1 if your getpgrp call takes 1 argument and + your setpgrp calls takes 2 arguments (on System V they generally + take no arguments). You can safely set this to 1 on System V, + provided the call will compile without any errors. */ +#define HAVE_BSD_PGRP 0 + +/* Set HAVE_UNION_WAIT to 1 if union wait is defined in the header + file <sys/wait.h>. */ +#define HAVE_UNION_WAIT 1 + +/* Set HAVE_LONG_FILE_NAMES to 1 if the system supports file names + longer than 14 characters. */ +#define HAVE_LONG_FILE_NAMES 1 + +/* If slow system calls are restarted after interrupts, set + HAVE_RESTARTABLE_SYSCALLS to 1. This is ignored if HAVE_SIGACTION + is 1 or if HAVE_SIGVEC is 1 and HAVE_SIGVEC_SV_FLAGS is 1 and + SV_INTERRUPT is defined in <signal.h>. In both of these cases + system calls can be prevented from restarting. */ +#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 diff --git a/gnu/libexec/uucp/common_sources/conn.c b/gnu/libexec/uucp/common_sources/conn.c new file mode 100644 index 000000000000..8db53516a685 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/conn.c @@ -0,0 +1,552 @@ +/* conn.c + Connection routines for the Taylor UUCP package. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#include <ctype.h> + +#include "uudefs.h" +#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. */ + +boolean +fconn_init (qport, qconn) + struct uuconf_port *qport; + struct sconnection *qconn; +{ + qconn->qport = qport; + switch (qport == NULL ? UUCONF_PORTTYPE_STDIN : qport->uuconf_ttype) + { + case UUCONF_PORTTYPE_STDIN: + return fsysdep_stdin_init (qconn); + case UUCONF_PORTTYPE_MODEM: + return fsysdep_modem_init (qconn); + case UUCONF_PORTTYPE_DIRECT: + return fsysdep_direct_init (qconn); +#if HAVE_TCP + case UUCONF_PORTTYPE_TCP: + return fsysdep_tcp_init (qconn); +#endif +#if HAVE_TLI + case UUCONF_PORTTYPE_TLI: + return fsysdep_tli_init (qconn); +#endif + default: + ulog (LOG_ERROR, "Unknown port type"); + return FALSE; + } +} + +/* Connection dispatch routines. */ + +/* Free a connection. */ + +void +uconn_free (qconn) + struct sconnection *qconn; +{ + (*qconn->qcmds->pufree) (qconn); +} + +/* Lock a connection. */ + +boolean +fconn_lock (qconn, fin) + struct sconnection *qconn; + boolean fin; +{ + boolean (*pflock) P((struct sconnection *, boolean)); + + pflock = qconn->qcmds->pflock; + if (pflock == NULL) + return TRUE; + return (*pflock) (qconn, fin); +} + +/* Unlock a connection. */ + +boolean +fconn_unlock (qconn) + struct sconnection *qconn; +{ + boolean (*pfunlock) P((struct sconnection *)); + + pfunlock = qconn->qcmds->pfunlock; + if (pfunlock == NULL) + return TRUE; + return (*pfunlock) (qconn); +} + +/* Open a connection. */ + +boolean +fconn_open (qconn, ibaud, ihighbaud, fwait) + struct sconnection *qconn; + long ibaud; + long ihighbaud; + boolean fwait; +{ + boolean fret; + +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_PORT)) + { + char abspeed[20]; + + if (ibaud == (long) 0) + strcpy (abspeed, "default speed"); + else + sprintf (abspeed, "speed %ld", ibaud); + + if (qconn->qport == NULL) + ulog (LOG_DEBUG, "fconn_open: Opening stdin port (%s)", + abspeed); + else if (qconn->qport->uuconf_zname == NULL) + ulog (LOG_DEBUG, "fconn_open: Opening unnamed port (%s)", + abspeed); + else + ulog (LOG_DEBUG, "fconn_open: Opening port %s (%s)", + qconn->qport->uuconf_zname, abspeed); + } +#endif + + /* If the system provides a range of baud rates, we select the + highest baud rate supported by the port. */ + if (ihighbaud != 0 && qconn->qport != NULL) + { + struct uuconf_port *qport; + + qport = qconn->qport; + ibaud = ihighbaud; + if (qport->uuconf_ttype == UUCONF_PORTTYPE_MODEM) + { + if (qport->uuconf_u.uuconf_smodem.uuconf_ilowbaud != 0) + { + if (qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud < ibaud) + ibaud = qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud; + } + else if (qport->uuconf_u.uuconf_smodem.uuconf_ibaud != 0) + ibaud = qport->uuconf_u.uuconf_smodem.uuconf_ibaud; + } + else if (qport->uuconf_ttype == UUCONF_PORTTYPE_DIRECT) + { + if (qport->uuconf_u.uuconf_sdirect.uuconf_ibaud != 0) + ibaud = qport->uuconf_u.uuconf_sdirect.uuconf_ibaud; + } + } + + /* This will normally be overridden by the port specific open + routine. */ + if (qconn->qport == NULL) + ulog_device ("stdin"); + else + ulog_device (qconn->qport->uuconf_zname); + + fret = (*qconn->qcmds->pfopen) (qconn, ibaud, fwait); + + if (! fret) + ulog_device ((const char *) NULL); + + return fret; +} + +/* Close a connection. */ + +boolean +fconn_close (qconn, puuconf, qdialer, fsuccess) + struct sconnection *qconn; + pointer puuconf; + struct uuconf_dialer *qdialer; + boolean fsuccess; +{ + boolean fret; + + DEBUG_MESSAGE0 (DEBUG_PORT, "fconn_close: Closing connection"); + + /* Don't report hangup signals while we're closing. */ + fLog_sighup = FALSE; + + fret = (*qconn->qcmds->pfclose) (qconn, puuconf, qdialer, fsuccess); + + /* Make sure any signal reporting has been done before we set + fLog_sighup back to TRUE. */ + ulog (LOG_ERROR, (const char *) NULL); + fLog_sighup = TRUE; + + ulog_device ((const char *) NULL); + + 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. */ + +boolean +fconn_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; +{ + struct uuconf_dialer sdialer; + enum tdialerfound tfound; + boolean (*pfdial) P((struct sconnection *, pointer, + const struct uuconf_system *, const char *, + struct uuconf_dialer *, enum tdialerfound *)); + + if (qdialer == NULL) + qdialer = &sdialer; + if (ptdialerfound == NULL) + ptdialerfound = &tfound; + + qdialer->uuconf_zname = NULL; + *ptdialerfound = DIALERFOUND_FALSE; + + pfdial = qconn->qcmds->pfdial; + if (pfdial == NULL) + return TRUE; + return (*pfdial) (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound); +} + +/* Read data from the connection. */ + +boolean +fconn_read (qconn, zbuf, pclen, cmin, ctimeout, freport) + struct sconnection *qconn; + char *zbuf; + size_t *pclen; + size_t cmin; + int ctimeout; + boolean freport; +{ + boolean fret; + + fret = (*qconn->qcmds->pfread) (qconn, zbuf, pclen, cmin, ctimeout, + freport); + +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_INCOMING)) + udebug_buffer ("fconn_read: Read", zbuf, *pclen); + else if (FDEBUGGING (DEBUG_PORT)) + ulog (LOG_DEBUG, "fconn_read: Read %lu", (unsigned long) *pclen); +#endif + + return fret; +} + +/* Write data to the connection. */ + +boolean +fconn_write (qconn, zbuf, clen) + struct sconnection *qconn; + const char *zbuf; + size_t clen; +{ +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_OUTGOING)) + udebug_buffer ("fconn_write: Writing", zbuf, clen); + else if (FDEBUGGING (DEBUG_PORT)) + ulog (LOG_DEBUG, "fconn_write: Writing %lu", (unsigned long) clen); +#endif + + return (*qconn->qcmds->pfwrite) (qconn, zbuf, clen); +} + +/* Read and write data. */ + +boolean +fconn_io (qconn, zwrite, pcwrite, zread, pcread) + struct sconnection *qconn; + const char *zwrite; + size_t *pcwrite; + char *zread; + size_t *pcread; +{ + boolean fret; +#if DEBUG > 1 + size_t cwrite = *pcwrite; + size_t cread = *pcread; + + if (cread == 0 || cwrite == 0) + ulog (LOG_FATAL, "fconn_io: cread %lu; cwrite %lu", + (unsigned long) cread, (unsigned long) cwrite); +#endif + +#if DEBUG > 1 + if (FDEBUGGING (DEBUG_OUTGOING)) + udebug_buffer ("fconn_io: Writing", zwrite, cwrite); +#endif + + fret = (*qconn->qcmds->pfio) (qconn, zwrite, pcwrite, zread, pcread); + + DEBUG_MESSAGE4 (DEBUG_PORT, + "fconn_io: Wrote %lu of %lu, read %lu of %lu", + (unsigned long) *pcwrite, (unsigned long) cwrite, + (unsigned long) *pcread, (unsigned long) cread); + +#if DEBUG > 1 + if (*pcread > 0 && FDEBUGGING (DEBUG_INCOMING)) + udebug_buffer ("fconn_io: Read", zread, *pcread); +#endif + + return fret; +} + +/* Send a break character to a connection. Some port types may not + support break characters, in which case we just return TRUE. */ + +boolean +fconn_break (qconn) + struct sconnection *qconn; +{ + boolean (*pfbreak) P((struct sconnection *)); + + pfbreak = *qconn->qcmds->pfbreak; + if (pfbreak == NULL) + return TRUE; + + DEBUG_MESSAGE0 (DEBUG_PORT, "fconn_break: Sending break character"); + + return (*pfbreak) (qconn); +} + +/* Change the setting of a connection. Some port types may not + support this, in which case we just return TRUE. */ + +boolean +fconn_set (qconn, tparity, tstrip, txonxoff) + struct sconnection *qconn; + enum tparitysetting tparity; + enum tstripsetting tstrip; + enum txonxoffsetting txonxoff; +{ + boolean (*pfset) P((struct sconnection *, enum tparitysetting, + enum tstripsetting, enum txonxoffsetting)); + + pfset = qconn->qcmds->pfset; + if (pfset == NULL) + return TRUE; + + DEBUG_MESSAGE3 (DEBUG_PORT, + "fconn_set: Changing setting to %d, %d, %d", + (int) tparity, (int) tstrip, (int) txonxoff); + + return (*pfset) (qconn, tparity, tstrip, txonxoff); +} + +/* Require or ignore carrier on a connection. */ + +boolean +fconn_carrier (qconn, fcarrier) + struct sconnection *qconn; + boolean fcarrier; +{ + boolean (*pfcarrier) P((struct sconnection *, boolean)); + + pfcarrier = qconn->qcmds->pfcarrier; + if (pfcarrier == NULL) + return TRUE; + return (*pfcarrier) (qconn, fcarrier); +} + +/* Run a chat program on a connection. */ + +boolean +fconn_run_chat (qconn, pzprog) + struct sconnection *qconn; + char **pzprog; +{ + return (*qconn->qcmds->pfchat) (qconn, pzprog); +} + +/* Get the baud rate of a connection. */ + +long +iconn_baud (qconn) + struct sconnection *qconn; +{ + long (*pibaud) P((struct sconnection *)); + + pibaud = qconn->qcmds->pibaud; + if (pibaud == NULL) + return 0; + return (*pibaud) (qconn); +} + +/* Modem dialing routines. */ + +/*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; +{ + *ptdialerfound = DIALERFOUND_FALSE; + + if (qconn->qport->uuconf_u.uuconf_smodem.uuconf_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) + { + 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); + if (iuuconf == UUCONF_NOT_FOUND) + { + ulog (LOG_ERROR, "%s: Dialer not found", *pz); + 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) + (void) uuconf_dialer_free (puuconf, qdialer); + return FALSE; + } + + if (ffirst) + { + *ptdialerfound = DIALERFOUND_FREE; + ffirst = FALSE; + } + else + (void) uuconf_dialer_free (puuconf, q); + + if (*pz != NULL) + ++pz; + } + + return TRUE; + } + else if (qconn->qport->uuconf_u.uuconf_smodem.uuconf_qdialer != NULL) + { + struct uuconf_dialer *q; + + q = qconn->qport->uuconf_u.uuconf_smodem.uuconf_qdialer; + *qdialer = *q; + *ptdialerfound = DIALERFOUND_TRUE; + return fcdo_dial (qconn, puuconf, q, zphone, FALSE); + } + else + { + ulog (LOG_ERROR, "No dialer information"); + 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 new file mode 100644 index 000000000000..59d4881b07ff --- /dev/null +++ b/gnu/libexec/uucp/common_sources/conn.h @@ -0,0 +1,312 @@ +/* conn.h + Header file for routines which manipulate connections. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#ifndef CONN_H + +#define CONN_H + +#if ANSI_C +/* These structures are used in prototypes but are not defined in this + header file. */ +struct uuconf_system; +struct uuconf_dialer; +struct uuconf_chat; +#endif + +/* This structure represents a connection. */ + +struct sconnection +{ + /* Pointer to command table for this type of connection. */ + const struct sconncmds *qcmds; + /* Pointer to system dependent information. */ + pointer psysdep; + /* Pointer to system independent information. */ + struct uuconf_port *qport; +}; + +/* Whether fconn_dial got a dialer. */ + +enum tdialerfound +{ + /* Did not find a dialer. */ + DIALERFOUND_FALSE, + /* Found a dialer which does not need to be freed. */ + DIALERFOUND_TRUE, + /* Found a dialer which does need to be freed. */ + DIALERFOUND_FREE +}; + +/* Parity settings to pass to fconn_set. */ + +enum tparitysetting +{ + /* Do not change output parity generation. */ + PARITYSETTING_DEFAULT, + /* No parity (all eight output bits used). */ + PARITYSETTING_NONE, + /* Even parity. */ + PARITYSETTING_EVEN, + /* Odd parity. */ + PARITYSETTING_ODD, + /* Mark parity. */ + PARITYSETTING_MARK, + /* Space parity. */ + PARITYSETTING_SPACE +}; + +/* Type of strip control argument to fconn_set. */ + +enum tstripsetting +{ + /* Do not change the stripping of input characters. */ + STRIPSETTING_DEFAULT, + /* Do not strip input characters to seven bits. */ + STRIPSETTING_EIGHTBITS, + /* Strip input characters to seven bits. */ + STRIPSETTING_SEVENBITS +}; + +/* Type of XON/XOFF control argument to fconn_set. */ + +enum txonxoffsetting +{ + /* Do not change XON/XOFF handshake setting. */ + XONXOFF_DEFAULT, + /* Do not do XON/XOFF handshaking. */ + XONXOFF_OFF, + /* Do XON/XOFF handshaking. */ + XONXOFF_ON +}; + +/* A command table holds the functions which implement actions for + each different kind of connection. */ + +struct sconncmds +{ + /* Free up a connection. */ + void (*pufree) P((struct sconnection *qconn)); + /* Lock the connection. The fin argument is TRUE if the connection + is to be used for an incoming call. May be NULL. */ + boolean (*pflock) P((struct sconnection *qconn, boolean fin)); + /* Unlock the connection. May be NULL. */ + boolean (*pfunlock) P((struct sconnection *qconn)); + /* Open the connection. */ + boolean (*pfopen) P((struct sconnection *qconn, long ibaud, + boolean fwait)); + /* Close the connection. */ + boolean (*pfclose) P((struct sconnection *qconn, + 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 + NULL. */ + boolean (*pfdial) P((struct sconnection *qconn, pointer puuconf, + const struct uuconf_system *qsys, + const char *zphone, + struct uuconf_dialer *qdialer, + enum tdialerfound *ptdialerfound)); + /* Read data from a connection, with a timeout in seconds. When + called *pclen is the length of the buffer; on successful return + *pclen is the number of bytes read into the buffer. The cmin + argument is the minimum number of bytes to read before returning + ahead of a timeout. */ + boolean (*pfread) P((struct sconnection *qconn, char *zbuf, size_t *pclen, + size_t cmin, int ctimeout, boolean freport)); + /* Write data to the connection. */ + boolean (*pfwrite) P((struct sconnection *qconn, const char *zbuf, + size_t clen)); + /* Read and write data to the connection. This reads and writes + data until either all passed in data has been written or the read + buffer has been filled. When called *pcread is the size of the + read buffer and *pcwrite is the number of bytes to write; on + successful return *pcread is the number of bytes read and + *pcwrite is the number of bytes written. */ + boolean (*pfio) P((struct sconnection *qconn, const char *zwrite, + size_t *pcwrite, char *zread, size_t *pcread)); + /* Send a break character. This field may be NULL. */ + boolean (*pfbreak) P((struct sconnection *qconn)); + /* Change the connection setting. This field may be NULL. */ + boolean (*pfset) P((struct sconnection *qconn, + enum tparitysetting tparity, + enum tstripsetting tstrip, + enum txonxoffsetting txonxoff)); + /* Require or ignore carrer. This field may be NULL. */ + boolean (*pfcarrier) P((struct sconnection *qconn, + boolean fcarrier)); + /* Run a chat program on a connection. */ + boolean (*pfchat) P((struct sconnection *qconn, char **pzprog)); + /* Get the baud rate of a connection. This field may be NULL. */ + long (*pibaud) P((struct sconnection *qconn)); +}; + +/* Connection functions. */ + +/* 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. */ +extern boolean fconn_init P((struct uuconf_port *qport, + struct sconnection *qconn)); + +/* Free up connection data. */ +extern void uconn_free P((struct sconnection *qconn)); + +/* Lock a connection. The fin argument is TRUE if the port is to be + used for an incoming call; certains type of Unix locking need this + information because they need to open the port. */ +extern boolean fconn_lock P((struct sconnection *qconn, boolean fin)); + +/* Unlock a connection. */ +extern boolean fconn_unlock P((struct sconnection *qconn)); + +/* Open a connection. If ibaud is 0, the natural baud rate of the + port is used. If ihighbaud is not 0, fconn_open chooses the + highest supported baud rate between ibaud and ihighbaud. If fwait + is TRUE, this should wait for an incoming call. */ +extern boolean fconn_open P((struct sconnection *qconn, long ibaud, + long ihighbaud, boolean fwait)); + +/* Close a connection. The fsuccess argument is TRUE if the + conversation completed normally, FALSE if it is being aborted. */ +extern boolean fconn_close P((struct sconnection *qconn, + pointer puuconf, + 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 + any; *ptdialerfound will be set appropriately. */ +extern boolean fconn_dial P((struct sconnection *q, pointer puuconf, + const struct uuconf_system *qsys, + const char *zphone, + struct uuconf_dialer *qdialer, + enum tdialerfound *ptdialerfound)); + +/* Read from a connection. + zbuf -- buffer to read bytes into + *pclen on call -- length of zbuf + *pclen on successful return -- number of bytes read + cmin -- minimum number of bytes to read before returning ahead of timeout + ctimeout -- timeout in seconds, 0 if none + freport -- whether to report errors. */ +extern boolean fconn_read P((struct sconnection *qconn, char *zbuf, + size_t *pclen, size_t cmin, + int ctimeout, boolean freport)); + +/* Write to a connection. */ +extern boolean fconn_write P((struct sconnection *qconn, const char *zbuf, + size_t cbytes)); + +/* Read and write to a connection. This reads and writes data until + either all passed-in data has been written or the read buffer is + full. + zwrite -- buffer to write bytes from + *pcwrite on call -- number of bytes to write + *pcwrite on successful return -- number of bytes written + zread -- buffer to read bytes into + *pcread on call -- size of read buffer + *pcread on successful return -- number of bytes read. */ +extern boolean fconn_io P((struct sconnection *qconn, const char *zwrite, + size_t *pcwrite, char *zread, size_t *pcread)); + +/* Send a break character to a connection. */ +extern boolean fconn_break P((struct sconnection *qconn)); + +/* Change the settings of a connection. This allows independent + control over the parity of output characters, whether to strip + input characters, and whether to do XON/XOFF handshaking. There is + no explicit control over parity checking of input characters. This + function returns FALSE on error. Attempts to set values not + supported by the hardware are silently ignored. */ +extern boolean fconn_set P((struct sconnection *qconn, + enum tparitysetting tparity, + enum tstripsetting tstrip, + enum txonxoffsetting txonxoff)); + +/* Get the baud rate of a connection. */ +extern long iconn_baud P((struct sconnection *qconn)); + +/* Do a chat script with a system. */ +extern boolean fchat P((struct sconnection *qconn, pointer puuconf, + const struct uuconf_chat *qchat, + const struct uuconf_system *qsys, + const struct uuconf_dialer *qdialer, + const char *zphone, boolean ftranslate, + const char *zport, long ibaud)); + +/* Tell the connection to either require or ignore carrier as fcarrier + is TRUE or FALSE respectively. This is called with fcarrier TRUE + when \m is encountered in a chat script, and with fcarrier FALSE + when \M is encountered. */ +extern boolean fconn_carrier P((struct sconnection *qconn, + boolean fcarrier)); + +/* Run a chat program on a connection. */ +extern boolean fconn_run_chat P((struct sconnection *qconn, + char **pzprog)); + +/* 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, + const struct uuconf_system *qsys, + const char *zphone, + struct uuconf_dialer *qdialer, + enum tdialerfound *ptdialerfound)); + +/* Begin dialing out. This should open the dialer device if there is + one, toggle DTR if requested and possible, and tell the port to + ignore carrier. It should return FALSE on error. */ +extern boolean fsysdep_modem_begin_dial P((struct sconnection *qconn, + struct uuconf_dialer *qdial)); + +/* Finish dialing out on a modem. This should close the dialer device + if there is one. If the dialer and the port both support carrier, + the connection should be told to pay attention to carrier. If it + is possible to wait for carrier to come on, and the dialer and the + port both the port support carrier, it should wait until carrier + comes on. */ +extern boolean fsysdep_modem_end_dial P((struct sconnection *qconn, + struct uuconf_dialer *qdial)); + +/* System dependent initialization routines. */ +extern boolean fsysdep_stdin_init P((struct sconnection *qconn)); +extern boolean fsysdep_modem_init P((struct sconnection *qconn)); +extern boolean fsysdep_direct_init P((struct sconnection *qconn)); +#if HAVE_TCP +extern boolean fsysdep_tcp_init P((struct sconnection *qconn)); +#endif +#if HAVE_TLI +extern boolean fsysdep_tli_init P((struct sconnection *qconn)); +#endif + +#endif /* ! defined (CONN_H) */ diff --git a/gnu/libexec/uucp/common_sources/copy.c b/gnu/libexec/uucp/common_sources/copy.c new file mode 100644 index 000000000000..0d1a5bb2c270 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/copy.c @@ -0,0 +1,202 @@ +/* copy.c + Copy one file to another for the UUCP package. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#include "uudefs.h" +#include "system.h" +#include "sysdep.h" + +#include <stdio.h> +#include <errno.h> + +/* Copy one file to another. */ + +#if USE_STDIO + +boolean +fcopy_file (zfrom, zto, fpublic, fmkdirs) + const char *zfrom; + const char *zto; + boolean fpublic; + boolean fmkdirs; +{ + FILE *efrom; + boolean fret; + + efrom = fopen (zfrom, BINREAD); + if (efrom == NULL) + { + ulog (LOG_ERROR, "fopen (%s): %s", zfrom, strerror (errno)); + return FALSE; + } + + fret = fcopy_open_file (efrom, zto, fpublic, fmkdirs); + (void) fclose (efrom); + return fret; +} + +boolean +fcopy_open_file (efrom, zto, fpublic, fmkdirs) + FILE *efrom; + const char *zto; + boolean fpublic; + boolean fmkdirs; +{ + FILE *eto; + char ab[8192]; + int c; + + eto = esysdep_fopen (zto, fpublic, FALSE, fmkdirs); + if (eto == NULL) + return FALSE; + + while ((c = fread (ab, sizeof (char), sizeof ab, efrom)) != 0) + { + if (fwrite (ab, sizeof (char), (size_t) c, eto) != c) + { + ulog (LOG_ERROR, "fwrite: %s", strerror (errno)); + (void) fclose (eto); + (void) remove (zto); + return FALSE; + } + } + + if (fclose (eto) != 0) + { + ulog (LOG_ERROR, "fclose: %s", strerror (errno)); + (void) remove (zto); + return FALSE; + } + + return TRUE; +} + +#else /* ! USE_STDIO */ + +#if HAVE_FCNTL_H +#include <fcntl.h> +#else +#if HAVE_SYS_FILE_H +#include <sys/file.h> +#endif +#endif + +#ifndef O_RDONLY +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 +#endif + +#ifndef O_NOCTTY +#define O_NOCTTY 0 +#endif + +boolean +fcopy_file (zfrom, zto, fpublic, fmkdirs) + const char *zfrom; + const char *zto; + boolean fpublic; + boolean fmkdirs; +{ + int ofrom; + boolean fret; + + ofrom = open (zfrom, O_RDONLY | O_NOCTTY, 0); + if (ofrom < 0) + { + ulog (LOG_ERROR, "open (%s): %s", zfrom, strerror (errno)); + return FALSE; + } + + fret = fcopy_open_file (ofrom, zto, fpublic, fmkdirs); + (void) close (ofrom); + return fret; +} + +boolean +fcopy_open_file (ofrom, zto, fpublic, fmkdirs) + int ofrom; + const char *zto; + boolean fpublic; + boolean fmkdirs; +{ + int oto; + char ab[8192]; + int c; + + /* These file mode arguments are from the UNIX version of sysdep.h; + each system dependent header file will need their own + definitions. */ + oto = creat (zto, fpublic ? IPUBLIC_FILE_MODE : IPRIVATE_FILE_MODE); + if (oto < 0) + { + if (errno == ENOENT && fmkdirs) + { + if (! fsysdep_make_dirs (zto, fpublic)) + return FALSE; + oto = creat (zto, + fpublic ? IPUBLIC_FILE_MODE : IPRIVATE_FILE_MODE); + } + if (oto < 0) + { + ulog (LOG_ERROR, "open (%s): %s", zto, strerror (errno)); + return FALSE; + } + } + + while ((c = read (ofrom, ab, sizeof ab)) > 0) + { + if (write (oto, ab, (size_t) c) != c) + { + ulog (LOG_ERROR, "write: %s", strerror (errno)); + (void) close (oto); + (void) remove (zto); + return FALSE; + } + } + + if (close (oto) < 0) + { + ulog (LOG_ERROR, "close: %s", strerror (errno)); + (void) remove (zto); + return FALSE; + } + + if (c < 0) + { + ulog (LOG_ERROR, "read: %s", strerror (errno)); + (void) remove (zto); + return FALSE; + } + + return TRUE; +} + +#endif /* ! USE_STDIO */ diff --git a/gnu/libexec/uucp/common_sources/cu.h b/gnu/libexec/uucp/common_sources/cu.h new file mode 100644 index 000000000000..5a514ee3bfe7 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/cu.h @@ -0,0 +1,80 @@ +/* cu.h + Header file for cu. + + Copyright (C) 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +/* The user settable variables supported by cu. */ + +/* The escape character used to introduce a special command. The + escape character is the first character of this string. */ +extern const char *zCuvar_escape; + +/* Whether to delay for a second before printing the host name after + seeing an escape character. */ +extern boolean fCuvar_delay; + +/* The input characters which finish a line. The escape character is + only recognized following one of these characters. */ +extern const char *zCuvar_eol; + +/* Whether to transfer binary data (nonprintable characters other than + newline and tab) when sending a file. If this is FALSE, then + newline is changed to carriage return. */ +extern boolean fCuvar_binary; + +/* A prefix string to use before sending a binary character from a + file; this is only used if fCuvar_binary is TRUE. */ +extern const char *zCuvar_binary_prefix; + +/* Whether to check for echoes of characters sent when sending a file. + This is ignored if fCuvar_binary is TRUE. */ +extern boolean fCuvar_echocheck; + +/* A character to look for after each newline is sent when sending a + file. The character is the first character in this string, except + that a '\0' means that no echo check is done. */ +extern const char *zCuvar_echonl; + +/* The timeout to use when looking for an character. */ +extern int cCuvar_timeout; + +/* The character to use to kill a line if an echo check fails. The + first character in this string is sent. */ +extern const char *zCuvar_kill; + +/* The number of times to try resending a line if the echo check keeps + failing. */ +extern int cCuvar_resend; + +/* The string to send at the end of a file sent with ~>. */ +extern const char *zCuvar_eofwrite; + +/* The string to look for to finish a file received with ~<. For tip + this is a collection of single characters, but I don't want to do + that because it means that there are characters which cannot be + received. */ +extern const char *zCuvar_eofread; + +/* Whether to provide verbose information when sending or receiving a + file. */ +extern boolean fCuvar_verbose; diff --git a/gnu/libexec/uucp/common_sources/getopt.h b/gnu/libexec/uucp/common_sources/getopt.h new file mode 100644 index 000000000000..1a70e027714e --- /dev/null +++ b/gnu/libexec/uucp/common_sources/getopt.h @@ -0,0 +1,120 @@ +/* Declarations for getopt. + Copyright (C) 1989, 1990, 1991, 1992 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 the + Free Software Foundation; either version 2, 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, 675 Mass Ave, Cambridge, MA 02139, USA. + + This file was modified slightly by Ian Lance Taylor, November 1992, + for Taylor UUCP. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Ian Lance Taylor <ian@airs.com> added the following defines for + Taylor UUCP. This avoids reported conflicts with system getopt + definitions. */ +#define getopt gnu_getopt +#define optarg gnu_optarg +#define optind gnu_optind +#define opterr gnu_opterr + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ + const char *name; + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +enum _argtype +{ + no_argument, + required_argument, + optional_argument +}; + +extern int getopt P((int argc, char *const *argv, const char *shortopts)); +extern int getopt_long P((int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind)); +extern int getopt_long_only P((int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind)); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal P((int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only)); + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/gnu/libexec/uucp/common_sources/log.c b/gnu/libexec/uucp/common_sources/log.c new file mode 100644 index 000000000000..9528baf5ca39 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/log.c @@ -0,0 +1,699 @@ +/* log.c + Routines to add entries to the log files. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#include <errno.h> + +#if ANSI_C +#include <stdarg.h> +#endif + +#if HAVE_TIME_H +#include <time.h> +#endif + +#include "uudefs.h" +#include "uuconf.h" +#include "system.h" + +/* Local functions. */ + +static const char *zldate_and_time P((void)); + +/* Log file name. */ +static const char *zLogfile; + +/* The function to call when a LOG_FATAL error occurs. */ +static void (*pfLfatal) P((void)); + +/* Whether to go to a file. */ +static boolean fLfile; + +/* ID number. */ +static int iLid; + +/* The current user name. */ +static char *zLuser; + +/* The current system name. */ +static char *zLsystem; + +/* The current device name. */ +char *zLdevice; + +/* The open log file. */ +static FILE *eLlog; + +/* Whether we have tried to open the log file. We need this because + we don't want to keep trying to open the log file if we failed the + first time. It can't be static because under HAVE_HDB_LOGGING we + may have to write to various different log files. */ +static boolean fLlog_tried; + +#if DEBUG > 1 +/* Debugging file name. */ +static const char *zLdebugfile; + +/* The open debugging file. */ +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. */ +static const char *zLstatsfile; + +/* The open statistics file. */ +static FILE *eLstats; + +/* Whether we've tried to open the statistics file. */ +static boolean fLstats_tried; + +/* The array of signals. The elements are only set to TRUE by the + default signal handler. They are only set to FALSE if we don't + care whether we got the signal or not. */ +volatile sig_atomic_t afSignal[INDEXSIG_COUNT]; + +/* The array of signals to log. The elements are only set to TRUE by + the default signal handler. They are set to FALSE when the signal + is logged in ulog. This means that if a signal comes in at just + the right time we won't log it (or, rather, we'll log it once + instead of twice), but that is not a catatrophe. */ +volatile sig_atomic_t afLog_signal[INDEXSIG_COUNT]; + +/* Flag that indicates SIGHUP is worth logging. */ +boolean fLog_sighup = TRUE; + +/* Signal names to use when logging signals. */ +static const char * const azSignal_names[INDEXSIG_COUNT] = INDEXSIG_NAMES; + +/* If not NULL, ulog calls this function before outputting anything. + This is used to support cu. */ +void (*pfLstart) P((void)); + +/* If not NULL, ulog calls this function after outputting everything. + This is used to support cu. */ +void (*pfLend) P((void)); + +/* Set the function to call on a LOG_FATAL error. */ + +void +ulog_fatal_fn (pfn) + void (*pfn) P((void)); +{ + pfLfatal = pfn; +} + +/* Decide whether to send log message to the file or not. */ + +void +ulog_to_file (puuconf, ffile) + pointer puuconf; + boolean ffile; +{ + int iuuconf; + + iuuconf = uuconf_logfile (puuconf, &zLogfile); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + +#if DEBUG > 1 + iuuconf = uuconf_debugfile (puuconf, &zLdebugfile); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); +#endif + + iuuconf = uuconf_statsfile (puuconf, &zLstatsfile); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + + fLfile = ffile; +} + +/* Set the ID number. This will be called by the usysdep_initialize + if there is something sensible to set it to. */ + +void +ulog_id (i) + int i; +{ + iLid = i; +} + +/* Set the user we are making log entries for. The arguments will be + copied into memory. */ + +void +ulog_user (zuser) + const char *zuser; +{ + ubuffree (zLuser); + zLuser = zbufcpy (zuser); +} + +/* Set the system name we are making log entries for. The name is copied + into memory. */ + +void +ulog_system (zsystem) + const char *zsystem; +{ + if (zsystem == NULL + || zLsystem == NULL + || strcmp (zsystem, zLsystem) != 0) + { + ubuffree (zLsystem); + zLsystem = zbufcpy (zsystem); +#if HAVE_HDB_LOGGING + /* Under HDB logging we now must write to a different log file. */ + ulog_close (); +#endif /* HAVE_HDB_LOGGING */ + } +} + +/* Set the device name. This is copied into memory. */ + +void +ulog_device (zdevice) + const char *zdevice; +{ + ubuffree (zLdevice); + zLdevice = zbufcpy (zdevice); +} + +/* Make a log entry. We make a token concession to non ANSI_C systems, + but it clearly won't always work. */ + +#if ! ANSI_C +#undef HAVE_VFPRINTF +#endif + +/*VARARGS2*/ +#if HAVE_VFPRINTF +void +ulog (enum tlog ttype, const char *zmsg, ...) +#else +void +ulog (ttype, zmsg, a, b, c, d, f, g, h, i, j) + enum tlog ttype; + const char *zmsg; +#endif +{ +#if HAVE_VFPRINTF + va_list parg; +#endif + FILE *e, *edebug; + boolean fstart, fend; + const char *zhdr, *zstr; + + /* 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 + message out with zmsg == NULL. */ + { + static boolean fdoing_sigs; + + if (! fdoing_sigs) + { + int isig; + + fdoing_sigs = TRUE; + for (isig = 0; isig < INDEXSIG_COUNT; isig++) + { + if (afLog_signal[isig]) + { + afLog_signal[isig] = FALSE; + + /* Apparently SunOS sends SIGINT rather than SIGHUP + when hanging up, so we don't log either signal if + fLog_sighup is FALSE. */ + if ((isig != INDEXSIG_SIGHUP && isig != INDEXSIG_SIGINT) + || fLog_sighup) + ulog (LOG_ERROR, "Got %s signal", azSignal_names[isig]); + } + } + fdoing_sigs = FALSE; + } + } + + if (zmsg == NULL) + return; + +#if DEBUG > 1 + /* If we've had a debugging file open in the past, then we want to + write all log file entries to the debugging file even if it's + currently closed. */ + if (fLfile + && eLdebug == NULL + && ! fLdebug_tried + && (fLdebugging || (int) ttype >= (int) LOG_DEBUG)) + { + fLdebug_tried = TRUE; + eLdebug = esysdep_fopen (zLdebugfile, FALSE, TRUE, TRUE); + fLdebugging = TRUE; + } +#endif /* DEBUG > 1 */ + + if (! fLfile) + e = stderr; +#if DEBUG > 1 + else if ((int) ttype >= (int) LOG_DEBUG) + { + e = eLdebug; + + /* If we can't open the debugging file, don't output any + debugging messages. */ + if (e == NULL) + return; + } +#endif /* DEBUG > 1 */ + else + { + if (eLlog == NULL && ! fLlog_tried) + { + fLlog_tried = TRUE; +#if ! HAVE_HDB_LOGGING + eLlog = esysdep_fopen (zLogfile, TRUE, TRUE, TRUE); +#else /* HAVE_HDB_LOGGING */ + { + const char *zsys; + char *zfile; + + /* We want to write to .Log/program/system, e.g. + .Log/uucico/uunet. The system name may not be set. */ + if (zLsystem == NULL) + zsys = "ANY"; + else + zsys = zLsystem; + + zfile = zbufalc (strlen (zLogfile) + + strlen (abProgram) + + strlen (zsys) + + 1); + sprintf (zfile, zLogfile, abProgram, zsys); + eLlog = esysdep_fopen (zfile, TRUE, TRUE, TRUE); + ubuffree (zfile); + } +#endif /* HAVE_HDB_LOGGING */ + + 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). */ + if (pfLfatal != NULL) + (*pfLfatal) (); + usysdep_exit (FALSE); + } + } + + e = eLlog; + + /* eLlog might be NULL here because we might try to open the log + file recursively via esysdep_fopen. */ + if (e == NULL) + return; + } + + if (pfLstart != NULL) + (*pfLstart) (); + + edebug = NULL; +#if DEBUG > 1 + if ((int) ttype < (int) LOG_DEBUG) + edebug = eLdebug; +#endif + + fstart = TRUE; + fend = TRUE; + + switch (ttype) + { + case LOG_NORMAL: + zhdr = ""; + break; + case LOG_ERROR: + zhdr = "ERROR: "; + break; + case LOG_FATAL: + zhdr = "FATAL: "; + break; +#if DEBUG > 1 + case LOG_DEBUG: + zhdr = "DEBUG: "; + break; + case LOG_DEBUG_START: + zhdr = "DEBUG: "; + fend = FALSE; + break; + case LOG_DEBUG_CONTINUE: + zhdr = NULL; + fstart = FALSE; + fend = FALSE; + break; + case LOG_DEBUG_END: + zhdr = NULL; + fstart = FALSE; + break; +#endif + default: + zhdr = "???: "; + break; + } + + if (fstart) + { + if (! fLfile) + { + fprintf (e, "%s: ", abProgram); + if (edebug != NULL) + fprintf (edebug, "%s: ", abProgram); + } + else + { +#if HAVE_TAYLOR_LOGGING + fprintf (e, "%s ", abProgram); + if (edebug != NULL) + fprintf (edebug, "%s ", abProgram); +#else /* ! HAVE_TAYLOR_LOGGING */ + fprintf (e, "%s ", zLuser == NULL ? "uucp" : zLuser); + if (edebug != NULL) + fprintf (edebug, "%s ", zLuser == NULL ? "uucp" : zLuser); +#endif /* HAVE_TAYLOR_LOGGING */ + + fprintf (e, "%s ", zLsystem == NULL ? "-" : zLsystem); + if (edebug != NULL) + fprintf (edebug, "%s ", zLsystem == NULL ? "-" : zLsystem); + +#if HAVE_TAYLOR_LOGGING + fprintf (e, "%s ", zLuser == NULL ? "-" : zLuser); + if (edebug != NULL) + fprintf (edebug, "%s ", zLuser == NULL ? "-" : zLuser); +#endif /* HAVE_TAYLOR_LOGGING */ + + zstr = zldate_and_time (); + fprintf (e, "(%s", zstr); + if (edebug != NULL) + fprintf (edebug, "(%s", zstr); + + if (iLid != 0) + { +#if ! HAVE_HDB_LOGGING +#if HAVE_TAYLOR_LOGGING + fprintf (e, " %d", iLid); + if (edebug != NULL) + fprintf (edebug, " %d", iLid); +#else /* ! HAVE_TAYLOR_LOGGING */ + fprintf (e, "-%d", iLid); + if (edebug != NULL) + fprintf (edebug, "-%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); +#endif /* HAVE_HDB_LOGGING */ + } + + fprintf (e, ") "); + if (edebug != NULL) + fprintf (edebug, ") "); + + fprintf (e, "%s", zhdr); + if (edebug != NULL) + fprintf (edebug, "%s", zhdr); + } + } + +#if HAVE_VFPRINTF + va_start (parg, zmsg); + vfprintf (e, zmsg, parg); + va_end (parg); + if (edebug != NULL) + { + va_start (parg, zmsg); + vfprintf (edebug, zmsg, parg); + va_end (parg); + } +#else /* ! HAVE_VFPRINTF */ + fprintf (e, zmsg, a, b, c, d, f, g, h, i, j); + if (edebug != NULL) + fprintf (edebug, zmsg, a, b, c, d, f, g, h, i, j); +#endif /* ! HAVE_VFPRINTF */ + + if (fend) + { + fprintf (e, "\n"); + if (edebug != NULL) + fprintf (edebug, "\n"); + } + + (void) fflush (e); + if (edebug != NULL) + (void) fflush (edebug); + + if (pfLend != NULL) + (*pfLend) (); + + if (ttype == LOG_FATAL) + { + if (pfLfatal != NULL) + (*pfLfatal) (); + usysdep_exit (FALSE); + } + +#if CLOSE_LOGFILES + ulog_close (); +#endif +} + +/* Log a uuconf error. */ + +void +ulog_uuconf (ttype, puuconf, iuuconf) + enum tlog ttype; + pointer puuconf; + int iuuconf; +{ + char ab[512]; + + (void) uuconf_error_string (puuconf, iuuconf, ab, sizeof ab); + ulog (ttype, "%s", ab); +} + +/* Close the log file. There's nothing useful we can do with errors, + so we don't check for them. */ + +void +ulog_close () +{ + /* Make sure we logged any signal we received. */ + ulog (LOG_ERROR, (const char *) NULL); + + if (eLlog != NULL) + { + (void) fclose (eLlog); + eLlog = NULL; + fLlog_tried = FALSE; + } + +#if DEBUG > 1 + if (eLdebug != NULL) + { + (void) fclose (eLdebug); + eLdebug = NULL; + fLdebug_tried = FALSE; + } +#endif +} + +/* Add an entry to the statistics file. We may eventually want to put + failed file transfers in here, but we currently do not. */ + +/*ARGSUSED*/ +void +ustats (fsucceeded, zuser, zsystem, fsent, cbytes, csecs, cmicros, fmaster) + boolean fsucceeded; + const char *zuser; + const char *zsystem; + boolean fsent; + long cbytes; + long csecs; + long cmicros; + boolean fmaster; +{ + long cbps; + + /* The seconds and microseconds are now counted independently, so + they may be out of synch. */ + if (cmicros < 0) + { + csecs -= ((- cmicros) / 1000000L) + 1; + cmicros = 1000000L - ((- cmicros) % 1000000L); + } + if (cmicros >= 1000000L) + { + csecs += cmicros / 10000000L; + cmicros = cmicros % 1000000L; + } + + /* On a system which can determine microseconds we might very well + have both csecs == 0 and cmicros == 0. */ + if (csecs == 0 && cmicros < 1000) + cbps = 0; + else + { + long cmillis; + + /* This computation will not overflow provided csecs < 2147483 + and cbytes and cbps both fit in a long. */ + cmillis = csecs * 1000 + cmicros / 1000; + cbps = ((cbytes / cmillis) * 1000 + + ((cbytes % cmillis) * 1000) / cmillis); + } + + if (eLstats == NULL) + { + if (fLstats_tried) + return; + fLstats_tried = TRUE; + eLstats = esysdep_fopen (zLstatsfile, TRUE, TRUE, TRUE); + if (eLstats == NULL) + return; + } + +#if HAVE_TAYLOR_LOGGING + fprintf (eLstats, + "%s %s (%s) %s%s %ld bytes in %ld.%03ld seconds (%ld bytes/sec)\n", + zuser, zsystem, zldate_and_time (), + fsucceeded ? "" : "failed after ", + fsent ? "sent" : "received", + cbytes, csecs, cmicros / 1000, cbps); +#endif /* HAVE_TAYLOR_LOGGING */ +#if HAVE_V2_LOGGING + fprintf (eLstats, + "%s %s (%s) (%ld) %s %s %ld bytes %ld seconds\n", + zuser, zsystem, zldate_and_time (), + (long) time ((time_t *) NULL), + fsent ? "sent" : "received", + fsucceeded ? "data" : "failed after", + cbytes, csecs + cmicros / 500000); +#endif /* HAVE_V2_LOGGING */ +#if HAVE_HDB_LOGGING + { + static int iseq; + + /* I don't know what the 'C' means. The sequence number should + 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; + ++iseq; + fprintf (eLstats, + "%s!%s %c (%s) (C,%d,%d) [%s] %s %ld / %ld.%03ld secs, %ld %s\n", + zsystem, zuser, fmaster ? 'M' : 'S', zldate_and_time (), + iLid, iseq, zLdevice == NULL ? "unknown" : zLdevice, + fsent ? "->" : "<-", + cbytes, csecs, cmicros / 1000, cbps, + "bytes/sec"); + } +#endif /* HAVE_HDB_LOGGING */ + + (void) fflush (eLstats); + +#if CLOSE_LOGFILES + ustats_close (); +#endif +} + +/* Close the statistics file. */ + +void +ustats_close () +{ + if (eLstats != NULL) + { + if (fclose (eLstats) != 0) + ulog (LOG_ERROR, "fclose: %s", strerror (errno)); + eLstats = NULL; + fLstats_tried = FALSE; + } +} + +/* Return the date and time in a form used for a log entry. */ + +static const char * +zldate_and_time () +{ + long isecs, imicros; + struct tm s; +#if HAVE_TAYLOR_LOGGING + static char ab[sizeof "1991-12-31 12:00:00.00"]; +#endif +#if HAVE_V2_LOGGING + static char ab[sizeof "12/31-12:00"]; +#endif +#if HAVE_HDB_LOGGING + static char ab[sizeof "12/31-12:00:00"]; +#endif + + isecs = ixsysdep_time (&imicros); + usysdep_localtime (isecs, &s); + +#if HAVE_TAYLOR_LOGGING + sprintf (ab, "%04d-%02d-%02d %02d:%02d:%02d.%02d", + s.tm_year + 1900, s.tm_mon + 1, s.tm_mday, s.tm_hour, + s.tm_min, s.tm_sec, (int) (imicros / 10000)); +#endif +#if HAVE_V2_LOGGING + sprintf (ab, "%d/%d-%02d:%02d", s.tm_mon + 1, s.tm_mday, + s.tm_hour, s.tm_min); +#endif +#if HAVE_HDB_LOGGING + sprintf (ab, "%d/%d-%02d:%02d:%02d", s.tm_mon + 1, s.tm_mday, + s.tm_hour, s.tm_min, s.tm_sec); +#endif + + return ab; +} diff --git a/gnu/libexec/uucp/common_sources/policy.h b/gnu/libexec/uucp/common_sources/policy.h new file mode 100644 index 000000000000..4c829bf42d8e --- /dev/null +++ b/gnu/libexec/uucp/common_sources/policy.h @@ -0,0 +1,521 @@ +/* policy.h + Configuration file for policy decisions. To be edited on site. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +/* This header file contains macro definitions which must be set by + each site before compilation. The first few are system + characteristics that can not be easily discovered by the + configuration script. Most are configuration decisions that must + be made by the local administrator. */ + +/* System characteristics. */ + +/* This code tries to use several ANSI C features, including + prototypes, stdarg.h, the const qualifier and the types void + (including void * pointers) and unsigned char. By default it will + use these features if the compiler defines __STDC__. If your + compiler supports these features but does not define __STDC__, you + should set ANSI_C to 1. If your compiler does not support these + features but defines __STDC__ (no compiler should do this, in my + opinion), you should set ANSI_C to 0. In most cases (or if you're + not sure) just leave the line below commented out. */ +/* #define ANSI_C 1 */ + +/* Set USE_STDIO to 1 if data files should be read using the stdio + routines (fopen, fread, etc.) rather than the UNIX unbuffered I/O + calls (open, read, etc.). Unless you know your stdio is really + rotten, you should leave this as 1. */ +#define USE_STDIO 1 + +/* Exactly one of the following macros must be set to 1. Many modern + systems support more than one of these choices through some form of + compilation environment, in which case the setting will depend on + the compilation environment you use. If you have a reasonable + choice between options, I suspect that TERMIO or TERMIOS will be + more efficient than TTY, but I have not done any head to head + comparisons. + + If you don't set any of these macros, the code below will guess. + It will doubtless be wrong on some systems. + + HAVE_BSD_TTY -- Use the 4.2BSD tty routines + HAVE_SYSV_TERMIO -- Use the System V termio routines + HAVE_POSIX_TERMIOS -- Use the POSIX termios routines + */ +#define HAVE_BSD_TTY 0 +#define HAVE_SYSV_TERMIO 0 +#define HAVE_POSIX_TERMIOS 1 + +/* This code tries to guess which terminal driver to use if you did + not make a choice above. It is in this file to make it easy to + figure out what's happening if something goes wrong. */ + +#if HAVE_BSD_TTY + HAVE_SYSV_TERMIO + HAVE_POSIX_TERMIOS == 0 +#if HAVE_CBREAK +#undef HAVE_BSD_TTY +#define HAVE_BSD_TTY 1 +#else +#undef HAVE_SYSV_TERMIO +#define HAVE_SYSV_TERMIO 1 +#endif +#endif + +/* 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 + more efficient if the package knows that a write to the serial port + will not block; however, if the write does block unexpectedly then + data loss is possible at high speeds. + + If writes to a serial port always block even when requested not to, + you should set HAVE_UNBLOCKED_WRITES to 0; otherwise you should set + it to 1. In general on System V releases without STREAMS-based + ttys (e.g., before SVR4) HAVE_UNBLOCKED_WRITES should be 0 and on + BSD or SVR4 it should be 1. + + If HAVE_UNBLOCKED_WRITES is set to 1 when it should be 0 you may + see an unexpectedly large number of transmission errors, or, if you + have hardware handshaking, transfer times may be lower than + expected (but then, they always are). If HAVE_UNBLOCKED_WRITES is + set to 0 when it should be 1, file transfer will use more CPU time + than necessary. If you are unsure, setting HAVE_UNBLOCKED_WRITES + to 0 should always be safe. */ +#define HAVE_UNBLOCKED_WRITES 1 + +/* When the code does do a blocking write, it wants to write the + largest amount of data which the kernel will accept as a single + unit. On BSD this is typically the value of OBUFSIZ in + <sys/tty.h>, usually 100. On System V before SVR4 this is + typically the size of a clist, CLSIZE in <sys/tty.h>, which is + usually 64. On SVR4, which uses STREAMS-based ttys, 2048 is + reasonable. Define SINGLE_WRITE to the correct value for your + system. If SINGLE_WRITE is too large, data loss may occur. If + SINGLE_WRITE is too small, file transfer will use more CPU time + than necessary. If you have no idea, 64 should work on most modern + systems. */ +#define SINGLE_WRITE 100 + +/* Some tty drivers, such as those from SCO and AT&T's Unix PC, have a + bug in the implementation of ioctl() that causes CLOCAL to be + ineffective until the port is opened a second time. If + HAVE_CLOCAL_BUG is set to 1, code will be added to do this second + open on the port. Set this if you are getting messages that say + "Line disconnected" while in the dial chat script after only + writing the first few characters to the port. This bug causes the + resetting of CLOCAL to have no effect, so the "\m" (require + carrier) escape sequence won't function properly in dialer chat + scripts. */ +#define HAVE_CLOCAL_BUG 0 + +/* On some systems, such as SCO Xenix, resetting DTR on a port + apparently prevents getty from working on the port, and thus + prevents anybody from dialing in. If HAVE_RESET_BUG is set to 1, + DTR will not be reset when a serial port is closed. */ +#define HAVE_RESET_BUG 0 + +/* The Sony NEWS reportedly handles no parity by clearing both the odd + and even parity bits in the sgtty structure, unlike most BSD based + systems in which no parity is indicated by setting both the odd and + even parity bits. Setting HAVE_PARITY_BUG to 1 will handle this + correctly. */ +#define HAVE_PARITY_BUG 0 + +#if HAVE_BSD_TTY +#ifdef sony +#undef HAVE_PARITY_BUG +#define HAVE_PARITY_BUG 1 +#endif +#endif + +/* On Ultrix 4.0, at least, setting CBREAK causes input characters to + be stripped, regardless of the setting of LPASS8 and LLITOUT. This + can be worked around by using the termio call to reset ISTRIP. + This probably does not apply to any other operating system. + Setting HAVE_STRIP_BUG to 1 will use this workaround. */ +#define HAVE_STRIP_BUG 0 + +#if HAVE_BSD_TTY +#ifdef ultrix +#undef HAVE_STRIP_BUG +#define HAVE_STRIP_BUG 1 +#endif +#endif + +/* 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 + function and also has _SC_CLK_TCK defined in <unistd.h>) TIMES_TICK + may simply be left as 0. On some systems the environment variable + HZ is what you want for TIMES_TICK, but on some other systems HZ + has the wrong value; check the man page. If you leave this set to + 0, the code will try to guess; it will doubtless be wrong on some + non-POSIX systems. If TIMES_TICK is wrong the code may report + incorrect file transfer times in the statistics file, but on many + systems times(2) will actually not be used and this value will not + matter at all. */ +#define TIMES_TICK 0 + +/* If your system does not support saved set user ID, set + HAVE_SAVED_SETUID to 0. However, this is ignored if your system + has the setreuid function. Most modern Unixes have one or the + other. If your system has the setreuid function, don't worry about + this define, or about the following discussion. + + If you set HAVE_SAVED_SETUID to 0, you will not be able to use uucp + to transfer files that the uucp user can not read. Basically, you + will only be able to use uucp on world-readable files. If you set + 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 + +/* On some systems, such as the DG Aviion and, possibly, the RS/6000, + the setreuid function is broken. It should be possible to use + setreuid to swap the real and effective user ID's, but on some + systems it will not change the real user ID (I believe this is due + to a misreading of the POSIX standard). On such a system you must + 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 + +/* On the 3B2, and possibly other systems, nap takes an argument in + hundredths of a second rather than milliseconds. I don't know of + any way to test for this. Set HAVE_HUNDREDTHS_NAP to 1 if this is + true on your system. This does not matter if your system does not + have the nap function. */ +#define HAVE_HUNDREDTHS_NAP 0 + +/* 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 + numbers may be appended (e.g. ``ps -flp1,10,100''). Otherwise ps + will be invoked several times, with a single process number append + each time. The default definitions should work on most systems, + although some (such as the NeXT) will complain about the 'p' + option; for those, use the second set of definitions. The third + set of definitions are appropriate for System V. To use the second + or third set of definitions, change the ``#if 1'' to ``#if 0'' and + change the appropriate ``#if 0'' to ``#if 1''. */ +#if 1 +#define PS_PROGRAM "/bin/ps -lp" +#define HAVE_PS_MULTIPLE 0 +#endif +#if 0 +#define PS_PROGRAM "/bin/ps -l" +#define HAVE_PS_MULTIPLE 0 +#endif +#if 0 +#define PS_PROGRAM "/bin/ps -flp" +#define HAVE_PS_MULTIPLE 1 +#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 + is locked. This is typically done by creating a lock file in a + specific directory; the lock files are generally named + LCK..something or LK.something. If the LOCKDIR macro is defined, + these lock files will be placed in the named directory; otherwise + they will be placed in the default spool directory. On some HDB + systems the lock files are placed in /etc/locks. On some they are + placed in /usr/spool/locks. On the NeXT they are placed in + /usr/spool/uucp/LCK. */ +/* #define LOCKDIR "/usr/spool/uucp" */ +/* #define LOCKDIR "/etc/locks" */ +/* #define LOCKDIR "/usr/spool/locks" */ +/* #define LOCKDIR "/usr/spool/uucp/LCK" */ +#define LOCKDIR "/var/spool/lock" + +/* You must also specify the format of the lock files by setting + exactly one of the following macros to 1. Check an existing lock + file to decide which of these choices is more appropriate. + + The HDB style is to write the locking process ID in ASCII, passed + to ten characters, followed by a newline. + + The V2 style is to write the locking process ID as four binary + bytes in the host byte order. Many BSD derived systems use this + type of lock file, including the NeXT. + + SCO lock files are similar to HDB lock files, but always lock the + lowercase version of the tty (i.e., LCK..tty2a is created if you + are locking tty2A). They are appropriate if you are using Taylor + UUCP on an SCO Unix, SCO Xenix, or SCO Open Desktop system. + + SVR4 lock files are also similar to HDB lock files, but they use a + different naming convention. The filenames are LK.xxx.yyy.zzz, + where xxx is the major device number of the device holding the + special device file, yyy is the major device number of the port + device itself, and zzz is the minor device number of the port + device. + + 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. */ +#define HAVE_V2_LOCKFILES 0 +#define HAVE_HDB_LOCKFILES 1 +#define HAVE_SCO_LOCKFILES 0 +#define HAVE_SVR4_LOCKFILES 0 +#define HAVE_COHERENT_LOCKFILES 0 + +/* 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. */ +#define HAVE_INTERNET_MAIL 1 + +/* Adminstrative decisions. */ + +/* Set USE_RCS_ID to 1 if you want the RCS ID strings compiled into + the executable. Leaving them out will decrease the executable + size. Leaving them in will make it easier to determine which + version you are running. */ +#define USE_RCS_ID 1 + +/* DEBUG controls how much debugging information is compiled into the + code. If DEBUG is defined as 0, no sanity checks will be done and + no debugging messages will be compiled in. If DEBUG is defined as + 1 sanity checks will be done but there will still be no debugging + messages. If DEBUG is 2 than debugging messages will be compiled + in. When initially testing, DEBUG should be 2, and you should + probably leave it at 2 unless a small reduction in the executable + file size will be very helpful. */ +#define DEBUG 2 + +/* 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. */ +#define BDEFAULT_UUCP_GRADE ('N') + +/* Set the default grade to use for a uux command if the -g option is + not used. */ +#define BDEFAULT_UUX_GRADE ('N') + +/* To compile in use of the new style of configuration files described + in the documentation, set HAVE_TAYLOR_CONFIG to 1. */ +#define HAVE_TAYLOR_CONFIG 1 + +/* To compile in use of V2 style configuration files (L.sys, L-devices + and so on), set HAVE_V2_CONFIG to 1. To compile in use of HDB + style configuration files (Systems, Devices and so on) set + HAVE_HDB_CONFIG to 1. The files will be looked up in the + oldconfigdir directory as defined in the Makefile. + + You may set any or all of HAVE_TAYLOR_CONFIG, HAVE_V2_CONFIG and + HAVE_HDB_CONFIG to 1 (you must set at least one of the macros). + 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 + +/* Exactly one of the following macros must be set to 1. The exact + format of the spool directories is explained in unix/spool.c. + + SPOOLDIR_V2 -- Use a Version 2 (original UUCP) style spool directory + SPOOLDIR_BSD42 -- Use a BSD 4.2 style spool directory + SPOOLDIR_BSD43 -- Use a BSD 4.3 style spool directory + SPOOLDIR_HDB -- Use a HDB (BNU) style spool directory + SPOOLDIR_ULTRIX -- Use an Ultrix style spool directory + SPOOLDIR_SVR4 -- Use a System V Release 4 spool directory + SPOOLDIR_TAYLOR -- Use a new style spool directory + + If you are not worried about compatibility with a currently running + UUCP, use SPOOLDIR_TAYLOR. */ +#define SPOOLDIR_V2 0 +#define SPOOLDIR_BSD42 0 +#define SPOOLDIR_BSD43 0 +#define SPOOLDIR_HDB 0 +#define SPOOLDIR_ULTRIX 0 +#define SPOOLDIR_SVR4 0 +#define SPOOLDIR_TAYLOR 1 + +/* 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. + + If you define HAVE_TAYLOR_LOGGING, each line in the log file will + look something like this: + + uucico uunet uucp (1991-12-10 09:04:34.45 16390) Receiving uunet/D./D.uunetSwJ72 + + and each line in the statistics file will look something like this: + + uucp uunet (1991-12-10 09:04:40.20) received 2371 bytes in 5 seconds (474 bytes/sec) + + If you define HAVE_V2_LOGGING, each line in the log file will look + something like this: + + uucico uunet uucp (12/10-09:04 16390) Receiving uunet/D./D.uunetSwJ72 + + and each line in the statistics file will look something like this: + + uucp uunet (12/10-09:04 16390) (692373862) received data 2371 bytes 5 seconds + + If you define HAVE_HDB_LOGGING, each program will by default use a + separate log file. For uucico talking to uunet, for example, it + will be /usr/spool/uucp/.Log/uucico/uunet. Each line will look + something like this: + + uucp uunet (12/10-09:04:22,16390,1) Receiving uunet/D./D.uunetSwJ72 + + and each line in the statistics file will look something like this: + + uunet!uucp M (12/10-09:04:22) (C,16390,1) [ttyXX] <- 2371 / 5.000 secs, 474 bytes/sec + + The main reason to prefer one format over another is that you may + have shell scripts which expect the files to have a particular + format. If you have none, choose whichever format you find more + appealing. */ +#define HAVE_TAYLOR_LOGGING 1 +#define HAVE_V2_LOGGING 0 +#define HAVE_HDB_LOGGING 0 + +/* 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 + exist when a new message is written out, it will be created. + Setting CLOSE_LOGFILES to 1 will obviously require slightly more + processing time. */ +#define CLOSE_LOGFILES 0 + +/* 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 "/var/spool/uucp" + +/* The name of the default public directory. If HAVE_TAYLOR_CONFIG is + set to 1, this may be overridden by the ``pubdir'' command in the + configuration file. Also, a particular system may be given a + specific public directory by using the ``pubdir'' command in the + system file. */ +#define PUBDIR "/var/spool/uucppublic" + +/* The default command path. This is a space separated list of + directories. Remote command executions requested by uux are looked + up using this path. If you are using HAVE_TAYLOR_CONFIG, the + command path may be overridden for a particular system. For most + systems, you should just make sure that the programs rmail and + rnews can be found using this path. */ +#define CMDPATH "/bin /usr/bin /usr/local/bin" + +/* The default amount of free space to require for systems that do not + specify an amount with the ``free-space'' command. This is only + used when talking to another instance of Taylor UUCP; if accepting + a file would not leave at least this many bytes free on the disk, + it will be refused. */ +#define DEFAULT_FREE_SPACE (50000) + +/* While a file is being received, Taylor UUCP will periodically check + to see if there is enough free space remaining on the disk. If + there is not enough space available on the disk (as determined by + DEFAULT_FREE_SPACE, above, or the ``free-space'' command for the + system) the communication will be aborted. The disk will be + checked each time FREE_SPACE_DELTA bytes are received. Lower + values of FREE_SPACE_DELTA are less likely to fill up the disk, but + will also waste more time checking the amount of free space. To + avoid checking the disk while the file is being received, set + FREE_SPACE_DELTA to 0. */ +#define FREE_SPACE_DELTA (10240) + +/* It is possible for an execute job to request to be executed using + sh(1), rather than execve(2). This is such a security risk, it is + being disabled by default; to allow such jobs, set the following + macro to 1. */ +#define ALLOW_SH_EXECUTION 0 + +/* If a command executed on behalf of a remote system takes a filename + as an argument, a security breach may be possible (note that on my + system neither of the default commands, rmail and rnews, take + filename arguments). If you set ALLOW_FILENAME_ARGUMENTS to 0, all + arguments to a command will be checked; if any argument + 1) starts with ../ + 2) contains the string /../ + 3) begins with a / but does not name a file that may be sent or + received (according to the specified ``remote-send'' and + ``remote-receive'') + the command will be rejected. By default, any argument is + permitted. */ +#define ALLOW_FILENAME_ARGUMENTS 1 + +#if HAVE_TAYLOR_LOGGING + +/* 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 "/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 "/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 "/var/spool/uucp/Debug" + +#endif /* HAVE_TAYLOR_LOGGING */ + +#if HAVE_V2_LOGGING + +/* 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" + +/* 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" + +/* 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" + +#endif /* HAVE_V2_LOGGING */ + +#if HAVE_HDB_LOGGING + +/* The default log file when using HAVE_HDB_LOGGING. When using + HAVE_TAYLOR_CONFIG, this may be overridden by the ``logfile'' + command in the configuration file. The first %s in the string will + be replaced by the program name (e.g. uucico); the second %s will + 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" + +/* 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" + +/* 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" + +#endif /* HAVE_HDB_LOGGING */ diff --git a/gnu/libexec/uucp/common_sources/prot.c b/gnu/libexec/uucp/common_sources/prot.c new file mode 100644 index 000000000000..433bf2766829 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/prot.c @@ -0,0 +1,237 @@ +/* prot.c + Protocol support routines to move commands and data around. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#include <errno.h> + +#include "uudefs.h" +#include "system.h" +#include "conn.h" +#include "prot.h" + +/* Variables visible to the protocol-specific routines. */ + +/* Buffer to hold received data. */ +char abPrecbuf[CRECBUFLEN]; + +/* Index of start of data in abPrecbuf. */ +int iPrecstart; + +/* Index of end of data (first byte not included in data) in abPrecbuf. */ +int iPrecend; + +/* We want to output and input at the same time, if supported on this + machine. If we have something to send, we send it all while + accepting a large amount of data. Once we have sent everything we + look at whatever we have received. If data comes in faster than we + can send it, we may run out of buffer space. */ + +boolean +fsend_data (qconn, zsend, csend, fdoread) + struct sconnection *qconn; + const char *zsend; + size_t csend; + boolean fdoread; +{ + if (! fdoread) + return fconn_write (qconn, zsend, csend); + + while (csend > 0) + { + size_t crec, csent; + + if (iPrecend < iPrecstart) + crec = iPrecstart - iPrecend - 1; + else + { + crec = CRECBUFLEN - iPrecend; + if (iPrecstart == 0) + --crec; + } + + csent = csend; + + if (! fconn_io (qconn, zsend, &csent, abPrecbuf + iPrecend, &crec)) + return FALSE; + + csend -= csent; + zsend += csent; + + iPrecend = (iPrecend + crec) % CRECBUFLEN; + } + + return TRUE; +} + +/* Read data from the other system when we have nothing to send. The + argument cneed is the amount of data the caller wants, and ctimeout + is the timeout in seconds. The function sets *pcrec to the amount + of data which was actually received, which may be less than cneed + if there isn't enough room in the receive buffer. If no data is + received before the timeout expires, *pcrec will be returned as 0. + If an error occurs, the function returns FALSE. If the freport + argument is FALSE, no error should be reported. */ + +boolean +freceive_data (qconn, cneed, pcrec, ctimeout, freport) + struct sconnection *qconn; + size_t cneed; + size_t *pcrec; + int ctimeout; + boolean freport; +{ + /* Set *pcrec to the maximum amount of data we can read. fconn_read + expects *pcrec to be the buffer size, and sets it to the amount + actually received. */ + if (iPrecend < iPrecstart) + *pcrec = iPrecstart - iPrecend - 1; + else + { + *pcrec = CRECBUFLEN - iPrecend; + if (iPrecstart == 0) + --(*pcrec); + } + +#if DEBUG > 0 + /* If we have no room in the buffer, we're in trouble. The + protocols must be written to ensure that this can't happen. */ + if (*pcrec == 0) + ulog (LOG_FATAL, "freceive_data: No room in buffer"); +#endif + + /* If we don't have room for all the data the caller wants, we + simply have to expect less. We'll get the rest later. */ + if (*pcrec < cneed) + cneed = *pcrec; + + if (! fconn_read (qconn, abPrecbuf + iPrecend, pcrec, cneed, ctimeout, + freport)) + return FALSE; + + iPrecend = (iPrecend + *pcrec) % CRECBUFLEN; + + return TRUE; +} + +/* Read a single character. Get it out of the receive buffer if it's + there, otherwise ask freceive_data for at least one character. + This is used because as a protocol is shutting down freceive_data + may read ahead and eat characters that should be read outside the + protocol routines. We call freceive_data rather than fconn_read + with an argument of 1 so that we can get all the available data in + a single system call. The ctimeout argument is the timeout in + seconds; the freport argument is FALSE if no error should be + reported. This returns a character, or -1 on timeout or -2 on + error. */ + +int +breceive_char (qconn, ctimeout, freport) + struct sconnection *qconn; + int ctimeout; + boolean freport; +{ + char b; + + if (iPrecstart == iPrecend) + { + size_t crec; + + if (! freceive_data (qconn, sizeof (char), &crec, ctimeout, freport)) + return -2; + if (crec == 0) + return -1; + } + + b = abPrecbuf[iPrecstart]; + iPrecstart = (iPrecstart + 1) % CRECBUFLEN; + return BUCHAR (b); +} + +/* Send mail about a file transfer. We send to the given mailing + address if there is one, otherwise to the user. */ + +boolean +fmail_transfer (fsuccess, zuser, zmail, zwhy, zfromfile, zfromsys, + ztofile, ztosys, zsaved) + boolean fsuccess; + const char *zuser; + const char *zmail; + const char *zwhy; + const char *zfromfile; + const char *zfromsys; + const char *ztofile; + const char *ztosys; + const char *zsaved; +{ + const char *zsendto; + const char *az[20]; + int i; + + if (zmail != NULL && *zmail != '\0') + zsendto = zmail; + else + zsendto = zuser; + + i = 0; + az[i++] = "The file\n\t"; + if (zfromsys != NULL) + { + az[i++] = zfromsys; + az[i++] = "!"; + } + az[i++] = zfromfile; + if (fsuccess) + az[i++] = "\nwas successfully transferred to\n\t"; + else + az[i++] = "\ncould not be transferred to\n\t"; + if (ztosys != NULL) + { + az[i++] = ztosys; + az[i++] = "!"; + } + az[i++] = ztofile; + az[i++] = "\nas requested by\n\t"; + az[i++] = zuser; + if (! fsuccess) + { + az[i++] = "\nfor the following reason:\n\t"; + az[i++] = zwhy; + az[i++] = "\n"; + } + if (zsaved != NULL) + { + az[i++] = zsaved; + az[i++] = "\n"; + } + + return fsysdep_mail (zsendto, + fsuccess ? "UUCP succeeded" : "UUCP failed", + i, az); +} diff --git a/gnu/libexec/uucp/common_sources/prot.h b/gnu/libexec/uucp/common_sources/prot.h new file mode 100644 index 000000000000..4e2bb584d842 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/prot.h @@ -0,0 +1,250 @@ +/* prot.h + Protocol header file. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +/* We need the definition of uuconf_cmdtab to declare the protocol + parameter arrays. */ +#ifndef UUCONF_H +#include "uuconf.h" +#endif + +#if ANSI_C +/* These structures are used in prototypes but are not defined in this + header file. */ +struct sdaemon; +struct sconnection; +struct stransfer; +#endif + +/* The sprotocol structure holds information and functions for a specific + protocol (e.g. the 'g' protocol). */ + +struct sprotocol +{ + /* The name of the protocol (e.g. 'g'). */ + char bname; + /* Reliability requirements, an or of UUCONF_RELIABLE_xxx defines + from uuconf.h. */ + int ireliable; + /* The maximum number of channels this protocol can support. */ + int cchans; + /* Protocol parameter commands. */ + struct uuconf_cmdtab *qcmds; + /* A routine to start the protocol. If *pzlog is set to be + non-NULL, it is an informative message to be logged; it should + then be passed to ubuffree. */ + boolean (*pfstart) P((struct sdaemon *qdaemon, char **pzlog)); + /* Shutdown the protocol. */ + boolean (*pfshutdown) P((struct sdaemon *qdaemon)); + /* Send a command to the other side. */ + boolean (*pfsendcmd) P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); + /* Get buffer to space to fill with data. This should set *pcdata + to the amount of data desired. */ + char *(*pzgetspace) P((struct sdaemon *qdaemon, size_t *pcdata)); + /* Send data to the other side. The argument z must be a return + value of pzgetspace. The ipos argument is the file position, and + is ignored by most protocols. */ + boolean (*pfsenddata) P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); + /* Wait for data to come in and call fgot_data with it until + fgot_data sets *pfexit. */ + boolean (*pfwait) P((struct sdaemon *qdaemon)); + /* Handle any file level actions that need to be taken. If a file + transfer is starting rather than ending, fstart is TRUE. If the + file is being sent rather than received, fsend is TRUE. If + fstart and fsend are both TRUE, cbytes holds the size of the + file. If *pfhandled is set to TRUE, then the protocol routine + has taken care of queueing up qtrans for the next action. */ + boolean (*pffile) P((struct sdaemon *qdaemon, struct stransfer *qtrans, + boolean fstart, boolean fsend, long cbytes, + boolean *pfhandled)); +}; + +/* Send data to the other system. If the fread argument is TRUE, this + will also receive data into the receive buffer abPrecbuf; fread is + passed as TRUE if the protocol expects data to be coming back, to + make sure the input buffer does not fill up. Returns FALSE on + error. */ +extern boolean fsend_data P((struct sconnection *qconn, + const char *zsend, size_t csend, + boolean fdoread)); + +/* Receive data from the other system when there is no data to send. + The cneed argument is the amount of data desired and the ctimeout + argument is the timeout in seconds. This will set *pcrec to the + amount of data received. It will return FALSE on error. If a + timeout occurs, it will return TRUE with *pcrec set to zero. */ +extern boolean freceive_data P((struct sconnection *qconn, size_t cneed, + size_t *pcrec, int ctimeout, + boolean freport)); + +/* Get one character from the remote system, going through the + procotol buffering. The ctimeout argument is the timeout in + seconds, and the freport argument is TRUE if errors should be + reported (when closing a connection it is pointless to report + errors). This returns a character or -1 on a timeout or -2 on an + error. */ +extern int breceive_char P((struct sconnection *qconn, + int ctimeout, boolean freport)); + +/* Compute a 32 bit CRC of a data buffer, given an initial CRC. */ +extern unsigned long icrc P((const char *z, size_t c, unsigned long ick)); + +/* The initial CRC value to use for a new buffer. */ +#if ANSI_C +#define ICRCINIT (0xffffffffUL) +#else +#define ICRCINIT ((unsigned long) 0xffffffffL) +#endif + +/* The size of the receive buffer. */ +#define CRECBUFLEN (16384) + +/* Buffer to hold received data. */ +extern char abPrecbuf[CRECBUFLEN]; + +/* Index of start of data in abPrecbuf. */ +extern int iPrecstart; + +/* Index of end of data (first byte not included in data) in abPrecbuf. */ +extern int iPrecend; + +/* There are a couple of variables and functions that are shared by + the 'i' and 'j' protocols (the 'j' protocol is just a wrapper + around the 'i' protocol). These belong in a separate header file, + protij.h, but I don't want to create one for just a couple of + things. */ + +/* An escape sequence of characters for the 'j' protocol to avoid + (protocol parameter ``avoid''). */ +extern const char *zJavoid_parameter; + +/* Timeout to use when sending the 'i' protocol SYNC packet (protocol + parameter ``sync-timeout''). */ +extern int cIsync_timeout; + +/* Shared startup routine for the 'i' and 'j' protocols. */ +extern boolean fijstart P((struct sdaemon *qdaemon, char **pzlog, + int imaxpacksize, + boolean (*pfsend) P((struct sconnection *qconn, + const char *zsend, + size_t csend, + boolean fdoread)), + boolean (*pfreceive) P((struct sconnection *qconn, + size_t cneed, + size_t *pcrec, + int ctimeout, + boolean freport)))); + +/* Prototypes for 'g' protocol functions. */ + +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 fgshutdown P((struct sdaemon *qdaemon)); +extern boolean fgsendcmd P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); +extern char *zggetspace P((struct sdaemon *qdaemon, size_t *pcdata)); +extern boolean fgsenddata P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); +extern boolean fgwait P((struct sdaemon *qdaemon)); + +/* Prototypes for 'f' protocol functions. */ + +extern struct uuconf_cmdtab asFproto_params[]; +extern boolean ffstart P((struct sdaemon *qdaemon, char **pzlog)); +extern boolean ffshutdown P((struct sdaemon *qdaemon)); +extern boolean ffsendcmd P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); +extern char *zfgetspace P((struct sdaemon *qdaemon, size_t *pcdata)); +extern boolean ffsenddata P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); +extern boolean ffwait P((struct sdaemon *qdaemon)); +extern boolean fffile P((struct sdaemon *qdaemon, struct stransfer *qtrans, + boolean fstart, boolean fsend, long cbytes, + boolean *pfhandled)); + +/* Prototypes for 't' protocol functions. */ + +extern struct uuconf_cmdtab asTproto_params[]; +extern boolean ftstart P((struct sdaemon *qdaemon, char **pzlog)); +extern boolean ftshutdown P((struct sdaemon *qdaemon)); +extern boolean ftsendcmd P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); +extern char *ztgetspace P((struct sdaemon *qdaemon, size_t *pcdata)); +extern boolean ftsenddata P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); +extern boolean ftwait P((struct sdaemon *qdaemon)); +extern boolean ftfile P((struct sdaemon *qdaemon, struct stransfer *qtrans, + boolean fstart, boolean fsend, long cbytes, + boolean *pfhandled)); + +/* Prototypes for 'e' protocol functions. */ + +extern struct uuconf_cmdtab asEproto_params[]; +extern boolean festart P((struct sdaemon *qdaemon, char **pzlog)); +extern boolean feshutdown P((struct sdaemon *qdaemon)); +extern boolean fesendcmd P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); +extern char *zegetspace P((struct sdaemon *qdaemon, size_t *pcdata)); +extern boolean fesenddata P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); +extern boolean fewait P((struct sdaemon *qdaemon)); +extern boolean fefile P((struct sdaemon *qdaemon, struct stransfer *qtrans, + boolean fstart, boolean fsend, long cbytes, + boolean *pfhandled)); + +/* Prototypes for 'i' protocol functions. */ + +extern struct uuconf_cmdtab asIproto_params[]; +extern boolean fistart P((struct sdaemon *qdaemon, char **pzlog)); +extern boolean fishutdown P((struct sdaemon *qdaemon)); +extern boolean fisendcmd P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); +extern char *zigetspace P((struct sdaemon *qdaemon, size_t *pcdata)); +extern boolean fisenddata P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); +extern boolean fiwait P((struct sdaemon *qdaemon)); + +/* Prototypes for 'j' protocol functions. The 'j' protocol mostly + uses the 'i' protocol functions, but it has a couple of functions + of its own. */ +extern boolean fjstart P((struct sdaemon *qdaemon, char **pzlog)); +extern boolean fjshutdown P((struct sdaemon *qdaemon)); + +/* Prototypes for 'a' protocol functions (these use 'z' as the second + character because 'a' is a modified Zmodem protocol). */ +extern struct uuconf_cmdtab asZproto_params[]; +extern boolean fzstart P((struct sdaemon *qdaemon, char **pzlog)); +extern boolean fzshutdown P((struct sdaemon *qdaemon)); +extern boolean fzsendcmd P((struct sdaemon *qdaemon, const char *z, + int ilocal, int iremote)); +extern char *zzgetspace P((struct sdaemon *qdaemon, size_t *pcdata)); +extern boolean fzsenddata P((struct sdaemon *qdaemon, char *z, size_t c, + int ilocal, int iremote, long ipos)); +extern boolean fzwait P((struct sdaemon *qdaemon)); +extern boolean fzfile P((struct sdaemon *qdaemon, struct stransfer *qtrans, + boolean fstart, boolean fsend, long cbytes, + boolean *pfhandled)); diff --git a/gnu/libexec/uucp/common_sources/sysdep.h b/gnu/libexec/uucp/common_sources/sysdep.h new file mode 100644 index 000000000000..47675ac2385d --- /dev/null +++ b/gnu/libexec/uucp/common_sources/sysdep.h @@ -0,0 +1,530 @@ +/* sysh.unx -*- C -*- + The header file for the UNIX system dependent routines. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#ifndef SYSH_UNX_H + +#define SYSH_UNX_H + +#if ANSI_C +/* These structures are used in prototypes but are not defined in this + header file. */ +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 +#undef HAVE_HDB_LOCKFILES +#define HAVE_HDB_LOCKFILES 1 +#endif + +#if HAVE_BSD_TTY + HAVE_SYSV_TERMIO + HAVE_POSIX_TERMIOS != 1 + #error Terminal driver define not set or duplicated +#endif + +#if SPOOLDIR_V2 + SPOOLDIR_BSD42 + SPOOLDIR_BSD43 + SPOOLDIR_HDB + SPOOLDIR_ULTRIX + SPOOLDIR_SVR4 + SPOOLDIR_TAYLOR != 1 + #error Spool directory define not set or duplicated +#endif + +/* If setreuid is broken, don't use it. */ +#if HAVE_BROKEN_SETREUID +#undef HAVE_SETREUID +#define HAVE_SETREUID 0 +#endif + +/* Get some standard types from the configuration header file. */ +#ifdef PID_T +typedef PID_T pid_t; +#endif + +#ifdef UID_T +typedef UID_T uid_t; +#endif + +#ifdef GID_T +typedef GID_T gid_t; +#endif + +#ifdef OFF_T +typedef OFF_T off_t; +#endif + +/* On Unix, binary files are the same as text files. */ +#define BINREAD "r" +#define BINWRITE "w" + +/* If we have sigaction, we can force system calls to not be + restarted. */ +#if HAVE_SIGACTION +#undef HAVE_RESTARTABLE_SYSCALLS +#define HAVE_RESTARTABLE_SYSCALLS 0 +#endif + +/* If we have sigvec, and we have HAVE_SIGVEC_SV_FLAGS, and + SV_INTERRUPT is defined, we can force system calls to not be + restarted (signal.h is included by uucp.h before this point, so + SV_INTERRUPT will be defined by now if it it ever is). */ +#if HAVE_SIGVEC && HAVE_SIGVEC_SV_FLAGS +#ifdef SV_INTERRUPT +#undef HAVE_RESTARTABLE_SYSCALLS +#define HAVE_RESTARTABLE_SYSCALLS 0 +#endif +#endif + +/* If we were cross-configured, we will have a value of -1 for + HAVE_RESTARTABLE_SYSCALLS. In this case, we try to guess what the + correct value should be. Yuck. If we have sigvec, but neither of + the above cases applied (which we know because they would have + changed HAVE_RESTARTABLE_SYSCALLS) then we are probably on 4.2BSD + and system calls are automatically restarted. Otherwise, assume + that they are not. */ +#if HAVE_RESTARTABLE_SYSCALLS == -1 +#undef HAVE_RESTARTABLE_SYSCALLS +#if HAVE_SIGVEC +#define HAVE_RESTARTABLE_SYSCALLS 1 +#else +#define HAVE_RESTARTABLE_SYSCALLS 0 +#endif +#endif /* HAVE_RESTARTABLE_SYSCALLS == -1 */ + +/* We don't handle sigset in combination with restartable system + calls, so we check for it although this combination will never + happen. */ +#if ! HAVE_SIGACTION && ! HAVE_SIGVEC && HAVE_SIGSET +#if HAVE_RESTARTABLE_SYSCALLS +#undef HAVE_SIGSET +#define HAVE_SIGSET 0 +#endif +#endif + +/* If we don't have restartable system calls, we can ignore + fsysdep_catch, usysdep_start_catch and usysdep_end_catch. + Otherwise fsysdep_catch has to do a setjmp. */ + +#if ! HAVE_RESTARTABLE_SYSCALLS + +#define fsysdep_catch() (TRUE) +#define usysdep_start_catch() +#define usysdep_end_catch() +#define CATCH_PROTECT + +#else /* HAVE_RESTARTABLE_SYSCALLS */ + +#if HAVE_SETRET && ! HAVE_SIGSETJMP +#include <setret.h> +#define setjmp setret +#define longjmp longret +#define jmp_buf ret_buf +#else /* ! HAVE_SETRET || HAVE_SIGSETJMP */ +#include <setjmp.h> +#if HAVE_SIGSETJMP +#undef setjmp +#undef longjmp +#undef jmp_buf +#define setjmp(s) sigsetjmp ((s), TRUE) +#define longjmp siglongjmp +#define jmp_buf sigjmp_buf +#endif /* HAVE_SIGSETJMP */ +#endif /* ! HAVE_SETRET || HAVE_SIGSETJMP */ + +extern volatile sig_atomic_t fSjmp; +extern volatile jmp_buf sSjmp_buf; + +#define fsysdep_catch() (setjmp (sSjmp_buf) == 0) + +#define usysdep_start_catch() (fSjmp = TRUE) + +#define usysdep_end_catch() (fSjmp = FALSE) + +#define CATCH_PROTECT volatile + +#endif /* HAVE_RESTARTABLE_SYSCALLS */ + +/* Get definitions for the terminal driver. */ + +#if HAVE_BSD_TTY +#include <sgtty.h> +struct sbsd_terminal +{ + struct sgttyb stty; + struct tchars stchars; + struct ltchars sltchars; +}; +typedef struct sbsd_terminal sterminal; +#define fgetterminfo(o, q) \ + (ioctl ((o), TIOCGETP, &(q)->stty) == 0 \ + && ioctl ((o), TIOCGETC, &(q)->stchars) == 0 \ + && ioctl ((o), TIOCGLTC, &(q)->sltchars) == 0) +#define fsetterminfo(o, q) \ + (ioctl ((o), TIOCSETN, &(q)->stty) == 0 \ + && ioctl ((o), TIOCSETC, &(q)->stchars) == 0 \ + && ioctl ((o), TIOCSLTC, &(q)->sltchars) == 0) +#define fsetterminfodrain(o, q) \ + (ioctl ((o), TIOCSETP, &(q)->stty) == 0 \ + && ioctl ((o), TIOCSETC, &(q)->stchars) == 0 \ + && ioctl ((o), TIOCSLTC, &(q)->sltchars) == 0) +#endif /* HAVE_BSD_TTY */ + +#if HAVE_SYSV_TERMIO +#include <termio.h> +typedef struct termio sterminal; +#define fgetterminfo(o, q) (ioctl ((o), TCGETA, (q)) == 0) +#define fsetterminfo(o, q) (ioctl ((o), TCSETA, (q)) == 0) +#define fsetterminfodrain(o, q) (ioctl ((o), TCSETAW, (q)) == 0) +#endif /* HAVE_SYSV_TERMIO */ + +#if HAVE_POSIX_TERMIOS +#include <termios.h> +typedef struct termios sterminal; +#define fgetterminfo(o, q) (tcgetattr ((o), (q)) == 0) +#define fsetterminfo(o, q) (tcsetattr ((o), TCSANOW, (q)) == 0) +#define fsetterminfodrain(o, q) (tcsetattr ((o), TCSADRAIN, (q)) == 0) + +/* On some systems it is not possible to include both <sys/ioctl.h> + and <termios.h> in the same source files; I don't really know why. + On such systems, we pretend that we don't have <sys/ioctl.h>. */ +#if ! HAVE_TERMIOS_AND_SYS_IOCTL_H +#undef HAVE_SYS_IOCTL_H +#define HAVE_SYS_IOCTL_H 0 +#endif + +#endif /* HAVE_POSIX_TERMIOS */ + +/* The root directory (this is needed by the system independent stuff + as the default for local-send). */ +#define ZROOTDIR "/" + +/* The name of the execution directory within the spool directory + (this is need by the system independent uuxqt.c). */ +#define XQTDIR ".Xqtdir" + +/* The name of the directory in which we preserve file transfers that + failed. */ +#define PRESERVEDIR ".Preserve" + +/* The length of the sequence number used in a file name. */ +#define CSEQLEN (4) + +/* Get some standard definitions. Avoid including the files more than + once--some might have been included by uucp.h. */ +#if USE_STDIO && HAVE_UNISTD_H +#include <unistd.h> +#endif +#if ! USE_TYPES_H +#include <sys/types.h> +#endif +#include <sys/stat.h> + +/* Get definitions for the file permission bits. */ + +#ifndef S_IRWXU +#define S_IRWXU 0700 +#endif +#ifndef S_IRUSR +#define S_IRUSR 0400 +#endif +#ifndef S_IWUSR +#define S_IWUSR 0200 +#endif +#ifndef S_IXUSR +#define S_IXUSR 0100 +#endif + +#ifndef S_IRWXG +#define S_IRWXG 0070 +#endif +#ifndef S_IRGRP +#define S_IRGRP 0040 +#endif +#ifndef S_IWGRP +#define S_IWGRP 0020 +#endif +#ifndef S_IXGRP +#define S_IXGRP 0010 +#endif + +#ifndef S_IRWXO +#define S_IRWXO 0007 +#endif +#ifndef S_IROTH +#define S_IROTH 0004 +#endif +#ifndef S_IWOTH +#define S_IWOTH 0002 +#endif +#ifndef S_IXOTH +#define S_IXOTH 0001 +#endif + +#ifndef S_ISDIR +#ifdef S_IFDIR +#define S_ISDIR(i) (((i) & S_IFMT) == S_IFDIR) +#else /* ! defined (S_IFDIR) */ +#define S_ISDIR(i) (((i) & 0170000) == 040000) +#endif /* ! defined (S_IFDIR) */ +#endif /* ! defined (S_ISDIR) */ + +/* We need the access macros. */ +#ifndef R_OK +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 +#endif /* ! defined (R_OK) */ + +/* We create files with these modes (should this be configurable?). */ +#define IPRIVATE_FILE_MODE (S_IRUSR | S_IWUSR) +#define IPUBLIC_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) + +/* We create directories with this mode (should this be configurable?). */ +#define IDIRECTORY_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) +#define IPUBLIC_DIRECTORY_MODE (S_IRWXU | S_IRWXG | S_IRWXO) + +#if ! HAVE_OPENDIR + +/* Define some structures to use if we don't have opendir, etc. These + will only work if we have the old Unix filesystem, with a 2 byte + inode and a 14 byte filename. */ + +#include <sys/dir.h> + +struct dirent +{ + char d_name[DIRSIZ + 1]; +}; + +typedef struct +{ + int o; + struct dirent s; +} DIR; + +extern DIR *opendir P((const char *zdir)); +extern struct dirent *readdir P((DIR *)); +extern int closedir P((DIR *)); + +#endif /* ! HAVE_OPENDIR */ + +#if ! HAVE_FTW_H + +/* If there is no <ftw.h>, define the ftw constants. */ + +#define FTW_F (0) +#define FTW_D (1) +#define FTW_DNR (2) +#define FTW_NS (3) + +#endif /* ! HAVE_FTW_H */ + +/* This structure holds the system dependent information we keep for a + connection. This is used by the TCP and TLI code. */ + +struct ssysdep_conn +{ + /* File descriptor. */ + int o; + /* Device name. */ + char *zdevice; + /* File status flags. */ + int iflags; + /* File status flags for descriptor 1 (-1 if not standard input). */ + int istdout_flags; + /* Hold the real descriptor when using a dialer device. */ + int ohold; + /* TRUE if this is a terminal and the remaining fields are valid. */ + boolean fterminal; + /* TRUE if this is a TLI descriptor. */ + boolean ftli; + /* Baud rate. */ + long ibaud; + /* Original terminal settings. */ + sterminal sorig; + /* Current terminal settings. */ + sterminal snew; +#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. */ + char *zenable; +#endif +}; + +/* These functions do I/O and chat scripts to a port. They are called + by the TCP and TLI routines. */ +extern boolean fsysdep_conn_read P((struct sconnection *qconn, + char *zbuf, size_t *pclen, + size_t cmin, int ctimeout, + boolean freport)); +extern boolean fsysdep_conn_write P((struct sconnection *qconn, + const char *zbuf, size_t clen)); +extern boolean fsysdep_conn_io P((struct sconnection *qconn, + const char *zwrite, size_t *pcwrite, + char *zread, size_t *pcread)); +extern boolean fsysdep_conn_chat P((struct sconnection *qconn, + char **pzprog)); + +/* Set a signal handler. */ +extern void usset_signal P((int isig, RETSIGTYPE (*pfn) P((int)), + boolean fforce, boolean *pfignored)); + +/* Default signal handler. This sets the appropriate element of the + afSignal array. If system calls are automatically restarted, it + may do a longjmp to an fsysdep_catch. */ +extern RETSIGTYPE ussignal P((int isig)); + +/* Try to fork, repeating several times. */ +extern pid_t ixsfork P((void)); + +/* Spawn a job. Returns the process ID of the spawned job or -1 on + error. The following macros may be passed in aidescs. */ + +/* Set descriptor to /dev/null. */ +#define SPAWN_NULL (-1) +/* Set element of aidescs to a pipe for caller to read from. */ +#define SPAWN_READ_PIPE (-2) +/* Set element of aidescs to a pipe for caller to write to. */ +#define SPAWN_WRITE_PIPE (-3) + +extern pid_t ixsspawn P((const char **pazargs, int *aidescs, + boolean fkeepuid, boolean fkeepenv, + const char *zchdir, boolean fnosigs, + boolean fshell, const char *zpath, + const char *zuu_machine, + const char *zuu_user)); + +/* Do a form of popen using ixsspawn. */ +extern FILE *espopen P((const char **pazargs, boolean frd, + pid_t *pipid)); + +/* Wait for a particular process to finish, returning the exit status. + The process ID should be pid_t, but we can't put that in a + prototype. */ +extern int ixswait P((unsigned long ipid, const char *zreport)); + +/* 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. */ +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)); + +/* Lock a string. */ +extern boolean fsdo_lock P((const char *, boolean fspooldir, + boolean *pferr)); + +/* Unlock a string. */ +extern boolean fsdo_unlock P((const char *, boolean fspooldir)); + +/* Check access for a particular user name, or NULL to check access + for any user. */ +extern boolean fsuser_access P((const struct stat *, int imode, + const char *zuser)); + +/* Stick two directories and a file name together. */ +extern char *zsappend3 P((const char *zdir1, const char *zdir2, + const char *zfile)); + +/* Stick three directories and a file name together. */ +extern char *zsappend4 P((const char *zdir1, const char *zdir2, + const char *zdir3, const char *zfile)); + +/* Get a temporary file name. */ +extern char *zstemp_file P((const struct uuconf_system *qsys)); + +/* Get a command file name. */ +extern char *zscmd_file P((const struct uuconf_system *qsys, int bgrade)); + +/* Get a jobid from a system, a file name, and a grade. */ +extern char *zsfile_to_jobid P((const struct uuconf_system *qsys, + const char *zfile, + int bgrade)); + +/* Get a file name from a jobid. This also returns the associated system + in *pzsystem and the grade in *pbgrade. */ +extern char *zsjobid_to_file P((const char *zid, char **pzsystem, + char *pbgrade)); + +/* See whether there is a spool directory for a system when using + SPOOLDIR_ULTRIX. */ +extern boolean fsultrix_has_spool P((const char *zsystem)); + +#if HAVE_COHERENT_LOCKFILES +/* Lock a coherent tty. */ +extern boolean lockttyexist P((const char *z)); +extern boolean fscoherent_disable_tty P((const char *zdevice, + char **pzenable)); +#endif + +/* Some replacements for standard Unix functions. */ + +#if ! HAVE_DUP2 +extern int dup2 P((int oold, int onew)); +#endif + +#if ! HAVE_FTW +extern int ftw P((const char *zdir, + int (*pfn) P((const char *zfile, + const struct stat *qstat, + int iflag)), + int cdescriptors)); +#endif + +#if ! HAVE_GETCWD && ! HAVE_GETWD +extern char *getcwd P((char *zbuf, size_t cbuf)); +#endif + +#if ! HAVE_MKDIR +extern int mkdir P((const char *zdir, int imode)); +#endif + +#if ! HAVE_RENAME +extern int rename P((const char *zold, const char *znew)); +#endif + +#if ! HAVE_RMDIR +extern int rmdir P((const char *zdir)); +#endif + +/* The working directory from which the program was run (this is set + by usysdep_initialize if called with INIT_GETCWD). */ +extern char *zScwd; + +/* The spool directory name. */ +extern const char *zSspooldir; + +/* The lock directory name. */ +extern const char *zSlockdir; + +/* The local UUCP name (needed for some spool directory stuff). */ +extern const char *zSlocalname; + +#endif /* ! defined (SYSH_UNX_H) */ diff --git a/gnu/libexec/uucp/common_sources/system.h b/gnu/libexec/uucp/common_sources/system.h new file mode 100644 index 000000000000..aa9d2a41a45a --- /dev/null +++ b/gnu/libexec/uucp/common_sources/system.h @@ -0,0 +1,950 @@ +/* system.h + 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 + + 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#ifndef SYSTEM_H + +#define SYSTEM_H + +#if ANSI_C +/* These structures are used in prototypes but are not defined in this + header file. */ +struct tm; +struct uuconf_system; +struct uuconf_port; +struct sconnection; +struct sstatus; +struct scmd; +#endif + +/* Any function which returns an error should also report an error + message, unless otherwise indicated. + + Any function that returns a char *, rather than a const char *, is + returning a pointer to a buffer allocated by zbufalc which must be + freed using ubuffree, unless otherwise indicated. */ + +/* The maximum length of a remote system name. */ +extern size_t cSysdep_max_name_len; + +/* Initialize. If something goes wrong, this routine should just + exit. The flag argument is 0, or a combination of any of the + following flags. */ + +/* This program needs to know the current working directory. This is + used because on Unix it can be expensive to determine the current + working directory (some versions of getcwd fork a process), but in + most cases we don't need to know it. However, we are going to + chdir to the spool directory (unless INIT_CHDIR is set), so we have + to get the cwd now if we are ever going to get it. Both uucp and + uux use the function fsysdep_needs_cwd to determine whether they + will need the current working directory, and pass the argument to + usysdep_initialize appropriately. There's probably a cleaner way + to handle this, but this will suffice for now. */ +#define INIT_GETCWD (01) + +/* This program should not chdir to the spool directory. This may + only make sense on Unix. It is set by cu. */ +#define INIT_NOCHDIR (02) + +/* This program needs special access to the spool directories. That + means, on Unix, this program is normally installed setuid. */ +#define INIT_SUID (04) + +extern void usysdep_initialize P((pointer puuconf, int iflags)); + +/* Exit the program. The fsuccess argument indicates whether to + return an indication of success or failure to the outer + environment. This routine should not return. */ +extern void usysdep_exit P((boolean fsuccess)); + +/* Called when a non-standard configuration file is being used, to + avoid handing out privileged access. If it returns FALSE, default + configuration file will be used. This is called before the + usysdep_initialize function is called. */ +extern boolean fsysdep_other_config P((const char *)); + +/* Detach from the controlling terminal. This probably only makes + sense on Unix. It is called by uucico to try to get the modem port + as a controlling terminal. It is also called by uucico before it + starts up uuxqt, so that uuxqt will be a complete daemon. */ +extern void usysdep_detach P((void)); + +/* Get the local node name if it is not specified in the configuration + files. Returns NULL on error; otherwise the return value should + point to a static buffer. */ +extern const char *zsysdep_localname P((void)); + +/* Get the login name. This is used when uucico is started up with no + arguments in slave mode, which causes it to assume that somebody + has logged in. It also used by uucp and uux for recording the user + name. This may not return NULL. The return value should point to + a static buffer. */ +extern const char *zsysdep_login_name P((void)); + +/* Set a signal handler for a signal. If the signal occurs, the + appropriate element of afSignal should be set to the signal number + (see the declaration of afSignal in uucp.h). This routine might be + able to just use signal, but Unix requires more complex handling. + This is called before usysdep_initialize. */ +extern void usysdep_signal P((int isig)); + +/* Catch a signal. This is actually defined as a macro in the system + dependent header file, and the prototype here just indicates how it + should be called. It is called before a routine which must exit if + a signal occurs, and is expected to set do a setjmp (which is why + it must be a macro). It is actually only called in one place in + the system independent code, before the call to read stdin in uux. + This is needed to handle 4.2 BSD restartable system calls, which + require a longjmp. On systems which don't need to do + setjmp/longjmp around system calls, this can be redefined in + sysdep.h to TRUE. It should return TRUE if the routine should + proceed, or FALSE if a signal occurred. After having this return + TRUE, usysdep_start_catch should be used to start catching the + signal; this basically tells the signal handler that it's OK to do + the longjmp, if fsysdep_catch did not already do so. */ +#ifndef fsysdep_catch +extern boolean fsysdep_catch P((void)); +#endif + +/* Start catching a signal. This is called after fsysdep_catch to + tell the signal handler to go ahead and do the longjmp. This may + be implemented as a macro in sysdep.h. */ +#ifndef usysdep_start_catch +extern void usysdep_start_catch P((void)); +#endif + +/* Stop catching a signal. This is called when it is no longer + necessary for fsysdep_catch to handle signals. This may be + implemented as a macro in sysdep.h. */ +#ifndef usysdep_end_catch +extern void usysdep_end_catch P((void)); +#endif + +/* Link two files. On Unix this should attempt the link. If it + succeeds it should return TRUE with *pfworked set to TRUE. If the + link fails because it must go across a device, it should return + TRUE with *pfworked set to FALSE. If the link fails for some other + reason, it should log an error message and return FALSE. On a + system which does not support links to files, this should just + return TRUE with *pfworked set to FALSE. */ +extern boolean fsysdep_link P((const char *zfrom, const char *zto, + boolean *pfworked)); + +/* Get the port name. This is used when uucico is started up in slave + mode to figure out which port was used to call in so that it can + determine any appropriate protocol parameters. This may return + NULL if the port cannot be determined, which will just mean that no + protocol parameters are applied. The name returned should be the + sort of name that would appear in the port file. This should set + *pftcp_port to TRUE if it can determine that the port is a TCP + connection rather than a normal serial port. The return value (if + not NULL) should point to a static buffer. */ +extern const char *zsysdep_port_name P((boolean *pftcp_port)); + +/* Expand a file name on the local system. On Unix, if the zfile + argument begins with ~user/ it goes in that users home directory, + and if it begins with ~/ it goes in the public directory (the + public directory is passed to this routine, since each system may + have its own public directory). Similar conventions may be + 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. */ +extern char *zsysdep_local_file P((const char *zname, + const char *zpubdir)); + +/* 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 + is zdir itself). If it is not, it should return FALSE. If zfile + is in zdir, then fcheck indicates whether further checking should + be done. If fcheck is FALSE, no further checking is done. + Otherwise, if freadable is TRUE the user zuser should have search + access to all directories from zdir down to zfile and should have + read access on zfile itself (if zfile does not exist, or is not a + regular file, this function may return FALSE but does not have to). + If freadable is FALSE, the user zuser should have search access to + all directories from zdir down to zfile and should have write + access on zfile (which may be a directory, or may not actually + exist, which is acceptable). The zuser argument may be NULL, in + which case the check should be made for any user, not just zuser. + There is no way for this function to return error. */ +extern boolean fsysdep_in_directory P((const char *zfile, + const char *zdir, + boolean fcheck, + boolean freadable, + const char *zuser)); + +/* Return TRUE if a file exists, FALSE otherwise. There is no way to + 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 + error. */ +extern boolean fsysdep_run P((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 + should simply be concatenated together to form the mail message. + It should return FALSE on error, although the return value is often + ignored. */ +extern boolean fsysdep_mail P((const char *zto, const char *zsubject, + int cstrs, const char **paz)); + +/* Get the time in seconds since some epoch. The actual epoch is + unimportant, so long as the time values are consistent across + program executions and the value is never negative. If the + pimicros argument is not NULL, it should be set to the number of + microseconds (if this is not available, *pimicros should be set to + zero). */ +extern long ixsysdep_time P((long *pimicros)); + +/* Get the time in seconds and microseconds (millionths of a second) + since some epoch. The actual epoch is not important, and it may + change in between program invocations; this is provided because on + Unix the times function may be used. If microseconds can not be + determined, *pimicros can just be set to zero. */ +extern long ixsysdep_process_time P((long *pimicros)); + +/* Parse the value returned by ixsysdep_time into a struct tm. I + assume that this structure is defined in <time.h>. This is + basically just localtime, except that the ANSI function takes a + time_t which may not be what is returned by ixsysdep_time. */ +extern void usysdep_localtime P((long itime, struct tm *q)); + +/* Sleep for a number of seconds. */ +extern void usysdep_sleep P((int cseconds)); + +/* Pause for half a second, or 1 second if subsecond sleeps are not + possible. */ +extern void usysdep_pause P((void)); + +/* Lock a remote system. This should return FALSE if the system is + already locked (no error should be reported). */ +extern boolean fsysdep_lock_system P((const struct uuconf_system *qsys)); + +/* Unlock a remote system. This should return FALSE on error + (although the return value is generally ignored). */ +extern boolean fsysdep_unlock_system P((const struct uuconf_system *qsys)); + +/* Get the conversation sequence number for a remote system, and + increment it for next time. This should return -1 on error. */ +extern long ixsysdep_get_sequence P((const struct uuconf_system *qsys)); + +/* Get the status of a remote system. This should return FALSE on + error. Otherwise it should set *qret to the status. If no status + information is available, this should set *qret to sensible values + and return TRUE. If pfnone is not NULL, then it should be set to + TRUE if no status information was available or FALSE otherwise. */ +extern boolean fsysdep_get_status P((const struct uuconf_system *qsys, + struct sstatus *qret, + boolean *pfnone)); + +/* Set the status of a remote system. This should return FALSE on + error. The system will be locked before this call is made. */ +extern boolean fsysdep_set_status P((const struct uuconf_system *qsys, + const struct sstatus *qset)); + +/* See whether a remote system is permitted to log in. This is just + to support the remote.unknown shell script for HDB. The zscript + argument is the script name, as return by uuconf_remote_unknown. + The zsystem argument is the name given by the remote system. If + the system is not permitted to log in, this function should log an + error and return FALSE. */ +extern boolean fsysdep_unknown_caller P((const char *zscript, + const char *zsystem)); + +/* Check whether there is work for a remote system. It should return + TRUE if there is work, FALSE otherwise; there is no way to indicate + an error. */ +extern boolean fsysdep_has_work P((const struct uuconf_system *qsys)); + +/* Initialize the work scan. This will be called before + fsysdep_get_work. The bgrade argument is the minimum grade of + execution files that should be considered (e.g. a bgrade of 'd' + will allow all grades from 'A' to 'Z' and 'a' to 'd'). This + function should return FALSE on error. */ +extern boolean fsysdep_get_work_init P((const struct uuconf_system *qsys, + int bgrade)); + +/* Get the next command to be executed for a remote system. The + bgrade argument will be the same as for fsysdep_get_work_init; + probably only one of these functions will use it, namely the + function for which it is more convenient. This should return FALSE + on error. The structure pointed to by qcmd should be filled in. + The strings may point into a static buffer; they will be copied out + if necessary. If there is no more work, this should set qcmd->bcmd + to 'H' and return TRUE. This should set qcmd->pseq to something + which can be passed to fsysdep_did_work to remove the job from the + queue when it has been completed. This may set qcmd->bcmd to 'P' + to represent a poll file; the main code will just pass the pseq + element of such a structure to fsysdep_did_work if the system is + called. */ +extern boolean fsysdep_get_work P((const struct uuconf_system *qsys, + int bgrade, struct scmd *qcmd)); + +/* Remove a job from the work queue. This must also remove the + temporary file used for a send command, if there is one. It should + return FALSE on error. */ +extern boolean fsysdep_did_work P((pointer pseq)); + +/* Save the temporary file for a send command. This function should + return a string that will be put into a mail message. On success + this string should say something like ``The file has been saved as + ...''. On failure it could say something like ``The file could not + be saved because ...''. If there is no temporary file, or for some + reason it's not appropriate to include a message, this function + should just return NULL. This function is used when a file send + fails for some reason, to make sure that we don't completely lost + the file. */ +extern const char *zsysdep_save_temp_file P((pointer pseq)); + +/* 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. */ +extern void usysdep_get_work_free P((const struct uuconf_system *qsys)); + +/* Add a base name to a file if it is a directory. If zfile names a + directory, then return a string naming a file within the directory + with the base file name of zname. This should return NULL on + error. */ +extern char *zsysdep_add_base P((const char *zfile, + const char *zname)); + +/* Get a file name from the spool directory. This should return NULL + on error. The pseq argument is TRUE if the file was found from + searching the work directory; this is, unfortunately, needed to + support SVR4 spool directories. */ +extern char *zsysdep_spool_file_name P((const struct uuconf_system *qsys, + const char *zfile, + pointer pseq)); + +/* Make necessary directories. This should create all non-existent + directories for a file. If the fpublic argument is TRUE, anybody + should be permitted to create and remove files in the directory; + otherwise anybody can list the directory, but only the UUCP system + can create and remove files. It should return FALSE on error. */ +extern boolean fsysdep_make_dirs P((const char *zfile, boolean fpublic)); + +/* Create a stdio file, setting appropriate protection. If the + fpublic argument is TRUE, the file is made publically accessible; + otherwise it is treated as a private data file. If the fappend + argument is TRUE, the file is opened in append mode; otherwise any + previously existing file of the same name is removed. If the + fmkdirs argument is TRUE, then any necessary directories should + also be created. On a system in which file protections are + unimportant and the necessary directories exist, this may be + implemented as + + fopen (zfile, fappend ? "a" : "w"); + + */ +extern FILE *esysdep_fopen P((const char *zfile, boolean fpublic, + boolean fappend, boolean fmkdirs)); + +/* Open a file, using the access permission of the user who invoked + the program. The frd argument is TRUE if the file should be opened + for reading, and the fbinary argument is TRUE if the file should be + opened as a binary file (this is ignored on Unix, since there all + files are binary files). This returns an openfile_t, not a FILE *. + This is supposed to be able to open a file even if it can not be + read by the uucp user. This is not possible on some older Unix + systems. */ +extern openfile_t esysdep_user_fopen P((const char *zfile, + boolean frd, boolean fbinary)); + +/* Open a file to send to another system; the qsys argument is the + system the file is being sent to. If fcheck is TRUE, it should + make sure that the file is readable by zuser (if zuser is NULL the + file must be readable by anybody). This is to eliminate a window + between fsysdep_in_directory and esysdep_open_send. If an error + occurs, it should return EFILECLOSED. */ +extern openfile_t esysdep_open_send P((const struct uuconf_system *qsys, + const char *zname, + boolean fcheck, + const char *zuser)); + +/* 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. */ +extern char *zsysdep_receive_temp P((const struct uuconf_system *qsys, + const char *zfile, + const char *ztemp)); + +/* 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. */ +extern openfile_t esysdep_open_receive P((const struct uuconf_system *qsys, + const char *zto, + const char *ztemp, + const char *zreceive, + long *pcrestart)); + +/* Move a file. This is used to move a received file to its final + location. The zto argument is the file to create. The zorig + argument is the name of the file to move. If fmkdirs is TRUE, then + any necessary directories are created; fpublic indicates whether + they should be publically writeable or not. If fcheck is TRUE, + 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. */ +extern boolean fsysdep_move_file P((const char *zorig, const char *zto, + boolean fmkdirs, boolean fpublic, + boolean fcheck, const char *zuser)); + +/* Change the mode of a file. The imode argument is a Unix mode. + This should return FALSE on error. */ +extern boolean fsysdep_change_mode P((const char *zfile, + unsigned int imode)); + +/* Truncate a file which we are receiving into. This may be done by + closing the original file, removing it and reopening it. This + should return FALSE on error. */ +extern openfile_t esysdep_truncate P((openfile_t e, const char *zname)); + +/* It is possible for the acknowledgement of a received file to be + lost. The sending system will then now know that the file was + correctly received, and will send it again. This can be a problem + particularly with protocols which support channels, since they may + send several small files in a single window, all of which may be + received correctly although the sending system never sees the + acknowledgement. If these files involve an execution, the + execution will happen twice, which will be bad. + + This function is called when a file is completely received. It is + supposed to try and remember the reception, in case the connection + is lost. It is passed the system, the file name to receive to, and + the temporary file name from the sending system. It should return + FALSE on error. */ +extern boolean fsysdep_remember_reception P((const struct uuconf_system *qsys, + const char *zto, + const char *ztemp)); + +/* This function is called to see if a file has already been received + successfully. It gets the same arguments as + fsysdep_remember_reception. It should return TRUE if the file was + already received, FALSE otherwise. There is no way to report + error. */ +extern boolean fsysdep_already_received P((const struct uuconf_system *qsys, + const char *zto, + const char *ztemp)); + +/* This function is called when it is no longer necessary to remember + that a file has been received. This will be called when the + protocol knows that the receive message has been acknowledged. It + gets the same arguments as fsysdep_remember_reception. it should + return FALSE on error. */ +extern boolean fsysdep_forget_reception P((const struct uuconf_system *qsys, + const char *zto, + const char *ztemp)); + +/* Start expanding a wildcarded file name. This should return FALSE + on error; otherwise subsequent calls to zsysdep_wildcard should + return file names. */ +extern boolean fsysdep_wildcard_start P((const char *zfile)); + +/* Get the next wildcard name. This should return NULL when there are + no more names to return. The return value should be freed using + ubuffree. The argument should be the same as that to + fsysdep_wildcard_start. There is no way to return error. */ +extern char *zsysdep_wildcard P((const char *zfile)); + +/* Finish getting wildcard names. This may be called before or after + zsysdep_wildcard has returned NULL. It should return FALSE on + error. */ +extern boolean fsysdep_wildcard_end P((void)); + +/* Prepare to execute a bunch of file transfer requests. This should + make an entry in the spool directory so that the next time uucico + is started up it will transfer these files. The bgrade argument + specifies the grade of the commands. The commands themselves are + in the pascmds array, which has ccmds entries. The function should + return NULL on error, or the jobid on success. The jobid is a + string that may be printed or passed to fsysdep_kill_job and + related functions, but is otherwise uninterpreted. */ +extern char *zsysdep_spool_commands P((const struct uuconf_system *qsys, + int bgrade, int ccmds, + const struct scmd *pascmds)); + +/* Get a file name to use for a data file to be copied to another + system. The ztname, zdname and zxname arguments will all either be + NULL or point to an array of CFILE_NAME_LEN characters in length. + The ztname array should be set to a temporary file name that could + be passed to zsysdep_spool_file_name to retrieve the return value + of this function; this will be appropriate for the temporary name + in a send request. The zdname array should be set to a data file + name that is appropriate for the spool directory of the other + system; this will be appropriate for the name of the destination + file in a send request of a data file for an execution of some + sort. The zxname array should be set to an execute file name that + is appropriate for the other system. The zlocalname argument is + the name of the local system as seen by the remote system, the + bgrade argument is the grade, and fxqt is TRUE if this file is + going to become an execution file. This should return NULL on + error. */ +#define CFILE_NAME_LEN (15) + +extern char *zsysdep_data_file_name P((const struct uuconf_system *qsys, + const char *zlocalname, + int bgrade, boolean fxqt, + char *ztname, char *zdname, + char *zxname)); + +/* Get a name for a local execute file. This is used by uux for a + local command with remote files. Returns NULL on error. */ +extern char *zsysdep_xqt_file_name P((void)); + +/* Beginning getting execute files. To get a list of execute files, + first fsysdep_get_xqt_init is called, then zsysdep_get_xqt is + called several times until it returns NULL, then finally + usysdep_get_xqt_free is called. */ +extern boolean fsysdep_get_xqt_init P((void)); + +/* Get the next execute file. This should return NULL when finished + (with *pferr set to FALSE). On an error this should return NULL + with *pferr set to TRUE. This should set *pzsystem to the name of + the system for which the execute file was created. Both the return + value and *pzsystem should be freed using ubuffree. */ +extern char *zsysdep_get_xqt P((char **pzsystem, + boolean *pferr)); + +/* Clean up after getting execute files. */ +extern void usysdep_get_xqt_free P((void)); + +/* Get the absolute pathname of a command to execute. This is given + the legal list of commands (which may be the special case "ALL") + and the path. It must return an absolute pathname to the command. + If it gets an error it should set *pferr to TRUE and return NULL; + if the command is not found it should set *pferr to FALSE and + return NULL. */ +extern char *zsysdep_find_command P((const char *zcmd, char **pzcmds, + char **pzpath, boolean *pferr)); + +/* Expand file names for uuxqt. This exists because uuxqt on Unix has + to expand file names which begin with a ~. It does not want to + expand any other type of file name, and it turns a double ~ into a + single one without expanding. If this returns NULL, the file does + not need to be changed; otherwise it returns a zbufalc'ed string. + There is no way to report error. */ +extern char *zsysdep_xqt_local_file P((const struct uuconf_system *qsys, + const char *zfile)); + +#if ! ALLOW_FILENAME_ARGUMENTS +/* Check an argument to an execution command to make sure that it + doesn't refer to a file name that may not be accessed. This should + check the argument to see if it is a filename. If it is, it should + either reject it out of hand or it should call fin_directory_list + on the file with both qsys->zremote_receive and qsys->zremote_send. + If the file is rejected, it should log an error and return FALSE. + Otherwise it should return TRUE. */ +extern boolean fsysdep_xqt_check_file P((const struct uuconf_system *qsys, + const char *zfile)); +#endif /* ! ALLOW_FILENAME_ARGUMENTS */ + +/* Run an execute file. The arguments are: + + qsys -- system for which execute file was created + zuser -- user who requested execution + pazargs -- list of arguments to command (element 0 is command) + zfullcmd -- command and arguments stuck together in one string + zinput -- file name for standard input (may be NULL) + zoutput -- file name for standard output (may be NULL) + fshell -- if TRUE, use /bin/sh to execute file + ilock -- return value of ixsysdep_lock_uuxqt + pzerror -- set to name of standard error file + pftemp -- set to TRUE if error is temporary, FALSE otherwise + + If fshell is TRUE, the command should be executed with /bin/sh + (obviously, this can only really be done on Unix systems). If an + error occurs this should return FALSE and set *pftemp + appropriately. *pzerror should be freed using ubuffree. */ +extern boolean fsysdep_execute P((const struct uuconf_system *qsys, + const char *zuser, + const char **pazargs, + const char *zfullcmd, + const char *zinput, + const char *zoutput, + boolean fshell, + int ilock, + char **pzerror, + boolean *pftemp)); + +/* Lock for uuxqt execution. If the cmaxuuxqts argument is not zero, + this should make sure that no more than cmaxuuxqts uuxqt processes + are running at once. Also, only one uuxqt may execute a particular + command (specified by the -c option) at a time. If zcmd is not + NULL, it is a command that must be locked. This should return a + nonnegative number which will be passed to other routines, + including fsysdep_unlock_uuxqt, or -1 on error. */ +extern int ixsysdep_lock_uuxqt P((const char *zcmd, + int cmaxuuxqts)); + +/* Unlock a uuxqt process. This is passed the return value of + ixsysdep_lock_uuxqt, as well as the arguments passed to + ixsysdep_lock_uuxqt. It may return FALSE on error, but at present + the return value is ignored. */ +extern boolean fsysdep_unlock_uuxqt P((int iseq, const char *zcmd, + int cmaxuuxqts)); + +/* See whether a particular uuxqt command is locked. This should + return TRUE if the command is locked (because ixsysdep_lock_uuxqt + was called with it as an argument), FALSE otherwise. There is no + way to return error. */ +extern boolean fsysdep_uuxqt_locked P((const char *zcmd)); + +/* Lock an execute file in order to execute it. This should return + FALSE if the execute file is already locked. There is no way to + return error. */ +extern boolean fsysdep_lock_uuxqt_file P((const char *zfile)); + +/* Unlock an execute file. This should return FALSE on error. */ +extern boolean fsysdep_unlock_uuxqt_file P((const char *zfile)); + +/* Lock the execution directory. The ilock argument is the return + value of ixsysdep_lock_uuxqt. This should return FALSE if the + directory is already locked. There is no way to return error. */ +extern boolean fsysdep_lock_uuxqt_dir P((int ilock)); + +/* Remove all files in the execution directory, and unlock it. This + should return FALSE on error. */ +extern boolean fsysdep_unlock_uuxqt_dir P((int ilock)); + +/* Move files into or out of the execution directory. The code will + already have checked that all the files exist. The elements in the + pzfrom array will be complete filenames, and the elements in the + pzto array will be either NULL (in which case the file should not + be moved) or simple base names. If fto is TRUE, the files in + pzfrom should be moved to pzto; otherwise, the files in pzto should + be moved to pzfrom (this is used if a temporary failure occurs, in + which case the execution will be retried later). If pzinput and + *pzinput are not NULL, then it is the name of the standard input + file; if it is the same as any element of pzfrom, then *pzinput + should be set to the zbufcpy of the corresponding pzto value, if + any. */ +extern boolean fsysdep_move_uuxqt_files P((int cfiles, + const char *const *pzfrom, + const char *const *pzto, + boolean fto, int ilock, + char **pzinput)); + +/* Expand a file name on the local system, defaulting to the current + directory. This is just like zsysdep_local_file, except that + relative files are placed in the working directory the program + 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)); + +/* Add the working directory to a file name. The named file is + actually on a remote system. If the file already has a directory, + it should not be changed. This should return NULL on error. */ +extern char *zsysdep_add_cwd P((const char *zfile)); + +/* See whether a file name will need the current working directory + when zsysdep_local_file_cwd or zsysdep_add_cwd is called on it. + This will be called before usysdep_initialize. It should just + check whether the argument is an absolute path. See the comment + above usysdep_initialize in this file for an explanation of why + things are done this way. */ +extern boolean fsysdep_needs_cwd P((const char *zfile)); + +/* Get the base name of a file. The file will be a local file name, + and this function should return the base file name, ideally in a + form which will make sense on most systems; it will be used if the + destination of a uucp is a directory. */ +extern char *zsysdep_base_name P((const char *zfile)); + +/* Return a filename within a directory. */ +extern char *zsysdep_in_dir P((const char *zdir, const char *zfile)); + +/* Get the mode of a file. This should return a Unix style file mode. + It should return 0 on error. */ +extern unsigned int ixsysdep_file_mode P((const char *zfile)); + +/* See whether the user has access to a file. This is called by uucp + and uux to prevent copying of a file which uucp can read but the + user cannot. If access is denied, this should log an error message + and return FALSE. */ +extern boolean fsysdep_access P((const char *zfile)); + +/* See whether the daemon has access to a file. This is called by + uucp and uux when a file is queued up for transfer without being + copied into the spool directory. It is merely an early error + check, as the daemon would of course discover the error itself when + it tried the transfer. If access would be denied, this should log + an error message and return FALSE. */ +extern boolean fsysdep_daemon_access P((const char *zfile)); + +/* Translate a destination from system!user to a place in the public + directory where uupick will get the file. On Unix this produces + system!~/receive/user/localname, and that's probably what it has to + produce on any other system as well. Returns NULL on a usage + error, or otherwise returns string allocated by zbufcpy. */ +extern char *zsysdep_uuto P((const char *zdest, + const char *zlocalname)); + +/* Return TRUE if a pathname exists and is a directory. */ +extern boolean fsysdep_directory P((const char *zpath)); + +/* Walk a directory tree. The zdir argument is the directory to walk. + The pufn argument is a function to call on each regular file in the + tree. The first argument to pufn should be the full filename; the + second argument to pufn should be the filename relative to zdir; + the third argument to pufn should be the pinfo argument to + usysdep_walk_tree. The usysdep_walk_tree function should return + FALSE on error. */ +extern boolean usysdep_walk_tree P((const char *zdir, + void (*pufn) P((const char *zfull, + const char *zrelative, + pointer pinfo)), + pointer pinfo)); + +/* Return the jobid of a work file, given the sequence value. On + error this should log an error and return NULL. The jobid is a + string which may be printed out and read in and passed to + fsysdep_kill_job, etc., but is not otherwise interpreted. */ +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. */ +extern boolean fsysdep_privileged P((void)); + +/* Kill a job, given the jobid. This should remove all associated + files and in general eliminate the job completely. On error it + should log an error message and return FALSE. */ +extern boolean fsysdep_kill_job P((pointer puuconf, + const char *zjobid)); + +/* Rejuvenate a job, given the jobid. If possible, this should update + the time associated with the job such that it will not be + eliminated by uustat -K or similar programs that check the creation + time. This should affect the return value of ixsysdep_work_time. + On error it should log an error message and return FALSE. */ +extern boolean fsysdep_rejuvenate_job P((pointer puuconf, + const char *zjobid)); + +/* Get the time a job was queued, given the sequence number. There is + no way to indicate error. The return value must use the same epoch + as ixsysdep_time. */ +extern long ixsysdep_work_time P((const struct uuconf_system *qsys, + pointer pseq)); + +/* Get the time a file was created. This is called by uustat on + execution files. There is no way to indicate error. The return + value must use the same epoch as ixsysdep_time. */ +extern long ixsysdep_file_time 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. */ +extern long csysdep_size P((const char *zfile)); + +/* Return the amount of free space on the containing the given file + name (the file may or may not exist). If the amount of free space + cannot be determined, the function should return -1. */ +extern long csysdep_bytes_free P((const char *zfile)); + +/* Start getting status information for all systems with available + status information. There may be status information for unknown + systems, which is why this series of functions is used. The phold + argument is used to pass information around, to possibly avoid the + use of static variables. On error this should log an error and + return FALSE. */ +extern boolean fsysdep_all_status_init P((pointer *phold)); + +/* Get status information for the next system. This should return the + system name and fill in the qstat argument. The phold argument + will be that set by fsysdep_all_status_init. On error this should + log an error, set *pferr to TRUE, and return NULL. */ +extern char *zsysdep_all_status P((pointer phold, boolean *pferr, + struct sstatus *qstat)); + +/* Free up anything allocated by fsysdep_all_status_init and + zsysdep_all_status. The phold argument is that set by + fsysdep_all_status_init. */ +extern void usysdep_all_status_free P((pointer phold)); + +/* Display the process status of all processes holding lock files. + This is uustat -p. The return value is passed to usysdep_exit. */ +extern boolean fsysdep_lock_status P((void)); + +/* Return TRUE if the user has legitimate access to the port. This is + used by cu to control whether the user can open a port directly, + rather than merely being able to dial out on it. Opening a port + directly allows the modem to be reprogrammed. */ +extern boolean fsysdep_port_access P((struct uuconf_port *qport)); + +/* Return whether the given port could be named by the given line. On + Unix, the line argument would be something like "ttyd0", and this + function should return TRUE if the named port is "/dev/ttyd0". */ +extern boolean fsysdep_port_is_line P((struct uuconf_port *qport, + const char *zline)); + +/* Set the terminal into raw mode. In this mode no input characters + should be treated specially, and characters should be made + available as they are typed. The original terminal mode should be + saved, so that it can be restored by fsysdep_terminal_restore. If + flocalecho is TRUE, then local echoing should still be done; + otherwise echoing should be disabled. This function returns FALSE + on error. */ +extern boolean fsysdep_terminal_raw P((boolean flocalecho)); + +/* Restore the terminal back to the original setting, before + fsysdep_terminal_raw was called. Returns FALSE on error. */ +extern boolean fsysdep_terminal_restore P((void)); + +/* Read a line from the terminal. The fsysdep_terminal_raw function + will have been called. This should print the zprompt argument + (unless it is NULL) and return the line, allocated by zbufcpy, or + NULL on error. */ +extern char *zsysdep_terminal_line P((const char *zprompt)); + +/* Write a line to the terminal, ending with a newline. This is + basically just puts (zline, stdout), except that the terminal will + be in raw mode, so on ASCII Unix systems the line needs to end with + \r\n. */ +extern boolean fsysdep_terminal_puts P((const char *zline)); + +/* If faccept is TRUE, permit the user to generate signals from the + terminal. If faccept is FALSE, turn signals off again. After + fsysdep_terminal_raw is called, signals should be off. Return + FALSE on error. */ +extern boolean fsysdep_terminal_signals P((boolean faccept)); + +/* The cu program expects the system dependent code to handle the + details of copying data from the communications port to the + terminal. This should be set up by fsysdep_cu_init, and done while + fsysdep_cu is called. It is permissible to do it on a continual + basis (on Unix a subprocess handles it) so long as the copying can + be stopped by the fsysdep_cu_copy function. + + The fsysdep_cu_init function does any system dependent + initialization needed for this. */ +extern boolean fsysdep_cu_init P((struct sconnection *qconn)); + +/* Copy all data from the communications port to the terminal, and all + data from the terminal to the communications port. Keep this up + until the escape character *zCuvar_escape is seen. Set *pbcmd to + the character following the escape character; after the escape + character, zlocalname should be printed, possibly after a delay. + If two escape characters are entered in sequence, this function + should send a single escape character to the port, and not return. + Returns FALSE on error. */ +extern boolean fsysdep_cu P((struct sconnection *qconn, + char *pbcmd, + const char *zlocalname)); + +/* If fcopy is TRUE, start copying data from the communications port + to the terminal. If fcopy is FALSE, stop copying data. This + function may be called several times during a cu session. It + should return FALSE on error. */ +extern boolean fsysdep_cu_copy P((boolean fcopy)); + +/* Stop copying data from the communications port to the terminal, and + generally clean up after fsysdep_cu_init and fsysdep_cu. Returns + FALSE on error. */ +extern boolean fsysdep_cu_finish P((void)); + +/* Run a shell command. If zcmd is NULL, or *zcmd == '\0', just + start up a shell. The second argument is one of the following + values. This should return FALSE on error. */ +enum tshell_cmd +{ + /* Attach stdin and stdout to the terminal. */ + SHELL_NORMAL, + /* Attach stdout to the communications port, stdin to the terminal. */ + SHELL_STDOUT_TO_PORT, + /* Attach stdin to the communications port, stdout to the terminal. */ + SHELL_STDIN_FROM_PORT, + /* Attach both stdin and stdout to the communications port. */ + SHELL_STDIO_ON_PORT +}; + +extern boolean fsysdep_shell P((struct sconnection *qconn, + const char *zcmd, + enum tshell_cmd tcmd)); + +/* Change directory. If zdir is NULL, or *zdir == '\0', change to the + user's home directory. Return FALSE on error. */ +extern boolean fsysdep_chdir P((const char *zdir)); + +/* Suspend the current process. This is only expected to work on Unix + versions that support SIGTSTP. In general, people can just shell + out. */ +extern boolean fsysdep_suspend P((void)); + +/* Start getting files for uupick. The zsystem argument may be NULL + to get files from all systems, or it may specify a particular + system. The zpubdir argument is the public directory to use. This + returns FALSE on error. */ +extern boolean fsysdep_uupick_init P((const char *zsystem, + const char *zpubdir)); + +/* Get the next file for uupick. This returns the basic file name. + It sets *pzfull to the full name, and *pzfrom to the name of the + system which sent this file over; both should be freed using + ubuffree. *pzfull should be passed to ubuffree after it is no + longer needed. The zsystem and zpubdir arguments should be the + same as the arguments to fsysdep_uupick_init. This returns NULL + when all files been returned. */ +extern char *zsysdep_uupick P((const char *zsystem, const char *zpubdir, + char **pzfrom, char **pzfull)); + +/* Clean up after getting files for uupick. */ +extern boolean fsysdep_uupick_free P((const char *zsystem, + const char *zpubdir)); + +/* Translate a local file name for uupick. On Unix this is just like + 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)); + +/* Remove a directory and all the files in it. */ +extern boolean fsysdep_rmdir P((const char *zdir)); + +#endif /* ! defined (SYSTEM_H) */ diff --git a/gnu/libexec/uucp/common_sources/tcp.c b/gnu/libexec/uucp/common_sources/tcp.c new file mode 100644 index 000000000000..543e9f0d8205 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/tcp.c @@ -0,0 +1,470 @@ +/* tcp.c + Code to handle TCP connections. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#if HAVE_TCP + +#include "uudefs.h" +#include "uuconf.h" +#include "sysdep.h" +#include "conn.h" +#include "system.h" + +#include <errno.h> + +#if HAVE_SYS_TYPES_TCP_H +#include <sys/types.tcp.h> +#endif +#include <sys/socket.h> +#include <netdb.h> +#include <netinet/in.h> + +#if HAVE_FCNTL_H +#include <fcntl.h> +#else +#if HAVE_SYS_FILE_H +#include <sys/file.h> +#endif +#endif + +#ifndef FD_CLOEXEC +#define FD_CLOEXEC 1 +#endif + +/* This code handles TCP connections. It assumes a Berkeley socket + interface. */ + +/* The normal "uucp" port number. */ +#define IUUCP_PORT (540) + +/* Local functions. */ +static void utcp_free P((struct sconnection *qconn)); +static boolean ftcp_open P((struct sconnection *qconn, long ibaud, + boolean fwait)); +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, + struct uuconf_dialer *qdialer, + enum tdialerfound *ptdialer)); +static int itcp_port_number P((const char *zport)); + +/* The command table for a TCP connection. */ +static const struct sconncmds stcpcmds = +{ + utcp_free, + NULL, /* pflock */ + NULL, /* pfunlock */ + ftcp_open, + ftcp_close, + ftcp_reset, + ftcp_dial, + fsysdep_conn_read, + fsysdep_conn_write, + fsysdep_conn_io, + NULL, /* pfbreak */ + NULL, /* pfset */ + NULL, /* pfcarrier */ + fsysdep_conn_chat, + NULL /* pibaud */ +}; + +/* Initialize a TCP connection. */ + +boolean +fsysdep_tcp_init (qconn) + struct sconnection *qconn; +{ + struct ssysdep_conn *q; + + q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn)); + q->o = -1; + q->zdevice = NULL; + q->iflags = -1; + q->istdout_flags = -1; + q->fterminal = FALSE; + q->ftli = FALSE; + q->ibaud = 0; + + qconn->psysdep = (pointer) q; + qconn->qcmds = &stcpcmds; + return TRUE; +} + +/* Free a TCP connection. */ + +static void +utcp_free (qconn) + struct sconnection *qconn; +{ + xfree (qconn->psysdep); +} + +/* Open a TCP connection. If the fwait argument is TRUE, we are + running as a server. Otherwise we are just trying to reach another + system. */ + +static boolean +ftcp_open (qconn, ibaud, fwait) + struct sconnection *qconn; + long ibaud; + boolean fwait; +{ + struct ssysdep_conn *qsysdep; + struct sockaddr_in s; + const char *zport; + uid_t iuid, ieuid; + + ulog_device ("TCP"); + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + + qsysdep->o = socket (AF_INET, SOCK_STREAM, 0); + if (qsysdep->o < 0) + { + ulog (LOG_ERROR, "socket: %s", strerror (errno)); + return FALSE; + } + + if (fcntl (qsysdep->o, F_SETFD, + fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0) + { + ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno)); + (void) close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } + + qsysdep->iflags = fcntl (qsysdep->o, F_GETFL, 0); + if (qsysdep->iflags < 0) + { + ulog (LOG_ERROR, "fcntl: %s", strerror (errno)); + (void) close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } + + /* If we aren't waiting for a connection, we're done. */ + if (! fwait) + return TRUE; + + /* Run as a server and wait for a new connection. The code in + uucico.c has already detached us from our controlling terminal. + From this point on if the server gets an error we exit; we only + return if we have received a connection. It would be more robust + to respawn the server if it fails; someday. */ + bzero ((pointer) &s, sizeof s); + s.sin_family = AF_INET; + zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport; + s.sin_port = itcp_port_number (zport); + s.sin_addr.s_addr = htonl (INADDR_ANY); + + /* Swap to our real user ID when doing the bind call. This will + permit the server to use privileged TCP ports when invoked by + root. We only swap if our effective user ID is not root, so that + the program can also be made suid root in order to get privileged + ports when invoked by anybody. */ + iuid = getuid (); + ieuid = geteuid (); + if (ieuid != 0) + { +#if HAVE_SETREUID + /* Swap the effective user id and the real user id. We can then + swap them back again when we want to return to the uucp + user's permissions. */ + if (setreuid (ieuid, iuid) < 0) + { + ulog (LOG_ERROR, "setreuid (%ld, %ld): %s", + (long) ieuid, (long) iuid, strerror (errno)); + (void) close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } +#else /* ! HAVE_SETREUID */ +#if HAVE_SAVED_SETUID + /* Set the effective user id to the real user id. Since the + effective user id is the saved setuid we will able to set + back to it later. If the real user id is root we will not be + able to switch back and forth, but that doesn't matter since + we only want to switch once. */ + if (setuid (iuid) < 0) + { + ulog (LOG_ERROR, "setuid (%ld): %s", (long) iuid, + strerror (errno)); + (void) close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } +#else /* ! HAVE_SAVED_SETUID */ + /* There's no way to switch between real permissions and + effective permissions. Just try the bind with the uucp + permissions. */ +#endif /* ! HAVE_SAVED_SETUID */ +#endif /* ! HAVE_SETREUID */ + } + + if (bind (qsysdep->o, (struct sockaddr *) &s, sizeof s) < 0) + ulog (LOG_FATAL, "bind: %s", strerror (errno)); + + /* Now swap back to the uucp user ID. */ + if (ieuid != 0) + { +#if HAVE_SETREUID + if (setreuid (iuid, ieuid) < 0) + { + ulog (LOG_ERROR, "setreuid (%ld, %ld): %s", + (long) iuid, (long) ieuid, strerror (errno)); + (void) close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } +#else /* ! HAVE_SETREUID */ +#if HAVE_SAVED_SETUID + /* Set ourselves back to our original effective user id. */ + if (setuid ((uid_t) ieuid) < 0) + { + ulog (LOG_ERROR, "setuid (%ld): %s", (long) ieuid, + strerror (errno)); + (void) close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } +#else /* ! HAVE_SAVED_SETUID */ + /* We didn't switch, no need to switch back. */ +#endif /* ! HAVE_SAVED_SETUID */ +#endif /* ! HAVE_SETREUID */ + } + + if (listen (qsysdep->o, 5) < 0) + ulog (LOG_FATAL, "listen: %s", strerror (errno)); + + while (! FGOT_SIGNAL ()) + { + size_t clen; + int onew; + pid_t ipid; + + DEBUG_MESSAGE0 (DEBUG_PORT, + "ftcp_open: Waiting for connections"); + + clen = sizeof s; + onew = accept (qsysdep->o, (struct sockaddr *) &s, &clen); + if (onew < 0) + ulog (LOG_FATAL, "accept: %s", strerror (errno)); + + DEBUG_MESSAGE0 (DEBUG_PORT, + "ftcp_open: Got connection; forking"); + + ipid = ixsfork (); + if (ipid < 0) + ulog (LOG_FATAL, "fork: %s", strerror (errno)); + if (ipid == 0) + { + (void) close (qsysdep->o); + qsysdep->o = onew; + + /* Now we fork and let our parent die, so that we become + a child of init. This lets the main server code wait + for its child and then continue without accumulating + zombie children. */ + ipid = ixsfork (); + if (ipid < 0) + { + ulog (LOG_ERROR, "fork: %s", strerror (errno)); + _exit (EXIT_FAILURE); + } + + if (ipid != 0) + _exit (EXIT_SUCCESS); + + ulog_id (getpid ()); + + return TRUE; + } + + (void) close (onew); + + /* Now wait for the child. */ + (void) ixswait ((unsigned long) ipid, (const char *) NULL); + } + + /* We got a signal. */ + usysdep_exit (FALSE); + + /* Avoid compiler warnings. */ + return FALSE; +} + +/* Close the port. */ + +/*ARGSUSED*/ +static boolean +ftcp_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; + if (qsysdep->o >= 0 && close (qsysdep->o) < 0) + { + ulog (LOG_ERROR, "close: %s", strerror (errno)); + 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; +} + +/* Dial out on a TCP port, so to speak: connect to a remote computer. */ + +/*ARGSUSED*/ +static boolean +ftcp_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 *qsysdep; + const char *zhost; + struct hostent *q; + struct sockaddr_in s; + const char *zport; + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + + *ptdialer = DIALERFOUND_FALSE; + + zhost = zphone; + if (zhost == NULL) + { + if (qsys == NULL) + { + ulog (LOG_ERROR, "No address for TCP connection"); + return FALSE; + } + zhost = qsys->uuconf_zname; + } + + errno = 0; + q = gethostbyname ((char *) zhost); + if (q == NULL) + { + if (errno == 0) + ulog (LOG_ERROR, "%s: unknown host name", zhost); + else + ulog (LOG_ERROR, "gethostbyname (%s): %s", zhost, strerror (errno)); + return FALSE; + } + + s.sin_family = q->h_addrtype; + 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) + { + ulog (LOG_ERROR, "connect: %s", strerror (errno)); + return FALSE; + } + + return TRUE; +} + +/* Get the port number given a name. The argument will almost always + be "uucp" so we cache that value. The return value is always in + network byte order. This returns -1 on error. */ + +static int +itcp_port_number (zname) + const char *zname; +{ + boolean fuucp; + static int iuucp; + int i; + char *zend; + struct servent *q; + + fuucp = strcmp (zname, "uucp") == 0; + if (fuucp && iuucp != 0) + return iuucp; + + /* Try it as a number first. */ + i = strtol ((char *) zname, &zend, 10); + if (i != 0 && *zend == '\0') + return htons (i); + + q = getservbyname ((char *) zname, (char *) "tcp"); + if (q == NULL) + { + /* We know that the "uucp" service should be 540, even if isn't + in /etc/services. */ + if (fuucp) + { + iuucp = htons (IUUCP_PORT); + return iuucp; + } + ulog (LOG_ERROR, "getservbyname (%s): %s", zname, strerror (errno)); + return -1; + } + + if (fuucp) + iuucp = q->s_port; + + return q->s_port; +} + +#endif /* HAVE_TCP */ diff --git a/gnu/libexec/uucp/common_sources/tli.c b/gnu/libexec/uucp/common_sources/tli.c new file mode 100644 index 000000000000..9fffdcdfebd1 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/tli.c @@ -0,0 +1,644 @@ +/* tli.c + Code to handle TLI connections. + + Copyright (C) 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#if HAVE_TLI + +#include "sysdep.h" +#include "uudefs.h" +#include "uuconf.h" +#include "conn.h" +#include "system.h" + +#include <errno.h> + +#if HAVE_SYS_IOCTL_H +#include <sys/ioctl.h> +#endif + +#if HAVE_TIUSER_H +#include <tiuser.h> +#else +#if HAVE_XTI_H +#include <xti.h> +#else +#if HAVE_SYS_TLI_H +#include <sys/tli.h> +#endif +#endif +#endif + +#if HAVE_STROPTS_H +#include <stropts.h> +#endif + +#if HAVE_FCNTL_H +#include <fcntl.h> +#else +#if HAVE_SYS_FILE_H +#include <sys/file.h> +#endif +#endif + +#ifndef O_RDONLY +#define O_RDONLY 0 +#define O_WRONLY 1 +#define O_RDWR 2 +#endif + +#ifndef FD_CLOEXEC +#define FD_CLOEXEC 1 +#endif + +/* The arguments to t_alloca have two different names. I want the + SVID ones, not the XPG3 ones. */ +#ifndef T_BIND +#define T_BIND T_BIND_STR +#endif +#ifndef T_CALL +#define T_CALL T_CALL_STR +#endif + +/* Hopefully these externs will not cause any trouble. This is how + they are shown in the SVID. */ +extern int t_errno; +extern char *t_errlist[]; +extern int t_nerr; + +#ifndef t_alloc +extern pointer t_alloc (); +#endif + +/* This code handles TLI connections. It's Unix specific. It's + largely based on code from Unix Network Programming, by W. Richard + Stevens. */ + +/* Local functions. */ +static const char *ztlierror P((void)); +static void utli_free P((struct sconnection *qconn)); +static boolean ftli_push P((struct sconnection *qconn)); +static boolean ftli_open P((struct sconnection *qconn, long ibaud, + boolean fwait)); +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, + struct uuconf_dialer *qdialer, + enum tdialerfound *ptdialer)); + +/* The command table for a TLI connection. */ +static const struct sconncmds stlicmds = +{ + utli_free, + NULL, /* pflock */ + NULL, /* pfunlock */ + ftli_open, + ftli_close, + ftli_reset, + ftli_dial, + fsysdep_conn_read, + fsysdep_conn_write, + fsysdep_conn_io, + NULL, /* pfbreak */ + NULL, /* pfset */ + NULL, /* pfcarrier */ + fsysdep_conn_chat, + NULL /* pibaud */ +}; + +/* Get a TLI error string. */ + +static const char * +ztlierror () +{ + if (t_errno == TSYSERR) + return strerror (errno); + if (t_errno < 0 || t_errno >= t_nerr) + return "Unknown TLI error"; + return t_errlist[t_errno]; +} + +/* Initialize a TLI connection. */ + +boolean +fsysdep_tli_init (qconn) + struct sconnection *qconn; +{ + struct ssysdep_conn *q; + + q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn)); + q->o = -1; + q->zdevice = NULL; + q->iflags = -1; + q->istdout_flags = -1; + q->fterminal = FALSE; + q->ftli = TRUE; + q->ibaud = 0; + + qconn->psysdep = (pointer) q; + qconn->qcmds = &stlicmds; + return TRUE; +} + +/* Free a TLI connection. */ + +static void +utli_free (qconn) + struct sconnection *qconn; +{ + xfree (qconn->psysdep); +} + +/* Push all desired modules onto a TLI stream. If the user requests a + STREAMS connection without giving a list of modules, we just push + tirdwr. If the I_PUSH ioctl is not defined on this system, we just + ignore any list of modules. */ + +static boolean +ftli_push (qconn) + struct sconnection *qconn; +{ +#ifdef I_PUSH + + struct ssysdep_conn *qsysdep; + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + + if (qconn->qport->uuconf_u.uuconf_stli.uuconf_pzpush != NULL) + { + char **pz; + + for (pz = qconn->qport->uuconf_u.uuconf_stli.uuconf_pzpush; + *pz != NULL; + pz++) + { + if (ioctl (qsysdep->o, I_PUSH, *pz) < 0) + { + ulog (LOG_ERROR, "ioctl (I_PUSH, %s): %s", *pz, + strerror (errno)); + return FALSE; + } + } + } + else if (qconn->qport->uuconf_u.uuconf_stli.uuconf_fstream) + { + if (ioctl (qsysdep->o, I_PUSH, "tirdwr") < 0) + { + ulog (LOG_ERROR, "ioctl (I_PUSH, tirdwr): %s", + strerror (errno)); + return FALSE; + } + } + + /* If we have just put the connection into stream mode, we must turn + off the TLI flag to avoid using TLI calls on it. */ + if (qconn->qport->uuconf_u.uuconf_stli.uuconf_fstream) + qsysdep->ftli = FALSE; + +#endif /* defined (I_PUSH) */ + + return TRUE; +} + +/* Open a TLI connection. If the fwait argument is TRUE, we are + running as a server. Otherwise we are just trying to reach another + system. */ + +static boolean +ftli_open (qconn, ibaud, fwait) + struct sconnection *qconn; + long ibaud; + boolean fwait; +{ + struct ssysdep_conn *qsysdep; + const char *zdevice; + char *zfreedev; + const char *zservaddr; + char *zfreeaddr; + struct t_bind *qtbind; + struct t_call *qtcall; + + /* Unlike most other device types, we don't bother to call + ulog_device here, because fconn_open calls it with the name of + the port anyhow. */ + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + + zdevice = qconn->qport->uuconf_u.uuconf_stli.uuconf_zdevice; + if (zdevice == NULL) + zdevice = qconn->qport->uuconf_zname; + + zfreedev = NULL; + if (*zdevice != '/') + { + zfreedev = zbufalc (sizeof "/dev/" + strlen (zdevice)); + sprintf (zfreedev, "/dev/%s", zdevice); + zdevice = zfreedev; + } + + qsysdep->o = t_open (zdevice, O_RDWR, (struct t_info *) NULL); + if (qsysdep->o < 0) + { + ulog (LOG_ERROR, "t_open (%s): %s", zdevice, ztlierror ()); + ubuffree (zfreedev); + return FALSE; + } + + if (fcntl (qsysdep->o, F_SETFD, + fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0) + { + ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno)); + ubuffree (zfreedev); + (void) t_close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } + + qsysdep->iflags = fcntl (qsysdep->o, F_GETFL, 0); + if (qsysdep->iflags < 0) + { + ulog (LOG_ERROR, "fcntl: %s", strerror (errno)); + ubuffree (zfreedev); + (void) t_close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } + + /* If we aren't waiting for a connection, we can bind to any local + address, and then we're finished. */ + if (! fwait) + { + ubuffree (zfreedev); + if (t_bind (qsysdep->o, (struct t_bind *) NULL, + (struct t_bind *) NULL) < 0) + { + ulog (LOG_ERROR, "t_bind: %s", ztlierror ()); + (void) t_close (qsysdep->o); + qsysdep->o = -1; + return FALSE; + } + return TRUE; + } + + /* Run as a server and wait for a new connection. The code in + uucico.c has already detached us from our controlling terminal. + From this point on if the server gets an error we exit; we only + return if we have received a connection. It would be more robust + to respawn the server if it fails; someday. */ + qtbind = (struct t_bind *) t_alloc (qsysdep->o, T_BIND, T_ALL); + if (qtbind == NULL) + ulog (LOG_FATAL, "t_alloc (T_BIND): %s", ztlierror ()); + + zservaddr = qconn->qport->uuconf_u.uuconf_stli.uuconf_zservaddr; + if (zservaddr == NULL) + ulog (LOG_FATAL, "Can't run as TLI server; no server address"); + + zfreeaddr = zbufcpy (zservaddr); + qtbind->addr.len = cescape (zfreeaddr); + if (qtbind->addr.len > qtbind->addr.maxlen) + ulog (LOG_FATAL, "%s: TLI server address too long (max %d)", + zservaddr, qtbind->addr.maxlen); + memcpy (qtbind->addr.buf, zfreeaddr, qtbind->addr.len); + ubuffree (zfreeaddr); + + qtbind->qlen = 5; + + if (t_bind (qsysdep->o, qtbind, (struct t_bind *) NULL) < 0) + ulog (LOG_FATAL, "t_bind (%s): %s", zservaddr, ztlierror ()); + + (void) t_free ((pointer) qtbind, T_BIND); + + qtcall = (struct t_call *) t_alloc (qsysdep->o, T_CALL, T_ALL); + if (qtcall == NULL) + ulog (LOG_FATAL, "t_alloc (T_CALL): %s", ztlierror ()); + + while (! FGOT_SIGNAL ()) + { + int onew; + pid_t ipid; + + DEBUG_MESSAGE0 (DEBUG_PORT, + "ftli_open: Waiting for connections"); + + if (t_listen (qsysdep->o, qtcall) < 0) + ulog (LOG_FATAL, "t_listen: %s", ztlierror ()); + + onew = t_open (zdevice, O_RDWR, (struct t_info *) NULL); + if (onew < 0) + ulog (LOG_FATAL, "t_open (%s): %s", zdevice, ztlierror ()); + + if (fcntl (onew, F_SETFD, + fcntl (onew, F_GETFD, 0) | FD_CLOEXEC) < 0) + ulog (LOG_FATAL, "fcntl (FD_CLOEXEC): %s", strerror (errno)); + + if (t_bind (onew, (struct t_bind *) NULL, (struct t_bind *) NULL) < 0) + ulog (LOG_FATAL, "t_bind: %s", ztlierror ()); + + if (t_accept (qsysdep->o, onew, qtcall) < 0) + { + /* We may have received a disconnect. */ + if (t_errno != TLOOK) + ulog (LOG_FATAL, "t_accept: %s", ztlierror ()); + if (t_rcvdis (qsysdep->o, (struct t_discon *) NULL) < 0) + ulog (LOG_FATAL, "t_rcvdis: %s", ztlierror ()); + (void) t_close (onew); + continue; + } + + DEBUG_MESSAGE0 (DEBUG_PORT, + "ftli_open: Got connection; forking"); + + ipid = ixsfork (); + if (ipid < 0) + ulog (LOG_FATAL, "fork: %s", strerror (errno)); + if (ipid == 0) + { + ulog_close (); + + (void) t_close (qsysdep->o); + qsysdep->o = onew; + + /* Push any desired modules. */ + if (! ftli_push (qconn)) + _exit (EXIT_FAILURE); + + /* Now we fork and let our parent die, so that we become + a child of init. This lets the main server code wait + for its child and then continue without accumulating + zombie children. */ + ipid = ixsfork (); + if (ipid < 0) + { + ulog (LOG_ERROR, "fork: %s", strerror (errno)); + _exit (EXIT_FAILURE); + } + + if (ipid != 0) + _exit (EXIT_SUCCESS); + + ulog_id (getpid ()); + + return TRUE; + } + + (void) t_close (onew); + + /* Now wait for the child. */ + (void) ixswait ((unsigned long) ipid, (const char *) NULL); + } + + /* We got a signal. */ + usysdep_exit (FALSE); + + /* Avoid compiler warnings. */ + return FALSE; +} + +/* Close the port. */ + +/*ARGSUSED*/ +static boolean +ftli_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; + if (qsysdep->o >= 0) + { + if (qsysdep->ftli) + { + if (t_close (qsysdep->o) < 0) + { + ulog (LOG_ERROR, "t_close: %s", ztlierror ()); + fret = FALSE; + } + } + else + { + if (close (qsysdep->o) < 0) + { + ulog (LOG_ERROR, "close: %s", strerror (errno)); + fret = FALSE; + } + } + + 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]. */ + +/*ARGSUSED*/ +static boolean +ftli_reset (qconn) + struct sconnection *qconn; +{ + afSignal[INDEXSIG_SIGINT] = TRUE; + return TRUE; +} + +/* Dial out on a TLI port, so to speak: connect to a remote computer. */ + +/*ARGSUSED*/ +static boolean +ftli_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; +{ + struct ssysdep_conn *qsysdep; + char **pzdialer; + const char *zaddr; + struct t_call *qtcall; + char *zescape; + + qsysdep = (struct ssysdep_conn *) qconn->psysdep; + + *ptdialerfound = DIALERFOUND_FALSE; + + pzdialer = qconn->qport->uuconf_u.uuconf_stli.uuconf_pzdialer; + if (*pzdialer == NULL) + pzdialer = NULL; + + /* If the first dialer is "TLI" or "TLIS", we use the first token + (pzdialer[1]) as the address to connect to. */ + zaddr = zphone; + if (pzdialer != NULL + && (strcmp (pzdialer[0], "TLI") == 0 + || strcmp (pzdialer[0], "TLIS") == 0)) + { + if (pzdialer[1] == NULL) + ++pzdialer; + else + { + if (strcmp (pzdialer[1], "\\D") != 0 + && strcmp (pzdialer[1], "\\T") != 0) + zaddr = pzdialer[1]; + pzdialer += 2; + } + } + + if (zaddr == NULL) + { + ulog (LOG_ERROR, "No address for TLI connection"); + return FALSE; + } + + qtcall = (struct t_call *) t_alloc (qsysdep->o, T_CALL, T_ADDR); + if (qtcall == NULL) + { + ulog (LOG_ERROR, "t_alloc (T_CALL): %s", ztlierror ()); + return FALSE; + } + + zescape = zbufcpy (zaddr); + qtcall->addr.len = cescape (zescape); + if (qtcall->addr.len > qtcall->addr.maxlen) + { + ulog (LOG_ERROR, "%s: TLI address too long (max %d)", zaddr, + qtcall->addr.maxlen); + ubuffree (zescape); + return FALSE; + } + memcpy (qtcall->addr.buf, zescape, qtcall->addr.len); + ubuffree (zescape); + + if (t_connect (qsysdep->o, qtcall, (struct t_call *) NULL) < 0) + { + if (t_errno != TLOOK) + ulog (LOG_ERROR, "t_connect: %s", ztlierror ()); + else + { + if (t_rcvdis (qsysdep->o, (struct t_discon *) NULL) < 0) + ulog (LOG_ERROR, "t_rcvdis: %s", ztlierror ()); + else + ulog (LOG_ERROR, "Connection refused"); + } + return FALSE; + } + + /* We've connected to the remote. Push any desired modules. */ + 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) + { + 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; + } + } + + return TRUE; +} + +#endif /* HAVE_TLI */ diff --git a/gnu/libexec/uucp/common_sources/trans.h b/gnu/libexec/uucp/common_sources/trans.h new file mode 100644 index 000000000000..79c380ea48d8 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/trans.h @@ -0,0 +1,268 @@ +/* trans.h + Header file for file and command transfer routines. + + Copyright (C) 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +/* The maximum possible number of channels. */ +#define IMAX_CHAN (16) + +/* The ifeatures field of the sdaemon structure is an or of the + following values. These values are sent during the uucico + handshake, and MUST NOT CHANGE. */ + +/* File size negotiation. */ +#define FEATURE_SIZES (01) + +/* File transfer restart. */ +#define FEATURE_RESTART (02) + +/* The E (execute) command. */ +#define FEATURE_EXEC (04) + +/* Version 1.03: requires decimal size in S and R command. Needless + to say, this should not be used by any new programs. */ +#define FEATURE_V103 (010) + +/* SVR4 UUCP: expects dummy string between notify field and size field + in send command. There is probably some meaning to this string, + but I don't know what it is. If I ever find out, this flag will + still be used to indicate it. */ +#define FEATURE_SVR4 (020) + +/* This structure is used to hold information concerning the + communication link established with the remote system. */ + +struct sdaemon +{ + /* Global uuconf pointer. */ + pointer puuconf; + /* Remote system information. */ + const struct uuconf_system *qsys; + /* Local name being used. */ + const char *zlocalname; + /* Connection structure. */ + struct sconnection *qconn; + /* Protocol being used. */ + const struct sprotocol *qproto; + /* The largest file size permitted for a local request. */ + long clocal_size; + /* The largest file size permitted for a remote request. */ + long cremote_size; + /* The largest file size that may ever be transferred. */ + long cmax_ever; + /* The remote system ulimit. */ + long cmax_receive; + /* Features supported by the remote side. */ + int ifeatures; + /* TRUE if we should request the remote side to hang up. */ + boolean frequest_hangup; + /* TRUE if the remote side requested a hangup. */ + boolean fhangup_requested; + /* TRUE if we are hanging up. */ + boolean fhangup; + /* TRUE if the local system is currently the master. */ + boolean fmaster; + /* TRUE if the local system placed the call. */ + boolean fcaller; + /* UUCONF_RELIABLE_* flags for the connection. */ + int ireliable; + /* If fcaller is FALSE, the lowest grade which may be transferred + during this call. */ + char bgrade; +}; + +/* This structure is used to hold a file or command transfer which is + in progress. */ + +struct stransfer +{ + /* Next file transfer in queue. */ + struct stransfer *qnext; + /* Previous file transfer in queue. */ + struct stransfer *qprev; + /* Points to the queue this structure is on. */ + struct stransfer **pqqueue; + /* The function to call to send some data. */ + boolean (*psendfn) P((struct stransfer *qtrans, struct sdaemon *qdaemon)); + /* The function to call when data is received. */ + boolean (*precfn) P((struct stransfer *qtrans, struct sdaemon *qdaemon, + const char *zdata, size_t cdata)); + /* Type specific information. */ + pointer pinfo; + /* TRUE if we are sending the file e (this is used to avoid a call + to psendfn). */ + boolean fsendfile; + /* TRUE if we are receiving the file e (this is used to avoid a call + to precfn). */ + boolean frecfile; + /* The file to read or write. */ + openfile_t e; + /* The position we are at in the file. */ + long ipos; + /* TRUE if we are waiting for a command string. */ + boolean fcmd; + /* The command string we have so far. */ + char *zcmd; + /* The length of the command string we have so far. */ + size_t ccmd; + /* Local destination number. */ + int ilocal; + /* Remote destination number. */ + int iremote; + /* The command. */ + struct scmd s; + /* A message to log when work starts. */ + char *zlog; + /* The process time; imicros can be negative. */ + long isecs; + long imicros; + /* Number of bytes sent or received. */ + long cbytes; +}; + +/* Reasons that a file transfer might fail. */ + +enum tfailure +{ + /* No failure. */ + FAILURE_NONE, + /* No permission for operation. */ + FAILURE_PERM, + /* Can't open necessary file. */ + FAILURE_OPEN, + /* Not enough space to receive file. */ + FAILURE_SIZE, + /* File was received in a previous conversation. */ + FAILURE_RECEIVED +}; + +/* The main loop which talks to the remote system, passing transfer + requests and file back and forth. */ +extern boolean floop P((struct sdaemon *qdaemon)); + +/* Allocate a new transfer structure. */ +extern struct stransfer *qtransalc P((struct scmd *qcmd)); + +/* Free a transfer structure. */ +extern void utransfree P((struct stransfer *qtrans)); + +/* Queue up local requests. If pfany is not NULL, this sets *pfany to + TRUE if there are, in fact, any local requests which can be done at + this point. */ +extern boolean fqueue P((struct sdaemon *qdaemon, boolean *pfany)); + +/* Clear away any queued requests. This may be called more than once + at the end of a call. */ +extern void uclear_queue P((struct sdaemon *qdaemon)); + +/* Queue a new transfer request made by the local system. */ +extern boolean fqueue_local P((struct sdaemon *qdaemon, + struct stransfer *qtrans)); + +/* Queue a new transfer request made by the remote system. */ +extern boolean fqueue_remote P((struct sdaemon *qdaemon, + struct stransfer *qtrans)); + +/* Queue a transfer request which wants to send something. */ +extern boolean fqueue_send P((struct sdaemon *qdaemon, + struct stransfer *qtrans)); + +/* Queue a transfer request which wants to receiving something. */ +extern boolean fqueue_receive P((struct sdaemon *qdaemon, + struct stransfer *qtrans)); + +/* Prepare to send a file by local or remote request. */ +extern boolean flocal_send_file_init P((struct sdaemon *qdaemon, + struct scmd *qcmd)); +extern boolean fremote_send_file_init P((struct sdaemon *qdaemon, + struct scmd *qcmd, + int iremote)); + +/* Prepare to receive a file by local or remote request. */ +extern boolean flocal_rec_file_init P((struct sdaemon *qdaemon, + struct scmd *qcmd)); +extern boolean fremote_rec_file_init P((struct sdaemon *qdaemon, + struct scmd *qcmd, + int iremote)); + +/* Prepare to request work by local or remote request. */ +extern boolean flocal_xcmd_init P((struct sdaemon *qdaemon, + struct scmd *qcmd)); +extern boolean fremote_xcmd_init P((struct sdaemon *qdaemon, + struct scmd *qcmd, + int iremote)); + +/* We have lost the connection; record any in progress file transfers + in the statistics file and discard any temporary files. */ +extern void ufailed P((struct sdaemon *qdaemon)); + +/* Check that there is enough disk space for a file receive. Return + FALSE if there is not. */ +extern boolean frec_check_free P((struct stransfer *qtrans, + long cfree_space)); + +/* Discard the temporary file being used to receive a file, if + appropriate. */ +extern boolean frec_discard_temp P((struct sdaemon *qdaemon, + struct stransfer *qtrans)); + +/* Handle data received by a protocol. This is called by the protocol + specific routines as data comes in. The data is passed as two + buffers because that is convenient for packet based protocols, but + normally csecond will be 0. The ilocal argument is the local + channel number, and the iremote argument is the remote channel + number. Either may be -1, if the protocol does not have channels. + The ipos argument is the position in the file, if the protocol + knows it; for most protocols, this will be -1. The fallacked + argument should be set to TRUE if the remote has acknowledged all + outstanding data; see uwindow_acked, below, for details. This will + set *pfexit to TRUE if there is something for the main loop to do. + A file is complete is when a zero length buffer is passed (cfirst + == 0). A command is complete when data containing a null byte is + passed. This will return FALSE on error. If the protocol pfwait + entry point should exit and let the top level loop continue, + *pfexit will be set to TRUE (if pfexit is not NULL). This will not + set *pfexit to FALSE, so the caller must do that. */ +extern boolean fgot_data P((struct sdaemon *qdaemon, + const char *zfirst, size_t cfirst, + const char *zsecond, size_t csecond, + int ilocal, int iremote, + long ipos, boolean fallacked, + boolean *pfexit)); + +/* This routine is called when an ack is sent for a file receive. */ +extern void usent_receive_ack P((struct sdaemon *qdaemon, + struct stransfer *qtrans)); + +/* A protocol may call this routine to indicate the packets have been + acknowledged by the remote system. If the fallacked argument is + TRUE, then all outstanding packets have been acknowledged; for + convenience, this may also be indicated by passing fallacked as + TRUE to fgot_data, above. Otherwise this routine should be called + each time a complete window is acked by the remote system. The + transfer code uses this information to keep track of when an + acknowledgement of a file receive has been seen by the other side, + so that file receives may be handled cleanly if the connection is + lost. */ +extern void uwindow_acked P((struct sdaemon *qdaemon, + boolean fallacked)); diff --git a/gnu/libexec/uucp/common_sources/util.c b/gnu/libexec/uucp/common_sources/util.c new file mode 100644 index 000000000000..89b3caf1d446 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/util.c @@ -0,0 +1,144 @@ +/* util.c + A couple of UUCP utility functions. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#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 $"; +#endif + +#include <ctype.h> + +#include "uudefs.h" +#include "uuconf.h" +#include "system.h" + +/* Get information for an unknown system. This will leave the name + allocated on the heap. We could fix this by breaking the + abstraction and adding the name to qsys->palloc. It makes sure the + name is not too long, but takes no other useful action. */ + +boolean +funknown_system (puuconf, zsystem, qsys) + pointer puuconf; + const char *zsystem; + struct uuconf_system *qsys; +{ + char *z; + int iuuconf; + + if (strlen (zsystem) <= cSysdep_max_name_len) + z = zbufcpy (zsystem); + else + { + char **pznames, **pz; + boolean ffound; + + z = zbufalc (cSysdep_max_name_len + 1); + memcpy (z, zsystem, cSysdep_max_name_len); + z[cSysdep_max_name_len] = '\0'; + + iuuconf = uuconf_system_names (puuconf, &pznames, TRUE); + if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + + ffound = FALSE; + for (pz = pznames; *pz != NULL; pz++) + { + if (strcmp (*pz, z) == 0) + ffound = TRUE; + xfree ((pointer) *pz); + } + xfree ((pointer) pznames); + + if (ffound) + { + ubuffree (z); + return FALSE; + } + } + + iuuconf = uuconf_system_unknown (puuconf, qsys); + if (iuuconf == UUCONF_NOT_FOUND) + { + ubuffree (z); + return FALSE; + } + else if (iuuconf != UUCONF_SUCCESS) + ulog_uuconf (LOG_FATAL, puuconf, iuuconf); + + for (; qsys != NULL; qsys = qsys->uuconf_qalternate) + qsys->uuconf_zname = z; + + return TRUE; +} + +/* See whether a file is in a directory list, and make sure the user + has appropriate access. */ + +boolean +fin_directory_list (zfile, pzdirs, zpubdir, fcheck, freadable, zuser) + const char *zfile; + char **pzdirs; + const char *zpubdir; + boolean fcheck; + boolean freadable; + const char *zuser; +{ + boolean fmatch; + char **pz; + + fmatch = FALSE; + + for (pz = pzdirs; *pz != NULL; pz++) + { + char *zuse; + + if (pz[0][0] == '!') + { + zuse = zsysdep_local_file (*pz + 1, zpubdir); + if (zuse == NULL) + return FALSE; + + if (fsysdep_in_directory (zfile, zuse, FALSE, + FALSE, (const char *) NULL)) + fmatch = FALSE; + } + else + { + zuse = zsysdep_local_file (*pz, zpubdir); + if (zuse == NULL) + return FALSE; + + if (fsysdep_in_directory (zfile, zuse, fcheck, + freadable, zuser)) + fmatch = TRUE; + } + + ubuffree (zuse); + } + + return fmatch; +} diff --git a/gnu/libexec/uucp/common_sources/uuconf.h b/gnu/libexec/uucp/common_sources/uuconf.h new file mode 100644 index 000000000000..4bf6bccbf3f2 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/uuconf.h @@ -0,0 +1,1496 @@ +/* uuconf.h + Header file for UUCP configuration routines. + + Copyright (C) 1992 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 use of an object file which uses material from this header + file, and from no other portion of the uuconf library, is + unrestricted, as described in paragraph 4 of section 5 of version 2 + of the GNU Library General Public License (this sentence is merely + 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. + */ + +#ifndef UUCONF_H + +#define UUCONF_H + +#include <stdio.h> + +/* The macro UUCONF_ANSI_C may be used to override __STDC__. */ +#ifndef UUCONF_ANSI_C +#ifdef __STDC__ +#define UUCONF_ANSI_C 1 +#else /* ! defined (__STDC__) */ +#define UUCONF_ANSI_C 0 +#endif /* ! defined (__STDC__) */ +#endif /* ! defined (UUCONF_ANSI_C) */ + +#if UUCONF_ANSI_C +#define UUCONF_CONST const +typedef void *UUCONF_POINTER; +#include <stddef.h> +typedef size_t UUCONF_SIZE_T; +#else +#define UUCONF_CONST +typedef char *UUCONF_POINTER; +typedef unsigned int UUCONF_SIZE_T; +#endif + +/* The field names of each of the following structures begin with + "uuconf_". This is to avoid any conflicts with user defined + macros. The first character following the "uuconf_" string + indicates the type of the field. + + z -- a string (char *) + c -- a count (normally int) + i -- an integer value (normally int) + f -- a boolean value (normally int) + b -- a single character value (char or int) + t -- an enum (enum XX) + s -- a structure (struct XX) + u -- a union (union XX) + q -- a pointer to a structure (struct XX *) + p -- a pointer to something other than a string + */ + +/* The information which is kept for a chat script. */ + +struct uuconf_chat +{ + /* The script itself. This is a NULL terminated list of expect/send + pairs. The first string is an expect string. A string starting + with a '-' indicates subsend string; the following strings which + start with '-' are subexpect/subsend strings. This field may be + NULL, in which case there is no chat script (but pzprogram may + hold a program to run). */ + char **uuconf_pzchat; + /* The chat program to run. This is a NULL terminated list of + arguments; element 0 if the program. May be NULL, in which case + there is no program. */ + char **uuconf_pzprogram; + /* The timeout in seconds to use for expect strings in the chat + script. */ + int uuconf_ctimeout; + /* The NULL terminated list of failure strings. If any of these + strings appear, the chat script is aborted. May be NULL, in + which case there are no failure strings. */ + char **uuconf_pzfail; + /* Non-zero if incoming characters should be stripped to seven bits + (by anding with 0x7f). */ + int uuconf_fstrip; +}; + +/* The information which is kept for a time specification. This is a + linked list of structures. Each element of the list represents a + span of time, giving a starting time and an ending time. The time + only depends on the day of the week, not on the day of the month or + of the year. The time is only specified down to the minute, not + down to the second or below. The list is sorted by starting time. + + The starting and ending time are expressed in minutes since the + beginning of the week, which is considered to be 12 midnight on + Sunday. Thus 60 is 1 am on Sunday, 1440 (== 60 * 24) is 12 + midnight on Monday, and the largest possible value is 10080 (== 60 + * 24 * 7) which is 12 midnight on the following Sunday. + + Each span of time has a value associated with it. This is the + lowest grade or the largest file size that may be transferred + during that time, depending on the source of the time span. When + time specifications overlap, the value used for the overlap is the + higher grade or the smaller file size. Thus specifying + ``call-timegrade z Any'' and ``call-timegrade Z Mo'' means that + only grade Z or higher may be sent on Monday, since Z is the higer + grade of the overlapping spans. The final array wil have no + overlaps. + + Each span also has a retry time associated with it. This permits + different retry times to be used at different times of day. The + retry time is only relevant if the span came from a ``time'' or + ``timegrade'' command for a system. */ + +struct uuconf_timespan +{ + /* Next element in list. */ + struct uuconf_timespan *uuconf_qnext; + /* Starting minute (-1 at the end of the array). */ + int uuconf_istart; + /* Ending minute. */ + int uuconf_iend; + /* Value for this span (lowest grade or largest file that may be + transferred at this time). */ + long uuconf_ival; + /* Retry time. */ + int uuconf_cretry; +}; + +/* The information which is kept for protocol parameters. Protocol + parameter information is stored as an array of the following + structures. */ + +struct uuconf_proto_param +{ + /* The name of the protocol to which this entry applies. This is + '\0' for the last element of the array. */ + int uuconf_bproto; + /* Specific entries for this protocol. This points to an array + ending in an element with a uuconf_cargs field of 0. */ + struct uuconf_proto_param_entry *uuconf_qentries; +}; + +/* Each particular protocol parameter entry is one of the following + structures. */ + +struct uuconf_proto_param_entry +{ + /* The number of arguments to the ``protocol-parameter'' command + (not counting ``protocol-parameter'' itself). This is 0 for the + last element of the array. */ + int uuconf_cargs; + /* The actual arguments to the ``protocol-parameter'' command; this + is an array with cargs entries. */ + char **uuconf_pzargs; +}; + +/* The information which is kept for a system. The zname and zalias + fields will be the same for all alternates. Every other fields is + specific to the particular alternate in which it appears (although + most will be the same for all alternates). */ + +struct uuconf_system +{ + /* The name of the system. */ + char *uuconf_zname; + /* A list of aliases for the system. This is a NULL terminated list + of strings. May be NULL, in which case there are no aliases. */ + char **uuconf_pzalias; + /* A linked list of alternate call in or call out information. Each + alternative way to call this system occupies an element of this + list. May be NULL, in which case there are no alternates. */ + struct uuconf_system *uuconf_qalternate; + /* The name for this particular alternate. May be NULL, in which + case this alternate does not have a name. */ + char *uuconf_zalternate; + /* If non-zero, this alternate may be used for calling out. */ + int uuconf_fcall; + /* If non-zero, this alternate may be used for accepting a call. */ + int uuconf_fcalled; + /* The times at which this system may be called. The ival field of + each uuconf_timespan structure is the lowest grade which may be + transferred at that time. The cretry field is the number of + minutes to wait before retrying the call, or 0 if it was not + specified. May be NULL, in which case the system may never be + called. */ + struct uuconf_timespan *uuconf_qtimegrade; + /* The times at which to request a particular grade of the system + when calling it, and the grades to request. The ival field of + each uuconf_timespan structure is the lowest grade which the + other system should transfer at that time. May be NULL, in which + case there are no grade restrictions. */ + struct uuconf_timespan *uuconf_qcalltimegrade; + /* The maximum number of times to retry calling this system. If + this is 0, there is no limit. */ + int uuconf_cmax_retries; + /* The number of minutes to wait between successful calls to a + system. */ + int uuconf_csuccess_wait; + /* The size restrictions by time for local requests during a locally + placed call. The ival field of each uuconf_timespan structure is + the size in bytes of the largest file which may be transferred at + that time. May be NULL, in which case there are no size + restrictions. */ + struct uuconf_timespan *uuconf_qcall_local_size; + /* The size restrictions by time for remote requests during a + locally placed call. May be NULL. */ + struct uuconf_timespan *uuconf_qcall_remote_size; + /* The size restrictions by time for local requests during a + remotely placed call. May be NULL. */ + struct uuconf_timespan *uuconf_qcalled_local_size; + /* The size restrictions by time for remote requests during a + remotely placed call. May be NULL. */ + struct uuconf_timespan *uuconf_qcalled_remote_size; + /* Baud rate, or speed. Zero means any baud rate. If ihighbaud is + non-zero, this is the low baud rate of a range. */ + long uuconf_ibaud; + /* If non-zero, ibaud is the low baud rate of a range and ihighbaud + is the high baud rate. */ + long uuconf_ihighbaud; + /* Port name to use. May be NULL. If an HDB configuration file + contains a modem class (alphabetic characters preceeding the baud + rate), the class is appended to the port name. */ + char *uuconf_zport; + /* Specific port information, if the system entry includes port + information. May be NULL. */ + struct uuconf_port *uuconf_qport; + /* Phone number to call, or address to use for a TCP connection. + May be NULL, in which case a dialer script may not use \D or \T + for this system, and a TCP port will use the system name. */ + char *uuconf_zphone; + /* Chat script to use when logging in to the system. */ + struct uuconf_chat uuconf_schat; + /* Login name to use for \L in the login chat script. This should + normally be accessed via uuconf_callout. If it is "*", + uuconf_callout will look it up in the call out file. This may be + NULL, in which case the login script may not use \L. */ + char *uuconf_zcall_login; + /* Password to use for \P in the login chat script. This should + normally be accessed via uuconf_callout. If it is "*", + uuconf_callout will look it up in the call out file. This may be + NULL, in which case the login script may not use \P. */ + char *uuconf_zcall_password; + /* The login name this system must use when calling in. This may be + different for different alternates. This should only be examined + if uuconf_fcalled is TRUE. If this is NULL or "ANY" then + uuconf_validate must be called to make sure that whatever login + name was used is permitted for this machine. */ + char *uuconf_zcalled_login; + /* If non-zero, then when this system calls in the call should not + be allowed to proceed and the system should be called back. */ + int uuconf_fcallback; + /* If non-zero, then conversation sequence numbers should be used + with this system. */ + int uuconf_fsequence; + /* A list of protocols to use with this system. Each protocol has a + single character name. May be NULL, in which case any known + protocol may be used. */ + char *uuconf_zprotocols; + /* Array of protocol parameters. Ends in an entry with a + uuconf_bproto field of '\0'. May be NULL. */ + struct uuconf_proto_param *uuconf_qproto_params; + /* Chat script to run when called by this system. */ + struct uuconf_chat uuconf_scalled_chat; + /* Debugging level to set during a conversation. May be NULL. */ + char *uuconf_zdebug; + /* Maximum remote debugging level this system may request. May be + NULL. */ + char *uuconf_zmax_remote_debug; + /* Non-zero if the remote system may request us to send files from + the local system to the remote. */ + int uuconf_fsend_request; + /* Non-zero if the remote system may request us to receive files + from the remote system to the local. */ + int uuconf_frec_request; + /* Non-zero if local requests are permitted when calling this + system. */ + int uuconf_fcall_transfer; + /* Non-zero if local requests are permitted when this system calls + in. */ + int uuconf_fcalled_transfer; + /* NULL terminated list of directories from which files may be sent + by local request. */ + char **uuconf_pzlocal_send; + /* NULL terminated list of directories from which files may be sent + by remote request. */ + char **uuconf_pzremote_send; + /* NULL terminated list of directories into which files may be + received by local request. */ + char **uuconf_pzlocal_receive; + /* NULL terminated list of directories into which files may be + received by remote request. */ + char **uuconf_pzremote_receive; + /* Path to use for command execution. This is a NULL terminated + list of directories. */ + char **uuconf_pzpath; + /* NULL terminated List of commands that may be executed. */ + char **uuconf_pzcmds; + /* Amount of free space to leave when accepting a file from this + system, in bytes. */ + long uuconf_cfree_space; + /* NULL terminated list of systems that this system may forward + from. May be NULL if there are no systems from which files may + be forwarded. The list may include "ANY". */ + char **uuconf_pzforward_from; + /* NULL terminated list of systems that this system may forward to. + May be NULL if there are no systems to which files may be + forwarded. The list may include "ANY". */ + char **uuconf_pzforward_to; + /* The public directory to use for this sytem. */ + const char *uuconf_zpubdir; + /* The local name to use for this remote system. May be NULL if the + usual local name should be used. */ + char *uuconf_zlocalname; + /* Memory allocation block for the system. */ + UUCONF_POINTER uuconf_palloc; +}; + +/* Types of ports. */ + +enum uuconf_porttype +{ + /* Unknown port type. A port of this type should never be returned + by the uuconf functions. */ + UUCONF_PORTTYPE_UNKNOWN, + /* Read from standard input and write to standard output. Not + normally used. */ + UUCONF_PORTTYPE_STDIN, + /* A modem port. */ + UUCONF_PORTTYPE_MODEM, + /* A direct connect port. */ + UUCONF_PORTTYPE_DIRECT, + /* A TCP port. Not supported on all systems. */ + UUCONF_PORTTYPE_TCP, + /* A TLI port. Not supported on all systems. */ + UUCONF_PORTTYPE_TLI +}; + +/* Additional information for a stdin port (there is none). */ + +struct uuconf_stdin_port +{ + int uuconf_idummy; +}; + +/* Additional information for a modem port. */ + +struct uuconf_modem_port +{ + /* The device name. May be NULL, in which case the port name is + used instead. */ + char *uuconf_zdevice; + /* The device name to send the dialer chat script to. May be NULL, + in which case the chat script is sent to the usual device. */ + char *uuconf_zdial_device; + /* The default baud rate (speed). If zero, there is no default. */ + long uuconf_ibaud; + /* The low baud rate, if a range is used. If zero, a range is not + used and ihighbaud should be ignored. */ + long uuconf_ilowbaud; + /* The high baud rate, if ilowbaud is non-zero. */ + long uuconf_ihighbaud; + /* Non-zero if the port supports carrier detect. */ + int uuconf_fcarrier; + /* 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. */ + char **uuconf_pzdialer; + /* Specific dialer information. Only used if pzdialer is NULL. */ + struct uuconf_dialer *uuconf_qdialer; +}; + +/* Additional information for a direct connect port. */ + +struct uuconf_direct_port +{ + /* The device name. May be NULL, in which case the port name is + used instead. */ + char *uuconf_zdevice; + /* The baud rate (speed). */ + long uuconf_ibaud; +}; + +/* Additional information for a TCP port. */ + +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; +}; + +/* Additional information for a TLI port. */ + +struct uuconf_tli_port +{ + /* Device name to open. May be NULL, in which case the port name is + used. */ + char *uuconf_zdevice; + /* Whether this port should be turned into a stream, permitting the + read and write calls instead of the t_rcv and t_send calls. */ + int uuconf_fstream; + /* A NULL terminated list of modules to push after making the + connection. May be NULL, in which case if fstream is non-zero, + then "tirdwr" is pushed onto the stream, and otherwise nothing is + pushed. */ + char **uuconf_pzpush; + /* A NULL terminated sequence of dialer/token pairs (element 0 is a + dialer name, element 1 is a token, etc.) May be NULL. If + element 0 is TLI or TLIS, element 1 is used as the address to + connect to; otherwise uuconf_zphone from the system information + is used. */ + char **uuconf_pzdialer; + /* Address to use when operating as a server. This may contain + escape sequences. */ + char *uuconf_zservaddr; +}; + +/* Information kept for a port. */ + +struct uuconf_port +{ + /* The name of the port. */ + char *uuconf_zname; + /* The type of the port. */ + enum uuconf_porttype uuconf_ttype; + /* The list of protocols supported by the port. The name of each + protocol is a single character. May be NULL, in which case any + protocol is permitted. */ + char *uuconf_zprotocols; + /* Array of protocol parameters. Ends in an entry with a + uuconf_bproto field of '\0'. May be NULL. */ + struct uuconf_proto_param *uuconf_qproto_params; + /* The set of reliability bits. */ + int uuconf_ireliable; + /* The lock file name to use. */ + char *uuconf_zlockname; + /* Memory allocation block for the port. */ + UUCONF_POINTER uuconf_palloc; + /* The type specific information. */ + union + { + struct uuconf_stdin_port uuconf_sstdin; + struct uuconf_modem_port uuconf_smodem; + struct uuconf_direct_port uuconf_sdirect; + struct uuconf_tcp_port uuconf_stcp; + struct uuconf_tli_port uuconf_stli; + } uuconf_u; +}; + +/* Information kept about a dialer. */ + +struct uuconf_dialer +{ + /* The name of the dialer. */ + char *uuconf_zname; + /* The chat script to use when dialing out. */ + struct uuconf_chat uuconf_schat; + /* The string to send when a `=' appears in the phone number. */ + char *uuconf_zdialtone; + /* The string to send when a `-' appears in the phone number. */ + char *uuconf_zpause; + /* Non-zero if the dialer supports carrier detect. */ + int uuconf_fcarrier; + /* The number of seconds to wait for carrier after the chat script + is complete. Only used if fcarrier is non-zero. Only supported + on some systems. */ + int uuconf_ccarrier_wait; + /* If non-zero, DTR should be toggled before dialing. Only + supported on some systems. */ + int uuconf_fdtr_toggle; + /* If non-zero, sleep for 1 second after toggling DTR. Ignored if + fdtr_toggle is zero. */ + int uuconf_fdtr_toggle_wait; + /* The chat script to use when a call is complete. */ + struct uuconf_chat uuconf_scomplete; + /* The chat script to use when a call is aborted. */ + struct uuconf_chat uuconf_sabort; + /* Array of protocol parameters. Ends in an entry with a + uuconf_bproto field of '\0'. May be NULL. */ + struct uuconf_proto_param *uuconf_qproto_params; + /* The set of reliability bits. */ + int uuconf_ireliable; + /* Memory allocation block for the dialer. */ + UUCONF_POINTER uuconf_palloc; +}; + +/* Reliability bits for the ireliable field of ports and dialers. + These bits are used to decide which protocol to run. A given + protocol will have a set of these bits, and each of them must be + turned on for the port before we will permit that protocol to be + used. This will be overridden by the zprotocols field. */ + +/* Whether a set of reliability bits is given. If this bit is not + set, then there is no reliability information. */ +#define UUCONF_RELIABLE_SPECIFIED (01) + +/* Set if the connection is eight bit transparent. */ +#define UUCONF_RELIABLE_EIGHT (02) + +/* Set if the connection is error-free. */ +#define UUCONF_RELIABLE_RELIABLE (04) + +/* Set if the connection is end-to-end reliable (e.g. TCP). */ +#define UUCONF_RELIABLE_ENDTOEND (010) + +/* Set if the connection is full-duplex; that is, no time consuming + line turnaround is required before sending data in the reverse + direction. If the connection is truly half-duplex, in the sense + that communication can only flow in one direction, UUCP can not be + used. */ +#define UUCONF_RELIABLE_FULLDUPLEX (020) + +/* UUCP grades range from 0 to 9, A to Z, a to z in order from highest + to lowest (work of higher grades is done before work of lower + grades). */ + +/* The highest grade. */ +#define UUCONF_GRADE_HIGH ('0') + +/* The lowest grade. */ +#define UUCONF_GRADE_LOW ('z') + +/* Whether a character is a legal grade (requires <ctype.h>). */ +#define UUCONF_GRADE_LEGAL(b) (isalnum ((unsigned) (b))) + +/* Return < 0 if the first grade should be done before the second + grade, == 0 if they are the same, or > 0 if the first grade should + be done after the second grade. On an ASCII system, this can just + be b1 - b2. */ +#define UUCONF_GRADE_CMP(b1, b2) (uuconf_grade_cmp ((b1), (b2))) + +/* Most of the uuconf functions returns an error code. A value of + zero (UUCONF_SUCCESS) indicates success. */ + +/* If this bit is set in the returned error code, then the + uuconf_errno function may be used to obtain the errno value as set + by the function which caused the failure. */ +#define UUCONF_ERROR_ERRNO (0x100) + +/* If this bit is set in the returned error code, then the + uuconf_filename function may be used to get the name of a file + associated with the error. */ +#define UUCONF_ERROR_FILENAME (0x200) + +/* If this bit is set in the returned error code, then the + uuconf_lineno function may be used to get a line number associated + with the error; normally if this is set UUCONF_ERROR_FILENAME will + also be set. */ +#define UUCONF_ERROR_LINENO (0x400) + +/* There are two UUCONF_CMDTABRET bits that may be set in the return + value of uuconf_cmd_line or uuconf_cmd_args, described below. They + do not indicate an error, but instead give instructions to the + calling function, often uuconf_cmd_file. They may also be set in + the return value of a user function listed in a uuconf_cmdtab + table, in which case they will be honored by uuconf_cmd_file. */ + +/* This bit means that the memory occupied by the arguments passed to + the function should be preserved, and not overwritten or freed. It + refers only to the contents of the arguments; the contents of the + argv array itself may always be destroyed. If this bit is set in + the return value of uuconf_cmd_line or uuconf_cmd_args, it must be + honored. It will be honored by uuconf_cmd_file. This may be + combined with an error code or with UUCONF_CMDTABRET_EXIT, although + neither uuconf_cmd_file or uuconf_cmd_line will do so. */ +#define UUCONF_CMDTABRET_KEEP (0x800) + +/* This bit means that uuconf_cmd_file should exit, rather than go on + to read and process the next line. If uuconf_cmd_line or + uuconf_cmd_args encounter an error, the return value will have this + bit set along with the error code. A user function may set this + bit with or without an error; the return value of the user function + will be returned by uuconf_cmd_file, except that the + UUCONF_CMDTABRET_KEEP and UUCONF_CMDTABRET_EXIT bits will be + cleared. */ +#define UUCONF_CMDTABRET_EXIT (0x1000) + +/* This macro may be used to extract the specific error value. */ +#define UUCONF_ERROR_VALUE(i) ((i) & 0xff) + +/* UUCONF_ERROR_VALUE will return one of the following values. */ + +/* Function succeeded. */ +#define UUCONF_SUCCESS (0) +/* Named item not found. */ +#define UUCONF_NOT_FOUND (1) +/* A call to fopen failed. */ +#define UUCONF_FOPEN_FAILED (2) +/* A call to fseek failed. */ +#define UUCONF_FSEEK_FAILED (3) +/* A call to malloc or realloc failed. */ +#define UUCONF_MALLOC_FAILED (4) +/* Syntax error in file. */ +#define UUCONF_SYNTAX_ERROR (5) +/* Unknown command. */ +#define UUCONF_UNKNOWN_COMMAND (6) + +#if UUCONF_ANSI_C + +/* For each type of configuration file (Taylor, V2, HDB), there are + separate routines to read various sorts of information. There are + also generic routines, which call on the appropriate type specific + routines. The library can be compiled to read any desired + combination of the configuration file types. This affects only the + generic routines, as it determines which type specific routines + they call. Thus, on a system which, for example, does not have any + V2 configuration files, there is no need to include the overhead of + the code to parse the files and the time to look for them. + However, a program which specifically wants to be able to parse + them can call the V2 specific routines. + + The uuconf functions all take as an argument a pointer to uuconf + global information. This must be initialized by any the + initialization routines (the generic one and the three file type + specific ones) before any of the other uuconf functions may be + called. */ + +/* Initialize the configuration file reading routines. The ppglobal + argument should point to a generic pointer (a void *, or, on older + compilers, a char *) which will be initialized and may then be + passed to the other uuconf routines. The zprogram argument is the + name of the program for which files should be read. A NULL is + taken as "uucp", and reads the standard UUCP configuration files. + The only other common argument is "cu", but any string is + permitted. The zname argument is the name of the Taylor UUCP + config file; if it is NULL, the default config file will be read. + If not reading Taylor UUCP configuration information, the argument + is ignored. This function must be called before any of the other + uuconf functions. + + Note that if the zname argument is obtained from the user running + the program, the program should be careful to revoke any special + privileges it may have (e.g. on Unix call setuid (getuid ()) and + setgid (getgid ())). Otherwise various sorts of spoofing become + possible. */ +extern int uuconf_init (void **uuconf_ppglobal, + const char *uuconf_zprogram, + const char *uuconf_zname); + +/* Adjust the configuration file global pointer for a new thread. The + library is fully reentrant (with the exception of the function + uuconf_error_string, which calls strerror, which on some systems is + not reentrant), provided that each new thread that wishes to call + the library calls this function and uses the new global pointer + value. The ppglobal argument should be set to the address of the + global pointer set by any of the init functions; it will be + modified to become a new global pointer. */ +extern int uuconf_init_thread (void **uuconf_ppglobal); + +/* Get the names of all known systems. This sets sets *ppzsystems to + point to an array of system names. The list of names is NULL + terminated. The array is allocated using malloc, as is each + element of the array, and they may all be passed to free when they + are no longer needed. If the falias argument is 0, the list will + not include any aliases; otherwise, it will. */ +extern int uuconf_system_names (void *uuconf_pglobal, + char ***uuconf_ppzsystems, + int uuconf_falias); + +/* Get the information for the system zsystem. This sets the fields + in *qsys. This will work whether zsystem is the official name of + the system or merely an alias. */ +extern int uuconf_system_info (void *uuconf_pglobal, + const char *uuconf_zsystem, + struct uuconf_system *uuconf_qsys); + +/* Get information for an unknown (anonymous) system. The + uuconf_zname field of the returned system information will be NULL. + If no information is available for unknown systems, this will + return UUCONF_NOT_FOUND. This does not run the HDB remote.unknown + shell script. */ +extern int uuconf_system_unknown (void *uuconf_pglobal, + struct uuconf_system *uuconf_qsys); + +/* Get information for the local system. Normally the local system + name should first be looked up using uuconf_system_info. If that + returns UUCONF_NOT_FOUND, this function may be used to get an + appropriate set of defaults. The uuconf_zname field of the + returned system information may be NULL. */ +extern int uuconf_system_local (void *uuconf_pglobal, + struct uuconf_system *uuconf_qsys); + +/* Free the memory occupied by system information returned by + uuconf_system_info, uuconf_system_unknown, uuconf_system_local, or + any of the configuration file type specific routines described + below. After this is called, the contents of the structure shall + not be referred to. */ +extern int uuconf_system_free (void *uuconf_pglobal, + struct uuconf_system *uuconf_qsys); + +#ifdef __OPTIMIZE__ +#define uuconf_system_free(qglob, q) \ + (uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS) +#endif + +/* Find a matching port. This will consider each port in turn. + + If the zname argument is not NULL, the port's uuconf_zname field + must match it. + + If the ibaud argument is not zero and the ihighbaud argument is + zero, the port's baud rate, if defined, must be the same (if the + port has a range of baud rates, ibaud must be within the range). + If ibaud and ihighbaud are both not zero, the port's baud rate, if + defined, must be between ibaud and ihighbaud inclusive (if the port + has a range of baud rates, the ranges must intersect). If the port + has no baud rate, either because it is a type of port for which + baud rate is not defined (e.g. a TCP port) or because the + uuconf_ibaud field is 0, the ibaud and ihighbaud arguments are + ignored. + + If the pifn argument is not NULL, the port is passed to pifn, along + with the pinfo argument (which is otherwise ignored). If pifn + returns UUCONF_SUCCESS, the port matches. If pifn returns + UUCONF_NOT_FOUND, a new port is sought. Otherwise the return value + of pifn is returned from uuconf_find_port. The pifn function may + be used to further restrict the port, such as by modem class or + device name. It may also be used to lock the port, if appropriate; + in this case, if the lock fails, pifn may return UUCONF_NOT_FOUND + to force uuconf_find_port to continue searching for a port. + + If the port matches, the information is set into uuconf_qport, and + uuconf_find_port returns UUCONF_SUCCESS. */ +extern int uuconf_find_port (void *uuconf_pglobal, + const char *uuconf_zname, + long uuconf_ibaud, + long uuconf_ihighbaud, + int (*uuconf_pifn) (struct uuconf_port *, + void *uuconf_pinfo), + void *uuconf_pinfo, + struct uuconf_port *uuconf_qport); + +/* Free the memory occupied by system information returned by + uuconf_find_port (or any of the configuration file specific + routines described below). After this is called, the contents of + the structure shall not be referred to. */ +extern int uuconf_port_free (void *uuconf_pglobal, + struct uuconf_port *uuconf_qport); + +#ifdef __OPTIMIZE__ +#define uuconf_port_free(qglob, q) \ + (uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS) +#endif + +/* Get the names of all known dialers. This sets sets *ppzdialers to + point to an array of dialer names. The list of names is NULL + terminated. The array is allocated using malloc, as is each + element of the array, and they may all be passed to free when they + are no longer needed. */ +extern int uuconf_dialer_names (void *uuconf_pglobal, + char ***uuconf_ppzdialers); + +/* Get the information for the dialer zdialer. This sets the fields + in *qdialer. */ +extern int uuconf_dialer_info (void *uuconf_pglobal, + const char *uuconf_zdialer, + struct uuconf_dialer *uuconf_qdialer); + +/* Free the memory occupied by system information returned by + uuconf_dialer_info (or any of the configuration file specific + routines described below). After this is called, the contents of + the structure shall not be referred to. */ +extern int uuconf_dialer_free (void *uuconf_pglobal, + struct uuconf_dialer *uuconf_qsys); + +#ifdef __OPTIMIZE__ +#define uuconf_dialer_free(qglob, q) \ + (uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS) +#endif + +/* Get the local node name. If the node name is not specified + (because no ``nodename'' command appeared in the config file) this + will return UUCONF_NOT_FOUND, and some system dependent function + must be used to determine the node name. Otherwise it will return + a pointer to a constant string, which should not be freed. */ +extern int uuconf_localname (void *uuconf_pglobal, + const char **pzname); + +/* Get the local node name that should be used, given a login name. + This function will check for any special local name that may be + associated with the login name zlogin (as set by the ``myname'' + command in a Taylor configuration file, or the MYNAME field in a + Permissions entry). This will set *pzname to the node name. If no + node name can be determined, *pzname will be set to NULL and the + function will return UUCONF_NOT_FOUND; in this case some system + dependent function must be used to determine the node name. If the + function returns UUCONF_SUCCESS, *pzname will be point to an + malloced buffer. */ +extern int uuconf_login_localname (void *uuconf_pglobal, + const char *uuconf_zlogin, + char **pzname); + +/* Get the name of the UUCP spool directory. This will set *pzspool + to a constant string, which should not be freed. */ +extern int uuconf_spooldir (void *uuconf_pglobal, + const char **uuconf_pzspool); + +/* Get the name of the default UUCP public directory. This will set + *pzpub to a constant string, which should not be freed. Note that + particular systems may use a different public directory. */ +extern int uuconf_pubdir (void *uuconf_pglobal, + const char **uuconf_pzpub); + +/* Get the name of the UUCP lock directory. This will set *pzlock to + a constant string, which should not be freed. */ +extern int uuconf_lockdir (void *uuconf_pglobal, + const char **uuconf_pzlock); + +/* Get the name of the UUCP log file. This will set *pzlog to a + constant string, which should not be freed. */ +extern int uuconf_logfile (void *uuconf_pglobal, + const char **uuconf_pzlog); + +/* Get the name of the UUCP statistics file. This will set *pzstats + to a constant string, which should not be freed. */ +extern int uuconf_statsfile (void *uuconf_pglobal, + const char **uuconf_pzstats); + +/* Get the name of the UUCP debugging file. This will set *pzdebug to + a constant string, which should not be freed. */ +extern int uuconf_debugfile (void *uuconf_pglobal, + const char **uuconf_pzdebug); + +/* Get the default debugging level to use. This basically gets the + argument of the ``debug'' command from the Taylor UUCP config file. + It will set *pzdebug to a constant string, which should not be + freed. */ +extern int uuconf_debuglevel (void *uuconf_pglobal, + const char **uuconf_pzdebug); + +/* Get the maximum number of simultaneous uuxqt executions. This will + set *pcmaxuuxqt to the number. Zero indicates no maximum. */ +extern int uuconf_maxuuxqts (void *uuconf_pglobal, + int *uuconf_pcmaxuuxqt); + +/* 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. */ +extern int uuconf_callin (void *uuconf_pglobal, + const char *uuconf_zlogin, + const char *uuconf_zpassword); + +/* 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 + NULL if the value is not found. If neither value is found, the + function will return UUCONF_NOT_FOUND. */ +extern int uuconf_callout (void *uuconf_pglobal, + const struct uuconf_system *uuconf_qsys, + char **uuconf_pzlog, + char **uuconf_pzpass); + +/* See if a login name is permitted for a system. This will return + UUCONF_SUCCESS if it is permitted or UUCONF_NOT_FOUND if it is + invalid. This simply calls uuconf_taylor_validate or returns + UUCONF_SUCCESS, depending on the value of HAVE_TAYLOR_CONFIG. */ +extern int uuconf_validate (void *uuconf_pglobal, + const struct uuconf_system *uuconf_qsys, + const char *uuconf_zlogin); + +/* Get the name of the HDB remote.unknown shell script, if using + HAVE_HDB_CONFIG. This does not actually run the shell script. If + the function returns UUCONF_SUCCESS, the name will be in *pzname, + which will point to an malloced buffer. If it returns + UUCONF_NOT_FOUND, then there is no script to run. */ +extern int uuconf_remote_unknown (void *uuconf_pglobal, + char **pzname); + +/* Translate a dial code. This sets *pznum to an malloced string. + This will look up the entire zdial string in the dialcode file, so + for normal use the alphabetic prefix should be separated. */ +extern int uuconf_dialcode (void *uuconf_pglobal, + const char *uuconf_zdial, + char **uuconf_pznum); + +/* Compare two grades, returning < 0 if b1 should be executed before + b2, == 0 if they are the same, or > 0 if b1 should be executed + after b2. This can not fail, and does not return a standard uuconf + error code; it is normally called via the macro UUCONF_GRADE_CMP, + defined above. */ +extern int uuconf_grade_cmp (int uuconf_b1, int uuconf_b2); + +#else /* ! UUCONF_ANSI_C */ + +extern int uuconf_init (); +extern int uuconf_init_thread (); +extern int uuconf_system_names (); +extern int uuconf_system_info (); +extern int uuconf_system_unknown (); +extern int uuconf_system_local (); +extern int uuconf_system_free (); +extern int uuconf_find_port (); +extern int uuconf_port_free (); +extern int uuconf_dialer_names (); +extern int uuconf_dialer_info (); +extern int uuconf_dialer_free (); +extern int uuconf_localname (); +extern int uuconf_login_localname (); +extern int uuconf_spooldir (); +extern int uuconf_lockdir (); +extern int uuconf_pubdir (); +extern int uuconf_logfile (); +extern int uuconf_statsfile (); +extern int uuconf_debugfile (); +extern int uuconf_debuglevel (); +extern int uuconf_maxuuxqts (); +extern int uuconf_callin (); +extern int uuconf_callout (); +extern int uuconf_remote_unknown (); +extern int uuconf_validate (); +extern int uuconf_grade_cmp (); + +#ifdef __OPTIMIZE__ +#define uuconf_system_free(qglob, q) \ + (uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS) +#define uuconf_port_free(qglob, q) \ + (uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS) +#define uuconf_dialer_free(qglob, q) \ + (uuconf_free_block ((q)->uuconf_palloc), UUCONF_SUCCESS) +#endif + +#endif /* ! UUCONF_ANSI_C */ + +#if UUCONF_ANSI_C + +/* Initialize the Taylor UUCP configuration file reading routines. + This must be called before calling any of the Taylor UUCP + configuration file specific routines. The ppglobal argument should + point to a generic pointer. Moreover, before calling this function + the pointer either must be set to NULL, or must have been passed to + one of the other uuconf init routines. The zprogram argument is + the name of the program for which files should be read. If NULL, + it is taken as "uucp", which means to read the standard UUCP files. + The zname argument is the name of the config file. If it is NULL, + the default config file will be used. + + Note that if the zname argument is obtained from the user running + the program, the program should be careful to revoke any special + privileges it may have (e.g. on Unix call setuid (getuid ()) and + setgid (getgid ())). Otherwise various sorts of spoofing become + possible. */ +extern int uuconf_taylor_init (void **uuconf_pglobal, + const char *uuconf_zprogram, + const char *uuconf_zname); + +/* Get the names of all systems listed in the Taylor UUCP + configuration files. This sets *ppzsystems to point to an array of + system names. The list of names is NULL terminated. The array is + allocated using malloc, as is each element of the array. If the + falias argument is 0, the list will not include any aliases; + otherwise, it will. */ +extern int uuconf_taylor_system_names (void *uuconf_pglobal, + char ***uuconf_ppzsystems, + int uuconf_falias); + +/* Get the information for system zsystem from the Taylor UUCP + configuration files. This will set *qsys. */ +extern int uuconf_taylor_system_info (void *uuconf_pglobal, + const char *uuconf_zsystem, + struct uuconf_system *uuconf_qsys); + +/* Get information for an unknown (anonymous) system. This returns + the values set by the ``unknown'' command in the main configuration + file. If the ``unknown'' command was not used, this will return + UUCONF_NOT_FOUND. */ +extern int uuconf_taylor_system_unknown (void *uuconf_pglobal, + struct uuconf_system *uuconf_qsys); + +/* Find a port from the Taylor UUCP configuration files. The + arguments and return values are identical to those of + uuconf_find_port. */ +extern int uuconf_taylor_find_port (void *uuconf_pglobal, + const char *uuconf_zname, + long uuconf_ibaud, + long uuconf_ihighbaud, + int (*uuconf_pifn) (struct uuconf_port *, + void *uuconf_pinfo), + void *uuconf_pinfo, + struct uuconf_port *uuconf_qport); + +/* Get the names of all dialers listed in the Taylor UUCP + configuration files. This sets *ppzdialers to point to an array of + dialer names. The list of names is NULL terminated. The array is + allocated using malloc, as is each element of the array. */ +extern int uuconf_taylor_dialer_names (void *uuconf_pglobal, + char ***uuconf_ppzdialers); + +/* Get the information for the dialer zdialer from the Taylor UUCP + configuration files. This sets the fields in *qdialer. */ +extern int uuconf_taylor_dialer_info (void *uuconf_pglobal, + const char *uuconf_zdialer, + struct uuconf_dialer *uuconf_qdialer); + +/* Get the local node name that should be used, given a login name, + considering only the ``myname'' command in the Taylor UUCP + configuration files. If the function returns UUCONF_SUCCESS, + *pzname will point to an malloced buffer. */ +extern int uuconf_taylor_login_localname (void *uuconf_pglobal, + const char *uuconf_zlogin, + char **pzname); + +/* Get the callout login name and password for a system from the + Taylor UUCP configuration files. This will set both *pzlog and + *pzpass to a string allocated by malloc, or to NULL if the value is + not found. If neither value is found, the function will return + UUCONF_NOT_FOUND. */ +extern int uuconf_taylor_callout (void *uuconf_pglobal, + const struct uuconf_system *uuconf_qsys, + char **uuconf_pzlog, + char **uuconf_pzpass); + +/* See if a login name is permitted for a system. This will return + UUCONF_SUCCESS if it is permitted or UUCONF_NOT_FOUND if it is + invalid. This checks whether the login name appears in a + called-login command with a list of system which does not include + the system qsys. */ +extern int uuconf_taylor_validate (void *uuconf_pglobal, + const struct uuconf_system *uuconf_qsys, + const char *uuconf_zlogin); + +#else /* ! UUCONF_ANSI_C */ + +extern int uuconf_taylor_init (); +extern int uuconf_taylor_system_names (); +extern int uuconf_taylor_system_info (); +extern int uuconf_taylor_system_unknown (); +extern int uuconf_taylor_find_port (); +extern int uuconf_taylor_dialer_names (); +extern int uuconf_taylor_dialer_info (); +extern int uuconf_taylor_login_localname (); +extern int uuconf_taylor_callout (); +extern int uuconf_taylor_validate (); + +#endif /* ! UUCONF_ANSI_C */ + +#if UUCONF_ANSI_C + +/* Initialize the V2 configuration file reading routines. This must + be called before any of the other V2 routines are called. The + ppglobal argument should point to a generic pointer. Moreover, + before calling this function the pointer either must be set to + NULL, or must have been passed to one of the other uuconf init + routines. */ +extern int uuconf_v2_init (void **uuconf_ppglobal); + +/* Get the names of all systems listed in the V2 configuration files. + This sets *ppzsystems to point to an array of system names. The + list of names is NULL terminated. The array is allocated using + malloc, as is each element of the array. If the falias argument is + 0, the list will not include any aliases; otherwise, it will. */ +extern int uuconf_v2_system_names (void *uuconf_pglobal, + char ***uuconf_ppzsystems, + int uuconf_falias); + +/* Get the information for system zsystem from the V2 configuration + files. This will set *qsys. */ +extern int uuconf_v2_system_info (void *uuconf_pglobal, + const char *uuconf_zsystem, + struct uuconf_system *uuconf_qsys); + +/* Find a port from the V2 configuration files. The arguments and + return values are identical to those of uuconf_find_port. */ +extern int uuconf_v2_find_port (void *uuconf_pglobal, + const char *uuconf_zname, + long uuconf_ibaud, + long uuconf_ihighbaud, + int (*uuconf_pifn) (struct uuconf_port *, + void *uuconf_pinfo), + void *uuconf_pinfo, + struct uuconf_port *uuconf_qport); + +#else /* ! UUCONF_ANSI_C */ + +extern int uuconf_v2_init (); +extern int uuconf_v2_system_names (); +extern int uuconf_v2_system_info (); +extern int uuconf_v2_find_port (); + +#endif /* ! UUCONF_ANSI_C */ + +#if UUCONF_ANSI_C + +/* Initialize the HDB configuration file reading routines. This + should be called before any of the other HDB routines are called. + The ppglobal argument should point to a generic pointer. Moreover, + before calling this function the pointer either must be set to + NULL, or must have been passed to one of the other uuconf init + routines. The zprogram argument is used to match against a + "services" string in Sysfiles. A NULL or "uucp" argument is taken + as "uucico". */ +extern int uuconf_hdb_init (void **uuconf_ppglobal, + const char *uuconf_zprogram); + +/* Get the names of all systems listed in the HDB configuration files. + This sets *ppzsystems to point to an array of system names. The + list of names is NULL terminated. The array is allocated using + malloc, as is each element of the array. If the falias argument is + 0, the list will not include any aliases; otherwise, it will (an + alias is created by using the ALIAS= keyword in the Permissions + file). */ +extern int uuconf_hdb_system_names (void *uuconf_pglobal, + char ***uuconf_ppzsystems, + int uuconf_falias); + +/* Get the information for system zsystem from the HDB configuration + files. This will set *qsys. */ +extern int uuconf_hdb_system_info (void *uuconf_pglobal, + const char *uuconf_zsystem, + struct uuconf_system *uuconf_qsys); + + +/* Get information for an unknown (anonymous) system. If no + information is available for unknown systems, this will return + UUCONF_NOT_FOUND. This does not run the remote.unknown shell + script. */ +extern int uuconf_hdb_system_unknown (void *uuconf_pglobal, + struct uuconf_system *uuconf_qsys); + +/* Find a port from the HDB configuration files. The arguments and + return values are identical to those of uuconf_find_port. */ +extern int uuconf_hdb_find_port (void *uuconf_pglobal, + const char *uuconf_zname, + long uuconf_ibaud, + long uuconf_ihighbaud, + int (*uuconf_pifn) (struct uuconf_port *, + void *uuconf_pinfo), + void *uuconf_pinfo, + struct uuconf_port *uuconf_qport); + +/* Get the names of all dialers listed in the HDB configuration files. + This sets *ppzdialers to point to an array of dialer names. The + list of names is NULL terminated. The array is allocated using + malloc, as is each element of the array. */ +extern int uuconf_hdb_dialer_names (void *uuconf_pglobal, + char ***uuconf_ppzdialers); + +/* Get the information for the dialer zdialer from the HDB + configuration files. This sets the fields in *qdialer. */ +extern int uuconf_hdb_dialer_info (void *uuconf_pglobal, + const char *uuconf_zdialer, + struct uuconf_dialer *uuconf_qdialer); + +/* Get the local node name that should be used, given a login name, + considering only the MYNAME field in the HDB Permissions file. If + the function returns UUCONF_SUCCESS, *pzname will point to an + malloced buffer. */ +extern int uuconf_hdb_login_localname (void *uuconf_pglobal, + const char *uuconf_zlogin, + char **pzname); + +/* Get the name of the HDB remote.unknown shell script. This does not + actually run the shell script. If the function returns + UUCONF_SUCCESS, the name will be in *pzname, which will point to an + malloced buffer. */ +extern int uuconf_hdb_remote_unknown (void *uuconf_pglobal, + char **pzname); + +#else /* ! UUCONF_ANSI_C */ + +extern int uuconf_hdb_init (); +extern int uuconf_hdb_system_names (); +extern int uuconf_hdb_system_info (); +extern int uuconf_hdb_system_unknown (); +extern int uuconf_hdb_find_port (); +extern int uuconf_hdb_dialer_names (); +extern int uuconf_hdb_dialer_info (); +extern int uuconf_hdb_localname (); +extern int uuconf_hdb_remote_unknown (); + +#endif /* ! UUCONF_ANSI_C */ + +#if UUCONF_ANSI_C + +/* This function will set an appropriate error message into the buffer + zbuf, given a uuconf error code. The buffer will always be null + terminated, and will never be accessed beyond the length cbuf. + This function will return the number of characters needed for the + complete message, including the null byte. If this is less than + the cbytes argument, the buffer holds a truncated string. */ +extern int uuconf_error_string (void *uuconf_pglobal, int ierror, + char *zbuf, UUCONF_SIZE_T cbuf); + +/* If UUCONF_ERROR_ERRNO is set in a return value, this function may + be used to retrieve the errno value. This will be the value of + errno as set by the system function which failed. However, some + system functions, notably some stdio routines, may not set errno, + in which case the value will be meaningless. This function does + not return a uuconf error code, and it cannot fail. */ +extern int uuconf_error_errno (void *uuconf_pglobal); + +/* If UUCONF_ERROR_FILENAME is set in a return value, this function + may be used to retrieve the file name. This function does not + return a uuconf error code, and it cannot fail. The string that it + returns a pointer to is not guaranteed to remain allocated across + the next call to a uuconf function (other than one of the three + error retrieving functions). */ +extern const char *uuconf_error_filename (void *uuconf_pglobal); + +/* If UUCONF_ERROR_LINENO is set in a return value, this function may + be used to retrieve the line number. This function does not return + a uuconf error code, and it cannot fail. */ +extern int uuconf_error_lineno (void *uuconf_pglobal); + +#else /* ! UUCONF_ANSI_C */ + +extern int uuconf_error_string (); +extern int uuconf_error_errno (); +extern UUCONF_CONST char *uuconf_error_filename (); +extern int uuconf_error_lineno (); + +#endif /* ! UUCONF_ANSI_C */ + +/* The uuconf package also provides a few functions which can accept + commands and parcel them out according to a table. These are + publically visible, partially in the hopes that they will be + useful, but mostly because the rest of the Taylor UUCP package uses + them. */ + +/* The types of entries allowed in a command table (struct + uuconf_cmdtab). Each type defines how a particular command is + interpreted. Each type will either assign a value to a variable or + call a function. In all cases, a line of input is parsed into + separate fields, separated by whitespace; comments beginning with + '#' are discarded, except that a '#' preceeded by a backslash is + retained. The first field is taken as the command to execute, and + the remaining fields are its arguments. */ + +/* A boolean value. Used for a command which accepts a single + argument, which must begin with 'y', 'Y', 't', or 'T' for true (1) + or 'n', 'N', 'f', or 'F' for false (0). The corresponding variable + must be an int. */ +#define UUCONF_CMDTABTYPE_BOOLEAN (0x12) + +/* An integer value. Used for a command which accepts a single + argument, which must be an integer. The corresponding variable + must be an int. */ +#define UUCONF_CMDTABTYPE_INT (0x22) + +/* A long value. Used for a command which accepts a single value, + which must be an integer. The corresponding variable must be a + long. */ +#define UUCONF_CMDTABTYPE_LONG (0x32) + +/* A string value. Used for a command which accepts a string + argument. If there is no argument, the variable will be set to + point to a zero byte. Otherwise the variable will be set to point + to the string. The corresponding variable must be a char *. The + memory pointed to by the variable after it is set must not be + modified. */ +#define UUCONF_CMDTABTYPE_STRING (0x40) + +/* A full string value. Used for a command which accepts a series of + string arguments separated by whitespace. The corresponding + variable must be a char **. It will be set to an NULL terminated + array of the arguments. The memory occupied by the array itself, + and by the strings within it, must not be modified. */ +#define UUCONF_CMDTABTYPE_FULLSTRING (0x50) + +/* A function. If this command is encountered, the command and its + arguments are passed to the corresponding function. They are + passed as an array of strings, in which the first string is the + command itself, along with a count of strings. This value may be + or'red with a specific number of required arguments; + UUCONF_CMDTABTYPE_FN | 1 accepts no additional arguments besides + the command itself, UUCONF_CMDTABTYPE_FN | 2 accepts 1 argument, + etc. UUCONF_CMDTABTYPE_FN | 0, accepts any number of additional + arguments. */ +#define UUCONF_CMDTABTYPE_FN (0x60) + +/* A prefix function. The string in the table is a prefix; if a + command is encountered with the same prefix, the corresponding + function will be called as for UUCONF_CMDTABTYPE_FN. The number of + arguments may be or'red in as with UUCONF_CMDTABTYPE_FN. */ +#define UUCONF_CMDTABTYPE_PREFIX (0x70) + +/* This macro will return the particular type of a CMDTABTYPE. */ +#define UUCONF_TTYPE_CMDTABTYPE(i) ((i) & 0x70) + +/* This macro will return the required number of arguments of a + CMDTABTYPE. If it is zero, there is no restriction. */ +#define UUCONF_CARGS_CMDTABTYPE(i) ((i) & 0x0f) + +/* When a function is called via UUCONF_CMDTABTYPE_FN or + UUCONF_CMDTABTYPE_PREFIX, it may return any uuconf error code (see + above). However, it will normally return one of the following: + + UUCONF_CMDTABRET_CONTINUE: Take no special action. In particular, + the arguments passed to the function may be overwritten or freed. + + UUCONF_CMDTABRET_KEEP: The memory occupied by the arguments passed + to the function must be preserved. Continue processing commands. + + UUCONF_CMDTABRET_EXIT: If reading commands from a file, stop + processing. The arguments passed to the function may be + overwritten or freed. + + UUCONF_CMDTABRET_KEEP_AND_EXIT: Stop processing any file. The + memory occupied by the arguments passed to the function must be + preserved. + + These values are interpreted by uuconf_cmd_file. The + uuconf_cmd_line and uuconf_cmd_args functions may return + UUCONF_CMDTABRET_KEEP. It they get an error, they will return an + error code with UUCONF_CMDTABRET_EXIT set. Also, of course, they + may return any value that is returned by one of the user functions + in the uuconf_cmdtab table. */ + +/* UUCONF_CMDTABRET_KEEP and UUCONF_CMDTABRET_EXIT are defined above, + with the error codes. */ + +#define UUCONF_CMDTABRET_CONTINUE UUCONF_SUCCESS +#define UUCONF_CMDTABRET_KEEP_AND_EXIT \ + (UUCONF_CMDTABRET_KEEP | UUCONF_CMDTABRET_EXIT) + +/* When a function is called via CMDTABTYPE_FN or CMDTABTYPE_PREFIX, + it is passed five arguments. This is the type of a pointer to such + a function. The uuconf global information structure is passed in + for convenience in calling another uuconf function. The arguments + to the command are passed in (the command itself is the first + argument) along with a count and the value of the pvar field from + the uuconf_cmdtab structure in which the function pointer was + found. The pinfo argument to the function is taken from the + argument to uuconf_cmd_*. */ + +#if UUCONF_ANSI_C +typedef int (*uuconf_cmdtabfn) (void *uuconf_pglobal, + int uuconf_argc, + char **uuconf_argv, + void *uuconf_pvar, + void *uuconf_pinfo); +#else +typedef int (*uuconf_cmdtabfn) (); +#endif + +/* A table of commands is an array of the following structures. The + final element of the table should have uuconf_zcmd == NULL. */ + +struct uuconf_cmdtab +{ + /* Command name. */ + UUCONF_CONST char *uuconf_zcmd; + /* Command type (one of CMDTABTYPE_*). */ + int uuconf_itype; + /* If not CMDTABTYPE_FN or CMDTABTYPE_PREFIX, the address of the + associated variable. Otherwise, a pointer value to pass to the + function pifn. */ + UUCONF_POINTER uuconf_pvar; + /* The function to call if CMDTABTYPE_FN or CMDTABTYPE_PREFIX. */ + uuconf_cmdtabfn uuconf_pifn; +}; + +/* Bit flags to pass to uuconf_processcmds. */ + +/* If set, case is significant when checking commands. Normally case + is ignored. */ +#define UUCONF_CMDTABFLAG_CASE (0x1) + +/* If set, a backslash at the end of a line may be used to include the + next physical line in the logical line. */ +#define UUCONF_CMDTABFLAG_BACKSLASH (0x2) + +#if UUCONF_ANSI_C + +/* Read commands from a file, look them up in a table, and take the + appropriate action. This continues reading lines from the file + until EOF, or until a function returns with UUCONF_CMDTABRET_EXIT + set, or until an error occurs. The qtab argument must point to a + table of struct uuconf_cmdtab; the last element in the table should + have uuconf_zcmd == NULL. When a UUCONF_CMDTABTYPE_FN or + UUCONF_CMDTABTYPE_PREFIX command is found, the pinfo argument will + be passed to the called function. If an a command is found that is + not in the table, then if pfiunknownfn is NULL the unknown command + is ignored; otherwise it is passed to pfiunknownfn, which should + return a uuconf return code which is handled as for any other + function (the pvar argument to pfiunknownfn will always be NULL). + The iflags argument is any combination of the above + UUCONF_CMDTABFLAG bits. The pblock argument may also be a memory + block, as returned by uuconf_malloc_block (described below), in + which case all memory preserved because of UUCONF_CMDTABRET_KEEP + will be added to the block so that it may be freed later; it may + also be NULL, in which case any such memory is permanently lost. + + This function initially sets the internal line number to 0, and + then increments it as each line is read. It is permitted for any + called function to use the uuconf_lineno function to obtain it. If + this function is called when not at the start of a file, the value + returned by uuconf_lineno (which is, in any case, only valid if an + error code with UUCONF_ERROR_LINENO set is returned) must be + adjusted by the caller. + + This returns a normal uuconf return value, as described above. */ +extern int uuconf_cmd_file (void *uuconf_pglobal, + FILE *uuconf_e, + const struct uuconf_cmdtab *uuconf_qtab, + void *uuconf_pinfo, + uuconf_cmdtabfn uuconf_pfiunknownfn, + int uuconf_iflags, + void *pblock); + +/* This utility function is just like uuconf_cmd_file, except that it + only operates on a single string. If a function is called via + qtab, its return value will be the return value of this function. + UUCONF_CMDTABFLAG_BACKSLASH is ignored in iflags. The string z is + modified in place. The return value may include the + UUCONF_CMDTABRET_KEEP and, on error, the UUCONF_CMDTABRET_EXIT + bits, which should be honored by the calling code. */ +extern int uuconf_cmd_line (void *uuconf_pglobal, + char *uuconf_z, + const struct uuconf_cmdtab *uuconf_qtab, + void *uuconf_pinfo, + uuconf_cmdtabfn uuconf_pfiunknownfn, + int uuconf_iflags, + void *pblock); + +/* This utility function is just like uuconf_cmd_line, except it is + given a list of already parsed arguments. */ +extern int uuconf_cmd_args (void *uuconf_pglobal, + int uuconf_cargs, + char **uuconf_pzargs, + const struct uuconf_cmdtab *uuconf_qtab, + void *uuconf_pinfo, + uuconf_cmdtabfn uuconf_pfiunknownfn, + int uuconf_iflags, + void *pblock); + +#else /* ! UUCONF_ANSI_C */ + +extern int uuconf_cmd_file (); +extern int uuconf_cmd_line (); +extern int uuconf_cmd_args (); + +#endif /* ! UUCONF_ANSI_C */ + +#if UUCONF_ANSI_C + +/* The uuconf_cmd_file function may allocate memory permanently, as + for setting a UUCONF_CMDTABTYPE_STRING value, in ways which are + difficult to free up. A memory block may be used to record all + allocated memory, so that it can all be freed up at once at some + later time. These functions do not take a uuconf global pointer, + and are independent of the rest of the uuconf library. */ + +/* Allocate a block of memory. If this returns NULL, then malloc + returned NULL, and errno is whatever malloc set it to. */ +extern void *uuconf_malloc_block (void); + +/* Allocate memory within a memory block. If this returns NULL, then + malloc returned NULL, and errno is whatever malloc set it to. */ +extern void *uuconf_malloc (void *uuconf_pblock, + UUCONF_SIZE_T uuconf_cbytes); + +/* Add a block returned by the generic malloc routine to a memory + block. This returns zero on success, non-zero on failure. If this + fails (returns non-zero), then malloc returned NULL, and errno is + whatever malloc set it to. */ +extern int uuconf_add_block (void *uuconf_pblock, void *uuconf_padd); + +/* Free a value returned by uuconf_malloc from a memory block. In the + current implementation, this will normally not do anything, but it + doesn't hurt. No errors can occur. */ +extern void uuconf_free (void *uuconf_pblock, void *uuconf_pfree); + +/* Free an entire memory block, including all values returned by + uuconf_malloc from it and all values added to it with + uuconf_add_block. No errors can occur. */ +extern void uuconf_free_block (void *uuconf_pblock); + +#else /* ! UUCONF_ANSI_C */ + +extern UUCONF_POINTER uuconf_malloc_block (); +extern UUCONF_POINTER uuconf_malloc (); +extern int uuconf_add_block (); +extern /* void */ uuconf_free (); +extern /* void */ uuconf_free_block (); + +#endif /* ! UUCONF_ANSI_C */ + +#endif /* ! defined (UUCONF_H) */ diff --git a/gnu/libexec/uucp/common_sources/uucp.h b/gnu/libexec/uucp/common_sources/uucp.h new file mode 100644 index 000000000000..8df3ec4c3e79 --- /dev/null +++ b/gnu/libexec/uucp/common_sources/uucp.h @@ -0,0 +1,367 @@ +/* uucp.h + Header file for the UUCP package. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +/* Get the system configuration parameters. */ +#include "conf.h" +#include "policy.h" + +/* Get a definition for ANSI_C if we weren't given one. */ +#ifndef ANSI_C +#ifdef __STDC__ +#define ANSI_C 1 +#else /* ! defined (__STDC__) */ +#define ANSI_C 0 +#endif /* ! defined (__STDC__) */ +#endif /* ! defined (ANSI_C) */ + +/* Pass this definition into uuconf.h. */ +#define UUCONF_ANSI_C ANSI_C + +/* We always include some standard header files. We need <signal.h> + to define sig_atomic_t. */ +#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. */ +#if ! HAVE_SIG_ATOMIC_T_IN_SIGNAL_H && HAVE_SIG_ATOMIC_T_IN_TYPES_H +#define USE_TYPES_H 1 +#else +#if ! HAVE_SIZE_T_IN_STDDEF_H && HAVE_SIZE_T_IN_TYPES_H +#define USE_TYPES_H 1 +#else +#if ! HAVE_TIME_T_IN_TIME_H && HAVE_TIME_T_IN_TYPES_H +#define USE_TYPES_H 1 +#endif +#endif +#endif + +#ifndef USE_TYPES_H +#define USE_TYPES_H 0 +#endif + +#if USE_TYPES_H +#include <sys/types.h> +#endif + +/* Make sure we have sig_atomic_t. */ +#if ! HAVE_SIG_ATOMIC_T_IN_SIGNAL_H && ! HAVE_SIG_ATOMIC_T_IN_TYPES_H +#ifndef SIG_ATOMIC_T +/* There is no portable definition for sig_atomic_t. */ +#define SIG_ATOMIC_T char +#endif /* ! defined (SIG_ATOMIC_T) */ +typedef SIG_ATOMIC_T sig_atomic_t; +#endif /* ! HAVE_SIG_ATOMIC_T_IN_SIGNAL_H && ! HAVE_SIG_ATOMIC_T_IN_TYPES_H */ + +/* Make sure we have size_t. We use int as the default because the + main use of this type is to provide an argument to malloc and + realloc. On a system which does not define size_t, int is + certainly the correct type to use. */ +#if ! HAVE_SIZE_T_IN_STDDEF_H && ! HAVE_SIZE_T_IN_TYPES_H +#ifndef SIZE_T +#define SIZE_T unsigned +#endif /* ! defined (SIZE_T) */ +typedef SIZE_T size_t; +#endif /* ! HAVE_SIZE_T_IN_STDDEF_H && ! HAVE_SIZE_T_IN_TYPES_H */ + +/* Make sure we have time_t. We use long as the default. We don't + bother to let conf.h override this, since on a system which doesn't + define time_t long must be correct. */ +#if ! HAVE_TIME_T_IN_TIME_H && ! HAVE_TIME_T_IN_TYPES_H +typedef long time_t; +#endif + +/* Set up some definitions for both ANSI C and Classic C. + + P() -- for function prototypes (e.g. extern int foo P((int)) ). + pointer -- for a generic pointer (i.e. void *). + 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 +#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 +#define volatile +#if ! HAVE_VOID +#define void int +#endif +#define P(x) () +typedef char *pointer; +typedef const char *constpointer; +#if HAVE_UNSIGNED_CHAR +#define BUCHAR(b) ((unsigned char) (b)) +#else /* ! HAVE_UNSIGNED_CHAR */ +/* This should work on most systems, but not necessarily all. */ +#define BUCHAR(b) ((b) & 0xff) +#endif /* ! HAVE_UNSIGNED_CHAR */ +#endif /* ! ANSI_C */ + +/* Make sure we have a definition for offsetof. */ +#ifndef offsetof +#define offsetof(type, field) \ + ((size_t) ((char *) &(((type *) 0)->field) - (char *) (type *) 0)) +#endif + +/* Only use inline with gcc. */ +#ifndef __GNUC__ +#define __inline__ +#endif + +/* Get the string functions, which are used throughout the code. */ +#if HAVE_MEMORY_H +#include <memory.h> +#else +/* We really need a definition for memchr, and this should not + conflict with anything in <string.h>. I hope. */ +extern pointer memchr (); +#endif + +#if HAVE_STRING_H +#include <string.h> +#else /* ! HAVE_STRING_H */ +#if HAVE_STRINGS_H +#include <strings.h> +#else /* ! HAVE_STRINGS_H */ +extern char *strcpy (), *strncpy (), *strchr (), *strrchr (), *strtok (); +extern char *strcat (), *strerror (), *strstr (); +extern size_t strlen (), strspn (), strcspn (); +#if ! HAVE_MEMORY_H +extern pointer memcpy (), memchr (); +#endif /* ! HAVE_MEMORY_H */ +#endif /* ! HAVE_STRINGS_H */ +#endif /* ! HAVE_STRING_H */ + +/* Get what we need from <stdlib.h>. */ +#if HAVE_STDLIB_H +#include <stdlib.h> +#else /* ! HAVE_STDLIB_H */ +extern pointer malloc (), realloc (), bsearch (); +extern long strtol (); +extern char *getenv (); +#endif /* ! HAVE_STDLIB_H */ + +/* NeXT uses <libc.h> to declare a bunch of functions. */ +#if HAVE_LIBC_H +#include <libc.h> +#endif + +/* Make sure we have the EXIT_ macros. */ +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS (0) +#endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE (1) +#endif + +/* If we need to declare errno, do so. I don't want to always do + this, because some system might theoretically have a different + declaration for errno. On a POSIX system this is sure to work. */ +#if ! HAVE_ERRNO_DECLARATION +extern int errno; +#endif + +/* If the system has the socket call, guess that we can compile the + TCP code. */ +#define HAVE_TCP HAVE_SOCKET + +/* If the system has the t_open call, guess that we can compile the + TLI code. */ +#define HAVE_TLI HAVE_T_OPEN + +/* The boolean type holds boolean values. */ +typedef int boolean; +#undef TRUE +#undef FALSE +#define TRUE (1) +#define FALSE (0) + +/* The openfile_t type holds an open file. This depends on whether we + are using stdio or not. */ +#if USE_STDIO + +typedef FILE *openfile_t; +#define EFILECLOSED ((FILE *) NULL) +#define ffileisopen(e) ((e) != NULL) +#define ffileeof(e) feof (e) +#define cfileread(e, z, c) fread ((z), 1, (c), (e)) +#define ffilereaderror(e, c) ferror (e) +#define cfilewrite(e, z, c) fwrite ((z), 1, (c), (e)) +#ifdef SEEK_SET +#define ffileseek(e, i) (fseek ((e), (long) (i), SEEK_SET) == 0) +#define ffilerewind(e) (fseek ((e), (long) 0, SEEK_SET) == 0) +#else +#define ffileseek(e, i) (fseek ((e), (long) (i), 0) == 0) +#define ffilerewind(e) (fseek ((e), (long) 0, 0) == 0) +#endif +#define ffileclose(e) (fclose (e) == 0) + +#else /* ! USE_STDIO */ + +#if HAVE_UNISTD_H +#include <unistd.h> +#endif + +typedef int openfile_t; +#define EFILECLOSED (-1) +#define ffileisopen(e) ((e) >= 0) +#define ffileeof(e) (FALSE) +#define cfileread(e, z, c) read ((e), (z), (c)) +#define ffilereaderror(e, c) ((c) < 0) +#define cfilewrite(e, z, c) write ((e), (z), (c)) +#ifdef SEEK_SET +#define ffileseek(e, i) (lseek ((e), (long) i, SEEK_SET) >= 0) +#define ffilerewind(e) (lseek ((e), (long) 0, SEEK_SET) >= 0) +#else +#define ffileseek(e, i) (lseek ((e), (long) i, 0) >= 0) +#define ffilerewind(e) (lseek ((e), (long) 0, 0) >= 0) +#endif +#define ffileclose(e) (close (e) >= 0) + +#endif /* ! USE_STDIO */ + +/* A prototype for main to avoid warnings from gcc 2.0 + -Wmissing-prototype option. */ +extern int main P((int argc, char **argv)); + +/* Some standard routines which we only define if they are not present + on the system we are compiling on. */ + +#if ! HAVE_GETLINE +/* Read a line from a file. */ +extern int getline P((char **pz, size_t *pc, FILE *e)); +#endif + +#if ! HAVE_REMOVE +/* Erase a file. */ +#undef remove +extern int remove P((const char *zfile)); +#endif + +#if ! HAVE_STRDUP +/* Copy a string into memory. */ +extern char *strdup P((const char *z)); +#endif + +#if ! HAVE_STRSTR +/* Look for one string within another. */ +extern char *strstr P((const char *zouter, const char *zinner)); +#endif + +#if ! HAVE_STRCASECMP +#if HAVE_STRICMP +#define strcasecmp stricmp +#else /* ! HAVE_STRICMP */ +/* Rename strcasecmp to avoid ANSI C name space. */ +#define strcasecmp xstrcasecmp +extern int strcasecmp P((const char *z1, const char *z2)); +#endif /* ! HAVE_STRICMP */ +#endif /* ! HAVE_STRCASECMP */ + +#if ! HAVE_STRNCASECMP +#if HAVE_STRNICMP +#define strncasecmp strnicmp +#else /* ! HAVE_STRNICMP */ +/* Rename strncasecmp to avoid ANSI C name space. */ +#define strncasecmp xstrncasecmp +extern int strncasecmp P((const char *z1, const char *z2, size_t clen)); +#endif /* ! HAVE_STRNICMP */ +#endif /* ! HAVE_STRNCASECMP */ + +#if ! HAVE_STRERROR +/* Get a string corresponding to an error message. */ +#undef strerror +extern char *strerror P((int ierr)); +#endif + +/* Get the appropriate definitions for memcmp, memcpy, memchr and + bzero. */ +#if ! HAVE_MEMCMP +#if HAVE_BCMP +#define memcmp(p1, p2, c) bcmp ((p1), (p2), (c)) +#else /* ! HAVE_BCMP */ +extern int memcmp P((constpointer p1, constpointer p2, size_t c)); +#endif /* ! HAVE_BCMP */ +#endif /* ! HAVE_MEMCMP */ + +#if ! HAVE_MEMCPY +#if HAVE_BCOPY +#define memcpy(pto, pfrom, c) bcopy ((pfrom), (pto), (c)) +#else /* ! HAVE_BCOPY */ +extern pointer memcpy P((pointer pto, constpointer pfrom, size_t c)); +#endif /* ! HAVE_BCOPY */ +#endif /* ! HAVE_MEMCPY */ + +#if ! HAVE_MEMCHR +extern pointer memchr P((constpointer p, int b, size_t c)); +#endif + +#if ! HAVE_BZERO +#if HAVE_MEMSET +#define bzero(p, c) memset ((p), 0, (c)) +#else /* ! HAVE_MEMSET */ +extern void bzero P((pointer p, int c)); +#endif /* ! HAVE_MEMSET */ +#endif /* ! HAVE_BZERO */ + +/* Look up a character in a string. */ +#if ! HAVE_STRCHR +#if HAVE_INDEX +#define strchr index +extern char *index (); +#else /* ! HAVE_INDEX */ +extern char *strchr P((const char *z, int b)); +#endif /* ! HAVE_INDEX */ +#endif /* ! HAVE_STRCHR */ + +#if ! HAVE_STRRCHR +#if HAVE_RINDEX +#define strrchr rindex +extern char *rindex (); +#else /* ! HAVE_RINDEX */ +extern char *strrchr P((const char *z, int b)); +#endif /* ! HAVE_RINDEX */ +#endif /* ! HAVE_STRRCHR */ + +/* Turn a string into a long integer. */ +#if ! HAVE_STRTOL +extern long strtol P((const char *, char **, int)); +#endif + +/* Lookup a key in a sorted array. */ +#if ! HAVE_BSEARCH +extern pointer bsearch P((constpointer pkey, constpointer parray, + size_t celes, size_t cbytes, + int (*pficmp) P((constpointer, constpointer)))); +#endif diff --git a/gnu/libexec/uucp/common_sources/uudefs.h b/gnu/libexec/uucp/common_sources/uudefs.h new file mode 100644 index 000000000000..47d2c89896ef --- /dev/null +++ b/gnu/libexec/uucp/common_sources/uudefs.h @@ -0,0 +1,445 @@ +/* uudefs.h + Miscellaneous definitions for the UUCP package. + + Copyright (C) 1991, 1992 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 Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + */ + +#if ANSI_C +/* These structures are used in prototypes but are not defined in this + header file. */ +struct uuconf_system; +struct uuconf_timespan; +#endif + +/* The tlog enumeration holds the different types of logging. */ +enum tlog +{ + /* Normal log entry. */ + LOG_NORMAL, + /* Error log entry. */ + LOG_ERROR, + /* Fatal log entry. */ + LOG_FATAL +#if DEBUG > 1 + , + /* Debugging log entry. */ + LOG_DEBUG, + /* Start debugging log entry. */ + LOG_DEBUG_START, + /* Continue debugging log entry. */ + LOG_DEBUG_CONTINUE, + /* End debugging log entry. */ + LOG_DEBUG_END +#endif +}; + +/* The tstatus_type enumeration holds the kinds of status information + we put in the status file. The order of entries here corresponds + to the order of entries in the azStatus array. */ +enum tstatus_type +{ + /* Conversation complete. */ + STATUS_COMPLETE, + /* Port unavailable. */ + STATUS_PORT_FAILED, + /* Dial failed. */ + STATUS_DIAL_FAILED, + /* Login failed. */ + STATUS_LOGIN_FAILED, + /* Handshake failed. */ + STATUS_HANDSHAKE_FAILED, + /* Failed after logging in. */ + STATUS_FAILED, + /* Talking to remote system. */ + STATUS_TALKING, + /* Wrong time to call. */ + STATUS_WRONG_TIME, + /* Number of status values. */ + STATUS_VALUES +}; + +/* An array to convert status entries to strings. If more status entries + are added, this array must be extended. */ +extern const char *azStatus[]; + +/* The sstatus structure holds the contents of a system status file. */ +struct sstatus +{ + /* Current status of conversation. */ + enum tstatus_type ttype; + /* Number of failed retries. */ + int cretries; + /* Time of last call in seconds since epoch (determined by + ixsysdep_time). */ + long ilast; + /* Number of seconds until a retry is permitted. */ + int cwait; +}; + +/* How long we have to wait for the next call, given the number of retries + we have already made. This should probably be configurable. */ +#define CRETRY_WAIT(c) ((c) * 10 * 60) + +/* The scmd structure holds a complete UUCP command. */ +struct scmd +{ + /* Command ('S' for send, 'R' for receive, 'X' for execute, 'E' for + 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; + /* Sequence handle for fsysdep_did_work. */ + pointer pseq; + /* File name to transfer from. */ + const char *zfrom; + /* File name to transfer to. */ + const char *zto; + /* User who requested transfer. */ + const char *zuser; + /* Options. */ + const char *zoptions; + /* Temporary file name ('S' and 'E'). */ + const char *ztemp; + /* Mode to give newly created file ('S' and 'E'). */ + unsigned int imode; + /* User to notify on remote system (optional; 'S' and 'E'). */ + const char *znotify; + /* File size (-1 if not supplied) ('S', 'E' and 'R'). */ + long cbytes; + /* Command to execute ('E'). */ + const char *zcmd; + /* Position to restart from ('R'). */ + long ipos; +}; + +#if DEBUG > 1 + +/* We allow independent control over several different types of + debugging output, using a bit string with individual bits dedicated + to particular debugging types. */ + +/* The bit string is stored in iDebug. */ +extern int iDebug; + +/* Debug abnormal events. */ +#define DEBUG_ABNORMAL (01) +/* Debug chat scripts. */ +#define DEBUG_CHAT (02) +/* Debug initial handshake. */ +#define DEBUG_HANDSHAKE (04) +/* Debug UUCP protocol. */ +#define DEBUG_UUCP_PROTO (010) +/* Debug protocols. */ +#define DEBUG_PROTO (020) +/* Debug port actions. */ +#define DEBUG_PORT (040) +/* Debug configuration files. */ +#define DEBUG_CONFIG (0100) +/* Debug spool directory actions. */ +#define DEBUG_SPOOLDIR (0200) +/* Debug executions. */ +#define DEBUG_EXECUTE (0400) +/* Debug incoming data. */ +#define DEBUG_INCOMING (01000) +/* Debug outgoing data. */ +#define DEBUG_OUTGOING (02000) + +/* Maximum possible value for iDebug. */ +#define DEBUG_MAX (03777) + +/* Intializer for array of debug names. The index of the name in the + array is the corresponding bit position in iDebug. We only check + for prefixes, so these names only need to be long enough to + distinguish each name from every other. The last entry must be + NULL. The string "all" is also recognized to turn on all + debugging. */ +#define DEBUG_NAMES \ + { "a", "ch", "h", "u", "pr", "po", "co", "s", "e", "i", "o", NULL } + +/* The prefix to use to turn off all debugging. */ +#define DEBUG_NONE "n" + +/* Check whether a particular type of debugging is being done. */ +#define FDEBUGGING(i) ((iDebug & (i)) != 0) + +/* These macros are used to output debugging information. I use + several different macros depending on the number of arguments + because no macro can take a variable number of arguments and I + don't want to use double parentheses. */ +#define DEBUG_MESSAGE0(i, z) \ + do { if (FDEBUGGING (i)) ulog (LOG_DEBUG, (z)); } while (0) +#define DEBUG_MESSAGE1(i, z, a1) \ + do { if (FDEBUGGING (i)) ulog (LOG_DEBUG, (z), (a1)); } while (0) +#define DEBUG_MESSAGE2(i, z, a1, a2) \ + do { if (FDEBUGGING (i)) ulog (LOG_DEBUG, (z), (a1), (a2)); } while (0) +#define DEBUG_MESSAGE3(i, z, a1, a2, a3) \ + do \ + { \ + if (FDEBUGGING (i)) \ + ulog (LOG_DEBUG, (z), (a1), (a2), (a3)); \ + } \ + while (0) +#define DEBUG_MESSAGE4(i, z, a1, a2, a3, a4) \ + do \ + { \ + if (FDEBUGGING (i)) \ + ulog (LOG_DEBUG, (z), (a1), (a2), (a3), (a4)); \ + } \ + while (0) + +#else /* DEBUG <= 1 */ + +/* If debugging information is not being compiled, provide versions of + the debugging macros which just disappear. */ +#define DEBUG_MESSAGE0(i, z) +#define DEBUG_MESSAGE1(i, z, a1) +#define DEBUG_MESSAGE2(i, z, a1, a2) +#define DEBUG_MESSAGE3(i, z, a1, a2, a3) +#define DEBUG_MESSAGE4(i, z, a1, a2, a3, a4) + +#endif /* DEBUG <= 1 */ + +/* Functions. */ + +/* Given an unknown system name, return information for an unknown + system. If unknown systems are not permitted, this returns FALSE. + Otherwise, it translates the name as necessary for the spool + directory, and fills in *qsys. */ +extern boolean funknown_system P((pointer puuconf, const char *zsystem, + struct uuconf_system *qsys)); + +/* See whether a file belongs in the spool directory. */ +extern boolean fspool_file P((const char *zfile)); + +/* See if the current time matches a time span. If not, return FALSE. + Otherwise, return TRUE and set *pival and *pcretry to the values + from the matching element of the span. */ +extern boolean ftimespan_match P((const struct uuconf_timespan *qspan, + long *pival, int *pcretry)); + +/* 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 + returns the largest size that may be transferred at some time. */ +extern long cmax_size_ever P((const struct uuconf_timespan *qtimesize)); + +/* Send mail about a file transfer. */ +extern boolean fmail_transfer P((boolean fok, const char *zuser, + const char *zmail, const char *zwhy, + const char *zfrom, const char *zfromsys, + const char *zto, const char *ztosys, + const char *zsaved)); + +/* See whether a file is in one of a list of directories. The zpubdir + argument is used to pass the directory names to zsysdep_local_file. + If fcheck is FALSE, this does not check accessibility. Otherwise, + if freadable is TRUE, the user zuser must have read access to the + file and all appropriate directories; if freadable is FALSE zuser + must have write access to the appropriate directories. The zuser + argument may be NULL, in which case all users must have the + appropriate access (this is used for a remote request). */ +extern boolean fin_directory_list P((const char *zfile, + char **pzdirs, + const char *zpubdir, + boolean fcheck, + boolean freadable, + const char *zuser)); + +/* Parse a command string. */ +extern boolean fparse_cmd P((char *zcmd, struct scmd *qcmd)); + +/* Make a log entry. */ +#ifdef __GNUC__ +#define GNUC_VERSION __GNUC__ +#else +#define GNUC_VERSION 0 +#endif + +#if ANSI_C && HAVE_VFPRINTF +extern void ulog P((enum tlog ttype, const char *zfmt, ...)) +#if GNUC_VERSION > 1 + __attribute__ ((format (printf, 2, 3))) +#endif + ; +#else +extern void ulog (); +#endif + +#undef GNUC_VERSION + +/* Report an error returned by one of the uuconf routines. */ +extern void ulog_uuconf P((enum tlog ttype, pointer puuconf, + int iuuconf)); + +/* Set the function to call if a fatal error occurs. */ +extern void ulog_fatal_fn P((void (*pfn) P((void)))); + +/* If ffile is TRUE, send log entries to the log file rather than to + stderr. */ +extern void ulog_to_file P((pointer puuconf, boolean ffile)); + +/* Set the ID number used by the logging functions. */ +extern void ulog_id P((int iid)); + +/* Set the system name used by the logging functions. */ +extern void ulog_system P((const char *zsystem)); + +/* Set the system and user name used by the logging functions. */ +extern void ulog_user P((const char *zuser)); + +/* Set the device name used by the logging functions. */ +extern void ulog_device P((const char *zdevice)); + +/* Close the log file. */ +extern void ulog_close P((void)); + +/* Make an entry in the statistics file. */ +extern void ustats P((boolean fsucceeded, const char *zuser, + const char *zsystem, boolean fsent, + long cbytes, long csecs, long cmicros, + boolean fmaster)); + +/* Close the statistics file. */ +extern void ustats_close P((void)); + +#if DEBUG > 1 +/* A debugging routine to output a buffer. This outputs zhdr, the + buffer length clen, and the contents of the buffer in quotation + marks. */ +extern void udebug_buffer P((const char *zhdr, const char *zbuf, + size_t clen)); + +/* A debugging routine to make a readable version of a character. + This takes a buffer at least 5 bytes long, and returns the length + of the string it put into it (not counting the null byte). */ +extern size_t cdebug_char P((char *z, int ichar)); + +/* Parse a debugging option string. This can either be a number or a + comma separated list of debugging names. This returns a value for + iDebug. */ +extern int idebug_parse P((const char *)); + +#endif /* DEBUG <= 1 */ + +/* Copy one file to another. */ +extern boolean fcopy_file P((const char *zfrom, const char *zto, + boolean fpublic, boolean fmkdirs)); + +/* Copy an open file to another. */ +extern boolean fcopy_open_file P((openfile_t efrom, const char *zto, + boolean fpublic, boolean fmkdirs)); + +/* Translate escape sequences in a buffer, leaving the result in the + same buffer and returning the length. */ +extern size_t cescape P((char *zbuf)); + +/* Get a buffer to hold a string of a given size. The buffer should + be freed with ubuffree. */ +extern char *zbufalc P((size_t csize)); + +/* Call zbufalc to allocate a buffer and copy a string into it. */ +extern char *zbufcpy P((const char *z)); + +/* Free up a buffer returned by zbufalc or zbufcpy. */ +extern void ubuffree P((char *z)); + +/* Allocate memory without fail. */ +extern pointer xmalloc P((size_t)); + +/* Realloc memory without fail. */ +extern pointer xrealloc P((pointer, size_t)); + +/* Free memory (accepts NULL pointers, which some libraries erroneously + do not). */ +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[]; + +/* When a signal occurs, the signal handlers sets the appropriate + element of the arrays afSignal and afLog_signal to TRUE. The + afSignal array is used to check whether a signal occurred. The + afLog_signal array tells ulog to log the signal; ulog will clear + the element after logging it, which means that if a signal comes in + at just the right moment it will not be logged. It will always be + recorded in afSignal, though. At the moment we handle 5 signals: + SIGHUP, SIGINT, SIGQUIT, SIGTERM and SIGPIPE (the Unix code also + handles SIGALRM). If we want to handle more, the afSignal array + must be extended; I see little point to handling any of the other + ANSI C or POSIX signals, as they are either unlikely to occur + (SIGABRT, SIGUSR1) or nearly impossible to handle cleanly (SIGILL, + SIGSEGV). SIGHUP is only logged if fLog_sighup is TRUE. */ +#define INDEXSIG_SIGHUP (0) +#define INDEXSIG_SIGINT (1) +#define INDEXSIG_SIGQUIT (2) +#define INDEXSIG_SIGTERM (3) +#define INDEXSIG_SIGPIPE (4) +#define INDEXSIG_COUNT (5) + +extern volatile sig_atomic_t afSignal[INDEXSIG_COUNT]; +extern volatile sig_atomic_t afLog_signal[INDEXSIG_COUNT]; +extern boolean fLog_sighup; + +/* The names of the signals to use in error messages, as an + initializer for an array. */ +#define INDEXSIG_NAMES \ + { "hangup", "interrupt", "quit", "termination", "SIGPIPE" } + +/* Check to see whether we've received a signal. It would be nice if + we could use a single variable for this, but we sometimes want to + clear our knowledge of a signal and that would cause race + conditions (clearing a single element of the array is not a race + assuming that we don't care about a particular signal, even if it + occurs after we've examined the array). */ +#define FGOT_SIGNAL() \ + (afSignal[INDEXSIG_SIGHUP] || afSignal[INDEXSIG_SIGINT] \ + || afSignal[INDEXSIG_SIGQUIT] || afSignal[INDEXSIG_SIGTERM] \ + || afSignal[INDEXSIG_SIGPIPE]) + +/* If we get a SIGINT in uucico, we continue the current communication + session but don't start any new ones. This macros checks for any + signal other than SIGINT, which means we should get out + immediately. */ +#define FGOT_QUIT_SIGNAL() \ + (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; + +/* If not NULL, ulog calls this function before outputting anything. + This is used to support cu. */ +extern void (*pfLstart) P((void)); + +/* If not NULL, ulog calls this function after outputting everything. + This is used to support cu. */ +extern void (*pfLend) P((void)); diff --git a/gnu/libexec/uucp/contrib/Dial.Hayes b/gnu/libexec/uucp/contrib/Dial.Hayes new file mode 100644 index 000000000000..32eef82d347b --- /dev/null +++ b/gnu/libexec/uucp/contrib/Dial.Hayes @@ -0,0 +1,108 @@ +#!xchat +# @(#) dial.hayes V1.1 Tue Sep 1 13:59:58 1992 (Bob Denny) +# +# xchat script for dialing a vanilla Hayes modem +# +# Usage: +# xchat dial.hayes telno +# +# where telno is the telephone number, subject to pause and wait +# character modification. +# +# Uncomment the first two lines after "start:" to get debugging +# in file "Dial.Log" +# +# Flush input, zero counter, set telephone number if supplied, +# else fail if no telephone number given. +# +start: +### dbgfile Dial.Log +### dbgset 15 + zero + flush + ifnstr notelno 0 + telno 0 + goto initmodem +# +# Missing telephone number. +# +notelno: + logerr No telephone number given + failed +# +# Reset the modem to nonvolatile profile. +# Allow 3 sec. for response, as some modems are slow to reset. +# +initmodem: + count + ifgtr cantinit 4 + send ATZ\r + timeout initmodem 3000 + expect setupmodem OK +# +# No response from modem +# +cantinit: + logerr Can't wake modem + failed +# +# Send the stuff needed to initialize the modem to the modes +# needed for the particular modem flavor. The string below +# is provided as a vanilla example. Allow 2 sec. for the +# modem to respond to this command. +# +setupmodem: + sleep 1000 + send ATM0S7=90S11=120\r + timeout setupfail 2000 + expect setupfail ERROR + expect dialnumber OK +# +# Modem barfed or died on setup command. +# +setupfail: + logerr Error in modem setup string + failed +# +# Dial the supplied number. Handle the various errors that +# can come back from the modem by logging the error. +# +dialnumber: + sleep 1000 + send ATDT + dial + send \r + flush + timeout timeout 90000 + expect connected CONNECT + expect busy BUSY + expect nocarrier NO CARRIER + expect noanswer NO ANSWER + expect nodialtone NO DIALTONE +# +# Success! +# +connected: + success +# +# Handle modem dial failures +# +timeout: + logerr Modem or carrier timeout. + failed +busy: + logerr BUSY + failed +nocarrier: + logerr NO CARRIER + failed +noanswer: + logerr NO ANSWER + failed +nodialtone: + logerr NO DIALTONE + failed +# +# end +# + diff --git a/gnu/libexec/uucp/contrib/Hangup.Hayes b/gnu/libexec/uucp/contrib/Hangup.Hayes new file mode 100644 index 000000000000..c111c00fcaef --- /dev/null +++ b/gnu/libexec/uucp/contrib/Hangup.Hayes @@ -0,0 +1,57 @@ +#!xchat +# @(#) Hangup.Hayes V1.1 Tue Sep 1 14:04:25 1992 (Bob Denny) +# +# xchat script for hanging up a Hayes-type modem. When used with Taylor +# UUCP, this script should be run as the dialer-complete and dialer-abort +# script with xchat. +# +# Usage: +# xchat Hangup.Hayes [ x ] +# +# where 'x' is any string. If it is present, this script will log the +# modem reset as an ABORT reset, otherwise it will not log anything. +# +# Uncomment the lines starting with '###' to get debugging log. +# +start: +### dbgfile Hangup.Log +### dbgset 15 + zero + sleep 2000 # Wait for trailing garbage + flush # Toss it out + ifnstr wakemodem 0 # No abort indicator + log Hangup on abort +# +# Get modem's attention via Hayes 'escape' protocol. +# +wakemodem: + sleep 4000 + send +++ + sleep 4000 + send \r + timeout reset 2000 + expect reset OK +# +# We're (probably) in command mode. Use ATZ (reset) to hang up +# as some modems don't behave well with ATH0 command. +# +reset: + send ATZ\r + timeout silent 5000 + expect done OK +# +# Finished, modem is back in initial state. +# +done: + success +# +# No response to escape protocol. Log the error and force DTR low +# in an attempt to get control of the modem. Then send ATZ just to +# make sure. +# +silent: + logerr Hangup: no response from modem + hangup # Force DTR low as last gasp + send ATZ\r + sleep 5000 + failed diff --git a/gnu/libexec/uucp/contrib/Login.LAT b/gnu/libexec/uucp/contrib/Login.LAT new file mode 100644 index 000000000000..d557f97e2195 --- /dev/null +++ b/gnu/libexec/uucp/contrib/Login.LAT @@ -0,0 +1,137 @@ +#!xchat +# @(#) login.LAT V1.2 Tue Sep 1 13:25:28 1992 +# +# xchat script for logging into a VMS system through a LAT +# terminal server port. If no VMS password parameter supplied, +# skips password phase of VMS login. If LAT-password supplied, +# will log into LAT server using that password. NOTE: does not +# handle the situation where a LAT password is needed but no +# VMS password is needed. +# +# Usage: +# xchat login.LAT sysname username [ password [ LAT-password ] ] +# +# History: +# rbd Fri Aug 14 13:37:06 1992 +# Changes for Lantronix ETS-16. It says "type help at the Local> +# prompt..." then it gives the prompt for real! Prompt may need +# to be something other than "Local>". We match the real Local> +# prompt by matching the leading newline! +# +# rbd Tue Sep 1 13:04:32 1992 +# Remove absolute path name from log file. Now defaults per config. +# +start: + dbgfile Login.Log + dbgset 15 + sleep 2000 # Wait 2 seconds + flush # Flush typeahead + ifnstr svrstart 3 # Skip server password if not given +# +# Starting point if server password supplied. Handle situation +# where the server line may have been left waiting for username +# or at local> prompt. +# +getsvrpwp: + zero +l0: + count # Get server's password prompt + ifgtr deadmux 5 # die if 5 cr's don't do it + send \r + timeout l0 1000 # Wait and try again + expect dosvrpw ssword> + expect svrlogin ername> + expect connect \nLocal> +# +# Send server's password. Fail if don't get Username +# or Local> prompt. +# +dosvrpw: + zero +l2: + sendstr 3 + send \r + timeout badsvrpw 5000 # Die if invalid + expect svrlogin ername> + expect connect \nLocal> +# +# Starting point if NO server password supplied. Handle situation +# where the server line may have been left at local> prompt. +# +svrstart: + zero +l1: + count # Get username> or local> prompt + ifgtr deadmux 5 # Die if 5 cr's don't do it + send \r + timeout l1 1000 # Wait and try again + expect svrlogin ername> + expect connect \nLocal> +# +# Server asked for a username. Just give 'uucp'. +# +svrlogin: + send uucp\r + timeout deadmux 2000 + expect connect \nLocal> +# +# At this point, we have the Local> prompt. Send the connect +# command for the specified LAT host service name, and wait for +# VMS "Username:" prompt. Die after 10 seconds. +# +connect: + send c\s + sendstr 0 + send \r + timeout nologin 10000 + expect gotlogin ername: +# +# Got VMS "Username:" prompt. Send the username. If a password +# was given, wait for the "Password:" prompt. Die after 10 seconds. +# if no password was given, we're done! +# +gotlogin: + sendstr 1 + send \r + ifnstr done 2 + timeout nopasswd 10000 + expect gotpasswd ssword: +# +# Got VMS "Password:" prompt. Send the password and we're done! +# +gotpasswd: + sendstr 2 + send \r +# +# Success! +# +done: + success +# +# ERROR HANDLERS +# +# +# LAT server appears dead. Fail. +# +deadmux: + logerr No response from LAT server + failed +# +# The server password was bad. Fail. +# +badsvrpw: + logerr Invalid LAT server password + failed +# +# VMS system appears to be dead. Fail. +# +nologin: + logerr No VMS Username: prompt + failed +# +# Failed to get "Password:" prompt. Fail. +# +nopasswd: + logerr No VMS Password: prompt. Invalid password? + failed + diff --git a/gnu/libexec/uucp/contrib/Login.PortSel b/gnu/libexec/uucp/contrib/Login.PortSel new file mode 100644 index 000000000000..d8c3a6643a66 --- /dev/null +++ b/gnu/libexec/uucp/contrib/Login.PortSel @@ -0,0 +1,133 @@ +#!xchat +# @(#) Login.PortSelUnix V1.0 Tue Sep 1 14:57:05 1992 (Bob Denny) +# +# NOTE: Untested with xchat V1.1. Taken from DECUS UUCP. +# +# From: "Kent C. Brodie" <moocow!brodie@CSD4.MILW.WISC.EDU> +# uucp: {uunet!marque,csd4.milw.wisc.edu}!moocow!brodie +# special script for "uwmcsd4", have to go through a port selector (and then +# log in via standard Unix procedures). +# +# Also included is the ability to wait in the port selector queue. +# Be forwarned that the debug log can get pretty big depending on +# how many times you "wait" in the queue. +# (C) 1989 Kent C. Brodie - Medical College of Wisconsin + +# P0 is systemname , P1 is username, P2 is password. + + zero + +# send a CR to get the selector's attention. Sleep a little bit +# due to large login text of selector. It sends "Which System?" +# when it's ready. + +getprtslct: + count + ifgtr noprtslct 6 + break + send \r + sleep 2000 + flush + expect prtslctok ystem? + timeout getprtslct 15000 + +noprtslct: + logerr Sent cr, no "Which System?" from port selector + failed + +# Send the system name. We either get "OK" (connected), or we +# get "No ports available, would you like to wait?" (wait in queue) + +prtslctok: + zero + sendstr 0 + send \r + expect connected OK + expect prtslctwait wait? + timeout noconnect 10000 + +# Usually we get "nn Your place in queue" messages. JUST in case we +# get a free port right away, check for 'Are you ready?' as well. + +prtslctwait: + zero + send Y\r + expect prtslctque queue + expect prtslctrdy ready? + timeout prtwaitbad 70000 + +prtwaitbad: + logerr Sent "Y" to wait in queue, did not get valid response. + failed + +# Here's where we wait in the queue. The port selector sends us a status +# message about once a minute. We either get "nn Your place in queue" +# or we get "System Available. Are you Ready?". +# If something goes wrong, we time out waiting for either response. +# The reason we don't sleep for 40-50 seconds is because as SOON as the +# port is ready, it informs us. If we wait too long, it drops us. +# This setup is laid out for a maximum of 20 "tries" which is ABOUT +# 20 minutes. Note: This constant retrying can make log files +# kind of big.... + +prtslctque: + count + ifgtr prtslcttry 20 + expect prtslctque queue + expect prtslctrdy ready? + timeout noportwait 70000 + +prtslcttry: + logerr Too many (20) wait/retries -- queue too busy. + failed + +prtslctrdy: + send Y\r + expect connected OK + timeout noconnect 20000 + + +noportwait: + logerr Timed out awaiting place in port queue + failed + +noconnect: + logerr Sent system name, no "OK" from selector + failed + +# standard Unix login stuff. Send cr, expect "ogin:", if no, send a break +# (which tells Unix to try the next bit rate) and try again. + +connected: + send \r + zero + goto waitlogin + +sendbreak: + count + ifgtr nolgi 6 + flush + break + +waitlogin: + expect gotlogin ogin: + timeout sendbreak 5000 + +nolgi: + logerr No login: prompt + failed + +gotlogin: + sendstr 1 + send \r + expect gotword word: + timeout nopwd 10000 + +nopwd: + logerr No password: prompt + failed + +gotword: + sendstr 2 + send \r + success diff --git a/gnu/libexec/uucp/contrib/Login.VMS b/gnu/libexec/uucp/contrib/Login.VMS new file mode 100644 index 000000000000..d6196cb2aa64 --- /dev/null +++ b/gnu/libexec/uucp/contrib/Login.VMS @@ -0,0 +1,96 @@ +#!xchat +# @(#) Login.VMS V1.1 Tue Sep 1 13:24:54 1992 (Bob Denny) +# +# +# xchat script for logging into a VMS system. If no VMS password +# parameter supplied, skips password phase of VMS login. If syspass +# parameter given, will go through steps needed to log into a VMS +# system where a "system password" was set on the port. +# +# Cannot handle situation where system password is required but +# no password needed. +# +# +# Usage: +# xchat Login.VMS username [ password [ syspass ] ] +# +# Uncomment the lines starting with "###" to get debug logging. +# +start: +### dbgfile Login.Log +### dbgset 15 + sleep 2000 # Wait 2 seconds + zero + flush # Flush typeahead + ifnstr login 2 # Skip sys passwd if not given +# +# Need system password. Send <CR> to get bell. +# Try 5 times at 2 sec. intervals. Skip to do +# username if we see "Username:". +# +syspass: + count + ifgtr nobell 5 # Fail after 5 tries + send \r + timeout syspass 2000 # Wait 2 sec. and try again + expect gotbell \007 + expect gotlogin Username: +# +# Got the bell. Send the system password. Repeat 5 times +# at 2 sec. intervals. Fail if we don't get Username: +# +gotbell: + zero + sleep 2000 +l1: + count + ifgtr nologin 5 # Fail after 5 tries + sendstr 2 + send \r + timeout l1 2000 # Wait 2 sec. and try again + expect gotlogin Username: +# +# Start here if no system password supplied. +# Send <CR> until we get Username: Try 5 times at 2 sec. intervals. +# +login: + count + ifgtr nologin 5 # Fail after 5 tries + send \r + timeout login 2000 # Wait 2 sec. and try again + expect gotlogin Username: +# +# Got VMS "Username:" prompt. Send the username. If a password +# was given, wait for the "Password:" prompt. Die after 10 seconds. +# if no password was given, we're done! +# +gotlogin: + sendstr 0 + send \r + ifnstr done 1 + timeout nopasswd 10000 + expect gotpasswd Password: +# +# Got VMS "Password:" prompt. Send the password and we're done! +# +gotpasswd: + sendstr 1 + send \r +# +# Success! +# +done: + success +# +# ERROR HANDLERS +# +nobell: + logerr No VMS system password prompt (bell) + failed +nologin: + logerr No VMS Username: prompt + failed +nopasswd: + logerr No VMS Password: prompt. + failed + diff --git a/gnu/libexec/uucp/contrib/Makefile.uurt b/gnu/libexec/uucp/contrib/Makefile.uurt new file mode 100644 index 000000000000..235fcca889f8 --- /dev/null +++ b/gnu/libexec/uucp/contrib/Makefile.uurt @@ -0,0 +1,30 @@ +# +# Makefile for uurate 1.0 +# + +# Where uurate is installed +BIN=/usr/local/bin + +# Flags to use when compiling uurate +CFLAGS=-I.. + +CC=cc +SHELL=/bin/sh +PROGS=uurate + +#----------- + +all: $(PROGS) + +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 + +clean: + rm -f $(PROGS) core diff --git a/gnu/libexec/uucp/contrib/Makefile.xchat b/gnu/libexec/uucp/contrib/Makefile.xchat new file mode 100644 index 000000000000..5e9aaa8ffedb --- /dev/null +++ b/gnu/libexec/uucp/contrib/Makefile.xchat @@ -0,0 +1,31 @@ +# +# Makefile for xchat 1.1 +# +# Bob Denny - Tue Sep 1 15:58:22 1992 +# +CC=cc +SHELL=/bin/sh +BIN=/usr/local/lib/uucp +PROGS=xchat + +#----------- + +all: $(PROGS) + +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 + +clean: + rm -f $(PROGS) core + + + + + diff --git a/gnu/libexec/uucp/contrib/README b/gnu/libexec/uucp/contrib/README new file mode 100644 index 000000000000..c4105ed03868 --- /dev/null +++ b/gnu/libexec/uucp/contrib/README @@ -0,0 +1,46 @@ +This is the README file for the Taylor UUCP contrib directory. + +This directory contains contributed shell scripts and programs that +you may find useful. + +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 + driven by scripts which are written in its own little language. + It is a powerful program that can add a lot of flexibility to your + chat scripts. + +Dial.Hayes, Hangup.Hayes, Login.LAT, Login.PortSel, Login.VMS: + Sample scripts for xchat. + +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. + +uutraf: + Another program to produce neat reports from your log files, this + one a perl script by Johan Vromans. + +savelog.sh, savelog.man: + A handy shell script to rename a log file and cycle old versions + through a set of names, throwing away the oldest one. It will + also optionally compress the old log files. I believe that this + 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. + +stats.sh: + A gawk script by Zacharias Beckman which reads the Stats file and + prints the last 80 lines as a nicely formatted table. + +uuq.sh: + A uuq workalike shell script by Zacharias Beckman. + +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 + tstuu with the system UUCP on Ultrix 4.0, for reasons that escape + me. Most people will have little use for this. diff --git a/gnu/libexec/uucp/contrib/README-UURATE b/gnu/libexec/uucp/contrib/README-UURATE new file mode 100644 index 000000000000..2cc361ce26fb --- /dev/null +++ b/gnu/libexec/uucp/contrib/README-UURATE @@ -0,0 +1,20 @@ +uurate V1.2 - Gather and display Taylor UUCP traffic statistics + +Bob Denny (denny@alisa.com) - Thu Sep 3 19:47:41 1992 + +See the man page for documentation. + +Installation: +------------ + +(1) Copy 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). + +(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/README-XCHAT b/gnu/libexec/uucp/contrib/README-XCHAT new file mode 100644 index 000000000000..5f93a284bda6 --- /dev/null +++ b/gnu/libexec/uucp/contrib/README-XCHAT @@ -0,0 +1,42 @@ +This is xchat V1.1 (Tue Sep 1 15:50:56 1992) + +Introduction: +------------ + +Xchat is a general-purpose dialing and login program designed for use +with Taylor UUCP as a "chat-program", taking the place (or augmenting) +the built-in chat scripting facility. It provides the ability to +closely control timeouts, multiple simultaneous expect strings with +separate actions, extended terminal control, modem command character +pacing, and more. + +When used in conjunction with Taylor UUCP's configuration features, +xchat can provide you the ability to manage the most intricate login, +dial and hangup needs. The scripts are written in a shell-like (well, +sort-of) style with labels, commands, and parameters, easing the task +of writing procedures for complex terminal communications situations. + +Installation: +------------ + +(1) Copy xc-conf.h-dist to xc-conf.h, then edit xc-conf.h to reflect + your condifuration. A description of the settings is in that file. + +(2) Copy Makefile.xchat to Makefile and edit it to set BIN to where + you want xchat installed. + +(2) Do a 'make' to build xchat. + +(3) Do a 'make install' to install it. + +(4) Format and print xchat.8, and install it if you want. + +(5) Print out copies of the scripts in the ./scripts subdirectory. + +(6) Read xchat.8 and the scripts together. + + +Author: +------ + +Robert B. Denny (denny@alisa.com) diff --git a/gnu/libexec/uucp/contrib/savelog.man b/gnu/libexec/uucp/contrib/savelog.man new file mode 100644 index 000000000000..919b94f4ec11 --- /dev/null +++ b/gnu/libexec/uucp/contrib/savelog.man @@ -0,0 +1,130 @@ +.\" @(#)man/man8/savelog.an 1.2 24 Oct 1990 05:18:46 +.de pP +.if n .sp 1 +.if t .sp .4 +.. +.de tP +.pP +.ta \\n(pDu +.ti -\\n(pDu +.. +.TH SAVELOG X_MAN8_EXT_X "31 January 1988" "Local" +.SH NAME +savelog \- cycle and truncate log files +.SH SYNOPSIS +.na +.B X_UTIL_BIN_DIR_X/savelog +[ +.B \-m +.I mode +] [ +.B \-u +.I user +] [ +.B \-g +.I group +] [ +.B \-c +.I cycle +] [ +.B \-t +] [ +.B \-l +] +.I logfile +.br +.ad +.SH DESCRIPTION +The +.I savelog +command renames and optionally compresses a log file and cycles it +through a set of names based on the original log file, removing the +last name in the cycle. +.SH OPTIONS +The +.I savelog +command accepts the following options: +.TP +\fB\-m\fP \fImode\fP +Change the permissions mode for renamed log files to +.IR mode . +By default the mode is unchanged. +.TP +\fB\-u\fP \fIuser\fP +Change the owner for renamed log files to +.IR user . +By default the owner is unchanged. +.TP +\fB\-g\fP \fIgroup\fP +Change the group for renamed log files to +.IR group . +By default the group is unchanged. +.TP +\fB\-c\fP \fIcycle\fP +Save +.I cycle +versions of the logfile, where +.I cycle +is a decimal number. The default value is 7. +.TP +.B \-l +Do not compress log files. By default, a compression program is used, +if one is available. +.TP +.B \-t +Ensure that a new logfile exists when the savelog operation is +complete. Use of +.BR \-m , +.BR \-u +or +.BR \-g +imply this, ensuring that the logfile will have the designated mode. +.SH "OPERATION" +The given logfile is cycled through files named: +.RS + +OLD/\fIfile\fP.\fInumber\fP + +.RE +where +.I file +is the basename for the logfile and where +.I number +ranges from 0 to one less then the +.I cycle +count specified for the command. +The +.I OLD +dirctory is created, as necessary, and is under the same directory as +the logfile itself. +.PP +This cycle operation is accomplished by renaming the file numbered +.IR cycle -2 +to a file numbered +.IR cycle -1 +and so on until the file numbered 0 is renamed to the file numbered 1. +If compression is being used, the first cycle file is compressed after +being renamed to cycle 1. After the cycle files are moved through the +various names, the filefile itself is moved to the cycle 0 file. +This cycle normally occurs once every time +.I savelog +is executed. +If the log file does not exist, savelog ignores it and does +not cycle the OLD files. +.PP +If compression is being used, then compressed log files will have an +additional suffix appropriate for the compression program that is +used. +.SH "SEE ALSO" +.IR smail (X_MAN5_EXT_X) +and +.IR smail (X_MAN8_EXT_X). +.SH COPYRIGHT +Copyright(C)1987, 1988 Ronald S. Karr and Landon Curt Noll +.br +See a file COPYING, +distributed with the source code, +or type +.I "smail \-bc" +for distribution rights and restrictions +associated with this software. diff --git a/gnu/libexec/uucp/contrib/savelog.sh b/gnu/libexec/uucp/contrib/savelog.sh new file mode 100755 index 000000000000..64c989f292b2 --- /dev/null +++ b/gnu/libexec/uucp/contrib/savelog.sh @@ -0,0 +1,247 @@ +#! /bin/sh +# @(#)util/savelog.sh 1.4 26 Oct 1991 22:49:39 +# +# savelog - save a log file +# +# Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll +# +# See the file COPYING, distributed with smail, for restriction +# and warranty information. +# +# usage: savelog [-m mode] [-u user] [-g group] [-t] [-c cycle] [-l] file... +# +# -m mode - chmod log files to mode +# -u user - chown log files to user +# -g group - chgrp log files to group +# -c cycle - save cycle versions of the logfile (default: 7) +# -t - touch file +# -l - don't compress any log files (default: compress) +# file - log file names +# +# The savelog command saves and optionally compresses old copies of files +# into an 'dir'/OLD sub-directory. The 'dir' directory is determined from +# the directory of each 'file'. +# +# Older version of 'file' are named: +# +# OLD/'file'.<number><compress_suffix> +# +# where <number> is the version number, 0 being the newest. By default, +# version numbers > 0 are compressed (unless -l prevents it). The +# version number 0 is never compressed on the off chance that a process +# still has 'file' opened for I/O. +# +# If the 'file' does not exist or if it is zero length, no further processing +# is performed. However if -t was also given, it will be created. +# +# For files that do exist and have lengths greater than zero, the following +# actions are performed. +# +# 1) Version numered files are cycled. That is version 6 is moved to +# version 7, version is moved to becomes version 6, ... and finally +# version 0 is moved to version 1. Both compressed names and +# uncompressed names are cycled, regardless of -t. Missing version +# files are ignored. +# +# 2) The new OLD/file.1 is compressed and is changed subject to +# the -m, -u and -g flags. This step is skipped if the -t flag +# was given. +# +# 3) The main file is moved to OLD/file.0. +# +# 4) If the -m, -u, -g or -t flags are given, then file is created +# (as an empty file) subject to the given flags. +# +# 5) The new OLD/file.0 is chanegd subject to the -m, -u and -g flags. +# +# Note: If the OLD sub-directory does not exist, it will be created +# with mode 0755. +# +# Note: If no -m, -u or -g flag is given, then the primary log file is +# not created. +# |