tip(1) can do cu(1). We don't need this anymore.
This commit is contained in:
parent
3528d68f71
commit
c4ebcaa7ca
gnu
Makefile
libexec
MakefileMakefile.inc
uucp
COPYINGMakefileMakefile.inc
common_sources
chat.cconfig.hconn.cconn.hcopy.ccu.hgetopt.hlog.cpolicy.hprot.cprot.hsysdep.hsystem.huuconf.huucp.huudefs.h
cu
libunix
Makefilebasnam.ccusub.cefopen.cepopen.cinit.cisdir.cisfork.ciswait.clock.cloctim.cmail.cmkdirs.cpause.cpipe.cportnm.cproctm.cserial.csignal.csindir.csleep.cspawn.csync.ctcp.ctime.cufopen.cuid.c
libuuconf
COPYING.LIBMakefileaddblk.caddstr.callblk.calloc.calloc.hbase.cbool.ccallin.ccalout.cchatc.ccmdarg.ccmdfil.ccmdlin.cdebfil.cdeblev.cdiacod.cdial.cdiasub.cdnams.cerrno.cerrstr.cfilnam.cfreblk.cfredia.cfree.cfreprt.cfresys.cgrdcmp.chdial.chdnams.chinit.chlocnm.chport.chrmunk.chsinfo.chsnams.chsys.chunk.ciniglb.cinit.cint.clckdir.clineno.cllocnm.clocal.clocnm.c
@ -1,6 +1,6 @@
|
||||
# @(#)Makefile 5.33.1.1 (Berkeley) 5/6/91
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= include lib libexec usr.bin usr.sbin
|
||||
SUBDIR= include lib usr.bin usr.sbin
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
@ -1,7 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.if !defined(NOUUCP)
|
||||
SUBDIR= uucp
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
@ -1,3 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
BINDIR?= /usr/libexec
|
@ -1,339 +0,0 @@
|
||||
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.
|
@ -1,6 +0,0 @@
|
||||
# This is the Makefile for Taylor UUCP
|
||||
# $FreeBSD$
|
||||
|
||||
SUBDIR= libunix libuucp libuuconf cu
|
||||
|
||||
.include <bsd.subdir.mk>
|
@ -1,32 +0,0 @@
|
||||
.if exists(${.OBJDIR}/../libunix)
|
||||
LIBUNIX= $(.OBJDIR)/../libunix/libunix.a
|
||||
.else
|
||||
LIBUNIX= $(.CURDIR)/../libunix/libunix.a
|
||||
.endif
|
||||
|
||||
.if exists(${.OBJDIR}/../libuuconf)
|
||||
LIBUUCONF= $(.OBJDIR)/../libuuconf/libuuconf.a
|
||||
.else
|
||||
LIBUUCONF= $(.CURDIR)/../libuuconf/libuuconf.a
|
||||
.endif
|
||||
|
||||
.if exists(${.OBJDIR}/../libuucp)
|
||||
LIBUUCP= $(.OBJDIR)/../libuucp/libuucp.a
|
||||
.else
|
||||
LIBUUCP= $(.CURDIR)/../libuucp/libuucp.a
|
||||
.endif
|
||||
|
||||
VERSION= 1.06.1
|
||||
owner= uucp
|
||||
group= uucp
|
||||
bindir= /usr/bin
|
||||
sbindir= /usr/sbin
|
||||
libxdir= /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
|
File diff suppressed because it is too large
Load Diff
@ -1,481 +0,0 @@
|
||||
/* config.h. Generated automatically by configure. */
|
||||
/* Configuration header file for Taylor UUCP. -*- C -*- */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/* If your compiler does not use const correctly, then undefine it
|
||||
here. This #undef is commented out by the configure script if it
|
||||
determines that const is supported. */
|
||||
/* #undef const */
|
||||
|
||||
/* If your compiler supports prototypes, set HAVE_PROTOTYPES to 1. */
|
||||
#define HAVE_PROTOTYPES 1
|
||||
|
||||
/* Set ECHO_PROGRAM to a program which echoes its arguments; if echo
|
||||
is a shell builtin you can just use "echo". */
|
||||
#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_STDARG_H 1 /* <stdarg.h> */
|
||||
#define HAVE_STRING_H 1 /* <string.h> */
|
||||
#define HAVE_STRINGS_H 1 /* <strings.h> */
|
||||
#define HAVE_UNISTD_H 1 /* <unistd.h> */
|
||||
#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_TERMIOS_H 1 /* <termios.h> */
|
||||
#define HAVE_SYS_PARAM_H 1 /* <sys/param.h> */
|
||||
#define HAVE_UTIME_H 1 /* <utime.h> */
|
||||
#define HAVE_FCNTL_H 1 /* <fcntl.h> */
|
||||
#define HAVE_SYS_FILE_H 1 /* <sys/file.h> */
|
||||
#define HAVE_SYS_TIME_H 1 /* <sys/time.h> */
|
||||
#define HAVE_SYS_TIMES_H 1 /* <sys/times.h> */
|
||||
#define HAVE_LIBC_H 0 /* <libc.h> */
|
||||
#define HAVE_SYSEXITS_H 1 /* <sysexits.h> */
|
||||
#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> */
|
||||
#define HAVE_SYS_MOUNT_H 1 /* <sys/mount.h> */
|
||||
#define HAVE_SYS_VFS_H 0 /* <sys/vfs.h> */
|
||||
#define HAVE_SYS_FILSYS_H 0 /* <sys/filsys.h> */
|
||||
#define HAVE_SYS_STATFS_H 0 /* <sys/statfs.h> */
|
||||
#define HAVE_SYS_DUSTAT_H 0 /* <sys/dustat.h> */
|
||||
#define HAVE_SYS_FS_TYPES_H 0 /* <sys/fs_types.h> */
|
||||
#define HAVE_USTAT_H 0 /* <ustat.h> */
|
||||
#define HAVE_SYS_STATVFS_H 0 /* <sys/statvfs.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
|
||||
|
||||
/* If the macro S_ISDIR is defined in <sys/stat.h>, but is incorrect,
|
||||
define STAT_MACROS_BROKEN to be 1. This is said to be the case on
|
||||
Tektronix UTekV, Amdahl UTS and Motorola System V/88. */
|
||||
#define STAT_MACROS_BROKEN 0
|
||||
|
||||
/* Set TIME_WITH_SYS_TIME to 1 if <time.h> and <sys/time.h> can both
|
||||
be included in a single source file; if you don't have either or
|
||||
both of them, it doesn't matter what you set this to. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Set TM_IN_SYS_TIME to 1 if struct tm is defined in <sys/time.h>
|
||||
rather than in <time.h>. */
|
||||
#define TM_IN_SYS_TIME 0
|
||||
|
||||
/* Set HAVE_TERMIOS_AND_SYS_IOCTL_H to 1 if <termios.h> and <sys/ioctl.h>
|
||||
can both be included in a single source file; if you don't have either
|
||||
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 1
|
||||
|
||||
/* 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_STATFS3_OSF1 three argument statfs function (OSF/1)
|
||||
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_DISK_SPACE disk_space function (QNX)
|
||||
STAT_USTAT the ustat function with 512 byte blocks. */
|
||||
#define STAT_STATVFS 0
|
||||
#define STAT_STATFS3_OSF1 0
|
||||
#define STAT_STATFS2_BSIZE 1
|
||||
#define STAT_STATFS2_FSIZE 0
|
||||
#define STAT_STATFS2_FS_DATA 0
|
||||
#define STAT_STATFS4 0
|
||||
#define STAT_DISK_SPACE 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
|
||||
|
||||
/* Set HAVE_TXADDCD to 1 if TXADDCD is defined in <sys/ioctl.h>, as it
|
||||
is on AIX. */
|
||||
#define HAVE_TXADDCD 0
|
||||
|
||||
/* Set HAVE_SOCKADDR_SA_LEN to 1 if struct sockaddr has sa_len member. */
|
||||
#define HAVE_SOCKADDR_SA_LEN 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
|
||||
#define HAVE_SETEUID 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 */
|
||||
#define HAVE_STRTOUL 1 /* strtou.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
|
||||
|
||||
/* If neither of these functions exists, you should add getaddrinfo.o to
|
||||
lib/Makefile. */
|
||||
#define HAVE_GETADDRINFO 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 1
|
||||
#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 1
|
||||
|
||||
/* The code will use one of the following functions when detaching
|
||||
from a terminal. One of these must exist. */
|
||||
#define HAVE_SETPGRP 1
|
||||
#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 1
|
||||
|
||||
/* The code will try to use each of the following functions in turn to
|
||||
determine the current time. If none are available, it will use
|
||||
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
|
||||
|
||||
/* If the dev_info function is available (QNX only), it will be used
|
||||
to determine if any other process has the serial port open, and
|
||||
that will cause uucico and cu to presume the port is locked. */
|
||||
#define HAVE_DEV_INFO 0
|
||||
|
||||
/* That's the end of the list of the functions. Now there are a few
|
||||
last miscellaneous items. */
|
||||
|
||||
/* 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 1
|
||||
/* 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. If you are configuring
|
||||
by hand, you may add appropriate definitions here, or just add them
|
||||
to CFLAGS when running make. */
|
||||
/* #undef _ALL_SOURCE */
|
||||
/* #undef _POSIX_SOURCE */
|
||||
/* #undef _MINIX */
|
||||
/* #undef _POSIX_1_SOURCE */
|
@ -1,587 +0,0 @@
|
||||
/* conn.c
|
||||
Connection routines for the Taylor UUCP package.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char conn_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "uuconf.h"
|
||||
#include "conn.h"
|
||||
|
||||
/* 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, in which case ttype is the type of port to
|
||||
use. */
|
||||
|
||||
boolean
|
||||
fconn_init (qport, qconn, ttype)
|
||||
struct uuconf_port *qport;
|
||||
struct sconnection *qconn;
|
||||
enum uuconf_porttype ttype;
|
||||
{
|
||||
qconn->qport = qport;
|
||||
switch (qport == NULL ? ttype : 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
|
||||
case UUCONF_PORTTYPE_PIPE:
|
||||
return fsysdep_pipe_init (qconn);
|
||||
default:
|
||||
ulog (LOG_ERROR, "Unknown or unsupported 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);
|
||||
|
||||
/* Ignore any SIGHUP we may have gotten, and make sure any signal
|
||||
reporting has been done before we reset fLog_sighup. */
|
||||
afSignal[INDEXSIG_SIGHUP] = FALSE;
|
||||
ulog (LOG_ERROR, (const char *) NULL);
|
||||
fLog_sighup = TRUE;
|
||||
|
||||
ulog_device ((const char *) NULL);
|
||||
|
||||
return fret;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
/* Run through a dialer sequence. The pzdialer argument is a list of
|
||||
strings, which are considered in dialer/token pairs. The dialer
|
||||
string names a dialer to use. The token string is what \D and \T
|
||||
in the chat script expand to. If there is no token for the last
|
||||
dialer, the zphone argument is used. The qdialer argument is
|
||||
filled in with information for the first dialer, and *ptdialerfound
|
||||
is set to whether the information should be freed or not. However,
|
||||
if *ptdialerfound is not DIALERFOUND_FALSE when this function is
|
||||
called, then the information for the first dialer is already in
|
||||
qdialer. */
|
||||
|
||||
boolean
|
||||
fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone, qdialer,
|
||||
ptdialerfound)
|
||||
struct sconnection *qconn;
|
||||
pointer puuconf;
|
||||
char **pzdialer;
|
||||
const struct uuconf_system *qsys;
|
||||
const char *zphone;
|
||||
struct uuconf_dialer *qdialer;
|
||||
enum tdialerfound *ptdialerfound;
|
||||
{
|
||||
const char *zname;
|
||||
boolean ffirst, ffreefirst;
|
||||
|
||||
if (qconn->qport == NULL)
|
||||
zname = NULL;
|
||||
else
|
||||
zname = qconn->qport->uuconf_zname;
|
||||
ffirst = TRUE;
|
||||
ffreefirst = FALSE;
|
||||
while (*pzdialer != NULL)
|
||||
{
|
||||
struct uuconf_dialer *q;
|
||||
struct uuconf_dialer s;
|
||||
const char *ztoken;
|
||||
boolean ftranslate;
|
||||
|
||||
if (! ffirst)
|
||||
q = &s;
|
||||
else
|
||||
q = qdialer;
|
||||
|
||||
if (! ffirst || *ptdialerfound == DIALERFOUND_FALSE)
|
||||
{
|
||||
int iuuconf;
|
||||
|
||||
iuuconf = uuconf_dialer_info (puuconf, *pzdialer, q);
|
||||
if (iuuconf == UUCONF_NOT_FOUND)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s: Dialer not found", *pzdialer);
|
||||
if (ffreefirst)
|
||||
(void) uuconf_dialer_free (puuconf, qdialer);
|
||||
return FALSE;
|
||||
}
|
||||
else if (iuuconf != UUCONF_SUCCESS)
|
||||
{
|
||||
ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
|
||||
if (ffreefirst)
|
||||
(void) uuconf_dialer_free (puuconf, qdialer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ffirst)
|
||||
{
|
||||
*ptdialerfound = DIALERFOUND_FREE;
|
||||
ffreefirst = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
++pzdialer;
|
||||
ztoken = *pzdialer;
|
||||
|
||||
ftranslate = FALSE;
|
||||
if (ztoken == NULL
|
||||
|| strcmp (ztoken, "\\D") == 0)
|
||||
ztoken = zphone;
|
||||
else if (strcmp (ztoken, "\\T") == 0)
|
||||
{
|
||||
ztoken = zphone;
|
||||
ftranslate = TRUE;
|
||||
}
|
||||
|
||||
if (! fchat (qconn, puuconf, &q->uuconf_schat, qsys, q, ztoken,
|
||||
ftranslate, zname, iconn_baud (qconn)))
|
||||
{
|
||||
if (q == &s)
|
||||
(void) uuconf_dialer_free (puuconf, q);
|
||||
if (ffreefirst)
|
||||
(void) uuconf_dialer_free (puuconf, qdialer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ffirst)
|
||||
ffirst = FALSE;
|
||||
else
|
||||
(void) uuconf_dialer_free (puuconf, q);
|
||||
|
||||
if (*pzdialer != NULL)
|
||||
++pzdialer;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Modem dialing routine. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
fmodem_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound)
|
||||
struct sconnection *qconn;
|
||||
pointer puuconf;
|
||||
const struct uuconf_system *qsys;
|
||||
const char *zphone;
|
||||
struct uuconf_dialer *qdialer;
|
||||
enum tdialerfound *ptdialerfound;
|
||||
{
|
||||
char **pzdialer;
|
||||
|
||||
*ptdialerfound = DIALERFOUND_FALSE;
|
||||
|
||||
pzdialer = qconn->qport->uuconf_u.uuconf_smodem.uuconf_pzdialer;
|
||||
if (pzdialer != NULL && *pzdialer != NULL)
|
||||
{
|
||||
int iuuconf;
|
||||
boolean fret;
|
||||
|
||||
iuuconf = uuconf_dialer_info (puuconf, *pzdialer, qdialer);
|
||||
if (iuuconf == UUCONF_NOT_FOUND)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s: Dialer not found", *pzdialer);
|
||||
return FALSE;
|
||||
}
|
||||
else if (iuuconf != UUCONF_SUCCESS)
|
||||
{
|
||||
ulog_uuconf (LOG_ERROR, puuconf, iuuconf);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*ptdialerfound = DIALERFOUND_FREE;
|
||||
|
||||
fret = (fsysdep_modem_begin_dial (qconn, qdialer)
|
||||
&& fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
|
||||
qdialer, ptdialerfound)
|
||||
&& fsysdep_modem_end_dial (qconn, qdialer));
|
||||
|
||||
if (! fret)
|
||||
(void) uuconf_dialer_free (puuconf, qdialer);
|
||||
|
||||
return fret;
|
||||
}
|
||||
else if (qconn->qport->uuconf_u.uuconf_smodem.uuconf_qdialer != NULL)
|
||||
{
|
||||
struct uuconf_dialer *q;
|
||||
const char *zname;
|
||||
|
||||
q = qconn->qport->uuconf_u.uuconf_smodem.uuconf_qdialer;
|
||||
*qdialer = *q;
|
||||
*ptdialerfound = DIALERFOUND_TRUE;
|
||||
|
||||
if (qconn->qport == NULL)
|
||||
zname = NULL;
|
||||
else
|
||||
zname = qconn->qport->uuconf_zname;
|
||||
|
||||
return (fsysdep_modem_begin_dial (qconn, q)
|
||||
&& fchat (qconn, puuconf, &q->uuconf_schat, qsys, q,
|
||||
zphone, FALSE, zname, iconn_baud (qconn))
|
||||
&& fsysdep_modem_end_dial (qconn, q));
|
||||
}
|
||||
else
|
||||
{
|
||||
ulog (LOG_ERROR, "No dialer information");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
@ -1,319 +0,0 @@
|
||||
/* conn.h
|
||||
Header file for routines which manipulate connections.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#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));
|
||||
/* 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. If qport is NULL, this opens standard input as a port
|
||||
using type ttype. This function returns FALSE on error. */
|
||||
extern boolean fconn_init P((struct uuconf_port *qport,
|
||||
struct sconnection *qconn,
|
||||
enum uuconf_porttype ttype));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* Run through a dialer sequence. This is a support routine for the
|
||||
port type specific dialing routines. */
|
||||
extern boolean fconn_dial_sequence P((struct sconnection *qconn,
|
||||
pointer puuconf, char **pzdialer,
|
||||
const struct uuconf_system *qsys,
|
||||
const char *zphone,
|
||||
struct uuconf_dialer *qdialer,
|
||||
enum tdialerfound *ptdialerfound));
|
||||
|
||||
/* Dialing out on a modem is partially system independent. This is
|
||||
the modem dialing routine. */
|
||||
extern boolean fmodem_dial P((struct sconnection *qconn, pointer puuconf,
|
||||
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
|
||||
extern boolean fsysdep_pipe_init P((struct sconnection *qconn));
|
||||
|
||||
#endif /* ! defined (CONN_H) */
|
@ -1,236 +0,0 @@
|
||||
/* copy.c
|
||||
Copy one file to another for the UUCP package.
|
||||
|
||||
Copyright (C) 1991, 1992, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char copy_rcsid[] = "$FreeBSD$";
|
||||
#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, fsignals)
|
||||
const char *zfrom;
|
||||
const char *zto;
|
||||
boolean fpublic;
|
||||
boolean fmkdirs;
|
||||
boolean fsignals;
|
||||
{
|
||||
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, fsignals);
|
||||
(void) fclose (efrom);
|
||||
return fret;
|
||||
}
|
||||
|
||||
boolean
|
||||
fcopy_open_file (efrom, zto, fpublic, fmkdirs, fsignals)
|
||||
FILE *efrom;
|
||||
const char *zto;
|
||||
boolean fpublic;
|
||||
boolean fmkdirs;
|
||||
boolean fsignals;
|
||||
{
|
||||
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 (fsignals && FGOT_SIGNAL ())
|
||||
{
|
||||
/* Log the signal. */
|
||||
ulog (LOG_ERROR, (const char *) NULL);
|
||||
(void) fclose (eto);
|
||||
(void) remove (zto);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (! fsysdep_sync (eto, zto))
|
||||
{
|
||||
(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, fsignals)
|
||||
const char *zfrom;
|
||||
const char *zto;
|
||||
boolean fpublic;
|
||||
boolean fmkdirs;
|
||||
boolean fsignals;
|
||||
{
|
||||
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, fsignals);
|
||||
(void) close (ofrom);
|
||||
return fret;
|
||||
}
|
||||
|
||||
boolean
|
||||
fcopy_open_file (ofrom, zto, fpublic, fmkdirs, fsignals)
|
||||
int ofrom;
|
||||
const char *zto;
|
||||
boolean fpublic;
|
||||
boolean fmkdirs;
|
||||
boolean fsignals;
|
||||
{
|
||||
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 (fsignals && FGOT_SIGNAL ())
|
||||
{
|
||||
/* Log the signal. */
|
||||
ulog (LOG_ERROR, (const char *) NULL);
|
||||
(void) fclose (eto);
|
||||
(void) remove (zto);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (! fsysdep_sync (oto, zto))
|
||||
{
|
||||
(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 */
|
@ -1,80 +0,0 @@
|
||||
/* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* 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;
|
@ -1,133 +0,0 @@
|
||||
/* 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
This file was modified slightly by Ian Lance Taylor, November 1992,
|
||||
for Taylor UUCP, and again in June, 1995. */
|
||||
|
||||
#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
|
||||
};
|
||||
|
||||
#ifndef P
|
||||
/* On some systems, <stdio.h> includes getopt.h before P is defined by
|
||||
uucp.h, and the -I arguments cause this version of getopt.h to be
|
||||
included. Work around that here. */
|
||||
#define P(x) ()
|
||||
#define UNDEFINE_P
|
||||
#endif
|
||||
|
||||
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 UNDEFINE_P
|
||||
#undef P
|
||||
#undef UNDEFINE_P
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETOPT_H */
|
@ -1,775 +0,0 @@
|
||||
/* log.c
|
||||
Routines to add entries to the log files.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char log_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "uuconf.h"
|
||||
#include "system.h"
|
||||
|
||||
/* Local functions. */
|
||||
|
||||
__inline__ static char *zstpcpy P((char *zto, const char *zfrom));
|
||||
static const char *zldate_and_time P((void));
|
||||
|
||||
/* Program name. Set by main function. */
|
||||
const char *zProgram;
|
||||
|
||||
/* Log file name. */
|
||||
static const char *zLogfile;
|
||||
|
||||
/* 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;
|
||||
#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);
|
||||
}
|
||||
|
||||
/* A helper function for ulog. */
|
||||
|
||||
__inline__ static char *
|
||||
zstpcpy (zto, zfrom)
|
||||
char *zto;
|
||||
const char *zfrom;
|
||||
{
|
||||
while ((*zto++ = *zfrom++) != '\0')
|
||||
;
|
||||
return zto - 1;
|
||||
}
|
||||
|
||||
/* Make a log entry. We make a token concession to non ANSI_C systems,
|
||||
but it clearly won't always work. */
|
||||
|
||||
#if ! HAVE_PROTOTYPES || ! HAVE_STDARG_H
|
||||
#undef HAVE_VFPRINTF
|
||||
#define HAVE_VFPRINTF 0
|
||||
#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;
|
||||
char *zprefix;
|
||||
register char *zset;
|
||||
char *zformat;
|
||||
char *zfrom;
|
||||
|
||||
/* Log any received signal. We do it this way to avoid calling ulog
|
||||
from the signal handler. A few routines call ulog to get this
|
||||
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 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
|
||||
&& iDebug != 0)
|
||||
{
|
||||
fLdebug_tried = TRUE;
|
||||
eLdebug = esysdep_fopen (zLdebugfile, FALSE, TRUE, 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)
|
||||
{
|
||||
const char *zprint = NULL;
|
||||
|
||||
fLlog_tried = TRUE;
|
||||
#if ! HAVE_HDB_LOGGING
|
||||
eLlog = esysdep_fopen (zLogfile, TRUE, TRUE, TRUE);
|
||||
zprint = zLogfile;
|
||||
#else /* HAVE_HDB_LOGGING */
|
||||
{
|
||||
const char *zsys;
|
||||
char *zbase;
|
||||
char *zlower;
|
||||
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;
|
||||
|
||||
zbase = zsysdep_base_name (zProgram);
|
||||
if (zbase == NULL)
|
||||
zbase = zbufcpy (zProgram);
|
||||
|
||||
/* On some systems the native uusched will invoke uucico
|
||||
with an upper case argv[0]. We work around that by
|
||||
forcing the filename to lower case here. */
|
||||
for (zlower = zbase; *zlower != '\0'; zlower++)
|
||||
if (isupper (*zlower))
|
||||
*zlower = tolower (*zlower);
|
||||
|
||||
zfile = zbufalc (strlen (zLogfile)
|
||||
+ strlen (zbase)
|
||||
+ strlen (zsys)
|
||||
+ 1);
|
||||
sprintf (zfile, zLogfile, zbase, zsys);
|
||||
ubuffree (zbase);
|
||||
eLlog = esysdep_fopen (zfile, TRUE, TRUE, TRUE);
|
||||
if (eLlog != NULL)
|
||||
ubuffree (zfile);
|
||||
else
|
||||
zprint = zfile;
|
||||
}
|
||||
#endif /* HAVE_HDB_LOGGING */
|
||||
|
||||
if (eLlog == NULL)
|
||||
{
|
||||
/* We can't open the log file. We report the problem to
|
||||
stderr. This is not ideal, since if this is uucico
|
||||
running on an inbound call stderr is actually
|
||||
connected to a remote system, but is better than
|
||||
doing nothing. */
|
||||
fprintf (stderr, "%s: %s: can not open log file: %s\n",
|
||||
zProgram, zprint, strerror (errno));
|
||||
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 (zmsg == 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)
|
||||
zprefix = zbufcpy ("");
|
||||
else
|
||||
{
|
||||
if (! fLfile)
|
||||
{
|
||||
zprefix = zbufalc (strlen (zProgram) + 3);
|
||||
sprintf (zprefix, "%s: ", zProgram);
|
||||
}
|
||||
else
|
||||
{
|
||||
zprefix = zbufalc (strlen (zProgram)
|
||||
+ (zLsystem == NULL ? 1 : strlen (zLsystem))
|
||||
+ (zLuser == NULL ? 4 : strlen (zLuser))
|
||||
+ sizeof "1991-12-31 12:00:00.00"
|
||||
+ strlen (zhdr)
|
||||
+ 100);
|
||||
zset = zprefix;
|
||||
#if HAVE_TAYLOR_LOGGING
|
||||
{
|
||||
char *zbase;
|
||||
|
||||
zbase = zsysdep_base_name (zProgram);
|
||||
if (zbase == NULL)
|
||||
zbase = zbufcpy (zProgram);
|
||||
zset = zstpcpy (zset, zbase);
|
||||
*zset++ = ' ';
|
||||
ubuffree (zbase);
|
||||
}
|
||||
#else /* ! HAVE_TAYLOR_LOGGING */
|
||||
zset = zstpcpy (zset, zLuser == NULL ? "uucp" : zLuser);
|
||||
*zset++ = ' ';
|
||||
#endif /* HAVE_TAYLOR_LOGGING */
|
||||
|
||||
zset = zstpcpy (zset, zLsystem == NULL ? "-" : zLsystem);
|
||||
*zset++ = ' ';
|
||||
|
||||
#if HAVE_TAYLOR_LOGGING
|
||||
zset = zstpcpy (zset, zLuser == NULL ? "-" : zLuser);
|
||||
*zset++ = ' ';
|
||||
#endif /* HAVE_TAYLOR_LOGGING */
|
||||
|
||||
*zset++ = '(';
|
||||
zset = zstpcpy (zset, zldate_and_time ());
|
||||
|
||||
if (iLid != 0)
|
||||
{
|
||||
#if ! HAVE_HDB_LOGGING
|
||||
#if HAVE_TAYLOR_LOGGING
|
||||
sprintf (zset, " %d", iLid);
|
||||
#else /* ! HAVE_TAYLOR_LOGGING */
|
||||
sprintf (zset, "-%d", iLid);
|
||||
#endif /* ! HAVE_TAYLOR_LOGGING */
|
||||
#else /* HAVE_HDB_LOGGING */
|
||||
/* I assume that the second number here is meant to be
|
||||
some sort of file sequence number, and that it should
|
||||
correspond to the sequence number in the statistics
|
||||
file. I don't have any really convenient way to do
|
||||
this, so I won't unless somebody thinks it's very
|
||||
important. */
|
||||
sprintf (zset, ",%d,%d", iLid, 0);
|
||||
#endif /* HAVE_HDB_LOGGING */
|
||||
|
||||
zset += strlen (zset);
|
||||
}
|
||||
|
||||
#if QNX_LOG_NODE_ID
|
||||
sprintf (zset, " %ld", (long) getnid ());
|
||||
zset += strlen (zset);
|
||||
#endif
|
||||
|
||||
*zset++ = ')';
|
||||
*zset++ = ' ';
|
||||
|
||||
strcpy (zset, zhdr);
|
||||
}
|
||||
}
|
||||
|
||||
zformat = zbufalc (2 * strlen (zprefix) + strlen (zmsg) + 2);
|
||||
|
||||
zset = zformat;
|
||||
zfrom = zprefix;
|
||||
while (*zfrom != '\0')
|
||||
{
|
||||
if (*zfrom == '%')
|
||||
*zset++ = '%';
|
||||
*zset++ = *zfrom++;
|
||||
}
|
||||
|
||||
ubuffree (zprefix);
|
||||
|
||||
zset = zstpcpy (zset, zmsg);
|
||||
|
||||
if (fend)
|
||||
{
|
||||
*zset++ = '\n';
|
||||
*zset = '\0';
|
||||
}
|
||||
|
||||
#if HAVE_VFPRINTF
|
||||
va_start (parg, zmsg);
|
||||
vfprintf (e, zformat, parg);
|
||||
va_end (parg);
|
||||
if (edebug != NULL)
|
||||
{
|
||||
va_start (parg, zmsg);
|
||||
vfprintf (edebug, zformat, parg);
|
||||
va_end (parg);
|
||||
}
|
||||
#else /* ! HAVE_VFPRINTF */
|
||||
fprintf (e, zformat, a, b, c, d, f, g, h, i, j);
|
||||
if (edebug != NULL)
|
||||
fprintf (edebug, zformat, a, b, c, d, f, g, h, i, j);
|
||||
#endif /* ! HAVE_VFPRINTF */
|
||||
|
||||
ubuffree (zformat);
|
||||
|
||||
(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, fcaller)
|
||||
boolean fsucceeded;
|
||||
const char *zuser;
|
||||
const char *zsystem;
|
||||
boolean fsent;
|
||||
long cbytes;
|
||||
long csecs;
|
||||
long cmicros;
|
||||
boolean fcaller;
|
||||
{
|
||||
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, cdiv, crem;
|
||||
|
||||
/* Compute ((csecs * 1000) / cmillis) using integer division.
|
||||
Where DIV is integer division, we know
|
||||
a = (a DIV b) * b + a % b
|
||||
so
|
||||
a / b = (a DIV b) + (a % b) / b
|
||||
We compute the latter with a as csecs and b as cmillis,
|
||||
mixing the multiplication by 1000. */
|
||||
cmillis = csecs * 1000 + cmicros / 1000;
|
||||
cdiv = (cbytes / cmillis) * 1000;
|
||||
crem = (cbytes % cmillis) * 1000;
|
||||
cbps = cdiv + (crem / cmillis);
|
||||
if (cmillis < 0 || cdiv < 0 || crem < 0 || cbps < 0)
|
||||
{
|
||||
/* We overflowed using milliseconds, so use seconds. */
|
||||
cbps = cbytes / (csecs + ((cmicros > 500000L) ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (eLstats == NULL)
|
||||
{
|
||||
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) on port %s\n",
|
||||
zuser, zsystem, zldate_and_time (),
|
||||
fsucceeded ? "" : "failed after ",
|
||||
fsent ? "sent" : "received",
|
||||
cbytes, csecs, cmicros / 1000, cbps,
|
||||
zLdevice == NULL ? "unknown" : zLdevice);
|
||||
#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. */
|
||||
++iseq;
|
||||
fprintf (eLstats,
|
||||
"%s!%s %c (%s) (C,%d,%d) [%s] %s %ld / %ld.%03ld secs, %ld%s%s\n",
|
||||
zsystem, zuser, fcaller ? 'M' : 'S', zldate_and_time (),
|
||||
iLid, iseq, zLdevice == NULL ? "unknown" : zLdevice,
|
||||
fsent ? "->" : "<-",
|
||||
cbytes, csecs, cmicros / 1000, cbps,
|
||||
" bytes/sec",
|
||||
fsucceeded ? "" : " [PARTIAL FILE]");
|
||||
}
|
||||
#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-%d:%02d:%02d", s.tm_mon + 1, s.tm_mday,
|
||||
s.tm_hour, s.tm_min, s.tm_sec);
|
||||
#endif
|
||||
|
||||
return ab;
|
||||
}
|
@ -1,703 +0,0 @@
|
||||
/* policy.h
|
||||
Configuration file for policy decisions. To be edited on site.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* 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_TERMIOS_H
|
||||
#undef HAVE_POSIX_TERMIOS
|
||||
#define HAVE_POSIX_TERMIOS 1
|
||||
#else /* ! HAVE_TERMIOS_H */
|
||||
#if HAVE_CBREAK
|
||||
#undef HAVE_BSD_TTY
|
||||
#define HAVE_BSD_TTY 1
|
||||
#else /* ! HAVE_CBREAK */
|
||||
#undef HAVE_SYSV_TERMIO
|
||||
#define HAVE_SYSV_TERMIO 1
|
||||
#endif /* ! HAVE_CBREAK */
|
||||
#endif /* ! HAVE_TERMIOS_H */
|
||||
#endif /* HAVE_BSD_TTY + HAVE_SYSV_TERMIO + HAVE_POSIX_TERMIOS == 0 */
|
||||
|
||||
/* On some systems a write to a serial port will block even if the
|
||||
file descriptor has been set to not block. File transfer can be
|
||||
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__
|
||||
#ifndef ultrix
|
||||
#define ultrix
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ultrix
|
||||
#undef HAVE_STRIP_BUG
|
||||
#define HAVE_STRIP_BUG 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If your system implements full duplex pipes, set
|
||||
HAVE_FULLDUPLEX_PIPES to 1. Everything should work fine if you
|
||||
leave it set to 0, but setting it to 1 can be slightly more
|
||||
efficient. */
|
||||
#define HAVE_FULLDUPLEX_PIPES 0
|
||||
|
||||
/* TIMES_TICK is the fraction of a second which times(2) returns (for
|
||||
example, if times returns 100ths of a second TIMES_TICK should be
|
||||
set to 100). On a true POSIX system (one which has the sysconf
|
||||
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 0
|
||||
|
||||
/* On some systems, such as 4.4BSD-Lite, NetBSD, 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 a few systems, such as NextStep 3.3, the POSIX macro F_SETLKW is
|
||||
defined, but does not work. On such systems, you must set
|
||||
HAVE_BROKEN_SETLKW to 1. If you do not, uux will hang, or log
|
||||
peculiar error messages, every time it is run. */
|
||||
#define HAVE_BROKEN_SETLKW 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 MAIL_PROGRAM to a program which can be used to send mail. It
|
||||
will be used for mail to both local and remote users. Set
|
||||
MAIL_PROGRAM_TO_BODY to 1 if the recipient should be specified as a
|
||||
To: line in the body of the message; otherwise, the recipient will
|
||||
be provided as an argument to MAIL_PROGRAM. Set
|
||||
MAIL_PROGRAM_SUBJECT_BODY if the subject should be specified as a
|
||||
Subject: line in the body of the message; otherwise, the subject
|
||||
will be provided using the -s option to MAIL_PROGRAM (if your mail
|
||||
program does not support the -s option, you must set
|
||||
MAIL_PROGRAM_SUBJECT_BODY to 1). If your system uses sendmail, use
|
||||
the sendmail choice below. Otherwise, select one of the other
|
||||
choices as appropriate. */
|
||||
#if 1
|
||||
#define MAIL_PROGRAM "/usr/sbin/sendmail -t"
|
||||
#define MAIL_PROGRAM_TO_BODY 1
|
||||
#define MAIL_PROGRAM_SUBJECT_BODY 1
|
||||
#endif
|
||||
#if 0
|
||||
#define MAIL_PROGRAM "/usr/ucb/mail"
|
||||
#define MAIL_PROGRAM_TO_BODY 0
|
||||
#define MAIL_PROGRAM_SUBJECT_BODY 0
|
||||
#endif
|
||||
#if 0
|
||||
#define MAIL_PROGRAM "/bin/mail"
|
||||
#define MAIL_PROGRAM_TO_BODY 0
|
||||
#define MAIL_PROGRAM_SUBJECT_BODY 1
|
||||
#endif
|
||||
|
||||
/* Set PS_PROGRAM to the program to run to get a process status,
|
||||
including the arguments to pass it. This is used by ``uustat -p''.
|
||||
Set HAVE_PS_MULTIPLE to 1 if a comma separated list of process
|
||||
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
|
||||
#ifdef __QNX__
|
||||
/* Use this for QNX, along with HAVE_QNX_LOCKFILES. */
|
||||
#undef PS_PROGRAM
|
||||
#undef HAVE_PS_MULTIPLE
|
||||
#define PS_PROGRAM "/bin/ps -l -n -p"
|
||||
#define HAVE_PS_MULTIPLE 0
|
||||
#endif
|
||||
|
||||
/* If you use other programs that also lock devices, such as cu or
|
||||
uugetty, the other programs and UUCP must agree on whether a device
|
||||
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.
|
||||
|
||||
Sequent DYNIX/ptx (but perhaps not Dynix 3.x) uses yet another
|
||||
naming convention. The lock file for /dev/ttyXA/XAAP is named
|
||||
LCK..ttyXAAP.
|
||||
|
||||
Coherent use a completely different method of terminal locking.
|
||||
See unix/cohtty for details. For locks other than for terminals,
|
||||
HDB type lock files are used.
|
||||
|
||||
QNX lock files are similar to HDB lock files except that the node
|
||||
ID must be stored in addition to the process ID and for serial
|
||||
devices the node ID must be included in the lock file name. QNX
|
||||
boxes are generally used in bunches, and all of them behave like
|
||||
one big machine to some extent. Thus, processes on different
|
||||
machines will be sharing the files in the spool directory. To
|
||||
detect if a process has died and a lock is thus stale, you need the
|
||||
node ID of the process as well as the process ID. The process ID
|
||||
is stored as a number written using ASCII digits padded to 10
|
||||
characters, followed by a space, followed by the node ID written
|
||||
using ASCII digits padded to 10 characters, followed by a newline.
|
||||
The format for QNX lock files was made up just for Taylor UUCP.
|
||||
QNX doesn't come with a version of UUCP. */
|
||||
#define HAVE_V2_LOCKFILES 0
|
||||
#define HAVE_HDB_LOCKFILES 1
|
||||
#define HAVE_SCO_LOCKFILES 0
|
||||
#define HAVE_SVR4_LOCKFILES 0
|
||||
#define HAVE_SEQUENT_LOCKFILES 0
|
||||
#define HAVE_COHERENT_LOCKFILES 0
|
||||
#define HAVE_QNX_LOCKFILES 0
|
||||
|
||||
/* This tries to pick a default based on preprocessor definitions.
|
||||
Ignore it if you have explicitly set one of the above values. */
|
||||
#if HAVE_V2_LOCKFILES + HAVE_HDB_LOCKFILES + HAVE_SCO_LOCKFILES + HAVE_SVR4_LOCKFILES + HAVE_SEQUENT_LOCKFILES + HAVE_COHERENT_LOCKFILES + HAVE_QNX_LOCKFILES == 0
|
||||
#ifdef __QNX__
|
||||
#undef HAVE_QNX_LOCKFILES
|
||||
#define HAVE_QNX_LOCKFILES 1
|
||||
#else /* ! defined (__QNX__) */
|
||||
#ifdef __COHERENT__
|
||||
#undef HAVE_COHERENT_LOCKFILES
|
||||
#define HAVE_COHERENT_LOCKFILES 1
|
||||
#else /* ! defined (__COHERENT__) */
|
||||
#ifdef _SEQUENT_
|
||||
#undef HAVE_SEQUENT_LOCKFILES
|
||||
#define HAVE_SEQUENT_LOCKFILES 1
|
||||
#else /* ! defined (_SEQUENT) */
|
||||
#ifdef sco
|
||||
#undef HAVE_SCO_LOCKFILES
|
||||
#define HAVE_SCO_LOCKFILES 1
|
||||
#else /* ! defined (sco) */
|
||||
#ifdef __svr4__
|
||||
#undef HAVE_SVR4_LOCKFILES
|
||||
#define HAVE_SVR4_LOCKFILES 1
|
||||
#else /* ! defined (__svr4__) */
|
||||
/* Final default is HDB. There's no way to tell V2 from HDB. */
|
||||
#undef HAVE_HDB_LOCKFILES
|
||||
#define HAVE_HDB_LOCKFILES 1
|
||||
#endif /* ! defined (__svr4__) */
|
||||
#endif /* ! defined (sco) */
|
||||
#endif /* ! defined (_SEQUENT) */
|
||||
#endif /* ! defined (__COHERENT__) */
|
||||
#endif /* ! defined (__QNX__) */
|
||||
#endif /* no LOCKFILES define */
|
||||
|
||||
/* If your system supports Internet mail addresses (which look like
|
||||
user@host.domain rather than system!user), HAVE_INTERNET_MAIL
|
||||
should be set to 1. This is checked by uuxqt and uustat when
|
||||
sending notifications to the person who submitted the job.
|
||||
|
||||
If your system does not understand addresses of the form user@host,
|
||||
you must set HAVE_INTERNET_MAIL to 0.
|
||||
|
||||
If your system does not understand addresses of the form host!user,
|
||||
which is unlikely, you must set HAVE_INTERNET_MAIL to 1.
|
||||
|
||||
If your system sends mail addressed to "A!B@C" to host C (i.e., it
|
||||
parses the address as "(A!B)@C"), you must set HAVE_INTERNET_MAIL
|
||||
to 1.
|
||||
|
||||
If your system sends mail addressed to "A!B@C" to host A (i.e., it
|
||||
parses the address as "A!(B@C)"), you must set HAVE_INTERNET_MAIL
|
||||
to 0.
|
||||
|
||||
Note that in general it is best to avoid addresses of the form
|
||||
"A!B@C" because of this ambiguity of precedence. UUCP will not
|
||||
intentionally generate addresses of this form, but it can occur in
|
||||
certain rather complex cases. */
|
||||
#define HAVE_INTERNET_MAIL 1
|
||||
|
||||
/* Adminstrative decisions. */
|
||||
|
||||
/* 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 HAVE_ENCRYPTED_PASSWORDS to 1 if you want login passwords to be
|
||||
encrypted before comparing them against the values in the file.
|
||||
This only applies when uucico is run with the -l or -e switches and
|
||||
is doing its own login prompting. Note that the passwords used are
|
||||
from the UUCP password file, not the system /etc/passwd file. See
|
||||
the documentation for further details. If you set this, you are
|
||||
responsible for encrypting the passwords in the UUCP password file.
|
||||
The function crypt will be used to do comparisons. */
|
||||
#define HAVE_ENCRYPTED_PASSWORDS 0
|
||||
|
||||
/* Set the default grade to use for a uucp command if the -g option is
|
||||
not used. The grades, from highest to lowest, are 0 to 9, A to Z,
|
||||
a to z. */
|
||||
#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 0
|
||||
#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
|
||||
|
||||
/* The status file generated by UUCP can use either the traditional
|
||||
HDB upper case comments or new easier to read lower case comments.
|
||||
This affects the display of uustat -m or uustat -q. Some
|
||||
third-party programs read these status files and expect them to be
|
||||
in a certain format. The default is to use the traditional
|
||||
comments when using an HDB or SVR4 spool directory, and to use
|
||||
lower case comments otherwise. */
|
||||
#define USE_TRADITIONAL_STATUS (SPOOLDIR_HDB || SPOOLDIR_SVR4)
|
||||
|
||||
/* You must select which type of logging you want by setting exactly
|
||||
one of the following to 1. These control output to the log file
|
||||
and to the statistics file.
|
||||
|
||||
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 QNX_LOG_NODE_ID is set to 1, log messages will include the QNX
|
||||
node ID just after the process ID. This is a policy decision
|
||||
because it changes the log file entry format, which can break other
|
||||
programs (e.g., some of the ones in the contrib directory) which
|
||||
expect to read the standard log file format. */
|
||||
#ifdef __QNX__
|
||||
#define QNX_LOG_NODE_ID 1
|
||||
#else
|
||||
#define QNX_LOG_NODE_ID 0
|
||||
#endif
|
||||
|
||||
/* If LOG_DEVICE_PREFIX is 1, log messages will give the full
|
||||
pathname of a device rather than just the final component. This is
|
||||
important because on QNX //2/dev/ser2 refers to a different device
|
||||
than //4/dev/ser2. */
|
||||
#ifdef __QNX__
|
||||
#define LOG_DEVICE_PREFIX 1
|
||||
#else
|
||||
#define LOG_DEVICE_PREFIX 0
|
||||
#endif
|
||||
|
||||
/* If you would like the log, debugging and statistics files to be
|
||||
closed after each message, set CLOSE_LOGFILES to 1. This will
|
||||
permit the log files to be easily moved. If a log file does not
|
||||
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 "/usr/spool/uucp" */
|
||||
#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 "/usr/spool/uucppublic" */
|
||||
#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 you set FSYNC_ON_CLOSE to 1, all output files will be forced out
|
||||
to disk using the fsync system call when they are closed. This can
|
||||
be useful if you can not afford to lose people's mail if the system
|
||||
crashes. However, not all systems have the fsync call, and it is
|
||||
always less efficient to use it. Note that some versions of SCO
|
||||
Unix, and possibly other systems, make fsync a synonym for sync,
|
||||
which is extremely inefficient. */
|
||||
#define FSYNC_ON_CLOSE 0
|
||||
|
||||
#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 "/usr/spool/uucp/Log" */
|
||||
#define LOGFILE "/var/spool/uucp/Log"
|
||||
|
||||
/* The default statistics file when using HAVE_TAYLOR_LOGGING. When
|
||||
using HAVE_TAYLOR_CONFIG, this may be overridden by the
|
||||
``statfile'' command in the configuration file. */
|
||||
/* #define STATFILE "/usr/spool/uucp/Stats" */
|
||||
#define STATFILE "/var/spool/uucp/Stats"
|
||||
|
||||
/* The default debugging file when using HAVE_TAYLOR_LOGGING. When
|
||||
using HAVE_TAYLOR_CONFIG, this may be overridden by the
|
||||
``debugfile'' command in the configuration file. */
|
||||
/* #define DEBUGFILE "/usr/spool/uucp/Debug" */
|
||||
#define DEBUGFILE "/var/spool/uucp/Debug"
|
||||
|
||||
#endif /* HAVE_TAYLOR_LOGGING */
|
||||
|
||||
#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 "/usr/spool/uucp/LOGFILE"
|
||||
|
||||
/* The default statistics file when using HAVE_V2_LOGGING. When using
|
||||
HAVE_TAYLOR_CONFIG, this may be overridden by the ``statfile''
|
||||
command in the configuration file. */
|
||||
#define STATFILE "/usr/spool/uucp/SYSLOG"
|
||||
|
||||
/* The default debugging file when using HAVE_V2_LOGGING. When using
|
||||
HAVE_TAYLOR_CONFIG, this may be overridden by the ``debugfile''
|
||||
command in the configuration file. */
|
||||
#define DEBUGFILE "/usr/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 "/usr/spool/uucp/.Log/%s/%s"
|
||||
|
||||
/* The default statistics file when using HAVE_HDB_LOGGING. When using
|
||||
HAVE_TAYLOR_CONFIG, this may be overridden by the ``statfile''
|
||||
command in the configuration file. */
|
||||
#define STATFILE "/usr/spool/uucp/.Admin/xferstats"
|
||||
|
||||
/* The default debugging file when using HAVE_HDB_LOGGING. When using
|
||||
HAVE_TAYLOR_CONFIG, this may be overridden by the ``debugfile''
|
||||
command in the configuration file. */
|
||||
#define DEBUGFILE "/usr/spool/uucp/.Admin/audit.local"
|
||||
|
||||
#endif /* HAVE_HDB_LOGGING */
|
@ -1,241 +0,0 @@
|
||||
/* prot.c
|
||||
Protocol support routines to move commands and data around.
|
||||
|
||||
Copyright (C) 1991, 1992, 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char prot_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "uuconf.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;
|
||||
}
|
||||
|
||||
if (crec == 0)
|
||||
return fconn_write (qconn, zsend, csend);
|
||||
|
||||
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);
|
||||
}
|
@ -1,270 +0,0 @@
|
||||
/* prot.h
|
||||
Protocol header file.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* 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;
|
||||
/* Whether files may be reliably restarted using this protocol. */
|
||||
boolean frestart;
|
||||
/* Protocol parameter commands. */
|
||||
struct uuconf_cmdtab *qcmds;
|
||||
/* A routine to start the protocol. If *pzlog is set to be
|
||||
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 fvstart P((struct sdaemon *qdaemon, char **pzlog));
|
||||
extern boolean fgshutdown P((struct sdaemon *qdaemon));
|
||||
extern boolean fgsendcmd P((struct sdaemon *qdaemon, const char *z,
|
||||
int ilocal, int iremote));
|
||||
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));
|
||||
|
||||
/* Prototypes for 'y' protocol functions. */
|
||||
|
||||
extern struct uuconf_cmdtab asYproto_params[];
|
||||
extern boolean fystart P((struct sdaemon *qdaemon, char **pzlog));
|
||||
extern boolean fyshutdown P((struct sdaemon *qdaemon));
|
||||
extern boolean fysendcmd P((struct sdaemon *qdaemon, const char *z,
|
||||
int ilocal, int iremote));
|
||||
extern char *zygetspace P((struct sdaemon *qdaemon, size_t *pcdata));
|
||||
extern boolean fysenddata P((struct sdaemon *qdaemon, char *z, size_t c,
|
||||
int ilocal, int iremote, long ipos));
|
||||
extern boolean fywait P((struct sdaemon *qdaemon));
|
||||
extern boolean fyfile P((struct sdaemon *qdaemon, struct stransfer *qtrans,
|
||||
boolean fstart, boolean fsend, long cbytes,
|
||||
boolean *pfhandled));
|
@ -1,563 +0,0 @@
|
||||
/* sysh.unx -*- C -*-
|
||||
The header file for the UNIX system dependent routines.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
/* SCO, SVR4 and Sequent lockfiles are basically just like HDB
|
||||
lockfiles. */
|
||||
#if HAVE_SCO_LOCKFILES || HAVE_SVR4_LOCKFILES || HAVE_SEQUENT_LOCKFILES
|
||||
#undef HAVE_HDB_LOCKFILES
|
||||
#define HAVE_HDB_LOCKFILES 1
|
||||
#endif
|
||||
|
||||
#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 name of the directory to which we move corrupt files. */
|
||||
#define CORRUPTDIR ".Corrupt"
|
||||
|
||||
/* The name of the directory to which we move failed execution files. */
|
||||
#define FAILEDDIR ".Failed"
|
||||
|
||||
/* 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
|
||||
|
||||
#if STAT_MACROS_BROKEN
|
||||
#undef S_ISDIR
|
||||
#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;
|
||||
/* File descriptor to read from (used by stdin and pipe port types). */
|
||||
int ord;
|
||||
/* File descriptor to write to (used by stdin and pipe port types). */
|
||||
int owr;
|
||||
/* Device name. */
|
||||
char *zdevice;
|
||||
/* File status flags. */
|
||||
int iflags;
|
||||
/* File status flags for write descriptor (-1 if not used). */
|
||||
int iwr_flags;
|
||||
/* Hold the real descriptor when using a dialer device. */
|
||||
int ohold;
|
||||
/* TRUE if this is a terminal and the remaining fields are valid. */
|
||||
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;
|
||||
/* Process ID of currently executing pipe command, or parent process
|
||||
of forked TCP or TLI server, or -1. */
|
||||
pid_t ipid;
|
||||
#if HAVE_COHERENT_LOCKFILES
|
||||
/* On Coherent we need to hold on to the real port name which will
|
||||
be used to enable the port. Ick. */
|
||||
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));
|
||||
|
||||
/* Read from a connection using two file descriptors. */
|
||||
extern boolean fsdouble_read P((struct sconnection *qconn, char *zbuf,
|
||||
size_t *pclen, size_t cmin, int ctimeout,
|
||||
boolean freport));
|
||||
|
||||
/* Write to a connection using two file descriptors. */
|
||||
extern boolean fsdouble_write P((struct sconnection *qconn,
|
||||
const char *zbuf, size_t clen));
|
||||
|
||||
/* Run a chat program on a connection using two file descriptors. */
|
||||
extern boolean fsdouble_chat P((struct sconnection *qconn,
|
||||
char **pzprog));
|
||||
|
||||
/* Find a spool file in the spool directory. For a local file, the
|
||||
bgrade argument is the grade of the file. This is needed for
|
||||
SPOOLDIR_SVR4. */
|
||||
extern char *zsfind_file P((const char *zsimple, const char *zsystem,
|
||||
int bgrade));
|
||||
|
||||
/* Return the grade given a sequence number. */
|
||||
extern int 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));
|
||||
|
||||
/* Switch to the permissions of the invoking user. This sets the
|
||||
argument to a value to pass to fsuucp_perms. */
|
||||
extern boolean fsuser_perms P((uid_t *));
|
||||
|
||||
/* Switch back to the permissions of the UUCP user ID. This should be
|
||||
passed the value returned by fsuser_perms in its argument. */
|
||||
extern boolean fsuucp_perms P((long));
|
||||
|
||||
/* 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,
|
||||
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) */
|
@ -1,994 +0,0 @@
|
||||
/* system.h
|
||||
Header file for system dependent stuff in the Taylor UUCP package.
|
||||
This file is not itself system dependent.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#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)
|
||||
|
||||
/* Do not close all open descriptors. This is not used by the UUCP
|
||||
code, but it is used by other programs which share some of the
|
||||
system dependent libraries. */
|
||||
#define INIT_NOCLOSE (010)
|
||||
|
||||
extern void usysdep_initialize P((pointer puuconf, int iflags));
|
||||
|
||||
/* Exit the program. The fsuccess argument indicates whether to
|
||||
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. If pfbadname is not NULL, then if the function
|
||||
returns NULL *pfbadname should be set to TRUE if the error is just
|
||||
that the file name is badly specified; *pfbadname should be set to
|
||||
FALSE for some sort of internal error. */
|
||||
extern char *zsysdep_local_file P((const char *zname,
|
||||
const char *zpubdir,
|
||||
boolean *pfbadname));
|
||||
|
||||
/* Return whether a file name is in a directory, and check for read or
|
||||
write access. This should check whether zfile is within zdir (or
|
||||
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. If the ffork argument is true, this should
|
||||
spawn a new process and return. If the ffork argument is false,
|
||||
this may either return or not. The three string arguments may be
|
||||
catenated together to form the program to execute; I did it this
|
||||
way to make it easy to call execl(2), and because I never needed
|
||||
more than two arguments. The program will always be "uucico" or
|
||||
"uuxqt". The return value should be TRUE on success, FALSE on
|
||||
error. */
|
||||
extern boolean fsysdep_run P((boolean ffork, const char *zprogram,
|
||||
const char *zarg1, const char *zarg2));
|
||||
|
||||
/* Send a mail message. This function will be passed an array of
|
||||
strings. All necessary newlines are already included; the strings
|
||||
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));
|
||||
|
||||
/* Save a file in a location used to hold corrupt files. This is
|
||||
called if a bad execution file is found by uuxqt. This should
|
||||
return the new name of the file (allocated by zbufalc), or NULL if
|
||||
the move failed (in which the original file should remain). */
|
||||
extern char *zsysdep_save_corrupt_file P((const char *zfile));
|
||||
|
||||
/* Save a file in a location used to hold failed execution files.
|
||||
This is called if a uuxqt execution fails. This should return the
|
||||
new name of the file (allocated by zbufalc), or NULL if the move
|
||||
failed (in which case the original file should remain). */
|
||||
extern char *zsysdep_save_failed_file P((const char *zfile));
|
||||
|
||||
/* Cleanup anything left over by fsysdep_get_work_init and
|
||||
fsysdep_get_work. This may be called even though
|
||||
fsysdep_get_work_init has not been. */
|
||||
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, the ztemp argument, if it is
|
||||
not NULL, is from the command sent by the remote system, and the
|
||||
frestart argument is TRUE if the protocol and remote system permit
|
||||
file transfers to be restarted. The return value must be freed
|
||||
using ubuffree. The function should return NULL on error. */
|
||||
extern char *zsysdep_receive_temp P((const struct uuconf_system *qsys,
|
||||
const char *zfile,
|
||||
const char *ztemp,
|
||||
boolean frestart));
|
||||
|
||||
/* Open a file to receive from another system. The zreceive argument
|
||||
is the return value of zsysdep_receive_temp with the same qsys,
|
||||
zfile and ztemp arguments. If the function can determine that this
|
||||
file has already been partially received, it should set *pcrestart
|
||||
to the number of bytes that have been received. If the file has
|
||||
not been partially received, *pcrestart should be set to -1.
|
||||
pcrestart will be passed in as NULL if file restart is not
|
||||
supported by the protocol or the remote system. The function
|
||||
should return EFILECLOSED on error. After the file is written,
|
||||
fsysdep_move_file will be called to move the file to its final
|
||||
destination, and to set the correct file mode. */
|
||||
extern openfile_t esysdep_open_receive P((const struct uuconf_system *qsys,
|
||||
const char *zto,
|
||||
const char *ztemp,
|
||||
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, in
|
||||
which case the zorig file should still exist. */
|
||||
extern boolean fsysdep_move_file P((const char *zorig, const char *zto,
|
||||
boolean fmkdirs, boolean fpublic,
|
||||
boolean fcheck, const char *zuser));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* Sync a file to disk. If this fails it should log an error using
|
||||
the zmsg parameter, and return FALSE. This is controlled by the
|
||||
FSYNC_ON_CLOSE macro in policy.h. */
|
||||
extern boolean fsysdep_sync P((openfile_t e, const char *zmsg));
|
||||
|
||||
/* 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. If the zsystem argument is not
|
||||
NULL, it is the name of a system for which execution files are
|
||||
desired. */
|
||||
extern boolean fsysdep_get_xqt_init P((const char *zsystem));
|
||||
|
||||
/* Get the next execute file. This should return NULL when finished
|
||||
(with *pferr set to FALSE). The zsystem argument should be the
|
||||
same string as that passed to fsysdep_get_xqt_init. 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; this is not guaranteed to match the zsystem argument--that
|
||||
must be double checked by the caller. Both the return value and
|
||||
*pzsystem should be freed using ubuffree. */
|
||||
extern char *zsysdep_get_xqt P((const char *zsystem, char **pzsystem,
|
||||
boolean *pferr));
|
||||
|
||||
/* Clean up after getting execute files. The zsystem argument should
|
||||
be the same string as that passed to fsysdep_get_xqt_init. */
|
||||
extern void usysdep_get_xqt_free P((const char *zsystem));
|
||||
|
||||
/* 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,
|
||||
boolean *pfbadname));
|
||||
|
||||
/* Add the working directory to a file name. The named file is
|
||||
actually on a remote system. If the file already has a directory,
|
||||
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 privileged. Privileged users are
|
||||
permitted to kill jobs submitted by another user, and they are
|
||||
permitted to use the -u argument to uucico; other uses of this call
|
||||
may be added later. This should return TRUE if permission is
|
||||
granted, FALSE otherwise. */
|
||||
extern boolean fsysdep_privileged P((void));
|
||||
|
||||
/* Kill a job, given the jobid. This should remove all associated
|
||||
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));
|
||||
|
||||
/* Touch a file to make it appear as though it was created at the
|
||||
current time. This is called by uustat on execution files. On
|
||||
error this should log an error message and return FALSE. */
|
||||
extern boolean fsysdep_touch_file P((const char *zfile));
|
||||
|
||||
/* Get the size in bytes of a file. If this file does not exist, this
|
||||
should not give an error message, but should return -1. If some
|
||||
other error occurs, this should return -2. */
|
||||
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,
|
||||
boolean *pfbadname));
|
||||
|
||||
/* Remove a directory and all the files in it. */
|
||||
extern boolean fsysdep_rmdir P((const char *zdir));
|
||||
|
||||
#endif /* ! defined (SYSTEM_H) */
|
File diff suppressed because it is too large
Load Diff
@ -1,398 +0,0 @@
|
||||
/* uucp.h
|
||||
Header file for the UUCP package.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* Get the system configuration parameters. */
|
||||
#include "config.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. */
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#if HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
#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 || ! HAVE_PROTOTYPES
|
||||
#error ANSI C compiler without void or unsigned char or prototypes
|
||||
#endif
|
||||
#define P(x) x
|
||||
typedef void *pointer;
|
||||
typedef const void *constpointer;
|
||||
#define BUCHAR(b) ((unsigned char) (b))
|
||||
#else /* ! ANSI_C */
|
||||
/* Handle uses of volatile and void in Classic C. */
|
||||
#define volatile
|
||||
#if ! HAVE_VOID
|
||||
#define void int
|
||||
#endif
|
||||
#if HAVE_PROTOTYPES
|
||||
#define P(x) x
|
||||
#else
|
||||
#define P(x) ()
|
||||
#endif
|
||||
typedef char *pointer;
|
||||
typedef const char *constpointer;
|
||||
#if HAVE_UNSIGNED_CHAR
|
||||
#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 unsigned long strtoul ();
|
||||
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 cfilewrite(e, z, c) fwrite ((z), 1, (c), (e))
|
||||
#define ffileioerror(e, c) ferror (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
|
||||
#ifdef SEEK_END
|
||||
#define ffileseekend(e) (fseek ((e), (long) 0, SEEK_END) == 0)
|
||||
#else
|
||||
#define ffileseekend(e) (fseek ((e), (long) 0, 2) == 0)
|
||||
#endif
|
||||
#define ffileclose(e) (fclose (e) == 0)
|
||||
|
||||
#define fstdiosync(e, z) (fsysdep_sync (e, z))
|
||||
|
||||
#else /* ! USE_STDIO */
|
||||
|
||||
#if ! USE_TYPES_H
|
||||
#undef USE_TYPES_H
|
||||
#define USE_TYPES_H 1
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef OFF_T
|
||||
typedef OFF_T off_t;
|
||||
#undef OFF_T
|
||||
#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 cfilewrite(e, z, c) write ((e), (z), (c))
|
||||
#define ffileioerror(e, c) ((c) < 0)
|
||||
#ifdef SEEK_SET
|
||||
#define ffileseek(e, i) (lseek ((e), (off_t) i, SEEK_SET) >= 0)
|
||||
#define ffilerewind(e) (lseek ((e), (off_t) 0, SEEK_SET) >= 0)
|
||||
#else
|
||||
#define ffileseek(e, i) (lseek ((e), (off_t) i, 0) >= 0)
|
||||
#define ffilerewind(e) (lseek ((e), (off_t) 0, 0) >= 0)
|
||||
#endif
|
||||
#ifdef SEEK_END
|
||||
#define ffileseekend(e) (lseek ((e), (off_t) 0, SEEK_END) >= 0)
|
||||
#else
|
||||
#define ffileseekend(e) (lseek ((e), (off_t) 0, 2) >= 0)
|
||||
#endif
|
||||
#define ffileclose(e) (close (e) >= 0)
|
||||
|
||||
#define fstdiosync(e, z) (fsysdep_sync (fileno (e), z))
|
||||
|
||||
#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
|
||||
|
||||
/* Turn a string into a long unsigned integer. */
|
||||
#if ! HAVE_STRTOUL
|
||||
extern unsigned long strtoul P((const char *, char **, int));
|
||||
#endif
|
||||
|
||||
/* Lookup a key in a sorted array. */
|
||||
#if ! HAVE_BSEARCH
|
||||
extern pointer bsearch P((constpointer pkey, constpointer parray,
|
||||
size_t celes, size_t cbytes,
|
||||
int (*pficmp) P((constpointer, constpointer))));
|
||||
#endif
|
@ -1,453 +0,0 @@
|
||||
/* uudefs.h
|
||||
Miscellaneous definitions for the UUCP package.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#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;
|
||||
/* String in status file. Only used when reading status file, not
|
||||
when writing. May be NULL. Should be freed with ubuffree. */
|
||||
char *zstring;
|
||||
};
|
||||
|
||||
/* 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;
|
||||
/* Grade of the command ('\0' if from remote system). */
|
||||
char bgrade;
|
||||
/* 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));
|
||||
|
||||
/* Remove all occurrences of the local system name followed by an
|
||||
exclamation point from the start of the argument. Return the
|
||||
possibly shortened argument. */
|
||||
extern char *zremove_local_sys P((struct uuconf_system *qlocalsys,
|
||||
char *z));
|
||||
|
||||
/* Determine the maximum size that may ever be transferred, given a
|
||||
timesize span. If there are any time gaps larger than 1 hour not
|
||||
described by the timesize span, this returns -1. Otherwise it
|
||||
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
|
||||
#ifdef __printf0like
|
||||
__printf0like (2, 3)
|
||||
#else
|
||||
__attribute__ ((format (printf, 2, 3)))
|
||||
#endif
|
||||
#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 fcaller));
|
||||
|
||||
/* 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,
|
||||
boolean fsignals));
|
||||
|
||||
/* Copy an open file to another. */
|
||||
extern boolean fcopy_open_file P((openfile_t efrom, const char *zto,
|
||||
boolean fpublic, boolean fmkdirs,
|
||||
boolean fsignals));
|
||||
|
||||
/* 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. Set from argv[0]. */
|
||||
extern const char *zProgram;
|
||||
|
||||
/* When a signal occurs, the signal handlers sets the appropriate
|
||||
element of the arrays afSignal and afLog_signal to TRUE. The
|
||||
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])
|
||||
|
||||
/* 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));
|
@ -1,19 +0,0 @@
|
||||
# Makefile for cu
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= cu
|
||||
SRCS= cu.c prot.c log.c chat.c conn.c copy.c
|
||||
DPADD+= $(LIBUNIX) $(LIBUUCONF) $(LIBUUCP)
|
||||
LDADD+= $(LIBUNIX) $(LIBUUCONF) $(LIBUUCP)
|
||||
CFLAGS+= -I$(.CURDIR)/../common_sources\
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
|
||||
BINDIR= $(bindir)
|
||||
BINOWN= $(owner)
|
||||
BINGRP= dialer
|
||||
BINMODE= 6555
|
||||
INSTALLFLAGS= -fschg
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
.PATH: $(.CURDIR)/../common_sources
|
@ -1,311 +0,0 @@
|
||||
.\" $Id: cu.1,v 1.9 1995/08/02 00:16:58 ian Rel $
|
||||
.\" $FreeBSD$
|
||||
.TH cu 1 "Taylor UUCP 1.06"
|
||||
.SH NAME
|
||||
cu \- Call up another system
|
||||
.SH SYNOPSIS
|
||||
.B cu
|
||||
[ options ] [ system | phone | "dir" ]
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.I cu
|
||||
command is used to call up another system and act as a dial in
|
||||
terminal. It can also do simple file transfers with no error
|
||||
checking.
|
||||
|
||||
.I cu
|
||||
takes a single argument, besides the options. If the argument is the
|
||||
string "dir" cu will make a direct connection to the port. This may
|
||||
only be used by users with write access to the port, as it permits
|
||||
reprogramming the modem.
|
||||
|
||||
Otherwise, if the argument begins with a digit, it is taken to be a
|
||||
phone number to call. Otherwise, it is taken to be the name of a
|
||||
system to call. The
|
||||
.B \-z
|
||||
or
|
||||
.B \-\-system
|
||||
option may be used to name a system beginning with a digit, and the
|
||||
.B \-c
|
||||
or
|
||||
.B \-\-phone
|
||||
option may be used to name a phone number that does not begin with a
|
||||
digit.
|
||||
|
||||
.I cu
|
||||
locates a port to use in the UUCP configuration files. If a simple
|
||||
system name is given, it will select a port appropriate for that
|
||||
system. The
|
||||
.B \-p, \-\-port, \-l, \-\-line, \-s
|
||||
and
|
||||
.B \-\-speed
|
||||
options may be used to control the port selection.
|
||||
|
||||
When a connection is made to the remote system,
|
||||
.I cu
|
||||
forks into two processes. One reads from the port and writes to the
|
||||
terminal, while the other reads from the terminal and writes to the
|
||||
port.
|
||||
|
||||
.I cu
|
||||
provides several commands that may be used during the conversation.
|
||||
The commands all begin with an escape character, initially
|
||||
.B ~
|
||||
(tilde). The escape character is only recognized at the beginning of
|
||||
a line. To send an escape character to the remote system at the start
|
||||
of a line, it must be entered twice. All commands are either a single
|
||||
character or a word beginning with
|
||||
.B %
|
||||
(percent sign).
|
||||
|
||||
.I cu
|
||||
recognizes the following commands:
|
||||
|
||||
.TP 5
|
||||
.B ~.
|
||||
Terminate the conversation.
|
||||
.TP 5
|
||||
.B ~! command
|
||||
Run command in a shell. If command is empty, starts up a shell.
|
||||
.TP 5
|
||||
.B ~$ command
|
||||
Run command, sending the standard output to the remote system.
|
||||
.TP 5
|
||||
.B ~| command
|
||||
Run command, taking the standard input from the remote system.
|
||||
.TP 5
|
||||
.B ~+ command
|
||||
Run command, taking the standard input from the remote system and
|
||||
sending the standard output to the remote system.
|
||||
.TP 5
|
||||
.B ~#, ~%break
|
||||
Send a break signal, if possible.
|
||||
.TP 5
|
||||
.B ~c directory, ~%cd directory
|
||||
Change the local directory.
|
||||
.TP 5
|
||||
.B ~> file
|
||||
Send a file to the remote system. This just dumps the file over the
|
||||
communication line. It is assumed that the remote system is expecting
|
||||
it.
|
||||
.TP 5
|
||||
.B ~<
|
||||
Receive a file from the remote system. This prompts for the local
|
||||
file name and for the remote command to execute to begin the file
|
||||
transfer. It continues accepting data until the contents of the
|
||||
.B eofread
|
||||
variable are seen.
|
||||
.TP 5
|
||||
.B ~p from to, ~%put from to
|
||||
Send a file to a remote Unix system. This runs the appropriate
|
||||
commands on the remote system.
|
||||
.TP 5
|
||||
.B ~t from to, ~%take from to
|
||||
Retrieve a file from a remote Unix system. This runs the appropriate
|
||||
commands on the remote system.
|
||||
.TP 5
|
||||
.B ~s variable value
|
||||
Set a
|
||||
.I cu
|
||||
variable to the given value. If value is not given, the variable is
|
||||
set to
|
||||
.B true.
|
||||
.TP 5
|
||||
.B ~! variable
|
||||
Set a
|
||||
.I cu
|
||||
variable to
|
||||
.B false.
|
||||
.TP 5
|
||||
.B ~z
|
||||
Suspend the cu session. This is only supported on some systems. On
|
||||
systems for which ^Z may be used to suspend a job,
|
||||
.B ~^Z
|
||||
will also suspend the session.
|
||||
.TP 5
|
||||
.B ~%nostop
|
||||
Turn off XON/XOFF handling.
|
||||
.TP 5
|
||||
.B ~%stop
|
||||
Turn on XON/XOFF handling.
|
||||
.TP 5
|
||||
.B ~v
|
||||
List all the variables and their values.
|
||||
.TP 5
|
||||
.B ~?
|
||||
List all commands.
|
||||
|
||||
.I cu
|
||||
also supports several variables. They may be listed with the
|
||||
.B ~v
|
||||
command, and set with the
|
||||
.B ~s
|
||||
or
|
||||
.B ~!
|
||||
commands.
|
||||
|
||||
.TP 5
|
||||
.B escape
|
||||
The escape character. Initially
|
||||
.B ~
|
||||
(tilde).
|
||||
.TP 5
|
||||
.B delay
|
||||
If this variable is true,
|
||||
.I cu
|
||||
will delay for a second after recognizing the escape character before
|
||||
printing the name of the local system. The default is true.
|
||||
.TP 5
|
||||
.B eol
|
||||
The list of characters which are considered to finish a line. The
|
||||
escape character is only recognized after one of these is seen. The
|
||||
default is carriage return, ^U, ^C, ^O, ^D, ^S, ^Q, ^R.
|
||||
.TP 5
|
||||
.B binary
|
||||
Whether to transfer binary data when sending a file. If this is
|
||||
false, then newlines in the file being sent are converted to carriage
|
||||
returns. The default is false.
|
||||
.TP 5
|
||||
.B binary-prefix
|
||||
A string used before sending a binary character in a file transfer, if
|
||||
the
|
||||
.B binary
|
||||
variable is true. The default is ^V.
|
||||
.TP 5
|
||||
.B echo-check
|
||||
Whether to check file transfers by examining what the remote system
|
||||
echoes back. This probably doesn't work very well. The default is
|
||||
false.
|
||||
.TP 5
|
||||
.B echonl
|
||||
The character to look for after sending each line in a file. The
|
||||
default is carriage return.
|
||||
.TP 5
|
||||
.B timeout
|
||||
The timeout to use, in seconds, when looking for a character, either
|
||||
when doing echo checking or when looking for the
|
||||
.B echonl
|
||||
character. The default is 30.
|
||||
.TP 5
|
||||
.B kill
|
||||
The character to use delete a line if the echo check fails. The
|
||||
default is ^U.
|
||||
.TP 5
|
||||
.B resend
|
||||
The number of times to resend a line if the echo check continues to
|
||||
fail. The default is 10.
|
||||
.TP 5
|
||||
.B eofwrite
|
||||
The string to write after sending a file with the
|
||||
.B ~>
|
||||
command. The default is ^D.
|
||||
.TP 5
|
||||
.B eofread
|
||||
The string to look for when receiving a file with the
|
||||
.B ~<
|
||||
command. The default is $, which is intended to be a typical shell
|
||||
prompt.
|
||||
.TP 5
|
||||
.B verbose
|
||||
Whether to print accumulated information during a file transfer. The
|
||||
default is true.
|
||||
.SH OPTIONS
|
||||
The following options may be given to
|
||||
.I cu.
|
||||
.TP 5
|
||||
.B \-e, \-\-parity=even
|
||||
Use even parity.
|
||||
.TP 5
|
||||
.B \-o, \-\-parity=odd
|
||||
Use odd parity.
|
||||
.TP 5
|
||||
.B \-\-parity=none
|
||||
Use no parity. No parity is also used if both
|
||||
.B \-e
|
||||
and
|
||||
.B \-o
|
||||
are given.
|
||||
.TP 5
|
||||
.B \-h, \-\-halfduplex
|
||||
Echo characters locally (half-duplex mode).
|
||||
.TP 5
|
||||
.B \-\-nostop
|
||||
Turn off XON/XOFF handling (it is on by default).
|
||||
.TP 5
|
||||
.B \-E char, \-\-escape char
|
||||
Set the escape character. Initially
|
||||
.B ~
|
||||
(tilde). To eliminate the escape character, use
|
||||
.B -E ''.
|
||||
.TP 5
|
||||
.B \-z system, \-\-system system
|
||||
The system to call.
|
||||
.TP 5
|
||||
.B \-c phone-number, \-\-phone phone-number
|
||||
The phone number to call.
|
||||
.TP 5
|
||||
.B \-p port, \-\-port port
|
||||
Name the port to use.
|
||||
.TP 5
|
||||
.B \-a port
|
||||
Equivalent to
|
||||
.B \-\-port port.
|
||||
.TP 5
|
||||
.B \-l line, \-\-line line
|
||||
Name the line to use by giving a device name. This may be used to
|
||||
dial out on ports that are not listed in the UUCP configuration files.
|
||||
Write access to the device is required.
|
||||
.TP 5
|
||||
.B \-s speed, \-\-speed speed
|
||||
The speed (baud rate) to use.
|
||||
.TP 5
|
||||
.B \-#
|
||||
Where # is a number, equivalent to
|
||||
.B \-\-speed #.
|
||||
.TP 5
|
||||
.B \-n, \-\-prompt
|
||||
Prompt for the phone number to use.
|
||||
.TP 5
|
||||
.B \-d
|
||||
Enter debugging mode. Equivalent to
|
||||
.B \-\-debug all.
|
||||
.TP 5
|
||||
.B \-x type, \-\-debug type
|
||||
Turn on particular debugging types. The following types are
|
||||
recognized: abnormal, chat, handshake, uucp-proto, proto, port,
|
||||
config, spooldir, execute, incoming, outgoing. Only abnormal, chat,
|
||||
handshake, port, config, incoming and outgoing are meaningful for
|
||||
.I cu.
|
||||
|
||||
Multiple types may be given, separated by commas, and the
|
||||
.B \-\-debug
|
||||
option may appear multiple times. A number may also be given, which
|
||||
will turn on that many types from the foregoing list; for example,
|
||||
.B \-\-debug 2
|
||||
is equivalent to
|
||||
.B \-\-debug abnormal,chat.
|
||||
.B \-\-debug all
|
||||
may be used to turn on all debugging options.
|
||||
.TP 5
|
||||
.B \-I file, \-\-config file
|
||||
Set configuration file to use. This option may not be available,
|
||||
depending upon how
|
||||
.I cu
|
||||
was compiled.
|
||||
.TP 5
|
||||
.B \-v, \-\-version
|
||||
Report version information and exit.
|
||||
.TP 5
|
||||
.B \-\-help
|
||||
Print a help message and exit.
|
||||
.SH BUGS
|
||||
This program does not work very well.
|
||||
.SH FILES
|
||||
The file name may be changed at compilation time, so this is only an
|
||||
approximation.
|
||||
|
||||
.br
|
||||
/etc/uucp/config - Configuration file.
|
||||
.SH AUTHOR
|
||||
Ian Lance Taylor
|
||||
<ian@airs.com>
|
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
# This subdirectory contains Unix specific support functions.
|
||||
# $FreeBSD$
|
||||
|
||||
LIB= unix
|
||||
SRCS= basnam.c cusub.c efopen.c epopen.c init.c isdir.c isfork.c \
|
||||
iswait.c lock.c loctim.c mail.c mkdirs.c pause.c pipe.c \
|
||||
portnm.c proctm.c serial.c signal.c sindir.c sleep.c spawn.c \
|
||||
sync.c tcp.c time.c ufopen.c uid.c
|
||||
CFLAGS+= -I$(.CURDIR)/../common_sources \
|
||||
-DOWNER=\"$(owner)\" -DSBINDIR=\"$(libxdir)\"
|
||||
|
||||
NOMAN= noman
|
||||
NOPROFILE= noprofile
|
||||
|
||||
install:
|
||||
|
||||
.include <bsd.lib.mk>
|
@ -1,22 +0,0 @@
|
||||
/* basnam.c
|
||||
Get the base name of a file. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
/* Get the base name of a file name. */
|
||||
|
||||
char *
|
||||
zsysdep_base_name (zfile)
|
||||
const char *zfile;
|
||||
{
|
||||
const char *z;
|
||||
|
||||
z = strrchr (zfile, '/');
|
||||
if (z != NULL)
|
||||
return zbufcpy (z + 1);
|
||||
return zbufcpy (zfile);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,132 +0,0 @@
|
||||
/* efopen.c
|
||||
Open a stdio file with appropriate permissions. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#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_APPEND
|
||||
#ifdef FAPPEND
|
||||
#define O_APPEND FAPPEND
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef O_NOCTTY
|
||||
#define O_NOCTTY 0
|
||||
#endif
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
#define FD_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
FILE *
|
||||
esysdep_fopen (zfile, fpublic, fappend, fmkdirs)
|
||||
const char *zfile;
|
||||
boolean fpublic;
|
||||
boolean fappend;
|
||||
boolean fmkdirs;
|
||||
{
|
||||
int imode;
|
||||
int o;
|
||||
FILE *e;
|
||||
|
||||
if (fpublic)
|
||||
imode = IPUBLIC_FILE_MODE;
|
||||
else
|
||||
imode = IPRIVATE_FILE_MODE;
|
||||
|
||||
if (! fappend)
|
||||
o = creat ((char *) zfile, imode);
|
||||
else
|
||||
{
|
||||
#ifdef O_CREAT
|
||||
o = open ((char *) zfile,
|
||||
O_WRONLY | O_APPEND | O_CREAT | O_NOCTTY,
|
||||
imode);
|
||||
#else
|
||||
o = open ((char *) zfile, O_WRONLY | O_NOCTTY);
|
||||
if (o < 0 && errno == ENOENT)
|
||||
o = creat ((char *) zfile, imode);
|
||||
#endif /* ! defined (O_CREAT) */
|
||||
}
|
||||
|
||||
if (o < 0)
|
||||
{
|
||||
if (errno == ENOENT && fmkdirs)
|
||||
{
|
||||
if (! fsysdep_make_dirs (zfile, fpublic))
|
||||
return NULL;
|
||||
if (! fappend)
|
||||
o = creat ((char *) zfile, imode);
|
||||
else
|
||||
{
|
||||
#ifdef O_CREAT
|
||||
o = open ((char *) zfile,
|
||||
O_WRONLY | O_APPEND | O_CREAT | O_NOCTTY,
|
||||
imode);
|
||||
#else
|
||||
o = creat ((char *) zfile, imode);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (o < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "open (%s): %s", zfile, strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef O_CREAT
|
||||
#ifdef O_APPEND
|
||||
if (fappend)
|
||||
{
|
||||
if (fcntl (o, F_SETFL, O_APPEND) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "fcntl (%s, O_APPEND): %s", zfile,
|
||||
strerror (errno));
|
||||
(void) close (o);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif /* defined (O_APPEND) */
|
||||
#endif /* ! defined (O_CREAT) */
|
||||
|
||||
if (fcntl (o, F_SETFD, fcntl (o, F_GETFD, 0) | FD_CLOEXEC) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "fcntl (%s, FD_CLOEXEC): %s", zfile,
|
||||
strerror (errno));
|
||||
(void) close (o);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fappend)
|
||||
e = fdopen (o, (char *) "a");
|
||||
else
|
||||
e = fdopen (o, (char *) "w");
|
||||
|
||||
if (e == NULL)
|
||||
{
|
||||
ulog (LOG_ERROR, "fdopen: %s", strerror (errno));
|
||||
(void) close (o);
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/* epopen.c
|
||||
A version of popen that goes through ixsspawn.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* A version of popen that goes through ixsspawn. This actually takes
|
||||
an array of arguments rather than a string, and takes a boolean
|
||||
read/write value rather than a string. It sets *pipid to the
|
||||
process ID of the child. */
|
||||
|
||||
FILE *
|
||||
espopen (pazargs, frd, pipid)
|
||||
const char **pazargs;
|
||||
boolean frd;
|
||||
pid_t *pipid;
|
||||
{
|
||||
int aidescs[3];
|
||||
pid_t ipid;
|
||||
FILE *eret;
|
||||
|
||||
if (frd)
|
||||
{
|
||||
aidescs[0] = SPAWN_NULL;
|
||||
aidescs[1] = SPAWN_READ_PIPE;
|
||||
}
|
||||
else
|
||||
{
|
||||
aidescs[0] = SPAWN_WRITE_PIPE;
|
||||
aidescs[1] = SPAWN_NULL;
|
||||
}
|
||||
aidescs[2] = SPAWN_NULL;
|
||||
|
||||
ipid = ixsspawn (pazargs, aidescs, TRUE, FALSE,
|
||||
(const char *) NULL, FALSE, TRUE,
|
||||
(const char *) NULL, (const char *) NULL,
|
||||
(const char *) NULL);
|
||||
if (ipid < 0)
|
||||
return NULL;
|
||||
|
||||
if (frd)
|
||||
eret = fdopen (aidescs[1], (char *) "r");
|
||||
else
|
||||
eret = fdopen (aidescs[0], (char *) "w");
|
||||
if (eret == NULL)
|
||||
{
|
||||
int ierr;
|
||||
|
||||
ierr = errno;
|
||||
(void) close (frd ? aidescs[1] : aidescs[0]);
|
||||
(void) kill (ipid, SIGKILL);
|
||||
(void) ixswait ((unsigned long) ipid, (const char *) NULL);
|
||||
errno = ierr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*pipid = ipid;
|
||||
|
||||
return eret;
|
||||
}
|
@ -1,401 +0,0 @@
|
||||
/* init.c
|
||||
Initialize the system dependent routines.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1994 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "uuconf.h"
|
||||
#include "system.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#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
|
||||
|
||||
#if ! HAVE_GETHOSTNAME && HAVE_UNAME
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
/* Use getcwd in preference to getwd; if we have neither, we will be
|
||||
using a getcwd replacement. */
|
||||
#if HAVE_GETCWD
|
||||
#undef HAVE_GETWD
|
||||
#define HAVE_GETWD 0
|
||||
#else /* ! HAVE_GETCWD */
|
||||
#if ! HAVE_GETWD
|
||||
#undef HAVE_GETCWD
|
||||
#define HAVE_GETCWD 1
|
||||
#endif /* ! HAVE_GETWD */
|
||||
#endif /* ! HAVE_GETCWD */
|
||||
|
||||
#if HAVE_GETWD
|
||||
/* Get a value for MAXPATHLEN. */
|
||||
#if HAVE_SYS_PARAMS_H
|
||||
#include <sys/params.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef PATH_MAX
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#else /* ! defined (PATH_MAX) */
|
||||
#define MAXPATHLEN 1024
|
||||
#endif /* ! defined (PATH_MAX) */
|
||||
#endif /* ! defined (MAXPATHLEN) */
|
||||
#endif /* HAVE_GETWD */
|
||||
|
||||
/* External functions. */
|
||||
#ifndef getlogin
|
||||
extern char *getlogin ();
|
||||
#endif
|
||||
#if GETPWNAM_DECLARATION_OK
|
||||
#ifndef getpwnam
|
||||
extern struct passwd *getpwnam ();
|
||||
#endif
|
||||
#endif
|
||||
#if GETPWUID_DECLARATION_OK
|
||||
#ifndef getpwuid
|
||||
extern struct passwd *getpwuid ();
|
||||
#endif
|
||||
#endif
|
||||
#if HAVE_GETCWD
|
||||
#ifndef getcwd
|
||||
extern char *getcwd ();
|
||||
#endif
|
||||
#endif
|
||||
#if HAVE_GETWD
|
||||
#ifndef getwd
|
||||
extern char *getwd ();
|
||||
#endif
|
||||
#endif
|
||||
#if HAVE_SYSCONF
|
||||
#ifndef sysconf
|
||||
extern long sysconf ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Initialize the system dependent routines. We will probably be running
|
||||
suid to uucp, so we make sure that nothing is obviously wrong. We
|
||||
save the login name since we will be losing the real uid. */
|
||||
static char *zSlogin;
|
||||
|
||||
/* The UUCP spool directory. */
|
||||
const char *zSspooldir;
|
||||
|
||||
/* The UUCP lock directory. */
|
||||
const char *zSlockdir;
|
||||
|
||||
/* The local UUCP name. */
|
||||
const char *zSlocalname;
|
||||
|
||||
/* We save the current directory since we will do a chdir to the
|
||||
spool directory. */
|
||||
char *zScwd;
|
||||
|
||||
/* The maximum length of a system name is controlled by the type of spool
|
||||
directory we use. */
|
||||
#if SPOOLDIR_V2 || SPOOLDIR_BSD42 || SPOOLDIR_BSD43 || SPOOLDIR_ULTRIX
|
||||
size_t cSysdep_max_name_len = 7;
|
||||
#endif
|
||||
#if SPOOLDIR_HDB || SPOOLDIR_SVR4
|
||||
size_t cSysdep_max_name_len = 14;
|
||||
#endif
|
||||
#if SPOOLDIR_TAYLOR
|
||||
#if HAVE_LONG_FILE_NAMES
|
||||
size_t cSysdep_max_name_len = 255;
|
||||
#else /* ! HAVE_LONG_FILE_NAMES */
|
||||
size_t cSysdep_max_name_len = 14;
|
||||
#endif /* ! HAVE_LONG_FILE_NAMES */
|
||||
#endif /* SPOOLDIR_TAYLOR */
|
||||
|
||||
/* Initialize the system dependent routines. */
|
||||
|
||||
void
|
||||
usysdep_initialize (puuconf,iflags)
|
||||
pointer puuconf;
|
||||
int iflags;
|
||||
{
|
||||
int iuuconf;
|
||||
char *z;
|
||||
struct passwd *q;
|
||||
|
||||
ulog_id (getpid ());
|
||||
|
||||
if ((iflags & INIT_NOCLOSE) == 0)
|
||||
{
|
||||
int cdescs;
|
||||
int o;
|
||||
|
||||
/* Close everything but stdin, stdout and stderr. */
|
||||
#if HAVE_GETDTABLESIZE
|
||||
cdescs = getdtablesize ();
|
||||
#else
|
||||
#if HAVE_SYSCONF
|
||||
cdescs = sysconf (_SC_OPEN_MAX);
|
||||
#else
|
||||
#ifdef OPEN_MAX
|
||||
cdescs = OPEN_MAX;
|
||||
#else
|
||||
#ifdef NOFILE
|
||||
cdescs = NOFILE;
|
||||
#else
|
||||
cdescs = 20;
|
||||
#endif /* ! defined (NOFILE) */
|
||||
#endif /* ! defined (OPEN_MAX) */
|
||||
#endif /* ! HAVE_SYSCONF */
|
||||
#endif /* ! HAVE_GETDTABLESIZE */
|
||||
|
||||
for (o = 3; o < cdescs; o++)
|
||||
(void) close (o);
|
||||
}
|
||||
|
||||
/* Make sure stdin, stdout and stderr are open. */
|
||||
if (fcntl (0, F_GETFD, 0) < 0
|
||||
&& open ((char *) _PATH_DEVNULL, O_RDONLY, 0) != 0)
|
||||
exit (EXIT_FAILURE);
|
||||
if (fcntl (1, F_GETFD, 0) < 0
|
||||
&& open ((char *) _PATH_DEVNULL, O_WRONLY, 0) != 1)
|
||||
exit (EXIT_FAILURE);
|
||||
if (fcntl (2, F_GETFD, 0) < 0
|
||||
&& open ((char *) _PATH_DEVNULL, O_WRONLY, 0) != 2)
|
||||
exit (EXIT_FAILURE);
|
||||
|
||||
iuuconf = uuconf_spooldir (puuconf, &zSspooldir);
|
||||
if (iuuconf != UUCONF_SUCCESS)
|
||||
ulog_uuconf (LOG_FATAL, puuconf, iuuconf);
|
||||
|
||||
iuuconf = uuconf_lockdir (puuconf, &zSlockdir);
|
||||
if (iuuconf != UUCONF_SUCCESS)
|
||||
ulog_uuconf (LOG_FATAL, puuconf, iuuconf);
|
||||
|
||||
iuuconf = uuconf_localname (puuconf, &zSlocalname);
|
||||
if (iuuconf == UUCONF_NOT_FOUND)
|
||||
{
|
||||
#if HAVE_GETHOSTNAME
|
||||
char ab[256];
|
||||
|
||||
if (gethostname (ab, sizeof ab - 1) < 0)
|
||||
ulog (LOG_FATAL, "gethostname: %s", strerror (errno));
|
||||
ab[sizeof ab - 1] = '\0';
|
||||
ab[strcspn (ab, ".")] = '\0';
|
||||
zSlocalname = zbufcpy (ab);
|
||||
#else /* ! HAVE_GETHOSTNAME */
|
||||
#if HAVE_UNAME
|
||||
struct utsname s;
|
||||
|
||||
if (uname (&s) < 0)
|
||||
ulog (LOG_FATAL, "uname: %s", strerror (errno));
|
||||
zSlocalname = zbufcpy (s.nodename);
|
||||
#else /* ! HAVE_UNAME */
|
||||
ulog (LOG_FATAL, "Don't know how to get local node name");
|
||||
#endif /* ! HAVE_UNAME */
|
||||
#endif /* ! HAVE_GETHOSTNAME */
|
||||
}
|
||||
else if (iuuconf != UUCONF_SUCCESS)
|
||||
ulog_uuconf (LOG_FATAL, puuconf, iuuconf);
|
||||
|
||||
/* We always set our file modes to exactly what we want. */
|
||||
umask (0);
|
||||
|
||||
/* Get the login name, making sure that it matches the uid. Many
|
||||
systems truncate the getlogin return value to 8 characters, but
|
||||
keep the full name in the password file, so we prefer the name in
|
||||
the password file. */
|
||||
z = getenv ("LOGNAME");
|
||||
if (z == NULL)
|
||||
z = getenv ("USER");
|
||||
if (z == NULL)
|
||||
z = getlogin ();
|
||||
if (z == NULL)
|
||||
q = NULL;
|
||||
else
|
||||
{
|
||||
q = getpwnam (z);
|
||||
if (q != NULL)
|
||||
z = q->pw_name;
|
||||
}
|
||||
if (q == NULL || q->pw_uid != getuid ())
|
||||
{
|
||||
q = getpwuid (getuid ());
|
||||
if (q == NULL)
|
||||
z = NULL;
|
||||
else
|
||||
z = q->pw_name;
|
||||
}
|
||||
if (z != NULL)
|
||||
zSlogin = zbufcpy (z);
|
||||
|
||||
/* On some old systems, an suid program run by root is started with
|
||||
an euid of 0. If this happens, we look up the uid we should have
|
||||
and set ourselves to it manually. This means that on such a
|
||||
system root will not be able to uucp or uux files that are not
|
||||
readable by uucp. */
|
||||
if ((iflags & INIT_SUID) != 0
|
||||
&& geteuid () == 0)
|
||||
{
|
||||
q = getpwnam (OWNER);
|
||||
if (q != NULL)
|
||||
setuid (q->pw_uid);
|
||||
}
|
||||
|
||||
if ((iflags & INIT_GETCWD) != 0)
|
||||
{
|
||||
const char *zenv;
|
||||
struct stat senv, sdot;
|
||||
|
||||
/* Get the current working directory. We have to get it now,
|
||||
since we're about to do a chdir. We use PWD if it's defined
|
||||
and if it really names the working directory, since if it's
|
||||
not the same as whatever getcwd returns it's probably more
|
||||
appropriate. */
|
||||
zenv = getenv ("PWD");
|
||||
if (zenv != NULL
|
||||
&& stat ((char *) zenv, &senv) == 0
|
||||
&& stat ((char *) ".", &sdot) == 0
|
||||
&& senv.st_ino == sdot.st_ino
|
||||
&& senv.st_dev == sdot.st_dev)
|
||||
zScwd = zbufcpy (zenv);
|
||||
else
|
||||
{
|
||||
|
||||
#if HAVE_GETCWD
|
||||
{
|
||||
size_t c;
|
||||
|
||||
c = 128;
|
||||
while (TRUE)
|
||||
{
|
||||
zScwd = (char *) xmalloc (c);
|
||||
if (getcwd (zScwd, c) != NULL)
|
||||
break;
|
||||
xfree ((pointer) zScwd);
|
||||
zScwd = NULL;
|
||||
if (errno != ERANGE)
|
||||
break;
|
||||
c <<= 1;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_GETCWD */
|
||||
|
||||
#if HAVE_GETWD
|
||||
zScwd = (char *) xmalloc (MAXPATHLEN);
|
||||
if (getwd (zScwd) == NULL)
|
||||
{
|
||||
xfree ((pointer) zScwd);
|
||||
zScwd = NULL;
|
||||
}
|
||||
#endif /* HAVE_GETWD */
|
||||
|
||||
if (zScwd != NULL)
|
||||
zScwd = (char *) xrealloc ((pointer) zScwd,
|
||||
strlen (zScwd) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((iflags & INIT_NOCHDIR) == 0)
|
||||
{
|
||||
/* Connect to the spool directory, and create it if it doesn't
|
||||
exist. */
|
||||
if (chdir (zSspooldir) < 0)
|
||||
{
|
||||
if (errno == ENOENT
|
||||
&& mkdir ((char *) zSspooldir, IDIRECTORY_MODE) < 0)
|
||||
ulog (LOG_FATAL, "mkdir (%s): %s", zSspooldir,
|
||||
strerror (errno));
|
||||
if (chdir (zSspooldir) < 0)
|
||||
ulog (LOG_FATAL, "chdir (%s): %s", zSspooldir,
|
||||
strerror (errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Exit the program. */
|
||||
|
||||
void
|
||||
usysdep_exit (fsuccess)
|
||||
boolean fsuccess;
|
||||
{
|
||||
exit (fsuccess ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* This is called when a non-standard configuration file is used, to
|
||||
make sure the program doesn't hand out privileged file access.
|
||||
This means that to test non-standard configuration files, you
|
||||
should be logged in as uucp. This is called before
|
||||
usysdep_initialize. It ensures that someone can't simply use an
|
||||
alternate configuration file to steal UUCP transfers from other
|
||||
systems. This will still permit people to set up their own
|
||||
configuration file and pretend to be whatever system they choose.
|
||||
The only real security is to use a high level of protection on the
|
||||
modem ports. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean fsysdep_other_config (z)
|
||||
const char *z;
|
||||
{
|
||||
(void) setuid (getuid ());
|
||||
(void) setgid (getgid ());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Get the node name to use if it was not specified in the configuration
|
||||
file. */
|
||||
|
||||
const char *
|
||||
zsysdep_localname ()
|
||||
{
|
||||
return zSlocalname;
|
||||
}
|
||||
|
||||
/* Get the login name. We actually get the login name in
|
||||
usysdep_initialize, because after that we may switch away from the
|
||||
real uid. */
|
||||
|
||||
const char *
|
||||
zsysdep_login_name ()
|
||||
{
|
||||
if (zSlogin == NULL)
|
||||
ulog (LOG_FATAL, "Can't get login name");
|
||||
return zSlogin;
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/* isdir.c
|
||||
See whether a file exists and is a directory. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "system.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
boolean
|
||||
fsysdep_directory (z)
|
||||
const char *z;
|
||||
{
|
||||
struct stat s;
|
||||
|
||||
if (stat ((char *) z, &s) < 0)
|
||||
return FALSE;
|
||||
return S_ISDIR (s.st_mode);
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
/* isfork.c
|
||||
Retry fork several times before giving up. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
pid_t
|
||||
ixsfork ()
|
||||
{
|
||||
int i;
|
||||
pid_t iret;
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
iret = fork ();
|
||||
if (iret >= 0 || errno != EAGAIN)
|
||||
return iret;
|
||||
sleep (5);
|
||||
}
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
/* iswait.c
|
||||
Wait for a process to finish.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
/* We use a typedef wait_status for wait (waitpid, wait4) to put
|
||||
results into. We define the POSIX examination functions we need if
|
||||
they are not already defined (if they aren't defined, I assume that
|
||||
we have a standard wait status). */
|
||||
|
||||
#if HAVE_UNION_WAIT
|
||||
typedef union wait wait_status;
|
||||
#ifndef WIFEXITED
|
||||
#define WIFEXITED(u) ((u).w_termsig == 0)
|
||||
#endif
|
||||
#ifndef WEXITSTATUS
|
||||
#define WEXITSTATUS(u) ((u).w_retcode)
|
||||
#endif
|
||||
#ifndef WTERMSIG
|
||||
#define WTERMSIG(u) ((u).w_termsig)
|
||||
#endif
|
||||
#else /* ! HAVE_UNION_WAIT */
|
||||
typedef int wait_status;
|
||||
#ifndef WIFEXITED
|
||||
#define WIFEXITED(i) (((i) & 0xff) == 0)
|
||||
#endif
|
||||
#ifndef WEXITSTATUS
|
||||
#define WEXITSTATUS(i) (((i) >> 8) & 0xff)
|
||||
#endif
|
||||
#ifndef WTERMSIG
|
||||
#define WTERMSIG(i) ((i) & 0x7f)
|
||||
#endif
|
||||
#endif /* ! HAVE_UNION_WAIT */
|
||||
|
||||
/* Wait for a particular process to finish. The ipid argument should
|
||||
be pid_t, but then we couldn't have a prototype. If the zreport
|
||||
argument is not NULL, then a wait error will be logged, and if the
|
||||
exit status is non-zero it will be logged with zreport as the
|
||||
header of the log message. If the zreport argument is NULL, no
|
||||
errors will be logged. This function returns the exit status if
|
||||
the process exited normally, or -1 on error or if the process was
|
||||
killed by a signal (I don't just always return the exit status
|
||||
because then the calling code would have to prepared to handle
|
||||
union wait status vs. int status, and none of the callers care
|
||||
which signal killed the program anyhow).
|
||||
|
||||
This functions keeps waiting until the process finished, even if it
|
||||
is interrupted by a signal. I think this is right for all uses.
|
||||
The controversial one would be when called from uuxqt to wait for a
|
||||
requested process. Hitting uuxqt with SIGKILL will approximate the
|
||||
actions taken if we return from here with an error anyhow. If we
|
||||
do get a signal, we call ulog with a NULL argument to get it in the
|
||||
log file at about the right time. */
|
||||
|
||||
int
|
||||
ixswait (ipid, zreport)
|
||||
unsigned long ipid;
|
||||
const char *zreport;
|
||||
{
|
||||
wait_status istat;
|
||||
|
||||
#if HAVE_WAITPID
|
||||
while (waitpid ((pid_t) ipid, (pointer) &istat, 0) < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
if (zreport != NULL)
|
||||
ulog (LOG_ERROR, "waitpid: %s", strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
ulog (LOG_ERROR, (const char *) NULL);
|
||||
}
|
||||
#else /* ! HAVE_WAITPID */
|
||||
#if HAVE_WAIT4
|
||||
while (wait4 ((pid_t) ipid, (pointer) &istat, 0,
|
||||
(struct rusage *) NULL) < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
if (zreport != NULL)
|
||||
ulog (LOG_ERROR, "wait4: %s", strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
ulog (LOG_ERROR, (const char *) NULL);
|
||||
}
|
||||
#else /* ! HAVE_WAIT4 */
|
||||
pid_t igot;
|
||||
|
||||
/* We could theoretically get the wrong child here if we're in some
|
||||
kind of weird pipeline, so we don't give any error messages for
|
||||
it. */
|
||||
while ((igot = wait ((pointer) &istat)) != (pid_t) ipid)
|
||||
{
|
||||
if (igot < 0)
|
||||
{
|
||||
if (errno != EINTR)
|
||||
{
|
||||
if (zreport != NULL)
|
||||
ulog (LOG_ERROR, "wait: %s", strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
ulog (LOG_ERROR, (const char *) NULL);
|
||||
}
|
||||
}
|
||||
#endif /* ! HAVE_WAIT4 */
|
||||
#endif /* ! HAVE_WAITPID */
|
||||
|
||||
DEBUG_MESSAGE2 (DEBUG_EXECUTE, "%s %d",
|
||||
WIFEXITED (istat) ? "Exit status" : "Signal",
|
||||
WIFEXITED (istat) ? WEXITSTATUS (istat) : WTERMSIG (istat));
|
||||
|
||||
if (WIFEXITED (istat) && WEXITSTATUS (istat) == 0)
|
||||
return 0;
|
||||
|
||||
if (zreport != NULL)
|
||||
{
|
||||
if (! WIFEXITED (istat))
|
||||
ulog (LOG_ERROR, "%s: Got signal %d", zreport, WTERMSIG (istat));
|
||||
else
|
||||
ulog (LOG_ERROR, "%s: Exit status %d", zreport,
|
||||
WEXITSTATUS (istat));
|
||||
}
|
||||
|
||||
if (WIFEXITED (istat))
|
||||
return WEXITSTATUS (istat);
|
||||
else
|
||||
return -1;
|
||||
}
|
@ -1,690 +0,0 @@
|
||||
/* lock.c
|
||||
Lock and unlock a file name.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char lock_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#if HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/psinfo.h>
|
||||
#include <sys/seginfo.h>
|
||||
#include <sys/vc.h>
|
||||
#endif
|
||||
|
||||
#ifndef O_RDONLY
|
||||
#define O_RDONLY 0
|
||||
#define O_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
#endif
|
||||
|
||||
#ifndef O_NOCTTY
|
||||
#define O_NOCTTY 0
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0
|
||||
#endif
|
||||
|
||||
#ifndef localtime
|
||||
extern struct tm *localtime ();
|
||||
#endif
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
static boolean fsqnx_stale P((unsigned long ipid, unsigned long inme,
|
||||
unsigned long inid, boolean *pferr));
|
||||
#endif
|
||||
|
||||
/* Lock something. If the fspooldir argument is TRUE, the argument is
|
||||
a file name relative to the spool directory; otherwise the argument
|
||||
is a simple file name which should be created in the system lock
|
||||
directory (under HDB this is /etc/locks). */
|
||||
|
||||
boolean
|
||||
fsdo_lock (zlock, fspooldir, pferr)
|
||||
const char *zlock;
|
||||
boolean fspooldir;
|
||||
boolean *pferr;
|
||||
{
|
||||
char *zfree;
|
||||
const char *zpath, *zslash;
|
||||
size_t cslash;
|
||||
pid_t ime;
|
||||
char *ztempfile;
|
||||
char abtempfile[sizeof "TMP12345678901234567890"];
|
||||
int o;
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
nid_t inme;
|
||||
char ab[23];
|
||||
char *zend;
|
||||
#else
|
||||
#if HAVE_V2_LOCKFILES
|
||||
int i;
|
||||
#else
|
||||
char ab[12];
|
||||
#endif
|
||||
#endif
|
||||
int cwrote;
|
||||
const char *zerr;
|
||||
boolean fret;
|
||||
|
||||
if (pferr != NULL)
|
||||
*pferr = TRUE;
|
||||
|
||||
if (fspooldir)
|
||||
{
|
||||
zfree = NULL;
|
||||
zpath = zlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
zfree = zsysdep_in_dir (zSlockdir, zlock);
|
||||
zpath = zfree;
|
||||
}
|
||||
|
||||
ime = getpid ();
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
inme = getnid ();
|
||||
#endif
|
||||
|
||||
/* We do the actual lock by creating a file and then linking it to
|
||||
the final file name we want. This avoids race conditions due to
|
||||
one process checking the file before we have finished writing it,
|
||||
and also works even if we are somehow running as root.
|
||||
|
||||
First, create the file in the right directory (we must create the
|
||||
file in the same directory since otherwise we might attempt a
|
||||
cross-device link). */
|
||||
zslash = strrchr (zpath, '/');
|
||||
if (zslash == NULL)
|
||||
cslash = 0;
|
||||
else
|
||||
cslash = zslash - zpath + 1;
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
sprintf (abtempfile, "TMP%010lx%010lx", (unsigned long) ime,
|
||||
(unsigned long) inme);
|
||||
#else
|
||||
sprintf (abtempfile, "TMP%010lx", (unsigned long) ime);
|
||||
#endif
|
||||
ztempfile = zbufalc (cslash + sizeof abtempfile);
|
||||
memcpy (ztempfile, zpath, cslash);
|
||||
memcpy (ztempfile + cslash, abtempfile, sizeof abtempfile);
|
||||
|
||||
o = creat (ztempfile, IPUBLIC_FILE_MODE);
|
||||
if (o < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
if (! fsysdep_make_dirs (ztempfile, FALSE))
|
||||
{
|
||||
ubuffree (zfree);
|
||||
ubuffree (ztempfile);
|
||||
return FALSE;
|
||||
}
|
||||
o = creat (ztempfile, IPUBLIC_FILE_MODE);
|
||||
}
|
||||
if (o < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "creat (%s): %s", ztempfile, strerror (errno));
|
||||
ubuffree (zfree);
|
||||
ubuffree (ztempfile);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
sprintf (ab, "%10ld %10ld\n", (long) ime, (long) inme);
|
||||
cwrote = write (o, ab, strlen (ab));
|
||||
#else
|
||||
#if HAVE_V2_LOCKFILES
|
||||
i = (int) ime;
|
||||
cwrote = write (o, &i, sizeof i);
|
||||
#else
|
||||
sprintf (ab, "%10ld\n", (long) ime);
|
||||
cwrote = write (o, ab, strlen (ab));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
zerr = NULL;
|
||||
if (cwrote < 0)
|
||||
zerr = "write";
|
||||
if (close (o) < 0)
|
||||
zerr = "close";
|
||||
if (zerr != NULL)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s (%s): %s", zerr, ztempfile, strerror (errno));
|
||||
(void) remove (ztempfile);
|
||||
ubuffree (zfree);
|
||||
ubuffree (ztempfile);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Now try to link the file we just created to the lock file that we
|
||||
want. If it fails, try reading the existing file to make sure
|
||||
the process that created it still exists. We do this in a loop
|
||||
to make it easy to retry if the old locking process no longer
|
||||
exists. */
|
||||
fret = TRUE;
|
||||
if (pferr != NULL)
|
||||
*pferr = FALSE;
|
||||
o = -1;
|
||||
zerr = NULL;
|
||||
|
||||
while (link (ztempfile, zpath) != 0)
|
||||
{
|
||||
int cgot;
|
||||
pid_t ipid;
|
||||
boolean freadonly;
|
||||
struct stat st;
|
||||
char abtime[sizeof "1991-12-31 12:00:00"];
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
nid_t inid;
|
||||
#endif
|
||||
|
||||
fret = FALSE;
|
||||
|
||||
if (errno != EEXIST)
|
||||
{
|
||||
ulog (LOG_ERROR, "link (%s, %s): %s", ztempfile, zpath,
|
||||
strerror (errno));
|
||||
if (pferr != NULL)
|
||||
*pferr = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
freadonly = FALSE;
|
||||
o = open ((char *) zpath, O_RDWR | O_NOCTTY, 0);
|
||||
if (o < 0)
|
||||
{
|
||||
if (errno == EACCES)
|
||||
{
|
||||
freadonly = TRUE;
|
||||
o = open ((char *) zpath, O_RDONLY, 0);
|
||||
}
|
||||
if (o < 0)
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
{
|
||||
/* The file was presumably removed between the link
|
||||
and the open. Try the link again. */
|
||||
fret = TRUE;
|
||||
continue;
|
||||
}
|
||||
zerr = "open";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The race starts here. See below for a discussion. */
|
||||
|
||||
#if HAVE_V2_LOCKFILES
|
||||
cgot = read (o, &i, sizeof i);
|
||||
#else
|
||||
cgot = read (o, ab, sizeof ab - 1);
|
||||
#endif
|
||||
|
||||
if (cgot < 0)
|
||||
{
|
||||
zerr = "read";
|
||||
break;
|
||||
}
|
||||
|
||||
#if DEBUG > 0
|
||||
#if HAVE_V2_LOCKFILES
|
||||
{
|
||||
char ab[10];
|
||||
|
||||
if (read (o, ab, sizeof ab) > 4
|
||||
&& isdigit (BUCHAR (ab[0])))
|
||||
ulog (LOG_ERROR,
|
||||
"Lock file %s may be HDB format; check LOCKFILES in policy.h",
|
||||
zpath);
|
||||
}
|
||||
#else
|
||||
if (cgot == 4)
|
||||
ulog (LOG_ERROR,
|
||||
"Lock file %s may be V2 format; check LOCKFILES in policy.h",
|
||||
zpath);
|
||||
#endif
|
||||
#endif /* DEBUG > 0 */
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
ab[cgot] = '\0';
|
||||
ipid = (pid_t) strtol (ab, &zend, 10);
|
||||
inid = (nid_t) strtol (zend, (char **) NULL, 10);
|
||||
#else
|
||||
#if HAVE_V2_LOCKFILES
|
||||
ipid = (pid_t) i;
|
||||
#else
|
||||
ab[cgot] = '\0';
|
||||
ipid = (pid_t) strtol (ab, (char **) NULL, 10);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* On NFS, the link might have actually succeeded even though we
|
||||
got a failure return. This can happen if the original
|
||||
acknowledgement was lost or delayed and the operation was
|
||||
retried. In this case the pid will be our own. This
|
||||
introduces a rather improbable race condition: if a stale
|
||||
lock was left with our process ID in it, and another process
|
||||
just did the kill, below, but has not yet changed the lock
|
||||
file to hold its own process ID, we could start up and make
|
||||
it all the way to here and think we have the lock. I'm not
|
||||
going to worry about this possibility. */
|
||||
if (ipid == ime)
|
||||
{
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
if (inid == inme)
|
||||
#endif
|
||||
{
|
||||
fret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the lock file is empty (cgot == 0), we assume that it is
|
||||
stale. This can happen if the system crashed after the lock
|
||||
file was created but before the process ID was written out. */
|
||||
if (cgot > 0)
|
||||
{
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
if (! fsqnx_stale ((unsigned long) ipid, (unsigned long) inme,
|
||||
(unsigned long) inid, pferr))
|
||||
break;
|
||||
#else
|
||||
/* If the process still exists, we will get EPERM rather
|
||||
than ESRCH. We then return FALSE to indicate that we
|
||||
cannot make the lock. */
|
||||
if (kill (ipid, 0) == 0 || errno == EPERM)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (fstat (o, &st) < 0)
|
||||
strcpy (abtime, "unknown");
|
||||
else
|
||||
{
|
||||
time_t itm;
|
||||
struct tm *q;
|
||||
|
||||
itm = (time_t) st.st_mtime;
|
||||
q = localtime (&itm);
|
||||
sprintf (abtime, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||
q->tm_year + 1900, q->tm_mon + 1, q->tm_mday, q->tm_hour,
|
||||
q->tm_min, q->tm_sec);
|
||||
}
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
ulog (LOG_ERROR,
|
||||
"Stale lock %s held by process %ld on node %ld created %s",
|
||||
zpath, (long) ipid, (long) inid, abtime);
|
||||
#else
|
||||
ulog (LOG_ERROR, "Stale lock %s held by process %ld created %s",
|
||||
zpath, (long) ipid, abtime);
|
||||
#endif
|
||||
|
||||
/* This is a stale lock, created by a process that no longer
|
||||
exists.
|
||||
|
||||
Now we could remove the file (and, if the file mode disallows
|
||||
writing, that's what we have to do), but we try to avoid
|
||||
doing so since it causes a race condition. If we remove the
|
||||
file, and are interrupted any time after we do the read until
|
||||
we do the remove, another process could get in, open the
|
||||
file, find that it was a stale lock, remove the file and
|
||||
create a new one. When we regained control we would remove
|
||||
the file the other process just created.
|
||||
|
||||
These files are being generated partially for the benefit of
|
||||
cu, and it would be nice to avoid the race however cu avoids
|
||||
it, so that the programs remain compatible. Unfortunately,
|
||||
nobody seems to know how cu avoids the race, or even if it
|
||||
tries to avoid it at all.
|
||||
|
||||
There are a few ways to avoid the race. We could use kernel
|
||||
locking primitives, but they may not be available. We could
|
||||
link to a special file name, but if that file were left lying
|
||||
around then no stale lock could ever be broken (Henry Spencer
|
||||
would think this was a good thing).
|
||||
|
||||
Instead I've implemented the following procedure: seek to the
|
||||
start of the file, write our pid into it, sleep for five
|
||||
seconds, and then make sure our pid is still there. Anybody
|
||||
who checks the file while we're asleep will find our pid
|
||||
there and fail the lock. The only race will come from
|
||||
another process which has done the read by the time we do our
|
||||
write. That process will then have five seconds to do its
|
||||
own write. When we wake up, we'll notice that our pid is no
|
||||
longer in the file, and retry the lock from the beginning.
|
||||
|
||||
This relies on the atomicity of write(2). If it possible for
|
||||
the writes of two processes to be interleaved, the two
|
||||
processes could livelock. POSIX unfortunately leaves this
|
||||
case explicitly undefined; however, given that the write is
|
||||
of less than a disk block, it's difficult to imagine an
|
||||
interleave occurring.
|
||||
|
||||
Note that this is still a race. If it takes the second
|
||||
process more than five seconds to do the kill, the lseek, and
|
||||
the write, both processes will think they have the lock.
|
||||
Perhaps the length of time to sleep should be configurable.
|
||||
Even better, perhaps I should add a configuration option to
|
||||
use a permanent lock file, which eliminates any race and
|
||||
forces the installer to be aware of the existence of the
|
||||
permanent lock file.
|
||||
|
||||
We stat the file after the sleep, to make sure some other
|
||||
program hasn't deleted it for us. */
|
||||
if (freadonly)
|
||||
{
|
||||
(void) close (o);
|
||||
o = -1;
|
||||
(void) remove (zpath);
|
||||
fret = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lseek (o, (off_t) 0, SEEK_SET) != 0)
|
||||
{
|
||||
zerr = "lseek";
|
||||
break;
|
||||
}
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
sprintf (ab, "%10ld %10ld\n", (long) ime, (long) inme);
|
||||
cwrote = write (o, ab, strlen (ab));
|
||||
#else
|
||||
#if HAVE_V2_LOCKFILES
|
||||
i = (int) ime;
|
||||
cwrote = write (o, &i, sizeof i);
|
||||
#else
|
||||
sprintf (ab, "%10ld\n", (long) ime);
|
||||
cwrote = write (o, ab, strlen (ab));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (cwrote < 0)
|
||||
{
|
||||
zerr = "write";
|
||||
break;
|
||||
}
|
||||
|
||||
(void) sleep (5);
|
||||
|
||||
if (lseek (o, (off_t) 0, SEEK_SET) != 0)
|
||||
{
|
||||
zerr = "lseek";
|
||||
break;
|
||||
}
|
||||
|
||||
#if HAVE_V2_LOCKFILES
|
||||
cgot = read (o, &i, sizeof i);
|
||||
#else
|
||||
cgot = read (o, ab, sizeof ab - 1);
|
||||
#endif
|
||||
|
||||
if (cgot < 0)
|
||||
{
|
||||
zerr = "read";
|
||||
break;
|
||||
}
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
ab[cgot] = '\0';
|
||||
ipid = (pid_t) strtol (ab, &zend, 10);
|
||||
inid = (nid_t) strtol (zend, (char **) NULL, 10);
|
||||
#else
|
||||
#if HAVE_V2_LOCKFILES
|
||||
ipid = (pid_t) i;
|
||||
#else
|
||||
ab[cgot] = '\0';
|
||||
ipid = (pid_t) strtol (ab, (char **) NULL, 10);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ipid == ime)
|
||||
{
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
if (inid == inme)
|
||||
#endif
|
||||
{
|
||||
struct stat sfile, sdescriptor;
|
||||
|
||||
/* It looks like we have the lock. Do the final stat
|
||||
check. */
|
||||
if (stat ((char *) zpath, &sfile) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
zerr = "stat";
|
||||
break;
|
||||
}
|
||||
/* Loop around and try again. */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fstat (o, &sdescriptor) < 0)
|
||||
{
|
||||
zerr = "fstat";
|
||||
break;
|
||||
}
|
||||
|
||||
if (sfile.st_ino == sdescriptor.st_ino
|
||||
&& sfile.st_dev == sdescriptor.st_dev)
|
||||
{
|
||||
/* Close the file before assuming we've
|
||||
succeeded to pick up any trailing errors. */
|
||||
if (close (o) < 0)
|
||||
{
|
||||
zerr = "close";
|
||||
break;
|
||||
}
|
||||
|
||||
o = -1;
|
||||
|
||||
/* We have the lock. */
|
||||
fret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Loop around and try the lock again. We keep doing this until
|
||||
the lock file holds a pid that exists. */
|
||||
(void) close (o);
|
||||
o = -1;
|
||||
fret = TRUE;
|
||||
}
|
||||
|
||||
if (zerr != NULL)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s (%s): %s", zerr, zpath, strerror (errno));
|
||||
if (pferr != NULL)
|
||||
*pferr = TRUE;
|
||||
}
|
||||
|
||||
if (o >= 0)
|
||||
(void) close (o);
|
||||
|
||||
ubuffree (zfree);
|
||||
|
||||
/* It would be nice if we could leave the temporary file around for
|
||||
future calls, but considering that we create lock files in
|
||||
various different directories it's probably more trouble than
|
||||
it's worth. */
|
||||
if (remove (ztempfile) != 0)
|
||||
ulog (LOG_ERROR, "remove (%s): %s", ztempfile, strerror (errno));
|
||||
|
||||
ubuffree (ztempfile);
|
||||
|
||||
return fret;
|
||||
}
|
||||
|
||||
/* Unlock something. The fspooldir argument is as in fsdo_lock. */
|
||||
|
||||
boolean
|
||||
fsdo_unlock (zlock, fspooldir)
|
||||
const char *zlock;
|
||||
boolean fspooldir;
|
||||
{
|
||||
char *zfree;
|
||||
const char *zpath;
|
||||
|
||||
if (fspooldir)
|
||||
{
|
||||
zfree = NULL;
|
||||
zpath = zlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
zfree = zsysdep_in_dir (zSlockdir, zlock);
|
||||
zpath = zfree;
|
||||
}
|
||||
|
||||
if (remove (zpath) == 0
|
||||
|| errno == ENOENT)
|
||||
{
|
||||
ubuffree (zfree);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulog (LOG_ERROR, "remove (%s): %s", zpath, strerror (errno));
|
||||
ubuffree (zfree);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#if HAVE_QNX_LOCKFILES
|
||||
|
||||
/* Return TRUE if the lock is stale. */
|
||||
|
||||
static boolean
|
||||
fsqnx_stale (ipid, inme, inid, pferr)
|
||||
unsigned long ipid;
|
||||
unsigned long inme;
|
||||
unsigned long inid;
|
||||
boolean *pferr;
|
||||
{
|
||||
/* A virtual process ID. This virtual process ID, which will exist
|
||||
on the local node, will represent the process ID of the process
|
||||
manager process (Proc) on the remote node. */
|
||||
pid_t ivid;
|
||||
/* The return value of the qnx_psinfo function. This is either a
|
||||
process ID which might or might not be the same as the process
|
||||
being looked for, or -1 to indicate no process found. */
|
||||
pid_t ifound_pid;
|
||||
/* This holds the actual result of qnx_psinfo. We will ignore
|
||||
almost all the fields since we're just checking for existence. */
|
||||
struct _psinfo spsdata;
|
||||
|
||||
/* Establish connection with a remote process manager if necessary. */
|
||||
if (inid != inme)
|
||||
{
|
||||
ivid = qnx_vc_attach (inid /* remote node ID */,
|
||||
PROC_PID /* pid of process manager */,
|
||||
1000 /* initial buffer size */,
|
||||
0 /* flags */);
|
||||
if (ivid < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "qnx_vc_attach (%lu, PROC_PID): %s",
|
||||
inid, strerror (errno));
|
||||
if (pferr != NULL)
|
||||
*pferr = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Use the local pid of the local process manager. */
|
||||
ivid = PROC_PID;
|
||||
}
|
||||
|
||||
/* Request the process information. */
|
||||
ifound_pid = qnx_psinfo (ivid /* process manager handling request */,
|
||||
ipid /* get info on this process */,
|
||||
&spsdata /* put info in this struct */,
|
||||
0 /* unused */,
|
||||
(struct _seginfo *) NULL /* unused */);
|
||||
|
||||
/* Deallocate the virtual connection before continuing. */
|
||||
{
|
||||
int isaved_errno = errno;
|
||||
if (qnx_vc_detach (ivid) < 0)
|
||||
ulog (LOG_ERROR, "qnx_vd_detach (%ld): %s", (long) ivid,
|
||||
strerror (errno));
|
||||
errno = isaved_errno;
|
||||
}
|
||||
|
||||
/* If the returned pid matches then the process still holds the lock. */
|
||||
if ((ifound_pid == ipid) && (spsdata.pid == ipid))
|
||||
return FALSE;
|
||||
|
||||
/* If the returned pid is positive and doesn't match, then the
|
||||
process doesn't exist and the lock is stale. Continue. */
|
||||
|
||||
/* If the returned pid is negative (-1) and errno is EINVAL (or ESRCH
|
||||
in older versions of QNX), then the process doesn't exist and the
|
||||
lock is stale. Continue. */
|
||||
|
||||
/* Check for impossible errors. */
|
||||
if ((ifound_pid < 0) && (errno != ESRCH) && (errno != EINVAL))
|
||||
{
|
||||
ulog (LOG_ERROR, "qnx_psinfo (%ld, %ld): %s", (long) ivid,
|
||||
(long) ipid, strerror (errno));
|
||||
/* Since we don't know what the hell this means, and we don't
|
||||
want our system to freeze, we treat this case as a stale
|
||||
lock. Continue on. */
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* HAVE_QNX_LOCKFILES */
|
@ -1,27 +0,0 @@
|
||||
/* loctim.c
|
||||
Turn a time epoch into a struct tm. This is trivial on Unix. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if TM_IN_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#ifndef localtime
|
||||
extern struct tm *localtime ();
|
||||
#endif
|
||||
|
||||
void
|
||||
usysdep_localtime (itime, q)
|
||||
long itime;
|
||||
struct tm *q;
|
||||
{
|
||||
time_t i;
|
||||
|
||||
i = (time_t) itime;
|
||||
*q = *localtime (&i);
|
||||
}
|
@ -1,121 +0,0 @@
|
||||
/* mail.c
|
||||
Send mail to a user.
|
||||
|
||||
Copyright (C) 1992, 1993 Ian Lance Taylor
|
||||
|
||||
This file is part of the Taylor UUCP package.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#ifndef ctime
|
||||
extern char *ctime ();
|
||||
#endif
|
||||
|
||||
/* Mail a message to a user. */
|
||||
|
||||
boolean
|
||||
fsysdep_mail (zto, zsubject, cstrs, paz)
|
||||
const char *zto;
|
||||
const char *zsubject;
|
||||
int cstrs;
|
||||
const char **paz;
|
||||
{
|
||||
char **pazargs;
|
||||
char *zcopy, *ztok;
|
||||
size_t cargs, iarg;
|
||||
FILE *e;
|
||||
pid_t ipid;
|
||||
time_t itime;
|
||||
int i;
|
||||
|
||||
/* Parse MAIL_PROGRAM into an array of arguments. */
|
||||
zcopy = zbufcpy (MAIL_PROGRAM);
|
||||
|
||||
cargs = 0;
|
||||
for (ztok = strtok (zcopy, " \t");
|
||||
ztok != NULL;
|
||||
ztok = strtok ((char *) NULL, " \t"))
|
||||
++cargs;
|
||||
|
||||
pazargs = (char **) xmalloc ((cargs + 4) * sizeof (char *));
|
||||
|
||||
memcpy (zcopy, MAIL_PROGRAM, sizeof MAIL_PROGRAM);
|
||||
for (ztok = strtok (zcopy, " \t"), iarg = 0;
|
||||
ztok != NULL;
|
||||
ztok = strtok ((char *) NULL, " \t"), ++iarg)
|
||||
pazargs[iarg] = ztok;
|
||||
|
||||
#if ! MAIL_PROGRAM_SUBJECT_BODY
|
||||
pazargs[iarg++] = (char *) "-s";
|
||||
pazargs[iarg++] = (char *) zsubject;
|
||||
#endif
|
||||
|
||||
#if ! MAIL_PROGRAM_TO_BODY
|
||||
pazargs[iarg++] = (char *) zto;
|
||||
#endif
|
||||
|
||||
pazargs[iarg] = NULL;
|
||||
|
||||
e = espopen ((const char **) pazargs, FALSE, &ipid);
|
||||
|
||||
ubuffree (zcopy);
|
||||
xfree ((pointer) pazargs);
|
||||
|
||||
if (e == NULL)
|
||||
{
|
||||
ulog (LOG_ERROR, "espopen (%s): %s", MAIL_PROGRAM,
|
||||
strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if MAIL_PROGRAM_TO_BODY
|
||||
fprintf (e, "To: %s\n", zto);
|
||||
#endif
|
||||
#if MAIL_PROGRAM_SUBJECT_BODY
|
||||
fprintf (e, "Subject: %s\n", zsubject);
|
||||
#endif
|
||||
|
||||
#if MAIL_PROGRAM_TO_BODY || MAIL_PROGRAM_SUBJECT_BODY
|
||||
fprintf (e, "\n");
|
||||
#endif
|
||||
|
||||
(void) time (&itime);
|
||||
/* Remember that ctime includes a \n, so this skips a line. */
|
||||
fprintf (e, "Message from UUCP on %s %s\n", zSlocalname,
|
||||
ctime (&itime));
|
||||
|
||||
for (i = 0; i < cstrs; i++)
|
||||
fputs (paz[i], e);
|
||||
|
||||
(void) fclose (e);
|
||||
|
||||
return ixswait ((unsigned long) ipid, MAIL_PROGRAM) == 0;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* mkdirs.c
|
||||
Create any directories needed for a file name. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
boolean
|
||||
fsysdep_make_dirs (zfile, fpublic)
|
||||
const char *zfile;
|
||||
boolean fpublic;
|
||||
{
|
||||
char *zcopy, *z;
|
||||
int imode;
|
||||
|
||||
zcopy = zbufcpy (zfile);
|
||||
|
||||
if (fpublic)
|
||||
imode = IPUBLIC_DIRECTORY_MODE;
|
||||
else
|
||||
imode = IDIRECTORY_MODE;
|
||||
|
||||
for (z = zcopy; *z != '\0'; z++)
|
||||
{
|
||||
if (*z == '/' && z != zcopy)
|
||||
{
|
||||
/* Some versions of uuto will send a double slash. Some
|
||||
systems will fail to create a directory ending in a
|
||||
slash. */
|
||||
if (z[-1] == '/')
|
||||
continue;
|
||||
*z = '\0';
|
||||
if (mkdir (zcopy, imode) != 0
|
||||
&& errno != EEXIST
|
||||
&& errno != EISDIR
|
||||
#ifdef EROFS
|
||||
&& errno != EROFS
|
||||
#endif
|
||||
&& (errno != EACCES || ! fsysdep_directory (zcopy)))
|
||||
{
|
||||
ulog (LOG_ERROR, "mkdir (%s): %s", zcopy,
|
||||
strerror (errno));
|
||||
ubuffree (zcopy);
|
||||
return FALSE;
|
||||
}
|
||||
*z = '/';
|
||||
}
|
||||
}
|
||||
|
||||
ubuffree (zcopy);
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/* pause.c
|
||||
Pause for half a second. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
/* Pick a timing routine to use. I somewhat arbitrarily picked usleep
|
||||
above napms above poll above select above nap. The nap function is
|
||||
last because on different systems the argument has different
|
||||
meanings. */
|
||||
#if HAVE_USLEEP || HAVE_NAPMS || HAVE_POLL || HAVE_SELECT
|
||||
#undef HAVE_NAP
|
||||
#define HAVE_NAP 0
|
||||
#endif
|
||||
|
||||
#if HAVE_USLEEP || HAVE_NAPMS || HAVE_POLL
|
||||
#undef HAVE_SELECT
|
||||
#define HAVE_SELECT 0
|
||||
#endif
|
||||
|
||||
#if HAVE_USLEEP || HAVE_NAPMS
|
||||
#undef HAVE_POLL
|
||||
#define HAVE_POLL 0
|
||||
#endif
|
||||
|
||||
#if HAVE_USLEEP
|
||||
#undef HAVE_NAPMS
|
||||
#define HAVE_NAPMS 0
|
||||
#endif
|
||||
|
||||
#if HAVE_SELECT
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HAVE_POLL
|
||||
#if HAVE_STROPTS_H
|
||||
#include <stropts.h>
|
||||
#endif
|
||||
#if HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#if ! HAVE_STROPTS_H && ! HAVE_POLL_H
|
||||
/* We need a definition for struct pollfd, although it doesn't matter
|
||||
what it contains. */
|
||||
struct pollfd
|
||||
{
|
||||
int idummy;
|
||||
};
|
||||
#endif /* ! HAVE_STROPTS_H && ! HAVE_POLL_H */
|
||||
#endif /* HAVE_POLL */
|
||||
|
||||
#if HAVE_TIME_H
|
||||
#if ! HAVE_SYS_TIME_H || ! HAVE_SELECT || TIME_WITH_SYS_TIME
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
usysdep_pause ()
|
||||
{
|
||||
#if HAVE_NAPMS
|
||||
napms (500);
|
||||
#endif /* HAVE_NAPMS */
|
||||
#if HAVE_NAP
|
||||
#if HAVE_HUNDREDTHS_NAP
|
||||
nap (50L);
|
||||
#else
|
||||
nap (500L);
|
||||
#endif /* ! HAVE_HUNDREDTHS_NAP */
|
||||
#endif /* HAVE_NAP */
|
||||
#if HAVE_USLEEP
|
||||
usleep (500 * (long) 1000);
|
||||
#endif /* HAVE_USLEEP */
|
||||
#if HAVE_POLL
|
||||
struct pollfd sdummy;
|
||||
|
||||
/* We need to pass an unused pollfd structure because poll checks
|
||||
the address before checking the number of elements. */
|
||||
memset (&sdummy, 0, sizeof sdummy);
|
||||
poll (&sdummy, 0, 500);
|
||||
#endif /* HAVE_POLL */
|
||||
#if HAVE_SELECT
|
||||
struct timeval s;
|
||||
|
||||
s.tv_sec = 0;
|
||||
s.tv_usec = 500 * (long) 1000;
|
||||
select (0, (pointer) NULL, (pointer) NULL, (pointer) NULL, &s);
|
||||
#endif /* HAVE_SELECT */
|
||||
#if ! HAVE_NAPMS && ! HAVE_NAP && ! HAVE_USLEEP
|
||||
#if ! HAVE_SELECT && ! HAVE_POLL
|
||||
sleep (1);
|
||||
#endif /* ! HAVE_SELECT && ! HAVE_POLL */
|
||||
#endif /* ! HAVE_NAPMS && ! HAVE_NAP && ! HAVE_USLEEP */
|
||||
}
|
@ -1,294 +0,0 @@
|
||||
/* pipe.c
|
||||
The pipe port communication routines for Unix.
|
||||
Contributed by Marc Boucher <marc@CAM.ORG>.
|
||||
|
||||
Copyright (C) 1993 Ian Lance Taylor
|
||||
|
||||
This file is part of the Taylor UUCP package.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char pipe_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "uuconf.h"
|
||||
#include "system.h"
|
||||
#include "conn.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#if HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Local functions. */
|
||||
|
||||
static void uspipe_free P((struct sconnection *qconn));
|
||||
static boolean fspipe_open P((struct sconnection *qconn, long ibaud,
|
||||
boolean fwait));
|
||||
static boolean fspipe_close P((struct sconnection *qconn,
|
||||
pointer puuconf,
|
||||
struct uuconf_dialer *qdialer,
|
||||
boolean fsuccess));
|
||||
static boolean fspipe_dial P((struct sconnection *qconn, pointer puuconf,
|
||||
const struct uuconf_system *qsys,
|
||||
const char *zphone,
|
||||
struct uuconf_dialer *qdialer,
|
||||
enum tdialerfound *ptdialer));
|
||||
|
||||
/* The command table for standard input ports. */
|
||||
|
||||
static const struct sconncmds spipecmds =
|
||||
{
|
||||
uspipe_free,
|
||||
NULL, /* pflock */
|
||||
NULL, /* pfunlock */
|
||||
fspipe_open,
|
||||
fspipe_close,
|
||||
fspipe_dial,
|
||||
fsdouble_read,
|
||||
fsdouble_write,
|
||||
fsysdep_conn_io,
|
||||
NULL, /* pfbreak */
|
||||
NULL, /* pfset */
|
||||
NULL, /* pfcarrier */
|
||||
fsdouble_chat,
|
||||
NULL /* pibaud */
|
||||
};
|
||||
|
||||
/* Initialize a pipe connection. */
|
||||
|
||||
boolean
|
||||
fsysdep_pipe_init (qconn)
|
||||
struct sconnection *qconn;
|
||||
{
|
||||
struct ssysdep_conn *q;
|
||||
|
||||
q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn));
|
||||
q->o = -1;
|
||||
q->ord = -1;
|
||||
q->owr = -1;
|
||||
q->zdevice = NULL;
|
||||
q->iflags = -1;
|
||||
q->iwr_flags = -1;
|
||||
q->fterminal = FALSE;
|
||||
q->ftli = FALSE;
|
||||
q->ibaud = 0;
|
||||
q->ipid = -1;
|
||||
qconn->psysdep = (pointer) q;
|
||||
qconn->qcmds = &spipecmds;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
uspipe_free (qconn)
|
||||
struct sconnection *qconn;
|
||||
{
|
||||
xfree (qconn->psysdep);
|
||||
}
|
||||
|
||||
/* Open a pipe port. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
fspipe_open (qconn, ibaud, fwait)
|
||||
struct sconnection *qconn;
|
||||
long ibaud;
|
||||
boolean fwait;
|
||||
{
|
||||
/* We don't do incoming waits on pipes. */
|
||||
if (fwait)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Close a pipe port. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
fspipe_close (qconn, puuconf, qdialer, fsuccess)
|
||||
struct sconnection *qconn;
|
||||
pointer puuconf;
|
||||
struct uuconf_dialer *qdialer;
|
||||
boolean fsuccess;
|
||||
{
|
||||
struct ssysdep_conn *qsysdep;
|
||||
boolean fret;
|
||||
|
||||
qsysdep = (struct ssysdep_conn *) qconn->psysdep;
|
||||
fret = TRUE;
|
||||
|
||||
/* Close our sides of the pipe. */
|
||||
if (qsysdep->ord >= 0 && close (qsysdep->ord) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "fspipe_close: close read fd: %s", strerror (errno));
|
||||
fret = FALSE;
|
||||
}
|
||||
if (qsysdep->owr != qsysdep->ord
|
||||
&& qsysdep->owr >= 0
|
||||
&& close (qsysdep->owr) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "fspipe_close: close write fd: %s", strerror (errno));
|
||||
fret = FALSE;
|
||||
}
|
||||
qsysdep->ord = -1;
|
||||
qsysdep->owr = -1;
|
||||
|
||||
/* Kill dangling child process. */
|
||||
if (qsysdep->ipid >= 0)
|
||||
{
|
||||
if (kill (qsysdep->ipid, SIGHUP) == 0)
|
||||
usysdep_sleep (2);
|
||||
#ifdef SIGPIPE
|
||||
if (kill (qsysdep->ipid, SIGPIPE) == 0)
|
||||
usysdep_sleep (2);
|
||||
#endif
|
||||
if (kill (qsysdep->ipid, SIGKILL) < 0 && errno == EPERM)
|
||||
{
|
||||
ulog (LOG_ERROR, "fspipe_close: Cannot kill child pid %lu: %s",
|
||||
(unsigned long) qsysdep->ipid, strerror (errno));
|
||||
fret = FALSE;
|
||||
}
|
||||
else
|
||||
(void) ixswait ((unsigned long) qsysdep->ipid, (const char *) NULL);
|
||||
}
|
||||
qsysdep->ipid = -1;
|
||||
return fret;
|
||||
}
|
||||
|
||||
/* Dial out on a pipe port, so to speak: launch connection program
|
||||
under us. The code alternates q->o between q->ord and q->owr as
|
||||
appropriate. It is always q->ord before any call to fsblock. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static boolean
|
||||
fspipe_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer)
|
||||
struct sconnection *qconn;
|
||||
pointer puuconf;
|
||||
const struct uuconf_system *qsys;
|
||||
const char *zphone;
|
||||
struct uuconf_dialer *qdialer;
|
||||
enum tdialerfound *ptdialer;
|
||||
{
|
||||
struct ssysdep_conn *q;
|
||||
int aidescs[3];
|
||||
const char **pzprog;
|
||||
|
||||
q = (struct ssysdep_conn *) qconn->psysdep;
|
||||
|
||||
*ptdialer = DIALERFOUND_FALSE;
|
||||
|
||||
pzprog = (const char **) qconn->qport->uuconf_u.uuconf_spipe.uuconf_pzcmd;
|
||||
|
||||
if (pzprog == NULL)
|
||||
{
|
||||
ulog (LOG_ERROR, "No command for pipe connection");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
aidescs[0] = SPAWN_WRITE_PIPE;
|
||||
aidescs[1] = SPAWN_READ_PIPE;
|
||||
aidescs[2] = SPAWN_NULL;
|
||||
|
||||
/* Pass fkeepuid, fkeepenv and fshell as TRUE. This puts the
|
||||
responsibility of security on the connection program. */
|
||||
q->ipid = ixsspawn (pzprog, aidescs, TRUE, TRUE, (const char *) NULL,
|
||||
FALSE, TRUE, (const char *) NULL,
|
||||
(const char *) NULL, (const char *) NULL);
|
||||
if (q->ipid < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "ixsspawn (%s): %s", pzprog[0], strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
q->owr = aidescs[0];
|
||||
q->ord = aidescs[1];
|
||||
q->o = q->ord;
|
||||
|
||||
q->iflags = fcntl (q->ord, F_GETFL, 0);
|
||||
q->iwr_flags = fcntl (q->owr, F_GETFL, 0);
|
||||
if (q->iflags < 0 || q->iwr_flags < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "fspipe_dial: fcntl: %s", strerror (errno));
|
||||
(void) fspipe_close (qconn, puuconf, qdialer, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* Marc Boucher's contributed code used an alarm to avoid waiting too
|
||||
long when closing the pipe. However, I believe that it is not
|
||||
possible for the kernel to sleep when closing a pipe; it is only
|
||||
possible when closing a device. Therefore, I have removed the
|
||||
code, but am preserving it in case I am wrong. To reenable it, the
|
||||
two calls to close in fspipe_close should be changed to call
|
||||
fspipe_alarmclose. */
|
||||
|
||||
static RETSIGTYPE
|
||||
usalarm (isig)
|
||||
int isig;
|
||||
{
|
||||
#if ! HAVE_SIGACTION && ! HAVE_SIGVEC && ! HAVE_SIGSET
|
||||
(void) signal (isig, usalarm);
|
||||
#endif
|
||||
|
||||
#if HAVE_RESTARTABLE_SYSCALLS
|
||||
longjmp (sSjmp_buf, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
fspipe_alarmclose (fd)
|
||||
int fd;
|
||||
{
|
||||
int iret = -1;
|
||||
int ierrno = 0;
|
||||
|
||||
if (fsysdep_catch ())
|
||||
{
|
||||
usysdep_start_catch ();
|
||||
usset_signal (SIGALRM, usalarm, TRUE, (boolean *) NULL);
|
||||
(void) alarm (30);
|
||||
|
||||
iret = close (fd);
|
||||
ierrno = errno;
|
||||
}
|
||||
|
||||
usset_signal (SIGALRM, SIG_IGN, TRUE, (boolean *) NULL);
|
||||
(void) alarm (0);
|
||||
usysdep_end_catch ();
|
||||
|
||||
errno = ierrno;
|
||||
return iret;
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
@ -1,54 +0,0 @@
|
||||
/* portnm.c
|
||||
Get the port name of stdin. */
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#if HAVE_TCP
|
||||
#if HAVE_SYS_TYPES_TCP_H
|
||||
#include <sys/types.tcp.h>
|
||||
#endif
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include <paths.h>
|
||||
|
||||
#ifndef ttyname
|
||||
extern char *ttyname ();
|
||||
#endif
|
||||
|
||||
/* Get the port name of standard input. I assume that Unix systems
|
||||
generally support ttyname. If they don't, this function can just
|
||||
return NULL. It uses getsockname to see whether standard input is
|
||||
a TCP connection. */
|
||||
|
||||
const char *
|
||||
zsysdep_port_name (ftcp_port)
|
||||
boolean *ftcp_port;
|
||||
{
|
||||
const char *z;
|
||||
|
||||
*ftcp_port = FALSE;
|
||||
|
||||
#if HAVE_TCP
|
||||
{
|
||||
size_t clen;
|
||||
struct sockaddr s;
|
||||
|
||||
clen = sizeof (struct sockaddr);
|
||||
if (getsockname (0, &s, &clen) == 0)
|
||||
*ftcp_port = TRUE;
|
||||
}
|
||||
#endif /* HAVE_TCP */
|
||||
|
||||
z = ttyname (0);
|
||||
if (z == NULL)
|
||||
return NULL;
|
||||
if (strncmp (z, _PATH_DEV, sizeof _PATH_DEV - 1) == 0)
|
||||
return z + sizeof _PATH_DEV - 1;
|
||||
else
|
||||
return z;
|
||||
}
|
@ -1,197 +0,0 @@
|
||||
/* proctm.c
|
||||
Get the time spent in the process.
|
||||
|
||||
Copyright (C) 1992, 1993 Ian Lance Taylor
|
||||
|
||||
This file is part of the Taylor UUCP package.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Prefer gettimeofday to ftime to times. */
|
||||
|
||||
#if HAVE_GETTIMEOFDAY || HAVE_FTIME
|
||||
#undef HAVE_TIMES
|
||||
#define HAVE_TIMES 0
|
||||
#endif
|
||||
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
#undef HAVE_FTIME
|
||||
#define HAVE_FTIME 0
|
||||
#endif
|
||||
|
||||
#if HAVE_TIME_H && (TIME_WITH_SYS_TIME || ! HAVE_GETTIMEOFDAY)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_FTIME
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_TIMES
|
||||
|
||||
#if HAVE_SYS_TIMES_H
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
|
||||
#if TIMES_DECLARATION_OK
|
||||
/* We use a macro to protect this because times really returns clock_t
|
||||
and on some systems, such as Ultrix 4.0, clock_t is int. We don't
|
||||
leave it out entirely because on some systems, such as System III,
|
||||
the declaration is necessary for correct compilation. */
|
||||
#ifndef times
|
||||
extern long times ();
|
||||
#endif
|
||||
#endif /* TIMES_DECLARATION_OK */
|
||||
|
||||
#ifdef _SC_CLK_TCK
|
||||
#define HAVE_SC_CLK_TCK 1
|
||||
#else
|
||||
#define HAVE_SC_CLK_TCK 0
|
||||
#endif
|
||||
|
||||
/* TIMES_TICK may have been set in policy.h, or we may be able to get
|
||||
it using sysconf. If neither is the case, try to find a useful
|
||||
definition from the system header files. */
|
||||
#if TIMES_TICK == 0 && (! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK)
|
||||
#ifdef CLK_TCK
|
||||
#undef TIMES_TICK
|
||||
#define TIMES_TICK CLK_TCK
|
||||
#else /* ! defined (CLK_TCK) */
|
||||
#ifdef HZ
|
||||
#undef TIMES_TICK
|
||||
#define TIMES_TICK HZ
|
||||
#endif /* defined (HZ) */
|
||||
#endif /* ! defined (CLK_TCK) */
|
||||
#endif /* TIMES_TICK == 0 && (! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK) */
|
||||
|
||||
#endif /* HAVE_TIMES */
|
||||
|
||||
#ifndef time
|
||||
extern time_t time ();
|
||||
#endif
|
||||
#if HAVE_SYSCONF
|
||||
#ifndef sysconf
|
||||
extern long sysconf ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Get the time in seconds and microseconds; this need only work
|
||||
within the process when called from the system independent code.
|
||||
It is also called by ixsysdep_time. */
|
||||
|
||||
long
|
||||
ixsysdep_process_time (pimicros)
|
||||
long *pimicros;
|
||||
{
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
struct timeval stime;
|
||||
struct timezone stz;
|
||||
|
||||
(void) gettimeofday (&stime, &stz);
|
||||
if (pimicros != NULL)
|
||||
*pimicros = (long) stime.tv_usec;
|
||||
return (long) stime.tv_sec;
|
||||
#endif /* HAVE_GETTIMEOFDAY */
|
||||
|
||||
#if HAVE_FTIME
|
||||
static boolean fbad;
|
||||
|
||||
if (! fbad)
|
||||
{
|
||||
struct timeb stime;
|
||||
static struct timeb slast;
|
||||
|
||||
(void) ftime (&stime);
|
||||
|
||||
/* On some systems, such as SCO 3.2.2, ftime can go backwards in
|
||||
time. If we detect this, we switch to using time. */
|
||||
if (slast.time != 0
|
||||
&& (stime.time < slast.time
|
||||
|| (stime.time == slast.time &&
|
||||
stime.millitm < slast.millitm)))
|
||||
fbad = TRUE;
|
||||
else
|
||||
{
|
||||
slast = stime;
|
||||
if (pimicros != NULL)
|
||||
*pimicros = (long) stime.millitm * (long) 1000;
|
||||
return (long) stime.time;
|
||||
}
|
||||
}
|
||||
|
||||
if (pimicros != NULL)
|
||||
*pimicros = 0;
|
||||
return (long) time ((time_t *) NULL);
|
||||
#endif /* HAVE_FTIME */
|
||||
|
||||
#if HAVE_TIMES
|
||||
struct tms s;
|
||||
long i;
|
||||
static int itick;
|
||||
|
||||
if (itick == 0)
|
||||
{
|
||||
#if TIMES_TICK == 0
|
||||
#if HAVE_SYSCONF && HAVE_SC_CLK_TCK
|
||||
itick = (int) sysconf (_SC_CLK_TCK);
|
||||
#else /* ! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK */
|
||||
const char *z;
|
||||
|
||||
z = getenv ("HZ");
|
||||
if (z != NULL)
|
||||
itick = (int) strtol (z, (char **) NULL, 10);
|
||||
|
||||
/* If we really couldn't get anything, just use 60. */
|
||||
if (itick == 0)
|
||||
itick = 60;
|
||||
#endif /* ! HAVE_SYSCONF || ! HAVE_SC_CLK_TCK */
|
||||
#else /* TIMES_TICK != 0 */
|
||||
itick = TIMES_TICK;
|
||||
#endif /* TIMES_TICK == 0 */
|
||||
}
|
||||
|
||||
i = (long) times (&s);
|
||||
if (pimicros != NULL)
|
||||
*pimicros = (i % (long) itick) * ((long) 1000000 / (long) itick);
|
||||
return i / (long) itick;
|
||||
#endif /* HAVE_TIMES */
|
||||
|
||||
#if ! HAVE_GETTIMEOFDAY && ! HAVE_FTIME && ! HAVE_TIMES
|
||||
if (pimicros != NULL)
|
||||
*pimicros = 0;
|
||||
return (long) time ((time_t *) NULL);
|
||||
#endif /* ! HAVE_GETTIMEOFDAY && ! HAVE_FTIME && ! HAVE_TIMES */
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,208 +0,0 @@
|
||||
/* signal.c
|
||||
Signal handling 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Signal handling routines. When we catch a signal, we want to set
|
||||
the appropriate elements of afSignal and afLog_signal to TRUE. If
|
||||
we are on a system which restarts system calls, we may also want to
|
||||
longjmp out. On a system which does not restart system calls,
|
||||
these signal handling routines are well-defined by ANSI C. */
|
||||
|
||||
#if HAVE_RESTARTABLE_SYSCALLS
|
||||
volatile sig_atomic_t fSjmp;
|
||||
volatile jmp_buf sSjmp_buf;
|
||||
#endif /* HAVE_RESTARTABLE_SYSCALLS */
|
||||
|
||||
/* Some systems, such as SunOS, have a SA_INTERRUPT bit that must be
|
||||
set in the sigaction structure to force system calls to be
|
||||
interrupted. */
|
||||
#ifndef SA_INTERRUPT
|
||||
#define SA_INTERRUPT 0
|
||||
#endif
|
||||
|
||||
/* The SVR3 sigset function can be called just like signal, unless
|
||||
system calls are restarted which is extremely unlikely; we prevent
|
||||
this case in sysh.unx. */
|
||||
#if HAVE_SIGSET && ! HAVE_SIGACTION && ! HAVE_SIGVEC
|
||||
#define signal sigset
|
||||
#endif
|
||||
|
||||
/* The sigvec structure changed from 4.2BSD to 4.3BSD. These macros
|
||||
make the 4.3 code backward compatible. */
|
||||
#ifndef SV_INTERRUPT
|
||||
#define SV_INTERRUPT 0
|
||||
#endif
|
||||
#if ! HAVE_SIGVEC_SV_FLAGS
|
||||
#define sv_flags sv_onstack
|
||||
#endif
|
||||
|
||||
/* Catch a signal. Reinstall the signal handler if necessary, set the
|
||||
appropriate variables, and do a longjmp if necessary. */
|
||||
|
||||
RETSIGTYPE
|
||||
ussignal (isig)
|
||||
int isig;
|
||||
{
|
||||
int iindex;
|
||||
|
||||
#if ! HAVE_SIGACTION && ! HAVE_SIGVEC && ! HAVE_SIGSET
|
||||
(void) signal (isig, ussignal);
|
||||
#endif
|
||||
|
||||
switch (isig)
|
||||
{
|
||||
default: iindex = INDEXSIG_SIGHUP; break;
|
||||
#ifdef SIGINT
|
||||
case SIGINT: iindex = INDEXSIG_SIGINT; break;
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
case SIGQUIT: iindex = INDEXSIG_SIGQUIT; break;
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
case SIGTERM: iindex = INDEXSIG_SIGTERM; break;
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
case SIGPIPE: iindex = INDEXSIG_SIGPIPE; break;
|
||||
#endif
|
||||
}
|
||||
|
||||
afSignal[iindex] = TRUE;
|
||||
afLog_signal[iindex] = TRUE;
|
||||
|
||||
#if HAVE_RESTARTABLE_SYSCALLS
|
||||
if (fSjmp)
|
||||
longjmp (sSjmp_buf, 1);
|
||||
#endif /* HAVE_RESTARTABLE_SYSCALLS */
|
||||
}
|
||||
|
||||
/* Prepare to catch a signal. This is basically the ANSI C routine
|
||||
signal, but it uses sigaction or sigvec instead if they are
|
||||
available. If fforce is FALSE, we do not set the signal if it is
|
||||
currently being ignored. If pfignored is not NULL and fforce is
|
||||
FALSE, then *pfignored will be set to TRUE if the signal was
|
||||
previously being ignored (if fforce is TRUE the value returned in
|
||||
*pfignored is meaningless). If we can't change the signal handler
|
||||
we give a fatal error. */
|
||||
|
||||
void
|
||||
usset_signal (isig, pfn, fforce, pfignored)
|
||||
int isig;
|
||||
RETSIGTYPE (*pfn) P((int));
|
||||
boolean fforce;
|
||||
boolean *pfignored;
|
||||
{
|
||||
#if HAVE_SIGACTION
|
||||
|
||||
struct sigaction s;
|
||||
|
||||
if (! fforce)
|
||||
{
|
||||
(void) (sigemptyset (&s.sa_mask));
|
||||
if (sigaction (isig, (struct sigaction *) NULL, &s) != 0)
|
||||
ulog (LOG_FATAL, "sigaction (%d): %s", isig, strerror (errno));
|
||||
|
||||
if (s.sa_handler == SIG_IGN)
|
||||
{
|
||||
if (pfignored != NULL)
|
||||
*pfignored = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pfignored != NULL)
|
||||
*pfignored = FALSE;
|
||||
}
|
||||
|
||||
s.sa_handler = pfn;
|
||||
(void) (sigemptyset (&s.sa_mask));
|
||||
s.sa_flags = SA_INTERRUPT;
|
||||
|
||||
if (sigaction (isig, &s, (struct sigaction *) NULL) != 0)
|
||||
ulog (LOG_FATAL, "sigaction (%d): %s", isig, strerror (errno));
|
||||
|
||||
#else /* ! HAVE_SIGACTION */
|
||||
#if HAVE_SIGVEC
|
||||
|
||||
struct sigvec s;
|
||||
|
||||
if (! fforce)
|
||||
{
|
||||
if (sigvec (isig, (struct sigvec *) NULL, &s) != 0)
|
||||
ulog (LOG_FATAL, "sigvec (%d): %s", isig, strerror (errno));
|
||||
|
||||
if (s.sv_handler == SIG_IGN)
|
||||
{
|
||||
if (pfignored != NULL)
|
||||
*pfignored = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pfignored != NULL)
|
||||
*pfignored = FALSE;
|
||||
}
|
||||
|
||||
s.sv_handler = pfn;
|
||||
s.sv_mask = 0;
|
||||
s.sv_flags = SV_INTERRUPT;
|
||||
|
||||
if (sigvec (isig, &s, (struct sigvec *) NULL) != 0)
|
||||
ulog (LOG_FATAL, "sigvec (%d): %s", isig, strerror (errno));
|
||||
|
||||
#else /* ! HAVE_SIGVEC */
|
||||
|
||||
if (! fforce)
|
||||
{
|
||||
if (signal (isig, SIG_IGN) == SIG_IGN)
|
||||
{
|
||||
if (pfignored != NULL)
|
||||
*pfignored = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pfignored != NULL)
|
||||
*pfignored = FALSE;
|
||||
}
|
||||
|
||||
(void) signal (isig, pfn);
|
||||
|
||||
#endif /* ! HAVE_SIGVEC */
|
||||
#endif /* ! HAVE_SIGACTION */
|
||||
}
|
||||
|
||||
/* The routine called by the system independent code, which always
|
||||
uses the same signal handler. */
|
||||
|
||||
void
|
||||
usysdep_signal (isig)
|
||||
int isig;
|
||||
{
|
||||
usset_signal (isig, ussignal, FALSE, (boolean *) NULL);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/* sindir.c
|
||||
Stick a directory and file name together. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
char *
|
||||
zsysdep_in_dir (zdir, zfile)
|
||||
const char *zdir;
|
||||
const char *zfile;
|
||||
{
|
||||
size_t cdir, cfile;
|
||||
char *zret;
|
||||
|
||||
cdir = strlen (zdir);
|
||||
cfile = strlen (zfile);
|
||||
zret = zbufalc (cdir + cfile + 2);
|
||||
if (cdir == 1 && *zdir == '/')
|
||||
cdir = 0;
|
||||
else
|
||||
memcpy (zret, zdir, cdir);
|
||||
memcpy (zret + cdir + 1, zfile, cfile);
|
||||
zret[cdir] = '/';
|
||||
zret[cdir + cfile + 1] = '\0';
|
||||
return zret;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
/* sleep.c
|
||||
Sleep for a number of seconds. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
void
|
||||
usysdep_sleep (c)
|
||||
int c;
|
||||
{
|
||||
#if HAVE_NAPMS || HAVE_NAP || HAVE_USLEEP || HAVE_SELECT || HAVE_POLL
|
||||
int i;
|
||||
|
||||
/* In this case, usysdep_pause is accurate. */
|
||||
for (i = 2 * c; i > 0; i--)
|
||||
usysdep_pause ();
|
||||
#else
|
||||
/* On some system sleep (1) may not sleep at all. Avoid this sort
|
||||
of problem by always doing at least sleep (2). */
|
||||
if (c < 2)
|
||||
c = 2;
|
||||
(void) sleep (c);
|
||||
#endif
|
||||
}
|
@ -1,456 +0,0 @@
|
||||
/* spawn.c
|
||||
Spawn a program securely.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* $FreeBSD$ */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <paths.h>
|
||||
|
||||
#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
|
||||
|
||||
#ifndef environ
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
/* Spawn a child in a fairly secure fashion. This returns the process
|
||||
ID of the child or -1 on error. It takes far too many arguments:
|
||||
|
||||
pazargs -- arguments (element 0 is command)
|
||||
aidescs -- file descriptors for stdin, stdout and stderr
|
||||
fkeepuid -- TRUE if euid should be left unchanged
|
||||
fkeepenv -- TRUE if environment should be left unmodified
|
||||
zchdir -- directory to chdir to
|
||||
fnosigs -- TRUE if child should ignore SIGHUP, SIGINT and SIGQUIT
|
||||
fshell -- TRUE if should try /bin/sh if execve gets ENOEXEC
|
||||
zpath -- value for environment variable PATH
|
||||
zuu_machine -- value for environment variable UU_MACHINE
|
||||
zuu_user -- value for environment variable UU_USER
|
||||
|
||||
The aidescs array is three elements long. 0 is stdin, 1 is stdout
|
||||
and 2 is stderr. The array may contain either file descriptor
|
||||
numbers to dup appropriately, or one of the following:
|
||||
|
||||
SPAWN_NULL -- set descriptor to /dev/null
|
||||
SPAWN_READ_PIPE -- set aidescs element to pipe for parent to read
|
||||
SPAWN_WRITE_PIPE -- set aidescs element to pipe for parent to write
|
||||
|
||||
If fkeepenv is FALSE, a standard environment is created. The
|
||||
environment arguments (zpath, zuu_machine and zuu_user) are only
|
||||
used if fkeepenv is FALSE; any of them may be NULL.
|
||||
|
||||
This routine expects that all file descriptors have been set to
|
||||
close-on-exec, so it doesn't have to worry about closing them
|
||||
explicitly. It sets the close-on-exec flag for the new pipe
|
||||
descriptors it returns. */
|
||||
|
||||
pid_t
|
||||
ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir, fnosigs, fshell,
|
||||
zpath, zuu_machine, zuu_user)
|
||||
const char **pazargs;
|
||||
int aidescs[3];
|
||||
boolean fkeepuid;
|
||||
boolean fkeepenv;
|
||||
const char *zchdir;
|
||||
boolean fnosigs;
|
||||
boolean fshell;
|
||||
const char *zpath;
|
||||
const char *zuu_machine;
|
||||
const char *zuu_user;
|
||||
{
|
||||
char *zshcmd;
|
||||
int i;
|
||||
char *azenv[9];
|
||||
char **pazenv;
|
||||
boolean ferr;
|
||||
#if HAVE_FULLDUPLEX_PIPES
|
||||
boolean ffullduplex;
|
||||
#endif
|
||||
int ierr = 0;
|
||||
int onull;
|
||||
int aichild_descs[3];
|
||||
int cpar_close;
|
||||
int aipar_close[4];
|
||||
int cchild_close;
|
||||
int aichild_close[3];
|
||||
pid_t iret = 0;
|
||||
const char *zcmd;
|
||||
|
||||
/* If we might have to use the shell, allocate enough space for the
|
||||
quoted command before forking. Otherwise the allocation would
|
||||
modify the data segment and we could not safely use vfork. */
|
||||
zshcmd = NULL;
|
||||
if (fshell)
|
||||
{
|
||||
size_t clen;
|
||||
|
||||
clen = 0;
|
||||
for (i = 0; pazargs[i] != NULL; i++)
|
||||
clen += strlen (pazargs[i]);
|
||||
zshcmd = zbufalc (2 * clen + i);
|
||||
}
|
||||
|
||||
/* Set up a standard environment. This is again done before forking
|
||||
because it will modify the data segment. */
|
||||
if (fkeepenv)
|
||||
pazenv = environ;
|
||||
else
|
||||
{
|
||||
const char *zterm, *ztz;
|
||||
char *zspace;
|
||||
int ienv;
|
||||
|
||||
if (zpath == NULL)
|
||||
zpath = CMDPATH;
|
||||
|
||||
azenv[0] = zbufalc (sizeof "PATH=" + strlen (zpath));
|
||||
sprintf (azenv[0], "PATH=%s", zpath);
|
||||
zspace = azenv[0] + sizeof "PATH=" - 1;
|
||||
while ((zspace = strchr (zspace, ' ')) != NULL)
|
||||
*zspace = ':';
|
||||
|
||||
azenv[1] = zbufalc (sizeof "HOME=" + strlen (zSspooldir));
|
||||
sprintf (azenv[1], "HOME=%s", zSspooldir);
|
||||
|
||||
zterm = getenv ("TERM");
|
||||
if (zterm == NULL)
|
||||
zterm = "unknown";
|
||||
azenv[2] = zbufalc (sizeof "TERM=" + strlen (zterm));
|
||||
sprintf (azenv[2], "TERM=%s", zterm);
|
||||
|
||||
azenv[3] = zbufcpy ("SHELL=/bin/sh");
|
||||
|
||||
azenv[4] = zbufalc (sizeof "USER=" + strlen (OWNER));
|
||||
sprintf (azenv[4], "USER=%s", OWNER);
|
||||
|
||||
ienv = 5;
|
||||
|
||||
ztz = getenv ("TZ");
|
||||
if (ztz != NULL)
|
||||
{
|
||||
azenv[ienv] = zbufalc (sizeof "TZ=" + strlen (ztz));
|
||||
sprintf (azenv[ienv], "TZ=%s", ztz);
|
||||
++ienv;
|
||||
}
|
||||
|
||||
if (zuu_machine != NULL)
|
||||
{
|
||||
azenv[ienv] = zbufalc (sizeof "UU_MACHINE="
|
||||
+ strlen (zuu_machine));
|
||||
sprintf (azenv[ienv], "UU_MACHINE=%s", zuu_machine);
|
||||
++ienv;
|
||||
}
|
||||
|
||||
if (zuu_user != NULL)
|
||||
{
|
||||
azenv[ienv] = zbufalc (sizeof "UU_USER="
|
||||
+ strlen (zuu_user));
|
||||
sprintf (azenv[ienv], "UU_USER=%s", zuu_user);
|
||||
++ienv;
|
||||
}
|
||||
|
||||
azenv[ienv] = NULL;
|
||||
pazenv = azenv;
|
||||
}
|
||||
|
||||
/* Set up any needed pipes. */
|
||||
|
||||
ferr = FALSE;
|
||||
onull = -1;
|
||||
cpar_close = 0;
|
||||
cchild_close = 0;
|
||||
|
||||
#if HAVE_FULLDUPLEX_PIPES
|
||||
ffullduplex = (aidescs[0] == SPAWN_WRITE_PIPE
|
||||
&& aidescs[1] == SPAWN_READ_PIPE);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (aidescs[i] == SPAWN_NULL)
|
||||
{
|
||||
if (onull < 0)
|
||||
{
|
||||
onull = open ((char *) _PATH_DEVNULL, O_RDWR);
|
||||
if (onull < 0
|
||||
|| fcntl (onull, F_SETFD,
|
||||
fcntl (onull, F_GETFD, 0) | FD_CLOEXEC) < 0)
|
||||
{
|
||||
ierr = errno;
|
||||
(void) close (onull);
|
||||
ferr = TRUE;
|
||||
break;
|
||||
}
|
||||
aipar_close[cpar_close] = onull;
|
||||
++cpar_close;
|
||||
}
|
||||
aichild_descs[i] = onull;
|
||||
}
|
||||
else if (aidescs[i] != SPAWN_READ_PIPE
|
||||
&& aidescs[i] != SPAWN_WRITE_PIPE)
|
||||
aichild_descs[i] = aidescs[i];
|
||||
else
|
||||
{
|
||||
int aipipe[2];
|
||||
|
||||
#if HAVE_FULLDUPLEX_PIPES
|
||||
if (ffullduplex && i == 1)
|
||||
{
|
||||
/* Just use the fullduplex pipe. */
|
||||
aidescs[i] = aidescs[0];
|
||||
aichild_descs[i] = aichild_descs[0];
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pipe (aipipe) < 0)
|
||||
{
|
||||
ierr = errno;
|
||||
ferr = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (aidescs[i] == SPAWN_READ_PIPE)
|
||||
{
|
||||
aidescs[i] = aipipe[0];
|
||||
aichild_close[cchild_close] = aipipe[0];
|
||||
aichild_descs[i] = aipipe[1];
|
||||
aipar_close[cpar_close] = aipipe[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
aidescs[i] = aipipe[1];
|
||||
aichild_close[cchild_close] = aipipe[1];
|
||||
aichild_descs[i] = aipipe[0];
|
||||
aipar_close[cpar_close] = aipipe[0];
|
||||
}
|
||||
|
||||
++cpar_close;
|
||||
++cchild_close;
|
||||
|
||||
if (fcntl (aipipe[0], F_SETFD,
|
||||
fcntl (aipipe[0], F_GETFD, 0) | FD_CLOEXEC) < 0
|
||||
|| fcntl (aipipe[1], F_SETFD,
|
||||
fcntl (aipipe[1], F_GETFD, 0) | FD_CLOEXEC) < 0)
|
||||
{
|
||||
ierr = errno;
|
||||
ferr = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG > 1
|
||||
if (! ferr && FDEBUGGING (DEBUG_EXECUTE))
|
||||
{
|
||||
ulog (LOG_DEBUG_START, "Forking %s", pazargs[0]);
|
||||
for (i = 1; pazargs[i] != NULL; i++)
|
||||
ulog (LOG_DEBUG_CONTINUE, " %s", pazargs[i]);
|
||||
ulog (LOG_DEBUG_END, "%s", "");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! ferr)
|
||||
{
|
||||
/* This should really be vfork if available. */
|
||||
iret = ixsfork ();
|
||||
if (iret < 0)
|
||||
{
|
||||
ferr = TRUE;
|
||||
ierr = errno;
|
||||
}
|
||||
}
|
||||
|
||||
if (ferr)
|
||||
{
|
||||
for (i = 0; i < cchild_close; i++)
|
||||
(void) close (aichild_close[i]);
|
||||
iret = -1;
|
||||
}
|
||||
|
||||
if (iret != 0)
|
||||
{
|
||||
/* The parent. Close the child's ends of the pipes and return
|
||||
the process ID, or an error. */
|
||||
for (i = 0; i < cpar_close; i++)
|
||||
(void) close (aipar_close[i]);
|
||||
ubuffree (zshcmd);
|
||||
if (! fkeepenv)
|
||||
{
|
||||
char **pz;
|
||||
|
||||
for (pz = azenv; *pz != NULL; pz++)
|
||||
ubuffree (*pz);
|
||||
}
|
||||
errno = ierr;
|
||||
return iret;
|
||||
}
|
||||
|
||||
/* The child. */
|
||||
|
||||
#ifdef STDIN_FILENO
|
||||
#if STDIN_FILENO != 0 || STDOUT_FILENO != 1 || STDERR_FILENO != 2
|
||||
#error The following code makes invalid assumptions
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (aichild_descs[i] != i)
|
||||
(void) dup2 (aichild_descs[i], i);
|
||||
/* This should only be necessary if aichild_descs[i] == i, but
|
||||
some systems copy the close-on-exec flag for a dupped
|
||||
descriptor, which is wrong according to POSIX. */
|
||||
(void) fcntl (i, F_SETFD, fcntl (i, F_GETFD, 0) &~ FD_CLOEXEC);
|
||||
}
|
||||
|
||||
zcmd = pazargs[0];
|
||||
pazargs[0] = strrchr (zcmd, '/');
|
||||
if (pazargs[0] == NULL)
|
||||
pazargs[0] = zcmd;
|
||||
else
|
||||
++pazargs[0];
|
||||
|
||||
if (! fkeepuid)
|
||||
{
|
||||
/* Return to the uid of the invoking user. */
|
||||
(void) setuid (getuid ());
|
||||
(void) setgid (getgid ());
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Try to force the UUCP uid to be both real and effective user
|
||||
ID, in order to present a consistent environment regardless
|
||||
of the invoking user. This won't work on older System V
|
||||
based systems, where it can cause trouble if ordinary users
|
||||
wind up executing uuxqt, perhaps via uucico; any program
|
||||
which uuxqt executes will have an arbitrary real user ID, so
|
||||
if the program is itself a setuid program, any security
|
||||
checks it does based on the real user ID will be incorrect.
|
||||
Fixing this problem would seem to require a special setuid
|
||||
root program; I have not used this approach because
|
||||
modern systems should not suffer from it. */
|
||||
#if HAVE_SETREUID
|
||||
(void) setreuid (geteuid (), -1);
|
||||
(void) setregid (getegid (), -1);
|
||||
#else
|
||||
(void) setuid (geteuid ());
|
||||
(void) setgid (getegid ());
|
||||
#endif
|
||||
}
|
||||
|
||||
if (zchdir != NULL)
|
||||
(void) chdir (zchdir);
|
||||
|
||||
if (fnosigs)
|
||||
{
|
||||
#ifdef SIGHUP
|
||||
(void) signal (SIGHUP, SIG_IGN);
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
(void) signal (SIGINT, SIG_IGN);
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
(void) signal (SIGQUIT, SIG_IGN);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef isc386
|
||||
#ifdef _POSIX_SOURCE
|
||||
/* ISC has a remarkably stupid notion of environments. If a program
|
||||
is compiled in the POSIX environment, it sets a process state.
|
||||
If you then exec a program which expects the USG environment, the
|
||||
process state is not reset, so the execed program fails. The
|
||||
__setostype call is required to change back to the USG
|
||||
environment. This ought to be a switch in policy.h, but it seems
|
||||
too trivial, so I will leave this code here and wait for it to
|
||||
break in some fashion in the next version of ISC. */
|
||||
__setostype (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
(void) execve ((char *) zcmd, (char **) pazargs, pazenv);
|
||||
|
||||
/* The exec failed. If permitted, try using /bin/sh to execute a
|
||||
shell script. */
|
||||
if (errno == ENOEXEC && fshell)
|
||||
{
|
||||
char *zto;
|
||||
const char *azshargs[4];
|
||||
|
||||
pazargs[0] = zcmd;
|
||||
zto = zshcmd;
|
||||
for (i = 0; pazargs[i] != NULL; i++)
|
||||
{
|
||||
const char *zfrom;
|
||||
|
||||
for (zfrom = pazargs[i]; *zfrom != '\0'; zfrom++)
|
||||
{
|
||||
/* Some versions of /bin/sh appear to have a bug such
|
||||
that quoting a '/' sometimes causes an error. I
|
||||
don't know exactly when this happens (I can recreate
|
||||
it on Ultrix 4.0), but in any case it is harmless to
|
||||
not quote a '/'. */
|
||||
if (*zfrom != '/')
|
||||
*zto++ = '\\';
|
||||
*zto++ = *zfrom;
|
||||
}
|
||||
*zto++ = ' ';
|
||||
}
|
||||
*(zto - 1) = '\0';
|
||||
|
||||
azshargs[0] = "sh";
|
||||
azshargs[1] = "-c";
|
||||
azshargs[2] = zshcmd;
|
||||
azshargs[3] = NULL;
|
||||
|
||||
(void) execve ((char *) "/bin/sh", (char **) azshargs, pazenv);
|
||||
}
|
||||
|
||||
_exit (EXIT_FAILURE);
|
||||
|
||||
/* Avoid compiler warning. */
|
||||
return -1;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/* sync.c
|
||||
Sync a file to disk, if FSYNC_ON_CLOSE is set. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
boolean
|
||||
fsysdep_sync (e, zmsg)
|
||||
openfile_t e;
|
||||
const char *zmsg;
|
||||
{
|
||||
int o;
|
||||
|
||||
#if USE_STDIO
|
||||
if (fflush (e) == EOF)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s: fflush: %s", zmsg, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_STDIO
|
||||
o = fileno (e);
|
||||
#else
|
||||
o = e;
|
||||
#endif
|
||||
|
||||
#if FSYNC_ON_CLOSE
|
||||
if (fsync (o) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s: fsync: %s", zmsg, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -1,483 +0,0 @@
|
||||
/* tcp.c
|
||||
Code to handle TCP connections.
|
||||
|
||||
Copyright (C) 1991, 1992, 1993, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char tcp_rcsid[] = "$FreeBSD$";
|
||||
#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>
|
||||
#include <arpa/inet.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_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_getaddrinfo P((const char *zhost, const char *zport,
|
||||
const struct addrinfo *hints,
|
||||
struct addrinfo **res));
|
||||
|
||||
/* The command table for a TCP connection. */
|
||||
static const struct sconncmds stcpcmds =
|
||||
{
|
||||
utcp_free,
|
||||
NULL, /* pflock */
|
||||
NULL, /* pfunlock */
|
||||
ftcp_open,
|
||||
ftcp_close,
|
||||
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->ord = -1;
|
||||
q->owr = -1;
|
||||
q->zdevice = NULL;
|
||||
q->iflags = -1;
|
||||
q->iwr_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);
|
||||
}
|
||||
|
||||
static boolean
|
||||
utcp_init (qsysdep)
|
||||
struct ssysdep_conn *qsysdep;
|
||||
{
|
||||
if (!qsysdep)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 addrinfo hints, *res, *res0;
|
||||
struct sockaddr_storage s;
|
||||
const char *zport;
|
||||
int zfamily;
|
||||
uid_t ieuid;
|
||||
boolean fswap;
|
||||
int err;
|
||||
|
||||
ulog_device ("TCP");
|
||||
|
||||
qsysdep = (struct ssysdep_conn *) qconn->psysdep;
|
||||
|
||||
qsysdep->o = -1;
|
||||
|
||||
/* We save our process ID in the qconn structure. This is checked
|
||||
in ftcp_close. */
|
||||
qsysdep->ipid = getpid ();
|
||||
|
||||
/* If we aren't waiting for a connection, we're done. */
|
||||
if (! fwait)
|
||||
return TRUE;
|
||||
|
||||
/* 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. */
|
||||
zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;
|
||||
zfamily = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zfamily;
|
||||
memset (&hints, 0, sizeof(hints));
|
||||
hints.ai_family = zfamily;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_PASSIVE;
|
||||
if ((err = itcp_getaddrinfo (NULL, zport, &hints, &res0)) != 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "getaddrinfo (NULL, %s): %s",
|
||||
zport, gai_strerror (err));
|
||||
return FALSE;
|
||||
}
|
||||
#if HAVE_GETADDRINFO
|
||||
if (zfamily == PF_UNSPEC)
|
||||
{
|
||||
for (res = res0; res; res = res->ai_next)
|
||||
{
|
||||
if (res->ai_family == AF_INET6)
|
||||
{
|
||||
qsysdep->o = socket (res->ai_family, res->ai_socktype,
|
||||
res->ai_protocol);
|
||||
if (qsysdep->o >= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (qsysdep->o < 0)
|
||||
{
|
||||
for (res = res0; res; res = res->ai_next)
|
||||
{
|
||||
qsysdep->o = socket (res->ai_family, res->ai_socktype,
|
||||
res->ai_protocol);
|
||||
if (qsysdep->o >= 0)
|
||||
break;
|
||||
}
|
||||
if (qsysdep->o < 0)
|
||||
{
|
||||
freeaddrinfo (res);
|
||||
ulog (LOG_ERROR, "socket: %s", strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#ifdef IPV6_BINDV6ONLY
|
||||
if (res->ai_family == AF_INET6)
|
||||
{
|
||||
int flag = (zfamily == PF_UNSPEC) ? 0 : 1;
|
||||
|
||||
if (setsockopt (qsysdep->o, IPPROTO_IPV6, IPV6_BINDV6ONLY,
|
||||
(char *)&flag, sizeof (flag)) < 0)
|
||||
{
|
||||
freeaddrinfo (res);
|
||||
ulog (LOG_FATAL, "setsockopt: %s", strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!utcp_init (qsysdep))
|
||||
{
|
||||
freeaddrinfo (res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
fswap = geteuid () != 0;
|
||||
if (fswap)
|
||||
{
|
||||
if (! fsuser_perms (&ieuid))
|
||||
{
|
||||
(void) close (qsysdep->o);
|
||||
qsysdep->o = -1;
|
||||
freeaddrinfo (res);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bind (qsysdep->o, res->ai_addr, res->ai_addrlen) < 0)
|
||||
{
|
||||
freeaddrinfo (res);
|
||||
if (fswap)
|
||||
(void) fsuucp_perms ((long) ieuid);
|
||||
ulog (LOG_FATAL, "bind: %s", strerror (errno));
|
||||
}
|
||||
freeaddrinfo (res);
|
||||
|
||||
/* Now swap back to the uucp user ID. */
|
||||
if (fswap)
|
||||
{
|
||||
if (! fsuucp_perms ((long) ieuid))
|
||||
ulog (LOG_FATAL, "Could not swap back to UUCP user permissions");
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
/* If the current pid is not the one we used to open the port, then
|
||||
we must have forked up above and we are now the child. In this
|
||||
case, we are being called from within the fendless loop in
|
||||
uucico.c. We return FALSE to force the loop to end and the child
|
||||
to exit. This should be handled in a cleaner fashion. */
|
||||
if (qsysdep->ipid != getpid ())
|
||||
fret = FALSE;
|
||||
|
||||
return fret;
|
||||
}
|
||||
|
||||
/* Dial out on a TCP port, so to speak: connect to a remote computer. */
|
||||
|
||||
/*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 addrinfo hints, *res, *res0;
|
||||
int err, connected = FALSE;
|
||||
const char *zport;
|
||||
char **pzdialer;
|
||||
|
||||
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;
|
||||
zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport;
|
||||
memset (&hints, 0, sizeof(hints));
|
||||
hints.ai_family = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zfamily;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = 0;
|
||||
if ((err = itcp_getaddrinfo (zhost, zport, &hints, &res0)) != 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "getaddrinfo (%s, %s): %s",
|
||||
zhost, zport, gai_strerror (err));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (res = res0; res; res = res->ai_next)
|
||||
{
|
||||
qsysdep->o = socket (res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||
if (qsysdep->o < 0)
|
||||
continue;
|
||||
if (connect (qsysdep->o, res->ai_addr, res->ai_addrlen) >= 0)
|
||||
{
|
||||
connected = TRUE;
|
||||
break;
|
||||
}
|
||||
close (qsysdep->o);
|
||||
}
|
||||
freeaddrinfo (res0);
|
||||
if (!connected)
|
||||
{
|
||||
ulog (LOG_ERROR, "connect: %s", strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
if (!utcp_init (qsysdep))
|
||||
return FALSE;
|
||||
|
||||
/* Handle the dialer sequence, if any. */
|
||||
pzdialer = qconn->qport->uuconf_u.uuconf_stcp.uuconf_pzdialer;
|
||||
if (pzdialer != NULL && *pzdialer != NULL)
|
||||
{
|
||||
if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone,
|
||||
qdialer, ptdialer))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
itcp_getaddrinfo (zhost, zport, hints, res)
|
||||
const char *zhost, *zport;
|
||||
const struct addrinfo *hints;
|
||||
struct addrinfo **res;
|
||||
{
|
||||
int err;
|
||||
|
||||
if ((err = getaddrinfo (zhost, zport, hints, res)) != EAI_SERVICE ||
|
||||
strcmp(zport, "uucp") != 0)
|
||||
return err;
|
||||
return getaddrinfo (zhost, IUUCP_PORT, hints, res);
|
||||
}
|
||||
|
||||
#endif /* HAVE_TCP */
|
@ -1,32 +0,0 @@
|
||||
/* time.c
|
||||
Get the current time. */
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#if HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#ifndef time
|
||||
extern time_t time ();
|
||||
#endif
|
||||
|
||||
/* Get the time in seconds since the epoch, with optional
|
||||
microseconds. We use ixsysdep_process_time to get the microseconds
|
||||
if it will work (it won't if it uses times, since that returns a
|
||||
time based only on the process). */
|
||||
|
||||
long
|
||||
ixsysdep_time (pimicros)
|
||||
long *pimicros;
|
||||
{
|
||||
#if HAVE_GETTIMEOFDAY || HAVE_FTIME
|
||||
return ixsysdep_process_time (pimicros);
|
||||
#else
|
||||
if (pimicros != NULL)
|
||||
*pimicros = 0;
|
||||
return (long) time ((time_t *) NULL);
|
||||
#endif
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/* ufopen.c
|
||||
Open a file with the permissions of the invoking user.
|
||||
|
||||
Copyright (C) 1992, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
#include "system.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#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
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
#define FD_CLOEXEC 1
|
||||
#endif
|
||||
|
||||
/* Open a file with the permissions of the invoking user. Ignore the
|
||||
fbinary argument since Unix has no distinction between text and
|
||||
binary files. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
openfile_t
|
||||
esysdep_user_fopen (zfile, frd, fbinary)
|
||||
const char *zfile;
|
||||
boolean frd;
|
||||
boolean fbinary;
|
||||
{
|
||||
uid_t ieuid;
|
||||
openfile_t e;
|
||||
const char *zerr;
|
||||
int o = 0;
|
||||
|
||||
if (! fsuser_perms (&ieuid))
|
||||
return EFILECLOSED;
|
||||
|
||||
zerr = NULL;
|
||||
|
||||
#if USE_STDIO
|
||||
e = fopen (zfile, frd ? "r" : "w");
|
||||
if (e == NULL)
|
||||
zerr = "fopen";
|
||||
else
|
||||
o = fileno (e);
|
||||
#else
|
||||
if (frd)
|
||||
{
|
||||
e = open ((char *) zfile, O_RDONLY | O_NOCTTY, 0);
|
||||
zerr = "open";
|
||||
}
|
||||
else
|
||||
{
|
||||
e = creat ((char *) zfile, IPUBLIC_FILE_MODE);
|
||||
zerr = "creat";
|
||||
}
|
||||
if (e >= 0)
|
||||
{
|
||||
o = e;
|
||||
zerr = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (! fsuucp_perms ((long) ieuid))
|
||||
{
|
||||
if (ffileisopen (e))
|
||||
(void) ffileclose (e);
|
||||
return EFILECLOSED;
|
||||
}
|
||||
|
||||
if (zerr != NULL)
|
||||
{
|
||||
ulog (LOG_ERROR, "%s (%s): %s", zerr, zfile, strerror (errno));
|
||||
#if ! HAVE_SETREUID
|
||||
/* Are these error messages helpful or confusing? */
|
||||
#if HAVE_SAVED_SETUID
|
||||
if (errno == EACCES && getuid () == 0)
|
||||
ulog (LOG_ERROR,
|
||||
"The superuser may only transfer files that are readable by %s",
|
||||
OWNER);
|
||||
#else
|
||||
if (errno == EACCES)
|
||||
ulog (LOG_ERROR,
|
||||
"You may only transfer files that are readable by %s", OWNER);
|
||||
#endif
|
||||
#endif /* ! HAVE_SETREUID */
|
||||
return EFILECLOSED;
|
||||
}
|
||||
|
||||
if (fcntl (o, F_SETFD, fcntl (o, F_GETFD, 0) | FD_CLOEXEC) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno));
|
||||
(void) ffileclose (e);
|
||||
return EFILECLOSED;
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
/* uid.c
|
||||
Switch back and forth between UUCP and user permissions.
|
||||
|
||||
Copyright (C) 1992, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucp.h"
|
||||
|
||||
#include "uudefs.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* NetBSD apparently does not support setuid as required by POSIX when
|
||||
using saved setuid, so use seteuid instead. */
|
||||
|
||||
#if HAVE_SETEUID
|
||||
#define setuid seteuid
|
||||
#endif
|
||||
|
||||
/* Switch to permissions of the invoking user. */
|
||||
|
||||
boolean
|
||||
fsuser_perms (pieuid)
|
||||
uid_t *pieuid;
|
||||
{
|
||||
uid_t ieuid, iuid;
|
||||
|
||||
ieuid = geteuid ();
|
||||
iuid = getuid ();
|
||||
if (pieuid != NULL)
|
||||
*pieuid = ieuid;
|
||||
|
||||
#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));
|
||||
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 saved (it's 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, so don't even try. */
|
||||
if (iuid != 0)
|
||||
{
|
||||
if (setuid (iuid) < 0)
|
||||
{
|
||||
ulog (LOG_ERROR, "setuid (%ld): %s", (long) iuid, strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#else /* ! HAVE_SAVED_SETUID */
|
||||
/* There's no way to switch between real permissions and effective
|
||||
permissions. Just try to open the file with the uucp
|
||||
permissions. */
|
||||
#endif /* ! HAVE_SAVED_SETUID */
|
||||
#endif /* ! HAVE_SETREUID */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Restore the uucp permissions. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
fsuucp_perms (ieuid)
|
||||
long ieuid;
|
||||
{
|
||||
#if HAVE_SETREUID
|
||||
/* Swap effective and real user id's back to what they were. */
|
||||
if (! fsuser_perms ((uid_t *) NULL))
|
||||
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));
|
||||
/* Is this error message helpful or confusing? */
|
||||
if (errno == EPERM)
|
||||
ulog (LOG_ERROR,
|
||||
"Probably HAVE_SAVED_SETUID in policy.h should be set to 0");
|
||||
return FALSE;
|
||||
}
|
||||
#else /* ! HAVE_SAVED_SETUID */
|
||||
/* We didn't switch, no need to switch back. */
|
||||
#endif /* ! HAVE_SAVED_SETUID */
|
||||
#endif /* ! HAVE_SETREUID */
|
||||
|
||||
return TRUE;
|
||||
}
|
@ -1,481 +0,0 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 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.
|
||||
|
||||
[This is the first released version of the library GPL. It is
|
||||
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some
|
||||
specially designated Free Software Foundation software, and to any
|
||||
other libraries whose authors decide to use it. You can use it for
|
||||
your libraries, 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 library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link a program with the library, you must provide
|
||||
complete object files to the recipients so that they can relink them
|
||||
with the library, after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright
|
||||
the library, and (2) offer you this license which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
library. If the library is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original
|
||||
version, 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 companies distributing free
|
||||
software will individually obtain patent licenses, thus in effect
|
||||
transforming the program into proprietary software. To prevent this,
|
||||
we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary
|
||||
GNU General Public License, which was designed for utility programs. This
|
||||
license, the GNU Library General Public License, applies to certain
|
||||
designated libraries. This license is quite different from the ordinary
|
||||
one; be sure to read it in full, and don't assume that anything in it is
|
||||
the same as in the ordinary license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that
|
||||
they blur the distinction we usually make between modifying or adding to a
|
||||
program and simply using it. Linking a program with a library, without
|
||||
changing the library, is in some sense simply using the library, and is
|
||||
analogous to running a utility program or application program. However, in
|
||||
a textual and legal sense, the linked executable is a combined work, a
|
||||
derivative of the original library, and the ordinary General Public License
|
||||
treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General
|
||||
Public License for libraries did not effectively promote software
|
||||
sharing, because most developers did not use the libraries. We
|
||||
concluded that weaker conditions might promote sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the
|
||||
users of those programs of all benefit from the free status of the
|
||||
libraries themselves. This Library General Public License is intended to
|
||||
permit developers of non-free programs to use free libraries, while
|
||||
preserving your freedom as a user of such programs to change the free
|
||||
libraries that are incorporated in them. (We have not seen how to achieve
|
||||
this as regards changes in header files, but we have achieved it as regards
|
||||
changes in the actual functions of the Library.) The hope is that this
|
||||
will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, while the latter only
|
||||
works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary
|
||||
General Public License rather than by this special one.
|
||||
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which
|
||||
contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Library
|
||||
General Public License (also called "this License"). Each licensee is
|
||||
addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, 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 library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete 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 distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
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 Library or any portion
|
||||
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
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 Library, 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 Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you 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.
|
||||
|
||||
If distribution of 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 satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. 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.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library 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.
|
||||
|
||||
9. 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 Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
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.
|
||||
|
||||
11. 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 Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library 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 Library.
|
||||
|
||||
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.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library 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.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Library 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 Library
|
||||
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 Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
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
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. 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 LIBRARY 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
|
||||
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
@ -1,27 +0,0 @@
|
||||
# This is the Makefile for the Taylor UUCP uuconf library
|
||||
# $FreeBSD$
|
||||
|
||||
LIB= uuconf
|
||||
SRCS= addblk.c addstr.c allblk.c alloc.c base.c bool.c callin.c \
|
||||
calout.c chatc.c cmdarg.c cmdfil.c cmdlin.c debfil.c deblev.c \
|
||||
diacod.c dial.c diasub.c dnams.c errno.c errstr.c filnam.c \
|
||||
freblk.c fredia.c free.c freprt.c fresys.c grdcmp.c hdial.c \
|
||||
hdnams.c hinit.c hlocnm.c hport.c hrmunk.c hsinfo.c hsnams.c \
|
||||
hsys.c hunk.c iniglb.c init.c int.c lckdir.c lineno.c llocnm.c \
|
||||
local.c locnm.c logfil.c maxuxq.c mrgblk.c paramc.c port.c \
|
||||
prtsub.c pubdir.c rdlocs.c rdperm.c reliab.c remunk.c runuxq.c \
|
||||
sinfo.c snams.c split.c spool.c stafil.c strip.c syssub.c \
|
||||
tcalou.c tdial.c tdialc.c tdnams.c tgcmp.c thread.c time.c \
|
||||
tinit.c tlocnm.c tport.c tportc.c tsinfo.c tsnams.c tsys.c \
|
||||
tval.c ugtlin.c unk.c val.c vinit.c vport.c vsinfo.c vsnams.c \
|
||||
vsys.c
|
||||
CFLAGS+= -I$(.CURDIR)/../common_sources \
|
||||
-DNEWCONFIGLIB=\"$(newconfigdir)\"\
|
||||
-DOLDCONFIGLIB=\"$(oldconfigdir)\"
|
||||
|
||||
NOMAN= noman
|
||||
NOPROFILE= noprofile
|
||||
|
||||
install:
|
||||
|
||||
.include <bsd.lib.mk>
|
@ -1,56 +0,0 @@
|
||||
/* addblk.c
|
||||
Add an malloc block to a memory block.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_addblk_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "alloc.h"
|
||||
|
||||
/* Add a memory buffer allocated by malloc to a memory block. This is
|
||||
used by the uuconf_cmd functions so that they don't have to
|
||||
constantly copy data into memory. Returns 0 on success, non 0 on
|
||||
failure. */
|
||||
|
||||
int
|
||||
uuconf_add_block (pblock, padd)
|
||||
pointer pblock;
|
||||
pointer padd;
|
||||
{
|
||||
struct sblock *q = (struct sblock *) pblock;
|
||||
struct sadded *qnew;
|
||||
|
||||
qnew = (struct sadded *) uuconf_malloc (pblock, sizeof (struct sadded));
|
||||
if (qnew == NULL)
|
||||
return 1;
|
||||
|
||||
qnew->qnext = q->qadded;
|
||||
qnew->padded = padd;
|
||||
q->qadded = qnew;
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
/* addstr.c
|
||||
Add a string to a list of strings.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_addstr_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* When setting system information, we need to be able to distinguish
|
||||
between a value that is not set and a value that has been set to
|
||||
NULL. We do this by initializing the value to point to the
|
||||
variable _uuconf_unset, and then correcting it in the function
|
||||
_uuconf_isystem_basic_default. This variable is declared in this
|
||||
file because some linkers will apparently not pull in an object
|
||||
file which merely declarates a variable. This functions happens to
|
||||
be pulled in by almost everything. */
|
||||
|
||||
char *_uuconf_unset;
|
||||
|
||||
/* Add a string to a list of strings. The list is maintained as an
|
||||
array of elements ending in NULL. The total number of available
|
||||
slots is always a multiple of CSLOTS, so by counting the current
|
||||
number of elements we can tell whether a new slot is needed. If
|
||||
the fcopy argument is TRUE, the new string is duplicated into
|
||||
memory. If the fcheck argument is TRUE, this does not add a string
|
||||
that is already in the list. The pblock argument may be used to do
|
||||
the allocations within a memory block. This returns a standard
|
||||
uuconf error code. */
|
||||
|
||||
#define CSLOTS (8)
|
||||
|
||||
int
|
||||
_uuconf_iadd_string (qglobal, zadd, fcopy, fcheck, ppzstrings, pblock)
|
||||
struct sglobal *qglobal;
|
||||
char *zadd;
|
||||
boolean fcopy;
|
||||
boolean fcheck;
|
||||
char ***ppzstrings;
|
||||
pointer pblock;
|
||||
{
|
||||
char **pz;
|
||||
size_t c;
|
||||
|
||||
if (fcheck && *ppzstrings != NULL)
|
||||
{
|
||||
for (pz = *ppzstrings; *pz != NULL; pz++)
|
||||
if (strcmp (zadd, *pz) == 0)
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
if (fcopy)
|
||||
{
|
||||
size_t clen;
|
||||
char *znew;
|
||||
|
||||
clen = strlen (zadd) + 1;
|
||||
znew = (char *) uuconf_malloc (pblock, clen);
|
||||
if (znew == NULL)
|
||||
{
|
||||
if (qglobal != NULL)
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
memcpy ((pointer) znew, (pointer) zadd, clen);
|
||||
zadd = znew;
|
||||
}
|
||||
|
||||
pz = *ppzstrings;
|
||||
if (pz == NULL || pz == (char **) &_uuconf_unset)
|
||||
{
|
||||
pz = (char **) uuconf_malloc (pblock, CSLOTS * sizeof (char *));
|
||||
if (pz == NULL)
|
||||
{
|
||||
if (qglobal != NULL)
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
*ppzstrings = pz;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 0;
|
||||
while (*pz != NULL)
|
||||
{
|
||||
++pz;
|
||||
++c;
|
||||
}
|
||||
|
||||
if ((c + 1) % CSLOTS == 0)
|
||||
{
|
||||
char **pznew;
|
||||
|
||||
pznew = (char **) uuconf_malloc (pblock,
|
||||
((c + 1 + CSLOTS)
|
||||
* sizeof (char *)));
|
||||
if (pznew == NULL)
|
||||
{
|
||||
if (qglobal != NULL)
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
memcpy ((pointer) pznew, (pointer) *ppzstrings,
|
||||
c * sizeof (char *));
|
||||
uuconf_free (pblock, *ppzstrings);
|
||||
*ppzstrings = pznew;
|
||||
pz = pznew + c;
|
||||
}
|
||||
}
|
||||
|
||||
pz[0] = zadd;
|
||||
pz[1] = NULL;
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/* allblk.c
|
||||
Allocate a memory block.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_allblk_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "alloc.h"
|
||||
|
||||
/* Allocate a new memory block. If this fails, uuconf_errno will be
|
||||
set, and the calling routine may return UUCONF_MALLOC_FAILED |
|
||||
UUCONF_ERROR_ERRNO. */
|
||||
|
||||
pointer
|
||||
uuconf_malloc_block ()
|
||||
{
|
||||
struct sblock *qret;
|
||||
|
||||
qret = (struct sblock *) malloc (sizeof (struct sblock));
|
||||
if (qret == NULL)
|
||||
return NULL;
|
||||
qret->qnext = NULL;
|
||||
qret->ifree = 0;
|
||||
qret->plast = NULL;
|
||||
qret->qadded = NULL;
|
||||
return (pointer) qret;
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/* alloc.c
|
||||
Allocate within a memory block.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_alloc_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "alloc.h"
|
||||
|
||||
/* Allocate some memory out of a memory block. If the memory block is
|
||||
NULL, this just calls malloc; this is convenient for a number of
|
||||
routines. If this fails, uuconf_errno will be set, and the calling
|
||||
routine may return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO. */
|
||||
|
||||
pointer
|
||||
uuconf_malloc (pblock, c)
|
||||
pointer pblock;
|
||||
size_t c;
|
||||
{
|
||||
struct sblock *q = (struct sblock *) pblock;
|
||||
pointer pret;
|
||||
|
||||
if (c == 0)
|
||||
return NULL;
|
||||
|
||||
if (q == NULL)
|
||||
return malloc (c);
|
||||
|
||||
/* Make sure that c is aligned to a double boundary. */
|
||||
c = ((c + sizeof (double) - 1) / sizeof (double)) * sizeof (double);
|
||||
|
||||
while (q->ifree + c > CALLOC_SIZE)
|
||||
{
|
||||
if (q->qnext != NULL)
|
||||
q = q->qnext;
|
||||
else
|
||||
{
|
||||
if (c > CALLOC_SIZE)
|
||||
q->qnext = (struct sblock *) malloc (sizeof (struct sblock)
|
||||
+ c - CALLOC_SIZE);
|
||||
else
|
||||
q->qnext = (struct sblock *) malloc (sizeof (struct sblock));
|
||||
if (q->qnext == NULL)
|
||||
return NULL;
|
||||
q = q->qnext;
|
||||
q->qnext = NULL;
|
||||
q->ifree = 0;
|
||||
q->qadded = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pret = q->u.ab + q->ifree;
|
||||
q->ifree += c;
|
||||
q->plast = pret;
|
||||
|
||||
return pret;
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
/* alloc.h
|
||||
Header file for uuconf memory allocation 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
/* This header file is private to the uuconf memory allocation
|
||||
routines, and should not be included by any other files. */
|
||||
|
||||
/* We want to be able to keep track of allocated memory blocks, so
|
||||
that we can free them up later. This will let us free up all the
|
||||
memory allocated to hold information for a system, for example. We
|
||||
do this by allocating large chunks and doling them out. Calling
|
||||
uuconf_malloc_block will return a pointer to a magic cookie which
|
||||
can then be passed to uuconf_malloc and uuconf_free. Passing the
|
||||
pointer to uuconf_free_block will free all memory allocated for
|
||||
that block. */
|
||||
|
||||
/* We allocate this much space in each block. On most systems, this
|
||||
will make the actual structure 1024 bytes, which may be convenient
|
||||
for some types of memory allocators. */
|
||||
#define CALLOC_SIZE (1008)
|
||||
|
||||
/* This is the actual structure of a block. */
|
||||
struct sblock
|
||||
{
|
||||
/* Next block in linked list. */
|
||||
struct sblock *qnext;
|
||||
/* Index of next free spot. */
|
||||
size_t ifree;
|
||||
/* Last value returned by uuconf_malloc for this block. */
|
||||
pointer plast;
|
||||
/* List of additional memory blocks. */
|
||||
struct sadded *qadded;
|
||||
/* Buffer of data. We put it in a union with a double to make sure
|
||||
it is adequately aligned. */
|
||||
union
|
||||
{
|
||||
char ab[CALLOC_SIZE];
|
||||
double l;
|
||||
} u;
|
||||
};
|
||||
|
||||
/* There is a linked list of additional memory blocks inserted by
|
||||
uuconf_add_block. */
|
||||
struct sadded
|
||||
{
|
||||
/* The next in the list. */
|
||||
struct sadded *qnext;
|
||||
/* The added block. */
|
||||
pointer padded;
|
||||
};
|
@ -1,54 +0,0 @@
|
||||
/* base.c
|
||||
Subroutine to turn a cmdtab_offset table into a uuconf_cmdtab table.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_base_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* This turns a cmdtab_offset table into a uuconf_cmdtab table. Each
|
||||
offset is adjusted by a base value. */
|
||||
|
||||
void
|
||||
_uuconf_ucmdtab_base (qoff, celes, pbase, qset)
|
||||
register const struct cmdtab_offset *qoff;
|
||||
size_t celes;
|
||||
char *pbase;
|
||||
register struct uuconf_cmdtab *qset;
|
||||
{
|
||||
register size_t i;
|
||||
|
||||
for (i = 0; i < celes; i++, qoff++, qset++)
|
||||
{
|
||||
qset->uuconf_zcmd = qoff->zcmd;
|
||||
qset->uuconf_itype = qoff->itype;
|
||||
if (qoff->ioff == (size_t) -1)
|
||||
qset->uuconf_pvar = NULL;
|
||||
else
|
||||
qset->uuconf_pvar = pbase + qoff->ioff;
|
||||
qset->uuconf_pifn = qoff->pifn;
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/* bool.c
|
||||
Parse a boolean string into a variable.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_bool_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Parse a boolean string into a variable. This is called by
|
||||
uuconf_cmd_args, as well as other functions. The parsing is done
|
||||
in a single place to make it easy to change. This should return an
|
||||
error code, including both UUCONF_CMDTABRET_KEEP and
|
||||
UUCONF_CMDTABRET_EXIT if appropriate. */
|
||||
|
||||
/*ARGSIGNORED*/
|
||||
int
|
||||
_uuconf_iboolean (qglobal, zval, pi)
|
||||
struct sglobal *qglobal;
|
||||
const char *zval;
|
||||
boolean *pi;
|
||||
{
|
||||
switch (*zval)
|
||||
{
|
||||
case 'y':
|
||||
case 'Y':
|
||||
case 't':
|
||||
case 'T':
|
||||
*pi = TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
case 'N':
|
||||
case 'f':
|
||||
case 'F':
|
||||
*pi = FALSE;
|
||||
break;
|
||||
default:
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
}
|
||||
|
||||
return UUCONF_CMDTABRET_CONTINUE;
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
/* callin.c
|
||||
Check a login name and password against the UUCP password file.
|
||||
|
||||
Copyright (C) 1992, 1993, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_callin_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
static int ipcheck P((pointer pglobal, int argc, char **argv,
|
||||
pointer pvar, pointer pinfo));
|
||||
|
||||
struct sinfo
|
||||
{
|
||||
int (*pcmpfn) P((int, pointer, const char *));
|
||||
pointer pinfo;
|
||||
boolean ffound;
|
||||
boolean fmatched;
|
||||
};
|
||||
|
||||
/* Check a login name and password against the UUCP password file.
|
||||
This looks at the Taylor UUCP password file, but will work even if
|
||||
uuconf_taylor_init was not called. It accepts either spaces or
|
||||
colons as field delimiters. */
|
||||
|
||||
int
|
||||
uuconf_callin (pglobal, pcmpfn, pinfo)
|
||||
pointer pglobal;
|
||||
int (*pcmpfn) P((int, pointer, const char *));
|
||||
pointer pinfo;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
char **pz;
|
||||
struct uuconf_cmdtab as[1];
|
||||
struct sinfo s;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
|
||||
/* If we have no password file names, fill in the default name. */
|
||||
if (qglobal->qprocess->pzpwdfiles == NULL)
|
||||
{
|
||||
char ab[sizeof NEWCONFIGLIB + sizeof PASSWDFILE - 1];
|
||||
|
||||
memcpy ((pointer) ab, (pointer) NEWCONFIGLIB,
|
||||
sizeof NEWCONFIGLIB - 1);
|
||||
memcpy ((pointer) (ab + sizeof NEWCONFIGLIB - 1), (pointer) PASSWDFILE,
|
||||
sizeof PASSWDFILE);
|
||||
iret = _uuconf_iadd_string (qglobal, ab, TRUE, FALSE,
|
||||
&qglobal->qprocess->pzpwdfiles,
|
||||
qglobal->pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
as[0].uuconf_zcmd = NULL;
|
||||
|
||||
s.pcmpfn = pcmpfn;
|
||||
s.pinfo = pinfo;
|
||||
s.ffound = FALSE;
|
||||
s.fmatched = FALSE;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
for (pz = qglobal->qprocess->pzpwdfiles; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
while (getline (&zline, &cline, e) > 0)
|
||||
{
|
||||
char *z0, *z1;
|
||||
|
||||
++qglobal->ilineno;
|
||||
|
||||
/* We have a few hacks to make Unix style passwd files work.
|
||||
1) We turn the first two colon characters into spaces.
|
||||
2) If the colon characters are adjacent, we assume there
|
||||
is no password, and we skip the entry.
|
||||
3) If the password between colon characters contains a
|
||||
space, we assume that it has been disabled, and we
|
||||
skip the entry. */
|
||||
z0 = strchr (zline, ':');
|
||||
if (z0 != NULL)
|
||||
{
|
||||
*z0 = ' ';
|
||||
z1 = strchr (z0, ':');
|
||||
if (z1 != NULL)
|
||||
{
|
||||
if (z1 - z0 == 1)
|
||||
continue;
|
||||
*z1 = '\0';
|
||||
if (strchr (z0 + 1, ' ') != NULL)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
iret = uuconf_cmd_line (pglobal, zline, as, (pointer) &s,
|
||||
ipcheck, 0, (pointer) NULL);
|
||||
if ((iret & UUCONF_CMDTABRET_EXIT) != 0)
|
||||
{
|
||||
iret &=~ UUCONF_CMDTABRET_EXIT;
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
iret |= UUCONF_ERROR_LINENO;
|
||||
break;
|
||||
}
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
|
||||
if (iret != UUCONF_SUCCESS || s.ffound)
|
||||
break;
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
iret |= UUCONF_ERROR_FILENAME;
|
||||
}
|
||||
else if (! s.ffound || ! s.fmatched)
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
return iret;
|
||||
}
|
||||
|
||||
/* This is called on each line of the file. It checks to see if the
|
||||
login name from the file is the one we are looking for. If it is,
|
||||
it sets ffound, and then sets fmatched according to whether the
|
||||
password matches or not. */
|
||||
|
||||
static int
|
||||
ipcheck (pglobal, argc, argv, pvar, pinfo)
|
||||
pointer pglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
pointer pvar;
|
||||
pointer pinfo;
|
||||
{
|
||||
struct sinfo *q = (struct sinfo *) pinfo;
|
||||
|
||||
if (argc != 2)
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
if (! (*q->pcmpfn) (0, q->pinfo, argv[0]))
|
||||
return UUCONF_CMDTABRET_CONTINUE;
|
||||
|
||||
q->ffound = TRUE;
|
||||
q->fmatched = (*q->pcmpfn) (1, q->pinfo, argv[1]) != 0;
|
||||
|
||||
return UUCONF_CMDTABRET_EXIT;
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
/* calout.c
|
||||
Find callout login name and password for a system.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_calout_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Find callout login name and password for a system. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
uuconf_callout (pglobal, qsys, pzlog, pzpass)
|
||||
pointer pglobal;
|
||||
const struct uuconf_system *qsys;
|
||||
char **pzlog;
|
||||
char **pzpass;
|
||||
{
|
||||
#if HAVE_TAYLOR_CONFIG
|
||||
|
||||
return uuconf_taylor_callout (pglobal, qsys, pzlog, pzpass);
|
||||
|
||||
#else /* ! HAVE_TAYLOR_CONFIG */
|
||||
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
*pzlog = NULL;
|
||||
*pzpass = NULL;
|
||||
|
||||
if (qsys->uuconf_zcall_login == NULL
|
||||
&& qsys->uuconf_zcall_password == NULL)
|
||||
return UUCONF_NOT_FOUND;
|
||||
|
||||
if ((qsys->uuconf_zcall_login != NULL
|
||||
&& strcmp (qsys->uuconf_zcall_login, "*") == 0)
|
||||
|| (qsys->uuconf_zcall_password != NULL
|
||||
&& strcmp (qsys->uuconf_zcall_password, "*") == 0))
|
||||
return UUCONF_NOT_FOUND;
|
||||
|
||||
if (qsys->uuconf_zcall_login != NULL)
|
||||
{
|
||||
*pzlog = strdup (qsys->uuconf_zcall_login);
|
||||
if (*pzlog == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
}
|
||||
|
||||
if (qsys->uuconf_zcall_password != NULL)
|
||||
{
|
||||
*pzpass = strdup (qsys->uuconf_zcall_password);
|
||||
if (*pzpass == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
if (*pzlog != NULL)
|
||||
{
|
||||
free ((pointer) *pzlog);
|
||||
*pzlog = NULL;
|
||||
}
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
}
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
|
||||
#endif /* ! HAVE_TAYLOR_CONFIG */
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
/* chatc.c
|
||||
Subroutines to handle chat script commands.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_chatc_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
static int icchat P((pointer pglobal, int argc, char **argv,
|
||||
pointer pvar, pointer pinfo));
|
||||
static int icchat_fail P((pointer pglobal, int argc, char **argv,
|
||||
pointer pvar, pointer pinfo));
|
||||
static int icunknown P((pointer pglobal, int argc, char **argv,
|
||||
pointer pvar, pointer pinfo));
|
||||
|
||||
/* The chat script commands. */
|
||||
|
||||
static const struct cmdtab_offset asChat_cmds[] =
|
||||
{
|
||||
{ "chat", UUCONF_CMDTABTYPE_FN,
|
||||
offsetof (struct uuconf_chat, uuconf_pzchat), icchat },
|
||||
{ "chat-program", UUCONF_CMDTABTYPE_FULLSTRING,
|
||||
offsetof (struct uuconf_chat, uuconf_pzprogram), NULL },
|
||||
{ "chat-timeout", UUCONF_CMDTABTYPE_INT,
|
||||
offsetof (struct uuconf_chat, uuconf_ctimeout), NULL },
|
||||
{ "chat-fail", UUCONF_CMDTABTYPE_FN | 2,
|
||||
offsetof (struct uuconf_chat, uuconf_pzfail), icchat_fail },
|
||||
{ "chat-seven-bit", UUCONF_CMDTABTYPE_BOOLEAN,
|
||||
offsetof (struct uuconf_chat, uuconf_fstrip), NULL },
|
||||
{ NULL, 0, 0, NULL }
|
||||
};
|
||||
|
||||
#define CCHAT_CMDS (sizeof asChat_cmds / sizeof asChat_cmds[0])
|
||||
|
||||
/* Handle a chat script command. The chat script commands are entered
|
||||
as UUCONF_CMDTABTYPE_PREFIX, and the commands are routed to this
|
||||
function. We copy the command table onto the stack and repoint it
|
||||
at qchat in order to make the function reentrant. The return value
|
||||
can include UUCONF_CMDTABRET_KEEP, but should not include
|
||||
UUCONF_CMDTABRET_EXIT. */
|
||||
|
||||
int
|
||||
_uuconf_ichat_cmd (qglobal, argc, argv, qchat, pblock)
|
||||
struct sglobal *qglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
struct uuconf_chat *qchat;
|
||||
pointer pblock;
|
||||
{
|
||||
char *zchat;
|
||||
struct uuconf_cmdtab as[CCHAT_CMDS];
|
||||
int iret;
|
||||
|
||||
/* This is only invoked when argv[0] will contain the string "chat";
|
||||
the specific chat script command comes after that point. */
|
||||
for (zchat = argv[0]; *zchat != '\0'; zchat++)
|
||||
if ((*zchat == 'c' || *zchat == 'C')
|
||||
&& strncasecmp (zchat, "chat", sizeof "chat" - 1) == 0)
|
||||
break;
|
||||
if (*zchat == '\0')
|
||||
return UUCONF_SYNTAX_ERROR;
|
||||
argv[0] = zchat;
|
||||
|
||||
_uuconf_ucmdtab_base (asChat_cmds, CCHAT_CMDS, (char *) qchat, as);
|
||||
|
||||
iret = uuconf_cmd_args ((pointer) qglobal, argc, argv, as, pblock,
|
||||
icunknown, 0, pblock);
|
||||
return iret &~ UUCONF_CMDTABRET_EXIT;
|
||||
}
|
||||
|
||||
/* Handle the "chat" command. This breaks up substrings in expect
|
||||
strings, and sticks the arguments into a NULL terminated array. */
|
||||
|
||||
static int
|
||||
icchat (pglobal, argc, argv, pvar, pinfo)
|
||||
pointer pglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
pointer pvar;
|
||||
pointer pinfo;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char ***ppz = (char ***) pvar;
|
||||
pointer pblock = pinfo;
|
||||
int i;
|
||||
|
||||
*ppz = NULL;
|
||||
|
||||
for (i = 1; i < argc; i += 2)
|
||||
{
|
||||
char *z, *zdash;
|
||||
int iret;
|
||||
|
||||
/* Break the expect string into substrings. */
|
||||
z = argv[i];
|
||||
zdash = strchr (z, '-');
|
||||
while (zdash != NULL)
|
||||
{
|
||||
*zdash = '\0';
|
||||
iret = _uuconf_iadd_string (qglobal, z, TRUE, FALSE, ppz,
|
||||
pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
*zdash = '-';
|
||||
z = zdash;
|
||||
zdash = strchr (z + 1, '-');
|
||||
}
|
||||
|
||||
iret = _uuconf_iadd_string (qglobal, z, FALSE, FALSE, ppz, pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
|
||||
/* Add the send string without breaking it up. If it starts
|
||||
with a dash we must replace it with an escape sequence, to
|
||||
prevent it from being interpreted as a subsend. */
|
||||
|
||||
if (i + 1 < argc)
|
||||
{
|
||||
if (argv[i + 1][0] != '-')
|
||||
iret = _uuconf_iadd_string (qglobal, argv[i + 1], FALSE,
|
||||
FALSE, ppz, pblock);
|
||||
else
|
||||
{
|
||||
size_t clen;
|
||||
|
||||
clen = strlen (argv[i + 1]);
|
||||
z = uuconf_malloc (pblock, clen + 2);
|
||||
if (z == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
z[0] = '\\';
|
||||
memcpy ((pointer) (z + 1), (pointer) argv[i + 1], clen + 1);
|
||||
iret = _uuconf_iadd_string (qglobal, z, FALSE, FALSE, ppz,
|
||||
pblock);
|
||||
}
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
}
|
||||
|
||||
return UUCONF_CMDTABRET_KEEP;
|
||||
}
|
||||
|
||||
/* Add a new chat failure string. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
icchat_fail (pglobal, argc, argv, pvar, pinfo)
|
||||
pointer pglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
pointer pvar;
|
||||
pointer pinfo;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char ***ppz = (char ***) pvar;
|
||||
pointer pblock = pinfo;
|
||||
|
||||
return _uuconf_iadd_string (qglobal, argv[1], TRUE, FALSE, ppz, pblock);
|
||||
}
|
||||
|
||||
/* Return a syntax error for an unknown command. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
icunknown (pglobal, argc, argv, pvar, pinfo)
|
||||
pointer pglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
pointer pvar;
|
||||
pointer pinfo;
|
||||
{
|
||||
return UUCONF_SYNTAX_ERROR;
|
||||
}
|
@ -1,185 +0,0 @@
|
||||
/* cmdarg.c
|
||||
Look up a command with arguments in a command table.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_cmdarg_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#undef strcmp
|
||||
#if HAVE_STRCASECMP
|
||||
#undef strcasecmp
|
||||
#endif
|
||||
extern int strcmp (), strcasecmp ();
|
||||
|
||||
/* Look up a command with arguments in a table and execute it. */
|
||||
|
||||
int
|
||||
uuconf_cmd_args (pglobal, cargs, pzargs, qtab, pinfo, pfiunknown, iflags,
|
||||
pblock)
|
||||
pointer pglobal;
|
||||
int cargs;
|
||||
char **pzargs;
|
||||
const struct uuconf_cmdtab *qtab;
|
||||
pointer pinfo;
|
||||
int (*pfiunknown) P((pointer, int, char **, pointer, pointer));
|
||||
int iflags;
|
||||
pointer pblock;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int bfirstu, bfirstl;
|
||||
int (*pficmp) P((const char *, const char *));
|
||||
register const struct uuconf_cmdtab *q;
|
||||
int itype;
|
||||
int callowed;
|
||||
|
||||
bfirstu = bfirstl = pzargs[0][0];
|
||||
if ((iflags & UUCONF_CMDTABFLAG_CASE) != 0)
|
||||
pficmp = strcmp;
|
||||
else
|
||||
{
|
||||
if (islower (bfirstu))
|
||||
bfirstu = toupper (bfirstu);
|
||||
if (isupper (bfirstl))
|
||||
bfirstl = tolower (bfirstl);
|
||||
pficmp = strcasecmp;
|
||||
}
|
||||
|
||||
itype = 0;
|
||||
|
||||
for (q = qtab; q->uuconf_zcmd != NULL; q++)
|
||||
{
|
||||
int bfirst;
|
||||
|
||||
bfirst = q->uuconf_zcmd[0];
|
||||
if (bfirst != bfirstu && bfirst != bfirstl)
|
||||
continue;
|
||||
|
||||
itype = UUCONF_TTYPE_CMDTABTYPE (q->uuconf_itype);
|
||||
if (itype != UUCONF_CMDTABTYPE_PREFIX)
|
||||
{
|
||||
if ((*pficmp) (q->uuconf_zcmd, pzargs[0]) == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t clen;
|
||||
|
||||
clen = strlen (q->uuconf_zcmd);
|
||||
if ((iflags & UUCONF_CMDTABFLAG_CASE) != 0)
|
||||
{
|
||||
if (strncmp (q->uuconf_zcmd, pzargs[0], clen) == 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strncasecmp (q->uuconf_zcmd, pzargs[0], clen) == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (q->uuconf_zcmd == NULL)
|
||||
{
|
||||
if (pfiunknown == NULL)
|
||||
return UUCONF_CMDTABRET_CONTINUE;
|
||||
return (*pfiunknown) (pglobal, cargs, pzargs, (pointer) NULL, pinfo);
|
||||
}
|
||||
|
||||
callowed = UUCONF_CARGS_CMDTABTYPE (q->uuconf_itype);
|
||||
if (callowed != 0 && callowed != cargs)
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
switch (itype)
|
||||
{
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_STRING):
|
||||
if (cargs == 1)
|
||||
*(char **) q->uuconf_pvar = (char *) "";
|
||||
else if (cargs == 2)
|
||||
*(char **) q->uuconf_pvar = pzargs[1];
|
||||
else
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
return UUCONF_CMDTABRET_KEEP;
|
||||
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_INT):
|
||||
return _uuconf_iint (qglobal, pzargs[1], q->uuconf_pvar, TRUE);
|
||||
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_LONG):
|
||||
return _uuconf_iint (qglobal, pzargs[1], q->uuconf_pvar, FALSE);
|
||||
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_BOOLEAN):
|
||||
return _uuconf_iboolean (qglobal, pzargs[1], (int *) q->uuconf_pvar);
|
||||
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_FULLSTRING):
|
||||
if (cargs == 1)
|
||||
{
|
||||
char ***ppz = (char ***) q->uuconf_pvar;
|
||||
int iret;
|
||||
|
||||
*ppz = NULL;
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
|
||||
ppz, pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
return UUCONF_CMDTABRET_CONTINUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
char ***ppz = (char ***) q->uuconf_pvar;
|
||||
int i;
|
||||
|
||||
*ppz = NULL;
|
||||
for (i = 1; i < cargs; i++)
|
||||
{
|
||||
int iret;
|
||||
|
||||
iret = _uuconf_iadd_string (qglobal, pzargs[i], FALSE, FALSE,
|
||||
ppz, pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
*ppz = NULL;
|
||||
return iret | UUCONF_CMDTABRET_EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
return UUCONF_CMDTABRET_KEEP;
|
||||
}
|
||||
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_FN):
|
||||
case UUCONF_TTYPE_CMDTABTYPE (UUCONF_CMDTABTYPE_PREFIX):
|
||||
return (*q->uuconf_pifn) (pglobal, cargs, pzargs, q->uuconf_pvar,
|
||||
pinfo);
|
||||
|
||||
default:
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
}
|
||||
|
||||
/*NOTREACHED*/
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
/* cmdfil.c
|
||||
Read and parse commands from a file.
|
||||
|
||||
Copyright (C) 1992, 1993 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_cmdfil_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Read and parse commands from a file, updating uuconf_lineno as
|
||||
appropriate. */
|
||||
|
||||
int
|
||||
uuconf_cmd_file (pglobal, e, qtab, pinfo, pfiunknown, iflags, pblock)
|
||||
pointer pglobal;
|
||||
FILE *e;
|
||||
const struct uuconf_cmdtab *qtab;
|
||||
pointer pinfo;
|
||||
int (*pfiunknown) P((pointer, int, char **, pointer, pointer));
|
||||
int iflags;
|
||||
pointer pblock;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
boolean fcont;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
int iret;
|
||||
|
||||
fcont = (iflags & UUCONF_CMDTABFLAG_BACKSLASH) != 0;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
while ((fcont
|
||||
? _uuconf_getline (qglobal, &zline, &cline, e)
|
||||
: getline (&zline, &cline, e)) > 0)
|
||||
{
|
||||
++qglobal->ilineno;
|
||||
|
||||
iret = uuconf_cmd_line (pglobal, zline, qtab, pinfo, pfiunknown,
|
||||
iflags, pblock);
|
||||
|
||||
if ((iret & UUCONF_CMDTABRET_KEEP) != 0)
|
||||
{
|
||||
iret &=~ UUCONF_CMDTABRET_KEEP;
|
||||
|
||||
if (pblock != NULL)
|
||||
{
|
||||
if (uuconf_add_block (pblock, zline) != 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = (UUCONF_MALLOC_FAILED
|
||||
| UUCONF_ERROR_ERRNO
|
||||
| UUCONF_ERROR_LINENO);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
}
|
||||
|
||||
if ((iret & UUCONF_CMDTABRET_EXIT) != 0)
|
||||
{
|
||||
iret &=~ UUCONF_CMDTABRET_EXIT;
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
iret |= UUCONF_ERROR_LINENO;
|
||||
break;
|
||||
}
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
/* cmdlin.c
|
||||
Parse a command line.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_cmdlin_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Parse a command line into fields and process it via a command
|
||||
table. The command table functions may keep the memory allocated
|
||||
for the line, but they may not keep the memory allocated for the
|
||||
argv list. This function strips # comments. */
|
||||
|
||||
#define CSTACK (16)
|
||||
|
||||
int
|
||||
uuconf_cmd_line (pglobal, zline, qtab, pinfo, pfiunknown, iflags, pblock)
|
||||
pointer pglobal;
|
||||
char *zline;
|
||||
const struct uuconf_cmdtab *qtab;
|
||||
pointer pinfo;
|
||||
int (*pfiunknown) P((pointer, int, char **, pointer, pointer));
|
||||
int iflags;
|
||||
pointer pblock;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char *z;
|
||||
int cargs;
|
||||
char *azargs[CSTACK];
|
||||
char **pzargs;
|
||||
int iret;
|
||||
|
||||
if ((iflags & UUCONF_CMDTABFLAG_NOCOMMENTS) == 0)
|
||||
{
|
||||
/* Any # not preceeded by a backslash starts a comment. */
|
||||
z = zline;
|
||||
while ((z = strchr (z, '#')) != NULL)
|
||||
{
|
||||
if (z == zline || *(z - 1) != '\\')
|
||||
{
|
||||
*z = '\0';
|
||||
break;
|
||||
}
|
||||
/* Remove the backslash. */
|
||||
while ((*(z - 1) = *z) != '\0')
|
||||
++z;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the first CSTACK arguments by hand to avoid malloc. */
|
||||
|
||||
z = zline;
|
||||
cargs = 0;
|
||||
pzargs = azargs;
|
||||
while (TRUE)
|
||||
{
|
||||
while (*z != '\0' && isspace (BUCHAR (*z)))
|
||||
++z;
|
||||
|
||||
if (*z == '\0')
|
||||
break;
|
||||
|
||||
if (cargs >= CSTACK)
|
||||
{
|
||||
char **pzsplit;
|
||||
size_t csplit;
|
||||
int cmore;
|
||||
|
||||
pzsplit = NULL;
|
||||
csplit = 0;
|
||||
cmore = _uuconf_istrsplit (z, '\0', &pzsplit, &csplit);
|
||||
if (cmore < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
pzargs = (char **) malloc ((cmore + CSTACK) * sizeof (char *));
|
||||
if (pzargs == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
free ((pointer) pzsplit);
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
memcpy ((pointer) pzargs, (pointer) azargs,
|
||||
CSTACK * sizeof (char *));
|
||||
memcpy ((pointer) (pzargs + CSTACK), (pointer) pzsplit,
|
||||
cmore * sizeof (char *));
|
||||
cargs = cmore + CSTACK;
|
||||
|
||||
free ((pointer) pzsplit);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
azargs[cargs] = z;
|
||||
++cargs;
|
||||
|
||||
while (*z != '\0' && ! isspace (BUCHAR (*z)))
|
||||
z++;
|
||||
|
||||
if (*z == '\0')
|
||||
break;
|
||||
|
||||
*z++ = '\0';
|
||||
}
|
||||
|
||||
if (cargs <= 0)
|
||||
return UUCONF_CMDTABRET_CONTINUE;
|
||||
|
||||
iret = uuconf_cmd_args (pglobal, cargs, pzargs, qtab, pinfo, pfiunknown,
|
||||
iflags, pblock);
|
||||
|
||||
if (pzargs != azargs)
|
||||
free ((pointer) pzargs);
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* debfil.c
|
||||
Get the name of the UUCP debugging file.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_debfil_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Get the name of the UUCP debugging file. */
|
||||
|
||||
int
|
||||
uuconf_debugfile (pglobal, pzdebug)
|
||||
pointer pglobal;
|
||||
const char **pzdebug;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
*pzdebug = qglobal->qprocess->zdebugfile;
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* deblev.c
|
||||
Get the UUCP debugging level.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_deblev_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Get the UUCP debugging level. */
|
||||
|
||||
int
|
||||
uuconf_debuglevel (pglobal, pzdebug)
|
||||
pointer pglobal;
|
||||
const char **pzdebug;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
*pzdebug = qglobal->qprocess->zdebug;
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
/* diacod.c
|
||||
Translate a dialcode.
|
||||
|
||||
Copyright (C) 1992, 1993 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_diacod_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
static int idcode P((pointer pglobal, int argc, char **argv,
|
||||
pointer pinfo, pointer pvar));
|
||||
|
||||
/* Get the name of the UUCP log file. */
|
||||
|
||||
int
|
||||
uuconf_dialcode (pglobal, zdial, pznum)
|
||||
pointer pglobal;
|
||||
const char *zdial;
|
||||
char **pznum;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
struct uuconf_cmdtab as[2];
|
||||
char **pz;
|
||||
int iret;
|
||||
|
||||
as[0].uuconf_zcmd = zdial;
|
||||
as[0].uuconf_itype = UUCONF_CMDTABTYPE_FN | 0;
|
||||
as[0].uuconf_pvar = (pointer) pznum;
|
||||
as[0].uuconf_pifn = idcode;
|
||||
|
||||
as[1].uuconf_zcmd = NULL;
|
||||
|
||||
*pznum = NULL;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
for (pz = qglobal->qprocess->pzdialcodefiles; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
iret = uuconf_cmd_file (pglobal, e, as, (pointer) NULL,
|
||||
(uuconf_cmdtabfn) NULL, 0, (pointer) NULL);
|
||||
(void) fclose (e);
|
||||
|
||||
if (iret != UUCONF_SUCCESS || *pznum != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
iret |= UUCONF_ERROR_FILENAME;
|
||||
}
|
||||
else if (*pznum == NULL)
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
return iret;
|
||||
}
|
||||
|
||||
/* This is called if the dialcode is found. It copies the number into
|
||||
the heap and gets out of reading the file. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
idcode (pglobal, argc, argv, pvar, pinfo)
|
||||
pointer pglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
pointer pvar;
|
||||
pointer pinfo;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char **pznum = (char **) pvar;
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
*pznum = malloc (1);
|
||||
if (*pznum != NULL)
|
||||
**pznum = '\0';
|
||||
}
|
||||
else if (argc == 2)
|
||||
*pznum = strdup (argv[1]);
|
||||
else
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
if (*pznum == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return (UUCONF_MALLOC_FAILED
|
||||
| UUCONF_ERROR_ERRNO
|
||||
| UUCONF_CMDTABRET_EXIT);
|
||||
}
|
||||
|
||||
return UUCONF_CMDTABRET_EXIT;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/* dial.c
|
||||
Find a dialer.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_dial_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Find a dialer by name. */
|
||||
|
||||
int
|
||||
uuconf_dialer_info (pglobal, zdialer, qdialer)
|
||||
pointer pglobal;
|
||||
const char *zdialer;
|
||||
struct uuconf_dialer *qdialer;
|
||||
{
|
||||
#if HAVE_HDB_CONFIG
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
#endif
|
||||
int iret;
|
||||
|
||||
#if HAVE_TAYLOR_CONFIG
|
||||
iret = uuconf_taylor_dialer_info (pglobal, zdialer, qdialer);
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
return iret;
|
||||
#endif
|
||||
|
||||
#if HAVE_HDB_CONFIG
|
||||
if (qglobal->qprocess->fhdb)
|
||||
{
|
||||
iret = uuconf_hdb_dialer_info (pglobal, zdialer, qdialer);
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
return iret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return UUCONF_NOT_FOUND;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/* diasub.c
|
||||
Dialer information subroutines.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_diasub_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Clear the information in a dialer. */
|
||||
|
||||
#define INIT_CHAT(q) \
|
||||
((q)->uuconf_pzchat = NULL, \
|
||||
(q)->uuconf_pzprogram = NULL, \
|
||||
(q)->uuconf_ctimeout = 60, \
|
||||
(q)->uuconf_pzfail = NULL, \
|
||||
(q)->uuconf_fstrip = TRUE)
|
||||
|
||||
void
|
||||
_uuconf_uclear_dialer (qdialer)
|
||||
struct uuconf_dialer *qdialer;
|
||||
{
|
||||
qdialer->uuconf_zname = NULL;
|
||||
INIT_CHAT (&qdialer->uuconf_schat);
|
||||
qdialer->uuconf_zdialtone = (char *) ",";
|
||||
qdialer->uuconf_zpause = (char *) ",";
|
||||
qdialer->uuconf_fcarrier = TRUE;
|
||||
qdialer->uuconf_ccarrier_wait = 60;
|
||||
qdialer->uuconf_fdtr_toggle = FALSE;
|
||||
qdialer->uuconf_fdtr_toggle_wait = FALSE;
|
||||
INIT_CHAT (&qdialer->uuconf_scomplete);
|
||||
INIT_CHAT (&qdialer->uuconf_sabort);
|
||||
qdialer->uuconf_qproto_params = NULL;
|
||||
/* Note that we do not set RELIABLE_SPECIFIED; this just sets
|
||||
defaults, so that ``seven-bit true'' does not imply ``reliable
|
||||
false''. */
|
||||
qdialer->uuconf_ireliable = (UUCONF_RELIABLE_RELIABLE
|
||||
| UUCONF_RELIABLE_EIGHT
|
||||
| UUCONF_RELIABLE_FULLDUPLEX);
|
||||
qdialer->uuconf_palloc = NULL;
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
/* dnams.c
|
||||
Get all known dialer names.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_dnams_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Get all known dialer names. */
|
||||
|
||||
int
|
||||
uuconf_dialer_names (pglobal, ppzdialers)
|
||||
pointer pglobal;
|
||||
char ***ppzdialers;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char **pztaylor;
|
||||
char **pzhdb;
|
||||
int iret;
|
||||
|
||||
*ppzdialers = NULL;
|
||||
pztaylor = NULL;
|
||||
pzhdb = NULL;
|
||||
|
||||
#if HAVE_TAYLOR_CONFIG
|
||||
iret = uuconf_taylor_dialer_names (pglobal, &pztaylor);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
#endif
|
||||
|
||||
#if HAVE_HDB_CONFIG
|
||||
if (qglobal->qprocess->fhdb)
|
||||
{
|
||||
iret = uuconf_hdb_dialer_names (pglobal, &pzhdb);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pzhdb == NULL)
|
||||
*ppzdialers = pztaylor;
|
||||
else if (pztaylor == NULL)
|
||||
*ppzdialers = pzhdb;
|
||||
else
|
||||
{
|
||||
char **pz;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
for (pz = pztaylor; *pz != NULL; pz++)
|
||||
{
|
||||
iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE,
|
||||
ppzdialers, (pointer) NULL);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
if (iret == UUCONF_SUCCESS)
|
||||
{
|
||||
for (pz = pzhdb; *pz != NULL; pz++)
|
||||
{
|
||||
iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE,
|
||||
ppzdialers, (pointer) NULL);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pztaylor != NULL)
|
||||
free ((pointer) pztaylor);
|
||||
if (pzhdb != NULL)
|
||||
free ((pointer) pzhdb);
|
||||
}
|
||||
|
||||
if (iret == UUCONF_SUCCESS && *ppzdialers == NULL)
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
|
||||
ppzdialers, (pointer) NULL);
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* errno.c
|
||||
Return the saved errno value.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_errno_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Return the saved errno value. */
|
||||
|
||||
int
|
||||
uuconf_error_errno (pglobal)
|
||||
pointer pglobal;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
if (qglobal == NULL)
|
||||
return errno;
|
||||
else
|
||||
return qglobal->ierrno;
|
||||
}
|
@ -1,241 +0,0 @@
|
||||
/* errstr.c
|
||||
Return a string for a uuconf error.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_errstr_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
static char *zeprint_num P((char *zbuf, size_t cbuf, int ival));
|
||||
|
||||
/* Return an error string for a uuconf error. This does not return a
|
||||
uuconf error code, but instead returns the total buffer length. */
|
||||
|
||||
int
|
||||
uuconf_error_string (pglobal, ierr, zbuf, cbuf)
|
||||
pointer pglobal;
|
||||
int ierr;
|
||||
char *zbuf;
|
||||
size_t cbuf;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
const char *zfile;
|
||||
size_t cfile;
|
||||
const char *zlineno;
|
||||
char ablineno[100];
|
||||
size_t clineno;
|
||||
const char *zmsg;
|
||||
char abmsg[100];
|
||||
size_t cmsg;
|
||||
const char *zerrno;
|
||||
size_t cerrno;
|
||||
size_t cret;
|
||||
size_t ccopy;
|
||||
|
||||
/* The format of the message is
|
||||
|
||||
filename:lineno: message: errno
|
||||
|
||||
If there is no filename, the trailing colon is not output. If
|
||||
there is no linenumber, the trailing colon is not output. If
|
||||
there is no filename, the linenumber is not output, and neither
|
||||
is the space before message. If there is no errno, the
|
||||
preceeding colon and space are not output. */
|
||||
|
||||
/* Get the filename to put in the error message, if any. */
|
||||
if ((ierr & UUCONF_ERROR_FILENAME) == 0
|
||||
|| qglobal == NULL
|
||||
|| qglobal->zfilename == NULL)
|
||||
{
|
||||
zfile = "";
|
||||
cfile = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zfile = qglobal->zfilename;
|
||||
cfile = strlen (zfile) + 1;
|
||||
}
|
||||
|
||||
/* Get the line number to put in the error message, if any. */
|
||||
if (cfile == 0
|
||||
|| (ierr & UUCONF_ERROR_LINENO) == 0
|
||||
|| qglobal == NULL
|
||||
|| qglobal->ilineno <= 0)
|
||||
{
|
||||
zlineno = "";
|
||||
clineno = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zlineno = zeprint_num (ablineno, sizeof ablineno, qglobal->ilineno);
|
||||
clineno = strlen (zlineno) + 1;
|
||||
}
|
||||
|
||||
/* Get the main message. */
|
||||
switch (UUCONF_ERROR_VALUE (ierr))
|
||||
{
|
||||
case UUCONF_SUCCESS:
|
||||
zmsg = "no error";
|
||||
break;
|
||||
case UUCONF_NOT_FOUND:
|
||||
zmsg = "not found";
|
||||
break;
|
||||
case UUCONF_FOPEN_FAILED:
|
||||
zmsg = "fopen";
|
||||
break;
|
||||
case UUCONF_FSEEK_FAILED:
|
||||
zmsg = "fseek";
|
||||
break;
|
||||
case UUCONF_MALLOC_FAILED:
|
||||
zmsg = "malloc";
|
||||
break;
|
||||
case UUCONF_SYNTAX_ERROR:
|
||||
zmsg = "syntax error";
|
||||
break;
|
||||
default:
|
||||
zmsg = zeprint_num (abmsg, sizeof abmsg, UUCONF_ERROR_VALUE (ierr));
|
||||
zmsg -= sizeof "error " - 1;
|
||||
memcpy ((pointer) zmsg, (pointer) "error ", sizeof "error " - 1);
|
||||
break;
|
||||
}
|
||||
|
||||
cmsg = strlen (zmsg);
|
||||
if (cfile > 0)
|
||||
++cmsg;
|
||||
|
||||
/* Get the errno string. Note that strerror is not necessarily
|
||||
reentrant. */
|
||||
if ((ierr & UUCONF_ERROR_ERRNO) == 0
|
||||
|| qglobal == NULL)
|
||||
{
|
||||
zerrno = "";
|
||||
cerrno = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zerrno = strerror (qglobal->ierrno);
|
||||
cerrno = strlen (zerrno) + 2;
|
||||
}
|
||||
|
||||
cret = cfile + clineno + cmsg + cerrno + 1;
|
||||
|
||||
if (cbuf == 0)
|
||||
return cret;
|
||||
|
||||
/* Leave room for the null byte. */
|
||||
--cbuf;
|
||||
|
||||
if (cfile > 0)
|
||||
{
|
||||
ccopy = cfile - 1;
|
||||
if (ccopy > cbuf)
|
||||
ccopy = cbuf;
|
||||
memcpy ((pointer) zbuf, (pointer) zfile, ccopy);
|
||||
zbuf += ccopy;
|
||||
cbuf -= ccopy;
|
||||
if (cbuf > 0)
|
||||
{
|
||||
*zbuf++ = ':';
|
||||
--cbuf;
|
||||
}
|
||||
}
|
||||
|
||||
if (clineno > 0)
|
||||
{
|
||||
ccopy = clineno - 1;
|
||||
if (ccopy > cbuf)
|
||||
ccopy = cbuf;
|
||||
memcpy ((pointer) zbuf, (pointer) zlineno, ccopy);
|
||||
zbuf += ccopy;
|
||||
cbuf -= ccopy;
|
||||
if (cbuf > 0)
|
||||
{
|
||||
*zbuf++ = ':';
|
||||
--cbuf;
|
||||
}
|
||||
}
|
||||
|
||||
if (cbuf > 0 && cfile > 0)
|
||||
{
|
||||
*zbuf++ = ' ';
|
||||
--cbuf;
|
||||
--cmsg;
|
||||
}
|
||||
ccopy = cmsg;
|
||||
if (ccopy > cbuf)
|
||||
ccopy = cbuf;
|
||||
memcpy ((pointer) zbuf, (pointer) zmsg, ccopy);
|
||||
zbuf += ccopy;
|
||||
cbuf -= ccopy;
|
||||
|
||||
if (cerrno > 0)
|
||||
{
|
||||
if (cbuf > 0)
|
||||
{
|
||||
*zbuf++ = ':';
|
||||
--cbuf;
|
||||
}
|
||||
if (cbuf > 0)
|
||||
{
|
||||
*zbuf++ = ' ';
|
||||
--cbuf;
|
||||
}
|
||||
ccopy = cerrno - 2;
|
||||
if (ccopy > cbuf)
|
||||
ccopy = cbuf;
|
||||
memcpy ((pointer) zbuf, (pointer) zerrno, ccopy);
|
||||
zbuf += ccopy;
|
||||
cbuf -= ccopy;
|
||||
}
|
||||
|
||||
*zbuf = '\0';
|
||||
|
||||
return cret;
|
||||
}
|
||||
|
||||
/* Turn a number into a string. This should really call sprintf, but
|
||||
since nothing else in the uuconf library calls any print routine,
|
||||
it's more interesting to not call it here either. */
|
||||
|
||||
static char *
|
||||
zeprint_num (ab, c, i)
|
||||
char *ab;
|
||||
size_t c;
|
||||
register int i;
|
||||
{
|
||||
register char *z;
|
||||
|
||||
z = ab + c;
|
||||
*--z = '\0';
|
||||
do
|
||||
{
|
||||
*--z = i % 10 + '0';
|
||||
i /= 10;
|
||||
}
|
||||
while (i != 0);
|
||||
|
||||
return z;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* filnam.c
|
||||
Return the saved file name.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_filnam_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Return the saved file name. */
|
||||
|
||||
UUCONF_CONST char *
|
||||
uuconf_error_filename (pglobal)
|
||||
pointer pglobal;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
if (qglobal == NULL)
|
||||
return "";
|
||||
else
|
||||
return qglobal->zfilename;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/* freblk.c
|
||||
Free up an entire memory block.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_freblk_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "alloc.h"
|
||||
|
||||
/* Free up an entire memory block. */
|
||||
|
||||
#if UUCONF_ANSI_C
|
||||
void
|
||||
#endif
|
||||
uuconf_free_block (pblock)
|
||||
pointer pblock;
|
||||
{
|
||||
struct sblock *q = (struct sblock *) pblock;
|
||||
struct sblock *qloop;
|
||||
|
||||
/* We have to free the added blocks first because the list may link
|
||||
into blocks that are earlier on the list. */
|
||||
for (qloop = q; qloop != NULL; qloop = qloop->qnext)
|
||||
{
|
||||
struct sadded *qadd;
|
||||
|
||||
for (qadd = qloop->qadded; qadd != NULL; qadd = qadd->qnext)
|
||||
free (qadd->padded);
|
||||
}
|
||||
|
||||
while (q != NULL)
|
||||
{
|
||||
struct sblock *qnext;
|
||||
|
||||
qnext = q->qnext;
|
||||
free ((pointer) q);
|
||||
q = qnext;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* fredia.c
|
||||
Free dialer information.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_fredia_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Free the memory allocated for a dialer. */
|
||||
|
||||
#undef uuconf_dialer_free
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
uuconf_dialer_free (pglobal, qdialer)
|
||||
pointer pglobal;
|
||||
struct uuconf_dialer *qdialer;
|
||||
{
|
||||
uuconf_free_block (qdialer->uuconf_palloc);
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
/* free.c
|
||||
Free a buffer from within a memory block.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_free_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include "alloc.h"
|
||||
|
||||
/* Free memory allocated by uuconf_malloc. If the memory block is
|
||||
NULL, this just calls free; this is convenient for a number of
|
||||
routines. Otherwise, this will only do something if this was the
|
||||
last buffer allocated for one of the memory blocks in the list; in
|
||||
other cases, the memory is lost until the entire memory block is
|
||||
freed. */
|
||||
|
||||
#if UUCONF_ANSI_C
|
||||
void
|
||||
#endif
|
||||
uuconf_free (pblock, pbuf)
|
||||
pointer pblock;
|
||||
pointer pbuf;
|
||||
{
|
||||
struct sblock *q = (struct sblock *) pblock;
|
||||
|
||||
if (pbuf == NULL)
|
||||
return;
|
||||
|
||||
if (q == NULL)
|
||||
{
|
||||
free (pbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
for (; q != NULL; q = q->qnext)
|
||||
{
|
||||
if (q->plast == pbuf)
|
||||
{
|
||||
q->ifree = (char *) pbuf - q->u.ab;
|
||||
/* We could reset q->plast here, but it doesn't matter. */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* freprt.c
|
||||
Free port information.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_freprt_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Free the memory allocated for a port. */
|
||||
|
||||
#undef uuconf_port_free
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
uuconf_port_free (pglobal, qport)
|
||||
pointer pglobal;
|
||||
struct uuconf_port *qport;
|
||||
{
|
||||
uuconf_free_block (qport->uuconf_palloc);
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* fresys.c
|
||||
Free system information.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_fresys_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Free the memory allocated for a system. */
|
||||
|
||||
#undef uuconf_system_free
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
uuconf_system_free (pglobal, qsys)
|
||||
pointer pglobal;
|
||||
struct uuconf_system *qsys;
|
||||
{
|
||||
uuconf_free_block (qsys->uuconf_palloc);
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/* grdcmp.c
|
||||
Compare two grades.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_grdcmp_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* 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.
|
||||
|
||||
This implementation assumes that the upper case letters are in
|
||||
sequence, and that the lower case letters are in sequence. */
|
||||
|
||||
int
|
||||
uuconf_grade_cmp (barg1, barg2)
|
||||
int barg1;
|
||||
int barg2;
|
||||
{
|
||||
int b1, b2;
|
||||
|
||||
/* Make sure the arguments are unsigned. */
|
||||
b1 = (int) BUCHAR (barg1);
|
||||
b2 = (int) BUCHAR (barg2);
|
||||
|
||||
if (isdigit (b1))
|
||||
{
|
||||
if (isdigit (b2))
|
||||
return b1 - b2;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if (isupper (b1))
|
||||
{
|
||||
if (isdigit (b2))
|
||||
return 1;
|
||||
else if (isupper (b2))
|
||||
return b1 - b2;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! islower (b2))
|
||||
return 1;
|
||||
else
|
||||
return b1 - b2;
|
||||
}
|
||||
}
|
@ -1,187 +0,0 @@
|
||||
/* hdial.c
|
||||
Find a dialer in the HDB configuration files.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hdial_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Find a dialer in the HDB configuration files by name. */
|
||||
|
||||
int
|
||||
uuconf_hdb_dialer_info (pglobal, zname, qdialer)
|
||||
pointer pglobal;
|
||||
const char *zname;
|
||||
struct uuconf_dialer *qdialer;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char **pz;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
char **pzsplit;
|
||||
size_t csplit;
|
||||
int iret;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
pzsplit = NULL;
|
||||
csplit = 0;
|
||||
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
for (pz = qglobal->qprocess->pzhdb_dialers; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
int cchars;
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
while ((cchars = _uuconf_getline (qglobal, &zline, &cline, e)) > 0)
|
||||
{
|
||||
int ctoks;
|
||||
pointer pblock;
|
||||
|
||||
++qglobal->ilineno;
|
||||
|
||||
--cchars;
|
||||
if (zline[cchars] == '\n')
|
||||
zline[cchars] = '\0';
|
||||
if (isspace (BUCHAR (zline[0])) || zline[0] == '#')
|
||||
continue;
|
||||
|
||||
ctoks = _uuconf_istrsplit (zline, '\0', &pzsplit, &csplit);
|
||||
if (ctoks < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctoks < 1)
|
||||
continue;
|
||||
|
||||
if (strcmp (zname, pzsplit[0]) != 0)
|
||||
continue;
|
||||
|
||||
/* We found the dialer. */
|
||||
pblock = uuconf_malloc_block ();
|
||||
if (pblock == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
if (uuconf_add_block (pblock, zline) != 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
uuconf_free_block (pblock);
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
zline = NULL;
|
||||
|
||||
_uuconf_uclear_dialer (qdialer);
|
||||
qdialer->uuconf_zname = pzsplit[0];
|
||||
qdialer->uuconf_palloc = pblock;
|
||||
|
||||
if (ctoks > 1)
|
||||
{
|
||||
/* The second field is characters to send instead of "="
|
||||
and "-" in phone numbers. */
|
||||
if (strcmp (pzsplit[1], "\"\"") == 0)
|
||||
{
|
||||
char *zsubs;
|
||||
char bnext;
|
||||
|
||||
zsubs = pzsplit[1];
|
||||
bnext = *zsubs;
|
||||
while (bnext != '\0')
|
||||
{
|
||||
if (bnext == '=')
|
||||
qdialer->uuconf_zdialtone = zsubs + 1;
|
||||
else if (bnext == '-')
|
||||
qdialer->uuconf_zpause = zsubs + 1;
|
||||
if (zsubs[1] == '\0')
|
||||
break;
|
||||
zsubs += 2;
|
||||
bnext = *zsubs;
|
||||
*zsubs = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* Any remaining fields form a chat script. */
|
||||
if (ctoks > 2)
|
||||
{
|
||||
pzsplit[1] = (char *) "chat";
|
||||
iret = _uuconf_ichat_cmd (qglobal, ctoks - 1,
|
||||
pzsplit + 1,
|
||||
&qdialer->uuconf_schat,
|
||||
pblock);
|
||||
iret &=~ UUCONF_CMDTABRET_KEEP;
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
uuconf_free_block (pblock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
break;
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
if (pzsplit != NULL)
|
||||
free ((pointer) pzsplit);
|
||||
|
||||
if (iret != UUCONF_SUCCESS && iret != UUCONF_NOT_FOUND)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
iret |= UUCONF_ERROR_FILENAME | UUCONF_ERROR_LINENO;
|
||||
}
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
/* hdnams.c
|
||||
Get all known dialer names from the HDB configuration files.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hdnams_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Get all the dialer names from the HDB Dialers file. */
|
||||
|
||||
int
|
||||
uuconf_hdb_dialer_names (pglobal, ppzdialers)
|
||||
pointer pglobal;
|
||||
char ***ppzdialers;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
char **pz;
|
||||
|
||||
*ppzdialers = NULL;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
|
||||
for (pz = qglobal->qprocess->pzhdb_dialers; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
while (_uuconf_getline (qglobal, &zline, &cline, e) > 0)
|
||||
{
|
||||
++qglobal->ilineno;
|
||||
|
||||
/* Lines beginning with whitespace are treated as comments.
|
||||
No dialer name can contain a '#', which is another
|
||||
comment character, so eliminating the first '#' does no
|
||||
harm and catches comments. */
|
||||
zline[strcspn (zline, " \t#\n")] = '\0';
|
||||
if (*zline == '\0')
|
||||
continue;
|
||||
|
||||
iret = _uuconf_iadd_string (qglobal, zline, TRUE, TRUE,
|
||||
ppzdialers, (pointer) NULL);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
iret |= UUCONF_ERROR_LINENO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
return iret | UUCONF_ERROR_FILENAME;
|
||||
}
|
||||
|
||||
if (*ppzdialers == NULL)
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
|
||||
ppzdialers, (pointer) NULL);
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,295 +0,0 @@
|
||||
/* hinit.c
|
||||
Initialize for reading HDB configuration files.
|
||||
|
||||
Copyright (C) 1992, 1994 Ian Lance Taylor
|
||||
|
||||
This file is part of the Taylor UUCP uuconf library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hinit_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Avoid replicating OLDCONFIGLIB several times if not necessary. */
|
||||
static const char abHoldconfiglib[] = OLDCONFIGLIB;
|
||||
|
||||
/* Initialize the routines which read HDB configuration files. */
|
||||
|
||||
int
|
||||
uuconf_hdb_init (ppglobal, zprogram)
|
||||
pointer *ppglobal;
|
||||
const char *zprogram;
|
||||
{
|
||||
struct sglobal **pqglobal = (struct sglobal **) ppglobal;
|
||||
int iret;
|
||||
struct sglobal *qglobal;
|
||||
pointer pblock;
|
||||
char abdialcodes[sizeof OLDCONFIGLIB + sizeof HDB_DIALCODES - 1];
|
||||
char *zsys;
|
||||
FILE *e;
|
||||
|
||||
if (*pqglobal == NULL)
|
||||
{
|
||||
iret = _uuconf_iinit_global (pqglobal);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
qglobal = *pqglobal;
|
||||
pblock = qglobal->pblock;
|
||||
|
||||
if (zprogram == NULL
|
||||
|| strcmp (zprogram, "uucp") == 0)
|
||||
zprogram = "uucico";
|
||||
|
||||
/* Add the Dialcodes file to the global list. */
|
||||
memcpy ((pointer) abdialcodes, (pointer) abHoldconfiglib,
|
||||
sizeof OLDCONFIGLIB - 1);
|
||||
memcpy ((pointer) (abdialcodes + sizeof OLDCONFIGLIB - 1),
|
||||
(pointer) HDB_DIALCODES, sizeof HDB_DIALCODES);
|
||||
iret = _uuconf_iadd_string (qglobal, abdialcodes, TRUE, FALSE,
|
||||
&qglobal->qprocess->pzdialcodefiles,
|
||||
pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
|
||||
/* Read the Sysfiles file. We allocate the name on the heap rather
|
||||
than the stack so that we can return it in
|
||||
qerr->uuconf_zfilename. */
|
||||
|
||||
zsys = uuconf_malloc (pblock,
|
||||
sizeof OLDCONFIGLIB + sizeof HDB_SYSFILES - 1);
|
||||
if (zsys == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
memcpy ((pointer) zsys, (pointer) abHoldconfiglib, sizeof OLDCONFIGLIB - 1);
|
||||
memcpy ((pointer) (zsys + sizeof OLDCONFIGLIB - 1), (pointer) HDB_SYSFILES,
|
||||
sizeof HDB_SYSFILES);
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
e = fopen (zsys, "r");
|
||||
if (e == NULL)
|
||||
uuconf_free (pblock, zsys);
|
||||
else
|
||||
{
|
||||
char *zline;
|
||||
size_t cline;
|
||||
char **pzargs;
|
||||
size_t cargs;
|
||||
char **pzcolon;
|
||||
size_t ccolon;
|
||||
int cchars;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
pzargs = NULL;
|
||||
cargs = 0;
|
||||
pzcolon = NULL;
|
||||
ccolon = 0;
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
while (iret == UUCONF_SUCCESS
|
||||
&& (cchars = _uuconf_getline (qglobal, &zline, &cline, e)) > 0)
|
||||
{
|
||||
int ctypes, cnames;
|
||||
int i;
|
||||
|
||||
++qglobal->ilineno;
|
||||
|
||||
--cchars;
|
||||
if (zline[cchars] == '\n')
|
||||
zline[cchars] = '\0';
|
||||
if (zline[0] == '#')
|
||||
continue;
|
||||
|
||||
ctypes = _uuconf_istrsplit (zline, '\0', &pzargs, &cargs);
|
||||
if (ctypes < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctypes == 0)
|
||||
continue;
|
||||
|
||||
if (strncmp (pzargs[0], "service=", sizeof "service=" - 1) != 0)
|
||||
{
|
||||
iret = UUCONF_SYNTAX_ERROR;
|
||||
break;
|
||||
}
|
||||
pzargs[0] += sizeof "service=" - 1;
|
||||
|
||||
cnames = _uuconf_istrsplit (pzargs[0], ':', &pzcolon, &ccolon);
|
||||
if (cnames < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < cnames; i++)
|
||||
if (strcmp (zprogram, pzcolon[i]) == 0)
|
||||
break;
|
||||
|
||||
if (i >= cnames)
|
||||
continue;
|
||||
|
||||
for (i = 1; i < ctypes && iret == UUCONF_SUCCESS; i++)
|
||||
{
|
||||
char ***ppz;
|
||||
int cfiles, ifile;
|
||||
|
||||
if (strncmp (pzargs[i], "systems=", sizeof "systems=" - 1)
|
||||
== 0)
|
||||
{
|
||||
ppz = &qglobal->qprocess->pzhdb_systems;
|
||||
pzargs[i] += sizeof "systems=" - 1;
|
||||
}
|
||||
else if (strncmp (pzargs[i], "devices=", sizeof "devices=" - 1)
|
||||
== 0)
|
||||
{
|
||||
ppz = &qglobal->qprocess->pzhdb_devices;
|
||||
pzargs[i] += sizeof "devices=" - 1;
|
||||
}
|
||||
else if (strncmp (pzargs[i], "dialers=", sizeof "dialers=" - 1)
|
||||
== 0)
|
||||
{
|
||||
ppz = &qglobal->qprocess->pzhdb_dialers;
|
||||
pzargs[i] += sizeof "dialers=" - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iret = UUCONF_SYNTAX_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
cfiles = _uuconf_istrsplit (pzargs[i], ':', &pzcolon, &ccolon);
|
||||
if (cfiles < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
for (ifile = 0;
|
||||
ifile < cfiles && iret == UUCONF_SUCCESS;
|
||||
ifile++)
|
||||
{
|
||||
/* Looking for a leading '/' is Unix dependent, and
|
||||
should probably be changed. */
|
||||
if (pzcolon[ifile][0] == '/')
|
||||
iret = _uuconf_iadd_string (qglobal, pzcolon[ifile], TRUE,
|
||||
FALSE, ppz, pblock);
|
||||
else
|
||||
{
|
||||
char *zdir;
|
||||
size_t clen;
|
||||
|
||||
clen = strlen (pzcolon[ifile]);
|
||||
zdir = (char *) uuconf_malloc (pblock,
|
||||
(sizeof OLDCONFIGLIB
|
||||
+ sizeof HDB_SEPARATOR
|
||||
+ clen
|
||||
- 1));
|
||||
if (zdir == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
memcpy ((pointer) zdir, (pointer) abHoldconfiglib,
|
||||
sizeof OLDCONFIGLIB - 1);
|
||||
memcpy ((pointer) (zdir + sizeof OLDCONFIGLIB - 1),
|
||||
HDB_SEPARATOR, sizeof HDB_SEPARATOR - 1);
|
||||
memcpy ((pointer) (zdir
|
||||
+ sizeof OLDCONFIGLIB - 1
|
||||
+ sizeof HDB_SEPARATOR - 1),
|
||||
(pointer) pzcolon[ifile], clen + 1);
|
||||
iret = _uuconf_iadd_string (qglobal, zdir, FALSE, FALSE,
|
||||
ppz, pblock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
if (pzargs != NULL)
|
||||
free ((pointer) pzargs);
|
||||
if (pzcolon != NULL)
|
||||
free ((pointer) pzcolon);
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
qglobal->zfilename = zsys;
|
||||
return iret | UUCONF_ERROR_FILENAME | UUCONF_ERROR_LINENO;
|
||||
}
|
||||
}
|
||||
|
||||
if (qglobal->qprocess->pzhdb_systems == NULL)
|
||||
{
|
||||
char ab[sizeof OLDCONFIGLIB + sizeof HDB_SYSTEMS - 1];
|
||||
|
||||
memcpy ((pointer) ab, (pointer) abHoldconfiglib,
|
||||
sizeof OLDCONFIGLIB - 1);
|
||||
memcpy ((pointer) (ab + sizeof OLDCONFIGLIB - 1),
|
||||
(pointer) HDB_SYSTEMS, sizeof HDB_SYSTEMS);
|
||||
iret = _uuconf_iadd_string (qglobal, ab, TRUE, FALSE,
|
||||
&qglobal->qprocess->pzhdb_systems,
|
||||
pblock);
|
||||
}
|
||||
if (qglobal->qprocess->pzhdb_devices == NULL && iret == UUCONF_SUCCESS)
|
||||
{
|
||||
char ab[sizeof OLDCONFIGLIB + sizeof HDB_DEVICES - 1];
|
||||
|
||||
memcpy ((pointer) ab, (pointer) abHoldconfiglib,
|
||||
sizeof OLDCONFIGLIB - 1);
|
||||
memcpy ((pointer) (ab + sizeof OLDCONFIGLIB - 1),
|
||||
(pointer) HDB_DEVICES, sizeof HDB_DEVICES);
|
||||
iret = _uuconf_iadd_string (qglobal, ab, TRUE, FALSE,
|
||||
&qglobal->qprocess->pzhdb_devices,
|
||||
pblock);
|
||||
}
|
||||
if (qglobal->qprocess->pzhdb_dialers == NULL && iret == UUCONF_SUCCESS)
|
||||
{
|
||||
char ab[sizeof OLDCONFIGLIB + sizeof HDB_DIALERS - 1];
|
||||
|
||||
memcpy ((pointer) ab, (pointer) abHoldconfiglib,
|
||||
sizeof OLDCONFIGLIB - 1);
|
||||
memcpy ((pointer) (ab + sizeof OLDCONFIGLIB - 1),
|
||||
(pointer) HDB_DIALERS, sizeof HDB_DIALERS);
|
||||
iret = _uuconf_iadd_string (qglobal, ab, TRUE, FALSE,
|
||||
&qglobal->qprocess->pzhdb_dialers,
|
||||
pblock);
|
||||
}
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/* hlocnm.c
|
||||
Get the local name to use from the HDB configuration files.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hlocnm_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Get the local name to use, based on the login name, from the HDB
|
||||
configuration files. */
|
||||
|
||||
int
|
||||
uuconf_hdb_login_localname (pglobal, zlogin, pzname)
|
||||
pointer pglobal;
|
||||
const char *zlogin;
|
||||
char **pzname;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
struct shpermissions *qperm;
|
||||
|
||||
if (! qglobal->qprocess->fhdb_read_permissions)
|
||||
{
|
||||
int iret;
|
||||
|
||||
iret = _uuconf_ihread_permissions (qglobal);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
for (qperm = qglobal->qprocess->qhdb_permissions;
|
||||
qperm != NULL;
|
||||
qperm = qperm->qnext)
|
||||
{
|
||||
if (qperm->zmyname != NULL
|
||||
&& qperm->zmyname != (char *) &_uuconf_unset
|
||||
&& qperm->pzlogname != NULL
|
||||
&& qperm->pzlogname != (char **) &_uuconf_unset)
|
||||
{
|
||||
char **pz;
|
||||
|
||||
for (pz = qperm->pzlogname; *pz != NULL; pz++)
|
||||
{
|
||||
if (strcmp (*pz, zlogin) == 0)
|
||||
{
|
||||
*pzname = strdup (qperm->zmyname);
|
||||
if (*pzname == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*pzname = NULL;
|
||||
return UUCONF_NOT_FOUND;
|
||||
}
|
@ -1,374 +0,0 @@
|
||||
/* hport.c
|
||||
Find a port in the HDB configuration files.
|
||||
|
||||
Copyright (C) 1992, 1993 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hport_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Find a port in the HDB configuration files by name, baud rate, and
|
||||
special purpose function. */
|
||||
|
||||
int
|
||||
uuconf_hdb_find_port (pglobal, zname, ibaud, ihighbaud, pifn, pinfo, qport)
|
||||
pointer pglobal;
|
||||
const char *zname;
|
||||
long ibaud;
|
||||
long ihighbaud;
|
||||
int (*pifn) P((struct uuconf_port *, pointer));
|
||||
pointer pinfo;
|
||||
struct uuconf_port *qport;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
char **pzsplit;
|
||||
size_t csplit;
|
||||
int iret;
|
||||
char **pz;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
pzsplit = NULL;
|
||||
csplit = 0;
|
||||
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
for (pz = qglobal->qprocess->pzhdb_devices; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
int cchars;
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
while ((cchars = _uuconf_getline (qglobal, &zline, &cline, e)) > 0)
|
||||
{
|
||||
int ctoks;
|
||||
char *z, *zprotos, *zport;
|
||||
long ilow, ihigh;
|
||||
pointer pblock;
|
||||
char ***ppzdialer;
|
||||
|
||||
++qglobal->ilineno;
|
||||
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
--cchars;
|
||||
if (zline[cchars] == '\n')
|
||||
zline[cchars] = '\0';
|
||||
if (isspace (BUCHAR (zline[0])) || zline[0] == '#')
|
||||
continue;
|
||||
|
||||
ctoks = _uuconf_istrsplit (zline, '\0', &pzsplit, &csplit);
|
||||
if (ctoks < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
/* An entry in Devices is
|
||||
|
||||
type device dial-device baud dialer-token pairs
|
||||
|
||||
The type (normally "ACU") is treated as the name. */
|
||||
|
||||
/* If there aren't enough entries, ignore the line; this
|
||||
should probably do something more useful. */
|
||||
if (ctoks < 4)
|
||||
continue;
|
||||
|
||||
/* There may be a comma separated list of protocols after
|
||||
the name. */
|
||||
zprotos = strchr (pzsplit[0], ',');
|
||||
if (zprotos != NULL)
|
||||
{
|
||||
*zprotos = '\0';
|
||||
++zprotos;
|
||||
}
|
||||
|
||||
zport = pzsplit[0];
|
||||
|
||||
/* Get any modem class, and pick up the baud rate while
|
||||
we're at it. The modem class will be appended to the
|
||||
name, so we need to get it before we see if we've found
|
||||
the port with the right name. */
|
||||
z = pzsplit[3];
|
||||
if (strcasecmp (z, "Any") == 0
|
||||
|| strcmp (z, "-") == 0)
|
||||
{
|
||||
ilow = 0L;
|
||||
ihigh = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *zend;
|
||||
|
||||
while (*z != '\0' && ! isdigit (BUCHAR (*z)))
|
||||
++z;
|
||||
|
||||
ilow = strtol (z, &zend, 10);
|
||||
if (*zend == '-')
|
||||
ihigh = strtol (zend + 1, (char **) NULL, 10);
|
||||
else
|
||||
ihigh = ilow;
|
||||
|
||||
if (z != pzsplit[3])
|
||||
{
|
||||
size_t cclass, cport;
|
||||
|
||||
cclass = z - pzsplit[3];
|
||||
cport = strlen (pzsplit[0]);
|
||||
zport = malloc (cport + cclass + 1);
|
||||
if (zport == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
memcpy ((pointer) zport, (pointer) pzsplit[0], cport);
|
||||
memcpy ((pointer) (zport + cport), (pointer) pzsplit[3],
|
||||
cclass);
|
||||
zport[cport + cclass] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure the name and baud rate match any argument. */
|
||||
if ((zname != NULL
|
||||
&& strcmp (zport, zname) != 0)
|
||||
|| (ibaud != 0
|
||||
&& ilow != 0
|
||||
&& (ilow > ibaud || ihigh < ibaud)))
|
||||
{
|
||||
if (zport != pzsplit[0])
|
||||
free ((pointer) zport);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Some systems permit ,M after the device name. This means
|
||||
to open the port with O_NDELAY and then change it. We
|
||||
just ignore this flag, although perhaps we should record
|
||||
it somewhere. */
|
||||
pzsplit[1][strcspn (pzsplit[1], ",")] = '\0';
|
||||
|
||||
/* Now we must construct the port information, so that we
|
||||
can pass it to pifn. The port type is determined by its
|
||||
name, unfortunately. The name "Direct" is used for a
|
||||
direct port, "TCP" for a TCP port, and anything else for
|
||||
a modem port. */
|
||||
pblock = NULL;
|
||||
_uuconf_uclear_port (qport);
|
||||
qport->uuconf_zname = zport;
|
||||
qport->uuconf_zprotocols = zprotos;
|
||||
if (strcmp (pzsplit[0], "Direct") == 0)
|
||||
{
|
||||
qport->uuconf_ttype = UUCONF_PORTTYPE_DIRECT;
|
||||
qport->uuconf_u.uuconf_sdirect.uuconf_zdevice = pzsplit[1];
|
||||
qport->uuconf_u.uuconf_sdirect.uuconf_ibaud = ilow;
|
||||
qport->uuconf_u.uuconf_sdirect.uuconf_fcarrier = FALSE;
|
||||
qport->uuconf_u.uuconf_sdirect.uuconf_fhardflow = TRUE;
|
||||
ppzdialer = NULL;
|
||||
}
|
||||
else if (strcmp (pzsplit[0], "TCP") == 0)
|
||||
{
|
||||
/* For a TCP port, the device name is taken as the TCP
|
||||
port to use. */
|
||||
qport->uuconf_ttype = UUCONF_PORTTYPE_TCP;
|
||||
qport->uuconf_ireliable
|
||||
= (UUCONF_RELIABLE_ENDTOEND | UUCONF_RELIABLE_RELIABLE
|
||||
| UUCONF_RELIABLE_EIGHT | UUCONF_RELIABLE_FULLDUPLEX
|
||||
| UUCONF_RELIABLE_SPECIFIED);
|
||||
qport->uuconf_u.uuconf_stcp.uuconf_zport = pzsplit[1];
|
||||
|
||||
/* I leave with IPv4 only for compatibility reason. If
|
||||
you wish to use IPv6, please try Taylor UUCP
|
||||
configuration instead. If you still wish to use IPv6
|
||||
with HDB configuration, re-make with INET6 defined.
|
||||
In this case, you cannot specify the protocol family
|
||||
in HDB configuration file. */
|
||||
#ifdef INET6
|
||||
qport->uuconf_u.uuconf_stcp.uuconf_zfamily = PF_UNSPEC;
|
||||
#else
|
||||
qport->uuconf_u.uuconf_stcp.uuconf_zfamily = PF_INET;
|
||||
#endif
|
||||
|
||||
ppzdialer = &qport->uuconf_u.uuconf_stcp.uuconf_pzdialer;
|
||||
}
|
||||
else if (ctoks >= 5
|
||||
&& (strcmp (pzsplit[4], "TLI") == 0
|
||||
|| strcmp (pzsplit[4], "TLIS") == 0))
|
||||
{
|
||||
qport->uuconf_ttype = UUCONF_PORTTYPE_TLI;
|
||||
qport->uuconf_u.uuconf_stli.uuconf_zdevice = pzsplit[1];
|
||||
qport->uuconf_u.uuconf_stli.uuconf_fstream
|
||||
= strcmp (pzsplit[4], "TLIS") == 0;
|
||||
qport->uuconf_u.uuconf_stli.uuconf_pzpush = NULL;
|
||||
qport->uuconf_u.uuconf_stli.uuconf_zservaddr = NULL;
|
||||
qport->uuconf_ireliable
|
||||
= (UUCONF_RELIABLE_ENDTOEND | UUCONF_RELIABLE_RELIABLE
|
||||
| UUCONF_RELIABLE_EIGHT | UUCONF_RELIABLE_FULLDUPLEX
|
||||
| UUCONF_RELIABLE_SPECIFIED);
|
||||
ppzdialer = &qport->uuconf_u.uuconf_stli.uuconf_pzdialer;
|
||||
}
|
||||
else
|
||||
{
|
||||
qport->uuconf_ttype = UUCONF_PORTTYPE_MODEM;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_zdevice = pzsplit[1];
|
||||
if (strcmp (pzsplit[2], "-") != 0)
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_zdial_device =
|
||||
pzsplit[2];
|
||||
else
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_zdial_device = NULL;
|
||||
if (ilow == ihigh)
|
||||
{
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_ibaud = ilow;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_ilowbaud = 0L;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_ibaud = 0L;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_ilowbaud = ilow;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_ihighbaud = ihigh;
|
||||
}
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_fcarrier = TRUE;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_fhardflow = TRUE;
|
||||
qport->uuconf_u.uuconf_smodem.uuconf_qdialer = NULL;
|
||||
ppzdialer = &qport->uuconf_u.uuconf_smodem.uuconf_pzdialer;
|
||||
}
|
||||
|
||||
if (ppzdialer != NULL)
|
||||
{
|
||||
if (ctoks < 5)
|
||||
*ppzdialer = NULL;
|
||||
else
|
||||
{
|
||||
size_t c;
|
||||
char **pzd;
|
||||
|
||||
pblock = uuconf_malloc_block ();
|
||||
if (pblock == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
c = (ctoks - 4) * sizeof (char *);
|
||||
pzd = (char **) uuconf_malloc (pblock, c + sizeof (char *));
|
||||
if (pzd == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
uuconf_free_block (pblock);
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
memcpy ((pointer) pzd, (pointer) (pzsplit + 4), c);
|
||||
pzd[ctoks - 4] = NULL;
|
||||
|
||||
*ppzdialer = pzd;
|
||||
}
|
||||
}
|
||||
|
||||
if (pifn != NULL)
|
||||
{
|
||||
iret = (*pifn) (qport, pinfo);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
if (zport != pzsplit[0])
|
||||
free ((pointer) zport);
|
||||
if (pblock != NULL)
|
||||
uuconf_free_block (pblock);
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* This is the port we want. */
|
||||
if (pblock == NULL)
|
||||
{
|
||||
pblock = uuconf_malloc_block ();
|
||||
if (pblock == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (uuconf_add_block (pblock, zline) != 0
|
||||
|| (zport != pzsplit[0]
|
||||
&& uuconf_add_block (pblock, zport) != 0))
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
uuconf_free_block (pblock);
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
zline = NULL;
|
||||
|
||||
qport->uuconf_palloc = pblock;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
break;
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
if (pzsplit != NULL)
|
||||
free ((pointer) pzsplit);
|
||||
|
||||
if (iret != UUCONF_SUCCESS && iret != UUCONF_NOT_FOUND)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
iret |= UUCONF_ERROR_FILENAME | UUCONF_ERROR_LINENO;
|
||||
}
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/* remunk.c
|
||||
Get the name of the HDB remote.unknown shell script.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hrmunk_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Get the name of the HDB remote.unknown shell script. */
|
||||
|
||||
int
|
||||
uuconf_hdb_remote_unknown (pglobal, pzname)
|
||||
pointer pglobal;
|
||||
char **pzname;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
size_t csize;
|
||||
|
||||
csize = sizeof OLDCONFIGLIB + sizeof HDB_REMOTE_UNKNOWN - 1;
|
||||
*pzname = malloc (csize);
|
||||
if (*pzname == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
memcpy (*pzname, OLDCONFIGLIB, sizeof OLDCONFIGLIB - 1);
|
||||
memcpy (*pzname + sizeof OLDCONFIGLIB - 1, HDB_REMOTE_UNKNOWN,
|
||||
sizeof HDB_REMOTE_UNKNOWN);
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,637 +0,0 @@
|
||||
/* hsinfo.c
|
||||
Get information about a system from the HDB configuration files.
|
||||
|
||||
Copyright (C) 1992, 1993, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hsinfo_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static int ihadd_machine_perm P((struct sglobal *qglobal,
|
||||
struct uuconf_system *qsys,
|
||||
struct shpermissions *qperm));
|
||||
static int ihadd_logname_perm P((struct sglobal *qglobal,
|
||||
struct uuconf_system *qsys,
|
||||
struct shpermissions *qperm));
|
||||
|
||||
/* Get the information for a particular system from the HDB
|
||||
configuration files. This does not make sure that all the default
|
||||
values are set. */
|
||||
|
||||
int
|
||||
_uuconf_ihdb_system_internal (qglobal, zsystem, qsys)
|
||||
struct sglobal *qglobal;
|
||||
const char *zsystem;
|
||||
struct uuconf_system *qsys;
|
||||
{
|
||||
int iret;
|
||||
struct shpermissions *qperm;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
char **pzsplit;
|
||||
size_t csplit;
|
||||
char **pzcomma;
|
||||
size_t ccomma;
|
||||
pointer pblock;
|
||||
char **pz;
|
||||
boolean ffound_machine, ffound_login;
|
||||
struct shpermissions *qother_machine;
|
||||
struct uuconf_system *qalt;
|
||||
|
||||
if (! qglobal->qprocess->fhdb_read_permissions)
|
||||
{
|
||||
iret = _uuconf_ihread_permissions (qglobal);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
/* First look through the Permissions information to see if this is
|
||||
an alias for some system. I assume that an alias applies to the
|
||||
first name in the corresponding MACHINE entry. */
|
||||
|
||||
for (qperm = qglobal->qprocess->qhdb_permissions;
|
||||
qperm != NULL;
|
||||
qperm = qperm->qnext)
|
||||
{
|
||||
if (qperm->pzalias == NULL
|
||||
|| qperm->pzmachine == NULL
|
||||
|| qperm->pzalias == (char **) &_uuconf_unset
|
||||
|| qperm->pzmachine == (char **) &_uuconf_unset)
|
||||
continue;
|
||||
|
||||
for (pz = qperm->pzalias; *pz != NULL; pz++)
|
||||
{
|
||||
if (strcmp (*pz, zsystem) == 0)
|
||||
{
|
||||
zsystem = qperm->pzmachine[0];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*pz != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
pzsplit = NULL;
|
||||
csplit = 0;
|
||||
pzcomma = NULL;
|
||||
ccomma = 0;
|
||||
|
||||
pblock = NULL;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
for (pz = qglobal->qprocess->pzhdb_systems; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
int cchars;
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
while ((cchars = _uuconf_getline (qglobal, &zline, &cline, e)) > 0)
|
||||
{
|
||||
int ctoks, ctimes, i;
|
||||
struct uuconf_system *qset;
|
||||
char *z, *zretry;
|
||||
int cretry;
|
||||
|
||||
++qglobal->ilineno;
|
||||
|
||||
--cchars;
|
||||
if (zline[cchars] == '\n')
|
||||
zline[cchars] = '\0';
|
||||
if (isspace (BUCHAR (zline[0])) || zline[0] == '#')
|
||||
continue;
|
||||
|
||||
ctoks = _uuconf_istrsplit (zline, '\0', &pzsplit, &csplit);
|
||||
if (ctoks < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If this isn't the system we're looking for, keep reading
|
||||
the file. */
|
||||
if (ctoks < 1
|
||||
|| strcmp (zsystem, pzsplit[0]) != 0)
|
||||
continue;
|
||||
|
||||
/* If this is the first time we've found the system, we want
|
||||
to set *qsys directly. Otherwise, we allocate a new
|
||||
alternate. */
|
||||
if (pblock == NULL)
|
||||
{
|
||||
pblock = uuconf_malloc_block ();
|
||||
if (pblock == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
_uuconf_uclear_system (qsys);
|
||||
qsys->uuconf_palloc = pblock;
|
||||
qset = qsys;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct uuconf_system **pq;
|
||||
|
||||
qset = ((struct uuconf_system *)
|
||||
uuconf_malloc (pblock, sizeof (struct uuconf_system)));
|
||||
if (qset == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
_uuconf_uclear_system (qset);
|
||||
for (pq = &qsys->uuconf_qalternate;
|
||||
*pq != NULL;
|
||||
pq = &(*pq)->uuconf_qalternate)
|
||||
;
|
||||
*pq = qset;
|
||||
}
|
||||
|
||||
/* Add this line to the memory block we are building for the
|
||||
system. */
|
||||
if (uuconf_add_block (pblock, zline) != 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
|
||||
/* The format of a line in Systems is
|
||||
system time device speed phone chat
|
||||
For example,
|
||||
airs Any ACU 9600 5551212 ogin: foo pass: bar
|
||||
*/
|
||||
|
||||
/* Get the system name. */
|
||||
|
||||
qset->uuconf_zname = pzsplit[0];
|
||||
qset->uuconf_fcall = TRUE;
|
||||
qset->uuconf_fcalled = FALSE;
|
||||
|
||||
if (ctoks < 2)
|
||||
continue;
|
||||
|
||||
/* A time string is "time/grade,time/grade;retry". A
|
||||
missing grade is taken as BGRADE_LOW. */
|
||||
zretry = strchr (pzsplit[1], ';');
|
||||
if (zretry == NULL)
|
||||
cretry = 0;
|
||||
else
|
||||
{
|
||||
*zretry = '\0';
|
||||
cretry = (int) strtol (zretry + 1, (char **) NULL, 10);
|
||||
}
|
||||
|
||||
ctimes = _uuconf_istrsplit (pzsplit[1], ',', &pzcomma, &ccomma);
|
||||
if (ctimes < 0)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < ctimes; i++)
|
||||
{
|
||||
char *zslash;
|
||||
char bgrade;
|
||||
|
||||
z = pzcomma[i];
|
||||
zslash = strchr (z, '/');
|
||||
if (zslash == NULL)
|
||||
bgrade = UUCONF_GRADE_LOW;
|
||||
else
|
||||
{
|
||||
*zslash = '\0';
|
||||
bgrade = zslash[1];
|
||||
if (! UUCONF_GRADE_LEGAL (bgrade))
|
||||
bgrade = UUCONF_GRADE_LOW;
|
||||
}
|
||||
|
||||
iret = _uuconf_itime_parse (qglobal, z, (long) bgrade,
|
||||
cretry, _uuconf_itime_grade_cmp,
|
||||
&qset->uuconf_qtimegrade,
|
||||
pblock);
|
||||
|
||||
/* We treat a syntax error in the time field as
|
||||
equivalent to ``never'', on the assumption that that
|
||||
is what HDB does. */
|
||||
if (iret == UUCONF_SYNTAX_ERROR)
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
break;
|
||||
|
||||
/* Treat any time/grade setting as both a timegrade and
|
||||
a call-timegrade. */
|
||||
if (bgrade != UUCONF_GRADE_LOW)
|
||||
qset->uuconf_qcalltimegrade = qset->uuconf_qtimegrade;
|
||||
}
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
break;
|
||||
|
||||
if (ctoks < 3)
|
||||
continue;
|
||||
|
||||
/* Pick up the device name. It can be followed by a comma
|
||||
and a list of protocols. */
|
||||
qset->uuconf_zport = pzsplit[2];
|
||||
z = strchr (pzsplit[2], ',');
|
||||
if (z != NULL)
|
||||
{
|
||||
qset->uuconf_zprotocols = z + 1;
|
||||
*z = '\0';
|
||||
}
|
||||
|
||||
if (ctoks < 4)
|
||||
continue;
|
||||
|
||||
/* The speed entry can be a numeric speed, or a range of
|
||||
speeds, or "Any", or "-". If it starts with a letter,
|
||||
the initial nonnumeric prefix is a modem class, which
|
||||
gets appended to the port name. */
|
||||
z = pzsplit[3];
|
||||
if (strcasecmp (z, "Any") != 0
|
||||
&& strcmp (z, "-") != 0)
|
||||
{
|
||||
char *zend;
|
||||
|
||||
while (*z != '\0' && ! isdigit (BUCHAR (*z)))
|
||||
++z;
|
||||
|
||||
qset->uuconf_ibaud = strtol (z, &zend, 10);
|
||||
if (*zend == '-')
|
||||
qset->uuconf_ihighbaud = strtol (zend + 1, (char **) NULL,
|
||||
10);
|
||||
|
||||
if (z != pzsplit[3])
|
||||
{
|
||||
size_t cport, cclass;
|
||||
|
||||
cport = strlen (pzsplit[2]);
|
||||
cclass = z - pzsplit[3];
|
||||
qset->uuconf_zport = uuconf_malloc (pblock,
|
||||
cport + cclass + 1);
|
||||
if (qset->uuconf_zport == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
memcpy ((pointer) qset->uuconf_zport, (pointer) pzsplit[2],
|
||||
cport);
|
||||
memcpy ((pointer) (qset->uuconf_zport + cport),
|
||||
(pointer) pzsplit[3], cclass);
|
||||
qset->uuconf_zport[cport + cclass] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (ctoks < 5)
|
||||
continue;
|
||||
|
||||
/* Get the phone number. */
|
||||
qset->uuconf_zphone = pzsplit[4];
|
||||
|
||||
if (ctoks < 6)
|
||||
continue;
|
||||
|
||||
/* Get the chat script. We just hand this off to the chat
|
||||
script processor, so that it will parse subsend and
|
||||
subexpect strings correctly. */
|
||||
pzsplit[4] = (char *) "chat";
|
||||
iret = _uuconf_ichat_cmd (qglobal, ctoks - 4, pzsplit + 4,
|
||||
&qset->uuconf_schat, pblock);
|
||||
iret &=~ UUCONF_CMDTABRET_KEEP;
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
if (pzsplit != NULL)
|
||||
free ((pointer) pzsplit);
|
||||
if (pzcomma != NULL)
|
||||
free ((pointer) pzcomma);
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
return iret | UUCONF_ERROR_FILENAME | UUCONF_ERROR_LINENO;
|
||||
}
|
||||
|
||||
if (pblock == NULL)
|
||||
return UUCONF_NOT_FOUND;
|
||||
|
||||
/* Now we have to put in the Permissions information. The relevant
|
||||
Permissions entries are those with this system in the MACHINE
|
||||
list and (if this system does not have a VALIDATE entry) those
|
||||
with a LOGNAME list but no MACHINE list. If no entry is found
|
||||
with this system in the MACHINE list, then we must look for an
|
||||
entry with "OTHER" in the MACHINE list. */
|
||||
ffound_machine = FALSE;
|
||||
ffound_login = FALSE;
|
||||
qother_machine = NULL;
|
||||
for (qperm = qglobal->qprocess->qhdb_permissions;
|
||||
qperm != NULL;
|
||||
qperm = qperm->qnext)
|
||||
{
|
||||
boolean fmachine;
|
||||
|
||||
/* MACHINE=OTHER is recognized specially. It appears that OTHER
|
||||
need only be recognized by itself, not when combined with
|
||||
other machine names. */
|
||||
if (qother_machine == NULL
|
||||
&& qperm->pzmachine != NULL
|
||||
&& qperm->pzmachine != (char **) &_uuconf_unset
|
||||
&& qperm->pzmachine[0][0] == 'O'
|
||||
&& strcmp (qperm->pzmachine[0], "OTHER") == 0)
|
||||
qother_machine = qperm;
|
||||
|
||||
/* If this system is named in a MACHINE entry, we must add the
|
||||
appropriate information to every alternate that could be used
|
||||
for calling out. */
|
||||
fmachine = FALSE;
|
||||
if (! ffound_machine
|
||||
&& qperm->pzmachine != NULL
|
||||
&& qperm->pzmachine != (char **) &_uuconf_unset)
|
||||
{
|
||||
for (pz = qperm->pzmachine; *pz != NULL; pz++)
|
||||
{
|
||||
if ((*pz)[0] == zsystem[0]
|
||||
&& strcmp (*pz, zsystem) == 0)
|
||||
{
|
||||
for (qalt = qsys;
|
||||
qalt != NULL;
|
||||
qalt = qalt->uuconf_qalternate)
|
||||
{
|
||||
if (qalt->uuconf_fcall)
|
||||
{
|
||||
iret = ihadd_machine_perm (qglobal, qalt, qperm);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
}
|
||||
|
||||
fmachine = TRUE;
|
||||
ffound_machine = TRUE;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* A LOGNAME line applies to this machine if it is listed in the
|
||||
corresponding VALIDATE entry, or if it is not listed in any
|
||||
VALIDATE entry. On this pass through the Permissions entry
|
||||
we pick up the information if the system appears in a
|
||||
VALIDATE entry; if it does not, we make another pass to put
|
||||
in all the LOGNAME lines. */
|
||||
if (qperm->pzlogname != NULL
|
||||
&& qperm->pzlogname != (char **) &_uuconf_unset
|
||||
&& qperm->pzvalidate != NULL
|
||||
&& qperm->pzvalidate != (char **) &_uuconf_unset)
|
||||
{
|
||||
for (pz = qperm->pzvalidate; *pz != NULL; ++pz)
|
||||
if ((*pz)[0] == zsystem[0]
|
||||
&& strcmp (*pz, zsystem) == 0)
|
||||
break;
|
||||
if (*pz != NULL)
|
||||
{
|
||||
for (pz = qperm->pzlogname; *pz != NULL; ++pz)
|
||||
{
|
||||
/* If this LOGNAME line is also a matching MACHINE
|
||||
line, we can add the LOGNAME permissions to the
|
||||
first alternate. Otherwise, we must create a new
|
||||
alternate. We cannot put a LOGNAME line in the
|
||||
first alternate if MACHINE does not match,
|
||||
because certain permissions (e.g. READ) may be
|
||||
specified by both types of lines, and we must use
|
||||
LOGNAME entries only when accepting calls and
|
||||
MACHINE entries only when placing calls. */
|
||||
if (fmachine
|
||||
&& (qsys->uuconf_zcalled_login == NULL
|
||||
|| (qsys->uuconf_zcalled_login
|
||||
== (char *) &_uuconf_unset)))
|
||||
{
|
||||
qsys->uuconf_zcalled_login = *pz;
|
||||
iret = ihadd_logname_perm (qglobal, qsys, qperm);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct uuconf_system *qnew;
|
||||
struct uuconf_system **pq;
|
||||
|
||||
qnew = ((struct uuconf_system *)
|
||||
uuconf_malloc (pblock,
|
||||
sizeof (struct uuconf_system)));
|
||||
if (qnew == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
*qnew = *qsys;
|
||||
qnew->uuconf_qalternate = NULL;
|
||||
for (pq = &qsys->uuconf_qalternate;
|
||||
*pq != NULL;
|
||||
pq = &(*pq)->uuconf_qalternate)
|
||||
;
|
||||
*pq = qnew;
|
||||
|
||||
qnew->uuconf_zcalled_login = *pz;
|
||||
qnew->uuconf_fcall = FALSE;
|
||||
iret = ihadd_logname_perm (qglobal, qnew, qperm);
|
||||
}
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
ffound_login = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we didn't find an entry for the machine, we must use the
|
||||
MACHINE=OTHER entry, if any. */
|
||||
if (! ffound_machine && qother_machine != NULL)
|
||||
{
|
||||
for (qalt = qsys; qalt != NULL; qalt = qalt->uuconf_qalternate)
|
||||
{
|
||||
if (qalt->uuconf_fcall)
|
||||
{
|
||||
iret = ihadd_machine_perm (qglobal, qalt, qother_machine);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If this system was not listed in any VALIDATE entry, then we must
|
||||
add a called-login for each LOGNAME entry in Permissions. */
|
||||
if (! ffound_login)
|
||||
{
|
||||
for (qperm = qglobal->qprocess->qhdb_permissions;
|
||||
qperm != NULL;
|
||||
qperm = qperm->qnext)
|
||||
{
|
||||
if (qperm->pzlogname == NULL
|
||||
|| qperm->pzlogname == (char **) &_uuconf_unset)
|
||||
continue;
|
||||
|
||||
for (pz = qperm->pzlogname; *pz != NULL; pz++)
|
||||
{
|
||||
struct uuconf_system *qnew;
|
||||
struct uuconf_system **pq;
|
||||
|
||||
qnew = ((struct uuconf_system *)
|
||||
uuconf_malloc (pblock,
|
||||
sizeof (struct uuconf_system)));
|
||||
if (qnew == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
*qnew = *qsys;
|
||||
qnew->uuconf_qalternate = NULL;
|
||||
for (pq = &qsys->uuconf_qalternate;
|
||||
*pq != NULL;
|
||||
pq = &(*pq)->uuconf_qalternate)
|
||||
;
|
||||
*pq = qnew;
|
||||
|
||||
/* We recognize LOGNAME=OTHER specially, although this
|
||||
appears to be an SCO innovation. */
|
||||
if (strcmp (*pz, "OTHER") == 0)
|
||||
qnew->uuconf_zcalled_login = (char *) "ANY";
|
||||
else
|
||||
qnew->uuconf_zcalled_login = *pz;
|
||||
qnew->uuconf_fcall = FALSE;
|
||||
iret = ihadd_logname_perm (qglobal, qnew, qperm);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* HDB permits local requests to receive to any directory, which is
|
||||
not the default put in by _uuconf_isystem_basic_default. We set
|
||||
it here instead. */
|
||||
for (qalt = qsys; qalt != NULL; qalt = qalt->uuconf_qalternate)
|
||||
{
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) ZROOTDIR,
|
||||
FALSE, FALSE,
|
||||
&qalt->uuconf_pzlocal_receive,
|
||||
pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
/* HDB does not have a maximum number of retries if a retry time is
|
||||
given in the time field. */
|
||||
if (qsys->uuconf_qtimegrade != NULL
|
||||
&& qsys->uuconf_qtimegrade != (struct uuconf_timespan *) &_uuconf_unset
|
||||
&& qsys->uuconf_qtimegrade->uuconf_cretry > 0)
|
||||
qsys->uuconf_cmax_retries = 0;
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
/* Add the settings of a MACHINE line in Permissions to a system. */
|
||||
|
||||
/*ARGSIGNORED*/
|
||||
static int
|
||||
ihadd_machine_perm (qglobal, qsys, qperm)
|
||||
struct sglobal *qglobal;
|
||||
struct uuconf_system *qsys;
|
||||
struct shpermissions *qperm;
|
||||
{
|
||||
if (qperm->frequest >= 0)
|
||||
qsys->uuconf_fsend_request = qperm->frequest;
|
||||
else
|
||||
qsys->uuconf_fsend_request = FALSE;
|
||||
qsys->uuconf_pzremote_send = qperm->pzread;
|
||||
qsys->uuconf_pzremote_receive = qperm->pzwrite;
|
||||
qsys->uuconf_pzcmds = qperm->pzcommands;
|
||||
qsys->uuconf_zlocalname = qperm->zmyname;
|
||||
qsys->uuconf_zpubdir = qperm->zpubdir;
|
||||
qsys->uuconf_pzalias = qperm->pzalias;
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
/* Add the settings of a LOGNAME line in Permissions to a system. */
|
||||
|
||||
/*ARGSIGNORED*/
|
||||
static int
|
||||
ihadd_logname_perm (qglobal, qsys, qperm)
|
||||
struct sglobal *qglobal;
|
||||
struct uuconf_system *qsys;
|
||||
struct shpermissions *qperm;
|
||||
{
|
||||
qsys->uuconf_fcalled = TRUE;
|
||||
if (qperm->frequest >= 0)
|
||||
qsys->uuconf_fsend_request = qperm->frequest;
|
||||
else
|
||||
qsys->uuconf_fsend_request = FALSE;
|
||||
qsys->uuconf_fcalled_transfer = qperm->fsendfiles;
|
||||
qsys->uuconf_pzremote_send = qperm->pzread;
|
||||
qsys->uuconf_pzremote_receive = qperm->pzwrite;
|
||||
qsys->uuconf_fcallback = qperm->fcallback;
|
||||
qsys->uuconf_zlocalname = qperm->zmyname;
|
||||
qsys->uuconf_zpubdir = qperm->zpubdir;
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/* hsnams.c
|
||||
Get all known system names from the HDB configuration files.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hsnams_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/* Get all the system names from the HDB Systems file. We have to
|
||||
read the Permissions file in order to support aliases. */
|
||||
|
||||
int
|
||||
uuconf_hdb_system_names (pglobal, ppzsystems, falias)
|
||||
pointer pglobal;
|
||||
char ***ppzsystems;
|
||||
int falias;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
char *zline;
|
||||
size_t cline;
|
||||
char **pz;
|
||||
|
||||
*ppzsystems = NULL;
|
||||
|
||||
iret = UUCONF_SUCCESS;
|
||||
|
||||
zline = NULL;
|
||||
cline = 0;
|
||||
|
||||
for (pz = qglobal->qprocess->pzhdb_systems; *pz != NULL; pz++)
|
||||
{
|
||||
FILE *e;
|
||||
|
||||
e = fopen (*pz, "r");
|
||||
if (e == NULL)
|
||||
{
|
||||
if (FNO_SUCH_FILE ())
|
||||
continue;
|
||||
qglobal->ierrno = errno;
|
||||
iret = UUCONF_FOPEN_FAILED | UUCONF_ERROR_ERRNO;
|
||||
break;
|
||||
}
|
||||
|
||||
qglobal->ilineno = 0;
|
||||
|
||||
while (_uuconf_getline (qglobal, &zline, &cline, e) > 0)
|
||||
{
|
||||
++qglobal->ilineno;
|
||||
|
||||
/* Lines beginning with whitespace are treated as comments.
|
||||
No system name can contain a '#', which is another
|
||||
comment character, so eliminating the first '#' does no
|
||||
harm and catches comments. */
|
||||
zline[strcspn (zline, " \t#\n")] = '\0';
|
||||
if (*zline == '\0')
|
||||
continue;
|
||||
|
||||
iret = _uuconf_iadd_string (qglobal, zline, TRUE, TRUE,
|
||||
ppzsystems, (pointer) NULL);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
iret |= UUCONF_ERROR_LINENO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
(void) fclose (e);
|
||||
}
|
||||
|
||||
if (zline != NULL)
|
||||
free ((pointer) zline);
|
||||
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
qglobal->zfilename = *pz;
|
||||
return iret | UUCONF_ERROR_FILENAME;
|
||||
}
|
||||
|
||||
/* If we are supposed to return aliases, we must read the
|
||||
Permissions file. */
|
||||
if (falias)
|
||||
{
|
||||
struct shpermissions *q;
|
||||
|
||||
if (! qglobal->qprocess->fhdb_read_permissions)
|
||||
{
|
||||
iret = _uuconf_ihread_permissions (qglobal);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
for (q = qglobal->qprocess->qhdb_permissions;
|
||||
q != NULL;
|
||||
q = q->qnext)
|
||||
{
|
||||
pz = q->pzalias;
|
||||
if (pz == NULL || pz == (char **) &_uuconf_unset)
|
||||
continue;
|
||||
|
||||
for (; *pz != NULL; pz++)
|
||||
{
|
||||
iret = _uuconf_iadd_string (qglobal, *pz, TRUE, TRUE,
|
||||
ppzsystems, (pointer) NULL);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*ppzsystems == NULL)
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
|
||||
ppzsystems, (pointer) NULL);
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/* hsys.c
|
||||
User function to get a system from the HDB configuration files.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hsys_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Get system information from the HDB configuration files. This is a
|
||||
wrapper for the internal function which makes sure that every field
|
||||
gets a default value. */
|
||||
|
||||
int
|
||||
uuconf_hdb_system_info (pglobal, zsystem, qsys)
|
||||
pointer pglobal;
|
||||
const char *zsystem;
|
||||
struct uuconf_system *qsys;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
|
||||
iret = _uuconf_ihdb_system_internal (qglobal, zsystem, qsys);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
return _uuconf_isystem_basic_default (qglobal, qsys);
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
/* hunk.c
|
||||
Get information about an unknown system from the HDB Permissions file.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_hunk_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Get information about an unknown system from the HDB Permissions
|
||||
file. This doesn't run the remote.unknown shell script, because
|
||||
that's too system dependent. */
|
||||
|
||||
int
|
||||
uuconf_hdb_system_unknown (pglobal, qsys)
|
||||
pointer pglobal;
|
||||
struct uuconf_system *qsys;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
boolean ffirst;
|
||||
struct shpermissions *qperm;
|
||||
struct uuconf_system *qalt;
|
||||
|
||||
if (! qglobal->qprocess->fhdb_read_permissions)
|
||||
{
|
||||
iret = _uuconf_ihread_permissions (qglobal);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
_uuconf_uclear_system (qsys);
|
||||
qsys->uuconf_palloc = uuconf_malloc_block ();
|
||||
if (qsys->uuconf_palloc == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
ffirst = TRUE;
|
||||
|
||||
for (qperm = qglobal->qprocess->qhdb_permissions;
|
||||
qperm != NULL;
|
||||
qperm = qperm->qnext)
|
||||
{
|
||||
char **pz;
|
||||
|
||||
if (qperm->pzlogname == NULL
|
||||
|| qperm->pzlogname == (char **) &_uuconf_unset)
|
||||
continue;
|
||||
|
||||
for (pz = qperm->pzlogname; *pz != NULL; pz++)
|
||||
{
|
||||
if (ffirst)
|
||||
{
|
||||
qalt = qsys;
|
||||
ffirst = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct uuconf_system **pq;
|
||||
|
||||
qalt = ((struct uuconf_system *)
|
||||
uuconf_malloc (qsys->uuconf_palloc,
|
||||
sizeof (struct uuconf_system)));
|
||||
if (qalt == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
_uuconf_uclear_system (qalt);
|
||||
for (pq = &qsys->uuconf_qalternate;
|
||||
*pq != NULL;
|
||||
pq = &(*pq)->uuconf_qalternate)
|
||||
;
|
||||
*pq = qalt;
|
||||
}
|
||||
|
||||
/* We recognize LOGNAME=OTHER specially, although this
|
||||
appears to be an SCO innovation. */
|
||||
if (strcmp (*pz, "OTHER") == 0)
|
||||
qalt->uuconf_zcalled_login = (char *) "ANY";
|
||||
else
|
||||
qalt->uuconf_zcalled_login = *pz;
|
||||
qalt->uuconf_fcall = FALSE;
|
||||
qsys->uuconf_fcalled = TRUE;
|
||||
if (qperm->frequest >= 0)
|
||||
qsys->uuconf_fsend_request = qperm->frequest;
|
||||
else
|
||||
qsys->uuconf_fsend_request = FALSE;
|
||||
qsys->uuconf_fcalled_transfer = qperm->fsendfiles;
|
||||
qsys->uuconf_pzremote_send = qperm->pzread;
|
||||
qsys->uuconf_pzremote_receive = qperm->pzwrite;
|
||||
qsys->uuconf_fcallback = qperm->fcallback;
|
||||
qsys->uuconf_zlocalname = qperm->zmyname;
|
||||
qsys->uuconf_zpubdir = qperm->zpubdir;
|
||||
}
|
||||
}
|
||||
|
||||
if (ffirst)
|
||||
return UUCONF_NOT_FOUND;
|
||||
|
||||
/* HDB permits local requests to receive to any directory, which is
|
||||
not the default put in by _uuconf_isystem_basic_default. We set
|
||||
it here instead. */
|
||||
for (qalt = qsys; qalt != NULL; qalt = qalt->uuconf_qalternate)
|
||||
{
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) ZROOTDIR,
|
||||
FALSE, FALSE,
|
||||
&qalt->uuconf_pzlocal_receive,
|
||||
qsys->uuconf_palloc);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
|
||||
return _uuconf_isystem_basic_default (qglobal, qsys);
|
||||
}
|
@ -1,180 +0,0 @@
|
||||
/* iniglb.c
|
||||
Initialize the global information structure.
|
||||
|
||||
Copyright (C) 1992, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_iniglb_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Initialize the global information structure. */
|
||||
|
||||
int
|
||||
_uuconf_iinit_global (pqglobal)
|
||||
struct sglobal **pqglobal;
|
||||
{
|
||||
pointer pblock;
|
||||
register struct sprocess *qprocess;
|
||||
char *azargs[3];
|
||||
int iret;
|
||||
|
||||
pblock = uuconf_malloc_block ();
|
||||
if (pblock == NULL)
|
||||
return UUCONF_MALLOC_FAILED;
|
||||
|
||||
*pqglobal = (struct sglobal *) uuconf_malloc (pblock,
|
||||
sizeof (struct sglobal));
|
||||
if (*pqglobal == NULL)
|
||||
{
|
||||
uuconf_free_block (pblock);
|
||||
return UUCONF_MALLOC_FAILED;
|
||||
}
|
||||
|
||||
(*pqglobal)->qprocess = ((struct sprocess *)
|
||||
uuconf_malloc (pblock,
|
||||
sizeof (struct sprocess)));
|
||||
if ((*pqglobal)->qprocess == NULL)
|
||||
{
|
||||
uuconf_free_block (pblock);
|
||||
*pqglobal = NULL;
|
||||
return UUCONF_MALLOC_FAILED;
|
||||
}
|
||||
|
||||
(*pqglobal)->pblock = pblock;
|
||||
(*pqglobal)->ierrno = 0;
|
||||
(*pqglobal)->ilineno = 0;
|
||||
(*pqglobal)->zfilename = NULL;
|
||||
|
||||
qprocess = (*pqglobal)->qprocess;
|
||||
|
||||
qprocess->zlocalname = NULL;
|
||||
qprocess->zspooldir = SPOOLDIR;
|
||||
qprocess->zpubdir = PUBDIR;
|
||||
#ifdef LOCKDIR
|
||||
qprocess->zlockdir = LOCKDIR;
|
||||
#else
|
||||
qprocess->zlockdir = SPOOLDIR;
|
||||
#endif
|
||||
qprocess->zlogfile = LOGFILE;
|
||||
qprocess->zstatsfile = STATFILE;
|
||||
qprocess->zdebugfile = DEBUGFILE;
|
||||
qprocess->zdebug = "";
|
||||
qprocess->fstrip_login = TRUE;
|
||||
qprocess->fstrip_proto = TRUE;
|
||||
qprocess->cmaxuuxqts = 0;
|
||||
qprocess->zrunuuxqt = NULL;
|
||||
qprocess->fv2 = TRUE;
|
||||
qprocess->fhdb = TRUE;
|
||||
qprocess->pzdialcodefiles = NULL;
|
||||
qprocess->pztimetables = NULL;
|
||||
qprocess->zconfigfile = NULL;
|
||||
qprocess->pzsysfiles = NULL;
|
||||
qprocess->pzportfiles = NULL;
|
||||
qprocess->pzdialfiles = NULL;
|
||||
qprocess->pzpwdfiles = NULL;
|
||||
qprocess->pzcallfiles = NULL;
|
||||
qprocess->qunknown = NULL;
|
||||
qprocess->fread_syslocs = FALSE;
|
||||
qprocess->qsyslocs = NULL;
|
||||
qprocess->qvalidate = NULL;
|
||||
qprocess->fuses_myname = FALSE;
|
||||
qprocess->zv2systems = NULL;
|
||||
qprocess->zv2devices = NULL;
|
||||
qprocess->zv2userfile = NULL;
|
||||
qprocess->zv2cmds = NULL;
|
||||
qprocess->pzhdb_systems = NULL;
|
||||
qprocess->pzhdb_devices = NULL;
|
||||
qprocess->pzhdb_dialers = NULL;
|
||||
qprocess->fhdb_read_permissions = FALSE;
|
||||
qprocess->qhdb_permissions = NULL;
|
||||
|
||||
azargs[0] = NULL;
|
||||
azargs[1] = (char *) "Evening";
|
||||
azargs[2] = (char *) "Wk1705-0755,Sa,Su";
|
||||
iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs,
|
||||
(pointer) NULL, (pointer) NULL);
|
||||
if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS)
|
||||
{
|
||||
azargs[1] = (char *) "Night";
|
||||
azargs[2] = (char *) "Wk2305-0755,Sa,Su2305-1655";
|
||||
iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs,
|
||||
(pointer) NULL, (pointer) NULL);
|
||||
}
|
||||
if (UUCONF_ERROR_VALUE (iret) == UUCONF_SUCCESS)
|
||||
{
|
||||
azargs[1] = (char *) "NonPeak";
|
||||
azargs[2] = (char *) "Wk1805-0655,Sa,Su";
|
||||
iret = _uuconf_itimetable ((pointer) *pqglobal, 3, azargs,
|
||||
(pointer) NULL, (pointer) NULL);
|
||||
}
|
||||
if (UUCONF_ERROR_VALUE (iret) != UUCONF_SUCCESS)
|
||||
{
|
||||
uuconf_free_block (pblock);
|
||||
*pqglobal = NULL;
|
||||
|
||||
/* Strip off any special bits, since there's no global
|
||||
structure. */
|
||||
return UUCONF_ERROR_VALUE (iret);
|
||||
}
|
||||
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
/* Add a timetable. This is also called by the Taylor UUCP
|
||||
initialization code, as well as by the Taylor UUCP sys file code
|
||||
(although the latter is obsolete). There's no point in putting
|
||||
this in a separate file, since everything must call
|
||||
_uuconf_init_global. There is a race condition here if this is
|
||||
called by two different threads on a sys file command, but the sys
|
||||
file command is obsolete anyhow. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
_uuconf_itimetable (pglobal, argc, argv, pvar, pinfo)
|
||||
pointer pglobal;
|
||||
int argc;
|
||||
char **argv;
|
||||
pointer pvar;
|
||||
pointer pinfo;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
|
||||
iret = _uuconf_iadd_string (qglobal, argv[1], FALSE, FALSE,
|
||||
&qglobal->qprocess->pztimetables,
|
||||
qglobal->pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
iret = _uuconf_iadd_string (qglobal, argv[2], FALSE, FALSE,
|
||||
&qglobal->qprocess->pztimetables,
|
||||
qglobal->pblock);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
return UUCONF_CMDTABRET_KEEP;
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
/* init.c
|
||||
Initialize for reading UUCP configuration files.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_init_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Initialize the UUCP configuration file reading routines. This is
|
||||
just a generic routine which calls the type specific routines. */
|
||||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
uuconf_init (ppglobal, zprogram, zname)
|
||||
pointer *ppglobal;
|
||||
const char *zprogram;
|
||||
const char *zname;
|
||||
{
|
||||
struct sglobal **pqglob = (struct sglobal **) ppglobal;
|
||||
int iret;
|
||||
|
||||
iret = UUCONF_NOT_FOUND;
|
||||
|
||||
*pqglob = NULL;
|
||||
|
||||
#if HAVE_TAYLOR_CONFIG
|
||||
iret = uuconf_taylor_init (ppglobal, zprogram, zname);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
#endif
|
||||
|
||||
#if HAVE_V2_CONFIG
|
||||
if (*pqglob == NULL || (*pqglob)->qprocess->fv2)
|
||||
{
|
||||
iret = uuconf_v2_init (ppglobal);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_HDB_CONFIG
|
||||
if (*pqglob == NULL || (*pqglob)->qprocess->fhdb)
|
||||
{
|
||||
iret = uuconf_hdb_init (ppglobal, zprogram);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
return iret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return iret;
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/* int.c
|
||||
Parse a string into an int or a long.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_int_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Parse a string into a variable. This is called by uuconf_cmd_args,
|
||||
as well as other functions. The parsing is done in a single place
|
||||
to make it easy to change. This should return an error code,
|
||||
including both UUCONF_CMDTABRET_KEEP and UUCONF_CMDTABRET_EXIT if
|
||||
appropriate. */
|
||||
|
||||
/*ARGSIGNORED*/
|
||||
int
|
||||
_uuconf_iint (qglobal, zval, p, fint)
|
||||
struct sglobal *qglobal;
|
||||
const char *zval;
|
||||
pointer p;
|
||||
boolean fint;
|
||||
{
|
||||
long i;
|
||||
char *zend;
|
||||
|
||||
i = strtol ((char *) zval, &zend, 10);
|
||||
if (*zend != '\0')
|
||||
return UUCONF_SYNTAX_ERROR | UUCONF_CMDTABRET_EXIT;
|
||||
|
||||
if (fint)
|
||||
*(int *) p = (int) i;
|
||||
else
|
||||
*(long *) p = i;
|
||||
|
||||
return UUCONF_CMDTABRET_CONTINUE;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/* lckdir.c
|
||||
Get the name of the UUCP lock directory.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_lckdir_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Get the name of the UUCP lock directory. */
|
||||
|
||||
int
|
||||
uuconf_lockdir (pglobal, pzlock)
|
||||
pointer pglobal;
|
||||
const char **pzlock;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
*pzlock = qglobal->qprocess->zlockdir;
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/* lineno.c
|
||||
Return the saved line number.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_lineno_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Return the saved line number. */
|
||||
|
||||
int
|
||||
uuconf_error_lineno (pglobal)
|
||||
pointer pglobal;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
if (qglobal == NULL)
|
||||
return 0;
|
||||
else
|
||||
return qglobal->ilineno;
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/* llocnm.c
|
||||
Get the local name to use, given a login name.
|
||||
|
||||
Copyright (C) 1992, 1993 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_llocnm_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Get the local name to use, given a login name. */
|
||||
|
||||
int
|
||||
uuconf_login_localname (pglobal, zlogin, pzname)
|
||||
pointer pglobal;
|
||||
const char *zlogin;
|
||||
char **pzname;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
|
||||
#if HAVE_TAYLOR_CONFIG
|
||||
iret = uuconf_taylor_login_localname (pglobal, zlogin, pzname);
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
return iret;
|
||||
#endif
|
||||
|
||||
#if HAVE_HDB_CONFIG
|
||||
if (qglobal->qprocess->fhdb)
|
||||
{
|
||||
iret = uuconf_hdb_login_localname (pglobal, zlogin, pzname);
|
||||
if (iret != UUCONF_NOT_FOUND)
|
||||
return iret;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (qglobal->qprocess->zlocalname != NULL)
|
||||
{
|
||||
*pzname = strdup ((char *) qglobal->qprocess->zlocalname);
|
||||
if (*pzname == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
return UUCONF_SUCCESS;
|
||||
}
|
||||
|
||||
*pzname = NULL;
|
||||
return UUCONF_NOT_FOUND;
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
/* local.c
|
||||
Get default information for the local system.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_local_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
/* Get default information about the local system. */
|
||||
|
||||
int
|
||||
uuconf_system_local (pglobal, qsys)
|
||||
pointer pglobal;
|
||||
struct uuconf_system *qsys;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
int iret;
|
||||
|
||||
_uuconf_uclear_system (qsys);
|
||||
qsys->uuconf_palloc = uuconf_malloc_block ();
|
||||
if (qsys->uuconf_palloc == NULL)
|
||||
{
|
||||
qglobal->ierrno = errno;
|
||||
return UUCONF_MALLOC_FAILED | UUCONF_ERROR_ERRNO;
|
||||
}
|
||||
|
||||
qsys->uuconf_zname = (char *) qglobal->qprocess->zlocalname;
|
||||
|
||||
/* By default, we permit the local system to forward to and from any
|
||||
system. */
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) "ANY", FALSE, FALSE,
|
||||
&qsys->uuconf_pzforward_from,
|
||||
qsys->uuconf_palloc);
|
||||
if (iret == UUCONF_SUCCESS)
|
||||
iret = _uuconf_iadd_string (qglobal, (char *) "ANY", FALSE, FALSE,
|
||||
&qsys->uuconf_pzforward_to,
|
||||
qsys->uuconf_palloc);
|
||||
if (iret != UUCONF_SUCCESS)
|
||||
{
|
||||
uuconf_free_block (qsys->uuconf_palloc);
|
||||
return iret;
|
||||
}
|
||||
|
||||
return _uuconf_isystem_basic_default (qglobal, qsys);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* locnm.c
|
||||
Get the local node name.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author of the program may be contacted at ian@airs.com or
|
||||
c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
|
||||
*/
|
||||
|
||||
#include "uucnfi.h"
|
||||
|
||||
#if USE_RCS_ID
|
||||
const char _uuconf_locnm_rcsid[] = "$FreeBSD$";
|
||||
#endif
|
||||
|
||||
/* Get the local node name. */
|
||||
|
||||
int
|
||||
uuconf_localname (pglobal, pzname)
|
||||
pointer pglobal;
|
||||
const char **pzname;
|
||||
{
|
||||
struct sglobal *qglobal = (struct sglobal *) pglobal;
|
||||
|
||||
*pzname = qglobal->qprocess->zlocalname;
|
||||
if (*pzname != NULL)
|
||||
return UUCONF_SUCCESS;
|
||||
else
|
||||
return UUCONF_NOT_FOUND;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user