initial commit from tarball retrieved from the Internet Archive:

https://web.archive.org/web/20021127142540/http://www.lprng.com/DISTRIB/UNIXTOOLS/lp_server/lp_server-1.1.6.tgz
This commit is contained in:
2023-06-28 22:10:24 -07:00
commit 69d6b16e47
27 changed files with 12745 additions and 0 deletions

14
CHANGES Normal file
View File

@@ -0,0 +1,14 @@
Version 1.1.6 Mon Sep 17 16:52:46 PDT 2001
- fixed up nonblocking open, changed to blocking
read/write after open.
- fixed up the SO_REUSE
- fixed make files for Gmake and FreeBSD Make
Version 1.1.3 Sun Mar 29 16:55:23 PST 1998
Makefile modified for BSD compatibility
Fixed configure.in
Version 1.1.2
Bug Fixes:
Minor fumbling with IO, using select()
(Patches by: Chris O'Regan" <chris@ece.concordia.ca>)

339
COPYING Normal file
View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: 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.

23
Copyright Normal file
View File

@@ -0,0 +1,23 @@
***************************************************************************
* LPRng - An Extended Print Spooler System
*
* Copyright 1988-1997 Patrick Powell, San Diego, CA
* papowell@sdsu.edu
* See LICENSE for conditions of use.
*
***************************************************************************
* MODULE: LICENSE
* PURPOSE: terms and conditions
* Copyright,v 1.1 1997/05/30 18:53:30 papowell Exp
**************************************************************************
Use and distribution of this software is covered by the GNU COPYING
license. Please refer to this for terms and conditions.
This software incorporates code from other sources; see the file
Copyright.c in this distribution for general copyright information.
Individual source files have their copyrights as well, where
applicable.
Patrick Powell
Mon Jul 10 07:01:54 PDT 1995

170
INSTALL Normal file
View File

@@ -0,0 +1,170 @@
LPRng Installation
(Based on the AUTOCONF configuration facility)
=============================================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. In the same directory as these instructions, execute
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package. This will create the executables
in the source directory.
3. Change to the TESTINSTALL directory and run make again. This will
up a test version of the software.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source directory by typing `make clean'. To also remove the files
that `configure' created (so you can compile the package for a
different kind of computer), type `make distclean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Using a Different Build Directory
=================================
You can compile the package in a different directory from the one
containing the source code. Doing so allows you to compile it on more
than one kind of computer at the same time. To do this, you must use a
version of `make' that supports the `VPATH' variable, such as GNU
`make'. `cd' to the directory where you want the object files and
executables to go and run the `configure' script. `configure'
automatically checks for the source code in the directory that
`configure' is in and in `..'.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Save the results of the tests in FILE instead of `config.cache'.
Set FILE to `/dev/null' to disable caching, for debugging
`configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

24
LICENSE Normal file
View File

@@ -0,0 +1,24 @@
***************************************************************************
* LPRng - An Extended Print Spooler System
*
* Copyright 1988-1995 Patrick Powell, San Diego State University
* papowell@sdsu.edu
* See LICENSE for conditions of use.
*
***************************************************************************
* MODULE: LICENSE
* PURPOSE: terms and conditions
* LICENSE,v 1.1 1997/05/30 18:53:30 papowell Exp
**************************************************************************
Use and distribution of this software is covered by the GNU COPYING
license. Please refer to this for terms and conditions.
This software incorporates code from other sources; see the file
copyright.c in this distribution for general copyright information.
Individual source files have their copyrights as well, where
applicable.
Patrick Powell
Mon Jul 10 07:01:54 PDT 1995

152
Makefile.in Normal file
View File

@@ -0,0 +1,152 @@
###########################################################################
# LPRng - An Extended Print Spooler System
#
# Copyright 1988-1995 Patrick Powell, San Diego State University
# papowell@sdsu.edu
# See LICENSE for conditions of use.
#
###########################################################################
# MODULE: Makefile.in
# PURPOSE: top level Makefile for LPD Software
# $Id: Makefile.in,v 1.4 1998/03/30 00:05:05 papowell Exp papowell $
##########################################################################
SRC=@srcdir@
@SET_MAKE@
#=============================================================================
# List the directories you want to generate:
# DIRS for all, clean, etc.
# ALLDIRS for other such as documentation
#=============================================================================
DIRS= src man
ALLDIRS= $(DIRS)
TARGET=monitor ifhp
# define default target
MAKETARGET=all
all: $(DIRS)
.PHONY: all clean install tar ci cifiles DIRS $(ALLDIRS) warn
#force phony target to be made
$(ALLDIRS):
cd $@; $(MAKE) $(MAKETARGET)
###############################################################################
install:
$(MAKE) MAKETARGET=$@ $(DIRS)
###############################################################################
ci: cifiles
if test ! -d RCS ; then mkdir RCS; fi;
$(MAKE) MAKETARGET=$@ $(ALLDIRS)
CI=
CO=-kv
cifiles: newmake
if test ! -d RCS ; then mkdir RCS; fi;
checkin() { \
rcs -l $$1 ; \
ci $(CI) -mUpdate -t-Initial $$1; \
co $(CO) $$1; \
}; \
for i in *; do \
if test -f "$$i" ; then \
case "$$i" in \
config.h.in ) checkin $$i;; \
config.* ) ;; \
* ) checkin $$i ;; \
esac; \
fi; \
done;
newmake:
for i in Makefile.in */Makefile.in ; do \
d=`dirname $$i`; b=`basename $$i .in`; c=$${d}/$${b}.bsd.in; \
sed -e '/^#GNU/,/^#/d' -e 's/^#BSD.//' -e 's/$$^/$$>/' \
-e 's/^if /.if /' -e 's/^endif/.endif/' $$i >/tmp/Makefile.bsd.in; \
rm -f $$c; cp /tmp/Makefile.bsd.in $$c;\
done
###############################################################################
clean:
-rm -f *.o core $(TARGET)
$(MAKE) MAKETARGET=$@ $(DIRS)
realclean distclean: clean
$(MAKE) MAKETARGET=distclean $(DIRS)
-rm -f Makefile Makefile.bsd \
config.cache config.h config.log config.status
###############################################################################
shar:
DIR=`pwd | sed 's,.*/,,' `; \
if [ ! -f /tmp/$${DIR}.tgz ]; then \
echo You must make TAR file first; \
exit 1; \
fi; \
cd ..; tar ztf /tmp/$${DIR}.tgz | sed -e '/\/$$/d' | \
shar -S -n $${DIR} -a -s papowell@sdsu.edu \
-c -o /tmp/$${DIR}-Part -L100
dist: clean
echo RCS >/tmp/L_X
echo Makefile >>/tmp/L_X
echo Makefile.bsd >>/tmp/L_X
echo core >>/tmp/L_X
echo '?' >>/tmp/L_X
echo '*.o' >>/tmp/L_X
echo '*.a' >>/tmp/L_X
echo '*.sh' >>/tmp/L_X
for i in $(TARGET) Makefile config.cache config.h config.log config.status; \
do echo \*/$$i >>/tmp/L_X; done
cat /tmp/L_X
DIR=`pwd | sed 's,.*/,,' `; \
cd ..; \
tar zXcfv /tmp/L_X $${DIR}.tgz $${DIR}; \
md5 $${DIR}.tgz |pgp -fast > $$DIR.tgz.md5
cifast:
find . -type f -newer VERSION -print \
| sed \
-e '/core$$/d' \
-e '/RCS/d' \
-e '/\.o$$/d' \
-e '/.*liblpr.a$$/d' \
-e '/.*checkpc$$/d' \
-e '/.*lpr$$/d' \
-e '/.*lpd$$/d' \
-e '/.*lpq$$/d' \
-e '/.*lprm$$/d' \
-e '/.*lpc$$/d' \
-e '/.*lpbanner$$/d' \
-e '/.*lpf$$/d' \
-e '/.*lpraccnt$$/d' \
>/tmp/list
echo README >>/tmp/list
cat /tmp/list
checkin() { \
rcs -l $$1 ; \
ci $(CI) -mUpdate -t-Initial $$1; \
co $(CO) $$1; \
}; \
for i in ` cat /tmp/list `; do \
checkin $$i; \
done;
update:
for i in src/version.h VERSION; do \
chmod +w $$i; \
done;
pwd | sed -n -e 's,.*/,,' -e 's,.*,#define VERSION "&",p' > src/version.h
pwd | sed -n -e 's,.*/,,' -e 's,.*,VERSION &,p' > VERSION
(cd man; $(MAKE) update)

16
README Normal file
View File

@@ -0,0 +1,16 @@
README for lp_server
===================
Fri May 30 09:40:17 PDT 1997
This program allows you to 'export' a printer on your local host
to be used by an LPRng spooler. It is basically simulating an
HP JetDirect interface, which opens a connection on port 9100
and simply dumps input to the PostScript Engine.
lp_server [-n port] [-t stty_options] [-d device]
-n port - listen (bind) to this port for incoming connections
-d device - the device to open
-t stty_options - a list of stty options, similar (i.e.- identical)
to those used by other filters supplied with LPRng.

10
UPDATE Normal file
View File

@@ -0,0 +1,10 @@
#!/bin/sh
DIR=`pwd | sed -e 's,.*/,,'`
PREFIX=`echo $DIR | sed -e 's,-.*,,'`
TAIL=`echo $DIR | sed -e 's,^[^-]*-,,'`
LAST=`echo $TAIL | sed -e 's,^.*\.,,'`
BEFORE=`echo $TAIL | sed -e 's,\.[0-9]*$,.,'`
INCR=`expr $LAST "+" 1`
NEW=$PREFIX-$BEFORE$INCR
cd ..; mv $DIR $NEW; rm -f $PREFIX;
ln -s $NEW $PREFIX

1
VERSION Normal file
View File

@@ -0,0 +1 @@
VERSION lp_server-1.1.6

359
acconfig.h Normal file
View File

@@ -0,0 +1,359 @@
/* acconfig.h
This file is in the public domain.
Descriptive text for the C preprocessor macros that
the distributed Autoconf macros can define.
No software package will use all of them; autoheader copies the ones
your configure.in uses into your configuration header file templates.
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). Although this order
can split up related entries, it makes it easier to check whether
a given entry is in the file.
Leave the following blank line there!! Autoheader needs it. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if using ARCHITECTURE */
#undef ARCHITECTURE
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define if type char is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#undef __CHAR_UNSIGNED__
#endif
/* Define if the closedir function returns void instead of int. */
#undef CLOSEDIR_VOID
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define for DGUX with <sys/dg_sys_info.h>. */
#undef DGUX
/* Define if you have <dirent.h>. */
#undef DIRENT
/* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */
#undef GETGROUPS_T
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
#undef GETLOADAVG_PRIVILEGED
/* Define if the `getpgrp' function takes no argument. */
#undef GETPGRP_VOID
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you have a broken TIOCEXCL (IRIX 5) */
#undef HAVE_BROKEN_TIOCEXCL
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if <errno.h> contains a declaration for extern int errno */
#undef HAVE_ERRNO_DECL
/* Define if you do not have gethostname() defined */
#undef HAVE_GETHOSTNAME_DEF
/* Define if your system has its own `getloadavg' function. */
#undef HAVE_GETLOADAVG
/* Define if you have the getmntent function. */
#undef HAVE_GETMNTENT
/* Define if you have to use getpgrp(0) to get process group */
#undef HAVE_GETPGRP_0
/* Define if you have innetgr() defined in include file */
#undef HAVE_INNETGR_DEF
/* Define if the `long double' type works. */
#undef HAVE_LONG_DOUBLE
/* Define if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if you have a openlog prototype. */
#undef HAVE_OPENLOG_DEF
/* Define if system calls automatically restart after interruption
by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS
/* Define if you have to use setpgrp(0,0) to set process group */
#undef HAVE_SETPGRP_0
/* Define if you do have setproctitle() defined */
#undef HAVE_SETPROCTITLE_DEF
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS
/* Define if you have the strcoll function and it is properly defined. */
#undef HAVE_STRCOLL
/* Define if your struct stat has st_rdev. */
#undef HAVE_ST_RDEV
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
/* Define if we have a BSD-ish struct exec in <a.out.h> */
#undef HAVE_STRUCT_EXEC
/* Define if sys_errlist has the error strings. */
#undef HAVE_SYS_ERRLIST
/* Define if sys_errlist is defined. */
#undef HAVE_SYS_ERRLIST_DEF
/* Define if sys_nerr has number of err strings. */
#undef HAVE_SYS_NERR
/* Define if sys_nerr has definition. */
#undef HAVE_SYS_NERR_DEF
/* Define if sys_siglist has the signal strings. */
#undef HAVE_SYS_SIGLIST
/* Define if _sys_siglist has the signal strings. */
#undef HAVE__SYS_SIGLIST
/* Define if sys_siglist is defined in unistd.h include file */
#undef HAVE_SYS_SIGLIST_DEF
/* Define if sys_siglist has the signal strings. */
#undef HAVE__SYS_SIGLIST_DEF
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if tgetstr() has definition */
#undef HAVE_TGETSTR_DEF
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Use the "union wait" union to get process status from wait3/waitpid */
#undef HAVE_UNION_WAIT
/* Define if you have <unistd.h>. */
#undef HAVE_UNISTD_H
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the wait3 system call. */
#undef HAVE_WAIT3
/* HP/UX */
#undef HPUX
/* HP/UX source */
#undef _HPUX_SOURCE
/* Define if the struct in6_addr is defined */
#undef IN6_ADDR
/* Define if the LINUX struct in_addr6 is defined */
#undef IN_ADDR6
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if int is 16 bits instead of 32. */
#undef INT_16_BITS
/* Define if long int is 64 bits. */
#undef LONG_64_BITS
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
#undef MAJOR_IN_MKDEV
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define if you don't have <dirent.h>, but have <ndir.h>. */
#undef NDIR
/* Define if you have <memory.h>, and <string.h> doesn't declare the
mem* functions. */
#undef NEED_MEMORY_H
/* Define if your struct nlist has an n_un member. */
#undef NLIST_NAME_UNION
/* Define if you have <nlist.h>. */
#undef NLIST_STRUCT
/* Define if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
#undef SETVBUF_REVERSED
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define on SUN Solaris */
#undef SOLARIS
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have struct stat with st_mtime_nsec */
#undef ST_MTIME_NSEC
/* Define on SunOS */
#undef SUNOS
/* Define on System V Release 4. */
#undef SVR4
/* Define if you don't have <dirent.h>, but have <sys/dir.h>. */
#undef SYSDIR
/* Define if you don't have <dirent.h>, but have <sys/ndir.h>. */
#undef SYSNDIR
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define for Encore UMAX. */
#undef UMAX
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>. */
#undef UMAX4_3
/* Define if we are to use the old sgttyb structure and <sgtty.h>. */
#undef USE_SGTTYB
/* Use the statfs structure to find out free space */
#undef USE_STATFS
/* Define how to get file system space */
#undef USE_STATFS_TYPE
/* Use the statvfs structure to find out free space */
#undef USE_STATVFS
/* Define how to change serial line */
#undef USE_STTY
/* Use the statfs() func with f_bfree member to find out free space */
#undef USE_SVR3_STATFS
/* Define if we are to use the termio structure and TCGETA. */
#undef USE_TERMIO
/* Define if we are to use the termios structure and TCGETS. */
#undef USE_TERMIOS
/* Use the statfs() func with fs_data member to find out free space */
#undef USE_ULTRIX_STATFS
/* Define if you do not have <strings.h>, index, bzero, etc.. */
#undef USG
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if the closedir function returns void instead of int. */
#undef VOID_CLOSEDIR
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define if lex declares yytext as a char * by default, not a char[]. */
#undef YYTEXT_POINTER
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). */

693
config.guess vendored Executable file
View File

@@ -0,0 +1,693 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
#
# This file 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.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:*:*)
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-cbm-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
NILE:*:*:dcosx)
echo pyramid-pyramid-svr4
exit 0 ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-atari-openbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-sun-openbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-apple-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
${CC-cc} dummy.c -o dummy \
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i?86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit 0 ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit 0 ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit 0 ;;
9000/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo unknown-hitachi-hiuxwe2
exit 0 ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
i?86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp3[0-9][05]:OpenBSD:*:*)
echo m68k-hp-openbsd${UNAME_RELEASE}
exit 0 ;;
i?86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-pc-cygwin32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
echo "powerpc-unknown-linux-gnu" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
echo alpha-unknown-linux-gnu ; exit 0
elif test "${UNAME_MACHINE}" = "sparc" ; then
echo sparc-unknown-linux-gnu ; exit 0
else
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
test ! -d /usr/lib/ldscripts/. \
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-pc-linux-gnu\n", argv[1]);
#else
printf ("%s-pc-linux-gnuaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i?86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi
exit 0 ;;
i?86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit 0 ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit 0 ;;
M68*:*:R3V[567]*:*)
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3${OS_REL} && exit 0
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i?86:LynxOS:2.*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit 0 ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
cat >dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1

570
config.h.in Normal file
View File

@@ -0,0 +1,570 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define on System V Release 4. */
#undef SVR4
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if using ARCHITECTURE */
#undef ARCHITECTURE
/* Define to empty if the keyword does not work. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have a broken TIOCEXCL (IRIX 5) */
#undef HAVE_BROKEN_TIOCEXCL
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if <errno.h> contains a declaration for extern int errno */
#undef HAVE_ERRNO_DECL
/* Define if you do not have gethostname() defined */
#undef HAVE_GETHOSTNAME_DEF
/* Define if you have to use getpgrp(0) to get process group */
#undef HAVE_GETPGRP_0
/* Define if you have innetgr() defined in include file */
#undef HAVE_INNETGR_DEF
/* Define if you have a openlog prototype. */
#undef HAVE_OPENLOG_DEF
/* Define if you have to use setpgrp(0,0) to set process group */
#undef HAVE_SETPGRP_0
/* Define if you do have setproctitle() defined */
#undef HAVE_SETPROCTITLE_DEF
/* Define if we have a BSD-ish struct exec in <a.out.h> */
#undef HAVE_STRUCT_EXEC
/* Define if sys_errlist has the error strings. */
#undef HAVE_SYS_ERRLIST
/* Define if sys_errlist is defined. */
#undef HAVE_SYS_ERRLIST_DEF
/* Define if sys_nerr has number of err strings. */
#undef HAVE_SYS_NERR
/* Define if sys_nerr has definition. */
#undef HAVE_SYS_NERR_DEF
/* Define if sys_siglist has the signal strings. */
#undef HAVE_SYS_SIGLIST
/* Define if sys_siglist is defined in unistd.h include file */
#undef HAVE_SYS_SIGLIST_DEF
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if tgetstr() has definition */
#undef HAVE_TGETSTR_DEF
/* Use the "union wait" union to get process status from wait3/waitpid */
#undef HAVE_UNION_WAIT
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* HP/UX */
#undef HPUX
/* HP/UX source */
#undef _HPUX_SOURCE
/* Define if the struct in6_addr is defined */
#undef IN6_ADDR
/* Define if the LINUX struct in_addr6 is defined */
#undef IN_ADDR6
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define on SUN Solaris */
#undef SOLARIS
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have struct stat with st_mtime_nsec */
#undef ST_MTIME_NSEC
/* Define on SunOS */
#undef SUNOS
/* Define on System V Release 4. */
#undef SVR4
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define if we are to use the old sgttyb structure and <sgtty.h>. */
#undef USE_SGTTYB
/* Define how to get file system space */
#undef USE_STATFS_TYPE
/* Define how to change serial line */
#undef USE_STTY
/* Define if we are to use the termio structure and TCGETA. */
#undef USE_TERMIO
/* Define if we are to use the termios structure and TCGETS. */
#undef USE_TERMIOS
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if you have the cfsetispeed function. */
#undef HAVE_CFSETISPEED
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
/* Define if you have the flock function. */
#undef HAVE_FLOCK
/* Define if you have the getdtablesize function. */
#undef HAVE_GETDTABLESIZE
/* Define if you have the gethostbyname2 function. */
#undef HAVE_GETHOSTBYNAME2
/* Define if you have the gethostname function. */
#undef HAVE_GETHOSTNAME
/* Define if you have the getrlimit function. */
#undef HAVE_GETRLIMIT
/* Define if you have the inet_aton function. */
#undef HAVE_INET_ATON
/* Define if you have the inet_ntop function. */
#undef HAVE_INET_NTOP
/* Define if you have the inet_pton function. */
#undef HAVE_INET_PTON
/* Define if you have the innetgr function. */
#undef HAVE_INNETGR
/* Define if you have the killpg function. */
#undef HAVE_KILLPG
/* Define if you have the lockf function. */
#undef HAVE_LOCKF
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
/* Define if you have the mktemp function. */
#undef HAVE_MKTEMP
/* Define if you have the openlog function. */
#undef HAVE_OPENLOG
/* Define if you have the seteuid function. */
#undef HAVE_SETEUID
/* Define if you have the setpgid function. */
#undef HAVE_SETPGID
/* Define if you have the setproctitle function. */
#undef HAVE_SETPROCTITLE
/* Define if you have the setresuid function. */
#undef HAVE_SETRESUID
/* Define if you have the setreuid function. */
#undef HAVE_SETREUID
/* Define if you have the setsid function. */
#undef HAVE_SETSID
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the sigprocmask function. */
#undef HAVE_SIGPROCMASK
/* Define if you have the sigsetjmp function. */
#undef HAVE_SIGSETJMP
/* Define if you have the socketpair function. */
#undef HAVE_SOCKETPAIR
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strncasecmp function. */
#undef HAVE_STRNCASECMP
/* Define if you have the sysinfo function. */
#undef HAVE_SYSINFO
/* Define if you have the tcflush function. */
#undef HAVE_TCFLUSH
/* Define if you have the tcsetattr function. */
#undef HAVE_TCSETATTR
/* Define if you have the uname function. */
#undef HAVE_UNAME
/* Define if you have the wait3 function. */
#undef HAVE_WAIT3
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
/* Define if you have the <a.out.h> header file. */
#undef HAVE_A_OUT_H
/* Define if you have the <a_out.h> header file. */
#undef HAVE_A_OUT_H
/* Define if you have the <aouthdr.h> header file. */
#undef HAVE_AOUTHDR_H
/* Define if you have the <ar.h> header file. */
#undef HAVE_AR_H
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define if you have the <arpa/nameser.h> header file. */
#undef HAVE_ARPA_NAMESER_H
/* Define if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
/* Define if you have the <com_err.h> header file. */
#undef HAVE_COM_ERR_H
/* Define if you have the <compat.h> header file. */
#undef HAVE_COMPAT_H
/* Define if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define if you have the <curses.h> header file. */
#undef HAVE_CURSES_H
/* Define if you have the <dirent.h> header file. */
#undef HAVE_DIRENT_H
/* Define if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define if you have the <exechdr.h> header file. */
#undef HAVE_EXECHDR_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <filehdr.h> header file. */
#undef HAVE_FILEHDR_H
/* Define if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define if you have the <krb5.h> header file. */
#undef HAVE_KRB5_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <machine/vmparam.h> header file. */
#undef HAVE_MACHINE_VMPARAM_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <ndir.h> header file. */
#undef HAVE_NDIR_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <nlist.h> header file. */
#undef HAVE_NLIST_H
/* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H
/* Define if you have the <reloc.h> header file. */
#undef HAVE_RELOC_H
/* Define if you have the <resolv.h> header file. */
#undef HAVE_RESOLV_H
/* Define if you have the <setjmp.h> header file. */
#undef HAVE_SETJMP_H
/* Define if you have the <sgs.h> header file. */
#undef HAVE_SGS_H
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define if you have the <stab.h> header file. */
#undef HAVE_STAB_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/dir.h> header file. */
#undef HAVE_SYS_DIR_H
/* Define if you have the <sys/exec.h> header file. */
#undef HAVE_SYS_EXEC_H
/* Define if you have the <sys/exechdr.h> header file. */
#undef HAVE_SYS_EXECHDR_H
/* Define if you have the <sys/fcntl.h> header file. */
#undef HAVE_SYS_FCNTL_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the <sys/loader.h> header file. */
#undef HAVE_SYS_LOADER_H
/* Define if you have the <sys/mount.h> header file. */
#undef HAVE_SYS_MOUNT_H
/* Define if you have the <sys/ndir.h> header file. */
#undef HAVE_SYS_NDIR_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/pstat.h> header file. */
#undef HAVE_SYS_PSTAT_H
/* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/statfs.h> header file. */
#undef HAVE_SYS_STATFS_H
/* Define if you have the <sys/statvfs.h> header file. */
#undef HAVE_SYS_STATVFS_H
/* Define if you have the <sys/syslog.h> header file. */
#undef HAVE_SYS_SYSLOG_H
/* Define if you have the <sys/systeminfo.h> header file. */
#undef HAVE_SYS_SYSTEMINFO_H
/* Define if you have the <sys/termio.h> header file. */
#undef HAVE_SYS_TERMIO_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/ttold.h> header file. */
#undef HAVE_SYS_TTOLD_H
/* Define if you have the <sys/ttycom.h> header file. */
#undef HAVE_SYS_TTYCOM_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <sys/utsname.h> header file. */
#undef HAVE_SYS_UTSNAME_H
/* Define if you have the <sys/vfs.h> header file. */
#undef HAVE_SYS_VFS_H
/* Define if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
/* Define if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define if you have the <term.h> header file. */
#undef HAVE_TERM_H
/* Define if you have the <termcap.h> header file. */
#undef HAVE_TERMCAP_H
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <utsname.h> header file. */
#undef HAVE_UTSNAME_H
/* Define if you have the <varargs.h> header file. */
#undef HAVE_VARARGS_H
/* Define if you have the <vmparam.h> header file. */
#undef HAVE_VMPARAM_H

927
config.sub vendored Executable file
View File

@@ -0,0 +1,927 @@
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file 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.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
if [ x$1 = x ]
then
echo Configuration name missing. 1>&2
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
echo "or $0 ALIAS" 1>&2
echo where ALIAS is a recognized configuration type. 1>&2
exit 1
fi
# First pass through any local machine types.
case $1 in
*local*)
echo $1
exit 0
;;
*)
;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple)
os=
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco5)
os=sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
| arme[lb] | pyramid \
| tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
| alpha | we32k | ns16k | clipper | i370 | sh \
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
| pdp11 | mips64el | mips64orion | mips64orionel \
| sparc | sparclet | sparclite | sparc64)
basic_machine=$basic_machine-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i[3456]86)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
| hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-cbm
;;
amigados)
basic_machine=m68k-cbm
os=-amigados
;;
amigaunix | amix)
basic_machine=m68k-cbm
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | ymp)
basic_machine=ymp-cray
os=-unicos
;;
cray2)
basic_machine=cray2-cray
os=-unicos
;;
[ctj]90-cray)
basic_machine=c90-cray
os=-unicos
;;
crds | unos)
basic_machine=m68k-crds
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
os=-mvs
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[3456]86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i[3456]86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i[3456]86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i[3456]86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
miniframe)
basic_machine=m68000-convergent
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
np1)
basic_machine=np1-gould
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pentium | p5)
basic_machine=i586-intel
;;
pentiumpro | p6)
basic_machine=i686-intel
;;
pentium-* | p5-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
k5)
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
basic_machine=i586-amd
;;
nexen)
# We don't have specific support for Nexgen yet, so just call it a Pentium
basic_machine=i586-nexgen
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=rs6000-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
xmp)
basic_machine=xmp-cray
os=-unicos
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
mips)
basic_machine=mips-mips
;;
romp)
basic_machine=romp-ibm
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sparc)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-unixware* | svr4*)
os=-sysv4
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -linux-gnu* | -uxpv*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-ctix* | -uts*)
os=-sysv
;;
-ns2 )
os=-nextstep2
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-xenix)
os=-xenix
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
*-acorn)
os=-riscix1.2
;;
arm*-semi)
os=-aout
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-ibm)
os=-aix
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigados
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f301-fujitsu)
os=-uxpv
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-aix*)
vendor=ibm
;;
-hpux*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-vxsim* | -vxworks*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os

5215
configure vendored Executable file
View File

File diff suppressed because it is too large Load Diff

759
configure.in Normal file
View File

@@ -0,0 +1,759 @@
dnl process this file with GNU autoconf to produce a configure script.
dnl
dnl jmason 23 dec 94 -- fixed union wait and sys_errlist checks
dnl Patrick Powell Fri Jul 7 21:08:48 PDT 1995
dnl configure.in,v 1.1 1997/05/30 18:53:33 papowell Exp
dnl Original version from PLP4.0 Release
AC_INIT(Makefile.in)
AC_CONFIG_AUX_DIR(.)
AC_CANONICAL_SYSTEM
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr/local)
AC_SUBST(INSTALL)
AC_SUBST(INSTALL_MAN)
AC_SUBST(SHELL)
AC_SUBST(CPP)
AC_SUBST(CFLAGS)
AC_SUBST(LDCC)
dnl ----------------------------------------------------------------------------
dnl ----------- C compiler checks -----------------------------------------
AC_PROG_CC
if test $ac_cv_prog_gcc = yes; then
cat >conftest.c <<EOF
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
yes;
#endif
EOF
if ${CC-cc} -E conftest.c | egrep yes >/dev/null 2>&1; then
gcc -v
echo "WARNING: gcc -O (version 2.4.5 and below) produces incorrect code"
echo " for lpd.c and other large routines."
CFLAGS="`echo ${CFLAGS} | sed s/-O//`"
fi;
CFLAGS="${CFLAGS} -Wall"
echo "using CFLAGS=${CFLAGS}"
fi;
dnl ----------------------------------------------------------------------------
dnl ------------ OS Checks --------------------------------------------------
AC_ISC_POSIX
AC_MINIX
AC_AIX
changequote(, )dnl
version=`echo $target_os | sed -e 's/[^0-9][^0-9]*//' -e 's/\.//g'`
changequote([, ])dnl
echo "Target is $target, arch $target_cpu, os $target_os, version $version"
AC_DEFINE_UNQUOTED(ARCHITECTURE,"$target_cpu")
LDCC="$CC"
checklibs=
case $target_os in
bsdi* )
LDCC=shlicc
;;
unicos* )
checklibs=no
;;
irix6* )
checklibs=no
AC_DEFINE_UNQUOTED(IRIX,$version)
LIBS="$LIBS -lcurses"
;;
irix5* )
AC_DEFINE(HAVE_BROKEN_TIOCEXCL)
AC_DEFINE(SVR4)
AC_DEFINE_UNQUOTED(IRIX,$version)
LIBS="$LIBS -lcurses"
checklibs=no
;;
irix* )
AC_DEFINE_UNQUOTED(IRIX,$version)
LIBS="$LIBS -ltermcap"
checklibs=no
;;
solaris* )
AC_DEFINE(SVR4)
AC_DEFINE_UNQUOTED(SOLARIS,$version)
;;
hpux* )
AC_DEFINE(_HPUX_SOURCE)
CFLAGS="$CFLAGS -D_HPUX_SOURCE=1"
AC_DEFINE_UNQUOTED(HPUX,$version)
;;
sunos* )
AC_DEFINE_UNQUOTED(SUNOS,$version)
;;
esac
dnl if egrep _HPUX_SOURCE /usr/include/sys/types.h > /dev/null 2>&1 ; then
dnl # HP/UX support (kludgety kludge!)
dnl AC_DEFINE(_HPUX_SOURCE)
dnl CFLAGS="$CFLAGS -D_HPUX_SOURCE=1"
dnl fi
dnl these must be before anything that links.
dnl check to see if we suppress probing for libraries
dnl this is done by using the checklibs variable
if test -z "$checklibs"; then
dnl BSDI uses this for setproctitle
AC_CHECK_LIB(util, setproctitle, [LIBS="$LIBS -lutil"])
dnl A/UX uses this...
AC_CHECK_LIB(posix, getpwent, [LIBS="$LIBS -lposix"])
dnl use old-style shared libs if we have 'em.
AC_CHECK_LIB(socket_s, socket, [LIBS="$LIBS -lsocket_s"; have_socket=1], ,-lnsl)
if test -z "$have_socket"; then
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"], , -lnsl)
fi
AC_CHECK_LIB(nsl_s, gethostbyaddr, [LIBS="$LIBS -lnsl_s"; have_nsl=1])
if test -z "$have_nsl"; then
AC_CHECK_LIB(nsl, gethostbyaddr, [LIBS="$LIBS -lnsl"])
fi
AC_CHECK_LIB(net_s, gethostbyaddr, [LIBS="$LIBS -lnet_s"; have_net=1])
if test -z "$have_net"; then
AC_CHECK_LIB(net, gethostbyaddr, [LIBS="$LIBS -lnet"])
fi
dnl IRIX 4 uses these... NIS calls, shared C lib
AC_CHECK_LIB(sun, getpwnam, [LIBS="$LIBS -lsun"])
AC_CHECK_LIB(c_s, atoi, [LIBS="$LIBS -lc_s"])
fi
dnl **** end library checks
AC_C_CONST
AC_C_INLINE
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
dnl typedefs:
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
dnl ----------------------------------------------------------------------------
dnl headers:
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(a.out.h a_out.h aouthdr.h ar.h arpa/inet.h arpa/nameser.h)
AC_CHECK_HEADERS(assert.h com_err.h compat.h ctype.h curses.h dirent.h)
AC_CHECK_HEADERS(errno.h exechdr.h fcntl.h filehdr.h grp.h krb5.h)
AC_CHECK_HEADERS(limits.h locale.h machine/vmparam.h malloc.h memory.h ndir.h)
AC_CHECK_HEADERS(netdb.h netinet/in.h nlist.h pwd.h reloc.h resolv.h)
AC_CHECK_HEADERS(setjmp.h sgs.h sgtty.h signal.h stab.h stdarg.h)
AC_CHECK_HEADERS(stdio.h stdlib.h string.h strings.h sys/dir.h sys/exec.h)
AC_CHECK_HEADERS(sys/exechdr.h sys/fcntl.h sys/file.h sys/ioctl.h sys/loader.h)
AC_CHECK_HEADERS(sys/mount.h sys/ndir.h sys/param.h sys/pstat.h sys/resource.h)
AC_CHECK_HEADERS(sys/select.h sys/socket.h sys/stat.h sys/statfs.h sys/statvfs.h)
AC_CHECK_HEADERS(sys/syslog.h sys/systeminfo.h sys/termio.h sys/time.h sys/ttold.h)
AC_CHECK_HEADERS(sys/ttycom.h sys/utsname.h sys/vfs.h sys/wait.h syslog.h)
AC_CHECK_HEADERS(term.h termcap.h termio.h termios.h time.h unistd.h)
AC_CHECK_HEADERS(utsname.h varargs.h vmparam.h)
dnl ----------------------------------------------------------------------------
dnl function checks:
AC_CHECK_FUNCS(cfsetispeed fcntl flock gethostbyname2 getdtablesize)
AC_CHECK_FUNCS(gethostname getrlimit inet_aton inet_ntop inet_pton)
AC_CHECK_FUNCS(innetgr killpg lockf mkstemp)
AC_CHECK_FUNCS(mktemp openlog seteuid setpgid setproctitle)
AC_CHECK_FUNCS(setresuid setreuid setsid sigaction)
AC_CHECK_FUNCS(sigprocmask sigsetjmp socketpair strcasecmp)
AC_CHECK_FUNCS(strchr strdup strerror strncasecmp sysinfo)
AC_CHECK_FUNCS(tcflush tcsetattr uname wait3 waitpid)
if test ! "$ac_cv_func_setreuid" = yes -a ! "$ac_cv_func_seteuid" = yes -a ! "$ac_cv_func_setresuid" = yes; then
echo "WARNING: missing setreuid(), seteuid(), and setresuid()"
fi
AC_FUNC_VFORK
AC_FUNC_VPRINTF
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(how to manipulate tty attributes)
AC_CACHE_VAL(ac_cv_struct_term,
[
if test "$ac_cv_header_termios_h" = yes; then
ac_cv_struct_term=termios
fi
if test "$ac_cv_header_sys_termios_h" = yes; then
ac_cv_struct_term=termios
fi
dnl test to see if we need to compile
if test -z "$ac_cv_struct_term" ; then
AC_TRY_COMPILE([
#ifdef HAVE_TERMIO_H
#include <termio.h>
#endif
#ifdef HAVE_SYS_TERMIO_H
#include <sys/termio.h>
#endif],[struct termio t;t.c_iflag = 0],
ac_cv_struct_term=termio)
fi
dnl now you have determined if you have termio
if test -z "$ac_cv_struct_term" ; then
AC_TRY_COMPILE([#include <sgtty.h>],[
struct sgttyb s;s.sg_flags = 0],
ac_cv_struct_term=sgttyb)
fi
if test -z "$ac_cv_struct_term" ; then
ac_cv_struct_term=UNDEFINED
fi
])
AC_MSG_RESULT(using $ac_cv_struct_term)
if test "$ac_cv_struct_term" = "sgttyb"; then
AC_DEFINE(USE_SGTTYB)
AC_DEFINE(USE_STTY,SGTTYB)
fi
if test "$ac_cv_struct_term" = "termio"; then
AC_DEFINE(USE_TERMIO)
AC_DEFINE(USE_STTY,TERMIO)
fi
if test "$ac_cv_struct_term" = "termios"; then
AC_DEFINE(USE_TERMIOS)
AC_DEFINE(USE_STTY,TERMIOS)
fi
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(checking for struct exec)
AC_CACHE_VAL(ac_cv_struct_exec,
[
ac_cv_struct_exec=no
if test "$ac_cv_header_a_out_h" != no ; then
AC_TRY_COMPILE([
#include <sys/types.h>
#include <a.out.h>],[struct exec b; b.a_text = 0],
ac_cv_struct_exec=yes, ac_cv_struct_exec=no )
fi
])
AC_MSG_RESULT($ac_cv_struct_exec)
if test $ac_cv_struct_exec = yes; then
AC_DEFINE(HAVE_STRUCT_EXEC)
fi
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(how to get filesystem free space)
AC_CACHE_VAL(ac_cv_struct_fstype,
[
fstype=
dnl do this check if statvfs is a valid function
if test "$ac_cv_func_statvfs" != no ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif],[struct statvfs s; statvfs ("/", &s); return(s.f_bavail+s.f_bsize)],
fstype=statvfs)
fi #}
dnl do these checks if statfs is a valid function
if test "$ac_cv_func_statfs" != no ; then #{
if test -z "$fstype" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
# include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_STATVFS_H
# include <sys/statvfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
# include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
# include <sys/vfs.h>
#endif],[struct fs_data s; return(s.fd_bfree+s.fd_bsize)],
fstype=Ultrix-statfs)
fi #}
if test -z "$fstype" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif],[struct statfs s; return(s.f_bavail+s.f_bsize)],
fstype=statfs)
fi # }
if test -z "$fstype" ; then # {
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/param.h>
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
#endif],[struct statfs s; return(s.f_bfree+s.f_bsize)],
fstype=SVR3-statfs)
fi # }
fi # }
if test -z "$fstype" ; then
echo "cannot find a valid statfs-like structure!"
fstype=UNKNOWN
fi
ac_cv_struct_fstype=$fstype
])
AC_MSG_RESULT(using $ac_cv_struct_fstype)
if test "$ac_cv_struct_fstype" = SVR3-statfs; then
AC_DEFINE(USE_STATFS_TYPE,SVR3_STATFS)
fi
if test "$ac_cv_struct_fstype" = Ultrix-statfs; then
AC_DEFINE(USE_STATFS_TYPE,ULTRIX_STATFS)
fi
if test "$ac_cv_struct_fstype" = statfs; then
AC_DEFINE(USE_STATFS_TYPE,STATFS)
fi
if test "$ac_cv_struct_fstype" = statvfs; then
AC_DEFINE(USE_STATFS_TYPE,STATVFS)
fi
dnl ----------------------------------------------------------------------------
dnl
AC_MSG_CHECKING(for errno declaration)
AC_CACHE_VAL(ac_cv_decl_errno,
[AC_TRY_COMPILE([#include <errno.h>
#include <stdio.h>],[printf("%d",errno);],
ac_cv_decl_errno=yes, ac_cv_decl_errno=no)
])
AC_MSG_RESULT($ac_cv_decl_errno)
if test $ac_cv_decl_errno = yes; then
AC_DEFINE(HAVE_ERRNO_DECL)
fi;
AC_MSG_CHECKING(for sys_nerr)
AC_CACHE_VAL(ac_cv_decl_sys_nerr,
[AC_TRY_LINK(,[extern int sys_nerr; return (sys_nerr);],
ac_cv_decl_sys_nerr=yes, ac_cv_decl_sys_nerr=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_nerr)
if test $ac_cv_decl_sys_nerr = yes; then
AC_DEFINE(HAVE_SYS_NERR)
fi;
AC_MSG_CHECKING(for sys_nerr declaration)
AC_CACHE_VAL(ac_cv_decl_sys_nerr_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%d",sys_nerr);],
ac_cv_decl_sys_nerr_def=yes, ac_cv_decl_sys_nerr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_nerr_def)
if test $ac_cv_decl_sys_nerr_def = yes; then
AC_DEFINE(HAVE_SYS_NERR_DEF)
fi
AC_MSG_CHECKING(for sys_errlist array)
AC_CACHE_VAL(ac_cv_decl_sys_errlist,
[AC_TRY_LINK(,[extern char *sys_errlist[];
sys_errlist[0];],
ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist)
if test $ac_cv_decl_sys_errlist = yes; then
AC_DEFINE(HAVE_SYS_ERRLIST)
fi
AC_MSG_CHECKING(for sys_errlist declaration)
AC_CACHE_VAL(ac_cv_decl_sys_errlist_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",sys_errlist[0]);],
ac_cv_decl_sys_errlist_def=yes, ac_cv_decl_sys_errlist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_errlist_def)
if test $ac_cv_decl_sys_errlist_def = yes; then
AC_DEFINE(HAVE_SYS_ERRLIST_DEF)
fi
AC_MSG_CHECKING(for setproctitle declaration)
AC_CACHE_VAL(ac_cv_decl_setproctitle_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%s",setproctitle);],
ac_cv_decl_setproctitle_def=yes, ac_cv_decl_setproctitle_def=no)
])
AC_MSG_RESULT($ac_cv_decl_setproctitle_def)
if test $ac_cv_decl_setproctitle_def = yes; then
AC_DEFINE(HAVE_SETPROCTITLE_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl sys_siglist array (list of signals)
AC_MSG_CHECKING(for sys_siglist array)
AC_CACHE_VAL(ac_cv_decl_sys_siglist,
[AC_TRY_LINK(,[extern char *sys_siglist[]; printf("%s",sys_siglist[0]);],
ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_siglist)
if test $ac_cv_decl_sys_siglist = yes; then
AC_DEFINE(HAVE_SYS_SIGLIST)
fi
AC_MSG_CHECKING(for sys_siglist declaration)
AC_CACHE_VAL(ac_cv_decl_sys_siglist_def,
[AC_TRY_COMPILE([
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>],[printf("%s",sys_siglist[0]);],
ac_cv_decl_sys_siglist_def=yes, ac_cv_decl_sys_siglist_def=no)
])
AC_MSG_RESULT($ac_cv_decl_sys_siglist_def)
if test $ac_cv_decl_sys_siglist_def = yes; then
AC_DEFINE(HAVE_SYS_SIGLIST_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl check to see if you have getpgrp(0) or getpgrp()
dnl
dnl POSIX `getpgrp(void)' define HAVE_GETPGRP_0
dnl BSD `getpgrp(int)' - takes 0 as argument
dnl define HAVE_GETPGRP_0 0
dnl check to see if you have getpgrp(0) or getpgrp()
AC_MSG_CHECKING(for getprgp() or getpgrp(0) form)
AC_CACHE_VAL(ac_cv_func_getpgrp_0,
[AC_TRY_COMPILE([
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif],[getpgrp(0);],
ac_cv_func_getpgrp_0=getpgrp_0, ac_cv_func_getpgrp_0=getpgrp)
])
AC_MSG_RESULT($ac_cv_func_getpgrp_0)
if test "$ac_cv_func_getpgrp_0" = getpgrp_0; then
AC_DEFINE(HAVE_GETPGRP_0,0)
else
AC_DEFINE(HAVE_GETPGRP_0,)
fi
dnl ----------------------------------------------------------------------------
dnl check to see if you have setpgrp(n,m) or setpgrp()
AC_MSG_CHECKING(for setprgp form)
AC_CACHE_VAL(ac_cv_func_setpgrp_0,
[AC_TRY_COMPILE([
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
],[setpgrp(0,0);],
ac_cv_func_setpgrp_0=setpgrp_0, ac_cv_func_setpgrp_0=setpgrp)
])
AC_MSG_RESULT($ac_cv_func_setpgrp_0)
if test $ac_cv_func_setpgrp_0 = setpgrp_0; then
AC_DEFINE(HAVE_SETPGRP_0)
fi
dnl ----------------------------------------------------------------------------
dnl just for (really) backwards compatibility
dnl we really try not to use union wait -- it's heinously unportable.
dnl nicked this check from Tcl as well. ;)
dnl
dnl The check below checks whether <sys/wait.h> defines the type
dnl "union wait" correctly. It's needed because of weirdness in
dnl HP-UX where "union wait" is defined in both the BSD and SYS-V
dnl environments. Checking the usability of WIFEXITED seems to do
dnl the trick.
AC_MSG_CHECKING(for obsolete union wait compatibility)
AC_CACHE_VAL(ac_cv_unionwait,
[
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/wait.h>], [union wait x;WIFEXITED(x);],
ac_cv_unionwait=yes, ac_cv_unionwait=no)
])
AC_MSG_RESULT($ac_cv_unionwait)
if test $ac_cv_unionwait = yes; then
AC_DEFINE(HAVE_UNION_WAIT)
fi
dnl ----------------------------------------------------------------------------
dnl Would you believe the gethostname declarations are broken on some machines
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for gethostname declaration)
AC_CACHE_VAL(ac_cv_decl_gethostname_def,
[AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],[printf("%d",gethostname);],
ac_cv_decl_gethostname_def=yes, ac_cv_decl_gethostname_def=no)
])
AC_MSG_RESULT($ac_cv_decl_gethostname_def)
if test $ac_cv_decl_gethostname_def = yes; then
AC_DEFINE(HAVE_GETHOSTNAME_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl tgetstr definitions are missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for tgetstr declaration)
AC_CACHE_VAL(ac_cv_decl_tgetstr_def,
[AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_TERM_H
#include <term.h>
#endif],[printf("%d",tgetstr);],
ac_cv_decl_tgetstr_def=yes, ac_cv_decl_tgetstr_def=no)
if test $ac_cv_decl_tgetstr_def != yes; then
AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_CURSES_H
#include <curses.h>
#endif],[printf("%d",tgetstr);],
ac_cv_decl_tgetstr_def=yes, ac_cv_decl_tgetstr_def=no)
fi
])
AC_MSG_RESULT($ac_cv_decl_tgetstr_def)
if test $ac_cv_decl_tgetstr_def = yes; then
AC_DEFINE(HAVE_TGETSTR_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl innetgr() declarations missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for innetgr declaration)
AC_CACHE_VAL(ac_cv_decl_innetgr_def,
[AC_TRY_COMPILE([
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif],[printf("%d",innetgr);],
ac_cv_decl_innetgr_def=yes, ac_cv_decl_innetgr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_innetgr_def)
if test $ac_cv_decl_innetgr_def = yes; then
AC_DEFINE(HAVE_INNETGR_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl openlog() declarations missing
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for openlog declaration)
AC_CACHE_VAL(ac_cv_decl_openlog_def,
[AC_TRY_COMPILE([
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#ifdef HAVE_SYSLOG_H
#include <syslog.h>
#endif],[printf("%d",openlog);],
ac_cv_decl_openlog_def=yes, ac_cv_decl_openlog_def=no)
])
AC_MSG_RESULT($ac_cv_decl_openlog_def)
if test $ac_cv_decl_openlog_def = yes; then
AC_DEFINE(HAVE_OPENLOG_DEF)
fi
dnl ----------------------------------------------------------------------------
dnl IPV6 - check for structure declarations
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for struct in6_addr declaration)
AC_CACHE_VAL(ac_cv_decl_in6_addr_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[struct in6_addr v;],
ac_cv_decl_in6_addr_def=yes, ac_cv_decl_in6_addr_def=no)
])
AC_MSG_RESULT($ac_cv_decl_in6_addr_def)
if test $ac_cv_decl_in6_addr_def = yes; then
AC_DEFINE(IN6_ADDR)
fi
AC_MSG_CHECKING(for struct in_addr6 declaration (LINUX))
AC_CACHE_VAL(ac_cv_decl_in_addr6_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>],[struct in_addr6 v;],
ac_cv_decl_in_addr6_def=yes, ac_cv_decl_in_addr6_def=no)
])
AC_MSG_RESULT($ac_cv_decl_in_addr6_def)
if test "$ac_cv_decl_in_addr6_def" = yes; then
AC_DEFINE(IN_ADDR6)
fi
dnl ----------------------------------------------------------------------------
dnl struct stat can have a st_mtime_nsec field
dnl ----------------------------------------------------------------------------
AC_MSG_CHECKING(for struct stat has mtimespec.ts_nsec or mtimespec.ts_nsec)
AC_CACHE_VAL(ac_cv_decl_st_mtime_nsec_def,
[AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtimespec.ts_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtimespec.ts_nsec)
])
if test -z "$ac_cv_decl_st_mtime_nsec_def" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtime_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtime_nsec )
fi #}
if test -z "$ac_cv_decl_st_mtime_nsec_def" ; then #{
AC_TRY_COMPILE([
#include <sys/types.h>
#if defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#include <sys/stat.h>],[struct stat statb; statb.st_mtim.tv_nsec;],
ac_cv_decl_st_mtime_nsec_def=st_mtim.tv_nsec )
fi #}
if test -z "$ac_cv_decl_st_mtime_nsec_def"; then
ac_cv_decl_st_mtime_nsec_def=no
fi
AC_MSG_RESULT($ac_cv_decl_st_mtime_nsec_def)
if test ! "$ac_cv_decl_st_mtime_nsec_def" = no; then
AC_DEFINE_UNQUOTED(ST_MTIME_NSEC,$ac_cv_decl_st_mtime_nsec_def)
fi
dnl ----------------------------------------------------------------------------
dnl make stuff:
AC_PROG_INSTALL
AC_CHECK_PROG(INSTALL_MAN,auxman,auxman,[$INSTALL -m 644])
AC_PROG_RANLIB
AC_PROG_MAKE_SET
dnl ----------------- force this to be Bourne Shell for now ---------------
AC_MSG_CHECKING(for shell)
SHELL=/bin/sh
AC_MSG_RESULT(using $SHELL (FORCED))
dnl ----------------- GCC Compilation ----------------------------------
AC_OUTPUT(Makefile src/Makefile man/Makefile )

238
install-sh Executable file
View File

@@ -0,0 +1,238 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

49
man/Makefile.in Normal file
View File

@@ -0,0 +1,49 @@
#**************************************************************************
#* LPRng IFHP Filter
#* Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
#*
#* Based on the CTI printer filters.
#* See COPYRIGHT for details.
#*
#* $Id: Makefile.in,v 1.2 1997/06/04 18:35:35 papowell Exp $
#
prefix=@prefix@
VPATH=@srcdir@
SRC=@srcdir@
# Directory where the manual pages are to be placed
MAN=${prefix}/man
INSTALLCMD=@INSTALL@
FONTDIR=${prefix}/lib/filters/fonts/
INSTDIR=${prefix}/lib/filters/
#**************** configure does not change lines after this *********
.PHONY: install all clean distclean ci update
all: lp_server.8
install: lp_server.8
mkdir -p $(MAN)/man8
$(INSTALLCMD) -c $^ $(MAN)/man8
clean:
update:
VERSION=`cat ../$(SRC)/VERSION | sed 's/.* //'`; \
sed -e 's,_FONTDIR_,$(FONTDIR),g' \
-e 's,_INSTDIR_,$(INSTDIR),g' \
-e "s,_VERSION_,$${VERSION},g" \
lp_server.n >lp_server.8
distclean: clean
rm -f Makefile Makefile.bsd
ci:
if test ! -d RCS ; then mkdir RCS; fi;
for i in Makefile.in Makefile *.n; do \
ci $(CI) -l -mUpdate -t-Initial $$i; \
done;

138
man/lp_server.8 Normal file
View File

@@ -0,0 +1,138 @@
.TH ifhp 8 "lp_server-1.1.6"
.SH NAME
lp_server \- export a printer by simulation a HP JetDirect interface
.SH SYNOPSIS
.B lp_server
[-n port] [-w] [-s stty_options] [-d device] [-r remote_list]
.SH DESCRIPTION
.LP
The
.B lp_server
program will bind to the port specified by the -n option,
and wait for a TCP/IP connection.
It will then open the output device (write only if -w is specified),
applying the specified set of stty options if the device
is a serial port.
It then copies the TCP/IP output to the device output,
and copying the device output to the TCP/IP input.
.LP
The intended use for
.B lp_server
is to allow a serial or parallel printer to be made available to PC
workstations as well as to one or more LPRng servers.
.SH "OPTIONS"
The
.B lp_server
printer recognizes the following options provided by the spooler.
.TP
.BR -d " device"
The output device.
.TP
.BR -n " port"
port to use for connections.
Default is 9100.
.TP
.B -w
Open the output device write only.
Default is read/write.
.TP
.BR -t " stty_options"
A list of stty options to be applied to the device
after opening if it is a serial port.
.TP
.BR -r " remote_list"
A list of host names or IP addresses and masks from which
connections are allowed.
For example,
-r 130.191.10.30/24,dickory
would allow connections from the subnet 130.191.10.0 (24 bit netmask)
and the host dickory.
.SH EXAMPLES
.LP
lp_server -d /dev/lp -w
.LP
Opens the parallel port write only.
.LP
lp_server -d /dev/ttya
-t "38400 -echo -crmod -raw -oddp -evenp ixon pass8 -ixany cbreak"
.LP
Opens the serial port /dev/ttya,
and sets the various serial port options.
.SH STTY_OPTIONS
.PP
Due to the differences between implementations of UNIX,
there are several sets of
stty options supported.
Systems using the
.IR sgtty
tty manipulation interface may use the following
.IR stty (1)
options:
.nf
.PP
.ta 16n +16n +16n +16n +16n +16n +16n +16n +16n
bs0 bs1 [-]cbreak cooked cr0
cr1 cr2 cr3 [-]decctlq [-]echo
[-]even ff0 ff1 [-]lcase [-]litout
nl0 nl1 nl2 nl3 [-]nl
[-]noflsh new [-]nohang old [-]odd
[-]raw start stop tab0 tab1
tab2 [-]tabs [-]tandem tek ti700
[-]tilde tn300 tty33 tty37 vt05
[-]evenp [-]oddp [-]pass8
.fi
.PP
Systems using
.IR termio
may use the following options:
.nf
.PP
[-]ignbrk [-]brkint [-]ignpar [-]parmrk [-]inpck
[-]istrip [-]inlcr [-]igncr [-]icrnl [-]iuclc
[-]ixon [-]ixany [-]ixoff [-]decctlq [-]tandem
[-]imaxbel [-]opost [-]olcuc [-]onlcr [-]ocrnl
[-]onocr [-]onlret [-]ofill [-]ofdel [-]cstopb
[-]cread [-]parenb [-]parodd [-]hupcl [-]clocal
[-]loblk [-]parity [-]evenp [-]oddp [-]stopb
[-]hup [-]crtscts [-]isig [-]noisig [-]icanon
[-]cbreak [-]xcase [-]echo [-]echoe [-]echok
[-]crterase [-]lfkc [-]echonl [-]noflsh [-]tostop
[-]echoctl [-]ctlecho [-]echoprt [-]prterase [-]echoke
[-]crtkill [-]lcase [-]nl [-]litout [-]pass8
[-]raw [-]sane [-]cooked [-]nopost fill
nl0 nl1 cr0 cr1 cr2
cr3 tab0 tab1 tab2 tab3
bs0 bs1 vt0 vt1 ff0
ff1 cs5 cs6 cs7 cs8
nul-fill del-fill -tabs
.fi
.PP
And systems using
.IR termios
may use the following options:
.nf
.PP
[-]ignbrk [-]brkint [-]ignpar [-]parmrk [-]inpck
[-]istrip [-]inlcr [-]igncr [-]icrnl [-]iuclc
[-]ixon [-]ixany [-]ixoff [-]imaxbel [-]pass8
[-]opost [-]olcuc [-]onlcr [-]ocrnl [-]onocr
[-]onlret [-]ofill [-]ofdel [-]tabs nl0
nl1 cr0 cr1 cr2 cr3
tab0 tab1 tab2 tab3 bs0
bs1 vt0 vt1 ff0 ff1
cs5 cs6 cs7 cs8 [-]cstopb
[-]cread [-]parenb [-]parodd [-]hupcl [-]clocal
[-]crtscts [-]evenp [-]parity [-]oddp [-]pass8
[-]isig [-]icanon [-]xcase [-]echo [-]echoe
[-]echok [-]echonl [-]noflsh [-]tostop [-]iexten
[-]echoctl [-]ctlecho [-]echoprt [-]prterase [-]echoke
[-]crtkill [-]flusho [-]pendin
.fi
.SH "SEE ALSO"
.PP
LPRng Documentation, especially discussions about filters.
.SH "AUTHOR"
.PP
Patrick Powell, Start Tech, San Diego.
.br
Inspired by Ivan Popov <pin@math.chalmers.se>

138
man/lp_server.n Normal file
View File

@@ -0,0 +1,138 @@
.TH ifhp 8 "_VERSION_"
.SH NAME
lp_server \- export a printer by simulation a HP JetDirect interface
.SH SYNOPSIS
.B lp_server
[-n port] [-w] [-s stty_options] [-d device] [-r remote_list]
.SH DESCRIPTION
.LP
The
.B lp_server
program will bind to the port specified by the -n option,
and wait for a TCP/IP connection.
It will then open the output device (write only if -w is specified),
applying the specified set of stty options if the device
is a serial port.
It then copies the TCP/IP output to the device output,
and copying the device output to the TCP/IP input.
.LP
The intended use for
.B lp_server
is to allow a serial or parallel printer to be made available to PC
workstations as well as to one or more LPRng servers.
.SH "OPTIONS"
The
.B lp_server
printer recognizes the following options provided by the spooler.
.TP
.BR -d " device"
The output device.
.TP
.BR -n " port"
port to use for connections.
Default is 9100.
.TP
.B -w
Open the output device write only.
Default is read/write.
.TP
.BR -t " stty_options"
A list of stty options to be applied to the device
after opening if it is a serial port.
.TP
.BR -r " remote_list"
A list of host names or IP addresses and masks from which
connections are allowed.
For example,
-r 130.191.10.30/24,dickory
would allow connections from the subnet 130.191.10.0 (24 bit netmask)
and the host dickory.
.SH EXAMPLES
.LP
lp_server -d /dev/lp -w
.LP
Opens the parallel port write only.
.LP
lp_server -d /dev/ttya
-t "38400 -echo -crmod -raw -oddp -evenp ixon pass8 -ixany cbreak"
.LP
Opens the serial port /dev/ttya,
and sets the various serial port options.
.SH STTY_OPTIONS
.PP
Due to the differences between implementations of UNIX,
there are several sets of
stty options supported.
Systems using the
.IR sgtty
tty manipulation interface may use the following
.IR stty (1)
options:
.nf
.PP
.ta 16n +16n +16n +16n +16n +16n +16n +16n +16n
bs0 bs1 [-]cbreak cooked cr0
cr1 cr2 cr3 [-]decctlq [-]echo
[-]even ff0 ff1 [-]lcase [-]litout
nl0 nl1 nl2 nl3 [-]nl
[-]noflsh new [-]nohang old [-]odd
[-]raw start stop tab0 tab1
tab2 [-]tabs [-]tandem tek ti700
[-]tilde tn300 tty33 tty37 vt05
[-]evenp [-]oddp [-]pass8
.fi
.PP
Systems using
.IR termio
may use the following options:
.nf
.PP
[-]ignbrk [-]brkint [-]ignpar [-]parmrk [-]inpck
[-]istrip [-]inlcr [-]igncr [-]icrnl [-]iuclc
[-]ixon [-]ixany [-]ixoff [-]decctlq [-]tandem
[-]imaxbel [-]opost [-]olcuc [-]onlcr [-]ocrnl
[-]onocr [-]onlret [-]ofill [-]ofdel [-]cstopb
[-]cread [-]parenb [-]parodd [-]hupcl [-]clocal
[-]loblk [-]parity [-]evenp [-]oddp [-]stopb
[-]hup [-]crtscts [-]isig [-]noisig [-]icanon
[-]cbreak [-]xcase [-]echo [-]echoe [-]echok
[-]crterase [-]lfkc [-]echonl [-]noflsh [-]tostop
[-]echoctl [-]ctlecho [-]echoprt [-]prterase [-]echoke
[-]crtkill [-]lcase [-]nl [-]litout [-]pass8
[-]raw [-]sane [-]cooked [-]nopost fill
nl0 nl1 cr0 cr1 cr2
cr3 tab0 tab1 tab2 tab3
bs0 bs1 vt0 vt1 ff0
ff1 cs5 cs6 cs7 cs8
nul-fill del-fill -tabs
.fi
.PP
And systems using
.IR termios
may use the following options:
.nf
.PP
[-]ignbrk [-]brkint [-]ignpar [-]parmrk [-]inpck
[-]istrip [-]inlcr [-]igncr [-]icrnl [-]iuclc
[-]ixon [-]ixany [-]ixoff [-]imaxbel [-]pass8
[-]opost [-]olcuc [-]onlcr [-]ocrnl [-]onocr
[-]onlret [-]ofill [-]ofdel [-]tabs nl0
nl1 cr0 cr1 cr2 cr3
tab0 tab1 tab2 tab3 bs0
bs1 vt0 vt1 ff0 ff1
cs5 cs6 cs7 cs8 [-]cstopb
[-]cread [-]parenb [-]parodd [-]hupcl [-]clocal
[-]crtscts [-]evenp [-]parity [-]oddp [-]pass8
[-]isig [-]icanon [-]xcase [-]echo [-]echoe
[-]echok [-]echonl [-]noflsh [-]tostop [-]iexten
[-]echoctl [-]ctlecho [-]echoprt [-]prterase [-]echoke
[-]crtkill [-]flusho [-]pendin
.fi
.SH "SEE ALSO"
.PP
LPRng Documentation, especially discussions about filters.
.SH "AUTHOR"
.PP
Patrick Powell, Start Tech, San Diego.
.br
Inspired by Ivan Popov <pin@math.chalmers.se>

95
src/Makefile.in Normal file
View File

@@ -0,0 +1,95 @@
#**************************************************************************
#* LPRng IFHP Filter
#* Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
#*
#* Based on the CTI printer filters.
#* See COPYRIGHT for details.
#*
#* $Id: Makefile.in,v 1.2 1997/12/18 09:29:50 papowell Exp $
#
prefix=@prefix@
# where the filters are installed:
INSTDIR=${prefix}/lib/filters
# where the fonts are installed (this path should agree
# with the one in FONTPATH).
FONTDIR=${prefix}/lib/filters/fonts
SRC=@srcdir@
# shell to use
SHELL=@SHELL@
#
# the compiler optimisation/debugging flags you wish to use.
# what C compiler to use.
#
CC=@CC@
# add additional definitions here
# use FLAGS for additional flags
CFLAGS:= @CFLAGS@ @DEFS@ -I.. -I${SRC} $(CFLAGS)
LDFLAGS:= @LDFLAGS@
# libraries you will need (found by config), add more to end
LIBS=@LIBS@
INSTALLCMD=@INSTALL@
SHELL = @SHELL@
@SET_MAKE@
RANLIB=@RANLIB@
######### - no changes by configure after here #############
VPATH=.. ${SRC}/.
#if you want quiet operation, i.e. - only serious messages logged,
# uncomment out the following line
# commands made by this script
COMMANDS= lp_server
all: ${COMMANDS}
.PHONY: all clean install lorder
#
# Object - Source dependencies
#
OBJS = lp_server.o stty.o log.o snprintf.o
$(OBJS): common.h
lp_server: $(OBJS)
${CC} ${LDFLAGS} $(OBJS) -o $@ ${LIBS}
#
# Installation of commands
#
install: all
-mkdir -p $(INSTDIR)
for i in $(COMMANDS) ; do \
$(INSTALLCMD) -m 755 $$i $(INSTDIR); \
done ;
cd $(INSTDIR); rm -f ofhp; ln -s ifhp ofhp
#
# Miscellaneous
#
clean:
-rm -f $(COMMANDS) *.o *.a core ? pfu tags
ci:
if test ! -d RCS ; then mkdir RCS; fi;
for i in \
*.[ch] Makefile* \
accounting.sh_init banner.sh_init ellipse.ps psbanner.sh_init \
testbanner testif testnostat testnw testof \
; do \
if [ -f $$i ]; then ci $(CI) -l -mUpdate -t-Initial $$i; fi; \
done;
distclean:
-rm -f Makefile Makefile.bsd

67
src/common.h Normal file
View File

@@ -0,0 +1,67 @@
/**************************************************************************
* LPRng IFHP Filter
* Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
*
* Based on the CTI printer filters.
* See COPYRIGHT for details.
*
* $Id: common.h,v 1.1 1997/05/30 18:53:54 papowell Exp $
*/
/****************************************************************************
* Modification History:
* Extracted from ifhp4.c
*
* Revision 1.11 95/08/22 15:01:07
* Version 1.2 initiated and Porting to Solaris.
*
*/
#ifndef _COMMON_H
#define _COMMON_H 1
#ifdef EXTERN
# undef EXTERN
# undef DEFINE
# define EXTERN
# define DEFINE(X) X
#else
# undef EXTERN
# undef DEFINE
# define EXTERN extern
# define DEFINE(X)
#endif
#undef _PARMS__
#ifdef __STDC__
#define _PARMS__(X) X
#else
#define _PARMS__(X) ()
#endif
#if defined(HAVE_STDARGS)
void log _PARMS__( (int kind, char *msg,...) );
void fatal _PARMS__( ( char *msg,...) );
void logerr _PARMS__( (int kind, char *msg,...) );
void logerr_die _PARMS__( (int kind, char *msg,...) );
int plp_snprintf (char *str, size_t count, const char *fmt, ...);
int vplp_snprintf (char *str, size_t count, const char *fmt, va_list arg);
#else
void log _PARMS__( (void) );
void fatal _PARMS__( (void) );
void logerr _PARMS__( (void) );
void logerr_die _PARMS__( (void) );
int plp_snprintf ();
int vplp_snprintf ();
#endif
#define JABORT 1
EXTERN char *name;
EXTERN int debug;
EXTERN int errorcode;
void Do_stty( int fd, char *Stty_command );
const char * Errormsg ( int err );
#endif /* _COMMON_H */

400
src/log.c Normal file
View File

@@ -0,0 +1,400 @@
/**************************************************************************
* LPRng IFHP Filter
* Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
*
* Based on the CTI printer filters.
* See COPYRIGHT for details.
*
* $Id: log.c,v 1.1 1997/05/30 18:53:54 papowell Exp $
*/
#include "portable.h"
#include "common.h"
#if !defined(ultrix) && defined(HAVE_SYSLOG_H)
# include <syslog.h>
#endif
#if defined(HAVE_SYS_SYSLOG_H)
# include <sys/syslog.h>
#endif
#define PAIR(X) { #X, X }
extern char * Time_str();
struct keys {
char *name;
int value;
} log_level[] = {
{"EMERG",LOG_EMERG},
{"ALERT",LOG_ALERT},
{"CRIT",LOG_CRIT},
{"ERR",LOG_ERR},
{"WARNING",LOG_WARNING},
{"NOTICE",LOG_NOTICE},
{"INFO",LOG_INFO},
{"DEBUG",LOG_DEBUG},
{0,0}
};
static char msg_buf[1024];
extern int show_ctrl;
void init_pid()
{
int len;
plp_snprintf(msg_buf,sizeof(msg_buf), "%s ", name );
len = strlen( msg_buf );
plp_snprintf(msg_buf+len,sizeof(msg_buf)-len,
"pid [%d] ", (int)(getpid()) );
}
static void logbackend()
{
int len, original_len;
original_len = len = strlen( msg_buf );
len = strlen( msg_buf );
(void)plp_snprintf(msg_buf+len, sizeof(msg_buf)-len,
" at %s\n", Time_str());
(void)fputs(msg_buf, stderr );
(void)fflush(stderr);
}
/* VARARGS2 */
#ifdef HAVE_STDARGS
void log (int lvl, char *msg,...)
#else
void log (va_alist) va_dcl
#endif
{
#ifndef HAVE_STDARGS
int lvl;
char *msg;
#endif
int len;
VA_LOCAL_DECL
VA_START (msg);
VA_SHIFT (lvl, int);
VA_SHIFT (msg, char *);
lvl = show_ctrl;
show_ctrl = 1;
init_pid();
len = strlen(msg_buf);
(void)vplp_snprintf(msg_buf+len, sizeof(msg_buf)-len, msg, ap );
logbackend();
show_ctrl = lvl;
VA_END;
}
/* VARARGS1 */
#ifdef HAVE_STDARGS
void fatal ( char *msg,...)
#else
void fatal (va_alist) va_dcl
#endif
{
#ifndef HAVE_STDARGS
int lvl;
char *msg;
#endif
int len;
int lvl;
VA_LOCAL_DECL
VA_START (msg);
VA_SHIFT (msg, char *);
lvl = show_ctrl;
show_ctrl = 1;
init_pid();
len = strlen(msg_buf);
(void)vplp_snprintf(msg_buf+len, sizeof(msg_buf)-len, msg, ap );
logbackend();
show_ctrl = lvl;
VA_END;
exit(errorcode);
}
/* VARARGS2 */
#ifdef HAVE_STDARGS
void logerr (int lvl, char *msg,...)
#else
void logerr (va_alist) va_dcl
#endif
{
#ifndef HAVE_STDARGS
int lvl;
char *msg;
#endif
VA_LOCAL_DECL
int err = errno;
int len;
VA_START (msg);
VA_SHIFT (lvl, int);
VA_SHIFT (msg, char *);
lvl = show_ctrl;
show_ctrl = 1;
init_pid();
len = strlen(msg_buf);
(void)vplp_snprintf(msg_buf+len, sizeof(msg_buf)-len, msg, ap );
len = strlen(msg_buf);
plp_snprintf( msg_buf+len, sizeof(msg_buf)-len, " - %s", Errormsg( err ) );
logbackend();
show_ctrl = lvl;
VA_END;
}
/* VARARGS2 */
#ifdef HAVE_STDARGS
void logerr_die (int lvl, char *msg,...)
#else
void logerr_die (va_alist) va_dcl
#endif
{
#ifndef HAVE_STDARGS
int lvl;
char *msg;
#endif
VA_LOCAL_DECL
int err = errno;
int len;
VA_START (msg);
VA_SHIFT (lvl, int);
VA_SHIFT (msg, char *);
lvl = show_ctrl;
show_ctrl = 1;
init_pid();
len = strlen(msg_buf);
(void)vplp_snprintf(msg_buf+len, sizeof(msg_buf)-len, msg, ap );
len = strlen(msg_buf);
plp_snprintf( msg_buf+len, sizeof(msg_buf)-len, " - %s", Errormsg( err ) );
logbackend();
VA_END;
show_ctrl = lvl;
exit(errorcode);
}
char * Time_str()
{
time_t tvec; /* time */
char *ctime();
static char s[40];
(void)time(&tvec);
(void)strcpy(s,ctime(&tvec));
(void)strcpy(s+20,s+24);
s[strlen(s)-1] = 0;
return( s+4 );
}
/****************************************************************************
* char *Errormsg( int err )
* returns a printable form of the
* errormessage corresponding to the valie of err.
* This is the poor man's version of sperror(), not available on all systems
* Patrick Powell Tue Apr 11 08:05:05 PDT 1995
****************************************************************************/
/****************************************************************************/
#if !defined(HAVE_STRERROR)
# if defined(HAVE_SYS_NERR)
# if !defined(HAVE_SYS_NERR_DEF)
extern int sys_nerr;
# endif
# define num_errors (sys_nerr)
# else
# define num_errors (-1) /* always use "errno=%d" */
# endif
# if defined(HAVE_SYS_ERRLIST)
# if !defined(HAVE_SYS_ERRLIST_DEF)
extern const char *const sys_errlist[];
# endif
# else
# undef num_errors
# define num_errors (-1) /* always use "errno=%d" */
# endif
#endif
const char * Errormsg ( int err )
{
const char *cp;
#if defined(HAVE_STRERROR)
cp = strerror(err);
#else
# if defined(HAVE_SYS_ERRLIST)
if (err >= 0 && err < num_errors) {
cp = sys_errlist[err];
} else
# endif
{
static char msgbuf[32]; /* holds "errno=%d". */
(void) plp_snprintf (msgbuf, sizeof(msgbuf), "errno=%d", err);
cp = msgbuf;
}
#endif
return (cp);
}
/***************************************************************************
* char *Sigstr(n)
* Return a printable form the the signal
***************************************************************************/
#ifndef HAVE_SYS_SIGLIST
#define PAIR(X) { #X , X }
static struct signame {
char *str;
int value;
} signals[] = {
{ "NO SIGNAL", 0 },
#ifdef SIGHUP
PAIR(SIGHUP),
#endif
#ifdef SIGINT
PAIR(SIGINT),
#endif
#ifdef SIGQUIT
PAIR(SIGQUIT),
#endif
#ifdef SIGILL
PAIR(SIGILL),
#endif
#ifdef SIGTRAP
PAIR(SIGTRAP),
#endif
#ifdef SIGIOT
PAIR(SIGIOT),
#endif
#ifdef SIGABRT
PAIR(SIGABRT),
#endif
#ifdef SIGEMT
PAIR(SIGEMT),
#endif
#ifdef SIGFPE
PAIR(SIGFPE),
#endif
#ifdef SIGKILL
PAIR(SIGKILL),
#endif
#ifdef SIGBUS
PAIR(SIGBUS),
#endif
#ifdef SIGSEGV
PAIR(SIGSEGV),
#endif
#ifdef SIGSYS
PAIR(SIGSYS),
#endif
#ifdef SIGPIPE
PAIR(SIGPIPE),
#endif
#ifdef SIGALRM
PAIR(SIGALRM),
#endif
#ifdef SIGTERM
PAIR(SIGTERM),
#endif
#ifdef SIGURG
PAIR(SIGURG),
#endif
#ifdef SIGSTOP
PAIR(SIGSTOP),
#endif
#ifdef SIGTSTP
PAIR(SIGTSTP),
#endif
#ifdef SIGCONT
PAIR(SIGCONT),
#endif
#ifdef SIGCHLD
PAIR(SIGCHLD),
#endif
#ifdef SIGCLD
PAIR(SIGCLD),
#endif
#ifdef SIGTTIN
PAIR(SIGTTIN),
#endif
#ifdef SIGTTOU
PAIR(SIGTTOU),
#endif
#ifdef SIGIO
PAIR(SIGIO),
#endif
#ifdef SIGPOLL
PAIR(SIGPOLL),
#endif
#ifdef SIGXCPU
PAIR(SIGXCPU),
#endif
#ifdef SIGXFSZ
PAIR(SIGXFSZ),
#endif
#ifdef SIGVTALRM
PAIR(SIGVTALRM),
#endif
#ifdef SIGPROF
PAIR(SIGPROF),
#endif
#ifdef SIGWINCH
PAIR(SIGWINCH),
#endif
#ifdef SIGLOST
PAIR(SIGLOST),
#endif
#ifdef SIGUSR1
PAIR(SIGUSR1),
#endif
#ifdef SIGUSR2
PAIR(SIGUSR2),
#endif
{0,0}
/* that's all */
};
#else /* HAVE_SYS_SIGLIST */
# ifndef HAVE_SYS_SIGLIST_DEF
extern const char *sys_siglist[];
# endif
#endif
#ifndef NSIG
# define NSIG 32
#endif
const char *Sigstr (int n)
{
static char buf[40];
const char *s = 0;
#ifdef HAVE_SYS_SIGLIST
if (n < NSIG && n >= 0) {
s = sys_siglist[n];
}
#else
int i;
for( i = 0; signals[i].str && signals[i].value != n; ++i );
s = signals[i].str;
#endif
if( s == 0 ){
s = buf;
(void) plp_snprintf (buf, sizeof(buf), "signal %d", n);
}
return(s);
}

307
src/lp_server.c Normal file
View File

@@ -0,0 +1,307 @@
/*
lp_server [-n port] [-w] [-d device] [-t stty_cmds]
Export a printer by simulating an HP JetDirect interface.
-n connection port (default 9100)
-w open output device write only (default r/w)
-d device (default /dev/lp)
-t stty_cmds - stty commands to apply if device is serial port
The lp_server will bind to the connection port, and wait for
an incoming connection. After accepting a connection, it
opens the output device, (rw or write only as specified),
applys the stty options, and then copies the connection output
to the device input and vice versa.
Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
$Id: lp_server.c,v 1.3 1997/12/18 09:29:50 papowell Exp $
*/
#define EXTERN
#include "portable.h"
#include "common.h"
#include <sys/types.h>
#include <sys/time.h>
#include <fcntl.h>
#include <stdio.h>
#include <version.h>
char *device = "/dev/lp";
char *stty_opts;
char *port = "9100";
int write_only;
void usage(void);
int sock, conn, dev = -1;
int pid;
char *restrict;
char buffer[1024];
int tcp_open( char * portname );
int Check_restriction(char *restrict, struct sockaddr_in *sin);
extern char *optarg;
extern int optind;
int main( int argc, char *argv[] )
{
int c, n, maxfd, mask;
struct sockaddr_in sin;
fd_set readfds;
name = argv[0];
while( ((c = getopt(argc, argv, "D:n:wd:t:r:")) != EOF) ){
switch(c){
case 'D': debug = atoi(optarg); break;
case 'n': port = optarg; break;
case 'w': write_only = 1; break;
case 'r': restrict = optarg; break;
case 'd': device = optarg; break;
case 't': stty_opts = optarg; break;
default: usage();
}
}
if( optind != argc ) usage();
/* step 1 - bind to the port */
sock = tcp_open( port );
if( sock < 0 ) exit(1);
if( debug ) log(1,"socket %d", sock );
while(1) {
/* accept a connection */
if( dev >= 0 ) close(dev); dev = -1;
if( debug ) log( 1, "waiting" );
n = sizeof(sin);
conn = accept( sock,(void *) &sin, &n );
if(debug) log(1,"conn %d", conn );
if( conn == -1 && errno != EINTR ){
logerr_die(1, "accept failed" );
}
if( restrict && Check_restriction(restrict, &sin) ){
if( debug ) log( 1, "reject %s", inet_ntoa( sin.sin_addr ) );
close( conn );
continue;
}
/* open the output device */
if( write_only ){
dev = open( device, O_WRONLY|O_NONBLOCK );
} else {
dev = open( device, O_RDWR|O_NONBLOCK );
}
if( dev == -1 ){
logerr_die(1, "open of %s failed", device );
}
if(debug) log(1,"dev %d", dev );
mask = fcntl( dev, F_GETFL, 0 );
if( mask == -1 ){
logerr_die(1,"fcntl F_GETFL of '%s' failed", device);
}
if( mask & O_NONBLOCK ){
mask &= ~O_NONBLOCK;
mask = fcntl( dev, F_SETFL, mask );
if( mask == -1 && errno != ENODEV ){
logerr_die( 1, "fcntl F_SETFL of '%s' failed",
device );
}
}
if( isatty( dev ) && stty_opts ){
Do_stty( dev, stty_opts );
}
/* write/read-write loop */
for(;;) {
FD_ZERO( &readfds );
FD_SET( conn, &readfds );
if( !write_only ) {
if(debug) log(1, "read/write mode FD_SET");
FD_SET( dev, &readfds );
}
if( conn > dev ) {
maxfd = conn;
} else {
maxfd = dev;
}
maxfd++;
n = select( maxfd, &readfds, ( fd_set * ) 0, ( fd_set * ) 0, 0 );
if(debug) log(1, "select returned %d", n);
if( n == -1 ) {
logerr_die(1, "an error occured with the select statement");
}
if( FD_ISSET( conn, &readfds ) ) {
/* data on socket */
if( (n = read( conn, buffer, sizeof( buffer ))) <= 0)
break;
if(debug) log(1,"read %d bytes from socket", n);
n = write( dev, buffer, n );
if(debug) log(1, "wrote %d bytes to device", n);
}
if( !write_only ) {
if( FD_ISSET( dev, &readfds ) ) {
/* data on device */
n = read( dev, buffer, sizeof( buffer ));
if(debug) log(1,"read %d bytes from device", n);
n = write( conn, buffer, n );
if(debug) log(1, "wrote %d bytes to socket", n);
}
}
}
/* close connections */
close( conn ); conn = -1;
close( dev ); dev = -1;
}
return(0);
}
int tcp_open( char *portname )
{
int port, i, fd, err;
int option, len;
struct sockaddr_in sin;
struct servent *servent;
port = atoi( portname );
if( port <= 0 ){
servent = getservbyname( portname, "tcp" );
if( servent ){
port = ntohs( servent->s_port );
}
}
if( port <= 0 ){
fprintf( stderr, "tcp_open: bad port number '%s'\n",portname );
return( -1 );
}
if( debug ) log(1, "port %d", port );
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons( port );
fd = socket( AF_INET, SOCK_STREAM, 0 );
err = errno;
if( fd < 0 ){
fprintf(stderr,"tcp_open: socket call failed - %s\n", Errormsg(err) );
return( -1 );
}
i = bind( fd, (struct sockaddr *) & sin, sizeof (sin) );
err = errno;
if( i < 0 ){
fprintf(stderr,"tcp_open: bind to '%s port %d' failed - %s\n",
inet_ntoa( sin.sin_addr ), ntohs( sin.sin_port ),
Errormsg(errno) );
close(fd);
return( -1 );
}
/* #ifdef SO_REUSEADDR */
len = sizeof( option );
option = 1;
if( setsockopt( fd, SOL_SOCKET, SO_REUSEADDR,
(char *)&option, sizeof(option) ) ){
logerr_die( 1, "setsockopt failed" );
}
/* #endif */
i = listen( fd, 10 );
err = errno;
if( i < 0 ){
fprintf(stderr,"tcp_open: listen to '%s port %d' failed - %s\n",
inet_ntoa( sin.sin_addr ), ntohs( sin.sin_port ),
Errormsg(errno) );
close(fd);
return( -1 );
}
return( fd );
}
char *msg[] = {
"lp_server [-n port] [-w] [-d device] [-t stty_cmds]",
" Version " VERSION ,
" Export a printer by simulating an HP JetDirect interface.",
" -n connection port (default 9100)",
" -w open output device write only (default r/w)",
" -d device (default /dev/lp)",
" -t stty_cmds - stty commands to apply if device is serial port",
" -r remote_list - remote hosts allowed, in IP/netmask or hostname",
" separated by commas. i.e. - 130.191.20.10/24,dickory would",
" allow connections from subnet 130.191.20.0 (24 bit netmask)",
" and host dickory",
" -D level - set debug level",
0
};
void usage()
{
char *s;
int i;
for( i = 0; (s = msg[i]); ++i ){
fprintf( stderr, "%s\n", s );
}
exit(1);
}
/*
* check restrictions on connecting host
*/
int Check_restriction(char *restrict, struct sockaddr_in *sin)
{
char *s, *mask, *end, *b;
struct hostent *h;
struct sockaddr_in addr;
unsigned long n, m, a;
a = ntohl( sin->sin_addr.s_addr );
if( debug ) log(1,"remote 0x%x", a );
b = strdup( restrict );
for( s = b; s; s = end ){
end = strchr( s, ',' );
if( end ){
*end++ = 0;
}
while( isspace( *s ) ) ++s;
mask = strchr( s, '/' );
if( mask ){
*mask++ = 0;
}
if( ( h = gethostbyname( s ) ) ){
memcpy( &addr.sin_addr, h->h_addr_list[0], sizeof(addr.sin_addr));
n = ntohl( addr.sin_addr.s_addr );
} else {
n = inet_addr( s );
}
if( n == -1 ){
log(1,"bad addr format '%s'", s );
return(1);
}
m = -1;
if( mask ){
m = atoi( mask );
if( m == 0 || m > 32 ){
log(1,"bad mask format '%s'", mask );
}
m = ~((1 << (32-m)) - 1);
}
if( debug ) log( 1, "checking 0x%x, mask 0x%x", n, m );
n = (n ^ a) & m;
if( debug ) log( 1, "result 0x%x", n );
if( n == 0 ) return( 0 );
}
return( 1 );
}

761
src/portable.h Normal file
View File

@@ -0,0 +1,761 @@
/***************************************************************************
* LPRng - An Extended Print Spooler System
*
* Copyright 1988-1997, Patrick Powell, San Diego, CA
* papowell@sdsu.edu
* See LICENSE for conditions of use.
*
***************************************************************************
* MODULE: portable.h
* PURPOSE:
* The configure program generates config.h, which defines various
* macros indicating the presence or abscence of include files, etc.
* However, there are some systems which pass the tests, but things
* do not work correctly on them. This file will try and fix
* these things up for the user.
*
* NOTE: if there were no problems, this file would be:
* #include "config.h"
*
* Sigh. Patrick Powell Thu Apr 6 07:00:48 PDT 1995 <papowell@sdsu.edu>
* NOTE: thanks to all the folks who worked on the PLP software,
* Justin Mason <jmason@iona.ie> especially. Some of the things
* that you have to do to get portability are truely bizzare.
*
* $Id: portable.h,v 1.1 1997/05/30 18:53:54 papowell Exp $
**************************************************************************/
#ifndef _PLP_PORTABLE_H
#define _PLP_PORTABLE_H 1
#ifndef __STDC__
LPRng requires ANSI Standard C compiler
#endif
#include "config.h"
/*************************************************************************
* ARGH: some things that "configure" can't get right.
*************************************************************************/
/***************************************************************************
* porting note: if you port PLP and you get some errors
* caused by autoconf guessing the wrong set of functions/headers/structs,
* add or change the entry for your system in the ARGH section below.
* You might want to try and determine how your system is identified
* by the C preprocessor and use this informaton rather than trying
* to look for information in various f1les.
* Patrick Powell and Justin Mason
***************************************************************************/
/*************************************************************************
* APOLLO Ports
* Thu Apr 6 07:01:51 PDT 1995 Patrick Powell
* This appears to be historical.
*************************************************************************/
#ifdef apollo
# define IS_APOLLO
/* #undef __STDC__ */
/* # define CONFLICTING_PROTOS */
#endif
/*************************************************************************
* ULTRIX.
* Patrick Powell Thu Apr 6 07:17:34 PDT 1995
*
* Take a chance on using the standard calls
*************************************************************************/
#ifdef ultrix
# define IS_ULTRIX
#endif
/*************************************************************************
* AIX.
*************************************************************************/
#ifdef _AIX32
# define IS_AIX32
#endif
/*************************************************************************
* Sun
*************************************************************************/
#if defined(sun)
#endif
/*************************************************************************
* Cray
*************************************************************************/
#if defined(cray)
#define MAXPATHLEN 1023
#define HAVE_SIGSETJMP 1
/* configure incorrectly chooses STATVFS */
#if defined(USE_STATFS_TYPE)
#undef USE_STATFS_TYPE
#endif
#define USE_STATFS_TYPE SRV3_STATFS
#endif
/*************************************************************************/
#if defined(NeXT)
# define IS_NEXT
# define __STRICT_BSD__
#endif
/*************************************************************************/
#if defined(__sgi) && defined(_SYSTYPE_SVR4)
# define IS_IRIX5
#endif
/*************************************************************************/
#if defined(__sgi) && defined(_SYSTYPE_SYSV)
#define IS_IRIX4
#endif
/*************************************************************************/
#if defined(__linux__) || defined (__linux) || defined (LINUX)
# define IS_LINUX
#endif
/*************************************************************************/
#if defined(__hpux) || defined(_HPUX_SOURCE)
# define IS_HPUX
# undef _HPUX_SOURCE
# define _HPUX_SOURCE 1
#endif
/*************************************************************************/
#if defined(__convex__) /* Convex OS 11.0 - from w_stef */
# define IS_CONVEX
# define LPASS8 (L004000>>16)
#endif
/*************************************************************************/
#ifdef _AUX_SOURCE
# define IS_AUX
# define _POSIX_SOURCE
# undef SETPROCTITLE
#endif
/*************************************************************************/
#if defined(SNI) && defined(sinix)
# define IS_SINIX
#endif
/*************************************************************************/
#if defined(__svr4__) && !defined(SVR4)
# define SVR4 __svr4__
#endif
/***************************************************************************
* Solaris SUNWorks CC compiler
* man page indicates __SVR4 is defined, as is __unix, __sun
***************************************************************************/
#if (defined(__SVR4) || defined(_SVR4_)) && !defined(SVR4)
# define SVR4 1
#endif
/*************************************************************************/
#if defined(__bsdi__)
# define IS_BSDI
#endif
/*************************************************************************/
/*************************************************************************
* we also need some way of spotting IS_DATAGEN (Data Generals),
* and IS_SEQUENT (Sequent machines). Any suggestions?
* these ports probably don't work anymore...
*************************************************************************/
/*************************************************************************
* END OF ARGH SECTION; next: overrides from the Makefile.
*************************************************************************/
/*************************
* STTY functions to use *
*************************/
#define SGTTYB 0
#define TERMIO 1
#define TERMIOS 2
/*************************
* FSTYPE functions to use *
*************************/
#define SVR3_STATFS 0
#define ULTRIX_STATFS 1
#define STATFS 2
#define STATVFS 3
#if defined(MAKE_USE_STATFS)
# undef USE_STATFS
# define USE_STATFS MAKE_USE_STATFS
#endif
#if defined(MAKE_USE_STTY)
# undef USE_STTY
# define USE_STTY MAKE_USE_STTY
#endif
/*********************************************************************
* GET STANDARD INCLUDE FILES
* This is the one-size-fits-all include that should grab everthing.
* This has a horrible impact on compilation speed, but then, do you
* want compilation speed or portability?
*
* Patrick Powell Thu Apr 6 07:21:10 PDT 1995
*********************************************************************
* If you do not have the following, you are doomed. Or at least
* going to have an uphill hard time.
* NOTE: string.h might also be strings.h on some very very odd systems
*
* Patrick Powell Thu Apr 6 07:21:10 PDT 1995
*********************************************************************/
/*********************************************************************
* yuck -- this is a nightmare! half-baked-ANSI systems are poxy (jm)
*
* Note that configure checks for absolute compliance, i.e.-
* older versions of SUNOS, HP-UX, do not meet this.
*
* Patrick Powell Thu Apr 6 07:21:10 PDT 1995
*********************************************************************/
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#else
extern int dup2 ();
extern int execve ();
extern uid_t geteuid (), getegid ();
extern int setgid (), getgid ();
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#else
char *getenv( char * );
void abort(void);
#endif
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_STRINGS_H)
# include <strings.h>
#endif
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <pwd.h>
#include <signal.h>
#include <sys/wait.h>
#include <ctype.h>
#include <errno.h>
#include <grp.h>
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#ifndef HAVE_STRCHR
# define strchr index
# define strrchr rindex
#endif
/* case insensitive compare for OS without it */
#if !defined(HAVE_STRCASECMP)
int strcasecmp (const char *s1, const char *s2);
#endif
#if !defined(HAVE_STRNCASECMP)
int strncasecmp (const char *s1, const char *s2, int len );
#endif
/*********************************************************************
* directory management is nasty. There are two standards:
* struct directory and struct dirent.
* Solution: macros + a typedef.
* Patrick Powell Thu Apr 6 07:44:50 PDT 1995
*
*See GNU autoconf documentation for this little AHEM gem... and others
* too obnoxious to believe
*********************************************************************/
#if HAVE_DIRENT_H
# include <dirent.h>
# define NLENGTH(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NLENGTH(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
typedef struct dirent plp_dir_t;
/*********************************************************************
* malloc strikes again. Definition is a la ANSI C. However,
* You may need to edit this on historical systems.
* Patrick Powell Thu Apr 6 07:47:54 PDT 1995
*********************************************************************/
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#else
# if !defined(HAVE_STDLIB_H)
void *malloc(size_t);
void free(void *);
# endif
#endif
#ifndef HAVE_ERRNO_DECL
extern int errno;
#endif
/*********************************************************************
* Note the <time.h> may already be included by some previous
* lines. You may need to edit this by hand.
* Better solution is to put include guards in all of the include files.
* Patrick Powell Thu Apr 6 07:55:58 PDT 1995
*********************************************************************/
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#else
# include <time.h>
# endif
#endif
#ifdef HAVE_SYS_FILE_H
# include <sys/file.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#ifdef HAVE_SYS_FCNTL_H
# include <sys/fcntl.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
/*
* we use the FCNTL code if we have it
* We want you to define F_SETLK, etc. If they are not defined,
* Then you better put a system dependent configuration
* in and define them.
*/
#if defined(HAVE_FCNTL) && ! defined(F_SETLK)
/*ABORT: "defined(HAVE_FCNTL) && ! defined(F_SETLK)"*/
#undef HAVE_FCNTL
#endif
#if defined(HAVE_LOCKF) && ! defined(F_LOCK)
/*ABORT: "defined(HAVE_LOCKF) && ! defined(F_LOCK)"*/
/* You must fix this up */
#undef HAVE_LOCKF
#endif
#if defined(HAVE_FLOCK) && ! defined(LOCK_EX)
/*AB0RT: "defined(HAVE_FLOCK) && ! defined(LOCK_EX)"*/
/* You must fix this up */
#undef HAVE_FLOCK
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
/* 4.2 BSD systems */
#ifndef S_IRUSR
# define S_IRUSR S_IREAD
# define S_IWUSR S_IWRITE
# define S_IXUSR S_IEXEC
# define S_IXGRP (S_IEXEC >> 3)
# define S_IXOTH (S_IEXEC >> 6)
#endif
#ifndef S_ISLNK
# define S_ISLNK(mode) (((mode) & S_IFLNK) == S_IFLNK)
#endif
#ifndef S_ISREG
# define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG)
#endif
#ifndef S_ISDIR
# define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR)
#endif
/* 4.2 BSD systems */
#ifndef SEEK_SET
# define SEEK_SET 0
# define SEEK_CUR 1
# define SEEK_END 2
#endif
#ifndef HAVE_KILLPG
# define killpg(pg,sig) ((int) kill ((pid_t)(-(pg)), (sig)))
#else
extern int killpg(pid_t pgrp, int sig);
#endif
/***********************************************************************
* wait() stuff: most recent systems support a compatability version
* of "union wait", but it's not as fully-featured as the recent stuff
* that uses an "int *". However, we want to keep support for the
* older BSD systems as much as possible, so it's still supported;
* however, if waitpid() exists, we're POSIX.1 compliant, and we should
* not use "union wait". (hack hack hack) (jm)
*
* I agree. See the waitchild.c code for a tour through the depths of
* portability hell.
*
* Patrick Powell Thu Apr 6 08:03:58 PDT 1995
*
***********************************************************************/
#ifdef HAVE_WAITPID
# undef HAVE_UNION_WAIT /* and good riddance */
#endif
/***************************************************************************
* HAVE_UNION_WAIT will be def'd by configure if it's in <sys/wait.h>,
* and isn't just there for compatibility (like it is on HP/UX).
***************************************************************************/
#ifdef HAVE_UNION_WAIT
typedef union wait plp_status_t;
/*
* with some BSDish systems, there are already #defines for this,
* so we should use them if they're there.
*/
# ifndef WCOREDUMP
# define WCOREDUMP(x) ((x).w_coredump)
# endif
# ifndef WEXITSTATUS
# define WEXITSTATUS(x) ((x).w_retcode)
# endif
# ifndef WTERMSIG
# define WTERMSIG(x) ((x).w_termsig)
# endif
# ifndef WIFSTOPPED
# define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED)
# endif
# ifndef WIFEXITED
# define WIFEXITED(x) ((x).w_stopval == WEXITED)
# endif
#else
typedef int plp_status_t;
/* The POSIX defaults for these macros. (this is cheating!) */
# ifndef WTERMSIG
# define WTERMSIG(x) ((x) & 0x7f)
# endif
# ifndef WCOREDUMP
# define WCOREDUMP(x) ((x) & 0x80)
# endif
# ifndef WEXITSTATUS
# define WEXITSTATUS(x) ((((unsigned) x) >> 8) & 0xff)
# endif
# ifndef WIFSIGNALED
# define WIFSIGNALED(x) (WTERMSIG (x) != 0)
# endif
# ifndef WIFEXITED
# define WIFEXITED(x) (WTERMSIG (x) == 0)
# endif
#endif /* HAVE_UNION_WAIT */
/***********************************************************************
* SVR4: SIGCHLD is really SIGCLD; #define it here.
* PLP lpd _does_ handle the compatibility semantics properly
* (Advanced UNIX Programming p. 281).
***********************************************************************/
#if !defined(SIGCHLD) && defined(SIGCLD)
# define SIGCHLD SIGCLD
#endif
/***********************************************************************
* configure will set RETSIGTYPE to the type returned by signal()
***********************************************************************/
typedef RETSIGTYPE plp_signal_t;
typedef plp_signal_t (*plp_sigfunc_t)(int) ;
#ifndef HAVE_GETDTABLESIZE
# ifdef NOFILE
# define getdtablesize() NOFILE
# else
# ifdef NOFILES_MAX
# define getdtablesize() NOFILES_MAX
# endif
# endif
#endif
#ifndef HAVE_STRDUP
# ifdef __STDC__
char *strdup(const char*);
# else
char *strdup();
# endif
#endif
#ifndef IPPORT_RESERVED
#define IPPORT_RESERVED 1024
#endif
/* varargs declarations: */
#if defined(HAVE_STDARG_H)
# include <stdarg.h>
# define HAVE_STDARGS /* let's hope that works everywhere (mj) */
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap, f)
# define VA_SHIFT(v,t) ; /* no-op for ANSI */
# define VA_END va_end(ap)
#else
# if defined(HAVE_VARARGS_H)
# include <varargs.h>
# undef HAVE_STDARGS
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap) /* f is ignored! */
# define VA_SHIFT(v,t) v = va_arg(ap,t)
# define VA_END va_end(ap)
# else
XX ** NO VARARGS ** XX
# endif
#endif
#if !defined(IS_ULTRIX) && defined(HAVE_SYSLOG_H)
# include <syslog.h>
#endif
#if defined(HAVE_SYS_SYSLOG_H)
# include <syslog.h>
#endif
# if !(defined(LOG_PID) && defined(LOG_NOWAIT) && defined(HAVE_OPENLOG))
# undef HAVE_OPENLOG
# endif /* LOG_PID && LOG_NOWAIT */
/*
* Priorities (these are ordered)
*/
#ifndef LOG_ERR
# define LOG_EMERG 0 /* system is unusable */
# define LOG_ALERT 1 /* action must be taken immediately */
# define LOG_CRIT 2 /* critical conditions */
# define LOG_ERR 3 /* error conditions */
# define LOG_WARNING 4 /* warning conditions */
# define LOG_NOTICE 5 /* normal but signification condition */
# define LOG_INFO 6 /* informational */
# define LOG_DEBUG 7 /* debug-level messages */
#endif
#ifdef LOG_LPR
# define SYSLOG_FACILITY LOG_LPR
#else
# ifdef LOG_LOCAL0
# define SYSLOG_FACILITY LOCAL0
# else
# define SYSLOG_FACILITY (0) /* for Ultrix -- facilities aren't supported */
# endif
#endif
/*************************************************************************
* If we have SVR4 and no setpgid() then we need getpgrp()
*************************************************************************/
#if defined(SVR4) || defined(__alpha__)
# undef HAVE_SETPGRP_0
#endif
/*
* NONBLOCKING Open and IO - different flags for
* different systems
*/
#ifndef O_NONBLOCK
#define O_NONBLOCK 0
#endif
#ifndef O_NOCTTY
#define O_NOCTTY 0
#endif
#define NONBLOCK (O_NDELAY|O_NONBLOCK)
#ifdef IS_HPUX
#undef NONBLOCK
#define NONBLOCK (O_NONBLOCK)
#endif
/*********************************************************************
* AIX systems need this
*********************************************************************/
#if defined(HAVE_SYS_SELECT_H)
# include <sys/select.h>
#endif
/**********************************************************************
* Signal blocking
**********************************************************************/
#ifdef HAVE_SIGPROCMASK
/* a signal set */
typedef sigset_t plp_block_mask;
#else
/* an integer */
typedef int plp_block_mask;
#endif
#define FD_SET_FIX(X) X
/**********************************************************************
* SUNOS Definitions
**********************************************************************/
#ifdef SUNOS
extern int _flsbuf(int, FILE *);
extern int _filbuf(FILE *);
extern int accept(int s, struct sockaddr *name, int *namelen);
extern int bind(int s, struct sockaddr *name, int namelen);
extern int connect(int s, struct sockaddr *name, int namelen);
extern void bzero(void *s, size_t n);
extern void endgrent( void );
extern int fflush( FILE *stream );
extern int fclose( FILE *stream );
extern int flock( int fd, int operation );
extern int fprintf(FILE *, const char *, ...);
extern int fputs( const char *, FILE *stream );
extern int fstat(int fd, struct stat *buf );
extern int fseek( FILE *stream, long offset, int ptrname );
extern int ftruncate( int fd, off_t length );
extern int fwrite( char *ptr, int size, int nitems, FILE *stream);
extern int getdtablesize( void );
extern int getpeername(int s, struct sockaddr *name, int *namelen);
extern int getsockname(int s, struct sockaddr *name, int *namelen);
extern int getsockopt(int s, int level, int optname, char *optval,int *optlen);
extern int ioctl(int fd, int request, caddr_t arg );
extern int killpg(int pgrp, int sig );
extern int listen(int s, int backlog );
extern int lockf(int fd, int cmd, long size );
/*extern int lseek(int fd, off_t pos, int how ); */
extern int lstat(const char *path, struct stat *buf );
#define memmove(dest,src,len) bcopy(src,dest,len)
extern void bcopy(char *src,char *dest,int len);
extern int mkstemp(char *s );
extern int openlog( const char *ident, int logopt, int facility );
extern int perror(const char *);
extern int printf( const char *, ...);
extern int rename(const char *, const char *);
extern int select (int width, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
extern void setgrent(void);
extern int setreuid( int ruid, int euid );
extern int setsockopt(int s, int level, int optname, const char *optval,int optlen);
extern int socket( int domain, int type, int protocol );
extern int socketpair(int, int, int, int *);
extern int sscanf( char *s, char *format, ... );
extern int stat(const char *path, struct stat *buf );
extern int strcasecmp( const char *, const char * );
extern char *strerror( int );
extern int strncasecmp( const char *, const char *, int n );
extern int long strtol( char *str, char **ptr, int base );
extern int strftime(char *buf, int bufsize, const char *fmt, struct tm *tm);
extern void syslog(int, const char *, ...);
extern int system( const char *str );
extern int tgetent( char *buffer, char *name );
extern time_t time( time_t *t );
extern int tolower( int );
extern int toupper( int );
extern void tputs( const char *cp, int affcnt, int (*outc)() );
extern int vfprintf(FILE *, const char *, ...);
extern int vprintf(FILE *, const char *, va_list ap);
#endif
#ifdef SOLARIS
extern int setreuid( uid_t ruid, uid_t euid );
extern int mkstemp(char *s );
#ifdef HAVE_GETDTABLESIZE
extern int getdtablesize(void);
#endif
#endif
#ifdef HPUX
extern void syslog(int, const char *, ...);
#if !defined(HAVE_OPENLOG_DEF)
extern int openlog( const char *ident, int logopt, int facility );
#endif
#undef FD_SET_FIX
#define FD_SET_FIX(X) (int *)
#endif
#ifdef IS_AIX32
extern int tgetent(char *, char *);
#if !defined(HAVE_OPENLOG_DEF)
void openlog(const char *, int, int);
void syslog(int, const char *, ...);
#endif
extern int seteuid(uid_t);
#endif
/* IPV6 structures define */
#if !defined(AF_INET6)
# define AF_INET6 24
#endif
#if defined(IN_ADDR6)
# define in6_addr in_addr6
# define IN6_ADDR
#endif
#if !defined(IN6_ADDR)
# define IN6_ADDR
# define SIN6_LEN 16
struct in6_addr { unsigned char s6_addr[SIN6_LEN]; };
struct sockaddr_in6 {
/* unsigned char sin6_len; */
unsigned char sin6_family;
unsigned short sin6_port;
unsigned int sin6_flowinfo;
struct in6_addr sin6_addr;
};
#endif
#endif /* PLP_PORTABLE_H */

277
src/snprintf.c Normal file
View File

@@ -0,0 +1,277 @@
/**************************************************************************
* LPRng IFHP Filter
* Copyright 1994-1997 Patrick Powell, San Diego, CA <papowell@sdsu.edu>
*
* Based on the CTI printer filters.
* See COPYRIGHT for details.
*
* $Id: snprintf.c,v 1.1 1997/05/30 18:53:55 papowell Exp $
*/
#include "portable.h"
static char *const _id = "$Id: snprintf.c,v 1.1 1997/05/30 18:53:55 papowell Exp $";
static void dopr();
static char *end;
/**************************************************************
* Original:
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
* A bombproof version of doprnt (dopr) included.
* Sigh. This sort of thing is always nasty do deal with. Note that
* the version here does not include floating point...
*
* plp_snprintf() is used instead of sprintf() as it does limit checks
* for string length. This covers a nasty loophole.
*
* The other functions are there to prevent NULL pointers from
* causing nast effects.
**************************************************************/
int show_ctrl;
int vplp_snprintf(str, count, fmt, args)
char *str;
size_t count;
const char *fmt;
va_list args;
{
str[0] = 0;
end = str+count-1;
dopr( str, fmt, args );
if( count>0 ){
end[0] = 0;
}
return(strlen(str));
}
/* VARARGS3 */
#ifdef HAVE_STDARGS
int plp_snprintf (char *str,size_t count,const char *fmt,...)
#else
int plp_snprintf (va_alist) va_dcl
#endif
{
#ifndef HAVE_STDARGS
char *str;
size_t count;
char *fmt;
#endif
VA_LOCAL_DECL
VA_START (fmt);
VA_SHIFT (str, char *);
VA_SHIFT (count, size_t );
VA_SHIFT (fmt, char *);
(void) vplp_snprintf ( str, count, fmt, ap);
VA_END;
return( strlen( str ) );
}
/*
* dopr(): poor man's version of doprintf
*/
static void fmtstr( char *value, int ljust, int len, int zpad );
static void fmtnum( long value, int base, int dosign,
int ljust, int len, int zpad );
static void dostr( char * );
static char *output;
static void dopr_outch( int c );
static void dopr( buffer, format, args )
char *buffer;
char *format;
va_list args;
{
int ch;
long value;
int longflag = 0;
char *strvalue;
int ljust;
int len;
int zpad;
output = buffer;
while( (ch = *format++) ){
switch( ch ){
case '%':
ljust = len = zpad = 0;
nextch:
ch = *format++;
switch( ch ){
case 0:
dostr( "**end of format**" );
return;
case '-': ljust = 1; goto nextch;
case '0': /* set zero padding if len not set */
if(len==0) zpad = '0';
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7': case '8': case '9':
len = len*10 + ch - '0';
goto nextch;
case 'l': longflag = 1; goto nextch;
case 'u': case 'U':
/*fmtnum(value,base,dosign,ljust,len,zpad) */
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 10,0, ljust, len, zpad ); break;
case 'o': case 'O':
/*fmtnum(value,base,dosign,ljust,len,zpad) */
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 8,0, ljust, len, zpad ); break;
case 'd': case 'D':
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 10,1, ljust, len, zpad ); break;
case 'x':
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value, 16,0, ljust, len, zpad ); break;
case 'X':
if( longflag ){
value = va_arg( args, long );
} else {
value = va_arg( args, int );
}
fmtnum( value,-16,0, ljust, len, zpad ); break;
case 's':
strvalue = va_arg( args, char *);
fmtstr( strvalue,ljust,len,zpad ); break;
case 'c':
ch = va_arg( args, int );
dopr_outch( ch ); break;
case '%': dopr_outch( ch ); continue;
default:
dostr( "???????" );
}
longflag = 0;
break;
default:
dopr_outch( ch );
break;
}
}
*output = 0;
}
static void
fmtstr( value, ljust, len, zpad )
char *value;
int ljust, len, zpad;
{
int padlen, strlen; /* amount to pad */
if( value == 0 ){
value = "<NULL>";
}
for( strlen = 0; value[strlen]; ++ strlen ); /* strlen */
padlen = len - strlen;
if( padlen < 0 ) padlen = 0;
if( ljust ) padlen = -padlen;
while( padlen > 0 ) {
dopr_outch( ' ' );
--padlen;
}
dostr( value );
while( padlen < 0 ) {
dopr_outch( ' ' );
++padlen;
}
}
static void
fmtnum( value, base, dosign, ljust, len, zpad )
long value;
int base, dosign, ljust, len, zpad;
{
int signvalue = 0;
unsigned long uvalue;
char convert[20];
int place = 0;
int padlen = 0; /* amount to pad */
int caps = 0;
/* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n",
value, base, dosign, ljust, len, zpad )); */
uvalue = value;
if( dosign ){
if( value < 0 ) {
signvalue = '-';
uvalue = -value;
}
}
if( base < 0 ){
caps = 1;
base = -base;
}
do{
convert[place++] =
(caps? "0123456789ABCDEF":"0123456789abcdef")
[uvalue % (unsigned)base ];
uvalue = (uvalue / (unsigned)base );
}while(uvalue);
convert[place] = 0;
padlen = len - place;
if( padlen < 0 ) padlen = 0;
if( ljust ) padlen = -padlen;
/* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n",
convert,place,signvalue,padlen)); */
if( zpad && padlen > 0 ){
if( signvalue ){
dopr_outch( signvalue );
--padlen;
signvalue = 0;
}
while( padlen > 0 ){
dopr_outch( zpad );
--padlen;
}
}
while( padlen > 0 ) {
dopr_outch( ' ' );
--padlen;
}
if( signvalue ) dopr_outch( signvalue );
while( place > 0 ) dopr_outch( convert[--place] );
while( padlen < 0 ){
dopr_outch( ' ' );
++padlen;
}
}
static void dostr( str )
char *str;
{
while(*str) dopr_outch(*str++);
}
static void dopr_outch( c )
int c;
{
if( show_ctrl ){
c = c & 0xFF;
if( iscntrl(c) && c != '\n' && c != '\t' ){
if( end == 0 || output < end ){
*output++ = '^';
}
c = (0x1F & c) | '@';
}
}
if( end == 0 || output < end ){
*output++ = c;
}
}

1002
src/stty.c Normal file
View File

File diff suppressed because it is too large Load Diff

1
src/version.h Normal file
View File

@@ -0,0 +1 @@
#define VERSION "lp_server-1.1.6"