mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-06 15:00:40 +08:00
merged with autoconf branch
This commit is contained in:
parent
708e5abb08
commit
2a869f5a99
19
COPYRIGHT
19
COPYRIGHT
@ -12,13 +12,14 @@ distribution. Information concerning is available at
|
||||
|
||||
This work also contains materials derived from public sources.
|
||||
|
||||
University of Michagan LDAP v3.3 Copyright Notice
|
||||
Copyright (c) 1992-1996 Regents of the University of Michigan.
|
||||
All rights reserved.
|
||||
---
|
||||
|
||||
Redistribution and use in source and binary forms are permitted
|
||||
provided that this notice is preserved and that due credit is given
|
||||
to the University of Michigan at Ann Arbor. The name of the University
|
||||
may not be used to endorse or promote products derived from this
|
||||
software without specific prior written permission. This software
|
||||
is provided ``as is'' without express or implied warranty.
|
||||
Portions Copyright (c) 1992-1996 Regents of the University of Michigan.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms are permitted
|
||||
provided that this notice is preserved and that due credit is given
|
||||
to the University of Michigan at Ann Arbor. The name of the University
|
||||
may not be used to endorse or promote products derived from this
|
||||
software without specific prior written permission. This software
|
||||
is provided ``as is'' without express or implied warranty.
|
||||
|
139
INSTALL
139
INSTALL
@ -17,72 +17,50 @@ these steps:
|
||||
|
||||
If you are reading this file, you probably have already done this!
|
||||
|
||||
2. copy Make-common.dist or Make-common.gmake to Make.common
|
||||
2. Type:
|
||||
% ./configure --help
|
||||
|
||||
3. edit the files Make-common and include/ldapconfig.h.edit to configure
|
||||
to list available configuration options. A description of
|
||||
these options is provided in the 'CONFIGURE OPTIONS' section
|
||||
below.
|
||||
|
||||
The configure script will also use your environmental
|
||||
variables for determining compiler/linker options.
|
||||
|
||||
These environment variables are used:
|
||||
CC C Compiler (cc, ecgs)
|
||||
CFLAGS C Flags (-ansi)
|
||||
CPPFLAGS CPP Flags (-I/path/include -Ddef)
|
||||
LDFLAGS LDFLAGS (-L/path/lib -llib)
|
||||
|
||||
A list of defines and other options are noted in the
|
||||
'DEFINES and FLAGS' comments below.
|
||||
|
||||
3. edit the file include/ldapconfig.h.edit to configure
|
||||
the software for your site (the files are well-commented):
|
||||
|
||||
% vi Make-common
|
||||
% vi include/ldapconfig.h.edit
|
||||
|
||||
Note that you should NOT need to edit the Makefile located at the
|
||||
top of the distribution.
|
||||
4. Configure the build system
|
||||
|
||||
If you just want to see if things will build, you can leave the
|
||||
configuration alone and change it later. You may want to consult
|
||||
the appropriate platform makefile (build/*/Make-platform) for
|
||||
platform-specific defaults.
|
||||
% [env settings] ./configure [options]
|
||||
|
||||
If you have the ISODE package built and want to build the
|
||||
LDAP-to-X.500 server (ldapd), be sure to uncomment the appropriate
|
||||
lines near the end of the Make-common file. By default only the
|
||||
stand-alone server, LDAP libraries and client software are built.
|
||||
If all goes well, the configure script with auto-detect the
|
||||
appropriate settings. Use configure enable/with options and/or
|
||||
environment variables to obtain desired results.
|
||||
|
||||
4. make the software:
|
||||
5. Build dependencies
|
||||
|
||||
% make depend
|
||||
|
||||
6. Build the system
|
||||
|
||||
% make
|
||||
|
||||
If all goes well, then make will figure out what platform you are on,
|
||||
pick a compiler to use, construct Makefiles, and build everything.
|
||||
If you see a message like "unknown platform..." LDAP has probably not
|
||||
been set up to build on your machine. See the file build/PORTS for
|
||||
hints on what to do in that case.
|
||||
|
||||
Note that if your make does not use the Bourne (sh) shell by
|
||||
default when executing internal scripts (reportedly the case on SGI
|
||||
machines at least), you will need to run the make explicitly from
|
||||
within a Bourne shell. If you a syntax error such as "Missing ]"
|
||||
when you do the make under your usual shell, try this:
|
||||
|
||||
% sh
|
||||
$ make
|
||||
|
||||
If you don't like the some of the platform-specific options chosen
|
||||
by the automatic build process (such as the compiler to use, etc),
|
||||
you can intervene and edit them before anything is actually compiled
|
||||
by explicitly doing a "make platform" step, editing the .make-platform
|
||||
file (actually a link to the file to be edited), and then doing a
|
||||
regular make:
|
||||
|
||||
% make platform
|
||||
% vi .make-platform
|
||||
% make
|
||||
|
||||
If you want to choose the build platform yourself from among those that
|
||||
the distribution supports, cd to the appropriate directory underneath
|
||||
build/platforms and make from there. For example, if you are on a
|
||||
machine running SunOS 4.1.4 and you want to force the use of the cc
|
||||
compiler, you would do this:
|
||||
|
||||
% cd build/platforms/sunos4-cc
|
||||
% make
|
||||
|
||||
If you want to run some simple tests after the build is complete, you
|
||||
can do this:
|
||||
|
||||
% make test
|
||||
|
||||
5. install the binaries and man pages. You may need to be superuser to
|
||||
If all goes well, the system will build as configured. If not,
|
||||
return to step 4 after reviewing the enable/with options settings.
|
||||
|
||||
7. install the binaries and man pages. You may need to be superuser to
|
||||
do this (depending on where you are installing things):
|
||||
|
||||
% su
|
||||
@ -104,34 +82,47 @@ these steps:
|
||||
Building LDAP For More Than One Platform
|
||||
|
||||
It is now possible to build LDAP for more than one platform from the same
|
||||
source tree. This is accomplished by some rules in the Makefiles that
|
||||
create a shadow (linked) directory tree where the binaries are placed.
|
||||
source tree. This is accomplished by using make(1) VPATH support. If
|
||||
your make(1) program is old and doesn't have VPATH support, install GNU
|
||||
Make.
|
||||
|
||||
Follow these steps for each different platform:
|
||||
|
||||
1. move to the directory that matches the platform and compiler you
|
||||
want to build for and type make. The directories are all located
|
||||
underneath the build/platforms directory. If your platform is not
|
||||
there, you may need to do a port - see the build/PORTS file for
|
||||
more information. For a Sun running SunOS 4.1.4, you might do
|
||||
this:
|
||||
1. Create a directory for the platform object files.
|
||||
|
||||
% cd build/platforms/sunos4-cc
|
||||
% make links
|
||||
% mkdir obj-platform
|
||||
|
||||
This will create a linked source area.
|
||||
2. Change your working directory to the platform object directory.
|
||||
|
||||
% cd obj-platform
|
||||
|
||||
3. Configure the build system
|
||||
|
||||
% [env settings] ../configure --src-dir=.. [options]
|
||||
|
||||
( replace ".." with the appropriate path )
|
||||
|
||||
4. Continue as above (starting at step 6).
|
||||
|
||||
Note: make depend in VPATH environment is not yet supported.
|
||||
|
||||
|
||||
2. move to the new directory and make as for a single platform. Follow steps
|
||||
1-4 above to accomplish this. For example:
|
||||
CONFIGURE OPTIONS
|
||||
|
||||
% cd obj-sunos4-cc
|
||||
% make
|
||||
Regrettably, this section has not been written (yet). See
|
||||
"./configure --help" for current list of options.
|
||||
|
||||
That's all there is to it. You can also create the linked source area(s)
|
||||
by just typing "make links" at the top of the distribution, in which case
|
||||
the Makefile will try to automatically determine the platform and
|
||||
compiler.
|
||||
|
||||
DEFINES and FLAGS
|
||||
|
||||
The configure script will also use your environmental
|
||||
variables for determining compiler/linker options. This can
|
||||
be used to manual specify features and compilation options.
|
||||
|
||||
Supported Environmental Variables
|
||||
CC C Compiler (cc, ecgs)
|
||||
CFLAGS C Flags (-ansi)
|
||||
CPPFLAGS CPP Flags (-I/path/include -Ddef)
|
||||
LDFLAGS LDFLAGS (-L/path/lib -llib)
|
||||
|
||||
End of OpenLDAP INSTALL file.
|
||||
|
298
Make-common.dist
298
Make-common.dist
@ -1,298 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted only
|
||||
# as authorized by the OpenLDAP Public License. A copy of this
|
||||
# license is available at http://www.OpenLDAP.org/license.html or
|
||||
# in file LICENSE in the top-level directory of the distribution.
|
||||
#
|
||||
# This work is derived from the University of Michigan LDAP v3.3
|
||||
# distribution. Information concerning is available at
|
||||
# http://www.umich.edu/~dirsvcs/ldap/ldap.html.
|
||||
#
|
||||
# This work also contains materials derived from public sources.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#-----------------------------------------------------------------------------
|
||||
# LDAP common Make defines (included in all but top-level Makefile)
|
||||
|
||||
#############################################################################
|
||||
## Edit the following variables to have appropriate values for your system ##
|
||||
#############################################################################
|
||||
|
||||
#
|
||||
# Note: Some make(1) programs do not understand the FOO?=BAR syntax.
|
||||
#
|
||||
# On such systems, you should use copy Make-common.gmake to Make-common
|
||||
# and use gmake to build the distribution.
|
||||
#
|
||||
|
||||
#############################################################################
|
||||
## LDAP install paths ##
|
||||
#############################################################################
|
||||
# by default, everything is installed below INSTROOT
|
||||
# config files, etc. are put in ETCDIR
|
||||
# include files get put in INCLUDEDIR
|
||||
# libraries are put in LIBDIR
|
||||
# man pages are put under MANDIR
|
||||
# programs end-users will run are put in BINDIR
|
||||
# programs sysadmins will run are put in SBINDIR
|
||||
# servers are put in LIBEXECDIR
|
||||
# pid/args files are put in RUNDIR
|
||||
#
|
||||
# Per platform defaults override these.
|
||||
#
|
||||
LDAP_PREFIX?= /usr/local
|
||||
LDAP_INSTROOT?= $(LDAP_PREFIX)
|
||||
LDAP_ETCDIR?= $(LDAP_INSTROOT)/etc/ldap
|
||||
LDAP_INCDIR?= $(LDAP_INSTROOT)/include
|
||||
LDAP_LIBDIR?= $(LDAP_INSTROOT)/lib
|
||||
LDAP_MANDIR?= $(LDAP_INSTROOT)/man
|
||||
LDAP_BINDIR?= $(LDAP_INSTROOT)/bin
|
||||
LDAP_SBINDIR?=$(LDAP_INSTROOT)/sbin
|
||||
LDAP_LIBEXECDIR?= $(LDAP_INSTROOT)/libexec
|
||||
LDAP_RUNDIR?= $(LDAP_ETCDIR)
|
||||
|
||||
#############################################################################
|
||||
## General compiler options ##
|
||||
#############################################################################
|
||||
# Passed to every compile (cc or gcc). This is where you put -O or -g, etc.
|
||||
#EXTRACFLAGS=-O -g
|
||||
#EXTRACFLAGS=-O
|
||||
EXTRACFLAGS?=-g
|
||||
# Passed to every link (ld). Include -g here if you did in EXTRACFLAGS.
|
||||
EXTRALDFLAGS?=-g
|
||||
|
||||
#############################################################################
|
||||
## If you are NOT using Kerberos authentication, you can skip this section.##
|
||||
#############################################################################
|
||||
#
|
||||
# Otherwise, to enable kerberos authentication, uncomment KERBEROS (and
|
||||
# AFSKERBEROS if you are running the AFS version of kerberos). Also
|
||||
# uncomment and change the various KRB* lines to point to where the
|
||||
# kerberos libraries and include files are installed at your site.
|
||||
#
|
||||
# *** NOTE ***
|
||||
# If you have an MIT Kerberos V distribution and you compiled it with -krb4
|
||||
# flag which enables Kerberos IV compatibility, uncomment KERBEROS_V -
|
||||
# this will make sure all your includes can be found where they actually are -
|
||||
# in this case /usr/local/kerberos/include/kerberosIV - simple change of
|
||||
# KRBINCLUDEFLAG will _not_ work. Also uncomment the correct KRBLIBS define.
|
||||
#
|
||||
# For Kerberos V with Kerberos IV compatibility uncomment the following line
|
||||
#KERBEROS=-DKERBEROS -DKERBEROS_V
|
||||
# For Kerberos IV uncomment the following line
|
||||
#KERBEROS=-DKERBEROS
|
||||
#
|
||||
#AFSKERBEROS=-DAFSKERBEROS
|
||||
#KRBINCLUDEFLAG = -I/usr/local/kerberos/include
|
||||
#KRBLIBFLAG = -L/usr/local/kerberos/lib
|
||||
# For Kerberos V with Kerberos IV compatibility uncomment the following line
|
||||
#KRBLIBS = -lkrb4 -lkrb5 -ldes425
|
||||
# For Kerberos IV uncomment the following line
|
||||
#KRBLIBS = -lkrb -ldes
|
||||
|
||||
#############################################################################
|
||||
## ISODE is required ONLY to build the ldap <-> X.500 server (ldapd) ##
|
||||
## If you don't want to build it, you can skip this section. ##
|
||||
#############################################################################
|
||||
#
|
||||
# To build the ldap server, uncomment the HAVEISODE line,
|
||||
# and the section describing build settings for your version of isode.
|
||||
#
|
||||
#HAVEISODE = yes
|
||||
# If you compiled ISODE with TURBO_DISK defined, uncomment this
|
||||
#ISODETURBOLIBS = -lgdbm
|
||||
# uncomment these to have ldapd "pretty print" protocol elements w/debugging
|
||||
#PEPSY_DUMP=-DPEPSY_DUMP
|
||||
#PEPSY=/usr/local/ic/bin/pepsy
|
||||
# uncommment this line to have ldapd load PP syntax handlers
|
||||
# you'll also need to add -lpp to ISODEBASELIBS below
|
||||
#LDAP_USE_PP=-DLDAP_USE_PP
|
||||
# uncomment NO_SETPROCTITLE to have ldapd NOT change its title
|
||||
#NO_SETPROCTITLE=-DNOSETPROCTITLE
|
||||
#
|
||||
# ISODE Consortium release build settings
|
||||
# You should change the next line so that ICRELEASE matches the (integer)
|
||||
# version number of whatever IC release you have, e.g. 1, 2, or 3 and
|
||||
# also uncomment the next 5 lines.
|
||||
#ICRELEASE=-DICRELEASE=1
|
||||
#ISODEPACKAGE=-DISODEPACKAGE=IC
|
||||
#ISODEINCLUDEFLAG= -I/usr/local/ic/include/isode -I/usr/local/ic/include
|
||||
#ISODELIBFLAG = -L/usr/local/ic/lib
|
||||
#ISODEBASELIBS = -lisode
|
||||
#
|
||||
# Freely available ISODE 8.0 release build settings (uncomment the next 4 lines)
|
||||
#ISODEPACKAGE=-DISODEPACKAGE
|
||||
#ISODEINCLUDEFLAG= -I/usr/local/isode/include
|
||||
#ISODELIBFLAG = -L/usr/local/isode/lib
|
||||
#ISODEBASELIBS = -ldsap -lisode
|
||||
#
|
||||
# NEXOR ISODE release build settings (uncomment the next 4 lines)
|
||||
#ISODEPACKAGE=-DISODEPACKAGE=XT
|
||||
#ISODEINCLUDEFLAG= -I/usr/include/isode
|
||||
#ISODELIBFLAG = -L/usr/local/lib -L/usr/sunlink/osi/lib
|
||||
#ISODEBASELIBS = -lxtpp -lresolv -lxtdsap -lxtisode -losi
|
||||
|
||||
#############################################################################
|
||||
## If you don't want to run slapd, skip this section. ##
|
||||
#############################################################################
|
||||
#
|
||||
# To build slapd (the stand-alone ldap daemon), uncomment the MAKESLAPD
|
||||
# line and select the SLAPD_BACKENDS you want to use. If you enable the
|
||||
# LDBM backend, also select one of the LDBM backends.
|
||||
MAKESLAPD= yes
|
||||
#
|
||||
# remove the defines for backends you don't want to enable
|
||||
SLAPD_BACKENDS= -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD
|
||||
#
|
||||
# If you have included -DLDAP_LDBM in the SLAPD_BACKENDS line,
|
||||
# which low-level database package to use must be specified. You
|
||||
# may want to overide the platform settings by disabling the lines
|
||||
# below and hardcoding the desired settings.
|
||||
#
|
||||
# The four choices: Berkeley db b-tree, Berkeley db hash, GNU dbm, or ndbm.
|
||||
# You will also need to edit the include and lib strings appropriately.
|
||||
# standard unix ndbm
|
||||
|
||||
# Fallback settings, defaults are set in build/*/Make-platform
|
||||
# The NDBM interface may not work on some (any) platforms.
|
||||
# You may be happier with Berkeley DB B-trees.
|
||||
LDBMBACKEND?=-DLDBM_USE_NDBM
|
||||
LDBMINCLUDE?=
|
||||
LDBMLIB?=
|
||||
|
||||
# LDBM Hardcode Setting Examples (may require editing)
|
||||
# berkeley db btree package
|
||||
#LDBMLIB=-ldb
|
||||
#LDBMBACKEND=-DLDBM_USE_DBBTREE
|
||||
#LDBMINCLUDE=-I/usr/local/db/include
|
||||
#LDBMLIB?=-ldb
|
||||
# berkeley db hash package
|
||||
#LDBMBACKEND=-DLDBM_USE_DBHASH
|
||||
#LDBMINCLUDE=-I/usr/local/db/include
|
||||
#LDBMLIB=-ldb
|
||||
# gnu dbm (gdbm)
|
||||
#LDBMBACKEND=-DLDBM_USE_GDBM
|
||||
#LDBMINCLUDE=-I/usr/local/gdbm/include
|
||||
#LDBMLIB=-lgdbm
|
||||
|
||||
#undef these if you have SleepyCat DB2 installed the updated DBI
|
||||
#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2
|
||||
#LDBMINCLUDE=-I/usr/local/include
|
||||
#LDBMLIB=-L/usr/local/lib -ldb
|
||||
|
||||
#undef these if you have SleepyCat DB2 installed (with compat185)
|
||||
#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2_COMPAT185
|
||||
#LDBMINCLUDE=-I/usr/local/include
|
||||
#LDBMLIB=-L/usr/local/lib -ldb
|
||||
|
||||
# if you want to use a non-default threads package change the defines below
|
||||
# to one of:
|
||||
# -DPOSIX_THREADS (draft 10 or standard)
|
||||
# -DTHREAD_MIT_PTHREADS (draft 4)
|
||||
# -DTHREAD_NEXT_CTHREADS
|
||||
# -DTHREAD_DCE_PTHREADS
|
||||
# -DTHREAD_SUNOS4_LWP
|
||||
# -DTHREAD_SUNOS5_LWP
|
||||
# and select the appropriate library.
|
||||
THREADS?=-DNO_THREADS
|
||||
THREADSLIB?=
|
||||
|
||||
# Locations of auxilary programs
|
||||
# (excepts to below are generally defined in Make-platform)
|
||||
LDAP_SENDMAIL?=/usr/lib/sendmail
|
||||
LDAP_EDITOR?=/usr/ucb/vi
|
||||
LDAP_FINGER?=/usr/ucb/finger
|
||||
|
||||
# For generation of compressed man pages
|
||||
# (excepts to below are generally defined in Make-platform)
|
||||
MANCOMPRESS?=cat
|
||||
MANCOMPRESSSUFFIX?=
|
||||
|
||||
#############################################################################
|
||||
## The following options are used by the xax500 client. If you haven't ##
|
||||
## retrieved the xax500 source and dropped it into the "clients" ##
|
||||
## directory, you can skip this section. ##
|
||||
#############################################################################
|
||||
#
|
||||
# location of your X include files
|
||||
#XINCLUDES= -I/usr/X11/include
|
||||
#
|
||||
# location of your X libraries
|
||||
#XLIBDIRS=-L/usr/X11/lib
|
||||
#
|
||||
# include any extra X libraries you need here
|
||||
# the following works with sunos 4 and X11R5
|
||||
#XLIBS = $(XLIBDIRS) -lXm -lXt -lX11
|
||||
# the following has been known to work with Solaris 2.4 and X11R6
|
||||
#XLIBS = $(XLIBDIRS) -lXm -lXext -lSM -lICE -lXpm -lXt -lX11
|
||||
|
||||
#############################################################################
|
||||
## If you don't want to do auto-translation of character sets, skip this ##
|
||||
#############################################################################
|
||||
#
|
||||
# Otherwise, uncomment this line and set the following options.
|
||||
#STR_TRANSLATION=-DSTR_TRANSLATION
|
||||
#
|
||||
# remove the defines for LDAP client library T.61 character translation
|
||||
# you do not need. If you use LDAP_CHARSET_8859, replace the '1' in "88591"
|
||||
# with the number of the particular character set you use. E.g., use "88594"
|
||||
# if you use the ISO 8859-4 chracter set.
|
||||
#LIBLDAP_CHARSETS=-DLDAP_CHARSET_8859="88591"
|
||||
#
|
||||
# uncomment one these lines to enable automatic T.61 translation by default
|
||||
#LIBLDAP_DEF_CHARSET=-DLDAP_DEFAULT_CHARSET=LDAP_CHARSET_8859
|
||||
|
||||
#############################################################################
|
||||
## General options ##
|
||||
#############################################################################
|
||||
# uncomment this line to enable debugging code (a good idea)
|
||||
LDAP_DEBUG=-DLDAP_DEBUG
|
||||
|
||||
# uncomment this line to turn on a few U of Michigan specific things
|
||||
#UOFM=-DUOFM
|
||||
|
||||
# uncomment this line to delete a few printfs in the lber and ldap libraries.
|
||||
#NO_USERINTERFACE=-DNO_USERINTERFACE
|
||||
|
||||
# uncomment this line to include Connectionless LDAP support
|
||||
#CLDAP=-DCLDAP
|
||||
|
||||
# uncomment this line to eliminate local caching support in the libldap
|
||||
#NO_CACHE=-DNO_CACHE
|
||||
|
||||
# uncomment this line to do reverse lookups (useful for doing ACLs
|
||||
# by host/domain names)
|
||||
LDAP_REVERSE_LOOKUP=-DREVERSE_LOOKUP
|
||||
|
||||
# uncomment this line to enable support for LDAP referrals in libldap
|
||||
LDAP_REFERRALS=-DLDAP_REFERRALS
|
||||
|
||||
# uncomment this line to enable ACL by groups
|
||||
# LDAP_ACLGROUP=-DACLGROUP
|
||||
|
||||
# uncomment these lines to enable support for CRYPT, SHA1, and/or MD5 passwords
|
||||
# in LDBM. Crypt uses platform provided crypt(3).
|
||||
# LDAP_CRYPT=-DLDAP_CRYPT -DLDAP_SHA1 -DLDAP_MD5
|
||||
# LDAP_CRYPT_LIB?=
|
||||
# and comment this line out
|
||||
LDAP_CRYPT_LIB=
|
||||
|
||||
# uncomment these lines to enable support fro tcp_wrappers in servers.
|
||||
# Requires tcp_wrappers.
|
||||
# LDAP_TCP_WRAPPERS=-DTCP_WRAPPERS -I/usr/local/include
|
||||
# LDAP_TCP_WRAPPERS_LIB=-L/usr/local/lib -lwrap
|
||||
|
||||
# uncomment this line to use soundex for approximate matches in slapd.
|
||||
# the default is to use the metaphone algorithm.
|
||||
#PHONETIC=-DSOUNDEX
|
@ -1,343 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted only
|
||||
# as authorized by the OpenLDAP Public License. A copy of this
|
||||
# license is available at http://www.OpenLDAP.org/license.html or
|
||||
# in file LICENSE in the top-level directory of the distribution.
|
||||
#
|
||||
# This work is derived from the University of Michigan LDAP v3.3
|
||||
# distribution. Information concerning is available at
|
||||
# http://www.umich.edu/~dirsvcs/ldap/ldap.html.
|
||||
#
|
||||
# This work also contains materials derived from public sources.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#-----------------------------------------------------------------------------
|
||||
# LDAP common Make defines (included in all but top-level Makefile)
|
||||
|
||||
#############################################################################
|
||||
## Edit the following variables to have appropriate values for your system ##
|
||||
#############################################################################
|
||||
|
||||
#
|
||||
# This template should be used by systems with Gnu Make.
|
||||
#
|
||||
# If Gnu make is not installed as make, you must uncomment out
|
||||
# this line.
|
||||
#MAKE=gmake
|
||||
|
||||
#############################################################################
|
||||
## LDAP install paths ##
|
||||
#############################################################################
|
||||
# by default, everything is installed below INSTROOT
|
||||
# config files, etc. are put in ETCDIR
|
||||
# include files get put in INCLUDEDIR
|
||||
# libraries are put in LIBDIR
|
||||
# man pages are put under MANDIR
|
||||
# programs end-users will run are put in BINDIR
|
||||
# programs sysadmins will run are put in SBINDIR
|
||||
# servers are put in LIBEXECDIR
|
||||
# pid/args files are put in RUNDIR
|
||||
#
|
||||
# Per platform defaults override these.
|
||||
#
|
||||
ifndef LDAP_PREFIX
|
||||
LDAP_PREFIX= /usr/local
|
||||
endif
|
||||
ifndef LDAP_INSTROOT
|
||||
LDAP_INSTROOT= $(LDAP_PREFIX)
|
||||
endif
|
||||
ifndef LDAP_ETCDIR
|
||||
LDAP_ETCDIR= $(LDAP_INSTROOT)/etc/ldap
|
||||
endif
|
||||
ifndef LDAP_INCDIR
|
||||
LDAP_INCDIR= $(LDAP_INSTROOT)/include
|
||||
endif
|
||||
ifndef LDAP_LIBDIR
|
||||
LDAP_LIBDIR= $(LDAP_INSTROOT)/lib
|
||||
endif
|
||||
ifndef LDAP_MANDIR
|
||||
LDAP_MANDIR= $(LDAP_INSTROOT)/man
|
||||
endif
|
||||
ifndef LDAP_BINDIR
|
||||
LDAP_BINDIR= $(LDAP_INSTROOT)/bin
|
||||
endif
|
||||
ifndef LDAP_SBINDIR
|
||||
LDAP_SBINDIR=$(LDAP_INSTROOT)/sbin
|
||||
endif
|
||||
ifndef LDAP_LIBEXECDIR
|
||||
LDAP_LIBEXECDIR= $(LDAP_INSTROOT)/libexec
|
||||
endif
|
||||
ifndef LDAP_RUNDIR
|
||||
LDAP_RUNDIR= $(LDAP_ETCDIR)
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
## General compiler options ##
|
||||
#############################################################################
|
||||
# Passed to every compile (cc or gcc). This is where you put -O or -g, etc.
|
||||
#EXTRACFLAGS=-O -g
|
||||
#EXTRACFLAGS=-O
|
||||
ifndef EXTRACFLAGS
|
||||
EXTRACFLAGS?=-g
|
||||
endif
|
||||
# Passed to every link (ld). Include -g here if you did in EXTRACFLAGS.
|
||||
ifndef EXTRALDFLAGS
|
||||
EXTRALDFLAGS=-g
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
## If you are NOT using Kerberos authentication, you can skip this section.##
|
||||
#############################################################################
|
||||
#
|
||||
# Otherwise, to enable kerberos authentication, uncomment KERBEROS (and
|
||||
# AFSKERBEROS if you are running the AFS version of kerberos). Also
|
||||
# uncomment and change the various KRB* lines to point to where the
|
||||
# kerberos libraries and include files are installed at your site.
|
||||
#
|
||||
# *** NOTE ***
|
||||
# If you have an MIT Kerberos V distribution and you compiled it with -krb4
|
||||
# flag which enables Kerberos IV compatibility, uncomment KERBEROS_V -
|
||||
# this will make sure all your includes can be found where they actually are -
|
||||
# in this case /usr/local/kerberos/include/kerberosIV - simple change of
|
||||
# KRBINCLUDEFLAG will _not_ work. Also uncomment the correct KRBLIBS define.
|
||||
#
|
||||
# For Kerberos V with Kerberos IV compatibility uncomment the following line
|
||||
#KERBEROS=-DKERBEROS -DKERBEROS_V
|
||||
# For Kerberos IV uncomment the following line
|
||||
#KERBEROS=-DKERBEROS
|
||||
#
|
||||
#AFSKERBEROS=-DAFSKERBEROS
|
||||
#KRBINCLUDEFLAG = -I/usr/local/kerberos/include
|
||||
#KRBLIBFLAG = -L/usr/local/kerberos/lib
|
||||
# For Kerberos V with Kerberos IV compatibility uncomment the following line
|
||||
#KRBLIBS = -lkrb4 -lkrb5 -ldes425
|
||||
# For Kerberos IV uncomment the following line
|
||||
#KRBLIBS = -lkrb -ldes
|
||||
|
||||
#############################################################################
|
||||
## ISODE is required ONLY to build the ldap <-> X.500 server (ldapd) ##
|
||||
## If you don't want to build it, you can skip this section. ##
|
||||
#############################################################################
|
||||
#
|
||||
# To build the ldap server, uncomment the HAVEISODE line,
|
||||
# and the section describing build settings for your version of isode.
|
||||
#
|
||||
#HAVEISODE = yes
|
||||
# If you compiled ISODE with TURBO_DISK defined, uncomment this
|
||||
#ISODETURBOLIBS = -lgdbm
|
||||
# uncomment these to have ldapd "pretty print" protocol elements w/debugging
|
||||
#PEPSY_DUMP=-DPEPSY_DUMP
|
||||
#PEPSY=/usr/local/ic/bin/pepsy
|
||||
# uncommment this line to have ldapd load PP syntax handlers
|
||||
# you'll also need to add -lpp to ISODEBASELIBS below
|
||||
#LDAP_USE_PP=-DLDAP_USE_PP
|
||||
# uncomment NO_SETPROCTITLE to have ldapd NOT change its title
|
||||
#NO_SETPROCTITLE=-DNOSETPROCTITLE
|
||||
#
|
||||
# ISODE Consortium release build settings
|
||||
# You should change the next line so that ICRELEASE matches the (integer)
|
||||
# version number of whatever IC release you have, e.g. 1, 2, or 3 and
|
||||
# also uncomment the next 5 lines.
|
||||
#ICRELEASE=-DICRELEASE=1
|
||||
#ISODEPACKAGE=-DISODEPACKAGE=IC
|
||||
#ISODEINCLUDEFLAG= -I/usr/local/ic/include/isode -I/usr/local/ic/include
|
||||
#ISODELIBFLAG = -L/usr/local/ic/lib
|
||||
#ISODEBASELIBS = -lisode
|
||||
#
|
||||
# Freely available ISODE 8.0 release build settings (uncomment the next 4 lines)
|
||||
#ISODEPACKAGE=-DISODEPACKAGE
|
||||
#ISODEINCLUDEFLAG= -I/usr/local/isode/include
|
||||
#ISODELIBFLAG = -L/usr/local/isode/lib
|
||||
#ISODEBASELIBS = -ldsap -lisode
|
||||
#
|
||||
# NEXOR ISODE release build settings (uncomment the next 4 lines)
|
||||
#ISODEPACKAGE=-DISODEPACKAGE=XT
|
||||
#ISODEINCLUDEFLAG= -I/usr/include/isode
|
||||
#ISODELIBFLAG = -L/usr/local/lib -L/usr/sunlink/osi/lib
|
||||
#ISODEBASELIBS = -lxtpp -lresolv -lxtdsap -lxtisode -losi
|
||||
|
||||
#############################################################################
|
||||
## If you don't want to run slapd, skip this section. ##
|
||||
#############################################################################
|
||||
#
|
||||
# To build slapd (the stand-alone ldap daemon), uncomment the MAKESLAPD
|
||||
# line and select the SLAPD_BACKENDS you want to use. If you enable the
|
||||
# LDBM backend, also select one of the LDBM backends.
|
||||
MAKESLAPD= yes
|
||||
#
|
||||
# remove the defines for backends you don't want to enable
|
||||
SLAPD_BACKENDS= -DLDAP_LDBM -DLDAP_SHELL -DLDAP_PASSWD
|
||||
#
|
||||
# If you have included -DLDAP_LDBM in the SLAPD_BACKENDS line,
|
||||
# which low-level database package to use must be specified. You
|
||||
# may want to overide the platform settings by disabling the lines
|
||||
# below and hardcoding the desired settings.
|
||||
#
|
||||
# The four choices: Berkeley db b-tree, Berkeley db hash, GNU dbm, or ndbm.
|
||||
# You will also need to edit the include and lib strings appropriately.
|
||||
# standard unix ndbm
|
||||
|
||||
# Fallback settings, defaults are set in build/*/Make-platform
|
||||
# The NDBM interface may not work on some (any) platforms.
|
||||
# You may be happier with Berkeley DB B-trees.
|
||||
ifndef LDBMBACKEND
|
||||
LDBMBACKEND=-DLDBM_USE_NDBM
|
||||
endif
|
||||
ifndef LDBMINCLUDE
|
||||
LDBMINCLUDE=
|
||||
endif
|
||||
ifndef LDBMLIB
|
||||
LDBMLIB=
|
||||
endif
|
||||
|
||||
# LDBM Hardcode Setting Examples (may require editing)
|
||||
# berkeley db btree package
|
||||
#LDBMLIB=-ldb
|
||||
#LDBMBACKEND=-DLDBM_USE_DBBTREE
|
||||
#LDBMINCLUDE=-I/usr/local/db/include
|
||||
#LDBMLIB?=-ldb
|
||||
# berkeley db hash package
|
||||
#LDBMBACKEND=-DLDBM_USE_DBHASH
|
||||
#LDBMINCLUDE=-I/usr/local/db/include
|
||||
#LDBMLIB=-ldb
|
||||
# gnu dbm (gdbm)
|
||||
#LDBMBACKEND=-DLDBM_USE_GDBM
|
||||
#LDBMINCLUDE=-I/usr/local/gdbm/include
|
||||
#LDBMLIB=-lgdbm
|
||||
|
||||
#undef these if you have SleepyCat DB2 installed the updated DBI
|
||||
#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2
|
||||
#LDBMINCLUDE=-I/usr/local/include
|
||||
#LDBMLIB=-L/usr/local/lib -ldb
|
||||
|
||||
#undef these if you have SleepyCat DB2 installed (with compat185)
|
||||
#LDBMBACKEND=-DLDBM_USE_DBBTREE -DLDBM_USE_DB2_COMPAT185
|
||||
#LDBMINCLUDE=-I/usr/local/include
|
||||
#LDBMLIB=-L/usr/local/lib -ldb
|
||||
|
||||
# if you want to use a non-default threads package change the defines below
|
||||
# to one of:
|
||||
# -DPOSIX_THREADS (draft 10 or standard)
|
||||
# -DTHREAD_MIT_PTHREADS (draft 4)
|
||||
# -DTHREAD_NEXT_CTHREADS
|
||||
# -DTHREAD_DCE_PTHREADS
|
||||
# -DTHREAD_SUNOS4_LWP
|
||||
# -DTHREAD_SUNOS5_LWP
|
||||
# and select the appropriate library.
|
||||
|
||||
ifndef THREADS
|
||||
THREADS=-DNO_THREADS
|
||||
endif
|
||||
ifndef THREADSLIB
|
||||
THREADSLIB=
|
||||
endif
|
||||
|
||||
# Locations of auxilary programs
|
||||
# (excepts to below are generally defined in Make-platform)
|
||||
ifndef LDAP_SENDMAIL
|
||||
LDAP_SENDMAIL=/usr/lib/sendmail
|
||||
endif
|
||||
ifndef LDAP_EDITOR
|
||||
LDAP_EDITOR=/usr/ucb/vi
|
||||
endif
|
||||
ifndef LDAP_FINGER
|
||||
LDAP_FINGER=/usr/ucb/finger
|
||||
endif
|
||||
|
||||
# For generation of compressed man pages
|
||||
# (excepts to below are generally defined in Make-platform)
|
||||
ifndef MANCOMPRESS
|
||||
MANCOMPRESS=cat
|
||||
endif
|
||||
ifndef MANCOMPRESSSUFFIX
|
||||
MANCOMPRESSSUFFIX=
|
||||
endif
|
||||
|
||||
#############################################################################
|
||||
## The following options are used by the xax500 client. If you haven't ##
|
||||
## retrieved the xax500 source and dropped it into the "clients" ##
|
||||
## directory, you can skip this section. ##
|
||||
#############################################################################
|
||||
#
|
||||
# location of your X include files
|
||||
#XINCLUDES= -I/usr/X11/include
|
||||
#
|
||||
# location of your X libraries
|
||||
#XLIBDIRS=-L/usr/X11/lib
|
||||
#
|
||||
# include any extra X libraries you need here
|
||||
# the following works with sunos 4 and X11R5
|
||||
#XLIBS = $(XLIBDIRS) -lXm -lXt -lX11
|
||||
# the following has been known to work with Solaris 2.4 and X11R6
|
||||
#XLIBS = $(XLIBDIRS) -lXm -lXext -lSM -lICE -lXpm -lXt -lX11
|
||||
|
||||
#############################################################################
|
||||
## If you don't want to do auto-translation of character sets, skip this ##
|
||||
#############################################################################
|
||||
#
|
||||
# Otherwise, uncomment this line and set the following options.
|
||||
#STR_TRANSLATION=-DSTR_TRANSLATION
|
||||
#
|
||||
# remove the defines for LDAP client library T.61 character translation
|
||||
# you do not need. If you use LDAP_CHARSET_8859, replace the '1' in "88591"
|
||||
# with the number of the particular character set you use. E.g., use "88594"
|
||||
# if you use the ISO 8859-4 chracter set.
|
||||
#LIBLDAP_CHARSETS=-DLDAP_CHARSET_8859="88591"
|
||||
#
|
||||
# uncomment one these lines to enable automatic T.61 translation by default
|
||||
#LIBLDAP_DEF_CHARSET=-DLDAP_DEFAULT_CHARSET=LDAP_CHARSET_8859
|
||||
|
||||
#############################################################################
|
||||
## General options ##
|
||||
#############################################################################
|
||||
# uncomment this line to enable debugging code (a good idea)
|
||||
LDAP_DEBUG=-DLDAP_DEBUG
|
||||
|
||||
# uncomment this line to turn on a few U of Michigan specific things
|
||||
#UOFM=-DUOFM
|
||||
|
||||
# uncomment this line to delete a few printfs in the lber and ldap libraries.
|
||||
#NO_USERINTERFACE=-DNO_USERINTERFACE
|
||||
|
||||
# uncomment this line to include Connectionless LDAP support
|
||||
#CLDAP=-DCLDAP
|
||||
|
||||
# uncomment this line to eliminate local caching support in the libldap
|
||||
#NO_CACHE=-DNO_CACHE
|
||||
|
||||
# uncomment this line to do reverse lookups (useful for doing ACLs
|
||||
# by host/domain names)
|
||||
LDAP_REVERSE_LOOKUP=-DREVERSE_LOOKUP
|
||||
|
||||
# uncomment this line to enable support for LDAP referrals in libldap
|
||||
LDAP_REFERRALS=-DLDAP_REFERRALS
|
||||
|
||||
# uncomment this line to enable ACL by groups
|
||||
# LDAP_ACLGROUP=-DACLGROUP
|
||||
|
||||
# uncomment these lines to enable support for CRYPT, SHA1, and/or MD5 passwords
|
||||
# in LDBM. Crypt uses platform provided crypt(3).
|
||||
# LDAP_CRYPT=-DLDAP_CRYPT -DLDAP_SHA1 -DLDAP_MD5
|
||||
# LDAP_CRYPT_LIB=
|
||||
# and comment this line out
|
||||
LDAP_CRYPT_LIB=
|
||||
|
||||
# uncomment these lines to enable support fro tcp_wrappers in servers.
|
||||
# Requires tcp_wrappers.
|
||||
# LDAP_TCP_WRAPPERS=-DTCP_WRAPPERS -I/usr/local/include
|
||||
# LDAP_TCP_WRAPPERS_LIB=-L/usr/local/lib -lwrap
|
||||
|
||||
# uncomment this line to use soundex for approximate matches in slapd.
|
||||
# the default is to use the metaphone algorithm.
|
||||
#PHONETIC=-DSOUNDEX
|
425
Makefile
425
Makefile
@ -1,425 +0,0 @@
|
||||
# You will usually NOT need to edit this file at all: instead, edit the
|
||||
# Make-common file. See the LDAP INSTALL file for more information.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted only
|
||||
# as authorized by the OpenLDAP Public License. A copy of this
|
||||
# license is available at http://www.OpenLDAP.org/license.html or
|
||||
# in file LICENSE in the top-level directory of the distribution.
|
||||
#
|
||||
# This work is derived from the University of Michigan LDAP v3.3
|
||||
# distribution. Information concerning is available at
|
||||
# http://www.umich.edu/~dirsvcs/ldap/ldap.html.
|
||||
#
|
||||
# This work also contains materials derived from public sources.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#-----------------------------------------------------------------------------
|
||||
# LDAP lightweight X.500 Directory access top level makefile
|
||||
#
|
||||
############################################################################
|
||||
# #
|
||||
# Usually you will not need to edit anything in this file #
|
||||
# #
|
||||
############################################################################
|
||||
#
|
||||
# Note that these definitions of standard Unix utilities are only used
|
||||
# in this Makefile. The Make-common (and .make-platform) files have a
|
||||
# similar set of definitions that are used in all the other LDAP Makefiles.
|
||||
#
|
||||
RM=rm -f
|
||||
MV=mv -f
|
||||
CP=cp
|
||||
CAT=cat
|
||||
PWD=pwd
|
||||
TAIL=tail
|
||||
CHMOD=chmod
|
||||
FIND=find
|
||||
SED=sed
|
||||
LN=ln -s
|
||||
MKDIR=mkdir
|
||||
GREP=grep
|
||||
DIRNAME=dirname
|
||||
BASENAME=basename
|
||||
TAR=tar
|
||||
COMPRESS=compress
|
||||
CO=co
|
||||
CI=ci
|
||||
|
||||
|
||||
SRCDIRS= include libraries clients servers doc
|
||||
TESTDIR= tests
|
||||
|
||||
#
|
||||
# LDAPSRC is used by the links rule
|
||||
#
|
||||
LDAPSRC= ..
|
||||
|
||||
|
||||
#
|
||||
# rules to make the software
|
||||
#
|
||||
|
||||
all: makeconfig
|
||||
@echo "making all"
|
||||
@for i in $(SRCDIRS); do \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) all ); \
|
||||
done
|
||||
|
||||
lib-only: makeconfig
|
||||
@echo "making libraries only"
|
||||
@echo " cd include; $(MAKE) $(MFLAGS) all"; \
|
||||
cd include; $(MAKE) $(MFLAGS) all
|
||||
@echo " cd libraries; $(MAKE) $(MFLAGS) all"; \
|
||||
cd libraries; $(MAKE) $(MFLAGS) all
|
||||
|
||||
|
||||
#
|
||||
# rules to install the software
|
||||
#
|
||||
|
||||
install: makeconfig
|
||||
@for i in $(SRCDIRS); do \
|
||||
echo; echo "cd $$i; $(MAKE) $(MFLAGS) install"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) install ); \
|
||||
done
|
||||
|
||||
inst-lib: makeconfig
|
||||
@echo "cd libraries; $(MAKE) $(MFLAGS) install"
|
||||
@( cd libraries; $(MAKE) $(MFLAGS) install )
|
||||
|
||||
|
||||
#
|
||||
# rules to test the LDAP software
|
||||
#
|
||||
test: all
|
||||
@echo " cd $(TESTDIR); $(MAKE) $(MFLAGS) all"; \
|
||||
( cd $(TESTDIR); $(MAKE) $(MFLAGS) all );
|
||||
|
||||
#
|
||||
# rules to make clean
|
||||
#
|
||||
|
||||
clean: FORCE
|
||||
@if [ -f .makefiles ]; then \
|
||||
for i in $(SRCDIRS) $(TESTDIR); do \
|
||||
echo; echo "cd $$i; $(MAKE) $(MFLAGS) clean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) clean ); \
|
||||
done; \
|
||||
fi; \
|
||||
( for d in ./obj-*; do \
|
||||
if [ $$d != "./obj-*" ]; then \
|
||||
( echo "making clean in $$d..."; \
|
||||
cd $$d; $(MAKE) $(MFLAGS) clean; ) \
|
||||
else \
|
||||
exit 0; \
|
||||
fi; \
|
||||
done )
|
||||
|
||||
veryclean: FORCE
|
||||
@echo; echo "cd build; $(MAKE) $(MFLAGS) -f Make-template veryclean"; \
|
||||
( cd build; $(MAKE) $(MFLAGS) -f Make-template veryclean ); \
|
||||
if [ -f .makefiles ]; then \
|
||||
for i in $(SRCDIRS) $(TESTDIR); do \
|
||||
echo; echo "cd $$i; $(MAKE) $(MFLAGS) veryclean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
|
||||
done; \
|
||||
echo "finding and removing Makefiles..."; \
|
||||
for i in `$(FIND) . -type d -print`; do \
|
||||
if [ -f $$i/Make-template ]; then \
|
||||
echo "removing file $$i/Makefile"; \
|
||||
$(RM) $$i/Makefile; \
|
||||
fi; \
|
||||
done; \
|
||||
echo "removing file .makefiles"; \
|
||||
$(RM) .makefiles; \
|
||||
fi; \
|
||||
( for d in ./obj-*; do \
|
||||
if [ $$d != "./obj-*" ]; then \
|
||||
echo "removing $$d..."; $(RM) -r $$d; \
|
||||
else \
|
||||
exit 0; \
|
||||
fi; \
|
||||
done ); \
|
||||
if [ -f .make-platform ]; then \
|
||||
echo "removing link .make-platform"; \
|
||||
$(RM) .make-platform; \
|
||||
else \
|
||||
exit 0; \
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# rules to make depend
|
||||
#
|
||||
#
|
||||
depend: makeconfig
|
||||
@echo "making depend everywhere"; \
|
||||
echo " cd include; $(MAKE) $(MFLAGS) all"; \
|
||||
( cd include; $(MAKE) $(MFLAGS) all ); \
|
||||
for i in $(SRCDIRS); do \
|
||||
echo; echo "cd $$i; $(MAKE) $(MFLAGS) depend"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) depend ); \
|
||||
done;
|
||||
@echo " "; echo Remember to \"make depend\" after each \"make makefiles\"
|
||||
|
||||
#
|
||||
# rules to check out and in Make-template files
|
||||
#
|
||||
co-mktmpls: FORCE
|
||||
@echo "checking out Make-template files..."; \
|
||||
for mkfile in `$(FIND) . -name Make-template -type f -print`; do \
|
||||
$(CO) -l $$mkfile; \
|
||||
done
|
||||
|
||||
ci-mktmpls: FORCE
|
||||
@echo "enter a one-word log message:"; \
|
||||
read logmsg; \
|
||||
echo "checking in Make-template files..."; \
|
||||
for mkfile in `$(FIND) . -name Make-template -type f -print`; do \
|
||||
$(CI) -m$$logmsg -u $$mkfile; \
|
||||
done
|
||||
|
||||
|
||||
lib-depend: makeconfig
|
||||
@echo "cd libraries; $(MAKE) $(MFLAGS) depend"
|
||||
@( cd libraries; $(MAKE) $(MFLAGS) depend )"
|
||||
|
||||
#
|
||||
# rules to cut a new ldap distribution
|
||||
#
|
||||
distribution: makeconfig checkin tar
|
||||
|
||||
checkin: FORCE
|
||||
@-VERSION=V`cat ./build/version | $(SED) -e 's/\.//'` ; \
|
||||
echo "Checking in version $$VERSION"; \
|
||||
for i in `$(FIND) . -name \*,v -print | \
|
||||
$(SED) -e 's%RCS/%%' -e 's%,v%%'`; \
|
||||
do ( \
|
||||
ci -m"pre-version $$VERSION check-in" -u $$i; \
|
||||
rcs -N$$VERSION: $$i ) \
|
||||
done
|
||||
|
||||
tar: veryclean
|
||||
# $(RM) ./Make-common; \
|
||||
# $(CP) ./Make-common.dist ./Make-common; \
|
||||
# $(CHMOD) 644 ./Make-common; \
|
||||
# $(RM) ./include/ldapconfig.h.edit; \
|
||||
# $(CP) ./include/ldapconfig.h.dist ./include/ldapconfig.h.edit; \
|
||||
# $(CHMOD) 644 ./include/ldapconfig.h.edit;
|
||||
@PWD=`pwd`; \
|
||||
BASE=`$(BASENAME) $$PWD`; XFILE=/tmp/ldap-x.$$$$; \
|
||||
( cd .. ; $(CAT) $$BASE/exclude >$$XFILE; \
|
||||
$(FIND) $$BASE -name RCS -print >> $$XFILE ; \
|
||||
$(FIND) $$BASE -name CVS -print >> $$XFILE ; \
|
||||
$(FIND) $$BASE -name obj-\* -print >> $$XFILE ; \
|
||||
$(FIND) $$BASE -name tags -print >> $$XFILE ; \
|
||||
$(TAR) cvfX ./$$BASE.tar $$XFILE $$BASE; \
|
||||
); \
|
||||
$(RM) $$XFILE; \
|
||||
echo "compressing ../$$BASE.tar..."; \
|
||||
$(COMPRESS) ../$$BASE.tar
|
||||
|
||||
#
|
||||
# rule to force check for change of platform
|
||||
#
|
||||
platform: FORCE
|
||||
@if [ -f .make-platform ]; then \
|
||||
echo "removing old link .make-platform"; \
|
||||
$(RM) .make-platform; \
|
||||
fi; \
|
||||
$(MAKE) $(MFLAGS) .make-platform
|
||||
|
||||
|
||||
makeconfig: .makefiles buildtools
|
||||
|
||||
.make-platform:
|
||||
@if [ -f /usr/bin/swconfig ]; then \
|
||||
UNAME=./build/uname.sh; \
|
||||
elif [ -f /bin/uname ]; then \
|
||||
UNAME=/bin/uname; \
|
||||
elif [ -f /usr/bin/uname ]; then \
|
||||
UNAME=/usr/bin/uname; \
|
||||
else \
|
||||
UNAME=./build/uname.sh; \
|
||||
fi; \
|
||||
if [ -z "$$UNAME" ]; then \
|
||||
echo "unknown platform (no $$UNAME or /usr/bin/uname)"; \
|
||||
echo "see the file build/PORTS for more information."; \
|
||||
exit 1; \
|
||||
else \
|
||||
OS=`$$UNAME -s` ; OSRELEASE=`$$UNAME -r` ; \
|
||||
OSVERSION=`$$UNAME -v` ; \
|
||||
case $$OS in \
|
||||
SunOS) \
|
||||
if [ $$OSRELEASE -gt "5" -o $$OSRELEASE -lt "4" ]; then \
|
||||
echo "SunOS release $$OSRELEASE unknown..."; exit 1; \
|
||||
fi; \
|
||||
if [ $$OSRELEASE -ge "5" ]; then \
|
||||
MINORVER=`echo $$OSRELEASE|sed 's/^.*\.//'` ; \
|
||||
if [ $$MINORVER -ge "6" ]; then \
|
||||
PLATFORM="sunos56" ; \
|
||||
else \
|
||||
PLATFORM="sunos5"; \
|
||||
fi; \
|
||||
else \
|
||||
PLATFORM="sunos4"; \
|
||||
fi; \
|
||||
;; \
|
||||
ULTRIX) \
|
||||
PLATFORM="ultrix" \
|
||||
;; \
|
||||
OSF1) \
|
||||
PLATFORM="osf1" \
|
||||
;; \
|
||||
AIX) \
|
||||
PLATFORM="aix" \
|
||||
;; \
|
||||
HP-UX) \
|
||||
PLATFORM="hpux" \
|
||||
;; \
|
||||
Linux) \
|
||||
PLATFORM="linux" \
|
||||
;; \
|
||||
NetBSD) \
|
||||
PLATFORM="netbsd" \
|
||||
;; \
|
||||
OpenBSD) \
|
||||
PLATFORM="openbsd" \
|
||||
;; \
|
||||
FreeBSD) \
|
||||
MAJRELEASE=`echo $$OSRELEASE | sed 's/\..*//'` ; \
|
||||
if [ $$MAJRELEASE -lt 3 ]; then \
|
||||
PLATFORM="freebsd2" ; \
|
||||
else \
|
||||
PLATFORM="freebsd3" ; \
|
||||
fi; \
|
||||
;; \
|
||||
NeXTSTEP) \
|
||||
PLATFORM="nextstep" \
|
||||
;; \
|
||||
SCO) \
|
||||
PLATFORM="sco" \
|
||||
;; \
|
||||
IRIX|IRIX64) \
|
||||
PLATFORM="irix" \
|
||||
;; \
|
||||
*) echo "unknown platform ($$OS $$OSVERSION $$OSRELEASE)..."; \
|
||||
echo "see the file build/PORTS for more information."; \
|
||||
exit 1; \
|
||||
;; \
|
||||
esac; \
|
||||
fi; \
|
||||
CC="$(CC)"; \
|
||||
OLDIFS="$$IFS"; \
|
||||
IFS=":"; \
|
||||
for dir in $$PATH; do \
|
||||
if [ -f $$dir/gcc ]; then \
|
||||
CC=gcc; \
|
||||
break; \
|
||||
fi; \
|
||||
done; \
|
||||
IFS="$$OLDIFS"; \
|
||||
$(LN) ./build/platforms/$$PLATFORM-$$CC/Make-platform .make-platform; \
|
||||
echo ""; \
|
||||
echo "** Set platform to $$PLATFORM with compiler $$CC..."; \
|
||||
echo ""
|
||||
|
||||
Make-common: Make-common.dist
|
||||
@if [ -f Make-common ]; then \
|
||||
echo "Make-common.dist newer than Make-common, check for new options" ;\
|
||||
echo "or touch Make-common to ignore."; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
echo "Copy Make-common.dist or Make-common.gmake to Make-common"; \
|
||||
echo " Edit as needed before making!" ; \
|
||||
exit 1
|
||||
#
|
||||
# rule to build Makefiles by concatenating Make-template file in each
|
||||
# subdirectory with global Make-common, .make-platform, and
|
||||
# build/Make-append files
|
||||
#
|
||||
.makefiles: Make-common .make-platform build/Make-append
|
||||
@echo "making Makefiles..."; \
|
||||
HDRFILE=/tmp/Makehdr.$$$$; \
|
||||
DEFSFILE=/tmp/Makedefs.$$$$; \
|
||||
$(CAT) build/Make-append ./.make-platform ./Make-common > $$DEFSFILE; \
|
||||
echo "# --------------------------------------------------------" > $$HDRFILE; \
|
||||
echo "# This file was automatically generated. Do not edit it." >> $$HDRFILE; \
|
||||
echo "# Instead, edit the Make-common file (located in the root" >> $$HDRFILE; \
|
||||
echo "# (of the LDAP distribution). See the LDAP INSTALL file" >> $$HDRFILE; \
|
||||
echo "# for more information." >> $$HDRFILE; \
|
||||
echo "# --------------------------------------------------------" >> $$HDRFILE; \
|
||||
echo "#" >> $$HDRFILE; \
|
||||
for i in `$(FIND) . -type d -print`; do \
|
||||
if [ -f $$i/Make-template ]; then \
|
||||
echo " creating $$i/Makefile"; \
|
||||
$(RM) $$i/Makefile; \
|
||||
$(CAT) $$HDRFILE $$i/Make-template $$DEFSFILE > $$i/Makefile; \
|
||||
fi; \
|
||||
done; \
|
||||
$(RM) .makefiles; \
|
||||
touch .makefiles; \
|
||||
$(RM) $$HDRFILE $$DEFSFILE
|
||||
|
||||
#
|
||||
# rule to always build makefiles
|
||||
#
|
||||
makefiles: FORCE
|
||||
$(RM) .makefiles
|
||||
$(MAKE) $(MFLAGS) .makefiles
|
||||
@echo "Please \"make depend\" before building."
|
||||
|
||||
#
|
||||
# rule to create any tools we need to build everything else
|
||||
#
|
||||
buildtools: FORCE
|
||||
@echo "making buildtools"
|
||||
@echo " cd build; $(MAKE) $(MFLAGS)"
|
||||
@( cd build; $(MAKE) $(MFLAGS) )
|
||||
|
||||
#
|
||||
# rule to make a shadow (linked) build area
|
||||
#
|
||||
links: FORCE
|
||||
@if [ -f /usr/bin/swconfig ]; then \
|
||||
UNAME=./build/uname.sh; \
|
||||
elif [ -f /bin/uname ]; then \
|
||||
UNAME=/bin/uname; \
|
||||
elif [ -f /usr/bin/uname ]; then \
|
||||
UNAME=/usr/bin/uname; \
|
||||
else \
|
||||
UNAME=./build/uname.sh; \
|
||||
fi; \
|
||||
if [ ! -z "$(DEST)" ]; then \
|
||||
DEST="$(DEST)"; \
|
||||
else \
|
||||
DEST=./obj-`$$UNAME -s`-`$$UNAME -r` ; \
|
||||
fi; \
|
||||
echo "making links in $$DEST..."; \
|
||||
LINKLIST=/tmp/ldaplinklist.$$$$; \
|
||||
$(RM) $$LINKLIST; \
|
||||
$(MKDIR) $$DEST; \
|
||||
cd $$DEST; $(LN) $(LDAPSRC) .src; \
|
||||
$(LN) .src/Makefile . ; \
|
||||
$(CP) .src/Make-common . ; $(CHMOD) 644 ./Make-common; \
|
||||
for d in build $(SRCDIRS) $(TESTDIR); do \
|
||||
( $(MKDIR) $$d; cd $$d; $(LN) ../.src/$$d .src; \
|
||||
$(LN) .src/Make-template . ; \
|
||||
$(MAKE) $(MFLAGS) MKDIR="$(MKDIR)" LN="$(LN)" \
|
||||
-f Make-template links ) ; \
|
||||
done; \
|
||||
echo ""; echo "Now type:"; echo " cd $$DEST"; echo "and make there"
|
||||
|
||||
FORCE:
|
31
Makefile.in
Normal file
31
Makefile.in
Normal file
@ -0,0 +1,31 @@
|
||||
# Master Makefile for OpenLDAP
|
||||
# Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
|
||||
# COPYING RESTRICTIONS APPLY, See COPYRIGHT file
|
||||
|
||||
SUBDIRS= include libraries clients servers # contrib
|
||||
CLEANDIRS= tests
|
||||
INSTALLDIRS= doc
|
||||
|
||||
makefiles: FORCE
|
||||
./config.status
|
||||
|
||||
${srcdir}/configure: configure.in aclocal.m4
|
||||
cd ${srcdir} && autoconf
|
||||
|
||||
# autoheader might not change portable.h.in, so touch a stamp file
|
||||
${srcdir}/include/portable.h.in: stamp-h.in
|
||||
${srcdir}/stamp-h.in: configure.in aclocal.m4 acconfig.h \
|
||||
${srcdir}/include/portable.h.top ${srcdir}/include/portable.h.bot
|
||||
cd ${srcdir} && autoheader
|
||||
@echo timestamp > ${srcdir}/stamp-h.in
|
||||
|
||||
./include/portable.h: stamp-h
|
||||
stamp-h: config.h.in config.status
|
||||
./config.status
|
||||
|
||||
Makefile: Makefile.in config.status
|
||||
./config.status
|
||||
|
||||
config.status: configure
|
||||
./config.status --recheck
|
||||
|
42
README
42
README
@ -16,11 +16,25 @@ MAKING AND INSTALLING THE DISTRIBUTION
|
||||
You should be able to make and install the distribution with a pretty
|
||||
standard default configuration by typing the following commands
|
||||
|
||||
% cp Make-common.dist to Make-common
|
||||
Note: if using gmake, instead copy Make-common.gmake to Make-common
|
||||
Edit Make-common as desired.
|
||||
% ./configure --help
|
||||
This will list the available options.
|
||||
The configure script will also use your environmental
|
||||
variables for determining compiler/linker options.
|
||||
These environment variables are used:
|
||||
CC C compiler (cc, ecgs)
|
||||
CFLAGS C Flags (-ansi)
|
||||
CPPFLAGS CPP Flags (-I -D)
|
||||
LDFLAGS LDFLAGS (-L -l)
|
||||
|
||||
% [env settings] ./configure [options]
|
||||
this will configure the build system
|
||||
|
||||
% make depend
|
||||
this will create dependency information
|
||||
|
||||
% make
|
||||
this will build the system
|
||||
|
||||
% su
|
||||
# make install
|
||||
|
||||
@ -28,27 +42,7 @@ MAKING AND INSTALLING THE DISTRIBUTION
|
||||
works.
|
||||
|
||||
You will probably want to do a little configuration to suit your
|
||||
site, though. There are two files you might want to edit:
|
||||
|
||||
Make-common.dist
|
||||
contains distribution defaults. This file is used to
|
||||
contruct Make-common and should not be edited except to
|
||||
add new features/options to the distribution.
|
||||
|
||||
Make-common.gmake
|
||||
contains distribution defaults (with GNU make compatibility).
|
||||
This file can be used to contruct Make-common and should not
|
||||
be edited except to add new features/options to the distribution.
|
||||
|
||||
Make-common
|
||||
contains default definitions for where things will be
|
||||
installed, where to find various things, etc. These defaults
|
||||
are used in absense of platform-specific defaults. You may
|
||||
hardcode settings in Make-common if you desire. You will
|
||||
need to edit this file to enable optional features.
|
||||
|
||||
build/*/Make-platform
|
||||
contains platform-specific defaults.
|
||||
site, though. There are one file you might want to edit:
|
||||
|
||||
include/ldapconfig.h.edit
|
||||
This file contains #defines used by many parts of the
|
||||
|
138
acconfig.h
Normal file
138
acconfig.h
Normal file
@ -0,0 +1,138 @@
|
||||
/* acconfig.h
|
||||
Descriptive text for the C preprocessor macros that
|
||||
the distributed Autoconf macros can define.
|
||||
|
||||
Leave the following blank line there!! Autoheader needs it. */
|
||||
|
||||
|
||||
/* define this if toupper() requires tolower() check */
|
||||
#undef C_UPPER_LOWER
|
||||
|
||||
/* define this if sys_errlist is not defined in stdio.h or errno.h */
|
||||
#undef DECL_SYS_ERRLIST
|
||||
|
||||
/* define if you have berkeley db */
|
||||
#undef HAVE_BERKELEY_DB
|
||||
|
||||
/* define if you have berkeley db2 */
|
||||
#undef HAVE_BERKELEY_DB2
|
||||
|
||||
/* define if you have crypt */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* define if you have DCE */
|
||||
#undef HAVE_DCE
|
||||
|
||||
/* define if you have GDBM */
|
||||
#undef HAVE_GDBM
|
||||
|
||||
/* define if you have Kerberos */
|
||||
#undef HAVE_KERBEROS
|
||||
|
||||
/* define if you have LinuxThreads */
|
||||
#undef HAVE_LINUX_THREADS
|
||||
|
||||
/* define if you have Sun LWP (SunOS style) */
|
||||
#undef HAVE_LWP
|
||||
|
||||
/* define if you have -lncurses */
|
||||
#undef HAVE_NCURSES
|
||||
|
||||
/* define if you have NDBM */
|
||||
#undef HAVE_NDBM
|
||||
|
||||
/* define if you have Mach CThreads */
|
||||
#undef HAVE_MACH_CTHREADS
|
||||
|
||||
/* define if you have a preemptive POSIX Threads implementation */
|
||||
#undef HAVE_PREEMPTIVE_PTHREADS
|
||||
|
||||
/* define if you have POSIX Threads */
|
||||
#undef HAVE_PTHREADS
|
||||
|
||||
/* define if your POSIX Threads implementatin is circa Draft 4 */
|
||||
#undef HAVE_PTHREADS_D4
|
||||
|
||||
/* define if you have -lwrap */
|
||||
#undef HAVE_TCPD
|
||||
|
||||
/* define if you have -ltermcap */
|
||||
#undef HAVE_TERMCAP
|
||||
|
||||
/* define if you have Sun LWP (Solaris style) */
|
||||
#undef HAVE_THR
|
||||
|
||||
/* define this for connectionless LDAP support */
|
||||
#undef LDAP_CONNECTIONLESS
|
||||
|
||||
/* define this to add debugging code */
|
||||
#undef LDAP_DEBUG
|
||||
|
||||
/* define this for LDAP DNS support */
|
||||
#undef LDAP_DNS
|
||||
|
||||
/* define this to remove -lldap cache support */
|
||||
#undef LDAP_NOCACHE
|
||||
|
||||
/* define this for LDAP referrals support */
|
||||
#undef LDAP_REFERRALS
|
||||
|
||||
/* define this for LDAP User Interface support */
|
||||
#undef LDAP_LIBUI
|
||||
|
||||
/* define this to use DB2 in native mode */
|
||||
#undef LDBM_USE_DB2
|
||||
|
||||
/* define this to use DB2 in compat185 mode */
|
||||
#undef LDBM_USE_DB2_COMPAT185
|
||||
|
||||
/* define this to use DBBTREE w/ LDBM backend */
|
||||
#undef LDBM_USE_DBBTREE
|
||||
|
||||
/* define this to use DBHASH w/ LDBM backend */
|
||||
#undef LDBM_USE_DBHASH
|
||||
|
||||
/* define this to use GDBM w/ LDBM backend */
|
||||
#undef LDBM_USE_GDBM
|
||||
|
||||
/* define this to use NDBM w/ LDBM backend */
|
||||
#undef LDBM_USE_NDBM
|
||||
|
||||
/* define this if you want no termcap support */
|
||||
#undef NO_TERMCAP
|
||||
|
||||
/* define this if you want no thread support */
|
||||
#undef NO_THREADS
|
||||
|
||||
/* define this if the thread package is preemptive */
|
||||
#undef PREEMPTIVE_THREADS
|
||||
|
||||
/* define this for ACL Group support */
|
||||
#undef SLAPD_ACLGROUPS
|
||||
|
||||
/* define this for crypt(3) password support */
|
||||
#undef SLAPD_CRYPT
|
||||
|
||||
/* define this to use SLAPD LDBM backend */
|
||||
#undef SLAPD_LDBM
|
||||
|
||||
/* define this for MD5 password support */
|
||||
#undef SLAPD_MD5
|
||||
|
||||
/* define this to use SLAPD passwd backend */
|
||||
#undef SLAPD_PASSWD
|
||||
|
||||
/* define this for phonetic support */
|
||||
#undef SLAPD_PHONETIC
|
||||
|
||||
/* define this for Reverse Lookup support */
|
||||
#undef SLAPD_RLOOKUPS
|
||||
|
||||
/* define this for SHA1 password support */
|
||||
#undef SLAPD_SHA1
|
||||
|
||||
/* define this to use SLAPD shell backend */
|
||||
#undef SLAPD_SHELL
|
||||
|
||||
|
||||
/* Leave that blank line there!! Autoheader needs it. */
|
395
aclocal.m4
vendored
Normal file
395
aclocal.m4
vendored
Normal file
@ -0,0 +1,395 @@
|
||||
dnl
|
||||
dnl OpenLDAP Autoconf Macros
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Restricted form of AC_ARG_ENABLE that limits user options
|
||||
dnl
|
||||
dnl $1 = option name
|
||||
dnl $2 = help-string
|
||||
dnl $3 = default value (auto)
|
||||
dnl $4 = allowed values (auto yes no)
|
||||
AC_DEFUN([OL_ARG_ENABLE], [# OpenLDAP --enable-$1
|
||||
AC_ARG_ENABLE($1,[$2 (]ifelse($3,,auto,$3)[)],[
|
||||
ol_arg=invalid
|
||||
for ol_val in ifelse($4,,[auto yes no],[$4]) ; do
|
||||
if test "$enableval" = "$ol_val" ; then
|
||||
ol_arg="$ol_val"
|
||||
fi
|
||||
done
|
||||
if test "$ol_arg" = "invalid" ; then
|
||||
AC_MSG_ERROR(bad value $enableval for --enable-$1)
|
||||
fi
|
||||
ol_enable_$1="$ol_arg"
|
||||
],
|
||||
[ ol_enable_$1=ifelse($3,,"auto","$3")])dnl
|
||||
dnl AC_VERBOSE(OpenLDAP -enable-$1 $ol_enable_$1)
|
||||
# end --enable-$1
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Restricted form of AC_ARG_WITH that limits user options
|
||||
dnl
|
||||
dnl $1 = option name
|
||||
dnl $2 = help-string
|
||||
dnl $3 = default value (no)
|
||||
dnl $4 = allowed values (yes or no)
|
||||
AC_DEFUN([OL_ARG_WITH], [# OpenLDAP --with-$1
|
||||
AC_ARG_WITH($1,[$2 (]ifelse($3,,yes,$3)[)],[
|
||||
ol_arg=invalid
|
||||
for ol_val in ifelse($4,,[yes no],[$4]) ; do
|
||||
if test "$withval" = "$ol_val" ; then
|
||||
ol_arg="$ol_val"
|
||||
fi
|
||||
done
|
||||
if test "$ol_arg" = "invalid" ; then
|
||||
AC_MSG_ERROR(bad value $withval for --with-$1)
|
||||
fi
|
||||
ol_with_$1="$ol_arg"
|
||||
],
|
||||
[ ol_with_$1=ifelse($3,,"no","$3")])dnl
|
||||
dnl AC_VERBOSE(OpenLDAP --with-$1 $ol_with_$1)
|
||||
# end --with-$1
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if db.h is Berkeley DB2
|
||||
dnl
|
||||
dnl defines ol_cv_header_db2 to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_HEADERS(db.h)
|
||||
dnl
|
||||
AC_DEFUN([OL_HEADER_BERKELEY_DB2],
|
||||
[AC_CHECK_HEADERS(db.h)
|
||||
if test $ac_cv_header_db_h = yes ; then
|
||||
AC_CACHE_CHECK([if db.h is DB2], [ol_cv_header_db2],[
|
||||
AC_EGREP_CPP(__db_version_2,[
|
||||
# include <db.h>
|
||||
/* this check could be improved */
|
||||
# ifdef DB_VERSION_MAJOR
|
||||
# if DB_VERSION_MAJOR == 2
|
||||
__db_version_2
|
||||
# endif
|
||||
# endif
|
||||
], ol_cv_header_db2=yes, ol_cv_header_db2=no)])
|
||||
else
|
||||
ol_cv_header_db2=no
|
||||
fi
|
||||
])dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB2 library exists
|
||||
dnl Check for dbopen in standard libraries or -ldb
|
||||
dnl
|
||||
dnl defines ol_cv_lib_db2 to '-ldb' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_LIB(db,db_open)
|
||||
dnl
|
||||
AC_DEFUN([OL_LIB_BERKELEY_DB2],
|
||||
[AC_CACHE_CHECK([for DB2 library], [ol_cv_lib_db2],
|
||||
[ ol_LIBS="$LIBS"
|
||||
AC_CHECK_LIB(db,db_open,[ol_cv_lib_db2=-ldb],[ol_cv_lib_db2=no])
|
||||
LIBS="$ol_LIBS"
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley db2 exists
|
||||
dnl
|
||||
dnl defines ol_cv_berkeley_db2 to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_LIB_BERKELEY_DB2
|
||||
dnl OL_HEADER_BERKELEY_DB2
|
||||
dnl
|
||||
AC_DEFUN([OL_BERKELEY_DB2],
|
||||
[AC_REQUIRE([OL_LIB_BERKELEY_DB2])
|
||||
AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
|
||||
AC_CACHE_CHECK([for Berkeley DB2], [ol_cv_berkeley_db2], [
|
||||
if test $ol_cv_lib_db2 = no -o $ol_cv_header_db2 = no ; then
|
||||
ol_cv_berkeley_db2=no
|
||||
else
|
||||
ol_cv_berkeley_db2=yes
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_berkeley_db2 = yes ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB2,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check for db.h/db_185.h is Berkeley DB
|
||||
dnl
|
||||
dnl defines ol_cv_header_db to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_HEADER_BERKELEY_DB2
|
||||
dnl AC_CHECK_HEADERS(db_185.h)
|
||||
dnl
|
||||
AC_DEFUN([OL_HEADER_BERKELEY_DB],
|
||||
[AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
|
||||
AC_CHECK_HEADERS(db_185.h)
|
||||
if test $ol_cv_header_db2 = yes ; then
|
||||
dnl db.h is db2!
|
||||
|
||||
ol_cv_header_db=$ac_cv_header_db_185_h
|
||||
else
|
||||
ol_cv_header_db=$ac_cv_header_db_h
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB library exists
|
||||
dnl Check for dbopen in standard libraries or -ldb
|
||||
dnl
|
||||
dnl defines ol_cv_lib_db to 'yes' or '-ldb' or 'no'
|
||||
dnl 'yes' implies dbopen is in $LIBS
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_FUNC(dbopen)
|
||||
dnl AC_CHECK_LIB(db,dbopen)
|
||||
dnl
|
||||
AC_DEFUN([OL_LIB_BERKELEY_DB],
|
||||
[AC_CACHE_CHECK([for Berkeley DB library], [ol_cv_lib_db],
|
||||
[ ol_LIBS="$LIBS"
|
||||
AC_CHECK_FUNC(dbopen,[ol_cv_lib_db=yes], [
|
||||
AC_CHECK_LIB(db,dbopen,[ol_cv_lib_db=-ldb],[ol_cv_lib_db=no])
|
||||
])
|
||||
LIBS="$ol_LIBS"
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if Berkeley DB exists
|
||||
dnl
|
||||
dnl defines ol_cv_berkeley_db to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_LIB_BERKELEY_DB
|
||||
dnl OL_HEADER_BERKELEY_DB
|
||||
dnl
|
||||
AC_DEFUN([OL_BERKELEY_DB],
|
||||
[AC_REQUIRE([OL_LIB_BERKELEY_DB])
|
||||
AC_REQUIRE([OL_HEADER_BERKELEY_DB])
|
||||
AC_CACHE_CHECK([for Berkeley DB], [ol_cv_berkeley_db], [
|
||||
if test $ol_cv_lib_db = no -o $ol_cv_header_db = no ; then
|
||||
ol_cv_berkeley_db=no
|
||||
else
|
||||
ol_cv_berkeley_db=yes
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_berkeley_db = yes ; then
|
||||
AC_DEFINE(HAVE_BERKELEY_DB,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if GDBM library exists
|
||||
dnl Check for gdbm_open in standard libraries or -lgdbm
|
||||
dnl
|
||||
dnl defines ol_cv_lib_gdbm to 'yes' or '-lgdbm' or 'no'
|
||||
dnl 'yes' implies gdbm_open is in $LIBS
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_FUNC(gdbm_open)
|
||||
dnl AC_CHECK_LIB(gdbm,gdbm_open)
|
||||
dnl
|
||||
AC_DEFUN([OL_LIB_GDBM],
|
||||
[AC_CACHE_CHECK(for GDBM library, [ol_cv_lib_gdbm],
|
||||
[ ol_LIBS="$LIBS"
|
||||
AC_CHECK_FUNC(gdbm_open,[ol_cv_lib_gdbm=yes], [
|
||||
AC_CHECK_LIB(gdbm,gdbm_open,[ol_cv_lib_gdbm=-lgdbm],[ol_cv_lib_gdbm=no])
|
||||
])
|
||||
LIBS="$ol_LIBS"
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if GDBM exists
|
||||
dnl
|
||||
dnl defines ol_cv_gdbm to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_LIB_GDBM
|
||||
dnl AC_CHECK_HEADERS(gdbm.h)
|
||||
dnl
|
||||
AC_DEFUN([OL_GDBM],
|
||||
[AC_REQUIRE([OL_LIB_GDBM])
|
||||
AC_CHECK_HEADERS(gdbm.h)
|
||||
AC_CACHE_CHECK(for db, [ol_cv_gdbm], [
|
||||
if test $ol_cv_lib_gdbm = no -o $ac_cv_header_gdbm_h = no ; then
|
||||
ol_cv_gdbm=no
|
||||
else
|
||||
ol_cv_gdbm=yes
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_gdbm = yes ; then
|
||||
AC_DEFINE(HAVE_GDBM,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if NDBM library exists
|
||||
dnl Check for dbm_open in standard libraries or -lndbm or -ldbm
|
||||
dnl
|
||||
dnl defines ol_cv_lib_ndbm to 'yes' or '-lndbm' or -ldbm or 'no'
|
||||
dnl 'yes' implies ndbm_open is in $LIBS
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl AC_CHECK_FUNC(dbm_open)
|
||||
dnl AC_CHECK_LIB(ndbm,dbm_open)
|
||||
dnl AC_CHECK_LIB(dbm,dbm_open)
|
||||
dnl
|
||||
dnl restrictions:
|
||||
dnl should also check SVR4 case: dbm_open() in -lucb but that
|
||||
dnl would requiring dealing with -L/usr/ucblib
|
||||
dnl
|
||||
AC_DEFUN([OL_LIB_NDBM],
|
||||
[AC_CACHE_CHECK(for NDBM library, [ol_cv_lib_ndbm],
|
||||
[ ol_LIBS="$LIBS"
|
||||
AC_CHECK_FUNC(dbm_open,[ol_cv_lib_ndbm=yes], [
|
||||
AC_CHECK_LIB(ndbm,dbm_open,[ol_cv_lib_ndbm=-lndbm], [
|
||||
AC_CHECK_LIB(dbm,dbm_open,[ol_cv_lib_ndbm=-ldbm],
|
||||
[ol_cv_lib_ndbm=no])dnl
|
||||
])
|
||||
])
|
||||
LIBS="$ol_LIBS"
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check if NDBM exists
|
||||
dnl
|
||||
dnl defines ol_cv_ndbm to 'yes' or 'no'
|
||||
dnl
|
||||
dnl uses:
|
||||
dnl OL_LIB_NDBM
|
||||
dnl AC_CHECK_HEADERS(ndbm.h)
|
||||
dnl
|
||||
dnl restrictions:
|
||||
dnl Doesn't handle SVR4 case (see above)
|
||||
dnl
|
||||
AC_DEFUN([OL_NDBM],
|
||||
[AC_REQUIRE([OL_LIB_NDBM])
|
||||
AC_CHECK_HEADERS(ndbm.h)
|
||||
AC_CACHE_CHECK(for db, [ol_cv_ndbm], [
|
||||
if test $ol_cv_lib_ndbm = no -o $ac_cv_header_ndbm_h = no ; then
|
||||
ol_cv_ndbm=no
|
||||
else
|
||||
ol_cv_ndbm=yes
|
||||
fi
|
||||
])
|
||||
if test $ol_cv_ndbm = yes ; then
|
||||
AC_DEFINE(HAVE_NDBM,1)
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check POSIX Thread version
|
||||
dnl
|
||||
dnl defines ol_cv_posix_version to 'final' or 'draft' or 'unknown'
|
||||
dnl 'unknown' implies that the version could not be detected
|
||||
dnl or that pthreads.h does exist. Existance of pthreads.h
|
||||
dnl should be tested separately.
|
||||
dnl
|
||||
AC_DEFUN([OL_POSIX_THREAD_VERSION],
|
||||
[AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
|
||||
AC_EGREP_CPP(final,[
|
||||
# include <pthread.h>
|
||||
/* this check could be improved */
|
||||
# ifdef PTHREAD_ONCE_INIT
|
||||
final
|
||||
# endif
|
||||
], ol_pthread_final=yes, ol_pthread_final=no)
|
||||
|
||||
AC_EGREP_CPP(draft4,[
|
||||
# include <pthread.h>
|
||||
/* this check could be improved */
|
||||
# ifdef pthread_once_init
|
||||
draft4
|
||||
# endif
|
||||
], ol_pthread_draft4=yes, ol_pthread_draft4=no)
|
||||
|
||||
if test $ol_pthread_final = yes -a $ol_pthread_draft4 = no; then
|
||||
ol_cv_pthread_version=final
|
||||
elif test $ol_pthread_final = no -a $ol_pthread_draft4 = yes; then
|
||||
ol_cv_pthread_version=draft4
|
||||
else
|
||||
ol_cv_pthread_version=unknown
|
||||
fi
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl --------------------------------------------------------------------
|
||||
dnl Check LinuxThread
|
||||
dnl
|
||||
dnl defines ol_cv_linux_threads to 'yes' or 'no'
|
||||
dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
|
||||
dnl doesn't exists. Existance of pthread.h should separately
|
||||
dnl checked.
|
||||
dnl
|
||||
AC_DEFUN([OL_LINUX_THREADS],
|
||||
[
|
||||
AC_CACHE_CHECK([for LinuxThreads], [ol_cv_linux_threads], [
|
||||
res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
|
||||
if test "$res" -gt 0 ; then
|
||||
ol_cv_linux_threads=yes
|
||||
else
|
||||
ol_cv_linux_threads=no
|
||||
fi
|
||||
])
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Check if toupper() requires islower() to be called first
|
||||
AC_DEFUN([OL_C_UPPER_LOWER],
|
||||
[
|
||||
AC_MSG_CHECKING([if toupper() requires islower()])
|
||||
AC_CACHE_VAL(ol_cv_c_upper_lower,[
|
||||
AC_TRY_RUN([
|
||||
#include <ctype.h>
|
||||
main()
|
||||
{
|
||||
if ('C' == toupper('C'))
|
||||
exit(0);
|
||||
else
|
||||
exit(1);
|
||||
}],
|
||||
[ol_cv_c_upper_lower=no],
|
||||
[ol_cv_c_upper_lower=yes],
|
||||
[ol_cv_c_upper_lower=safe])])
|
||||
AC_MSG_RESULT($ol_cv_c_upper_lower)
|
||||
if test $ol_cv_c_upper_lower != no ; then
|
||||
AC_DEFINE(C_UPPER_LOWER,1)
|
||||
fi
|
||||
])
|
||||
|
||||
dnl ====================================================================
|
||||
dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
|
||||
dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
|
||||
dnl Reported by Keith Bostic.
|
||||
AC_DEFUN([OL_SYS_ERRLIST],
|
||||
[
|
||||
AC_MSG_CHECKING([declaration of sys_errlist])
|
||||
AC_CACHE_VAL(ol_cv_dcl_sys_errlist,[
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h> ],
|
||||
[char *c = (char *) *sys_errlist],
|
||||
[ol_cv_dcl_sys_errlist=yes],
|
||||
[ol_cv_dcl_sys_errlist=no])])
|
||||
AC_MSG_RESULT($ol_cv_dcl_sys_errlist)
|
||||
|
||||
# It's possible (for near-UNIX clones) that sys_errlist doesn't exist
|
||||
if test $ol_cv_dcl_sys_errlist = no ; then
|
||||
AC_DEFINE(DECL_SYS_ERRLIST,1)
|
||||
AC_MSG_CHECKING([existence of sys_errlist])
|
||||
AC_CACHE_VAL(ol_cv_have_sys_errlist,[
|
||||
AC_TRY_LINK([#include <errno.h>],
|
||||
[char *c = (char *) *sys_errlist],
|
||||
[ol_cv_have_sys_errlist=yes],
|
||||
[ol_cv_have_sys_errlist=no])])
|
||||
AC_MSG_RESULT($ol_cv_have_sys_errlist)
|
||||
fi
|
||||
])dnl
|
@ -1,96 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Do NOT edit this file -- it is automatically appended to all Makefiles
|
||||
# except the LDAP top-level Makefile. See the LDAP INSTALL file for more
|
||||
# information.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted only
|
||||
# as authorized by the OpenLDAP Public License. A copy of this
|
||||
# license is available at http://www.OpenLDAP.org/license.html or
|
||||
# in file LICENSE in the top-level directory of the distribution.
|
||||
#
|
||||
# This work is derived from the University of Michigan LDAP v3.3
|
||||
# distribution. Information concerning is available at
|
||||
# http://www.umich.edu/~dirsvcs/ldap/ldap.html.
|
||||
#
|
||||
# This work also contains materials derived from public sources.
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# LDAP standard Make defines (appended to all but top-level Makefile)
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
# DEFS are included in CFLAGS
|
||||
DEFS = $(PLATFORMCFLAGS) $(LDAP_DEBUG) $(KERBEROS) $(AFSKERBEROS) \
|
||||
$(UOFM) $(UOFA) $(NO_USERINTERFACE) $(CLDAP) $(NO_CACHE) \
|
||||
$(LDAP_REFERRALS) $(LDAP_DNS) $(STR_TRANSLATION) \
|
||||
$(LIBLDAP_CHARSETS) $(LIBLDAP_DEF_CHARSET)
|
||||
|
||||
# LDBMDEFS are included by servers (though only slapd only cares)
|
||||
# and libldbm
|
||||
LDBMDEFS = $(SLAPD_BACKENDS) $(LDBMBACKEND) $(LDBMINCLUDE)
|
||||
|
||||
# SERVERDEFS are added to server builds CFLAGS (in addition to DEFS)
|
||||
SERVERDEFS = $(ISODEPACKAGE) $(ICRELEASE) $(LDAP_USE_PP) \
|
||||
$(NO_SETPROCTITLE) $(PEPSY_DUMP) \
|
||||
$(LDAP_REVERSE_LOOKUP) $(LDAP_CRYPT) $(LDAP_ACLGROUP) \
|
||||
$(LDAP_TCP_WRAPPERS) \
|
||||
$(PHONETIC) $(LDBMDEFS)
|
||||
#
|
||||
# ISODELIBS are used in server/ldapd builds
|
||||
#
|
||||
ISODELIBS = $(ISODEBASELIBS) -lm $(ISODETURBOLIBS)
|
||||
|
||||
# ACFLAGS are added to CFLAGS but not passed to mkdep, lint, etc
|
||||
ACFLAGS = $(EXTRACFLAGS) $(UNPROTOCFLAGS)
|
||||
|
||||
# ALDFLAGS are always placed near the beginning of all linker (cc -o) commands
|
||||
ALDFLAGS = $(EXTRALDFLAGS) $(PLATFORMLDFLAGS)
|
||||
|
||||
# ALIBS are always placed at the end of all linker (cc -o) commands
|
||||
ALIBS = $(PLATFORMLIBS)
|
||||
|
||||
#
|
||||
# default definitions for Unix utilities (may be over-ridden in Make-platform)
|
||||
CC = cc
|
||||
MAKE = make
|
||||
RANLIB = ranlib
|
||||
AR = ar
|
||||
RM = rm -f
|
||||
MV = mv -f
|
||||
CP = cp
|
||||
CHMOD = chmod
|
||||
CAT = cat
|
||||
LN = ln -s
|
||||
HARDLN = ln
|
||||
TAIL = tail
|
||||
SED = sed
|
||||
LINT = lint
|
||||
5LINT = lint
|
||||
MKDIR = mkdir
|
||||
INSTALL = install
|
||||
INSTALLFLAGS = -c
|
||||
BASENAME= basename
|
||||
DIRNAME = dirname
|
||||
MKDEP = $(LDAPSRC)/build/mkdep -s -f Makefile
|
||||
PWD = pwd
|
||||
DATE = date
|
||||
HOSTNAME= hostname
|
||||
|
||||
|
||||
#
|
||||
# empty target used to force rules to be invoked
|
||||
#
|
||||
FORCE:
|
||||
|
@ -1,3 +0,0 @@
|
||||
The unproto code was obtained from:
|
||||
|
||||
ftp://ftp.win.tue.nl/pub/unix/unproto5.shar.Z
|
47
build/dir.mk
Normal file
47
build/dir.mk
Normal file
@ -0,0 +1,47 @@
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
## Makes subdirectories
|
||||
##
|
||||
|
||||
|
||||
all-common: all-local FORCE
|
||||
@echo "Making all in `$(PWD)`"
|
||||
@for i in $(SUBDIRS) $(ALLDIRS); do \
|
||||
echo " Entering subdirectory $$i"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) all ); \
|
||||
echo " "; \
|
||||
done
|
||||
|
||||
install-common: install-local FORCE
|
||||
@echo "Making install in `$(PWD)`"
|
||||
@for i in $(SUBDIRS) $(INSTALLDIRS); do \
|
||||
echo " Entering subdirectory $$i"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) install ); \
|
||||
echo " "; \
|
||||
done
|
||||
|
||||
clean-common: clean-local FORCE
|
||||
@echo "Making clean in `$(PWD)`"
|
||||
@for i in $(SUBDIRS) $(CLEANDIRS); do \
|
||||
echo " Entering subdirectory $$i"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) clean ); \
|
||||
echo " "; \
|
||||
done
|
||||
|
||||
veryclean-common: veryclean-local FORCE
|
||||
@echo "Making veryclean in `$(PWD)`"
|
||||
@for i in $(SUBDIRS) $(CLEANDIRS); do \
|
||||
echo " Entering subdirectory $$i"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
|
||||
echo " "; \
|
||||
done
|
||||
|
||||
depend-common: depend-local FORCE
|
||||
@echo "Making depend in `$(PWD)`"
|
||||
@for i in $(SUBDIRS) $(DEPENDDIRS); do \
|
||||
echo " Entering subdirectory $$i"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) depend ); \
|
||||
echo " "; \
|
||||
done
|
||||
|
||||
Makefile: $(top_srcdir)/build/dir.mk
|
6
build/info.mk
Normal file
6
build/info.mk
Normal file
@ -0,0 +1,6 @@
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
## Makefile Template for Non-Source Directories
|
||||
##
|
||||
|
||||
Makefile: $(top_srcdir)/build/info.mk
|
42
build/lib.mk
Normal file
42
build/lib.mk
Normal file
@ -0,0 +1,42 @@
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
## Makefile Template for Libraries
|
||||
##
|
||||
|
||||
all-common: $(LIBRARY) $(PROGRAMS)
|
||||
|
||||
$(LIBRARY): version.o
|
||||
$(AR) ru $@ $(OBJS) version.o
|
||||
@$(RANLIB) $@; \
|
||||
$(RM) ../$@; \
|
||||
(d=`$(PWD)` ; $(LN_S) `$(BASENAME) $$d`/$@ ../$@)
|
||||
|
||||
version.c: $(OBJS) $(srcdir)/Version.c
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` \
|
||||
h=`$(HOSTNAME)` t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Version.c > $@)
|
||||
|
||||
install-common: all-common install-local
|
||||
|
||||
lint: lint-local FORCE
|
||||
$(LINT) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
lint5: lint5-local FORCE
|
||||
$(5LINT) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
clean-common: clean-local
|
||||
$(RM) $(LIBRARY) ../$(LIBRARY) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) \
|
||||
*.o a.out core version.c
|
||||
|
||||
depend-common: depend-local
|
||||
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
veryclean-common: veryclean-local clean-common
|
||||
|
||||
lint-local: FORCE
|
||||
lint5-local: FORCE
|
||||
|
||||
Makefile: $(top_srcdir)/build/lib.mk
|
45
build/man.mk
Normal file
45
build/man.mk
Normal file
@ -0,0 +1,45 @@
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
## Makefile Template for Manual Pages
|
||||
##
|
||||
|
||||
MANDIR=$(mandir)/man$(MANSECT)
|
||||
|
||||
install-common: all-common install-local
|
||||
-$(MKDIR) -p $(MANDIR)
|
||||
@TMPMAN=/tmp/ldapman.$$$$$(MANCOMPRESSSUFFIX); \
|
||||
VERSION=`$(CAT) $(VERSIONFILE)`; \
|
||||
for page in *.$(MANSECT); do \
|
||||
$(SED) -e "s%LDVERSION%$$VERSION%" \
|
||||
-e 's%ETCDIR%$(sysconfdir)%' \
|
||||
-e 's%SYSCONFDIR%$(sysconfdir)%' \
|
||||
-e 's%SBINDIR%$(sbindir)%' \
|
||||
-e 's%BINDIR%$(bindir)%' \
|
||||
-e 's%LIBDIR%$(libdir)%' \
|
||||
-e 's%LIBEXECDIR%$(libexecdir)%' \
|
||||
$$page | $(MANCOMPRESS) > $$TMPMAN; \
|
||||
echo "installing $(MANDIR)/$$page"; \
|
||||
$(RM) $(MANDIR)/$$page $(MANDIR)/$$page$(MANCOMPRESSSUFFIX); \
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 644 $$TMPMAN $(MANDIR)/$$page$(MANCOMPRESSSUFFIX); \
|
||||
if [ -f "$$page.links" ]; then \
|
||||
for link in `$(CAT) $$page.links`; do \
|
||||
echo "installing $(MANDIR)/$$link as link to $$page"; \
|
||||
$(RM) $(INSTDIR)/$$link $(MANDIR)/$$link$(MANCOMPRESSSUFFIX); \
|
||||
ln -sf $$page$(MANCOMPRESSSUFFIX) $(MANDIR)/$$link$(MANCOMPRESSSUFFIX); \
|
||||
done; \
|
||||
fi; \
|
||||
done; \
|
||||
$(RM) $$TMPMAN
|
||||
|
||||
all-common: all-local
|
||||
clean-common: clean-local
|
||||
veryclean-common: veryclean-local clean-local
|
||||
depend-common: depend-local
|
||||
lint: lint-local
|
||||
lint5: lint5-local
|
||||
|
||||
# these could be empty
|
||||
lint-local: FORCE
|
||||
lint5-local: FORCE
|
||||
|
||||
Makefile: $(top_srcdir)/build/lib.mk
|
@ -1,68 +0,0 @@
|
||||
#
|
||||
# You should NOT need to edit this file at all: if you just type make
|
||||
# in this directory, LDAP will be built for this platform using this
|
||||
# compiler. If you type make links a build area will be created for
|
||||
# you under ./obj. You should # cd in there and edit the Make-common file
|
||||
# before building. See the LDAP INSTALL file for more information.
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# LDAP lightweight X.500 Directory access platform setup makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
############################################################################
|
||||
# #
|
||||
# You should not have to edit anything in this file #
|
||||
# #
|
||||
############################################################################
|
||||
LN=ln -s
|
||||
RM=rm -f
|
||||
SED=sed
|
||||
PWD=pwd
|
||||
|
||||
LDAPSRC= ../../..
|
||||
|
||||
all: platform
|
||||
( cd $(LDAPSRC); $(MAKE) $(MFLAGS) )
|
||||
|
||||
install: platform
|
||||
( cd $(LDAPSRC); $(MAKE) $(MFLAGS) install )
|
||||
|
||||
platform: FORCE
|
||||
@PWD=`$(PWD)`; \
|
||||
PLATFORMCC=`basename $$PWD`; \
|
||||
PLATFORM=`echo $$PLATFORMCC | $(SED) 's/-.*$$//'`; \
|
||||
CC=`echo $$PLATFORMCC | $(SED) 's/^.*-//'`; \
|
||||
echo "** Setting platform to $$PLATFORM and compiler $$CC"; \
|
||||
( cd $(LDAPSRC); \
|
||||
$(RM) .make-platform; \
|
||||
$(LN) build/platforms/$$PLATFORMCC/Make-platform .make-platform )
|
||||
|
||||
links: FORCE
|
||||
@PWD=`$(PWD)`; \
|
||||
PLATFORMCC=`basename $$PWD`; \
|
||||
DEST=./obj-$$PLATFORMCC; \
|
||||
PLATFORM=`echo $$PLATFORMCC | $(SED) 's/-.*$$//'`; \
|
||||
CC=`echo $$PLATFORMCC | $(SED) 's/^.*-//'`; \
|
||||
echo "** Setting platform to $$PLATFORM and compiler $$CC"; \
|
||||
( cd $(LDAPSRC); $(MAKE) $(MFLAGS) DEST=$$DEST links; \
|
||||
cd $$DEST; \
|
||||
$(LN) .src/build/platforms/$$PLATFORMCC/Make-platform .make-platform ); \
|
||||
$(LN) $(LDAPSRC)/$$DEST .
|
||||
|
||||
clean: FORCE
|
||||
|
||||
veryclean:
|
||||
-$(RM) -r ./obj-*
|
||||
|
||||
FORCE:
|
@ -1,46 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# LDAP build/platforms Makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
############################################################################
|
||||
# #
|
||||
# You should not have to edit anything below this point #
|
||||
# #
|
||||
############################################################################
|
||||
|
||||
all: FORCE
|
||||
|
||||
|
||||
install: FORCE
|
||||
|
||||
clean: FORCE
|
||||
@echo "making clean in `pwd`"
|
||||
@for i in *; do \
|
||||
if [ -d $$i -a $$i != "CVS" -a -f $$i/Makefile ]; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) clean ); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
veryclean: FORCE
|
||||
@echo "making veryclean in `pwd`"
|
||||
@for i in *; do \
|
||||
if [ -d $$i -a $$i != "CVS" -a -f $$i/Makefile ]; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) veryclean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) veryclean ); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
FORCE:
|
||||
|
@ -1,18 +0,0 @@
|
||||
#
|
||||
# LDAP AIX standard cc Make-platform file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# install with BSD semantics
|
||||
INSTALL=/usr/ucb/install
|
||||
|
||||
PLATFORMCFLAGS= -Daix
|
@ -1,19 +0,0 @@
|
||||
#
|
||||
# LDAP AIX standard cc Make-platform file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
# install with BSD commandline
|
||||
INSTALL=/usr/ucb/install
|
||||
|
||||
PLATFORMCFLAGS= -Daix
|
@ -1,27 +0,0 @@
|
||||
#
|
||||
# HP-UX optional c89 Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC=c89
|
||||
|
||||
# ranlib not needed under HP-UX
|
||||
RANLIB = ""
|
||||
|
||||
# install under HP-UX is not like on BSD systems, so we use our own script
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
# we need to link a separate library to get ndbm routines under HP/UX
|
||||
LDBMLIB=-lndbm
|
||||
|
||||
# we need to link in the V3 library to get sigset()
|
||||
PLATFORMLIBS= -lV3
|
||||
|
||||
PLATFORMCFLAGS= -Dhpux -Aa -D_HPUX_SOURCE
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# LDAP HP-UX standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under HP-UX
|
||||
RANLIB = ""
|
||||
|
||||
# install under HP-UX is not like on BSD systems, so we use our own script
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
# we need to link a separate library to get ndbm routines under HP/UX
|
||||
LDBMLIB=-lndbm
|
||||
|
||||
PLATFORMCFLAGS= -Dhpux
|
||||
|
||||
# we need to link in the V3 library to get sigset()
|
||||
PLATFORMLIBS= -lV3
|
||||
|
||||
#
|
||||
# the HP-UX cc compiler doesn't understand function prototypes, so we
|
||||
# need the unproto preprocessor
|
||||
#
|
||||
NEEDUNPROTO=yes
|
||||
UNPROTOCFLAGS=-tp,$(LDAPSRC)/build/unproto/cpp
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# LDAP HP-UX gcc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC=gcc
|
||||
|
||||
# ranlib not needed under HP-UX
|
||||
RANLIB = ""
|
||||
|
||||
# install under HP-UX is not like on BSD systems, so we use our own script
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
# we need to link a separate library to get ndbm routines under HP/UX
|
||||
LDBMLIB=-lndbm
|
||||
|
||||
# we need to link in the V3 library to get sigset()
|
||||
PLATFORMLIBS= -lV3
|
||||
|
||||
PLATFORMCFLAGS= -Dhpux
|
@ -1,29 +0,0 @@
|
||||
#
|
||||
# LDAP IRIX standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under IRIX
|
||||
RANLIB = ""
|
||||
|
||||
# be explicit about which CC to use
|
||||
CC=cc
|
||||
|
||||
# give full path to hostname since it may not be in user's path
|
||||
HOSTNAME=/usr/bsd/hostname
|
||||
|
||||
# don't count on a BSD install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS=-DUSE_WAITPID
|
||||
PLATFORMLIBS=
|
||||
THREADS=
|
||||
THREADSLIB=
|
@ -1,29 +0,0 @@
|
||||
#
|
||||
# LDAP IRIX standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under IRIX
|
||||
RANLIB = ""
|
||||
|
||||
# be explicit about which CC to use
|
||||
CC=gcc
|
||||
|
||||
# give full path to hostname since it may not be in user's path
|
||||
HOSTNAME=/usr/bsd/hostname
|
||||
|
||||
# don't count on a BSD install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS=-DUSE_WAITPID
|
||||
PLATFORMLIBS=
|
||||
THREADS=
|
||||
THREADSLIB=
|
@ -1,34 +0,0 @@
|
||||
#
|
||||
# LDAP SVR4 standard cc Make-platform file
|
||||
#
|
||||
# Uses the std SVR4 stuff whenever possible.
|
||||
# Some references to the BSD compatibility required.
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
# compiler to use, e.g. CC=cc or CC=gcc
|
||||
CC = cc
|
||||
|
||||
# flags added to every compile
|
||||
# Use the BSD include files but only after the SVR4 files.
|
||||
PLATFORMCFLAGS= -DSYSV -DSVR4 -I/usr/include -I/usr/ucbinclude
|
||||
|
||||
# flags added to every link
|
||||
PLATFORMLDFLAGS =
|
||||
|
||||
# extra libraries needed (added to the end of all link commands)
|
||||
PLATFORMLIBS = -lnsl -lnet -lsocket
|
||||
|
||||
# ndbm library, needed if not in libc (e.g. LDBMLIB=-lndbm)
|
||||
LDBMLIB = -L/usr/ucblib -lucb
|
||||
|
||||
# BSD-like install command; if necessary, you can use a script
|
||||
INSTALL = /usr/ucb/install
|
||||
|
||||
# command to convert libraries for efficient random access;
|
||||
RANLIB = ""
|
||||
|
||||
# other commands - see the file build/Make-append for a list
|
@ -1,17 +0,0 @@
|
||||
#
|
||||
# LDAP NetBSD cc Make-platform file
|
||||
# on NetBSD, cc is gcc
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
PLATFORMCFLAGS= -Dnetbsd
|
@ -1,16 +0,0 @@
|
||||
#
|
||||
# LDAP NetBSD GNU C Make-platform file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
PLATFORMCFLAGS= -Dnetbsd
|
@ -1,15 +0,0 @@
|
||||
#
|
||||
# LDAP NeXTSTEP cc Make-platform file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
PLATFORMCFLAGS= -Dnextstep
|
||||
PLATFORMLDFLAGS= -all_load
|
@ -1,33 +0,0 @@
|
||||
# LDAP OpenBSD cc Make-platform file
|
||||
# on OpenBSD, cc is gcc
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
PLATFORMCFLAGS= -Dopenbsd
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.if (${KERBEROS} == "yes")
|
||||
KERBEROS=-DKERBEROS
|
||||
KRBINCLUDEFLAG = -I/usr/include/kerberosIV
|
||||
KRBLIBS = -lkrb -ldes
|
||||
.endif
|
||||
|
||||
LDBMBACKEND=-DLDBM_USE_DBBTREE
|
||||
|
||||
THREADS=-DNO_THREADS
|
||||
|
||||
LDAP_SENDMAIL=/usr/sbin/sendmail
|
||||
LDAP_EDITOR=/usr/bin/vi
|
||||
LDAP_FINGER=/usr/bin/finger
|
||||
|
@ -1,34 +0,0 @@
|
||||
#
|
||||
# LDAP OpenBSD GNU C Make-platform file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
PLATFORMCFLAGS= -Dopenbsd
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.if (${KERBEROS} == "yes")
|
||||
KERBEROS=-DKERBEROS
|
||||
KRBINCLUDEFLAG = -I/usr/include/kerberosIV
|
||||
KRBLIBS = -lkrb -ldes
|
||||
.endif
|
||||
|
||||
# Use DB BTREE
|
||||
LDBMBACKEND=-DLDBM_USE_DBBTREE
|
||||
|
||||
THREADS=-DNO_THREADS
|
||||
|
||||
LDAP_SENDMAIL=/usr/sbin/sendmail
|
||||
LDAP_EDITOR=/usr/bin/vi
|
||||
LDAP_FINGER=/usr/bin/finger
|
||||
|
@ -1,24 +0,0 @@
|
||||
#
|
||||
# LDAP OSF1 standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# Even though prototypes are supported by the compiler, OSF's CC doesn't
|
||||
# seem to define __STDC__ so we explicitly defined NEEDPROTOS here.
|
||||
PLATFORMCFLAGS= -Dosf1 -DNEEDPROTOS
|
||||
PLATFORMLDFLAGS=
|
||||
|
||||
THREADS= -DTHREAD_DCE_PTHREADS
|
||||
THREADSLIB= -lpthreads
|
||||
|
||||
# the BSD-like install under OSF/1 is called installbsd
|
||||
INSTALL=installbsd
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# LDAP OSF1 gcc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
CC = gcc
|
||||
|
||||
PLATFORMCFLAGS= -Dosf1
|
||||
PLATFORMLDFLAGS=
|
||||
|
||||
THREADS= -DTHREAD_DCE_PTHREADS
|
||||
THREADSLIB= -lpthreads
|
||||
|
||||
# the BSD-like install under OSF/1 is called installbsd
|
||||
INSTALL=installbsd
|
||||
|
@ -1,23 +0,0 @@
|
||||
#
|
||||
# LDAP SCO standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under SCO
|
||||
RANLIB = ""
|
||||
|
||||
# be explicit about which CC to use
|
||||
CC=/bin/cc
|
||||
|
||||
# don't count on /usr/ucb/install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS= -DSCO -DNEED_BSDREGEX -DSYSV -DNOTERMCAP
|
||||
PLATFORMLIBS= -lsocket -lnsl_s
|
@ -1,22 +0,0 @@
|
||||
#
|
||||
# LDAP SCO gcc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under SCO
|
||||
RANLIB = ""
|
||||
|
||||
CC=gcc
|
||||
|
||||
# don't count on /usr/ucb/install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS= -DSCO -DNEED_BSDREGEX -DSYSV -DNOTERMCAP
|
||||
PLATFORMLIBS= -lsocket -lnsl_s
|
@ -1,25 +0,0 @@
|
||||
#
|
||||
# LDAP SunOS standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
5LINT = /usr/5bin/lint
|
||||
|
||||
PLATFORMCFLAGS= -Dsunos4
|
||||
THREADS= -DTHREAD_SUNOS4_LWP
|
||||
THREADSLIB=-llwp
|
||||
|
||||
#
|
||||
# the SunOS 4 cc compiler doesn't understand function prototypes, so we
|
||||
# need the unproto preprocessor
|
||||
#
|
||||
NEEDUNPROTO=yes
|
||||
UNPROTOCFLAGS=-Qpath $(LDAPSRC)/build/unproto
|
@ -1,19 +0,0 @@
|
||||
#
|
||||
# LDAP SunOS GNU C Make-platform file
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
5LINT = /usr/5bin/lint
|
||||
|
||||
PLATFORMCFLAGS= -Dsunos4
|
||||
THREADS= -DTHREAD_SUNOS4_LWP
|
||||
THREADSLIB=-llwp
|
@ -1,29 +0,0 @@
|
||||
#
|
||||
# LDAP SunOS5 standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under SunOS5
|
||||
RANLIB = ""
|
||||
|
||||
# be explicit about which CC to use
|
||||
CC=cc
|
||||
|
||||
# give full path to hostname since it may not be in user's path
|
||||
HOSTNAME=/usr/ucb/hostname
|
||||
|
||||
# don't count on /usr/ucb/install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS= -Dsunos5 -D_REENTRANT
|
||||
PLATFORMLIBS= -lsocket -lnsl -lgen
|
||||
THREADS= -DTHREAD_SUNOS5_LWP
|
||||
THREADSLIB=-lthread
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# LDAP SunOS5 GNU C Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
# ranlib not needed under SunOS5
|
||||
RANLIB = ""
|
||||
|
||||
# give full path to hostname since it may not be in user's path
|
||||
HOSTNAME=/usr/ucb/hostname
|
||||
|
||||
# don't count on /usr/ucb/install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS= -Dsunos5 -D_REENTRANT
|
||||
PLATFORMLIBS= -lsocket -lnsl -lgen
|
||||
THREADS= -DTHREAD_SUNOS5_LWP
|
||||
THREADSLIB=-lthread
|
@ -1,29 +0,0 @@
|
||||
#
|
||||
# LDAP SunOS5 standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
# ranlib not needed under SunOS5
|
||||
RANLIB = ""
|
||||
|
||||
# be explicit about which CC to use
|
||||
CC=cc
|
||||
|
||||
# give full path to hostname since it may not be in user's path
|
||||
HOSTNAME=/bin/hostname
|
||||
|
||||
# don't count on /usr/ucb/install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS= -Dsunos5 -D__SunOS_5_6 -D_REENTRANT
|
||||
PLATFORMLIBS= -lsocket -lnsl -lgen
|
||||
THREADS= -DTHREAD_SUNOS5_LWP
|
||||
THREADSLIB=-lthread
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# LDAP SunOS5 GNU C Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
CC = gcc
|
||||
|
||||
# ranlib not needed under SunOS5
|
||||
RANLIB = ""
|
||||
|
||||
# give full path to hostname since it may not be in user's path
|
||||
HOSTNAME=/bin/hostname
|
||||
|
||||
# don't count on /usr/ucb/install being present or first in path
|
||||
INSTALL=$(LDAPSRC)/build/install.sh
|
||||
|
||||
PLATFORMCFLAGS= -Dsunos5 -D__SunOS_5_6 -D_REENTRANT
|
||||
PLATFORMLIBS= -lsocket -lnsl -lgen
|
||||
THREADS= -DTHREAD_SUNOS5_LWP
|
||||
THREADSLIB=-lthread
|
@ -1,16 +0,0 @@
|
||||
#
|
||||
# LDAP Ultrix standard cc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
PLATFORMCFLAGS= -Dultrix -YSYSTEM_FIVE
|
||||
PLATFORMLDFLAGS= -YSYSTEM_FIVE
|
@ -1,16 +0,0 @@
|
||||
#
|
||||
# LDAP Ultrix standard gcc Make-platform file
|
||||
#
|
||||
|
||||
#
|
||||
# add any platform-specific overrides below here
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# you will probably not need to edit anything below this point
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
CC= gcc
|
||||
PLATFORMCFLAGS= -Dultrix
|
@ -1,31 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# LDAP build/platforms/vms Makefile (do nothing)
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
#
|
||||
############################################################################
|
||||
# #
|
||||
# You should not have to edit anything in this file #
|
||||
# #
|
||||
############################################################################
|
||||
LDAPSRC= ../../..
|
||||
|
||||
all: FORCE
|
||||
|
||||
links: FORCE
|
||||
|
||||
clean: FORCE
|
||||
|
||||
veryclean: FORCE
|
||||
|
||||
FORCE:
|
@ -1,95 +0,0 @@
|
||||
$! 30-Nov-1995 ldap V3.2 Craig Watkins Innosoft International, Inc.
|
||||
$!
|
||||
$! This is a crude make procedure to build the ldap libraries and the test
|
||||
$! program. This should work with DECC or VAXC compilers.
|
||||
$!
|
||||
$! This links with UCX libraries so that it should work on any TCP/IP
|
||||
$! package that has UCX emulation. This has been tested with MultiNet.
|
||||
$! You may have to change the LINK to find your copy of UCX$IPC.OLB.
|
||||
$!
|
||||
$ ARCH = "VAX"
|
||||
$ if f$getsyi("hw_model") .GE. 1024 then ARCH = "ALPHA"
|
||||
$ !
|
||||
$ ! If we are on an alpha/axp, we need to use DECC -- otherwise, your choice
|
||||
$ COMPILER = "VAXC"
|
||||
$ if ARCH .eqs. "ALPHA" then COMPILER = "DECC"
|
||||
$ !
|
||||
$ if COMPILER .eqs. "VAXC"
|
||||
$ then
|
||||
$ define arpa sys$library:
|
||||
$ define sys sys$library:
|
||||
$ define netinet sys$library:
|
||||
$! This assumes your default compiler is VAXC; if not, add /VAXC below
|
||||
$ cc_switches = "/include=([---.include],[---.libraries.vms])/define=(LDAP_DEBUG,CLDAP,LDAP_REFERRALS,STR_TRANSLATION,LDAP_CHARSET_8859=88591)"
|
||||
$!
|
||||
$ else
|
||||
$!
|
||||
$ cc_switches = "/decc/standard=vaxc/include=([---.include],[---.libraries.vms])/define=(__STDC__,LDAP_DEBUG,CLDAP,LDAP_REFERRALS,STR_TRANSLATION,LDAP_CHARSET_8859=88591)
|
||||
$ endif
|
||||
$ !
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.liblber]io
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.liblber]encode
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.liblber]decode
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.liblber]version
|
||||
$ !
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]ABANDON
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]ADD
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]ADDENTRY
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]BIND
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]CACHE
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]CHARSET
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]CLDAP
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]COMPARE
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]DELETE
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]DISPTMPL
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]DSPARSE
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]ERROR
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]FREE
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]FRIENDLY
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]GETATTR
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]GETDN
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]GETDXBYNAME
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]GETENTRY
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]GETFILTER
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]GETVALUES
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]KBIND
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]MODIFY
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]MODRDN
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]OPEN
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]OS-IP
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]REGEX
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]REQUEST
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]RESULT
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]SBIND
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]SEARCH
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]SORT
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]SRCHPREF
|
||||
$ cc 'CC_SWITCHES' 'P1' /define="TEMPLATEFILE=""LDAP_ETC:ldaptemplates.conf""" -
|
||||
[---.libraries.libldap]TMPLOUT
|
||||
$!CC 'CC_SWITCHES' 'P1' [---.libraries.libldap]TMPLTEST
|
||||
$ cc 'CC_SWITCHES' 'P1' /define="FILTERFILE=""LDAP_ETC:ldapfilter.conf""" -
|
||||
[---.libraries.libldap]UFN
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]UNBIND
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]VERSION
|
||||
$ !
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.vms]getopt
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.vms]strings
|
||||
$ !
|
||||
$ library/create/log ldap.olb *.obj
|
||||
$ !
|
||||
$ cc 'CC_SWITCHES' 'P1' [---.libraries.libldap]TEST
|
||||
$ !
|
||||
$ if COMPILER .eqs. "VAXC"
|
||||
$ then
|
||||
$!
|
||||
$ link test, sys$input/opt
|
||||
ldap.olb/lib
|
||||
sys$library:ucx$ipc.olb/lib
|
||||
sys$share:vaxcrtl.exe/share
|
||||
$!
|
||||
$ else
|
||||
$!
|
||||
$ link test, sys$input/opt
|
||||
ldap.olb/lib
|
||||
$ endif
|
||||
$!
|
28
build/rules.mk
Normal file
28
build/rules.mk
Normal file
@ -0,0 +1,28 @@
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
## Makefile Template for Programs
|
||||
##
|
||||
|
||||
all-common: all-local $(PROGRAMS)
|
||||
|
||||
install-common: all-common install-local
|
||||
|
||||
clean-common: clean-local
|
||||
$(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o a.out core
|
||||
|
||||
veryclean-common: veryclean-local clean-local
|
||||
|
||||
depend-common: depend-local
|
||||
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
lint: lint-local
|
||||
$(LINT) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
lint5: lint5-local
|
||||
$(5LINT) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
# these could be empty
|
||||
lint-local: FORCE
|
||||
lint5-local: FORCE
|
||||
|
||||
Makefile: $(top_srcdir)/build/rules.mk
|
73
build/srv.mk
Normal file
73
build/srv.mk
Normal file
@ -0,0 +1,73 @@
|
||||
##---------------------------------------------------------------------------
|
||||
##
|
||||
## Makefile Template for Servers
|
||||
##
|
||||
|
||||
all-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) all-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to build $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
clean-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) clean-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to clean $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
veryclean-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) veryclean-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to very clean $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
lint-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) lint-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to lint $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
5lint-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) 5lint-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to 5lint $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
depend-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) depend-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to depend $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
install-common: FORCE
|
||||
@if [ "$(BUILD_SRV)" = "yes" ]; then \
|
||||
$(MAKE) $(MFLAGS) install-srv; \
|
||||
else \
|
||||
echo "run configure with $(BUILD_OPT) to install $(PROGRAMS)"; \
|
||||
fi
|
||||
|
||||
all-srv: all-local
|
||||
|
||||
install-srv: all-srv install-local
|
||||
|
||||
lint-srv: lint-local
|
||||
$(LINT) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
5lint-srv: lint5-local
|
||||
$(5LINT) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
clean-srv: clean-local
|
||||
$(RM) $(PROGRAMS) $(XPROGRAMS) $(XSRCS) *.o a.out core
|
||||
|
||||
depend-srv: depend-local
|
||||
$(MKDEP) $(DEFS) $(DEFINES) $(SRCS)
|
||||
|
||||
veryclean-srv: clean-srv veryclean-local
|
||||
|
||||
Makefile: $(top_srcdir)/build/srv.mk
|
108
build/top.mk
Normal file
108
build/top.mk
Normal file
@ -0,0 +1,108 @@
|
||||
##
|
||||
## Copyright 1998 The OpenLDAP Foundation
|
||||
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
|
||||
## of this package for details.
|
||||
##
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@/ldap
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
|
||||
MV = mv
|
||||
LN = ln
|
||||
LN_S = @LN_S@
|
||||
RM = rm -f
|
||||
MAKEINFO = @MAKEINFO@
|
||||
RANLIB = @RANLIB@
|
||||
AR = ar
|
||||
|
||||
LINT = lint
|
||||
5LINT = 5lint
|
||||
MKDEP = $(top_srcdir)/build/mkdep
|
||||
|
||||
# Misc UNIX commands used in makefiles
|
||||
SED = sed
|
||||
DATE = date
|
||||
HOSTNAME = uname -n
|
||||
BASENAME = basename
|
||||
PWD = pwd
|
||||
CAT = cat
|
||||
MKDIR = mkdir
|
||||
CHMOD = chmod
|
||||
|
||||
# Misc UNIX commands used in programs
|
||||
EDITOR = @EDITOR@
|
||||
FINGER = @FINGER@
|
||||
SENDMAIL = @SENDMAIL@
|
||||
|
||||
# Version
|
||||
VERSIONFILE = $(top_srcdir)/build/version
|
||||
|
||||
INCLUDEDIR = $(top_srcdir)/include
|
||||
LDAP_INCPATH = -I$(LDAP_INCDIR) -I$(INCLUDEDIR)
|
||||
LDAP_LIBPATH = -L$(LDAP_LIBDIR)
|
||||
|
||||
LDAP_LIBS = $(LDAP_LIBPATH) -lldif -lldap -llber
|
||||
LDAP_LIBDEPEND = $(LDAP_LIBDIR)/libldif.a $(LDAP_LIBDIR)/libldap.a $(LDAP_LIBDIR)/liblber.a
|
||||
|
||||
# AutoConfig generated
|
||||
AC_CC = @CC@
|
||||
AC_DEFS = @CPPFLAGS@ @DEFS@
|
||||
AC_LIBS = @LDFLAGS@ @LIBS@
|
||||
AC_CFLAGS = @CFLAGS@
|
||||
AC_LDFLAGS =
|
||||
|
||||
KRB_LIBS = @KRB_LIBS@
|
||||
TERMCAP_LIBS = @TERMCAP_LIBS@
|
||||
|
||||
# Our Defaults
|
||||
CC = $(AC_CC)
|
||||
DEFS = $(LDAP_INCPATH) $(XINCPATH) $(XDEFS) $(AC_DEFS)
|
||||
LIBS = $(LDAP_LIBS) $(XLIBS) $(AC_LIBS)
|
||||
|
||||
CFLAGS = $(AC_CFLAGS) $(DEFS) $(DEFINES)
|
||||
LDFLAGS = $(AC_LDFLAGS)
|
||||
|
||||
all: all-common FORCE
|
||||
install: install-common FORCE
|
||||
clean: clean-common FORCE
|
||||
veryclean: veryclean-common FORCE
|
||||
depend: depend-common FORCE
|
||||
|
||||
# empty local rules
|
||||
all-local:
|
||||
install-local:
|
||||
clean-local:
|
||||
veryclean-local:
|
||||
depend-local:
|
||||
lint-local:
|
||||
lint5-local:
|
||||
|
||||
Makefile: Makefile.in $(top_srcdir)/build/top.mk
|
||||
|
||||
# empty rule for forcing rules
|
||||
FORCE:
|
||||
|
||||
##---------------------------------------------------------------------------
|
109
build/uname.sh
109
build/uname.sh
@ -1,109 +0,0 @@
|
||||
#!/bin/sh
|
||||
# simple BSD-like uname replacement for those systems without it
|
||||
#
|
||||
# Copyright (c) 1995 The Regents of the University of Michigan
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# if /bin/uname or /usr/bin/uname exists, just use it
|
||||
# ...unless we are on SCO, where the provided uname is bad
|
||||
#
|
||||
if [ ! -f /usr/bin/swconfig ]; then
|
||||
if [ -f /bin/uname ]; then
|
||||
exec /bin/uname $*
|
||||
fi
|
||||
|
||||
if [ -f /usr/bin/uname ]; then
|
||||
exec /usr/bin/uname $*
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# flags to keep track of what to output
|
||||
#
|
||||
PRINT_SYSTEM=0
|
||||
PRINT_VERSION=0
|
||||
PRINT_RELEASE=0
|
||||
|
||||
#
|
||||
# process arguments
|
||||
#
|
||||
USAGE="usage: $0 [-s] [-v] [-r]"
|
||||
|
||||
while [ $# != 0 ]; do
|
||||
case "$1" in
|
||||
-s)
|
||||
PRINT_SYSTEM=1
|
||||
;;
|
||||
-v)
|
||||
PRINT_VERSION=1
|
||||
;;
|
||||
-r)
|
||||
PRINT_RELEASE=1
|
||||
;;
|
||||
*)
|
||||
echo "$USAGE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# print system name by default
|
||||
#
|
||||
if [ $PRINT_VERSION = "0" -a $PRINT_RELEASE = "0" ]; then
|
||||
PRINT_SYSTEM=1
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# default to unknown everything...
|
||||
#
|
||||
SYSTEM="Unknown-System"
|
||||
VERSION="Unknown-Version"
|
||||
RELEASE="Unknown-Release"
|
||||
|
||||
#
|
||||
# check to see if we are on a machine that runs NextSTEP or SCO
|
||||
#
|
||||
if [ -r /NextApps ]; then
|
||||
SYSTEM="NeXTSTEP"
|
||||
elif [ -f /usr/bin/swconfig ]; then
|
||||
SYSTEM="SCO"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# output requested information
|
||||
#
|
||||
OUTPUT=0
|
||||
if [ $PRINT_SYSTEM = "1" ]; then
|
||||
echo -n "$SYSTEM"
|
||||
OUTPUT=1
|
||||
fi
|
||||
|
||||
if [ $PRINT_VERSION = "1" ]; then
|
||||
if [ $OUTPUT = "1" ]; then
|
||||
echo -n " $VERSION"
|
||||
else
|
||||
echo -n "$VERSION"
|
||||
OUTPUT=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $PRINT_RELEASE = "1" ]; then
|
||||
if [ $OUTPUT = "1" ]; then
|
||||
echo -n " $RELEASE"
|
||||
else
|
||||
echo -n "$RELEASE"
|
||||
OUTPUT=1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
exit 0
|
@ -1,123 +0,0 @@
|
||||
# @(#) Makefile 1.6 93/06/18 22:29:40
|
||||
|
||||
## BEGIN CONFIGURATION STUFF
|
||||
|
||||
# In the unlikely case that your compiler has no hooks for alternate
|
||||
# compiler passes, use a "cc cflags -E file.c | unproto >file.i"
|
||||
# pipeline, then "cc cflags -c file.i" to compile the resulting
|
||||
# intermediate file.
|
||||
#
|
||||
# Otherwise, the "/lib/cpp | unproto" pipeline can be packaged as an
|
||||
# executable shell script (see the provided "cpp.sh" script) that should
|
||||
# be installed as "/whatever/cpp". This script should then be specified
|
||||
# to the C compiler as a non-default preprocessor.
|
||||
#
|
||||
# PROG = unproto
|
||||
# PIPE =
|
||||
|
||||
# The overhead and problems of shell script interpretation can be
|
||||
# eliminated by having the unprototyper program itself open the pipe to
|
||||
# the preprocessor. In that case, define the PIPE_THROUGH_CPP macro as
|
||||
# the path name of the default C preprocessor (usually "/lib/cpp"),
|
||||
# install the unprototyper as "/whatever/cpp" and specify that to the C
|
||||
# compiler as a non-default preprocessor.
|
||||
#
|
||||
PROG = cpp
|
||||
PIPE = -DPIPE_THROUGH_CPP=\"/lib/cpp\"
|
||||
|
||||
# Some compilers complain about some #directives. The following is only a
|
||||
# partial solution, because the directives are still seen by /lib/cpp.
|
||||
# Be careful with filtering out #pragma, because some pre-ANSI compilers
|
||||
# (SunOS) rely on its use.
|
||||
#
|
||||
# SKIP = -DIGNORE_DIRECTIVES=\"pragma\",\"foo\",\"bar\"
|
||||
#
|
||||
SKIP =
|
||||
|
||||
# The bell character code depends on the character set. With ASCII, it is
|
||||
# 7. Specify a string constant with exactly three octal digits. If you
|
||||
# change this definition, you will have to update the example.out file.
|
||||
#
|
||||
BELL = -DBELL=\"007\"
|
||||
|
||||
# Some C compilers have problems with "void". The nature of the problems
|
||||
# depends on the age of the compiler.
|
||||
#
|
||||
# If your compiler does not understand "void" at all, compile with
|
||||
# -DMAP_VOID. The unprototyper will replace "void *" by "char *", a
|
||||
# (void) argument list by an empty one, and will replace all other
|
||||
# instances of "void" by "int".
|
||||
#
|
||||
# If your compiler has problems with "void *" only, compile with
|
||||
# -DMAP_VOID_STAR. The unprototyper will replace "void *" by "char *",
|
||||
# and will replace a (void) argument list by an empty one. All other
|
||||
# instances of "void" will be left alone.
|
||||
#
|
||||
# If neither of these are defined, (void) argument lists will be replaced
|
||||
# by empty ones.
|
||||
#
|
||||
# MAP = -DMAP_VOID_STAR
|
||||
|
||||
# Now that we have brought up the subject of antique C compilers, here's
|
||||
# a couple of aliases that may be useful, too.
|
||||
#
|
||||
# ALIAS = -Dstrchr=index
|
||||
|
||||
# If you need support for functions that implement ANSI-style variable
|
||||
# length argument lists, edit the stdarg.h file provided with this
|
||||
# package so that it contains the proper definitions for your machine.
|
||||
|
||||
## END CONFIGURATION STUFF
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
CFILES = unproto.c tok_io.c tok_class.c tok_pool.c vstring.c symbol.c error.c \
|
||||
hash.c strsave.c
|
||||
HFILES = error.h token.h vstring.h symbol.h
|
||||
SCRIPTS = cpp.sh acc.sh
|
||||
SAMPLES = stdarg.h stddef.h stdlib.h varargs.c example.c example.out
|
||||
SOURCES = README $(CFILES) $(HFILES) Makefile $(SCRIPTS) $(SAMPLES)
|
||||
FILES = $(SOURCES) unproto.1
|
||||
OBJECTS = tok_io.o tok_class.o tok_pool.o unproto.o vstring.o symbol.o error.o \
|
||||
hash.o strsave.o
|
||||
|
||||
CFLAGS = -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS)
|
||||
#CFLAGS = -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -p -Dstatic=
|
||||
#CFLAGS = -g $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DDEBUG
|
||||
|
||||
$(PROG): $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(MALLOC)
|
||||
|
||||
# For linting, enable all bells and whistles.
|
||||
|
||||
lint:
|
||||
lint -DPIPE_THROUGH_CPP=\"foo\" -DIGNORE_DIRECTIVES=\"foo\",\"bar\" \
|
||||
$(BELL) -DMAP_VOID $(ALIAS) $(CFILES)
|
||||
|
||||
# Testing requires that the program is compiled with -DDEBUG.
|
||||
|
||||
test: $(PROG) cpp example.c example.out
|
||||
./cpp example.c >example.tmp
|
||||
@echo the following diff command should produce no output
|
||||
diff -b example.out example.tmp
|
||||
rm -f example.tmp
|
||||
|
||||
shar: $(FILES)
|
||||
@shar $(FILES)
|
||||
|
||||
archive:
|
||||
$(ARCHIVE) $(SOURCES)
|
||||
|
||||
clean:
|
||||
rm -f *.o core cpp unproto mon.out varargs.o varargs example.tmp
|
||||
|
||||
error.o : error.c token.h error.h Makefile
|
||||
hash.o : hash.c Makefile
|
||||
strsave.o : strsave.c error.h Makefile
|
||||
symbol.o : symbol.c error.h token.h symbol.h Makefile
|
||||
tok_class.o : tok_class.c error.h vstring.h token.h symbol.h Makefile
|
||||
tok_io.o : tok_io.c token.h vstring.h error.h Makefile
|
||||
tok_pool.o : tok_pool.c token.h vstring.h error.h Makefile
|
||||
unproto.o : unproto.c vstring.h stdarg.h token.h error.h symbol.h Makefile
|
||||
varargs.o : varargs.c stdarg.h Makefile
|
||||
vstring.o : vstring.c vstring.h Makefile
|
@ -1,160 +0,0 @@
|
||||
@(#) README 1.6 93/06/18 22:29:34
|
||||
|
||||
unproto - Compile ANSI C with traditional UNIX C compiler
|
||||
|
||||
Description:
|
||||
------------
|
||||
|
||||
This is a filter that sits in between the UNIX C preprocessor and the
|
||||
next UNIX C compiler stage, on the fly transforming ANSI C syntax to
|
||||
old C syntax. Line number information is preserved so that compiler
|
||||
diagnostics still make sense. It runs at roughly the same speed as
|
||||
/lib/cpp, so it has negligible impact on compilation time.
|
||||
|
||||
Typically, the program is invoked by the native UNIX C compiler as an
|
||||
alternate preprocessor. The unprototyper in turn invokes the native C
|
||||
preprocessor and massages its output. Similar tricks can be used with
|
||||
the lint(1) command. Details are given below.
|
||||
|
||||
The filter rewrites ANSI-style function headings, function pointer
|
||||
types and type casts, function prototypes, and combinations thereof.
|
||||
Unlike some other unprototypers, this one is fully recursive and does
|
||||
not depend on source file layout (see the example.c file).
|
||||
|
||||
Besides the rewriting of argument lists, the program does the following
|
||||
transformations: string concatenation, conversion of \a and \x escape
|
||||
sequences to their octal equivalents, translation of the __TIME__ and
|
||||
__DATE__ macros, optional mapping of `void *' to `char *', and optional
|
||||
mapping of plain `void' to `int'.
|
||||
|
||||
The unprototyper provides hooks for compilers that require special
|
||||
tricks for variadic functions (fortunately, many don't). <stdarg.h>
|
||||
support is provided for sparc, mips, mc68k, 80x86, vax, and others.
|
||||
|
||||
The program has been tested with SunOS 4.1.1 (sparc), Ultrix 4.0 and
|
||||
4.2 (mips), and Microport System V Release 2 (80286). It should work
|
||||
with almost every PCC-based UNIX C compiler.
|
||||
|
||||
Restrictions:
|
||||
-------------
|
||||
|
||||
A description of restrictions and workarounds can be found in the
|
||||
unproto.1 manual page.
|
||||
|
||||
Problems fixed with this release:
|
||||
---------------------------------
|
||||
|
||||
Prototypes and definitions of functions returning pointer to function
|
||||
were not rewritten to old style.
|
||||
|
||||
Operation:
|
||||
----------
|
||||
|
||||
This package implements a non-default C preprocessor (the output from
|
||||
the default C preprocessor being piped through the unprototyper). How
|
||||
one tells the C compiler to use a non-default preprocessor program is
|
||||
somewhat compiler-dependent:
|
||||
|
||||
SunOS 4.x: cc -Qpath directory_with_alternate_cpp ...
|
||||
|
||||
Ultrix 4.x: cc -tp -hdirectory_with_alternate_cpp -B ...
|
||||
|
||||
System V.2: cc -Bdirectory_with_alternate_cpp/ -tp ...
|
||||
|
||||
Examples of these, and others, can be found in the acc.sh shell script
|
||||
that emulates an ANSI C compiler. Your C compiler manual page should
|
||||
provide the necessary information.
|
||||
|
||||
A more portable, but less efficient, approach relies on the observation
|
||||
that almost every UNIX C compiler supports the -E (write preprocessor
|
||||
output to stdout) and -P options (preprocess file.c into file.i). Just
|
||||
add the following lines to your Makefiles:
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -E $*.c | unproto >$*.i # simulate -P option
|
||||
$(CC) $(CFLAGS) -c $*.i
|
||||
rm -f $*.i
|
||||
|
||||
On some systems the lint(1) command is just a shell script, and writing
|
||||
a version that uses the unprototyper should not be too hard. With SunOS
|
||||
4.x, /usr/bin/lint is not a shell script, but it does accept the same
|
||||
syntax as the cc(1) command for the specification of a non-default
|
||||
compiler pass.
|
||||
|
||||
You may have to do some research on the lint command provided with your
|
||||
own machine.
|
||||
|
||||
Configuration:
|
||||
--------------
|
||||
|
||||
Check the contents of the `stdarg.h' file provided with this package.
|
||||
This file serves a dual purpose: (1) on systems that do not provide a
|
||||
stdarg.h file, it should be included by C source files that implements
|
||||
ANSI-style variadic functions; (2) it is also used to configure the
|
||||
unprototyper so that it emits the proper magic when it sees `...'.
|
||||
|
||||
The `stdarg.h' file has support for sparc, mips, and for compilers that
|
||||
pass arguments via the stack (typical for 80*86, mc68k and vax). It
|
||||
gives general hints for other compilers.
|
||||
|
||||
The other sample header files (stddef.h and stdlib.h) are not required
|
||||
to build the unprototyper.
|
||||
|
||||
The `varargs.c' file provided with this package can be used to verify
|
||||
that the `stdarg.h' file has been set up correctly.
|
||||
|
||||
If your C compiler has no hooks for an alternate preprocessor (the
|
||||
unprototyper will be used as: `cc cflags -E file.c | unproto >file.i'),
|
||||
build the `unproto' executable without the `PIPE_THROUGH_CPP' feature.
|
||||
Details are given in the Makefile.
|
||||
|
||||
Otherwise, the `cpp.sh' shell script can be used to set up the pipe
|
||||
between the native C preprocessor and the unprototyper command. The
|
||||
script assumes that the unprototyper binary is called `unproto', and
|
||||
that it was compiled without the `PIPE_THROUGH_CPP' feature. See the
|
||||
Makefile and the `cpp.sh' script for details and for a description of
|
||||
possible problems with this approach.
|
||||
|
||||
The overhead and problems of shell-script interpretation can be avoided
|
||||
by letting the unprototyper itself pipe its standard input through the
|
||||
C preprocessor. For this mode of operation, the unprototyper binary
|
||||
should be called `cpp', and the `unproto.c' source file should be
|
||||
compiled with the `PIPE_THROUGH_CPP' macro defined as the absolute
|
||||
pathname of the native C preprocessor (usually `/lib/cpp'). See the
|
||||
Makefile for details.
|
||||
|
||||
Installation:
|
||||
-------------
|
||||
|
||||
Install the `unproto.1' manual page in a suitable place. If your system
|
||||
does not provide a `stdarg.h' file, find a suitable place for the one
|
||||
provided with the unprototyper and install it there. The same goes for
|
||||
the sample stddef.h and stdlib.h files; make sure that the definitions
|
||||
in there apply to your environment. Most or all of the latter files are
|
||||
already part of Ultrix 4.x and SunOS 4.1.1.
|
||||
|
||||
The ANSI float.h and limits.h files can be generated with the config
|
||||
program by Steve Pemberton (comp.sources.misc volume 10, issue 62,
|
||||
available from ftp.uu.net as comp.sources.misc/volume10/config42.Z).
|
||||
|
||||
If you run the unprototyper with "cc -E" just install the `unproto'
|
||||
binary; the `cpp' and `acc' shell scripts will not be needed.
|
||||
|
||||
If you use the `cpp' shell script to pipe the preprocessor output
|
||||
through the unprototyper program, install the `unproto' binary in a
|
||||
place where the `cpp' shell script can find it, and install the `cpp'
|
||||
shell script in a suitable place. Edit the `acc' shell script and
|
||||
install it in a suitable place. From now on, type `acc' instead of
|
||||
`cc'.
|
||||
|
||||
If the unprototyper itself opens the pipe to the C preprocessor (i.e.
|
||||
the unprototyper was built with the `PIPE_THROUGH_CPP' macro defined),
|
||||
install the `cpp' unprototyper binary in a suitable place. Edit the
|
||||
`acc' shell script and install it in a suitable place. From now on,
|
||||
type `acc' instead of `cc'.
|
||||
|
||||
Wietse Venema
|
||||
wietse@wzv.win.tue.nl
|
||||
Mathematics and Computing Science
|
||||
Eindhoven University of Technology
|
||||
The Netherlands
|
@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# @(#) acc.sh 1.1 93/06/18 22:29:42
|
||||
#
|
||||
# Script to emulate most of an ANSI C compiler with a traditional UNIX
|
||||
# C compiler.
|
||||
|
||||
# INCDIR should be the directory with auxiliary include files from the
|
||||
# unproto source distribution (stdarg.h, stdlib.h, stddef.h, and other
|
||||
# stuff that is missing from your compilation environment). With Ultrix
|
||||
# 4.[0-2] you need unproto's stdarg.h even though the system provides
|
||||
# one.
|
||||
#
|
||||
INCDIR=.
|
||||
|
||||
# CPPDIR should be the directory with the unprototypeing cpp filter
|
||||
# (preferably the version with the PIPE_THROUGH_CPP feature).
|
||||
#
|
||||
CPPDIR=.
|
||||
|
||||
# DEFINES: you will want to define volatile and const, and maybe even
|
||||
# __STDC__.
|
||||
#
|
||||
DEFINES="-Dvolatile= -Dconst= -D__STDC__"
|
||||
|
||||
# Possible problem: INCDIR should be listed after the user-specified -I
|
||||
# command-line options, not before them as we do here. This is a problem
|
||||
# only if you attempt to redefine system libraries.
|
||||
#
|
||||
# Choose one of the commands below that is appropriate for your system.
|
||||
#
|
||||
exec cc -Qpath ${CPPDIR} -I${INCDIR} ${DEFINES} "$@" # SunOS 4.x
|
||||
exec cc -tp -h${CPPDIR} -B -I${INCDIR} ${DEFINES} "$@" # Ultrix 4.2
|
||||
exec cc -Yp,${CPPDIR} -I${INCDIR} ${DEFINES} "$@" # M88 SysV.3
|
||||
exec cc -B${CPPDIR}/ -tp -I${INCDIR} ${DEFINES} "$@" # System V.2
|
@ -1,35 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# @(#) cpp.sh 1.3 92/01/15 21:53:22
|
||||
|
||||
# Unprototypeing preprocessor for pre-ANSI C compilers. On some systems,
|
||||
# this script can be as simple as:
|
||||
#
|
||||
# /lib/cpp "$@" | unproto
|
||||
#
|
||||
# However, some cc(1) drivers specify output file names on the
|
||||
# preprocessor command line, so this shell script must be prepared to
|
||||
# intercept them. Depending on the driver program, the cpp options may
|
||||
# even go before or after the file name argument(s). The script below
|
||||
# tries to tackle all these cases.
|
||||
#
|
||||
# You may want to add -Ipath_to_stdarg.h_file, -Dvoid=, -Dvolatile=,
|
||||
# and even -D__STDC__.
|
||||
|
||||
cpp_args=""
|
||||
|
||||
while :
|
||||
do
|
||||
case $1 in
|
||||
"") break;;
|
||||
-*) cpp_args="$cpp_args $1";;
|
||||
*) cpp_args="$cpp_args $1"
|
||||
case $2 in
|
||||
""|-*) ;;
|
||||
*) exec 1> $2 || exit 1; shift;;
|
||||
esac;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
/lib/cpp $cpp_args | unproto
|
@ -1,97 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* error 3
|
||||
/* SUMMARY
|
||||
/* diagnostics
|
||||
/* PACKAGE
|
||||
/* unproto
|
||||
/* SYNOPSIS
|
||||
/* #include "error.h"
|
||||
/*
|
||||
/* int errcount;
|
||||
/*
|
||||
/* void error(text)
|
||||
/* char *text;
|
||||
/*
|
||||
/* void error_where(path, line, text)
|
||||
/* char *path;
|
||||
/* int line;
|
||||
/* char *text;
|
||||
/*
|
||||
/* void fatal(text)
|
||||
/* char *text;
|
||||
/* DESCRIPTION
|
||||
/* The routines in this file print a diagnostic (text). Some also
|
||||
/* terminate the program. Upon each error*() call, the errcount variable
|
||||
/* is incremented.
|
||||
/*
|
||||
/* error() provides a default context, i.e. the source-file
|
||||
/* coordinate of the last read token.
|
||||
/*
|
||||
/* error_where() allows the caller to explicitly specify context: path
|
||||
/* is a source-file name, and line is a line number.
|
||||
/*
|
||||
/* fatal() is like error() but terminates the program with a non-zero
|
||||
/* exit status.
|
||||
/*
|
||||
/* context is ignored if the line number is zero or if the path
|
||||
/* is an empty string.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:53:10
|
||||
/* VERSION/RELEASE
|
||||
/* 1.2
|
||||
/*--*/
|
||||
|
||||
static char error_sccsid[] = "@(#) error.c 1.2 92/01/15 21:53:10";
|
||||
|
||||
/* C library */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern void exit();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "token.h"
|
||||
#include "error.h"
|
||||
|
||||
int errcount = 0; /* error counter */
|
||||
|
||||
/* error - report problem (implicit context) */
|
||||
|
||||
void error(text)
|
||||
char *text;
|
||||
{
|
||||
error_where(in_path, in_line, text);
|
||||
}
|
||||
|
||||
/* error_where - report problem (explicit context) */
|
||||
|
||||
void error_where(path, line, text)
|
||||
char *path;
|
||||
int line;
|
||||
char *text;
|
||||
{
|
||||
errcount++;
|
||||
|
||||
/* Suppress context info if there is none. */
|
||||
|
||||
if (line && path[0])
|
||||
fprintf(stderr, "%s, line %d: ", path, line);
|
||||
|
||||
fprintf(stderr, "%s\n", text);
|
||||
}
|
||||
|
||||
/* fatal - report problem and terminate unsuccessfully */
|
||||
|
||||
void fatal(text)
|
||||
char *text;
|
||||
{
|
||||
error(text);
|
||||
exit(1);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
/* @(#) error.h 1.2 92/01/15 21:53:14 */
|
||||
|
||||
extern int errcount; /* error counter */
|
||||
extern void error(); /* default context */
|
||||
extern void error_where(); /* user-specified context */
|
||||
extern void fatal(); /* fatal error */
|
@ -1,222 +0,0 @@
|
||||
/*
|
||||
* @(#) example.c 1.5 93/06/18 22:29:46
|
||||
*
|
||||
* Examples of things that can be done with the unproto package
|
||||
*/
|
||||
|
||||
typedef char *charstar;
|
||||
|
||||
/*
|
||||
* New-style argument list with structured argument, one field being pointer
|
||||
* to function returning pointer to function with function-pointer argument
|
||||
*/
|
||||
|
||||
x(struct {
|
||||
struct {
|
||||
int (*(*foo) (int (*arg1) (double))) (float arg2);
|
||||
} foo;
|
||||
} baz) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* New-style function-pointer declaration. */
|
||||
|
||||
int (*(*bar0) (float)) (int);
|
||||
|
||||
/* Old-style argument list with new-style argument type. */
|
||||
|
||||
baz0(bar)
|
||||
int (*(*bar) (float)) (int);
|
||||
{}
|
||||
|
||||
/*
|
||||
* New-style argument list with new-style argument type, declaration
|
||||
* embedded within block. Plus a couple assignments with function calls that
|
||||
* look like casts.
|
||||
*/
|
||||
|
||||
foo(int (*(*bar) (float)) (int))
|
||||
{
|
||||
int (*baz) (int) = (int (*) (int)) 0,
|
||||
y = (y * (*baz) (y)),
|
||||
*(*z) (int) = (int *(*) (int)) 0;
|
||||
|
||||
struct { int (*foo)(int); } *(*s)(int) =
|
||||
(struct { int (*foo)(int); } *(*)(int)) 0;
|
||||
|
||||
{
|
||||
y = (y * (*baz) (y));
|
||||
}
|
||||
{
|
||||
z = (int *(*) (int)) 0;
|
||||
}
|
||||
{
|
||||
s = (struct { int (*foo)(int); } *(*)(int)) 0;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Multiple declarations in one statement */
|
||||
|
||||
test1()
|
||||
{
|
||||
int foo2,*(*(*bar)(int))(float),*baz(double);
|
||||
}
|
||||
|
||||
/* Discriminate declarations from executable statements */
|
||||
|
||||
test2(charstar y)
|
||||
{
|
||||
int foo = 5,atoi(charstar);
|
||||
|
||||
foo = 5,atoi(y);
|
||||
}
|
||||
|
||||
/* Declarations without explicit type */
|
||||
|
||||
test3,test4(int);
|
||||
|
||||
test5(int y)
|
||||
{
|
||||
{
|
||||
test3;
|
||||
}
|
||||
{
|
||||
test4(y);
|
||||
}
|
||||
}
|
||||
|
||||
test6[1],test7(int);
|
||||
|
||||
test7(int x)
|
||||
{
|
||||
{
|
||||
test6[1];
|
||||
}
|
||||
{
|
||||
test7(x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Checking a complicated cast */
|
||||
|
||||
struct {
|
||||
struct {
|
||||
int (*f)(int), o;
|
||||
} bar;
|
||||
} (*baz2)(int) = (struct { struct { int (*f)(int), o; } bar; } (*)(int)) 0;
|
||||
|
||||
/* Distinguish things with the same shape but with different meaning */
|
||||
|
||||
test8(x)
|
||||
{
|
||||
{
|
||||
struct {
|
||||
int foo;
|
||||
} bar(charstar);
|
||||
}
|
||||
{
|
||||
do {
|
||||
int foo;
|
||||
} while (x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Do not think foo(*bar) is a function pointer declaration */
|
||||
|
||||
test9(char *bar)
|
||||
{
|
||||
foo(*bar);
|
||||
}
|
||||
|
||||
/* another couple of special-cased words. */
|
||||
|
||||
test10(int x)
|
||||
{
|
||||
{
|
||||
int test10(int);
|
||||
do test10(x);
|
||||
while (x);
|
||||
}
|
||||
{
|
||||
return test10(x);
|
||||
}
|
||||
}
|
||||
|
||||
test11(int *x)
|
||||
{
|
||||
while (*x)
|
||||
(putchar(*x++));
|
||||
}
|
||||
|
||||
test11a(int *x)
|
||||
{
|
||||
for (*x;;)
|
||||
(putchar(*x++));
|
||||
}
|
||||
|
||||
/* #include directive between stuff that requires lookahead */
|
||||
|
||||
test12()
|
||||
{
|
||||
char *x = "\xf\0002\002\02\2" /* foo */
|
||||
#include "/dev/null"
|
||||
"\abar";
|
||||
|
||||
printf("foo" /* 1 */ "bar" /* 2 */ "baz");
|
||||
|
||||
*x = '\a';
|
||||
*x = '\xff';
|
||||
}
|
||||
|
||||
int test13(void);
|
||||
|
||||
/* line continuations in the middle of tokens */
|
||||
|
||||
te\
|
||||
st14();
|
||||
charstar test15 = "foo\
|
||||
bar";
|
||||
char test16 = "foo\\
|
||||
abar";
|
||||
|
||||
/* Array dimensions with unexpanded macros */
|
||||
|
||||
test17(charstar foo[bar]){}
|
||||
|
||||
int (*(*test18[bar])(charstar))(charstar) = \
|
||||
(int (*(*[bar])(charstar))(charstar)) 0;
|
||||
|
||||
/* Function returning pointer to function */
|
||||
|
||||
int (*(*test19(long))(int))(double);
|
||||
|
||||
/* GCC accepts the following stuff, K&R C does not... */
|
||||
|
||||
void test20(int test21(double)) {}
|
||||
|
||||
void test22(struct { int foo; } test23(short)) {}
|
||||
|
||||
/* Do not blindly rewrite (*name(stuff))(otherstuff) */
|
||||
|
||||
void test23()
|
||||
{
|
||||
int (*test24(int)) (int),
|
||||
y = (*test24(2)) (3),
|
||||
z = ((*test24(2)) (3));
|
||||
}
|
||||
|
||||
/* Function returning pointer to function */
|
||||
|
||||
int (*(*test25(long foo))(int bar))(double baz){ /* body */ }
|
||||
|
||||
int (*(*test26(foo))())()
|
||||
long foo;
|
||||
{ /* body */ }
|
||||
|
||||
#define ARGSTR() struct {int l; char c[1];}
|
||||
|
||||
void functie(ARGSTR() *cmdlin, ARGSTR() *c1)
|
||||
{
|
||||
}
|
@ -1,271 +0,0 @@
|
||||
# 1 "example.c"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef char *charstar;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
x(
|
||||
|
||||
|
||||
|
||||
baz)
|
||||
# 14 "example.c"
|
||||
struct {
|
||||
struct {
|
||||
int (*(*foo)())();
|
||||
} foo;
|
||||
} baz;
|
||||
# 18 "example.c"
|
||||
{/*1*/
|
||||
/* end dcls */return (0);
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
int (*(*bar0)())();
|
||||
|
||||
|
||||
|
||||
baz0(bar)
|
||||
int (*(*bar)())();
|
||||
{/*1*/}/*1*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foo(bar)
|
||||
# 38 "example.c"
|
||||
int (*(*bar)())();
|
||||
{/*1*/
|
||||
int (*baz)()= (int (*)()) 0,
|
||||
y = (y * (*baz)(y)),
|
||||
*(*z)()= (int *(*)()) 0;
|
||||
|
||||
struct {/*2*/ int (*foo)(); }/*2*/ *(*s)()=
|
||||
(struct { int (*foo)(); } *(*)()) 0;
|
||||
|
||||
/* end dcls */{/*2*/
|
||||
y /* end dcls */= (y * (*baz)(y));
|
||||
}/*2*/
|
||||
{/*2*/
|
||||
z /* end dcls */= (int *(*)()) 0;
|
||||
}/*2*/
|
||||
{/*2*/
|
||||
s /* end dcls */= (struct { int (*foo)(); } *(*)()) 0;
|
||||
}/*2*/
|
||||
|
||||
return (0);
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
test1()
|
||||
{/*1*/
|
||||
int foo2,*(*(*bar)())(),*baz();
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
test2(y)
|
||||
# 69 "example.c"
|
||||
charstar y;
|
||||
{/*1*/
|
||||
int foo = 5,atoi();
|
||||
|
||||
foo /* end dcls */= 5,atoi(y);
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
test3,test4();
|
||||
|
||||
test5(y)
|
||||
# 80 "example.c"
|
||||
int y;
|
||||
{/*1*/
|
||||
/* end dcls */{/*2*/
|
||||
test3/* end dcls */;
|
||||
}/*2*/
|
||||
{/*2*/
|
||||
test4/* end dcls */(y);
|
||||
}/*2*/
|
||||
}/*1*/
|
||||
|
||||
test6[1],test7();
|
||||
|
||||
test7(x)
|
||||
# 92 "example.c"
|
||||
int x;
|
||||
{/*1*/
|
||||
/* end dcls */{/*2*/
|
||||
test6/* end dcls */[1];
|
||||
}/*2*/
|
||||
{/*2*/
|
||||
test7/* end dcls */(x);
|
||||
}/*2*/
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
struct {/*1*/
|
||||
struct {/*2*/
|
||||
int (*f)(), o;
|
||||
}/*2*/ bar;
|
||||
}/*1*/ (*baz2)()= (struct { struct { int (*f)(), o; } bar; } (*)()) 0;
|
||||
|
||||
|
||||
|
||||
test8(x)
|
||||
{/*1*/
|
||||
/* end dcls */{/*2*/
|
||||
struct {/*3*/
|
||||
int foo;
|
||||
}/*3*/ bar();
|
||||
}/*2*/
|
||||
{/*2*/
|
||||
/* end dcls */do {/*3*/
|
||||
int foo;
|
||||
}/*3*/ while (x);
|
||||
}/*2*/
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
test9(bar)
|
||||
# 128 "example.c"
|
||||
char *bar;
|
||||
{/*1*/
|
||||
foo/* end dcls */(*bar);
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
test10(x)
|
||||
# 135 "example.c"
|
||||
int x;
|
||||
{/*1*/
|
||||
/* end dcls */{/*2*/
|
||||
int test10();
|
||||
/* end dcls */do test10(x);
|
||||
while (x);
|
||||
}/*2*/
|
||||
{/*2*/
|
||||
/* end dcls */return test10(x);
|
||||
}/*2*/
|
||||
}/*1*/
|
||||
|
||||
test11(x)
|
||||
# 147 "example.c"
|
||||
int *x;
|
||||
{/*1*/
|
||||
/* end dcls */while (*x)
|
||||
(putchar(*x++));
|
||||
}/*1*/
|
||||
|
||||
test11a(x)
|
||||
# 153 "example.c"
|
||||
int *x;
|
||||
{/*1*/
|
||||
/* end dcls */for (*x;;)
|
||||
(putchar(*x++));
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
test12()
|
||||
{/*1*/
|
||||
char *x =
|
||||
# 1 "/dev/null" 1
|
||||
# 165 "example.c" 2
|
||||
# 163 "example.c"
|
||||
"\017\0002\002\002\002\007bar"
|
||||
|
||||
;
|
||||
|
||||
printf/* end dcls */("foobarbaz" );
|
||||
|
||||
*x = '\007';
|
||||
*x = '\377';
|
||||
}/*1*/
|
||||
|
||||
int test13();
|
||||
|
||||
|
||||
|
||||
test14();
|
||||
|
||||
charstar test15 = "foobar";
|
||||
|
||||
char test16 = "foo\007bar";
|
||||
|
||||
|
||||
|
||||
|
||||
test17(foo)
|
||||
# 186 "example.c"
|
||||
charstar foo[bar];
|
||||
# 186 "example.c"
|
||||
{/*1*/}/*1*/
|
||||
|
||||
int (*(*test18[bar])())()= (int (*(*[bar])())()) 0;
|
||||
|
||||
|
||||
|
||||
|
||||
int (*(*test19())())();
|
||||
|
||||
|
||||
|
||||
void test20(test21)
|
||||
# 197 "example.c"
|
||||
int test21();
|
||||
# 197 "example.c"
|
||||
{/*1*/}/*1*/
|
||||
|
||||
void test22(test23)
|
||||
# 199 "example.c"
|
||||
struct { int foo; } test23();
|
||||
# 199 "example.c"
|
||||
{/*1*/}/*1*/
|
||||
|
||||
|
||||
|
||||
void test23()
|
||||
{/*1*/
|
||||
int (*test24())(),
|
||||
y = (*test24(2)) (3),
|
||||
z = ((*test24(2))(3));
|
||||
}/*1*/
|
||||
|
||||
|
||||
|
||||
int (*(*test25(foo))())()
|
||||
# 212 "example.c"
|
||||
long foo;
|
||||
# 212 "example.c"
|
||||
{/*1*/ }/*1*/
|
||||
|
||||
int (*(*test26(foo))())()
|
||||
long foo;
|
||||
{/*1*/ }/*1*/
|
||||
|
||||
|
||||
|
||||
void functie(cmdlin,c1)
|
||||
# 220 "example.c"
|
||||
struct {int l; char c[1];} *cmdlin;
|
||||
# 220 "example.c"
|
||||
struct {int l; char c[1];} *c1;
|
||||
{/*1*/
|
||||
}/*1*/
|
@ -1,54 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* hash 3
|
||||
/* SUMMARY
|
||||
/* compute hash value for string
|
||||
/* SYNOPSIS
|
||||
/* int hash(string, size)
|
||||
/* char *string;
|
||||
/* int size;
|
||||
/* DESCRIPTION
|
||||
/* This function computes for the given null-terminated string an
|
||||
/* integer hash value in the range 0..size-1.
|
||||
/* SEE ALSO
|
||||
/* .fi
|
||||
/* Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman: Compilers:
|
||||
/* principles, techniques and tools; Addison-Wesley, Amsterdam, 1986.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/*
|
||||
/* Originally written by: P. J. Weinberger at Bell Labs.
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:53:12
|
||||
/* VERSION/RELEASE
|
||||
/* %I
|
||||
/*--*/
|
||||
|
||||
static char hash_sccsid[] = "@(#) hash.c 1.1 92/01/15 21:53:12";
|
||||
|
||||
/* hash - hash a string; original author: P. J. Weinberger at Bell Labs. */
|
||||
|
||||
int hash(s, size)
|
||||
register char *s;
|
||||
unsigned size;
|
||||
{
|
||||
register unsigned long h = 0;
|
||||
register unsigned long g;
|
||||
|
||||
/*
|
||||
* For a performance comparison with the hash function presented in K&R,
|
||||
* first edition, see the "Dragon" book by Aho, Sethi and Ullman.
|
||||
*/
|
||||
|
||||
while (*s) {
|
||||
h = (h << 4) + *s++;
|
||||
if (g = (h & 0xf0000000)) {
|
||||
h ^= (g >> 24);
|
||||
h ^= g;
|
||||
}
|
||||
}
|
||||
return (h % size);
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
* @(#) stdarg.h 1.4 93/06/18 22:29:44
|
||||
*
|
||||
* Sample stdarg.h file for use with the unproto filter.
|
||||
*
|
||||
* This file serves two purposes.
|
||||
*
|
||||
* 1 - On systems that do not have a /usr/include/stdarg.h file, it should be
|
||||
* included by C source files that implement ANSI-style variadic functions.
|
||||
* Ultrix 4.[0-2] comes with stdarg.h but still needs the one that is
|
||||
* provided with the unproto filter.
|
||||
*
|
||||
* 2 - To configure the unprototyper itself. If the _VA_ALIST_ macro is
|
||||
* defined, its value will appear in the place of the "..." at the end of
|
||||
* argument lists of variadic function *definitions* (not declarations).
|
||||
* Some compilers (such as Greenhills m88k) have a non-empty va_dcl
|
||||
* definition in the system header file varargs.h. If that is the case,
|
||||
* define "_VA_DCL_" with the same value as va_dcl. If _VA_DCL_ is defined,
|
||||
* the unprototyper will emit its value just before the opening "{".
|
||||
*
|
||||
* Compilers that always pass arguments via the stack can use the default code
|
||||
* at the end of this file (this usually applies for the vax, mc68k and
|
||||
* 80*86 architectures).
|
||||
*
|
||||
* Special tricks are needed for compilers that pass some or all function
|
||||
* arguments via registers. Examples of the latter are given for the mips
|
||||
* and sparc architectures. Usually the compiler special-cases an argument
|
||||
* declaration such as "va_alist" or "__builtin_va_alist". For inspiration,
|
||||
* see the local /usr/include/varargs.h file.
|
||||
*
|
||||
* You can use the varargs.c program provided with the unproto package to
|
||||
* verify that the stdarg.h file has been set up correctly.
|
||||
*/
|
||||
|
||||
#ifdef sparc /* tested with SunOS 4.1.1 */
|
||||
|
||||
#define _VA_ALIST_ "__builtin_va_alist"
|
||||
typedef char *va_list;
|
||||
#define va_start(ap, p) (ap = (char *) &__builtin_va_alist)
|
||||
#define va_arg(ap, type) ((type *) __builtin_va_arg_incr((type *) ap))[0]
|
||||
#define va_end(ap)
|
||||
|
||||
#else
|
||||
#ifdef mips /* tested with Ultrix 4.0 and 4.2 */
|
||||
|
||||
#define _VA_ALIST_ "va_alist"
|
||||
#include "/usr/include/stdarg.h"
|
||||
|
||||
#else
|
||||
#ifdef m88k /* Motorola SYSTEM V/88 R32V3 */
|
||||
|
||||
#define _VA_ALIST_ "va_alist"
|
||||
#define _VA_DCL_ "va_type va_alist;"
|
||||
typedef struct _va_struct {
|
||||
int va_narg;
|
||||
int *va_stkaddr;
|
||||
int *va_iregs;
|
||||
} va_list;
|
||||
#define va_start(ap, p) \
|
||||
((ap).va_narg=(int *)&va_alist-va_stkarg, \
|
||||
(ap).va_stkaddr=va_stkarg, \
|
||||
(ap).va_iregs=(int *)va_intreg)
|
||||
#define va_end(p)
|
||||
#if defined(LittleEndian)
|
||||
#define va_arg(p,mode) \
|
||||
(*(mode *)_gh_va_arg(&p, va_align(mode), va_regtyp(mode), sizeof(mode)))
|
||||
#else /* defined(LittleEndian) */
|
||||
#define va_arg(p,mode) ( \
|
||||
(p).va_narg += ((p).va_narg & (va_align(mode) == 8)) + \
|
||||
(sizeof(mode)+3)/4, \
|
||||
((mode *)((va_regtyp(mode) && (p).va_narg <= 8 ? \
|
||||
(p).va_iregs: \
|
||||
(p).va_stkaddr) + (p).va_narg))[-1])
|
||||
#endif /* defined(LittleEndian) */
|
||||
|
||||
#else
|
||||
#ifdef hpux
|
||||
#include <stdarg.h>
|
||||
|
||||
#else /* vax, mc68k, 80*86 */
|
||||
|
||||
typedef char *va_list;
|
||||
#define va_start(ap, p) (ap = (char *) (&(p)+1))
|
||||
#define va_arg(ap, type) ((type *) (ap += sizeof(type)))[-1]
|
||||
#define va_end(ap)
|
||||
|
||||
#endif /* hpux */
|
||||
#endif /* m88k */
|
||||
#endif /* mips */
|
||||
#endif /* sparc */
|
@ -1,23 +0,0 @@
|
||||
/* @(#) stddef.h 1.1 92/02/15 17:25:46 */
|
||||
|
||||
#ifndef _stddef_h_
|
||||
#define _stddef_h_
|
||||
|
||||
/* NULL is also defined in <stdio.h> */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Structure member offset - some compilers barf on this. */
|
||||
|
||||
#define offsetof(type, member) ((size_t) &((type *)0)->member)
|
||||
|
||||
/* Some of the following types may already be defined in <sys/types.h>. */
|
||||
|
||||
/* #include <sys/types.h> */
|
||||
/* typedef long ptrdiff_t; /* type of pointer difference */
|
||||
/* typedef unsigned short wchar_t; /* wide character type */
|
||||
/* typedef unsigned size_t; /* type of sizeof */
|
||||
|
||||
#endif /* _stddef_h_ */
|
@ -1,53 +0,0 @@
|
||||
/* @(#) stdlib.h 1.1 92/02/15 17:25:45 */
|
||||
|
||||
#ifndef _stdlib_h_
|
||||
#define _stdlib_h_
|
||||
|
||||
/* NULL is also defined in <stdio.h> */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some functions in this file will be missing from the typical pre-ANSI
|
||||
* UNIX library. Some pre-ANSI UNIX library functions have return types
|
||||
* that differ from what ANSI requires.
|
||||
*/
|
||||
|
||||
extern double atof();
|
||||
extern int atoi();
|
||||
extern long atol();
|
||||
extern double strtod();
|
||||
extern long strtol();
|
||||
extern unsigned long strtoul();
|
||||
extern int rand();
|
||||
extern void srand();
|
||||
extern char *calloc();
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
extern void free();
|
||||
extern void abort();
|
||||
extern void exit();
|
||||
extern int atextit();
|
||||
extern int system();
|
||||
extern char *getenv();
|
||||
extern char *bsearch();
|
||||
extern void qsort();
|
||||
extern int abs();
|
||||
extern long labs();
|
||||
|
||||
typedef struct {
|
||||
int quot;
|
||||
int rem;
|
||||
} div_t;
|
||||
|
||||
typedef struct {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
extern div_t div();
|
||||
extern ldiv_t ldiv();
|
||||
|
||||
#endif /* _stdlib_h_ */
|
@ -1,71 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* strsave 3
|
||||
/* SUMMARY
|
||||
/* maintain unique copy of a string
|
||||
/* SYNOPSIS
|
||||
/* char *strsave(string)
|
||||
/* char *string;
|
||||
/* DESCRIPTION
|
||||
/* This function returns a pointer to an unique copy of its
|
||||
/* argument.
|
||||
/* DIAGNOSTISC
|
||||
/* strsave() calls fatal() when it runs out of memory.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:53:13
|
||||
/* VERSION/RELEASE
|
||||
/* 1.1
|
||||
/*--*/
|
||||
|
||||
static char strsave_sccsid[] = "@(#) strsave.c 1.1 92/01/15 21:53:13";
|
||||
|
||||
/* C library */
|
||||
|
||||
extern char *strcpy();
|
||||
extern char *malloc();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "error.h"
|
||||
|
||||
#define STR_TABSIZE 100
|
||||
|
||||
struct string {
|
||||
char *strval; /* unique string copy */
|
||||
struct string *next; /* next one in hash chain */
|
||||
};
|
||||
|
||||
static struct string *str_tab[STR_TABSIZE] = {0,};
|
||||
|
||||
/* More string stuff. Maybe it should go to an #include file. */
|
||||
|
||||
#define STREQ(x,y) (*(x) == *(y) && strcmp((x),(y)) == 0)
|
||||
|
||||
/* strsave - save unique copy of string */
|
||||
|
||||
char *strsave(str)
|
||||
register char *str;
|
||||
{
|
||||
register struct string *s;
|
||||
register int where = hash(str, STR_TABSIZE);
|
||||
|
||||
/* Look for existing entry. */
|
||||
|
||||
for (s = str_tab[where]; s; s = s->next)
|
||||
if (STREQ(str, s->strval))
|
||||
return (s->strval);
|
||||
|
||||
/* Add new entry. */
|
||||
|
||||
if ((s = (struct string *) malloc(sizeof(*s))) == 0
|
||||
|| (s->strval = malloc(strlen(str) + 1)) == 0)
|
||||
fatal("out of memory");
|
||||
s->next = str_tab[where];
|
||||
str_tab[where] = s;
|
||||
return (strcpy(s->strval, str));
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* symbol 3
|
||||
/* SUMMARY
|
||||
/* rudimentary symbol table package
|
||||
/* SYNOPSIS
|
||||
/* #include "symbol.h"
|
||||
/*
|
||||
/* void sym_init()
|
||||
/*
|
||||
/* void sym_enter(name, type)
|
||||
/* char *name;
|
||||
/* int type;
|
||||
/*
|
||||
/* struct symbol *sym_find(name)
|
||||
/* char *name;
|
||||
/* DESCRIPTION
|
||||
/* This is a rudimentary symbol-table package, just enough to
|
||||
/* keep track of a couple of C keywords.
|
||||
/*
|
||||
/* sym_init() primes the table with C keywords. At present, most of
|
||||
/* the keywords that have to do with types are left out.
|
||||
/* We need a different strategy to detect type definitions because
|
||||
/* we do not keep track of typedef names.
|
||||
/*
|
||||
/* sym_enter() adds an entry to the symbol table.
|
||||
/*
|
||||
/* sym_find() locates a symbol table entry (it returns 0 if
|
||||
/* it is not found).
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/02/15 18:59:56
|
||||
/* VERSION/RELEASE
|
||||
/* 1.4
|
||||
/*--*/
|
||||
|
||||
static char symbol_sccsid[] = "@(#) symbol.c 1.4 92/02/15 18:59:56";
|
||||
|
||||
/* C library */
|
||||
|
||||
extern char *strcpy();
|
||||
extern char *malloc();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "error.h"
|
||||
#include "token.h"
|
||||
#include "symbol.h"
|
||||
|
||||
#define SYM_TABSIZE 20
|
||||
|
||||
static struct symbol *sym_tab[SYM_TABSIZE] = {0,};
|
||||
|
||||
/* More string stuff. Maybe it should go to an #include file. */
|
||||
|
||||
#define STREQ(x,y) (*(x) == *(y) && strcmp((x),(y)) == 0)
|
||||
|
||||
/* sym_enter - enter symbol into table */
|
||||
|
||||
void sym_enter(name, type)
|
||||
char *name;
|
||||
int type;
|
||||
{
|
||||
struct symbol *s;
|
||||
int where;
|
||||
|
||||
if ((s = (struct symbol *) malloc(sizeof(*s))) == 0
|
||||
|| (s->name = malloc(strlen(name) + 1)) == 0)
|
||||
fatal("out of memory");
|
||||
(void) strcpy(s->name, name);
|
||||
s->type = type;
|
||||
|
||||
where = hash(name, SYM_TABSIZE);
|
||||
s->next = sym_tab[where];
|
||||
sym_tab[where] = s;
|
||||
}
|
||||
|
||||
/* sym_find - locate symbol definition */
|
||||
|
||||
struct symbol *sym_find(name)
|
||||
register char *name;
|
||||
{
|
||||
register struct symbol *s;
|
||||
|
||||
/*
|
||||
* This function is called for almost every "word" token, so it better be
|
||||
* fast.
|
||||
*/
|
||||
|
||||
for (s = sym_tab[hash(name, SYM_TABSIZE)]; s; s = s->next)
|
||||
if (STREQ(name, s->name))
|
||||
return (s);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialization data for symbol table. We do not enter keywords for types.
|
||||
* We use a different strategy to detect type declarations because we do not
|
||||
* keep track of typedef names.
|
||||
*/
|
||||
|
||||
struct sym {
|
||||
char *name;
|
||||
int tokno;
|
||||
};
|
||||
|
||||
static struct sym syms[] = {
|
||||
"if", TOK_CONTROL,
|
||||
"else", TOK_CONTROL,
|
||||
"for", TOK_CONTROL,
|
||||
"while", TOK_CONTROL,
|
||||
"do", TOK_CONTROL,
|
||||
"switch", TOK_CONTROL,
|
||||
"case", TOK_CONTROL,
|
||||
"default", TOK_CONTROL,
|
||||
"return", TOK_CONTROL,
|
||||
"continue", TOK_CONTROL,
|
||||
"break", TOK_CONTROL,
|
||||
"goto", TOK_CONTROL,
|
||||
"struct", TOK_COMPOSITE,
|
||||
"union", TOK_COMPOSITE,
|
||||
"__DATE__", TOK_DATE,
|
||||
"__TIME__", TOK_TIME,
|
||||
#if defined(MAP_VOID_STAR) || defined(MAP_VOID)
|
||||
"void", TOK_VOID,
|
||||
#endif
|
||||
"asm", TOK_OTHER,
|
||||
0,
|
||||
};
|
||||
|
||||
/* sym_init - enter known keywords into symbol table */
|
||||
|
||||
void sym_init()
|
||||
{
|
||||
register struct sym *p;
|
||||
|
||||
for (p = syms; p->name; p++)
|
||||
sym_enter(p->name, p->tokno);
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
/* @(#) symbol.h 1.1 91/09/22 21:21:42 */
|
||||
|
||||
struct symbol {
|
||||
char *name; /* symbol name */
|
||||
int type; /* symbol type */
|
||||
struct symbol *next;
|
||||
};
|
||||
|
||||
extern void sym_enter(); /* add symbol to table */
|
||||
extern struct symbol *sym_find(); /* locate symbol */
|
||||
extern void sym_init(); /* prime the table */
|
@ -1,432 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* tok_class 3
|
||||
/* SUMMARY
|
||||
/* token classification
|
||||
/* PACKAGE
|
||||
/* unproto
|
||||
/* SYNOPSIS
|
||||
/* #include "token.h"
|
||||
/*
|
||||
/* void tok_unget(t)
|
||||
/* struct token *t;
|
||||
/*
|
||||
/* struct token *tok_class()
|
||||
/* DESCRIPTION
|
||||
/* tok_class() collects single and composite tokens, and
|
||||
/* recognizes keywords.
|
||||
/* At present, the only composite tokens are ()-delimited,
|
||||
/* comma-separated lists, and non-whitespace tokens with attached
|
||||
/* whitespace or comment tokens.
|
||||
/*
|
||||
/* Source transformations are: __DATE__ and __TIME__ are rewritten
|
||||
/* to string constants with the current date and time, respectively.
|
||||
/* Multiple string constants are concatenated. Optionally, "void *"
|
||||
/* is mapped to "char *", and plain "void" to "int".
|
||||
/*
|
||||
/* tok_unget() implements an arbitrary amount of token pushback.
|
||||
/* Only tokens obtained through tok_class() should be given to
|
||||
/* tok_unget(). This function accepts a list of tokens in
|
||||
/* last-read-first order.
|
||||
/* DIAGNOSTICS
|
||||
/* The code complains if input terminates in the middle of a list.
|
||||
/* BUGS
|
||||
/* Does not preserve white space at the beginning of a list element
|
||||
/* or after the end of a list.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:53:02
|
||||
/* VERSION/RELEASE
|
||||
/* 1.4
|
||||
/*--*/
|
||||
|
||||
static char class_sccsid[] = "@(#) tok_class.c 1.4 92/01/15 21:53:02";
|
||||
|
||||
/* C library */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern char *strcpy();
|
||||
extern long time();
|
||||
extern char *ctime();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "error.h"
|
||||
#include "vstring.h"
|
||||
#include "token.h"
|
||||
#include "symbol.h"
|
||||
|
||||
static struct token *tok_list();
|
||||
static void tok_list_struct();
|
||||
static void tok_list_append();
|
||||
static void tok_strcat();
|
||||
static void tok_time();
|
||||
static void tok_date();
|
||||
static void tok_space_append();
|
||||
|
||||
#if defined(MAP_VOID_STAR) || defined(MAP_VOID)
|
||||
static void tok_void(); /* rewrite void keyword */
|
||||
#endif
|
||||
|
||||
static struct token *tok_buf = 0; /* token push-back storage */
|
||||
|
||||
/* TOK_PREPEND - add token to LIFO queue, return head */
|
||||
|
||||
#define TOK_PREPEND(list,t) (t->next = list, list = t)
|
||||
|
||||
/* tok_space_append - append trailing space except at start of or after list */
|
||||
|
||||
static void tok_space_append(list, t)
|
||||
register struct token *list;
|
||||
register struct token *t;
|
||||
{
|
||||
|
||||
/*
|
||||
* The head/tail fields of a token do triple duty. They are used to keep
|
||||
* track of the members that make up a (list); to keep track of the
|
||||
* non-blank tokens that make up one list member; and, finally, to tack
|
||||
* whitespace and comment tokens onto the non-blank tokens that make up
|
||||
* one list member.
|
||||
*
|
||||
* Within a (list), white space and comment tokens are always tacked onto
|
||||
* the non-blank tokens to avoid parsing complications later on. For this
|
||||
* reason, blanks and comments at the beginning of a list member are
|
||||
* discarded because there is no token to tack them onto. (Well, we could
|
||||
* start each list member with a dummy token, but that would mess up the
|
||||
* whole unprototyper).
|
||||
*
|
||||
* Blanks or comments that follow a (list) are discarded, because the
|
||||
* head/tail fields of a (list) are already being used for other
|
||||
* purposes.
|
||||
*
|
||||
* Newlines within a (list) are discarded because they can mess up the
|
||||
* output when we rewrite function headers. The output routines will
|
||||
* regenerate discarded newlines, anyway.
|
||||
*/
|
||||
|
||||
if (list == 0 || list->tokno == TOK_LIST) {
|
||||
tok_free(t);
|
||||
} else {
|
||||
tok_list_append(list, t);
|
||||
}
|
||||
}
|
||||
|
||||
/* tok_class - discriminate single tokens, keywords, and composite tokens */
|
||||
|
||||
struct token *tok_class()
|
||||
{
|
||||
register struct token *t;
|
||||
register struct symbol *s;
|
||||
|
||||
/*
|
||||
* Use push-back token, if available. Push-back tokens are already
|
||||
* canonical and can be passed on to the caller without further
|
||||
* inspection.
|
||||
*/
|
||||
|
||||
if (t = tok_buf) {
|
||||
tok_buf = t->next;
|
||||
t->next = 0;
|
||||
return (t);
|
||||
}
|
||||
/* Read a new token and canonicalize it. */
|
||||
|
||||
if (t = tok_get()) {
|
||||
switch (t->tokno) {
|
||||
case '(': /* beginning of list */
|
||||
t = tok_list(t);
|
||||
break;
|
||||
case TOK_WORD: /* look up keyword */
|
||||
if ((s = sym_find(t->vstr->str))) {
|
||||
switch (s->type) {
|
||||
case TOK_TIME: /* map __TIME__ to string */
|
||||
tok_time(t);
|
||||
tok_strcat(t); /* look for more strings */
|
||||
break;
|
||||
case TOK_DATE: /* map __DATE__ to string */
|
||||
tok_date(t);
|
||||
tok_strcat(t); /* look for more strings */
|
||||
break;
|
||||
#if defined(MAP_VOID_STAR) || defined(MAP_VOID)
|
||||
case TOK_VOID: /* optionally map void types */
|
||||
tok_void(t);
|
||||
break;
|
||||
#endif
|
||||
default: /* other keyword */
|
||||
t->tokno = s->type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '"': /* string, look for more */
|
||||
tok_strcat(t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (t);
|
||||
}
|
||||
|
||||
/* tok_list - collect ()-delimited, comma-separated list of tokens */
|
||||
|
||||
static struct token *tok_list(t)
|
||||
struct token *t;
|
||||
{
|
||||
register struct token *list = tok_alloc();
|
||||
char *filename;
|
||||
int lineno;
|
||||
|
||||
/* Save context of '(' for diagnostics. */
|
||||
|
||||
filename = t->path;
|
||||
lineno = t->line;
|
||||
|
||||
list->tokno = TOK_LIST;
|
||||
list->head = list->tail = t;
|
||||
list->path = t->path;
|
||||
list->line = t->line;
|
||||
#ifdef DEBUG
|
||||
strcpy(list->vstr->str, "LIST");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Read until the matching ')' is found, accounting for structured stuff
|
||||
* (enclosed by '{' and '}' tokens). Break the list up at each ',' token,
|
||||
* and try to preserve as much whitespace as possible. Newlines are
|
||||
* discarded so that they will not mess up the layout when we rewrite
|
||||
* argument lists. The output routines will regenerate discarded
|
||||
* newlines.
|
||||
*/
|
||||
|
||||
while (t = tok_class()) { /* skip blanks */
|
||||
switch (t->tokno) {
|
||||
case ')': /* end of list */
|
||||
tok_list_append(list, t);
|
||||
return (list);
|
||||
case '{': /* struct/union type */
|
||||
tok_list_struct(list->tail, t);
|
||||
break;
|
||||
case TOK_WSPACE: /* preserve trailing blanks */
|
||||
tok_space_append(list->tail->tail, t); /* except after list */
|
||||
break;
|
||||
case '\n': /* fix newlines later */
|
||||
tok_free(t);
|
||||
break;
|
||||
case ',': /* list separator */
|
||||
tok_list_append(list, t);
|
||||
break;
|
||||
default: /* other */
|
||||
tok_list_append(list->tail, t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
error_where(filename, lineno, "unmatched '('");
|
||||
return (list); /* do not waste any data */
|
||||
}
|
||||
|
||||
/* tok_list_struct - collect structured type info within list */
|
||||
|
||||
static void tok_list_struct(list, t)
|
||||
register struct token *list;
|
||||
register struct token *t;
|
||||
{
|
||||
char *filename;
|
||||
int lineno;
|
||||
|
||||
/*
|
||||
* Save context of '{' for diagnostics. This routine is called by the one
|
||||
* that collects list members. If the '}' is not found, the list
|
||||
* collector will not see the closing ')' either.
|
||||
*/
|
||||
|
||||
filename = t->path;
|
||||
lineno = t->line;
|
||||
|
||||
tok_list_append(list, t);
|
||||
|
||||
/*
|
||||
* Collect tokens until the matching '}' is found. Try to preserve as
|
||||
* much whitespace as possible. Newlines are discarded so that they do
|
||||
* not interfere when rewriting argument lists. The output routines will
|
||||
* regenerate discarded newlines.
|
||||
*/
|
||||
|
||||
while (t = tok_class()) {
|
||||
switch (t->tokno) {
|
||||
case TOK_WSPACE: /* preserve trailing blanks */
|
||||
tok_space_append(list->tail, t); /* except after list */
|
||||
break;
|
||||
case '\n': /* fix newlines later */
|
||||
tok_free(t);
|
||||
break;
|
||||
case '{': /* recurse */
|
||||
tok_list_struct(list, t);
|
||||
break;
|
||||
case '}': /* done */
|
||||
tok_list_append(list, t);
|
||||
return;
|
||||
default: /* other */
|
||||
tok_list_append(list, t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
error_where(filename, lineno, "unmatched '{'");
|
||||
}
|
||||
|
||||
/* tok_strcat - concatenate multiple string constants */
|
||||
|
||||
static void tok_strcat(t1)
|
||||
register struct token *t1;
|
||||
{
|
||||
register struct token *t2;
|
||||
register struct token *lookahead = 0;
|
||||
|
||||
/*
|
||||
* Read ahead past whitespace, comments and newlines. If we find a string
|
||||
* token, concatenate it with the previous one and push back the
|
||||
* intervening tokens (thus preserving as much information as possible).
|
||||
* If we find something else, push back all lookahead tokens.
|
||||
*/
|
||||
|
||||
#define PUSHBACK_AND_RETURN { if (lookahead) tok_unget(lookahead); return; }
|
||||
|
||||
while (t2 = tok_class()) {
|
||||
switch (t2->tokno) {
|
||||
case TOK_WSPACE: /* read past comments/blanks */
|
||||
case '\n': /* read past newlines */
|
||||
TOK_PREPEND(lookahead, t2);
|
||||
break;
|
||||
case '"': /* concatenate string tokens */
|
||||
if (vs_strcpy(t1->vstr,
|
||||
t1->vstr->str + strlen(t1->vstr->str) - 1,
|
||||
t2->vstr->str + 1) == 0)
|
||||
fatal("out of memory");
|
||||
tok_free(t2);
|
||||
PUSHBACK_AND_RETURN;
|
||||
default: /* something else, push back */
|
||||
tok_unget(t2);
|
||||
PUSHBACK_AND_RETURN;
|
||||
}
|
||||
}
|
||||
PUSHBACK_AND_RETURN; /* hit EOF */
|
||||
}
|
||||
|
||||
#if defined(MAP_VOID_STAR) || defined(MAP_VOID)
|
||||
|
||||
/* tok_void - support for compilers that have problems with "void" */
|
||||
|
||||
static void tok_void(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register struct token *t2;
|
||||
register struct token *lookahead = 0;
|
||||
|
||||
/*
|
||||
* Look ahead beyond whitespace, comments and newlines until we see a '*'
|
||||
* token. If one is found, replace "void" by "char". If we find something
|
||||
* else, and if "void" should always be mapped, replace "void" by "int".
|
||||
* Always push back the lookahead tokens.
|
||||
*
|
||||
* XXX The code also replaces the (void) argument list; this must be
|
||||
* accounted for later on. The alternative would be to add (in unproto.c)
|
||||
* TOK_VOID cases all over the place and that would be too error-prone.
|
||||
*/
|
||||
|
||||
#define PUSHBACK_AND_RETURN { if (lookahead) tok_unget(lookahead); return; }
|
||||
|
||||
while (t2 = tok_class()) {
|
||||
switch (TOK_PREPEND(lookahead, t2)->tokno) {
|
||||
case TOK_WSPACE: /* read past comments/blanks */
|
||||
case '\n': /* read past newline */
|
||||
break;
|
||||
case '*': /* "void *" -> "char *" */
|
||||
if (vs_strcpy(t->vstr, t->vstr->str, "char") == 0)
|
||||
fatal("out of memory");
|
||||
PUSHBACK_AND_RETURN;
|
||||
default:
|
||||
#ifdef MAP_VOID /* plain "void" -> "int" */
|
||||
if (vs_strcpy(t->vstr, t->vstr->str, "int") == 0)
|
||||
fatal("out of memory");
|
||||
#endif
|
||||
PUSHBACK_AND_RETURN;
|
||||
}
|
||||
}
|
||||
PUSHBACK_AND_RETURN; /* hit EOF */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* tok_time - rewrite __TIME__ to "hh:mm:ss" string constant */
|
||||
|
||||
static void tok_time(t)
|
||||
struct token *t;
|
||||
{
|
||||
long now;
|
||||
char *cp;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
/*
|
||||
* Using sprintf() to select parts of a string is gross, but this should
|
||||
* be fast enough.
|
||||
*/
|
||||
|
||||
(void) time(&now);
|
||||
cp = ctime(&now);
|
||||
sprintf(buf, "\"%.8s\"", cp + 11);
|
||||
if (vs_strcpy(t->vstr, t->vstr->str, buf) == 0)
|
||||
fatal("out of memory");
|
||||
t->tokno = buf[0];
|
||||
}
|
||||
|
||||
/* tok_date - rewrite __DATE__ to "Mmm dd yyyy" string constant */
|
||||
|
||||
static void tok_date(t)
|
||||
struct token *t;
|
||||
{
|
||||
long now;
|
||||
char *cp;
|
||||
char buf[BUFSIZ];
|
||||
|
||||
/*
|
||||
* Using sprintf() to select parts of a string is gross, but this should
|
||||
* be fast enough.
|
||||
*/
|
||||
|
||||
(void) time(&now);
|
||||
cp = ctime(&now);
|
||||
sprintf(buf, "\"%.3s %.2s %.4s\"", cp + 4, cp + 8, cp + 20);
|
||||
if (vs_strcpy(t->vstr, t->vstr->str, buf) == 0)
|
||||
fatal("out of memory");
|
||||
t->tokno = buf[0];
|
||||
}
|
||||
|
||||
/* tok_unget - push back one or more possibly composite tokens */
|
||||
|
||||
void tok_unget(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register struct token *next;
|
||||
|
||||
do {
|
||||
next = t->next;
|
||||
TOK_PREPEND(tok_buf, t);
|
||||
} while (t = next);
|
||||
}
|
||||
|
||||
/* tok_list_append - append data to list */
|
||||
|
||||
static void tok_list_append(h, t)
|
||||
struct token *h;
|
||||
struct token *t;
|
||||
{
|
||||
if (h->head == 0) {
|
||||
h->head = h->tail = t;
|
||||
} else {
|
||||
h->tail->next = t;
|
||||
h->tail = t;
|
||||
}
|
||||
}
|
@ -1,612 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* tok_io 3
|
||||
/* SUMMARY
|
||||
/* token I/O
|
||||
/* PACKAGE
|
||||
/* unproto
|
||||
/* SYNOPSIS
|
||||
/* #include "token.h"
|
||||
/*
|
||||
/* struct token *tok_get()
|
||||
/*
|
||||
/* void tok_flush(t)
|
||||
/* struct token *t;
|
||||
/*
|
||||
/* void tok_show(t)
|
||||
/* struct token *t;
|
||||
/*
|
||||
/* void tok_show_ch(t)
|
||||
/* struct token *t;
|
||||
/*
|
||||
/* void put_str(s)
|
||||
/* char *s;
|
||||
/*
|
||||
/* void put_ch(c)
|
||||
/* int c;
|
||||
/*
|
||||
/* void put_nl()
|
||||
/*
|
||||
/* char *in_path;
|
||||
/* int in_line;
|
||||
/* DESCRIPTION
|
||||
/* These functions read from stdin and write to stdout. The
|
||||
/* tokenizer keeps track of where the token appeared in the input
|
||||
/* stream; on output, this information is used to preserve correct
|
||||
/* line number information (even after lots of token lookahead or
|
||||
/* after function-header rewriting) so that diagnostics from the
|
||||
/* next compiler stage make sense.
|
||||
/*
|
||||
/* tok_get() reads the next token from standard input. It returns
|
||||
/* a null pointer when the end of input is reached.
|
||||
/*
|
||||
/* tok_show() displays the contents of a (possibly composite) token
|
||||
/* on the standard output.
|
||||
/*
|
||||
/* tok_show_ch() displays the contents of a single-character token
|
||||
/* on the standard output. The character should not be a newline.
|
||||
/*
|
||||
/* tok_flush() displays the contents of a (possibly composite) token
|
||||
/* on the standard output and makes it available for re-use.
|
||||
/*
|
||||
/* put_str() writes a null-terminated string to standard output.
|
||||
/* There should be no newline characters in the string argument.
|
||||
/*
|
||||
/* put_ch() writes one character to standard output. The character
|
||||
/* should not be a newline.
|
||||
/*
|
||||
/* put_nl() outputs a newline character and adjusts the program's idea of
|
||||
/* the current output line.
|
||||
/*
|
||||
/* The in_path and in_line variables contain the file name and
|
||||
/* line number of the most recently read token.
|
||||
/* BUGS
|
||||
/* The tokenizer is just good enough for the unproto filter.
|
||||
/* As a benefit, it is quite fast.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:52:59
|
||||
/* VERSION/RELEASE
|
||||
/* 1.3
|
||||
/*--*/
|
||||
|
||||
static char io_sccsid[] = "@(#) tok_io.c 1.3 92/01/15 21:52:59";
|
||||
|
||||
/* C library */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
extern char *strchr();
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
extern char *strcpy();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "token.h"
|
||||
#include "vstring.h"
|
||||
#include "error.h"
|
||||
|
||||
extern char *strsave(); /* XXX need include file */
|
||||
|
||||
/* Stuff to keep track of original source file name and position */
|
||||
|
||||
static char def_path[] = ""; /* default path name */
|
||||
|
||||
char *in_path = def_path; /* current input file name */
|
||||
int in_line = 1; /* current input line number */
|
||||
|
||||
static char *out_path = def_path; /* last name in output line control */
|
||||
static int out_line = 1; /* current output line number */
|
||||
int last_ch; /* type of last output */
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
static int read_quoted();
|
||||
static void read_comment();
|
||||
static int backslash_newline();
|
||||
static char *read_hex();
|
||||
static char *read_octal();
|
||||
static void fix_line_control();
|
||||
|
||||
/*
|
||||
* Character input with one level of pushback. The INPUT() macro recursively
|
||||
* strips backslash-newline pairs from the input stream. The UNPUT() macro
|
||||
* should be used only for characters obtained through the INPUT() macro.
|
||||
*
|
||||
* After skipping a backslash-newline pair, the input line counter is not
|
||||
* updated, and we continue with the same logical source line. We just
|
||||
* update a counter with the number of backslash-newline sequences that must
|
||||
* be accounted for (backslash_newline() updates the counter). At the end of
|
||||
* the logical source line, an appropriate number of newline characters is
|
||||
* pushed back (in tok_get()). I do not know how GCC handles this, but it
|
||||
* seems to produce te same output.
|
||||
*
|
||||
* Because backslash_newline() recursively calls itself (through the INPUT()
|
||||
* macro), we will run out of stack space, given a sufficiently long
|
||||
* sequence of backslash-newline pairs.
|
||||
*/
|
||||
|
||||
static char in_char = 0; /* push-back storage */
|
||||
static int in_flag = 0; /* pushback available */
|
||||
static int nl_compensate = 0; /* line continuation kluge */
|
||||
|
||||
#define INPUT(c) (in_flag ? (in_flag = 0, c = in_char) : \
|
||||
(c = getchar()) != '\\' ? c : \
|
||||
(c = getchar()) != '\n' ? (ungetc(c, stdin), c = '\\') : \
|
||||
(c = backslash_newline()))
|
||||
#define UNPUT(c) (in_flag = 1, in_char = c)
|
||||
|
||||
/* Directives that should be ignored. */
|
||||
|
||||
#ifdef IGNORE_DIRECTIVES
|
||||
|
||||
static char *ignore_directives[] = {
|
||||
IGNORE_DIRECTIVES,
|
||||
0,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* Modified string and ctype stuff. */
|
||||
|
||||
#define STREQUAL(x,y) (*(x) == *(y) && strcmp((x),(y)) == 0)
|
||||
|
||||
#define ISALNUM(c) (isalnum(c) || (c) == '_')
|
||||
#define ISALPHA(c) (isalpha(c) || (c) == '_')
|
||||
#define ISSPACE(c) (isspace(c) && c != '\n')
|
||||
#define ISDOT(c) (c == '.')
|
||||
#define ISHEX(c) (isdigit(c) || strchr("abcdefABCDEF", c) != 0)
|
||||
#define ISOCTAL(c) (isdigit(c) && (c) != '8' && (c) != '9')
|
||||
|
||||
/* Collect all characters that satisfy one condition */
|
||||
|
||||
#define COLLECT(v,c,cond) { \
|
||||
register struct vstring *vs = v; \
|
||||
register char *cp = vs->str; \
|
||||
*cp++ = c; \
|
||||
while (INPUT(c) != EOF) { \
|
||||
if (cond) { \
|
||||
if (VS_ADDCH(vs, cp, c) == 0) \
|
||||
fatal("out of memory"); \
|
||||
} else { \
|
||||
UNPUT(c); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
*cp = 0; \
|
||||
}
|
||||
|
||||
/* Ensure that output line information is correct */
|
||||
|
||||
#define CHECK_LINE_CONTROL(p,l) { if (out_path != (p) || out_line != (l)) \
|
||||
fix_line_control((p),(l)); }
|
||||
|
||||
/* do_control - parse control line */
|
||||
|
||||
static int do_control()
|
||||
{
|
||||
struct token *t;
|
||||
int line;
|
||||
char *path;
|
||||
|
||||
/* Make sure that the directive shows up in the right place. */
|
||||
|
||||
CHECK_LINE_CONTROL(in_path, in_line);
|
||||
|
||||
while (t = tok_get()) {
|
||||
switch (t->tokno) {
|
||||
|
||||
case TOK_WSPACE:
|
||||
/* Ignore blanks after "#" token. */
|
||||
tok_free(t);
|
||||
break;
|
||||
|
||||
case TOK_NUMBER:
|
||||
|
||||
/*
|
||||
* Line control is of the form: number pathname junk. Since we
|
||||
* have no idea what junk the preprocessor may generate, we copy
|
||||
* all line control tokens to stdout.
|
||||
*/
|
||||
|
||||
put_str("# ");
|
||||
line = atoi(t->vstr->str); /* extract line number */
|
||||
tok_flush(t);
|
||||
while ((t = tok_get()) && t->tokno == TOK_WSPACE)
|
||||
tok_flush(t); /* copy white space */
|
||||
if (t) { /* extract path name */
|
||||
path = (t->tokno == '"') ? strsave(t->vstr->str) : in_path;
|
||||
do {
|
||||
tok_flush(t); /* copy until newline */
|
||||
} while (t->tokno != '\n' && (t = tok_get()));
|
||||
}
|
||||
out_line = in_line = line; /* synchronize */
|
||||
out_path = in_path = path; /* synchronize */
|
||||
return;
|
||||
|
||||
#ifdef IGNORE_DIRECTIVES
|
||||
|
||||
case TOK_WORD:
|
||||
|
||||
/*
|
||||
* Optionally ignore other #directives. This is only a partial
|
||||
* solution, because the preprocessor will still see them.
|
||||
*/
|
||||
{
|
||||
char **cpp;
|
||||
char *cp = t->vstr->str;
|
||||
|
||||
for (cpp = ignore_directives; *cpp; cpp++) {
|
||||
if (STREQUAL(cp, *cpp)) {
|
||||
do {
|
||||
tok_free(t);
|
||||
} while (t->tokno != '\n' && (t = tok_get()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
default:
|
||||
/* Pass through. */
|
||||
put_ch('#');
|
||||
do {
|
||||
tok_flush(t);
|
||||
} while (t->tokno != '\n' && (t = tok_get()));
|
||||
return;
|
||||
|
||||
case 0:
|
||||
/* Hit EOF, punt. */
|
||||
put_ch('#');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* backslash_newline - fix up things after reading a backslash-newline pair */
|
||||
|
||||
static int backslash_newline()
|
||||
{
|
||||
register int c;
|
||||
|
||||
nl_compensate++;
|
||||
return (INPUT(c));
|
||||
}
|
||||
|
||||
/* tok_get - get next token */
|
||||
|
||||
static int last_tokno = '\n';
|
||||
|
||||
struct token *tok_get()
|
||||
{
|
||||
register struct token *t;
|
||||
register int c;
|
||||
int d;
|
||||
|
||||
/*
|
||||
* Get one from the pool and fill it in. The loop is here in case we hit
|
||||
* a preprocessor control line, which happens in a minority of all cases.
|
||||
* We update the token input path and line info *after* backslash-newline
|
||||
* processing or the newline compensation would go wrong.
|
||||
*/
|
||||
|
||||
t = tok_alloc();
|
||||
|
||||
for (;;) {
|
||||
if ((INPUT(c)) == EOF) {
|
||||
tok_free(t);
|
||||
return (0);
|
||||
} else if ((t->line = in_line, t->path = in_path), !isascii(c)) {
|
||||
t->vstr->str[0] = c;
|
||||
t->vstr->str[1] = 0;
|
||||
t->tokno = TOK_OTHER;
|
||||
break;
|
||||
} else if (ISSPACE(c)) {
|
||||
COLLECT(t->vstr, c, ISSPACE(c));
|
||||
t->tokno = TOK_WSPACE;
|
||||
break;
|
||||
} else if (ISALPHA(c)) {
|
||||
COLLECT(t->vstr, c, ISALNUM(c));
|
||||
t->tokno = TOK_WORD;
|
||||
break;
|
||||
} else if (isdigit(c)) {
|
||||
COLLECT(t->vstr, c, isdigit(c));
|
||||
t->tokno = TOK_NUMBER;
|
||||
break;
|
||||
} else if (c == '"' || c == '\'') {
|
||||
t->tokno = read_quoted(t->vstr, c); /* detect missing end quote */
|
||||
break;
|
||||
} else if (ISDOT(c)) {
|
||||
COLLECT(t->vstr, c, ISDOT(c));
|
||||
t->tokno = TOK_OTHER;
|
||||
break;
|
||||
} else if (c == '#' && last_tokno == '\n') {
|
||||
do_control();
|
||||
continue;
|
||||
} else {
|
||||
t->vstr->str[0] = c;
|
||||
if (c == '\n') {
|
||||
in_line++;
|
||||
if (nl_compensate > 0) { /* compensation for bs-nl */
|
||||
UNPUT('\n');
|
||||
nl_compensate--;
|
||||
}
|
||||
} else if (c == '/') {
|
||||
if ((INPUT(d)) == '*') {
|
||||
t->vstr->str[1] = d; /* comment */
|
||||
read_comment(t->vstr);
|
||||
t->tokno = TOK_WSPACE;
|
||||
break;
|
||||
} else {
|
||||
if (d != EOF)
|
||||
UNPUT(d);
|
||||
}
|
||||
} else if (c == '\\') {
|
||||
t->vstr->str[1] = (INPUT(c) == EOF ? 0 : c);
|
||||
t->vstr->str[2] = 0;
|
||||
t->tokno = TOK_OTHER;
|
||||
break;
|
||||
}
|
||||
t->vstr->str[1] = 0;
|
||||
t->tokno = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
last_tokno = t->tokno;
|
||||
t->end_line = in_line;
|
||||
return (t);
|
||||
}
|
||||
|
||||
/* read_quoted - read string or character literal, canonicalize escapes */
|
||||
|
||||
static int read_quoted(vs, ch)
|
||||
register struct vstring *vs;
|
||||
int ch;
|
||||
{
|
||||
register char *cp = vs->str;
|
||||
register int c;
|
||||
int ret = TOK_OTHER;
|
||||
|
||||
*cp++ = ch;
|
||||
|
||||
/*
|
||||
* Clobber the token type in case of a premature newline or EOF. This
|
||||
* prevents us from attempting to concatenate string constants with
|
||||
* broken ones that have no closing quote.
|
||||
*/
|
||||
|
||||
while (INPUT(c) != EOF) {
|
||||
if (c == '\n') { /* newline in string */
|
||||
UNPUT(c);
|
||||
break;
|
||||
}
|
||||
if (VS_ADDCH(vs, cp, c) == 0) /* store character */
|
||||
fatal("out of memory");
|
||||
if (c == ch) { /* closing quote */
|
||||
ret = c;
|
||||
break;
|
||||
}
|
||||
if (c == '\\') { /* parse escape sequence */
|
||||
if ((INPUT(c)) == EOF) { /* EOF, punt */
|
||||
break;
|
||||
} else if (c == 'a') { /* \a -> audible bell */
|
||||
if ((cp = vs_strcpy(vs, cp, BELL)) == 0)
|
||||
fatal("out of memory");
|
||||
} else if (c == 'x') { /* \xhh -> \nnn */
|
||||
cp = read_hex(vs, cp);
|
||||
} else if (ISOCTAL(c) && ch != '\'') {
|
||||
cp = read_octal(vs, cp, c); /* canonicalize \octal */
|
||||
} else {
|
||||
if (VS_ADDCH(vs, cp, c) == 0) /* \other: leave alone */
|
||||
fatal("out of memory");
|
||||
}
|
||||
}
|
||||
}
|
||||
*cp = 0;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* read_comment - stuff a whole comment into one huge token */
|
||||
|
||||
static void read_comment(vs)
|
||||
register struct vstring *vs;
|
||||
{
|
||||
register char *cp = vs->str + 2; /* skip slash star */
|
||||
register int c;
|
||||
register int d;
|
||||
|
||||
while (INPUT(c) != EOF) {
|
||||
if (VS_ADDCH(vs, cp, c) == 0)
|
||||
fatal("out of memory");
|
||||
if (c == '*') {
|
||||
if ((INPUT(d)) == '/') {
|
||||
if (VS_ADDCH(vs, cp, d) == 0)
|
||||
fatal("out of memory");
|
||||
break;
|
||||
} else {
|
||||
if (d != EOF)
|
||||
UNPUT(d);
|
||||
}
|
||||
} else if (c == '\n') {
|
||||
in_line++;
|
||||
} else if (c == '\\') {
|
||||
if ((INPUT(d)) != EOF && VS_ADDCH(vs, cp, d) == 0)
|
||||
fatal("out of memory");
|
||||
}
|
||||
}
|
||||
*cp = 0;
|
||||
}
|
||||
|
||||
/* read_hex - rewrite hex escape to three-digit octal escape */
|
||||
|
||||
static char *read_hex(vs, cp)
|
||||
struct vstring *vs;
|
||||
register char *cp;
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
char buf[BUFSIZ];
|
||||
int len;
|
||||
unsigned val;
|
||||
|
||||
/*
|
||||
* Eat up all subsequent hex digits. Complain later when there are too
|
||||
* many.
|
||||
*/
|
||||
|
||||
for (i = 0; i < sizeof(buf) && (INPUT(c) != EOF) && ISHEX(c); i++)
|
||||
buf[i] = c;
|
||||
buf[i] = 0;
|
||||
|
||||
if (i < sizeof(buf) && c)
|
||||
UNPUT(c);
|
||||
|
||||
/*
|
||||
* Convert hex form to three-digit octal form. The three-digit form is
|
||||
* used so that strings can be concatenated without problems. Complain
|
||||
* about malformed input; truncate the result to at most three octal
|
||||
* digits.
|
||||
*/
|
||||
|
||||
if (i == 0) {
|
||||
error("\\x escape sequence without hexadecimal digits");
|
||||
if (VS_ADDCH(vs, cp, 'x') == 0)
|
||||
fatal("out of memory");
|
||||
} else {
|
||||
(void) sscanf(buf, "%x", &val);
|
||||
sprintf(buf, "%03o", val);
|
||||
if ((len = strlen(buf)) > 3)
|
||||
error("\\x escape sequence yields non-character value");
|
||||
if ((cp = vs_strcpy(vs, cp, buf + len - 3)) == 0)
|
||||
fatal("out of memory");
|
||||
}
|
||||
return (cp);
|
||||
}
|
||||
|
||||
/* read_octal - convert octal escape to three-digit format */
|
||||
|
||||
static char obuf[] = "00123";
|
||||
|
||||
static char *read_octal(vs, cp, c)
|
||||
register struct vstring *vs;
|
||||
register char *cp;
|
||||
register int c;
|
||||
{
|
||||
register int i;
|
||||
|
||||
#define buf_input (obuf + 2)
|
||||
|
||||
/* Eat up at most three octal digits. */
|
||||
|
||||
buf_input[0] = c;
|
||||
for (i = 1; i < 3 && (INPUT(c) != EOF) && ISOCTAL(c); i++)
|
||||
buf_input[i] = c;
|
||||
buf_input[i] = 0;
|
||||
|
||||
if (i < 3 && c)
|
||||
UNPUT(c);
|
||||
|
||||
/*
|
||||
* Leave three-digit octal escapes alone. Convert one-digit and two-digit
|
||||
* octal escapes to three-digit form by prefixing them with a suitable
|
||||
* number of '0' characters. This is done so that strings can be
|
||||
* concatenated without problems.
|
||||
*/
|
||||
|
||||
if ((cp = vs_strcpy(vs, cp, buf_input + i - 3)) == 0)
|
||||
fatal("out of memory");
|
||||
return (cp);
|
||||
}
|
||||
|
||||
/* put_nl - emit newline and adjust output line count */
|
||||
|
||||
void put_nl()
|
||||
{
|
||||
put_ch('\n');
|
||||
out_line++;
|
||||
}
|
||||
|
||||
/* fix_line_control - to adjust path and/or line count info in output */
|
||||
|
||||
static void fix_line_control(path, line)
|
||||
register char *path;
|
||||
register int line;
|
||||
{
|
||||
|
||||
/*
|
||||
* This function is called sporadically, so it should not be a problem
|
||||
* that we repeat some of the tests that preceded this function call.
|
||||
*
|
||||
* Emit a newline if we are not at the start of a line.
|
||||
*
|
||||
* If we switch files, or if we jump backwards, emit line control. If we
|
||||
* jump forward, emit the proper number of newlines to compensate.
|
||||
*/
|
||||
|
||||
if (last_ch != '\n') /* terminate open line */
|
||||
put_nl();
|
||||
if (path != out_path || line < out_line) { /* file switch or back jump */
|
||||
printf("# %d %s\n", out_line = line, out_path = path);
|
||||
last_ch = '\n';
|
||||
} else { /* forward jump */
|
||||
while (line > out_line)
|
||||
put_nl();
|
||||
}
|
||||
}
|
||||
|
||||
/* tok_show_ch - output single-character token (not newline) */
|
||||
|
||||
void tok_show_ch(t)
|
||||
register struct token *t;
|
||||
{
|
||||
CHECK_LINE_CONTROL(t->path, t->line);
|
||||
|
||||
put_ch(t->tokno); /* show token contents */
|
||||
}
|
||||
|
||||
/* tok_show - output (possibly composite) token */
|
||||
|
||||
void tok_show(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register struct token *p;
|
||||
|
||||
if (t->tokno == TOK_LIST) {
|
||||
register struct token *s;
|
||||
|
||||
/*
|
||||
* This branch is completely in terms of tok_xxx() primitives, so
|
||||
* there is no need to check the line control information.
|
||||
*/
|
||||
|
||||
for (s = t->head; s; s = s->next) {
|
||||
tok_show_ch(s); /* '(' or ',' or ')' */
|
||||
for (p = s->head; p; p = p->next)
|
||||
tok_show(p); /* show list element */
|
||||
}
|
||||
} else {
|
||||
register char *cp = t->vstr->str;
|
||||
|
||||
/*
|
||||
* Measurements show that it pays off to give special treatment to
|
||||
* single-character tokens. Note that both types of token may cause a
|
||||
* change of output line number.
|
||||
*/
|
||||
|
||||
CHECK_LINE_CONTROL(t->path, t->line);
|
||||
if (cp[1] == 0) {
|
||||
put_ch(*cp); /* single-character token */
|
||||
} else {
|
||||
put_str(cp); /* multi_character token */
|
||||
}
|
||||
out_line = t->end_line; /* may span multiple lines */
|
||||
for (p = t->head; p; p = p->next)
|
||||
tok_show(p); /* trailing blanks */
|
||||
}
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* tok_pool 3
|
||||
/* SUMMARY
|
||||
/* maintain pool of unused token structures
|
||||
/* PACKAGE
|
||||
/* unproto
|
||||
/* SYNOPSIS
|
||||
/* #include "token.h"
|
||||
/*
|
||||
/* struct token *tok_alloc()
|
||||
/*
|
||||
/* void tok_free(t)
|
||||
/* struct token *t;
|
||||
/* DESCRIPTION
|
||||
/* tok_alloc() and tok_free() maintain a pool of unused token
|
||||
/* structures.
|
||||
/*
|
||||
/* tok_alloc() takes the first free token structure from the pool
|
||||
/* or allocates a new one if the pool is empty.
|
||||
/*
|
||||
/* tok_free() adds a (possibly composite) token structure to the pool.
|
||||
/* BUGS
|
||||
/* The pool never shrinks.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:53:04
|
||||
/* VERSION/RELEASE
|
||||
/* 1.2
|
||||
/*--*/
|
||||
|
||||
static char pool_sccsid[] = "@(#) tok_pool.c 1.2 92/01/15 21:53:04";
|
||||
|
||||
/* C library */
|
||||
|
||||
extern char *malloc();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "token.h"
|
||||
#include "vstring.h"
|
||||
#include "error.h"
|
||||
|
||||
#define TOKLEN 5 /* initial string buffer length */
|
||||
|
||||
struct token *tok_pool = 0; /* free token pool */
|
||||
|
||||
/* tok_alloc - allocate token structure from pool or heap */
|
||||
|
||||
struct token *tok_alloc()
|
||||
{
|
||||
register struct token *t;
|
||||
|
||||
if (tok_pool) { /* re-use an old one */
|
||||
t = tok_pool;
|
||||
tok_pool = t->next;
|
||||
} else { /* create a new one */
|
||||
if ((t = (struct token *) malloc(sizeof(struct token))) == 0
|
||||
|| (t->vstr = vs_alloc(TOKLEN)) == 0)
|
||||
fatal("out of memory");
|
||||
}
|
||||
t->next = t->head = t->tail = 0;
|
||||
#ifdef DEBUG
|
||||
strcpy(t->vstr->str, "BUSY");
|
||||
#endif
|
||||
return (t);
|
||||
}
|
||||
|
||||
/* tok_free - return (possibly composite) token to pool of free tokens */
|
||||
|
||||
void tok_free(t)
|
||||
register struct token *t;
|
||||
{
|
||||
#ifdef DEBUG
|
||||
/* Check if we are freeing free token */
|
||||
|
||||
register struct token *p;
|
||||
|
||||
for (p = tok_pool; p; p = p->next)
|
||||
if (p == t)
|
||||
fatal("freeing free token");
|
||||
#endif
|
||||
|
||||
/* Free neighbours and subordinates first */
|
||||
|
||||
if (t->next)
|
||||
tok_free(t->next);
|
||||
if (t->head)
|
||||
tok_free(t->head);
|
||||
|
||||
/* Free self */
|
||||
|
||||
t->next = tok_pool;
|
||||
t->head = t->tail = 0;
|
||||
tok_pool = t;
|
||||
#ifdef DEBUG
|
||||
strcpy(t->vstr->str, "FREE");
|
||||
#endif
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/* @(#) token.h 1.4 92/01/15 21:53:17 */
|
||||
|
||||
struct token {
|
||||
int tokno; /* token value, see below */
|
||||
char *path; /* file name */
|
||||
int line; /* line number at token start */
|
||||
int end_line; /* line number at token end */
|
||||
struct vstring *vstr; /* token contents */
|
||||
struct token *next;
|
||||
struct token *head;
|
||||
struct token *tail;
|
||||
};
|
||||
|
||||
/* Special token values */
|
||||
|
||||
#define TOK_LIST 256 /* () delimited list */
|
||||
#define TOK_WORD 257 /* keyword or identifier */
|
||||
#define TOK_NUMBER 258 /* one or more digits */
|
||||
#define TOK_WSPACE 259 /* comment, white space, not newline */
|
||||
#define TOK_OTHER 260 /* other token */
|
||||
#define TOK_CONTROL 261 /* flow control keyword */
|
||||
#define TOK_COMPOSITE 262 /* struct or union keyword */
|
||||
#define TOK_DATE 263 /* date: Mmm dd yyyy */
|
||||
#define TOK_TIME 264 /* time: hh:mm:ss */
|
||||
#define TOK_VOID 265 /* void keyword */
|
||||
|
||||
/* Input/output functions and macros */
|
||||
|
||||
extern struct token *tok_get(); /* read next single token */
|
||||
extern void tok_show(); /* display (composite) token */
|
||||
extern struct token *tok_class(); /* classify tokens */
|
||||
extern void tok_unget(); /* stuff token back into input */
|
||||
extern void put_nl(); /* print newline character */
|
||||
extern void tok_show_ch(); /* emit single-character token */
|
||||
|
||||
#define tok_flush(t) (tok_show(t), tok_free(t))
|
||||
|
||||
#ifdef DEBUG
|
||||
#define put_ch(c) (putchar(last_ch = c),fflush(stdout))
|
||||
#define put_str(s) (fputs(s,stdout),last_ch = 0,fflush(stdout))
|
||||
#else
|
||||
#define put_ch(c) putchar(last_ch = c)
|
||||
#define put_str(s) (fputs(s,stdout),last_ch = 0)
|
||||
#endif
|
||||
|
||||
/* Memory management */
|
||||
|
||||
struct token *tok_alloc(); /* allocate token storage */
|
||||
extern void tok_free(); /* re-cycle storage */
|
||||
|
||||
/* Context */
|
||||
|
||||
extern char *in_path; /* current input path name */
|
||||
extern int in_line; /* current input line number */
|
||||
extern int last_ch; /* type of last output */
|
@ -1,152 +0,0 @@
|
||||
.TH UNPROTO 1
|
||||
.ad
|
||||
.fi
|
||||
.SH NAME
|
||||
unproto
|
||||
\-
|
||||
compile ANSI C with traditional UNIX C compiler
|
||||
.SH PACKAGE
|
||||
.na
|
||||
.nf
|
||||
unproto
|
||||
.SH SYNOPSIS
|
||||
.na
|
||||
.nf
|
||||
/somewhere/cpp ...
|
||||
|
||||
cc cflags -E file.c | unproto >file.i; cc cflags -c file.i
|
||||
.SH DESCRIPTION
|
||||
.ad
|
||||
.fi
|
||||
This document describes a filter that sits in between the UNIX
|
||||
C preprocessor and the next UNIX C compiler stage, on the fly rewriting
|
||||
ANSI-style syntax to old-style syntax. Typically, the program is
|
||||
invoked by the native UNIX C compiler as an alternate preprocessor.
|
||||
The unprototyper in turn invokes the native C preprocessor and
|
||||
massages its output. Similar tricks can be used with the lint(1)
|
||||
command.
|
||||
|
||||
Language constructs that are always rewritten:
|
||||
.TP
|
||||
function headings, prototypes, pointer types
|
||||
ANSI-C style function headings, function prototypes, function
|
||||
pointer types and type casts are rewritten to old style.
|
||||
<stdarg.h> support is provided for functions with variable-length
|
||||
argument lists.
|
||||
.TP
|
||||
character and string constants
|
||||
The \\a and \\x escape sequences are rewritten to their (three-digit)
|
||||
octal equivalents.
|
||||
|
||||
Multiple string tokens are concatenated; an arbitrary number of
|
||||
whitespace or comment tokens may appear between successive
|
||||
string tokens.
|
||||
|
||||
Within string constants, octal escape sequences are rewritten to the
|
||||
three-digit \\ddd form, so that string concatenation produces correct
|
||||
results.
|
||||
.TP
|
||||
date and time
|
||||
The __DATE__ and __TIME__ tokens are replaced by string constants
|
||||
of the form "Mmm dd yyyy" and "hh:mm:ss", respectively. The result
|
||||
is subjected to string concatenation, just like any other string
|
||||
constant.
|
||||
.PP
|
||||
Language constructs that are rewritten only if the program has been
|
||||
configured to do so:
|
||||
.TP
|
||||
void types
|
||||
The unprototyper can be configured to rewrite "void *" to "char *",
|
||||
and even to rewrite plain "void" to "int".
|
||||
These features are configurable because many traditional UNIX C
|
||||
compilers do not need them.
|
||||
|
||||
Note: (void) argument lists are always replaced by empty ones.
|
||||
.PP
|
||||
ANSI C constructs that are not rewritten because the traditional
|
||||
UNIX C preprocessor provides suitable workarounds:
|
||||
.TP
|
||||
const and volatile
|
||||
Use the "-Dconst=" and/or "-Dvolatile=" preprocessor directives to
|
||||
get rid of unimplemented keywords.
|
||||
.TP
|
||||
token pasting and stringizing
|
||||
The traditional UNIX C preprocessor provides excellent alternatives.
|
||||
For example:
|
||||
|
||||
.nf
|
||||
.ne 2
|
||||
#define string(bar) "bar" /* instead of: # x */
|
||||
#define paste(x,y) x/**\/y /* instead of: x##y */
|
||||
.fi
|
||||
|
||||
There is a good reason why the # and ## operators are not implemented
|
||||
in the unprototyper.
|
||||
After program text has gone through a non-ANSI C preprocessor, all
|
||||
information about the grouping of the operands of # and ## is lost.
|
||||
Thus, if the unprototyper were to perform these operations, it would
|
||||
produce correct results only in the most trivial cases. Operands
|
||||
with embedded blanks, operands that expand to null tokens, and nested
|
||||
use of # and/or ## would cause all kinds of obscure problems.
|
||||
.PP
|
||||
Unsupported ANSI features:
|
||||
.TP
|
||||
trigraphs and #pragmas
|
||||
Trigraphs are useful only for systems with broken character sets.
|
||||
If the local compiler chokes on #pragma, insert a blank before the
|
||||
"#" character, and enclose the offending directive between #ifdef
|
||||
and #endif.
|
||||
.SH SEE ALSO
|
||||
.na
|
||||
.nf
|
||||
.ad
|
||||
.fi
|
||||
cc(1), how to specify a non-default C preprocessor.
|
||||
Some versions of the lint(1) command are implemented as a shell
|
||||
script. It should require only minor modification for integration
|
||||
with the unprototyper. Other versions of the lint(1) command accept
|
||||
the same command syntax as the C compiler for the specification of a
|
||||
non-default preprocessor. Some research may be needed.
|
||||
.SH FILES
|
||||
.na
|
||||
.nf
|
||||
/wherever/stdarg.h, provided with the unproto filter.
|
||||
.SH DIAGNOSTICS
|
||||
.ad
|
||||
.fi
|
||||
Problems are reported on the standard error stream.
|
||||
A non-zero exit status means that there was a problem.
|
||||
.SH BUGS
|
||||
.ad
|
||||
.fi
|
||||
The unprototyper should be run on preprocessed source only:
|
||||
unexpanded macros may confuse the program.
|
||||
|
||||
Declarations of (object) are misunderstood and will result in
|
||||
syntax errors: the objects between parentheses disappear.
|
||||
|
||||
Sometimes does not preserve whitespace after parentheses and commas.
|
||||
This is a purely aesthetical matter, and the compiler should not care.
|
||||
Whitespace within string constants is, of course, left intact.
|
||||
|
||||
Does not generate explicit type casts for function-argument
|
||||
expressions. The lack of explicit conversions between integral
|
||||
and/or pointer argument types should not be a problem in environments
|
||||
where sizeof(int) == sizeof(long) == sizeof(pointer). A more serious
|
||||
problem is the lack of automatic type conversions between integral and
|
||||
floating-point argument types. Let lint(1) be your friend.
|
||||
.SH AUTHOR(S)
|
||||
.na
|
||||
.nf
|
||||
Wietse Venema (wietse@wzv.win.tue.nl)
|
||||
Eindhoven University of Technology
|
||||
Department of Mathematics and Computer Science
|
||||
Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
.SH LAST MODIFICATION
|
||||
.na
|
||||
.nf
|
||||
93/06/18 22:29:37
|
||||
.SH VERSION/RELEASE
|
||||
.na
|
||||
.nf
|
||||
1.6
|
@ -1,999 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* unproto 1
|
||||
/* SUMMARY
|
||||
/* compile ANSI C with traditional UNIX C compiler
|
||||
/* PACKAGE
|
||||
/* unproto
|
||||
/* SYNOPSIS
|
||||
/* /somewhere/cpp ...
|
||||
/*
|
||||
/* cc cflags -E file.c | unproto >file.i; cc cflags -c file.i
|
||||
/* DESCRIPTION
|
||||
/* This document describes a filter that sits in between the UNIX
|
||||
/* C preprocessor and the next UNIX C compiler stage, on the fly rewriting
|
||||
/* ANSI-style syntax to old-style syntax. Typically, the program is
|
||||
/* invoked by the native UNIX C compiler as an alternate preprocessor.
|
||||
/* The unprototyper in turn invokes the native C preprocessor and
|
||||
/* massages its output. Similar tricks can be used with the lint(1)
|
||||
/* command.
|
||||
/*
|
||||
/* Language constructs that are always rewritten:
|
||||
/* .TP
|
||||
/* function headings, prototypes, pointer types
|
||||
/* ANSI-C style function headings, function prototypes, function
|
||||
/* pointer types and type casts are rewritten to old style.
|
||||
/* <stdarg.h> support is provided for functions with variable-length
|
||||
/* argument lists.
|
||||
/* .TP
|
||||
/* character and string constants
|
||||
/* The \\a and \\x escape sequences are rewritten to their (three-digit)
|
||||
/* octal equivalents.
|
||||
/*
|
||||
/* Multiple string tokens are concatenated; an arbitrary number of
|
||||
/* whitespace or comment tokens may appear between successive
|
||||
/* string tokens.
|
||||
/*
|
||||
/* Within string constants, octal escape sequences are rewritten to the
|
||||
/* three-digit \\ddd form, so that string concatenation produces correct
|
||||
/* results.
|
||||
/* .TP
|
||||
/* date and time
|
||||
/* The __DATE__ and __TIME__ tokens are replaced by string constants
|
||||
/* of the form "Mmm dd yyyy" and "hh:mm:ss", respectively. The result
|
||||
/* is subjected to string concatenation, just like any other string
|
||||
/* constant.
|
||||
/* .PP
|
||||
/* Language constructs that are rewritten only if the program has been
|
||||
/* configured to do so:
|
||||
/* .TP
|
||||
/* void types
|
||||
/* The unprototyper can be configured to rewrite "void *" to "char *",
|
||||
/* and even to rewrite plain "void" to "int".
|
||||
/* These features are configurable because many traditional UNIX C
|
||||
/* compilers do not need them.
|
||||
/*
|
||||
/* Note: (void) argument lists are always replaced by empty ones.
|
||||
/* .PP
|
||||
/* ANSI C constructs that are not rewritten because the traditional
|
||||
/* UNIX C preprocessor provides suitable workarounds:
|
||||
/* .TP
|
||||
/* const and volatile
|
||||
/* Use the "-Dconst=" and/or "-Dvolatile=" preprocessor directives to
|
||||
/* get rid of unimplemented keywords.
|
||||
/* .TP
|
||||
/* token pasting and stringizing
|
||||
/* The traditional UNIX C preprocessor provides excellent alternatives.
|
||||
/* For example:
|
||||
/*
|
||||
/* .nf
|
||||
/* .ne 2
|
||||
/* #define string(bar) "bar" /* instead of: # x */
|
||||
/* #define paste(x,y) x/**\/y /* instead of: x##y */
|
||||
/* .fi
|
||||
/*
|
||||
/* There is a good reason why the # and ## operators are not implemented
|
||||
/* in the unprototyper.
|
||||
/* After program text has gone through a non-ANSI C preprocessor, all
|
||||
/* information about the grouping of the operands of # and ## is lost.
|
||||
/* Thus, if the unprototyper were to perform these operations, it would
|
||||
/* produce correct results only in the most trivial cases. Operands
|
||||
/* with embedded blanks, operands that expand to null tokens, and nested
|
||||
/* use of # and/or ## would cause all kinds of obscure problems.
|
||||
/* .PP
|
||||
/* Unsupported ANSI features:
|
||||
/* .TP
|
||||
/* trigraphs and #pragmas
|
||||
/* Trigraphs are useful only for systems with broken character sets.
|
||||
/* If the local compiler chokes on #pragma, insert a blank before the
|
||||
/* "#" character, and enclose the offending directive between #ifdef
|
||||
/* and #endif.
|
||||
/* SEE ALSO
|
||||
/* .ad
|
||||
/* .fi
|
||||
/* cc(1), how to specify a non-default C preprocessor.
|
||||
/* Some versions of the lint(1) command are implemented as a shell
|
||||
/* script. It should require only minor modification for integration
|
||||
/* with the unprototyper. Other versions of the lint(1) command accept
|
||||
/* the same command syntax as the C compiler for the specification of a
|
||||
/* non-default preprocessor. Some research may be needed.
|
||||
/* FILES
|
||||
/* /wherever/stdarg.h, provided with the unproto filter.
|
||||
/* DIAGNOSTICS
|
||||
/* Problems are reported on the standard error stream.
|
||||
/* A non-zero exit status means that there was a problem.
|
||||
/* BUGS
|
||||
/* The unprototyper should be run on preprocessed source only:
|
||||
/* unexpanded macros may confuse the program.
|
||||
/*
|
||||
/* Declarations of (object) are misunderstood and will result in
|
||||
/* syntax errors: the objects between parentheses disappear.
|
||||
/*
|
||||
/* Sometimes does not preserve whitespace after parentheses and commas.
|
||||
/* This is a purely aesthetical matter, and the compiler should not care.
|
||||
/* Whitespace within string constants is, of course, left intact.
|
||||
/*
|
||||
/* Does not generate explicit type casts for function-argument
|
||||
/* expressions. The lack of explicit conversions between integral
|
||||
/* and/or pointer argument types should not be a problem in environments
|
||||
/* where sizeof(int) == sizeof(long) == sizeof(pointer). A more serious
|
||||
/* problem is the lack of automatic type conversions between integral and
|
||||
/* floating-point argument types. Let lint(1) be your friend.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema (wietse@wzv.win.tue.nl)
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 93/06/18 22:29:37
|
||||
/* VERSION/RELEASE
|
||||
/* 1.6
|
||||
/*--*/
|
||||
|
||||
static char unproto_sccsid[] = "@(#) unproto.c 1.6 93/06/18 22:29:37";
|
||||
|
||||
/* C library */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
extern void exit();
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
extern int getopt();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "vstring.h"
|
||||
#include "stdarg.h"
|
||||
#include "token.h"
|
||||
#include "error.h"
|
||||
#include "symbol.h"
|
||||
|
||||
/* Forward declarations. */
|
||||
|
||||
static struct token *dcl_flush();
|
||||
static void block_flush();
|
||||
static void block_dcls();
|
||||
static struct token *show_func_ptr_type();
|
||||
static struct token *show_struct_type();
|
||||
static void show_arg_name();
|
||||
static void show_type();
|
||||
static void pair_flush();
|
||||
static void check_cast();
|
||||
static void show_empty_list();
|
||||
|
||||
#define check_cast_flush(t) (check_cast(t), tok_free(t))
|
||||
|
||||
#ifdef PIPE_THROUGH_CPP
|
||||
static int pipe_stdin_through_cpp();
|
||||
#endif
|
||||
|
||||
/* Disable debugging printfs while preserving side effects. */
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DPRINTF printf
|
||||
#else
|
||||
#define DPRINTF (void)
|
||||
#endif
|
||||
|
||||
/* An attempt to make some complicated expressions a bit more readable. */
|
||||
|
||||
#define STREQ(x,y) (*(x) == *(y) && !strcmp((x),(y)))
|
||||
|
||||
#define LAST_ARG_AND_EQUAL(s,c) ((s)->next && (s)->next->next == 0 \
|
||||
&& (s)->head && ((s)->head == (s)->tail) \
|
||||
&& (STREQ((s)->head->vstr->str, (c))))
|
||||
|
||||
#define LIST_BEGINS_WITH_STAR(s) (s->head->head && s->head->head->tokno == '*')
|
||||
|
||||
#define IS_FUNC_PTR_TYPE(s) (s->tokno == TOK_LIST && s->next \
|
||||
&& s->next->tokno == TOK_LIST \
|
||||
&& LIST_BEGINS_WITH_STAR(s))
|
||||
|
||||
/* What to look for to detect a (void) argument list. */
|
||||
|
||||
#ifdef MAP_VOID
|
||||
#define VOID_ARG "int" /* bare "void" is mapped to "int" */
|
||||
#else
|
||||
#define VOID_ARG "void" /* bare "void" is left alone */
|
||||
#endif
|
||||
|
||||
/* main - driver */
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
register struct token *t;
|
||||
#ifdef PIPE_THROUGH_CPP /* pipe through /lib/cpp */
|
||||
int cpp_status;
|
||||
int wait_pid;
|
||||
int cpp_pid;
|
||||
|
||||
cpp_pid = pipe_stdin_through_cpp(argv);
|
||||
#endif
|
||||
|
||||
sym_init(); /* prime the symbol table */
|
||||
|
||||
while (t = tok_class()) {
|
||||
if (t = dcl_flush(t)) { /* try declaration */
|
||||
if (t->tokno == '{') { /* examine rejected token */
|
||||
block_flush(t); /* body */
|
||||
} else {
|
||||
tok_flush(t); /* other, recover */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PIPE_THROUGH_CPP /* pipe through /lib/cpp */
|
||||
while ((wait_pid = wait(&cpp_status)) != -1 && wait_pid != cpp_pid)
|
||||
/* void */ ;
|
||||
return (errcount != 0 || wait_pid != cpp_pid || cpp_status != 0);
|
||||
#else
|
||||
return (errcount != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PIPE_THROUGH_CPP /* pipe through /lib/cpp */
|
||||
|
||||
/* pipe_stdin_through_cpp - avoid shell script overhead */
|
||||
|
||||
static int pipe_stdin_through_cpp(argv)
|
||||
char **argv;
|
||||
{
|
||||
int pipefds[2];
|
||||
int pid;
|
||||
char **cpptr = argv;
|
||||
int i;
|
||||
struct stat st;
|
||||
|
||||
/*
|
||||
* The code that sets up the pipe requires that file descriptors 0,1,2
|
||||
* are already open. All kinds of mysterious things will happen if that
|
||||
* is not the case. The following loops makes sure that descriptors 0,1,2
|
||||
* are set up properly.
|
||||
*/
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (fstat(i, &st) == -1 && open("/dev/null", 2) != i) {
|
||||
perror("open /dev/null");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* With most UNIX implementations, the second non-option argument to
|
||||
* /lib/cpp specifies the output file. If an output file other than
|
||||
* stdout is specified, we must force /lib/cpp to write to stdout, and we
|
||||
* must redirect our own standard output to the specified output file.
|
||||
*/
|
||||
|
||||
#define IS_OPTION(cp) ((cp)[0] == '-' && (cp)[1] != 0)
|
||||
|
||||
/* Skip to first non-option argument, if any. */
|
||||
|
||||
while (*++cpptr && IS_OPTION(*cpptr))
|
||||
/* void */ ;
|
||||
|
||||
/*
|
||||
* Assume that the first non-option argument is the input file name. The
|
||||
* next argument could be the output destination or an option (System V
|
||||
* Release 2 /lib/cpp gets the options *after* the file arguments).
|
||||
*/
|
||||
|
||||
if (*cpptr && *++cpptr && **cpptr != '-') {
|
||||
|
||||
/*
|
||||
* The first non-option argument is followed by another argument that
|
||||
* is not an option ("-stuff") or a hyphen ("-"). Redirect our own
|
||||
* standard output before we clobber the file name.
|
||||
*/
|
||||
|
||||
if (freopen(*cpptr, "w", stdout) == 0) {
|
||||
perror(*cpptr);
|
||||
exit(1);
|
||||
}
|
||||
/* Clobber the file name argument so that /lib/cpp writes to stdout */
|
||||
|
||||
*cpptr = "-";
|
||||
}
|
||||
/* Set up the pipe that connects /lib/cpp to our standard input. */
|
||||
|
||||
if (pipe(pipefds)) {
|
||||
perror("pipe");
|
||||
exit(1);
|
||||
}
|
||||
switch (pid = fork()) {
|
||||
case -1: /* error */
|
||||
perror("fork");
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
case 0: /* child */
|
||||
(void) close(pipefds[0]); /* close reading end */
|
||||
(void) close(1); /* connect stdout to pipe */
|
||||
if (dup(pipefds[1]) != 1)
|
||||
fatal("dup() problem");
|
||||
(void) close(pipefds[1]); /* close redundant fd */
|
||||
(void) execv(PIPE_THROUGH_CPP, argv);
|
||||
perror(PIPE_THROUGH_CPP);
|
||||
exit(1);
|
||||
/* NOTREACHED */
|
||||
default: /* parent */
|
||||
(void) close(pipefds[1]); /* close writing end */
|
||||
(void) close(0); /* connect stdin to pipe */
|
||||
if (dup(pipefds[0]) != 0)
|
||||
fatal("dup() problem");
|
||||
close(pipefds[0]); /* close redundant fd */
|
||||
return (pid);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* show_arg_names - display function argument names */
|
||||
|
||||
static void show_arg_names(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register struct token *s;
|
||||
|
||||
/* Do argument names, but suppress void and rewrite trailing ... */
|
||||
|
||||
if (LAST_ARG_AND_EQUAL(t->head, VOID_ARG)) {
|
||||
show_empty_list(t); /* no arguments */
|
||||
} else {
|
||||
for (s = t->head; s; s = s->next) { /* foreach argument... */
|
||||
if (LAST_ARG_AND_EQUAL(s, "...")) {
|
||||
#ifdef _VA_ALIST_ /* see ./stdarg.h */
|
||||
tok_show_ch(s); /* ',' */
|
||||
put_str(_VA_ALIST_); /* varargs magic */
|
||||
#endif
|
||||
} else {
|
||||
tok_show_ch(s); /* '(' or ',' or ')' */
|
||||
show_arg_name(s); /* extract argument name */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* show_arg_types - display function argument types */
|
||||
|
||||
static void show_arg_types(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register struct token *s;
|
||||
|
||||
/* Do argument types, but suppress void and trailing ... */
|
||||
|
||||
if (!LAST_ARG_AND_EQUAL(t->head, VOID_ARG)) {
|
||||
for (s = t->head; s; s = s->next) { /* foreach argument... */
|
||||
if (LAST_ARG_AND_EQUAL(s, "...")) {
|
||||
#ifdef _VA_DCL_ /* see ./stdarg.h */
|
||||
put_str(_VA_DCL_); /* varargs magic */
|
||||
put_nl(); /* make output look nicer */
|
||||
#endif
|
||||
} else {
|
||||
if (s->head != s->tail) { /* really new-style argument? */
|
||||
show_type(s); /* rewrite type info */
|
||||
put_ch(';');
|
||||
put_nl(); /* make output look nicer */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* header_flush - rewrite new-style function heading to old style */
|
||||
|
||||
static void header_flush(t)
|
||||
register struct token *t;
|
||||
{
|
||||
show_arg_names(t); /* show argument names */
|
||||
put_nl(); /* make output look nicer */
|
||||
show_arg_types(t); /* show argument types */
|
||||
tok_free(t); /* discard token */
|
||||
}
|
||||
|
||||
/* fpf_header_names - define func returning ptr to func, no argument types */
|
||||
|
||||
static void fpf_header_names(list)
|
||||
struct token *list;
|
||||
{
|
||||
register struct token *s;
|
||||
register struct token *p;
|
||||
|
||||
/*
|
||||
* Recurse until we find the argument list. Account for the rare case
|
||||
* that list is a comma-separated list (which should be a syntax error).
|
||||
* Display old-style fuction argument names.
|
||||
*/
|
||||
|
||||
for (s = list->head; s; s = s->next) {
|
||||
tok_show_ch(s); /* '(' or ',' or ')' */
|
||||
for (p = s->head; p; p = p->next) {
|
||||
if (p->tokno == TOK_LIST) {
|
||||
if (IS_FUNC_PTR_TYPE(p)) { /* recurse */
|
||||
fpf_header_names(p);
|
||||
show_empty_list(p = p->next);
|
||||
} else { /* display argument names */
|
||||
show_arg_names(p);
|
||||
}
|
||||
} else { /* pass through other stuff */
|
||||
tok_show(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* fpf_header_types - define func returning ptr to func, argument types only */
|
||||
|
||||
static void fpf_header_types(list)
|
||||
struct token *list;
|
||||
{
|
||||
register struct token *s;
|
||||
register struct token *p;
|
||||
|
||||
/*
|
||||
* Recurse until we find the argument list. Account for the rare case
|
||||
* that list is a comma-separated list (which should be a syntax error).
|
||||
* Display old-style function argument types.
|
||||
*/
|
||||
|
||||
for (s = list->head; s; s = s->next) {
|
||||
for (p = s->head; p; p = p->next) {
|
||||
if (p->tokno == TOK_LIST) {
|
||||
if (IS_FUNC_PTR_TYPE(p)) { /* recurse */
|
||||
fpf_header_types(p);
|
||||
p = p->next;
|
||||
} else { /* display argument types */
|
||||
show_arg_types(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* fpf_header - define function returning pointer to function */
|
||||
|
||||
static void fpf_header(l1, l2)
|
||||
struct token *l1;
|
||||
struct token *l2;
|
||||
{
|
||||
fpf_header_names(l1); /* strip argument types */
|
||||
show_empty_list(l2); /* strip prototype */
|
||||
put_nl(); /* nicer output */
|
||||
fpf_header_types(l1); /* show argument types */
|
||||
}
|
||||
|
||||
/* skip_enclosed - skip over enclosed tokens */
|
||||
|
||||
static struct token *skip_enclosed(p, stop)
|
||||
register struct token *p;
|
||||
register int stop;
|
||||
{
|
||||
register int start = p->tokno;
|
||||
|
||||
/* Always return a pointer to the last processed token, never NULL. */
|
||||
|
||||
while (p->next) {
|
||||
p = p->next;
|
||||
if (p->tokno == start) {
|
||||
p = skip_enclosed(p, stop); /* recurse */
|
||||
} else if (p->tokno == stop) {
|
||||
break; /* done */
|
||||
}
|
||||
}
|
||||
return (p);
|
||||
}
|
||||
|
||||
/* show_arg_name - extract argument name from argument type info */
|
||||
|
||||
static void show_arg_name(s)
|
||||
register struct token *s;
|
||||
{
|
||||
if (s->head) {
|
||||
register struct token *p;
|
||||
register struct token *t = 0;
|
||||
|
||||
/* Find the last interesting item. */
|
||||
|
||||
for (p = s->head; p; p = p->next) {
|
||||
if (p->tokno == TOK_WORD) {
|
||||
t = p; /* remember last word */
|
||||
} else if (p->tokno == '{') {
|
||||
p = skip_enclosed(p, '}'); /* skip structured stuff */
|
||||
} else if (p->tokno == '[') {
|
||||
break; /* dimension may be a macro */
|
||||
} else if (IS_FUNC_PTR_TYPE(p)) {
|
||||
t = p; /* or function pointer */
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract argument name from last interesting item. */
|
||||
|
||||
if (t) {
|
||||
if (t->tokno == TOK_LIST)
|
||||
show_arg_name(t->head); /* function pointer, recurse */
|
||||
else
|
||||
tok_show(t); /* print last word */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* show_type - rewrite type to old-style syntax */
|
||||
|
||||
static void show_type(s)
|
||||
register struct token *s;
|
||||
{
|
||||
register struct token *p;
|
||||
|
||||
/*
|
||||
* Rewrite (*stuff)(args) to (*stuff)(). Rewrite word(args) to word(),
|
||||
* but only if the word was preceded by a word, '*' or '}'. Leave
|
||||
* anything else alone.
|
||||
*/
|
||||
|
||||
for (p = s->head; p; p = p->next) {
|
||||
if (IS_FUNC_PTR_TYPE(p)) {
|
||||
p = show_func_ptr_type(p, p->next); /* function pointer type */
|
||||
} else {
|
||||
register struct token *q;
|
||||
register struct token *r;
|
||||
|
||||
tok_show(p); /* other */
|
||||
if ((p->tokno == TOK_WORD || p->tokno == '*' || p->tokno == '}')
|
||||
&& (q = p->next) && q->tokno == TOK_WORD
|
||||
&& (r = q->next) && r->tokno == TOK_LIST) {
|
||||
tok_show(q); /* show name */
|
||||
show_empty_list(p = r); /* strip args */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* show_func_ptr_type - display function_pointer type using old-style syntax */
|
||||
|
||||
static struct token *show_func_ptr_type(t1, t2)
|
||||
struct token *t1;
|
||||
struct token *t2;
|
||||
{
|
||||
register struct token *s;
|
||||
|
||||
/*
|
||||
* Rewrite (list1) (list2) to (list1) (). Account for the rare case that
|
||||
* (list1) is a comma-separated list. That should be an error, but we do
|
||||
* not want to waste any information.
|
||||
*/
|
||||
|
||||
for (s = t1->head; s; s = s->next) {
|
||||
tok_show_ch(s); /* '(' or ',' or ')' */
|
||||
show_type(s); /* recurse */
|
||||
}
|
||||
show_empty_list(t2);
|
||||
return (t2);
|
||||
}
|
||||
|
||||
/* show_empty_list - display opening and closing parentheses (if available) */
|
||||
|
||||
static void show_empty_list(t)
|
||||
register struct token *t;
|
||||
{
|
||||
tok_show_ch(t->head); /* opening paren */
|
||||
if (t->tail->tokno == ')')
|
||||
tok_show_ch(t->tail); /* closing paren */
|
||||
}
|
||||
|
||||
/* show_struct_type - display structured type, rewrite function-pointer types */
|
||||
|
||||
static struct token *show_struct_type(p)
|
||||
register struct token *p;
|
||||
{
|
||||
tok_show(p); /* opening brace */
|
||||
|
||||
while (p->next) { /* XXX cannot return 0 */
|
||||
p = p->next;
|
||||
if (IS_FUNC_PTR_TYPE(p)) {
|
||||
p = show_func_ptr_type(p, p->next); /* function-pointer member */
|
||||
} else if (p->tokno == '{') {
|
||||
p = show_struct_type(p); /* recurse */
|
||||
} else {
|
||||
tok_show(p); /* other */
|
||||
if (p->tokno == '}') {
|
||||
return (p); /* done */
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINTF("/* missing '}' */");
|
||||
return (p);
|
||||
}
|
||||
|
||||
/* is_func_ptr_cast - recognize function-pointer type cast */
|
||||
|
||||
static int is_func_ptr_cast(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register struct token *p;
|
||||
|
||||
/*
|
||||
* Examine superficial structure. Require (list1) (list2). Require that
|
||||
* list1 begins with a star.
|
||||
*/
|
||||
|
||||
if (!IS_FUNC_PTR_TYPE(t))
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* Make sure that there is no name in (list1). Do not worry about
|
||||
* unexpected tokens, because the compiler will complain anyway.
|
||||
*/
|
||||
|
||||
for (p = t->head->head; p; p = p->next) {
|
||||
switch (p->tokno) {
|
||||
case TOK_LIST: /* recurse */
|
||||
return (is_func_ptr_cast(p));
|
||||
case TOK_WORD: /* name in list */
|
||||
return (0);
|
||||
case '[':
|
||||
return (1); /* dimension may be a macro */
|
||||
}
|
||||
}
|
||||
return (1); /* no name found */
|
||||
}
|
||||
|
||||
/* check_cast - display ()-delimited, comma-separated list */
|
||||
|
||||
static void check_cast(t)
|
||||
struct token *t;
|
||||
{
|
||||
register struct token *s;
|
||||
register struct token *p;
|
||||
|
||||
/*
|
||||
* Rewrite function-pointer types and function-pointer casts. Do not
|
||||
* blindly rewrite (*list1)(list2) to (*list1)(). Function argument lists
|
||||
* are about the only thing we can discard without provoking diagnostics
|
||||
* from the compiler.
|
||||
*/
|
||||
|
||||
for (s = t->head; s; s = s->next) {
|
||||
tok_show_ch(s); /* '(' or ',' or ')' */
|
||||
for (p = s->head; p; p = p->next) {
|
||||
switch (p->tokno) {
|
||||
case TOK_LIST:
|
||||
if (is_func_ptr_cast(p)) { /* not: IS_FUNC_PTR_TYPE(p) */
|
||||
p = show_func_ptr_type(p, p->next);
|
||||
} else {
|
||||
check_cast(p); /* recurse */
|
||||
}
|
||||
break;
|
||||
case '{':
|
||||
p = show_struct_type(p); /* rewrite func. ptr. types */
|
||||
break;
|
||||
default:
|
||||
tok_show(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* block_dcls - on the fly rewrite decls/initializers at start of block */
|
||||
|
||||
static void block_dcls()
|
||||
{
|
||||
register struct token *t;
|
||||
|
||||
/*
|
||||
* Away from the top level, a declaration should be preceded by type or
|
||||
* storage-class information. That is why inside blocks, structs and
|
||||
* unions we insist on reading one word before passing the _next_ token
|
||||
* to the dcl_flush() function.
|
||||
*
|
||||
* Struct and union declarations look the same everywhere: we make an
|
||||
* exception for these more regular constructs and pass the "struct" and
|
||||
* "union" tokens to the type_dcl() function.
|
||||
*/
|
||||
|
||||
while (t = tok_class()) {
|
||||
switch (t->tokno) {
|
||||
case TOK_WSPACE: /* preserve white space */
|
||||
case '\n': /* preserve line count */
|
||||
tok_flush(t);
|
||||
break;
|
||||
case TOK_WORD: /* type declarations? */
|
||||
tok_flush(t); /* advance to next token */
|
||||
t = tok_class(); /* null return is ok */
|
||||
/* FALLTRHOUGH */
|
||||
case TOK_COMPOSITE: /* struct or union */
|
||||
if ((t = dcl_flush(t)) == 0)
|
||||
break;
|
||||
/* FALLTRHOUGH */
|
||||
default: /* end of declarations */
|
||||
DPRINTF("/* end dcls */");
|
||||
/* FALLTRHOUGH */
|
||||
case '}': /* end of block */
|
||||
tok_unget(t);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* block_flush - rewrite struct, union or statement block on the fly */
|
||||
|
||||
static void block_flush(t)
|
||||
register struct token *t;
|
||||
{
|
||||
static int count = 0;
|
||||
|
||||
tok_flush(t);
|
||||
DPRINTF("/*%d*/", ++count);
|
||||
|
||||
/*
|
||||
* Rewrite function pointer types in declarations and function pointer
|
||||
* casts in initializers at start of block.
|
||||
*/
|
||||
|
||||
block_dcls();
|
||||
|
||||
/* Remainder of block: only rewrite function pointer casts. */
|
||||
|
||||
while (t = tok_class()) {
|
||||
if (t->tokno == TOK_LIST) {
|
||||
check_cast_flush(t);
|
||||
} else if (t->tokno == '{') {
|
||||
block_flush(t);
|
||||
} else {
|
||||
tok_flush(t);
|
||||
if (t->tokno == '}') {
|
||||
DPRINTF("/*%d*/", count--);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINTF("/* missing '}' */");
|
||||
}
|
||||
|
||||
/* pair_flush - on the fly rewrite casts in grouped stuff */
|
||||
|
||||
static void pair_flush(t, start, stop)
|
||||
register struct token *t;
|
||||
register int start;
|
||||
register int stop;
|
||||
{
|
||||
tok_flush(t);
|
||||
|
||||
while (t = tok_class()) {
|
||||
if (t->tokno == start) { /* recurse */
|
||||
pair_flush(t, start, stop);
|
||||
} else if (t->tokno == TOK_LIST) { /* expression or cast */
|
||||
check_cast_flush(t);
|
||||
} else { /* other, copy */
|
||||
tok_flush(t);
|
||||
if (t->tokno == stop) { /* done */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINTF("/* missing '%c' */", stop);
|
||||
}
|
||||
|
||||
/* initializer - on the fly rewrite casts in initializer */
|
||||
|
||||
static void initializer()
|
||||
{
|
||||
register struct token *t;
|
||||
|
||||
while (t = tok_class()) {
|
||||
switch (t->tokno) {
|
||||
case ',': /* list separator */
|
||||
case ';': /* list terminator */
|
||||
tok_unget(t);
|
||||
return;
|
||||
case TOK_LIST: /* expression or cast */
|
||||
check_cast_flush(t);
|
||||
break;
|
||||
case '[': /* array subscript, may nest */
|
||||
pair_flush(t, '[', ']');
|
||||
break;
|
||||
case '{': /* structured data, may nest */
|
||||
pair_flush(t, '{', '}');
|
||||
break;
|
||||
default: /* other, just copy */
|
||||
tok_flush(t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* func_ptr_dcl_flush - rewrite function pointer stuff */
|
||||
|
||||
static struct token *func_ptr_dcl_flush(list)
|
||||
register struct token *list;
|
||||
{
|
||||
register struct token *t;
|
||||
register struct token *t2;
|
||||
|
||||
/*
|
||||
* Ignore blanks and newlines because we are too lazy to maintain more
|
||||
* than one token worth of lookahead. The output routines will regenerate
|
||||
* discarded newline tokens.
|
||||
*/
|
||||
|
||||
while (t = tok_class()) {
|
||||
switch (t->tokno) {
|
||||
case TOK_WSPACE:
|
||||
case '\n':
|
||||
tok_free(t);
|
||||
break;
|
||||
case TOK_LIST:
|
||||
/* Function pointer or function returning pointer to function. */
|
||||
while ((t2 = tok_class()) /* skip blanks etc. */
|
||||
&&(t2->tokno == TOK_WSPACE || t2->tokno == '\n'))
|
||||
tok_free(t2);
|
||||
switch (t2 ? t2->tokno : 0) {
|
||||
case '{': /* function heading (new) */
|
||||
fpf_header(list, t);
|
||||
break;
|
||||
case TOK_WORD: /* function heading (old) */
|
||||
tok_show(list);
|
||||
tok_show(t);
|
||||
break;
|
||||
default: /* func pointer type */
|
||||
(void) show_func_ptr_type(list, t);
|
||||
break;
|
||||
}
|
||||
tok_free(list);
|
||||
tok_free(t);
|
||||
if (t2)
|
||||
tok_unget(t2);
|
||||
return (0);
|
||||
default: /* not a declaration */
|
||||
tok_unget(t);
|
||||
return (list);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hit EOF; must be mistake, but do not waste any information. */
|
||||
|
||||
return (list);
|
||||
}
|
||||
|
||||
/* function_dcl_flush - rewrite function { heading, type declaration } */
|
||||
|
||||
static struct token *function_dcl_flush(list)
|
||||
register struct token *list;
|
||||
{
|
||||
register struct token *t;
|
||||
|
||||
/*
|
||||
* Ignore blanks and newlines because we are too lazy to maintain more
|
||||
* than one token worth of lookahead. The output routines will regenerate
|
||||
* ignored newline tokens.
|
||||
*/
|
||||
|
||||
while (t = tok_class()) {
|
||||
switch (t->tokno) {
|
||||
case TOK_WSPACE:
|
||||
case '\n':
|
||||
tok_free(t);
|
||||
break;
|
||||
case '{':
|
||||
/* Function heading: word (list) { -> old style heading */
|
||||
header_flush(list);
|
||||
tok_unget(t);
|
||||
return (0);
|
||||
case TOK_WORD:
|
||||
/* Old-style function heading: word (list) word... */
|
||||
tok_flush(list);
|
||||
tok_unget(t);
|
||||
return (0);
|
||||
case TOK_LIST:
|
||||
/* Function pointer: word (list1) (list2) -> word (list1) () */
|
||||
tok_flush(list);
|
||||
show_empty_list(t);
|
||||
tok_free(t);
|
||||
return (0);
|
||||
case ',':
|
||||
case ';':
|
||||
/* Function type declaration: word (list) -> word () */
|
||||
show_empty_list(list);
|
||||
tok_free(list);
|
||||
tok_unget(t);
|
||||
return (0);
|
||||
default:
|
||||
/* Something else, reject the list. */
|
||||
tok_unget(t);
|
||||
return (list);
|
||||
}
|
||||
}
|
||||
|
||||
/* Hit EOF; must be mistake, but do not waste any information. */
|
||||
|
||||
return (list);
|
||||
}
|
||||
|
||||
/* dcl_flush - parse declaration on the fly, return rejected token */
|
||||
|
||||
static struct token *dcl_flush(t)
|
||||
register struct token *t;
|
||||
{
|
||||
register int got_word;
|
||||
|
||||
/*
|
||||
* Away from the top level, type or storage-class information is required
|
||||
* for an (extern or forward) function type declaration or a variable
|
||||
* declaration.
|
||||
*
|
||||
* With our naive word-counting approach, this means that the caller should
|
||||
* read one word before passing the next token to us. This is how we
|
||||
* distinguish, for example, function declarations from function calls.
|
||||
*
|
||||
* An exception are structs and unions, because they look the same at any
|
||||
* level. The caller should give is the "struct" or "union" token.
|
||||
*/
|
||||
|
||||
for (got_word = 0; t; t = tok_class()) {
|
||||
switch (t->tokno) {
|
||||
case TOK_WSPACE: /* advance past blanks */
|
||||
case '\n': /* advance past newline */
|
||||
case '*': /* indirection: keep trying */
|
||||
tok_flush(t);
|
||||
break;
|
||||
case TOK_WORD: /* word: keep trying */
|
||||
case TOK_COMPOSITE: /* struct or union */
|
||||
got_word = 1;
|
||||
tok_flush(t);
|
||||
break;
|
||||
default:
|
||||
|
||||
/*
|
||||
* Function pointer types can be preceded by zero or more words
|
||||
* (at least one when not at the top level). Other stuff can be
|
||||
* accepted only after we have seen at least one word (two words
|
||||
* when not at the top level). See also the above comment on
|
||||
* structs and unions.
|
||||
*/
|
||||
|
||||
if (t->tokno == TOK_LIST && LIST_BEGINS_WITH_STAR(t)) {
|
||||
if (t = func_ptr_dcl_flush(t)) {
|
||||
return (t); /* reject token */
|
||||
} else {
|
||||
got_word = 1; /* for = and [ and , and ; */
|
||||
}
|
||||
} else if (got_word == 0) {
|
||||
return (t); /* reject token */
|
||||
} else {
|
||||
switch (t->tokno) {
|
||||
case TOK_LIST: /* function type */
|
||||
if (t = function_dcl_flush(t))
|
||||
return (t); /* reject token */
|
||||
break;
|
||||
case '[': /* dimension, does not nest */
|
||||
pair_flush(t, '[', ']');
|
||||
break;
|
||||
case '=': /* initializer follows */
|
||||
tok_flush(t);
|
||||
initializer(); /* rewrite casts */
|
||||
break;
|
||||
case '{': /* struct, union, may nest */
|
||||
block_flush(t); /* use code for stmt blocks */
|
||||
break;
|
||||
case ',': /* separator: keep trying */
|
||||
got_word = 0;
|
||||
tok_flush(t);
|
||||
break;
|
||||
case ';': /* terminator: succeed */
|
||||
tok_flush(t);
|
||||
return (0);
|
||||
default: /* reject token */
|
||||
return (t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (0); /* hit EOF */
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* @(#) varargs.c 1.1 91/09/01 23:08:45
|
||||
*
|
||||
* This program can be used to verify that the stdarg.h file is set up
|
||||
* correctly for your system. If it works, it should print one line with the
|
||||
* text "stdarg.h works".
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stdarg.h"
|
||||
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
varargs_test("%s %s\n", "stdarg.h", "works");
|
||||
}
|
||||
|
||||
varargs_test(char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
while (*fmt) {
|
||||
if (strncmp("%s", fmt, 2) == 0) {
|
||||
fputs(va_arg(ap, char *), stdout);
|
||||
fmt += 2;
|
||||
} else {
|
||||
putchar(*fmt);
|
||||
fmt++;
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
/*++
|
||||
/* NAME
|
||||
/* vs_alloc(), VS_ADDCH()
|
||||
/* SUMMARY
|
||||
/* auto-resizing string library
|
||||
/* PACKAGE
|
||||
/* vstring
|
||||
/* SYNOPSIS
|
||||
/* #include "vstring.h"
|
||||
/*
|
||||
/* struct vstring *vs_alloc(len)
|
||||
/* int len;
|
||||
/*
|
||||
/* int VS_ADDCH(vs, wp, ch)
|
||||
/* struct vstring *vs;
|
||||
/* char *wp;
|
||||
/* int ch;
|
||||
/*
|
||||
/* char *vs_strcpy(vp, dst, src)
|
||||
/* struct vstring *vp;
|
||||
/* char *dst;
|
||||
/* char *src;
|
||||
/* DESCRIPTION
|
||||
/* These functions and macros implement a small library for
|
||||
/* arbitrary-length strings that grow automatically when
|
||||
/* they fill up. The allocation strategy is such that there
|
||||
/* will always be place for the terminating null character.
|
||||
/*
|
||||
/* vs_alloc() allocates storage for a variable-length string
|
||||
/* of at least "len" bytes.
|
||||
/*
|
||||
/* VS_ADDCH() adds a character to a variable-length string
|
||||
/* and automagically extends the string if fills up.
|
||||
/* \fIvs\fP is a pointer to a vstring structure; \fIwp\fP
|
||||
/* the current write position in the corresponding character
|
||||
/* array; \fIch\fP the character value to be written.
|
||||
/* Note that VS_ADDCH() is a macro that evaluates some
|
||||
/* arguments more than once.
|
||||
/*
|
||||
/* vs_strcpy() appends a null-terminated string to a variable-length
|
||||
/* string. \fIsrc\fP provides the data to be copied; \fIvp\fP is the
|
||||
/* target, and \fIdst\fP the current write position within the target.
|
||||
/* The result is null-terminated. The return value is the new write
|
||||
/* position.
|
||||
/* DIAGNOSTICS
|
||||
/* VS_ADDCH() returns zero if it was unable to dynamically
|
||||
/* resize a string.
|
||||
/*
|
||||
/* vs_alloc() returns a null pointer in case of problems.
|
||||
/*
|
||||
/* vs_strcpy() returns a null pointer if the request failed.
|
||||
/* BUGS
|
||||
/* Auto-resizing may change the address of the string data in
|
||||
/* a vstring structure. Beware of dangling pointers.
|
||||
/* AUTHOR(S)
|
||||
/* Wietse Venema
|
||||
/* Eindhoven University of Technology
|
||||
/* Department of Mathematics and Computer Science
|
||||
/* Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
|
||||
/* LAST MODIFICATION
|
||||
/* 92/01/15 21:53:06
|
||||
/* VERSION/RELEASE
|
||||
/* 1.3
|
||||
/*--*/
|
||||
|
||||
static char vstring_sccsid[] = "@(#) vstring.c 1.3 92/01/15 21:53:06";
|
||||
|
||||
/* C library */
|
||||
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
|
||||
/* Application-specific stuff */
|
||||
|
||||
#include "vstring.h"
|
||||
|
||||
/* vs_alloc - initial string allocation */
|
||||
|
||||
struct vstring *vs_alloc(len)
|
||||
int len;
|
||||
{
|
||||
register struct vstring *vp;
|
||||
|
||||
if (len < 1
|
||||
|| (vp = (struct vstring *) malloc(sizeof(struct vstring))) == 0
|
||||
|| (vp->str = malloc(len)) == 0)
|
||||
return (0);
|
||||
vp->last = vp->str + len - 1;
|
||||
return (vp);
|
||||
}
|
||||
|
||||
/* vs_realloc - extend string, update write pointer */
|
||||
|
||||
char *vs_realloc(vp, cp)
|
||||
register struct vstring *vp;
|
||||
char *cp;
|
||||
{
|
||||
int where = cp - vp->str;
|
||||
int len = vp->last - vp->str + 1;
|
||||
|
||||
if ((vp->str = realloc(vp->str, len *= 2)) == 0)
|
||||
return (0);
|
||||
vp->last = vp->str + len - 1;
|
||||
return (vp->str + where);
|
||||
}
|
||||
|
||||
/* vs_strcpy - copy string */
|
||||
|
||||
char *vs_strcpy(vp, dst, src)
|
||||
register struct vstring *vp;
|
||||
register char *dst;
|
||||
register char *src;
|
||||
{
|
||||
while (*src) {
|
||||
if (VS_ADDCH(vp, dst, *src) == 0)
|
||||
return (0);
|
||||
src++;
|
||||
}
|
||||
*dst = '\0';
|
||||
return (dst);
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
/* @(#) vstring.h 1.2 92/01/15 21:53:19 */
|
||||
|
||||
struct vstring {
|
||||
char *str; /* string value */
|
||||
char *last; /* last position */
|
||||
};
|
||||
|
||||
extern struct vstring *vs_alloc(); /* initial allocation */
|
||||
extern char *vs_realloc(); /* string extension */
|
||||
extern char *vs_strcpy(); /* copy string */
|
||||
|
||||
/* macro to add one character to auto-resized string */
|
||||
|
||||
#define VS_ADDCH(vs,wp,c) \
|
||||
((wp < (vs)->last || (wp = vs_realloc(vs,wp))) ? (*wp++ = c) : 0)
|
@ -1 +1 @@
|
||||
3.3
|
||||
1.1-devel
|
||||
|
@ -1,84 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# LDAP clients Makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
############################################################################
|
||||
# #
|
||||
# You should not have to edit anything below this point #
|
||||
# #
|
||||
############################################################################
|
||||
|
||||
all: FORCE
|
||||
@echo "making all in `$(PWD)`"
|
||||
@for i in *; do \
|
||||
if [ -d $$i -a $$i != "CVS" ]; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) all ); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# rules to install the software
|
||||
#
|
||||
|
||||
install: FORCE
|
||||
@echo "making install in `$(PWD)`"
|
||||
@for i in *; do \
|
||||
if [ -d $$i -a $$i != "CVS" ]; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) install"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) install ); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
#
|
||||
# rules to make clean
|
||||
#
|
||||
|
||||
clean: FORCE
|
||||
@echo "making clean in `$(PWD)`"
|
||||
@for i in *; do \
|
||||
if [ -d $$i -a $$i != "CVS" ]; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) clean ); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
veryclean: clean
|
||||
|
||||
#
|
||||
# rules to make depend
|
||||
#
|
||||
#
|
||||
|
||||
depend: FORCE
|
||||
@echo "making depend in `$(PWD)`"
|
||||
@for i in *; do \
|
||||
if [ -d $$i -a $$i != "CVS" ]; then \
|
||||
echo; echo " cd $$i; $(MAKE) $(MFLAGS) depend"; \
|
||||
( cd $$i; $(MAKE) $(MFLAGS) depend ); \
|
||||
fi; \
|
||||
done
|
||||
|
||||
links:
|
||||
@echo "making links in `$(PWD)`"; \
|
||||
for i in .src/*; do \
|
||||
if [ -d $$i -a $$i != ".src/CVS" ]; then \
|
||||
d=`basename $$i`; \
|
||||
( $(MKDIR) $$d; cd $$d; $(LN) ../.src/$$d .src; \
|
||||
$(LN) ../.src/$$d/Make-template . ; \
|
||||
$(MAKE) $(MFLAGS) MKDIR="$(MKDIR)" LN="$(LN)" \
|
||||
-f Make-template links ) ; \
|
||||
fi; \
|
||||
done
|
6
clients/Makefile.in
Normal file
6
clients/Makefile.in
Normal file
@ -0,0 +1,6 @@
|
||||
## Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## COPYING RESTRICTIONS APPLY, See COPYRIGHT file
|
||||
##
|
||||
## Clients Makefile.in for OpenLDAP
|
||||
|
||||
SUBDIRS= tools ud finger gopher mail500 fax500 rcpt500
|
@ -1,77 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# X.500 ldap fax mailer makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
LDAPSRC = ../..
|
||||
HDIR = $(LDAPSRC)/include
|
||||
LDIR = $(LDAPSRC)/libraries
|
||||
VERSIONFILE = $(LDAPSRC)/build/version
|
||||
|
||||
SRCS = rp500.c main.c faxtotpc.c
|
||||
OBJS = rp500.o main.o faxtotpc.o
|
||||
|
||||
INCLUDES= -I$(HDIR)
|
||||
DEFINES = $(DEFS)
|
||||
|
||||
CFLAGS = $(INCLUDES) $(DEFINES) $(ACFLAGS)
|
||||
LIBS = -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)
|
||||
|
||||
all: rp500 fax500
|
||||
|
||||
rp500: rpversion.o
|
||||
$(CC) $(ALDFLAGS) -o $@ faxtotpc.o rp500.o rpversion.o \
|
||||
-L$(LDIR) $(LIBS)
|
||||
|
||||
fax500: fax5version.o
|
||||
$(CC) $(ALDFLAGS) -o $@ main.o fax5version.o faxtotpc.o \
|
||||
-L$(LDIR) $(LIBS)
|
||||
|
||||
rpversion.c: faxtotpc.o rp500.o $(LDIR)/libldap.a
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Versionrp.c > $@)
|
||||
|
||||
fax5version.c: main.o faxtotpc.o $(LDIR)/libldap.a
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Version.c > $@ )
|
||||
|
||||
install: rp500 xrpcomp fax500 FORCE
|
||||
-$(MKDIR) -p $(LDAP_ETCDIR) $(LDAP_BINDIR) $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 rp500 $(LDAP_LIBEXECDIR)
|
||||
$(SED) -e 's%ETCDIR%$(LDAP_LIBEXECDIR)%' xrpcomp > /tmp/xrpcomp.tmp
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 /tmp/xrpcomp.tmp $(LDAP_BINDIR)/xrpcomp
|
||||
$(RM) /tmp/xrpcomp.tmp
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 fax500 $(LDAP_LIBEXECDIR)
|
||||
|
||||
lint: FORCE
|
||||
$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
5lint: FORCE
|
||||
$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.o core a.out rpversion.c fax5version.c rp500 fax500
|
||||
|
||||
depend: FORCE
|
||||
$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
links:
|
||||
@$(LN) .src/README .src/xrpcomp .src/*.[ch] .
|
||||
|
40
clients/fax500/Makefile.in
Normal file
40
clients/fax500/Makefile.in
Normal file
@ -0,0 +1,40 @@
|
||||
PROGRAMS= rp500 fax500
|
||||
|
||||
SRCS= main.c faxtotpc.c rp500.c
|
||||
XSRCS=fax5version.c rpversion.c
|
||||
|
||||
FAX5OBJS = main.o faxtotpc.o
|
||||
RPOBJS = rp500.o faxtotpc.o
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
rp500 : rpversion.o
|
||||
$(CC) $(LDFLAGS) -o $@ $(RPOBJS) rpversion.o $(LIBS)
|
||||
|
||||
fax500 : fax5version.o
|
||||
$(CC) $(LDFLAGS) -o $@ $(RPOBJS) fax5version.o $(LIBS)
|
||||
|
||||
rpversion.c: ${RPOBJS} $(LDAP_LIBDEPEND)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Versionrp.c > $@)
|
||||
|
||||
fax5version.c: ${FAX5OBJS} $(LDAP_LIBDEPEND)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Version.c > $@)
|
||||
|
||||
install: $(PROGRAMS) xrpcomp FORCE
|
||||
-$(MKDIR) -p $(libexecdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 rp500 $(libexecdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 fax500 $(libexecdir)
|
||||
$(SED) -e 's%LIBEXECDIR%$(libexecdir)%' $(srcdir)/xrpcomp > /tmp/xrpcomp.tmp
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 /tmp/xrpcomp.tmp $(libexecdir)/xrpcomp
|
||||
$(RM) /tmp/xrpcomp.tmp
|
@ -19,15 +19,13 @@
|
||||
* faxtotpc() returns a pointer to a string allocated with malloc(3).
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef ultrix
|
||||
extern char *strdup();
|
||||
#endif
|
||||
|
||||
#include <ac/string.h>
|
||||
|
||||
#define TPCDOMAIN "tpc.int"
|
||||
|
||||
|
@ -10,24 +10,27 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <memory.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sysexits.h>
|
||||
#include <ldapconfig.h>
|
||||
#include "portable.h"
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include <ldapconfig.h>
|
||||
|
||||
#define USER 0
|
||||
#define GROUP_ERRORS 1
|
||||
@ -921,14 +924,14 @@ send_message( to )
|
||||
char **to;
|
||||
{
|
||||
int pid;
|
||||
#ifndef USE_WAITPID
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
#ifdef USE_WAITPID
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
wait4( pid, &status, WAIT_FLAGS, 0 );
|
||||
@ -953,7 +956,7 @@ send_group( group, ngroup )
|
||||
char **argv;
|
||||
int argc;
|
||||
char *iargv[7];
|
||||
#ifndef USE_WAITPID
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
@ -976,7 +979,7 @@ send_group( group, ngroup )
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
#ifdef USE_WAITPID
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
wait4( pid, &status, WAIT_FLAGS, 0 );
|
||||
|
@ -10,19 +10,19 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <lber.h>
|
||||
#include <ldap.h>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
|
||||
RP500=ETCDIR/rp500
|
||||
RP500=%LIBEXECDIR%/rp500
|
||||
|
||||
NAME="$1"
|
||||
if [ -z "$NAME" ]; then
|
||||
|
@ -1,62 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# X.500 ldap finger daemon makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
LDAPSRC = ../..
|
||||
HDIR = $(LDAPSRC)/include
|
||||
LDIR = $(LDAPSRC)/libraries
|
||||
VERSIONFILE = $(LDAPSRC)/build/version
|
||||
|
||||
SRCS = main.c
|
||||
OBJS = main.o
|
||||
|
||||
INCLUDES=-I$(HDIR)
|
||||
DEFINES = $(DEFS)
|
||||
|
||||
CFLAGS = $(INCLUDES) $(DEFINES) $(ACFLAGS)
|
||||
LIBS = -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)
|
||||
|
||||
all: in.xfingerd
|
||||
|
||||
in.xfingerd: version.o
|
||||
$(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o \
|
||||
-L$(LDIR) $(LIBS)
|
||||
|
||||
version.c: $(OBJS) $(LDIR)/libldap.a
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Version.c > $@)
|
||||
|
||||
install: in.xfingerd FORCE
|
||||
-$(MKDIR) -p $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 in.xfingerd $(LDAP_LIBEXECDIR)
|
||||
|
||||
lint: FORCE
|
||||
$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
5lint: FORCE
|
||||
$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.o core a.out version.c in.xfingerd
|
||||
|
||||
depend: FORCE
|
||||
$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
links:
|
||||
@$(LN) .src/README .src/*.[ch] .
|
||||
|
22
clients/finger/Makefile.in
Normal file
22
clients/finger/Makefile.in
Normal file
@ -0,0 +1,22 @@
|
||||
SRCS= main.c
|
||||
XSRCS= version.c
|
||||
OBJS= main.o
|
||||
PROGRAMS= in.xfingerd
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
in.xfingerd : version.o
|
||||
$(CC) $(LDFLAGS) -o $@ version.o $(OBJS) $(LIBS)
|
||||
|
||||
version.c: ${OBJS} ${LDAP_LIBDEPEND}
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Version.c > $@)
|
||||
|
||||
install: $(PROGRAMS) FORCE
|
||||
-$(MKDIR) -p $(libexecdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 in.xfingerd $(libexecdir)
|
@ -10,33 +10,27 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#ifdef aix
|
||||
#include <sys/select.h>
|
||||
#endif /* aix */
|
||||
#include <signal.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "disptmpl.h"
|
||||
|
||||
#include "portable.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#include <unistd.h>
|
||||
#endif /* USE_SYSCONF */
|
||||
|
||||
int dosyslog = 1;
|
||||
char *ldaphost = LDAPHOST;
|
||||
@ -176,11 +170,13 @@ static do_query()
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#ifdef HAVE_SYSCONF
|
||||
tblsize = sysconf( _SC_OPEN_MAX );
|
||||
#else /* USE_SYSCONF */
|
||||
#elif HAVE_GETDTABLESIZE
|
||||
tblsize = getdtablesize();
|
||||
#endif /* USE_SYSCONF */
|
||||
#else
|
||||
tblsize = FD_SETSIZE;
|
||||
#endif
|
||||
|
||||
#ifdef FD_SETSIZE
|
||||
if (tblsize > FD_SETSIZE) {
|
||||
|
@ -1,79 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# gopher to x.500 gateway makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
LDAPSRC = ../..
|
||||
HDIR = $(LDAPSRC)/include
|
||||
LDIR = $(LDAPSRC)/libraries
|
||||
VERSIONFILE = $(LDAPSRC)/build/version
|
||||
|
||||
SRCS = go500.c go500gw.c detach.c setproctitle.c
|
||||
OBJS = go500.o go500gw.o detach.o setproctitle.o
|
||||
GOOBJS = go500.o detach.o goversion.o setproctitle.o
|
||||
GWOBJS = go500gw.o detach.o gwversion.o setproctitle.o
|
||||
|
||||
INCLUDES= -I$(HDIR)
|
||||
DEFINES = $(DEFS)
|
||||
|
||||
CFLAGS = $(INCLUDES) $(DEFS) $(ACFLAGS)
|
||||
LIBS = -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)
|
||||
|
||||
DLIBS = $(LDIR)/libldap.a $(LDIR)/liblber.a
|
||||
|
||||
all: go500gw go500
|
||||
|
||||
go500gw: gwversion.o
|
||||
$(CC) $(ALDFLAGS) -o $@ $(GWOBJS) -L$(LDIR) $(LIBS)
|
||||
|
||||
go500: goversion.o
|
||||
$(CC) $(ALDFLAGS) -o $@ $(GOOBJS) -L$(LDIR) $(LIBS)
|
||||
|
||||
goversion.c: go500.o detach.o setproctitle.o $(DLIBS)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Version.c > $@)
|
||||
|
||||
gwversion.c: go500gw.o detach.o setproctitle.o $(DLIBS)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Versiongw.c > $@)
|
||||
|
||||
install: go500 go500gw go500gw.help FORCE
|
||||
-$(MKDIR) -p $(LDAP_ETCDIR) $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 go500 $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 go500gw $(LDAP_LIBEXECDIR)
|
||||
-$(MV) $(LDAP_ETCDIR)/go500gw.help $(LDAP_ETCDIR)/go500gw.help-
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 644 go500gw.help $(LDAP_ETCDIR)
|
||||
|
||||
lint: FORCE
|
||||
$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
5lint: FORCE
|
||||
$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.o core a.out gwversion.c goversion.c go500gw go500
|
||||
|
||||
depend: FORCE
|
||||
$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
links:
|
||||
@$(LN) .src/README .src/*.help .src/*.[ch] .
|
||||
|
42
clients/gopher/Makefile.in
Normal file
42
clients/gopher/Makefile.in
Normal file
@ -0,0 +1,42 @@
|
||||
##
|
||||
## Makefile for gopher clients
|
||||
##
|
||||
PROGRAMS= go500gw go500
|
||||
|
||||
SRCS= detach.c go500.c go500gw.c setproctitle.c
|
||||
XSRCS= gwversion.o goversion.o
|
||||
GOOBJS = go500.o detach.o setproctitle.o
|
||||
GWOBJS = go500gw.o detach.o setproctitle.o
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
|
||||
go500 : goversion.o
|
||||
$(CC) $(LDFLAGS) -o $@ $(GOOBJS) goversion.o $(LIBS)
|
||||
|
||||
go500gw : gwversion.o
|
||||
$(CC) $(LDFLAGS) -o $@ $(GWOBJS) gwversion.o $(LIBS)
|
||||
|
||||
goversion.c: ${GOOBJS} $(LDAP_LIBDEPEND)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Version.c > $@)
|
||||
|
||||
gwversion.c: ${GWOBJS} $(LDAP_LIBDEPEND)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Versiongw.c > $@)
|
||||
|
||||
install: $(PROGRAMS) go500gw.help FORCE
|
||||
-$(MKDIR) -p $(libexecdir) $(sysconfdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 go500 $(libexecdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 go500gw $(libexecdir)
|
||||
-$(MV) $(sysconfdir)/go500gw.help $(sysconfdir)/go500gw.help-
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 644 go500gw.help $(sysconfdir)
|
@ -10,28 +10,29 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sys/file.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include "portable.h"
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#include <unistd.h>
|
||||
#endif /* USE_SYSCONF */
|
||||
#include <ac/unistd.h>
|
||||
|
||||
detach( debug )
|
||||
int debug;
|
||||
{
|
||||
int i, sd, nbits;
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#if defined( HAVE_SYSCONF )
|
||||
nbits = sysconf( _SC_OPEN_MAX );
|
||||
#else /* USE_SYSCONF */
|
||||
#elif defined( HAVE_GETDTABLESIZE )
|
||||
nbits = getdtablesize();
|
||||
#endif /* USE_SYSCONF */
|
||||
#else
|
||||
nbits = FD_SETSIZE;
|
||||
#endif
|
||||
|
||||
#ifdef FD_SETSIZE
|
||||
if (nbits > FD_SETSIZE) {
|
||||
@ -39,7 +40,6 @@ int debug;
|
||||
}
|
||||
#endif /* FD_SETSIZE*/
|
||||
|
||||
|
||||
if ( debug == 0 || !(isatty( 1 )) ) {
|
||||
for ( i = 0; i < 5; i++ ) {
|
||||
switch ( fork() ) {
|
||||
@ -73,14 +73,14 @@ int debug;
|
||||
(void) dup2( sd, 2 );
|
||||
close( sd );
|
||||
|
||||
#ifdef USE_SETSID
|
||||
#ifdef HAVE_SETSID
|
||||
(void) setsid();
|
||||
#else /* USE_SETSID */
|
||||
#else /* HAVE_SETSID */
|
||||
if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
|
||||
(void) ioctl( sd, TIOCNOTTY, NULL );
|
||||
(void) close( sd );
|
||||
}
|
||||
#endif /* USE_SETSID */
|
||||
#endif /* HAVE_SETSID */
|
||||
}
|
||||
|
||||
(void) signal( SIGPIPE, SIG_IGN );
|
||||
|
@ -10,33 +10,30 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#ifdef aix
|
||||
#include <sys/select.h>
|
||||
#endif /* aix */
|
||||
#include <signal.h>
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/signal.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "ldapconfig.h"
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "disptmpl.h"
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#include <unistd.h>
|
||||
#endif /* USE_SYSCONF */
|
||||
|
||||
int debug;
|
||||
int dosyslog;
|
||||
int inetd;
|
||||
@ -52,7 +49,7 @@ char myhost[MAXHOSTNAMELEN];
|
||||
int myport;
|
||||
|
||||
static set_socket();
|
||||
static SIG_FN wait4child();
|
||||
static RETSIGTYPE wait4child();
|
||||
static do_queries();
|
||||
static do_error();
|
||||
static do_search();
|
||||
@ -78,7 +75,7 @@ char **argv;
|
||||
struct hostent *hp;
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
SIG_FN wait4child();
|
||||
RETSIGTYPE wait4child();
|
||||
extern char *optarg;
|
||||
extern char **Argv;
|
||||
extern int Argc;
|
||||
@ -140,11 +137,13 @@ char **argv;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#ifdef HAVE_SYSCONF
|
||||
dtblsize = sysconf( _SC_OPEN_MAX );
|
||||
#else /* USE_SYSCONF */
|
||||
#elif HAVE_GETDTABLESIZE
|
||||
dtblsize = getdtablesize();
|
||||
#endif /* USE_SYSCONF */
|
||||
#else
|
||||
dtblsize = FD_SETSIZE;
|
||||
#endif
|
||||
|
||||
#ifdef FD_SETSIZE
|
||||
if (dtblsize > FD_SETSIZE) {
|
||||
@ -177,7 +176,7 @@ char **argv;
|
||||
s = set_socket( port );
|
||||
|
||||
/* arrange to reap children */
|
||||
(void) signal( SIGCHLD, (void *) wait4child );
|
||||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
} else {
|
||||
myport = GO500_PORT;
|
||||
|
||||
@ -299,20 +298,24 @@ int port;
|
||||
return( s );
|
||||
}
|
||||
|
||||
static SIG_FN
|
||||
static RETSIGTYPE
|
||||
wait4child()
|
||||
{
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
if ( debug ) printf( "parent: catching child status\n" );
|
||||
#ifdef USE_WAITPID
|
||||
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
|
||||
#else /* USE_WAITPID */
|
||||
while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
|
||||
#endif /* USE_WAITPID */
|
||||
; /* NULL */
|
||||
|
||||
(void) signal( SIGCHLD, (void *) wait4child );
|
||||
#ifdef HAVE_WAITPID
|
||||
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
|
||||
; /* NULL */
|
||||
#else
|
||||
while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
|
||||
; /* NULL */
|
||||
#endif
|
||||
|
||||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -10,33 +10,29 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#ifdef aix
|
||||
#include <sys/select.h>
|
||||
#endif /* aix */
|
||||
#include "portable.h"
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#include <unistd.h>
|
||||
#endif /* USE_SYSCONF */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/signal.h>
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/unistd.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "disptmpl.h"
|
||||
|
||||
#include "portable.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
int debug;
|
||||
@ -54,7 +50,7 @@ char *friendlyfile = FRIENDLYFILE;
|
||||
int rdncount = GO500GW_RDNCOUNT;
|
||||
|
||||
static set_socket();
|
||||
static SIG_FN wait4child();
|
||||
static RETSIGTYPE wait4child();
|
||||
static do_queries();
|
||||
static do_menu();
|
||||
static do_list();
|
||||
@ -87,7 +83,7 @@ char **argv;
|
||||
struct hostent *hp;
|
||||
struct sockaddr_in from;
|
||||
int fromlen;
|
||||
SIG_FN wait4child();
|
||||
RETSIGTYPE wait4child();
|
||||
extern char *optarg;
|
||||
extern char **Argv;
|
||||
extern int Argc;
|
||||
@ -152,11 +148,13 @@ char **argv;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_SYSCONF
|
||||
#ifdef HAVE_SYSCONF
|
||||
dtblsize = sysconf( _SC_OPEN_MAX );
|
||||
#else /* USE_SYSCONF */
|
||||
#elif HAVE_GETDTABLESIZE
|
||||
dtblsize = getdtablesize();
|
||||
#endif /* USE_SYSCONF */
|
||||
#else
|
||||
dtblsize = FD_SETSIZE;
|
||||
#endif
|
||||
|
||||
#ifdef FD_SETSIZE
|
||||
if ( dtblsize > FD_SETSIZE ) {
|
||||
@ -200,7 +198,7 @@ char **argv;
|
||||
s = set_socket( port );
|
||||
|
||||
/* arrange to reap children */
|
||||
(void) signal( SIGCHLD, (void *) wait4child );
|
||||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
}
|
||||
|
||||
if ( inetd ) {
|
||||
@ -324,20 +322,24 @@ int port;
|
||||
return( s );
|
||||
}
|
||||
|
||||
static SIG_FN
|
||||
static RETSIGTYPE
|
||||
wait4child()
|
||||
{
|
||||
WAITSTATUSTYPE status;
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
if ( debug ) printf( "parent: catching child status\n" );
|
||||
#ifdef USE_WAITPID
|
||||
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
|
||||
#else /* USE_WAITPID */
|
||||
while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
|
||||
#endif /* USE_WAITPID */
|
||||
; /* NULL */
|
||||
if ( debug ) printf( "parent: catching child status\n" );
|
||||
|
||||
(void) signal( SIGCHLD, (void *) wait4child );
|
||||
#ifdef HAVE_WAITPID
|
||||
while (waitpid ((pid_t) -1, NULL, WAIT_FLAGS) > 0)
|
||||
; /* NULL */
|
||||
#else
|
||||
while (wait3( &status, WAIT_FLAGS, 0 ) > 0 )
|
||||
; /* NULL */
|
||||
#endif
|
||||
|
||||
(void) SIGNAL( SIGCHLD, wait4child );
|
||||
}
|
||||
|
||||
static do_queries( s )
|
||||
|
@ -10,6 +10,8 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
char **Argv; /* pointer to original (main's) argv */
|
||||
int Argc; /* original argc */
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# X.500 ldap mailer makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
LDAPSRC = ../..
|
||||
HDIR = $(LDAPSRC)/include
|
||||
LDIR = $(LDAPSRC)/libraries
|
||||
VERSIONFILE = $(LDAPSRC)/build/version
|
||||
|
||||
SRCS = main.c
|
||||
OBJS = main.o
|
||||
|
||||
INCLUDES= -I$(HDIR)
|
||||
DEFINES = $(DEFS)
|
||||
|
||||
CFLAGS = $(INCLUDES) $(DEFINES) $(ACFLAGS)
|
||||
LDFLAGS = -L$(LDIR)
|
||||
LIBS = -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)
|
||||
|
||||
all: mail500
|
||||
|
||||
mail500: version.o
|
||||
$(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o $(LDFLAGS) $(LIBS)
|
||||
|
||||
version.c: $(OBJS) $(LDIR)/libldap/libldap.a
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Version.c > $@)
|
||||
|
||||
install: mail500 FORCE
|
||||
-$(MKDIR) -p $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 mail500 $(LDAP_LIBEXECDIR)
|
||||
|
||||
lint: FORCE
|
||||
$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
5lint: FORCE
|
||||
$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.o core a.out version.c mail500
|
||||
|
||||
depend: FORCE
|
||||
$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
links:
|
||||
@$(LN) .src/README .src/sendmail.cf .src/*.[ch] .
|
||||
|
23
clients/mail500/Makefile.in
Normal file
23
clients/mail500/Makefile.in
Normal file
@ -0,0 +1,23 @@
|
||||
PROGRAMS= mail500
|
||||
|
||||
SRCS= main.c
|
||||
XSRCS= version.c
|
||||
OBJS= main.o
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
mail500 : version.o
|
||||
$(CC) $(LDFLAGS) -o $@ version.o $(OBJS) $(LIBS)
|
||||
|
||||
version.c: ${OBJS} $(LDAP_LIBDEPEND)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Version.c > $@)
|
||||
|
||||
install: $(PROGRAMS) FORCE
|
||||
-$(MKDIR) -p $(libexecdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 mail500 $(libexecdir)
|
@ -10,19 +10,24 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <memory.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sysexits.h>
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
#include <ac/wait.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <sysexits.h>
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "ldapconfig.h"
|
||||
@ -1029,7 +1034,7 @@ send_message( to )
|
||||
char **to;
|
||||
{
|
||||
int pid;
|
||||
#ifndef USE_WAITPID
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
@ -1048,7 +1053,7 @@ send_message( to )
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
#ifdef USE_WAITPID
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
wait4( pid, &status, WAIT_FLAGS, 0 );
|
||||
@ -1073,7 +1078,7 @@ send_group( group, ngroup )
|
||||
char **argv;
|
||||
int argc;
|
||||
char *iargv[7];
|
||||
#ifndef USE_WAITPID
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
@ -1108,7 +1113,7 @@ send_group( group, ngroup )
|
||||
|
||||
/* parent */
|
||||
if ( pid = fork() ) {
|
||||
#ifdef USE_WAITPID
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
wait4( pid, &status, WAIT_FLAGS, 0 );
|
||||
@ -1136,7 +1141,7 @@ send_errors( err, nerr )
|
||||
int fd[2];
|
||||
char *argv[8];
|
||||
char buf[1024];
|
||||
#ifndef USE_WAITPID
|
||||
#ifndef HAVE_WAITPID
|
||||
WAITSTATUSTYPE status;
|
||||
#endif
|
||||
|
||||
@ -1255,7 +1260,7 @@ send_errors( err, nerr )
|
||||
}
|
||||
fclose( fp );
|
||||
|
||||
#ifdef USE_WAITPID
|
||||
#ifdef HAVE_WAITPID
|
||||
waitpid( pid, (int *) NULL, 0 );
|
||||
#else
|
||||
wait4( pid, &status, WAIT_FLAGS, 0 );
|
||||
|
@ -1,60 +0,0 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# Copyright (c) 1994 Regents of the University of Michigan.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms are permitted
|
||||
# provided that this notice is preserved and that due credit is given
|
||||
# to the University of Michigan at Ann Arbor. The name of the University
|
||||
# may not be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission. This software
|
||||
# is provided ``as is'' without express or implied warranty.
|
||||
#
|
||||
# X.500 ldap rcpt500 mail query responder makefile
|
||||
#
|
||||
#-----------------------------------------------------------------------------
|
||||
LDAPSRC = ../..
|
||||
HDIR = $(LDAPSRC)/include
|
||||
LDIR = $(LDAPSRC)/libraries
|
||||
VERSIONFILE = $(LDAPSRC)/build/version
|
||||
|
||||
SRCS= main.c cmds.c help.c query.c
|
||||
OBJS= main.o cmds.o help.o query.o
|
||||
|
||||
INCLUDES= -I$(HDIR)
|
||||
DEFINES = $(DEFS)
|
||||
CFLAGS = $(INCLUDES) $(DEFINES) $(ACFLAGS)
|
||||
LIBS = -lldap -llber $(KRBLIBFLAG) $(KRBLIBS) $(ALIBS)
|
||||
|
||||
all: rcpt500
|
||||
|
||||
rcpt500: version.o
|
||||
$(CC) $(ALDFLAGS) -o $@ $(OBJS) version.o -L$(LDIR) $(LIBS)
|
||||
|
||||
version.c: $(OBJS) $(LDIR)/libldap.a
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< Version.c > $@)
|
||||
|
||||
install: rcpt500 rcpt500.help FORCE
|
||||
-$(MKDIR) -p $(LDAP_ETCDIR) $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 rcpt500 $(LDAP_LIBEXECDIR)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 644 rcpt500.help $(LDAP_ETCDIR)
|
||||
|
||||
lint: FORCE
|
||||
$(LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
5lint: FORCE
|
||||
$(5LINT) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
clean: FORCE
|
||||
$(RM) *.o core a.out version.c rcpt500
|
||||
|
||||
depend: FORCE
|
||||
$(MKDEP) $(INCLUDES) $(DEFINES) $(SRCS)
|
||||
|
||||
links:
|
||||
@$(LN) .src/README .src/*.[ch] .src/*.help .
|
||||
|
25
clients/rcpt500/Makefile.in
Normal file
25
clients/rcpt500/Makefile.in
Normal file
@ -0,0 +1,25 @@
|
||||
PROGRAMS= rcpt500
|
||||
SRCS= main.c cmds.c help.c query.c
|
||||
XSRCS= version.c
|
||||
OBJS= main.o cmds.o help.o query.o
|
||||
HDRS= rcpt500.h
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
||||
rcpt500 : version.o
|
||||
$(CC) $(LDFLAGS) -o $@ version.o $(OBJS) $(LIBS)
|
||||
|
||||
version.c: ${OBJS} $(LDAP_LIBDEPEND)
|
||||
$(RM) $@
|
||||
(u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
|
||||
t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
|
||||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
-e "s|%VERSION%|$${v}|" \
|
||||
< $(srcdir)/Version.c > $@)
|
||||
|
||||
install: $(PROGRAMS) rcpt500.help FORCE
|
||||
-$(MKDIR) -p $(libexecdir) $(sysconfdir)
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 755 rcpt500 $(libexecdir)
|
||||
-$(MV) $(sysconfdir)/rcpt500.help $(sysconfdir)/rcpt500.help-
|
||||
$(INSTALL) $(INSTALLFLAGS) -m 644 rcpt500.help $(sysconfdir)
|
@ -6,7 +6,9 @@
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "rcpt500.h"
|
||||
|
||||
struct command cmds[] = {
|
||||
|
@ -6,12 +6,17 @@
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "ldapconfig.h"
|
||||
#include "rcpt500.h"
|
||||
|
||||
|
@ -6,24 +6,24 @@
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "portable.h"
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
|
||||
#include "ldapconfig.h"
|
||||
#include "rcpt500.h"
|
||||
|
||||
#ifdef ultrix
|
||||
extern char *strdup();
|
||||
#endif
|
||||
|
||||
int dosyslog = 0;
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
int do_cldap = 0;
|
||||
#endif /* CLDAP */
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
|
||||
int derefaliases = 1;
|
||||
int sizelimit = RCPT500_SIZELIMIT;
|
||||
int rdncount = RCPT500_RDNCOUNT;
|
||||
@ -78,11 +78,12 @@ main( argc, argv )
|
||||
dosyslog = 1;
|
||||
break;
|
||||
case 'U':
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
do_cldap = 1;
|
||||
#else /* CLDAP */
|
||||
fprintf( stderr, "Compile with -DCLDAP for -U support\n" );
|
||||
#endif /* CLDAP */
|
||||
#else /* LDAP_CONNECTIONLESS */
|
||||
fprintf( stderr,
|
||||
"Compile with -DLDAP_CONNECTIONLESS for -U support\n" );
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
break;
|
||||
case 'b':
|
||||
searchbase = optarg;
|
||||
|
@ -6,18 +6,21 @@
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ac/syslog.h>
|
||||
#include <ac/time.h>
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "portable.h"
|
||||
#include "ldapconfig.h"
|
||||
#include "disptmpl.h"
|
||||
|
||||
#include "rcpt500.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
extern int dosyslog;
|
||||
extern int do_cldap;
|
||||
@ -77,11 +80,11 @@ query_cmd( msgp, reply )
|
||||
/*
|
||||
* open connection to LDAP server and bind as dapuser
|
||||
*/
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( do_cldap )
|
||||
ldp = cldap_open( ldaphost, ldapport );
|
||||
else
|
||||
#endif /* CLDAP */
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
ldp = ldap_open( ldaphost, ldapport );
|
||||
|
||||
if ( ldp == NULL ) {
|
||||
@ -91,9 +94,9 @@ query_cmd( msgp, reply )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( !do_cldap )
|
||||
#endif /* CLDAP */
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
if ( ldap_simple_bind_s( ldp, dapuser, NULL ) != LDAP_SUCCESS ) {
|
||||
report_ldap_err( ldp, reply );
|
||||
close_ldap( ldp );
|
||||
@ -110,11 +113,11 @@ query_cmd( msgp, reply )
|
||||
matches = 0;
|
||||
|
||||
#ifdef RCPT500_UFN
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( !do_cldap && strchr( msgp->msg_arg, ',' ) != NULL ) {
|
||||
#else /* CLDAP */
|
||||
#else /* LDAP_CONNECTIONLESS */
|
||||
if ( strchr( msgp->msg_arg, ',' ) != NULL ) {
|
||||
#endif /* CLDAP */
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
struct timeval tv;
|
||||
|
||||
ldap_ufn_setprefix( ldp, searchbase );
|
||||
@ -133,12 +136,12 @@ query_cmd( msgp, reply )
|
||||
|
||||
for ( lfi = ldap_getfirstfilter( lfdp, "rcpt500", msgp->msg_arg );
|
||||
lfi != NULL; lfi = ldap_getnextfilter( lfdp )) {
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( do_cldap )
|
||||
rc = cldap_search_s( ldp, searchbase, LDAP_SCOPE_SUBTREE,
|
||||
lfi->lfi_filter, attrs, 0, &ldmsgp, dapuser );
|
||||
else
|
||||
#endif /* CLDAP */
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
rc = ldap_search_s( ldp, searchbase, LDAP_SCOPE_SUBTREE,
|
||||
lfi->lfi_filter, attrs, 0, &ldmsgp );
|
||||
|
||||
@ -220,11 +223,11 @@ query_cmd( msgp, reply )
|
||||
void
|
||||
close_ldap( LDAP *ld )
|
||||
{
|
||||
#ifdef CLDAP
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if ( do_cldap )
|
||||
cldap_close( ld );
|
||||
else
|
||||
#endif /* CLDAP */
|
||||
#endif /* LDAP_CONNECTIONLESS */
|
||||
ldap_unbind( ld );
|
||||
}
|
||||
|
||||
@ -319,7 +322,7 @@ do_read( ldp, dn, reply, tmpll )
|
||||
|
||||
|
||||
rc = ldap_entry2text_search( ldp, dn, searchbase, NULLMSG, tmpll,
|
||||
defattrs, defvals, (void *)append_text, (void *)reply, "\n",
|
||||
defattrs, defvals, append_text, (void *)reply, "\n",
|
||||
rdncount, LDAP_DISP_OPT_DOSEARCHACTIONS );
|
||||
|
||||
return( rc );
|
||||
|
@ -6,6 +6,10 @@
|
||||
* All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <ldap_cdefs.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
struct msginfo {
|
||||
char *msg_subject;
|
||||
char *msg_replyto; /* actually could be from From: line */
|
||||
@ -16,8 +20,8 @@ struct msginfo {
|
||||
};
|
||||
|
||||
struct command {
|
||||
char *cmd_text; /* text for command, e.g. "HELP" */
|
||||
int (*cmd_handler)(); /* pointer to handler function */
|
||||
char *cmd_text; /* text for command, e.g. "HELP" */
|
||||
int (*cmd_handler)LDAP_P(()); /* pointer to handler function */
|
||||
};
|
||||
|
||||
|
||||
@ -27,10 +31,12 @@ struct command {
|
||||
/*
|
||||
* functions
|
||||
*/
|
||||
int help_cmd();
|
||||
int query_cmd();
|
||||
int help_cmd LDAP_P(());
|
||||
int query_cmd LDAP_P(());
|
||||
|
||||
/*
|
||||
* externs
|
||||
*/
|
||||
extern struct command cmds[];
|
||||
|
||||
LDAP_END_DECL
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user