Newsgroups: comp.sources.unix From: decvax!concert.net!woods%robohack (Greg A. Woods) Subject: v26i237: uutraf - UUCP Traffic Analysis and Reporting, Part02/04 Sender: unix-sources-moderator@efficacy.home.vix.com Approved: vixie@efficacy.home.vix.com Submitted-By: decvax!concert.net!woods%robohack (Greg A. Woods) Posting-Number: Volume 26, Issue 237 Archive-Name: uutraf/part02 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'Makefile-dist' <<'END_OF_FILE' X#! /bin/make -f X# X#ident "@(#)uutraf:Makefile 1.2.2.9 92/11/08 16:35:41 (woods)" X# X# Makefile - for uutraf X# X# Usage: X# make [OPTIM=] [DEBUG=-DDEBUG] [SDB=-g] [uutraf] X# make install X# make clean X# make clobber X# make shar X# X# History: X# woods@robohack.UUCP - Sun Jul 05 23:43:43 EDT 1992 X# - many changes getting ready for new release X# woods@robohack.UUCP - Sun Jul 15 12:38:34 EDT 1990 X# - minor cleanups X# - added list library modules X# X# @(#) FILE: Makefile X# @(#) Release: 1.2 X# @(#) Date: 2/2/90 X# @(#) Author: Greg Hackney (hack@texbell.swbt.com) X XSHELL = /bin/sh X XLOCAL = /usr/local X XBINDIR = $(LOCAL)/bin XLIBDIR = $(LOCAL)/lib XINCDIR = $(LOCAL)/include XMANEXT = 1 XMANDIR = $(LOCAL)/man/man1 X X# Select the right definition for your system, unless you are compiling on X# one of the following: SunOS, ULTRIX, AIX, XENIX. X# X# v7: SYSTYPE= -DV7 /* UNTESTED "The Real Thing!"(tm) ;-) */ X# any BSD: SYSTYPE= -DBSD /* UNTESTED (not required?) */ X# fake BSD: SYSTYPE= -UBSD /* UNTESTED [for POSIX/ANSI systems] */ X# SysIII: SYSTYPE= -DSYSIII /* UNTESTED */ X# SysV: SYSTYPE= -DSYSV /* generic AT&T or USG unix */ X# SysVr1: SYSTYPE= -DSYSVR1 /* UNTESTED i.e. the original SysV */ X# SysVr2: SYSTYPE= -DSYSVR2 /* yes, 3b1'ers, this is you too! */ X# SysVr3: SYSTYPE= -DSYSVR3 X# SysVr4: SYSTYPE= -DSYSVR4 /* Solaris 2.0 too! */ X# XENIX: SYSTYPE= /* let the compiler do it, please! */ X# AIX: SYSTYPE= /* let the compiler do it, please! */ X# any P1003.1:SYSTYPE= -D_POSIX_SOURCE /* may combine with above */ X# XSYSTYPE = -DSYSVR3 X X# NOTE: you'll have to define DUMB_VOID if your compiler doesn't fully X# understand the 'void' keyword. (The most common error indicating this X# symptom is "operands of ':' have incompatible types" for invocations of X# the lst_top()/lst_bottom() macros.) If your compiler doesn't understand X# 'void' at all, then you should also define REDEF_VOID. X# X#DEFS = $(SYSTYPE) -DDUMB_VOID X#DEFS = $(SYSTYPE) -DDUMB_VOID -DREDEF_VOID X# X# If your system has , but your compiler isn't ANSI-C X# add -DUSE_STDLIB X# If your compiler is ANSI-C, and you want , X# add -DUSE_MALLOC X# If your system has , but isn't ANSI-C (or POSIX), X# add -DUSE_STDDEF X# If your compiler is almost ANSI-C, but doesn't have (__STDC__ == 1), X# add -DREALSTDC=1 [(or -D__STDC__=1), BUT -- BE CAREFUL!] X# If your system is POSIX 1003.1 compliant, X# add -D_POSIX_SOURCE X# If your system has , but your compiler isn't ANSI-C, X# add -DUSE_MALLOC [and perhaps include -lmalloc in LIBS] X# If your system has , but your compiler isn't (ANSI-C && BSD), X# add -DUSE_STDARGS [and you'll likely also need -DUSE_PROTOTYPES] X# If your compiler understands prototypes, but isn't ANSI-C, X# add -DUSE_PROTOTYPES X# If your compiler doesn't understand prototypes for pointers to functions, X# add -DNO_PTRPROTO X# If your compiler has old-style support (V7) for 'void', and isn't ANSI-C X# add -DDUMB_VOID X# If your compiler doesn't understand 'void' at all, X# add -DREDEF_VOID X# If your compiler understands 'const', but isn't ANSI-C X# add -DUSE_CONST X# If your compiler understands 'volatile', but isn't ANSI-C X# add -DUSE_VOLATILE X# If your compiler understands 'signed', but isn't ANSI-C X# add -DUSE_SIGNED X# If your compiler understands 'void *' as the universal pointer, but isn't ANSI-C X# add -DUSE_VOIDPTR X# If your system doesn't typedef 'size_t', and doesn't either X# add -DNEED_SIZE_T X# If your system doesn't typedef 'wchar_t', and doesn't either X# add -DNEED_WCHAR_T X# If your system doesn't typedef 'ptrdiff_t', and doesn't either X# add -DNEED_PTRDIFF_T X# XDEFS = $(SYSTYPE) X X# Use -lc_s if your system supports AT&T shared libraries. X# Use -lmalloc if your libc(malloc.o) is ancient. [see -DUSE_MALLOC above] X# X#LIBS = -ldlst X#LIBS = -ldlst -lmalloc X#LIBS = -ldlst -lc_s X#LIBS = -ldlst -lmalloc -lc_s X# XLIBS = -ldlst -lmalloc -lc_s X X# BSD derivatives might need strtok() & getopt() X#BSDOBJS = strtok.o getopt.o X X# Use 'make DEBUG=-DDEBUG' to compile in debugging code. X# Use 'make DEBUG=-DNDEBUG' to turn off assert()s. X# XDEBUG = X X# Use 'make OPTIM= SDB=-g' to build for a symbolic debugger. X# XOPTIM = -O XSDB = X XCFLAGS = $(OPTIM) $(SDB) -I$(INCDIR) $(DEBUG) $(DEFS) XLDFLAGS = -L$(LIBDIR) X X# Another sample: X# X#CFLAGS = $(OPTIM) $(SDB) -I$(LOCAL)/include $(DEBUG) $(DEFS) -pipe -ansi \ X# -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wwrite-strings \ X# -Dscanf=DONT_USE_SCANF -Dgets=DONT_USE_GETS X#CC = gcc X#LIBS = -ldlst X X# X# The rest should be OK. X# X XPROG = uutraf X XOBJECTS = uutraf.o version.o $(BSDOBJS) XSOURCES = uutraf.c version.c pdstrtok.c XINCLUDES = uutraf.h version.h patchlevel.h XOTHER = README Makefile-dist CREDITS defs.h-dist CHANGES RELEASES Letter Letter-1.2 XDOCS = uutraf.1 XOTHERSTUFF = $(OTHER) $(DOC) X X.PRECIOUS: $(OTHERSTUFF) X X# for building distributions only!!!! X# XDLSTDIR = ../lib/dlst XDLST = $(DLSTDIR)/dlst.shar XEXTERN_HDRS = ../head/sccsid.h ../head/sysdefs.h ../head/libc.h ../head/str.h \ X ../head/extern.h ../head/intern.h XEXTERN_SRCS = ../lib/pdlibc/getopt.c ../../ucblib/string/strtok.c XEXTERN_STUFF = $(EXTERN_SRCS) $(EXTERN_HDRS) XEXTSHARS = externhdr.shar externsrc.shar $(DLST) X XFILES = $(DOCS) $(INCLUDES) $(SOURCES) $(OTHER) $(EXTSHARS) X Xdefault: $(PROG) X Xall: $(PROG) X X$(PROG): $(OBJECTS) X $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) X Xuutraf.o: uutraf.h defs.h version.h X Xversion.o: version.h patchlevel.h X Xdefs.h: defs.h-dist X @echo "Copy defs.h-dist to defs.h and edit to suit." ; exit 1 X Xinstall: all X cp $(PROG) $(BINDIR)/$(PROG) X chmod 755 $(BINDIR)/$(PROG) X cp uutraf.1 $(MANDIR)/$(PROG).$(MANEXT) X Xclean: X rm -f $(OBJECTS) core X Xclobber: clean clean-ext-shars X rm -f $(PROG) X Xshar: $(PROG).shar clean-dlst-dist X Xclean-ext-shars: X rm -f $(EXTSHARS) X Xsimple-dist: Makefile-dist $(PROG).shar clean-dlst-dist clean-ext-shars X X# using 'make dist' prevents ever applying official patches to Makefile-dist... X# XMakefile-dist: Makefile X @echo "'cp Makefile Makefile-dist' Are you sure? [ to abort] \c"; read junk X rm -f Makefile-dist X cp Makefile Makefile-dist X X$(PROG).shar: $(OTHER) $(DOCS) $(INCLUDES) $(SOURCES) $(EXTSHARS) X ( sed -e '/^TO COMPILE$$/,/^#ident/d' README ; \ X shar -b -t 'NOTE: contains dlst library sources shar. Read the README!' \ X $(OTHER) $(DOCS) $(INCLUDES) $(SOURCES) $(EXTSHARS) ; \ X ) > $(PROG).shar X X$(DLST): X cd $(DLSTDIR); $(MAKE) -$(MAKEFLAGS) shar X Xclean-dlst-dist: X cd $(DLSTDIR); $(MAKE) -$(MAKEFLAGS) cleandist X Xecho: X @echo Makefile defs.h $(INCLUDES) $(SOURCES) X Xechoall: X @echo $(FILES) X Xexternhdr.shar: $(EXTERN_HDRS) X shar -b -t 'Put these in your local include directory.' $(EXTERN_HDRS) > $@ X Xexternsrc.shar: $(EXTERN_SRCS) X shar -b -t 'Modules for libfake...' $(EXTERN_SRCS) > $@ X XADMIN = sccs enter XADMINFLAGS = -fb -ftuutraf -fqwoods XVCSDIR = SCCS X X# I'll only ever use this once, but you can use it for each major X# release to start over your local change monitoring X# X# WARNING: this is a first hack X# Xmksccs: X -mkdir $(VCSDIR) X $(ADMIN) $(ADMINFLAGS) $(OTHERSTUFF) $(INCLUDES) $(SOURCES) X X# You can probably do this kind of stuff with RCS too.... X# XCHANGEFORMAT = -d":Z::Y:\::M:\t:Dt:\t(:Q:)\n\t:C:" XPRS = prs XPRSFLAGS = -l XRELEASEFORMAT = date '+%y/%m/%d-%T' XPATCHFORMAT = date '+%y%m%d' XVEDITING = sccs tell X X# Create an actual "release" by updating RELEASES and CHANGES. A release is X# defined as any change in patchlevel.h, followed by 'make dist'. X# XCHANGES: patchlevel.h X @if [ -n "`$(VEDITING)`" ] ; then echo "Checked out for editing: `$(VEDITING)`"; exit 1; fi X @echo '-------------------------------------------------------------------------------' > /tmp/uutraf.$@ X -$(PRS) $(PRSFLAGS) -c`tail -1 RELEASES` $(CHANGEFORMAT) $(VCSDIR) >> /tmp/uutraf.$@ X echo '----' >> /tmp/uutraf.$@ ; echo '' >> /tmp/uutraf.$@ X $(RELEASEFORMAT) >> RELEASES X echo "Changes for Release dated: `tail -1 RELEASES`" | cat - /tmp/uutraf.$@ $@ > $@.new X mv -f $@.new $@ X @rm -f /tmp/uutraf.$@ X @-chmod -w $@ X XGET = sccs get XDIFF = diff XDIFFFLAGS = -c X X# Make a Patch file for changes since the most recent release. X# X# WARNING: this is a first hack. A patch is always made from the most recent X# full release. Sequential patches must be interspersed with "fake" releases. X# X# Both this, and probably the update of CHANGES (above) should be done in X# a separate script. X# X# NOTE: This can be called at any time without doing a full release. X# X# ALSO: Does not update CHANGES. X# XPatch: patchlevel.h X @if [ -n "`sccs tell`" ] ; then echo "Do your deltas [make mass-delta]! (`sccs tell`)" ; exit 1 ; fi X echo "Patch-Creation-Date: `$(RELEASEFORMAT)`" > $@ X @: remainder must be one command line, and must append to $@ X tdir=/tmp/pgen.$$$$ ; \ X mkdir $$tdir ; \ X oldver=`tail -1 RELEASES` ; \ X echo "Changes-Since: $$oldver" >> $@ ; \ X for mod in `prs -d:M: $(VCSDIR)` ; do \ X $(GET) -s -p -c$$oldver $$mod > $$tdir/$$mod ; \ X $(DIFF) $(DIFFFLAGS) $$tdir/$$mod $$mod > $$tdir/diff.out ; \ X if [ -s $$tdir/diff.out ] ; then \ X echo "" ; \ X echo "Index: $$mod" ; \ X echo "Prereq: `prs -e -c$$oldver -d:I: $$mod`" ; \ X cat $$tdir/diff.out ; \ X fi >> $@ ; \ X done X @echo "You should try the patch against $$tdir" X X# build a distribution shar set using makekit (from Rich Salz's cshar) X# Xdist: $(PROG).dist clean-dlst-dist clean-ext-shars X X$(PROG).dist: DIST MANIFEST X @if [ ! -d DIST ] ; then mkdir DIST ; else rm -i DIST/* ; fi X makekit -n./DIST/Part. -m -t'Please read the file README first' X touch $(PROG).dist X XDIST: X -mkdir $@ X X# building a manifest for makekit requires all other files in the "release" X# to be ready and up-to-date. we hide the actual first-stage run of makekit, X# as it is both boring and has a very long command line. X# X# NOTE: this precludes editing of the file MANIFEST (for silly things like X# including more descriptive comments... X# XMANIFEST: CHANGES Makefile-dist defs.h-dist $(EXTSHARS) X @-rm -f $@ X @-rm -f makekit.in X @echo $(FILES) | tr '\040' '\012' > makekit.in X makekit -x -n./DIST/Part. < makekit.in > $@ X @-rm -f makekit.in X Xtest-MANIFEST: X -rm -f makekit.in X echo $(FILES) | tr '\040' '\012' > makekit.in X makekit -x -n./DIST/Part. < makekit.in > $@ END_OF_FILE if test 10227 -ne `wc -c <'Makefile-dist'`; then echo shar: \"'Makefile-dist'\" unpacked with wrong size! fi # end of 'Makefile-dist' fi if test -f 'externhdr.shar' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'externhdr.shar'\" else echo shar: Extracting \"'externhdr.shar'\" \(24610 characters\) sed "s/^X//" >'externhdr.shar' <<'END_OF_FILE' X#! /bin/sh X# This is a shell archive. Remove anything before this line, then unpack X# it by saving it into a file and typing "sh file". To overwrite existing X# files, type "sh file -c". You can also feed this as standard input via X# unshar, or by typing "sh 'sccsid.h' <<'END_OF_FILE' XX/* XX * sccsid.h - handle various incantations for SID's XX * XX * #ident "@(#)head:sccsid.h 1.3 92/10/09 23:39:52 (woods)" XX * XX * XX * USE (as the very first statements in a C source module w/out '\'s): XX * XX * #define SID "%Z\%%Y\%:%M\% %I\% %E\% %U\% (%Q\%)" XX * #include "sccsid.h" XX * XX * USE (as the very first statement in a C header module w/out '\'s): XX * XX * #define SID_NM module_sccsid * the full name of the static array * XX * #define SID_H "%Z\%%Y\%:%M\% %I\% %E\% %U\% (%Q\%)" XX * #include "sccsid.h" XX * XX * [Use tab characters around the '%I\%'.] XX * XX * NOTE: assumes SYSVR3 or SYSVR4 or SMART_CPP will be defined on the XX * compiler command line if appropriate. XX * XX * WARNING: as a side-effect, this file define's and undef's XX * both SMART_CPP and MYconst XX */ XX XX#if !defined(_AIX) && (defined(SYSVR3) || defined(SYSVR4)) XX# define SMART_CPP XX# define SMART_IDENT XX#endif XX XX#if defined(SYSVR2) /* You might want this, but it's usually a no-op. */ XX/*# define SMART_CPP /* use this if your compiler has #sccs */ XX/*# define SMART_SCCS /* you must also uncomment '#sccs' lines below */ XX#endif XX XX#if defined(__STDC__) && (__STDC__ > 0) XX# define MYconst const XX#else XX# define MYconst /* no_op */ XX#endif XX XX#ifdef SMART_CPP XX XX# ifdef SID XX# ifdef SMART_IDENT XX# ident SID /* comment this out if your cpp blows up */ XX# endif XX# ifdef SMART_SCCS XX# include "You must uncomment the #sccs lines for SMART_SCCS to work!" XX/*# sccs SID /* comment the above line if you uncomment this one */ XX# endif XX# undef SID XX# else XX# ifdef SID_H XX# ifdef SID_NM XX# ifdef SMART_IDENT XX# ident SID_H /* unset SMART_CPP if your compiler blows up */ XX# endif XX# ifdef SMART_SCCS XX# include "You must uncomment the #sccs lines for SMART_SCCS to work!" XX/*# sccs SID_H /* comment the above line if you uncomment this one */ XX# endif XX# undef SID_NM XX# undef SID_H XX# else XX# include "ERROR: you must define SID_NM to use SID_H" XX# endif XX# else XX# include "ERROR: you must define either SID or SID_H to use sccsid.h" XX# endif XX# endif XX XX#else /* !SMART_CPP */ XX XX# if !(defined(lint) || defined(M_LINT)) || defined(DEBUG) XX# ifdef SID XXstatic MYconst char sccsid[] = SID; XX# undef SID XX# else XX# ifdef SID_H XX# ifdef SID_NM XXstatic MYconst char SID_NM[] = SID_H; XX# undef SID_NM XX# undef SID_H XX# else XX# include "ERROR: you must define SID_NM to use SID_H" XX# endif XX# else XX# include "ERROR: you must define either SID or SID_H to use sccsid.h" XX# endif XX# endif XX# endif XX XX#endif XX XX#undef MYconst XX#undef SMART_CPP XEND_OF_FILE Xif test 2526 -ne `wc -c <'sccsid.h'`; then X echo shar: \"'sccsid.h'\" unpacked with wrong size! Xfi X# end of 'sccsid.h' Xfi Xif test -f 'sysdefs.h' -a "${1}" != "-c" ; then X echo shar: Will not clobber existing file \"'sysdefs.h'\" Xelse Xecho shar: Extracting \"'sysdefs.h'\" \(9731 characters\) Xsed "s/^X//" >'sysdefs.h' <<'END_OF_FILE' XX/* XX * sysdefs.h - Configuration options header file. XX */ XX XX#define SID_H "@(#)head:sysdefs.h 1.3 92/10/03 20:34:24 (woods)" XX#define SID_NM sysdefs_sccsid XX#include XX XX/* XX * This file defines a few things such as a base system environment XX * (BSD/SYSV), and includes some support for ANSI Standard C. It is, in some XX * ways, analogous to the ANSI-C header. It also defines some XX * common system data types that may be missing on some platforms. It is XX * intended to be included first, and to be followed at some point by XX * . XX */ XX XX/* XX * NOTE: In general you will not have to edit this file. Custom features XX * should be enabled via command-line defines if necessary (eg. -DDUMB_VOID). XX */ XX XX/* XX * WARNING: This file uses '\' to continue '#if' lines XX */ XX XX/* XX * Determine if really ANSI C XX */ XX#if defined(__STDC__) && !defined(REALSTDC) XX# if (__STDC__ - 0) > 0 XX# define REALSTDC 1 XX# ifndef USE_PROTOTYPES XX# define USE_PROTOTYPES 1 /* see use of this below */ XX# endif XX# else XX# define REALSTDC 0 XX# endif XX#else XX# define REALSTDC 0 XX#endif XX XX/* XX * some compilers bitch about using 'extern' for "forward" references XX */ XX#if REALSTDC XX# define forward /* implicit */ XX#else XX# define forward extern XX#endif XX#ifndef private XX# define private static XX#endif XX XX/* XX * Some automated feature detection partially ripped out of JOVE 4.x XX */ XX XX#if defined(ultrix) || defined(__ultrix__) XX# define ULTRIX XX# ifndef BSD4_2 XX# define BSD4_2 1 /* True enough for our purposes */ XX# endif XX#endif XX XX#if (defined(sun) || defined(__sun__)) /* && !defined(SUNOS5) */ XX# define SUN XX# ifndef BSD4_2 XX# define BSD4_2 1 /* True enough for our purposes */ XX# endif XX#endif XX XX#if defined(mips) || defined(__mips__) XX# define MIPS XX# ifndef SYSVR3 XX# define SYSVR3 1 XX# endif XX#endif XX XX/* M_XENIX is defined by the Compiler */ XX XX/* SYSV should be defined for AT&T UNIX System V systems */ XX XX#ifdef SYSVR4 XX# ifndef SYSVR3 XX# define SYSVR3 1 /* SYSVR3 is a subset of SYSVR4 */ XX# endif XX#endif XX#ifdef SYSVR3 XX# ifndef SYSVR2 XX# define SYSVR2 1 /* SYSVR2 is a subset of SYSVR3 */ XX# endif XX#endif XX#ifdef SYSVR2 XX# ifndef SYSV XX# define SYSV 1 /* SYSV is a subset of SYSVR2 */ XX# endif XX#endif XX#ifdef SYSVR1 XX# ifndef SYSV XX# define SYSV 1 /* SYSVR1 is SYSV! */ XX# endif XX#endif XX XX#ifdef BSD4_1 XX# ifndef BSD XX# define BSD 1 XX# endif XX#endif XX#ifdef BSD4_2 XX# ifndef BSD XX# define BSD 1 XX# endif XX#endif XX#ifdef BSD4_3 XX# ifndef BSD XX# define BSD 1 XX# endif XX#endif XX XX#ifdef BSD2_8 XX# ifndef BSD XX# define BSD 1 XX# endif XX#endif XX#ifdef BSD2_9 XX# ifndef BSD XX# define BSD 1 XX# endif XX#endif XX#ifdef BSD2_10 XX# ifndef BSD XX# define BSD 1 XX# endif XX#endif XX XX#if defined(BSD) || defined(V7) || defined(SYSIII) /* || defined(M_XENIX) 2.3 */ XX# ifndef strchr XX# define strchr index XX# endif XX# ifndef strrchr XX# define strrchr rindex XX# endif XX#endif XX XX#ifdef SYSV XX# ifndef HAVE_UNAME XX# define HAVE_UNAME 1 XX# endif XX#endif XX XX#if !defined(SYSV) && !defined(M_XENIX) && \ XX !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) XX# define NEED_LOCKF 1 XX#endif XX XX/* XX * Legend says the old Microsoft mc68k C compiler (for XENIX/68000, and XX * probably originally written by UniSoft) "noticed" if the code defined XX * 'VOID' and suddenly supported the 'void' keyword, in which case constructs XX * like the following may cause syntax errors or other weird behavior. XX * (Personally I thought it was M_VOID that triggered this behavior.) XX * XX * NOTE: we don't use a typedef here. XX * XX * NOTE: See 'UnivPtr' below too! XX */ XX#ifndef DUMB_VOID XX# ifndef VOID XX# define VOID void /* 'VOID' is used where half-baked compilers fail */ XX# endif XX#else XX# undef VOID XX# define VOID int XX# if defined(REDEF_VOID) && !defined(void) XX# define void int /* Even Ritchie's V7 cc supported 'void'.... */ XX# endif XX#endif XX XX/* XX * proto: macro to allow us to prototype any function declaration without XX * upsetting old compilers. Use it like this: XX * XX * extern int myfun proto(int arg1, char *arg2); XX * extern int (*ptrtofun) ptrproto(void); XX * extern char *morefun proto((char *(*proc) ptrproto((const char *)))); XX * pattern = myproc("howdy", (int (*) ptrproto((int))) NULL, (char *) NULL); XX * XX * If you define this you'll likely need USE_STDARGS too. XX */ XX#if (REALSTDC == 1) || defined(USE_PROTOTYPES) XX# define proto(x) x XX# ifdef NO_PTRPROTO XX /* on these systems, a prototype cannot be used for a pointer to function */ XX# define ptrproto(x) () XX# else XX# define ptrproto(x) x XX# endif XX#else XX# define proto(x) () XX# define ptrproto(x) () XX#endif XX XX/* XX * There are two ways to handle functions with a variable number of args. XX * The old portable way uses . The way sanctioned by ANSI X3J11 XX * uses . Unfortunately they are not compatible.... Note also XX * that if you define this you'll probably need USE_PROTOTYPES too. XX */ XX#if (REALSTDC == 1) || defined(USE_STDARGS) XX# ifndef USE_STDARGS XX# define USE_STDARGS 1 XX# endif XX# define va_init(ap, parmN) { va_start((ap), (parmN)); } XX#else XX# define va_init(ap, parmN) { va_start((ap)); } XX#endif XX XX/* XX * 'const': readonly type qualifier (use may break some pre-ANSI compilers!) XX */ XX#if (REALSTDC == 0) && !defined(USE_CONST) XX# define const /* Only in ANSI C. Pity */ XX#endif XX XX/* XX * 'volatile': type qualifier indicating one of two kinds of magic: XX * XX * 1. This object may be modified by an event unknown to the implementation XX * (eg. asynchronous signal or memory-mapped I/O device). XX * XX * 2. This automatic variable might be modified between a setjmp() XX * and a longjmp(), and we wish it to have the correct value after XX * the longjmp(). This second meaning is an X3J11 abomination. XX */ XX#if (REALSTDC == 0) && !defined(USE_VOLATILE) XX# define volatile /* also only in ANSI C. Oh well. */ XX#endif XX XX/* XX * 'signed': converse of 'unsigned' XX */ XX#if (REALSTDC == 0) && !defined(USE_SIGNED) XX# define signed /* bye-bye! */ XX#endif XX XX/* XX * UnivPtr: universal pointer type XX */ XX#if (REALSTDC == 1) || defined(USE_VOIDPTR) XXtypedef void Univ; XXtypedef void *UnivPtr; XXtypedef const void *UnivConstPtr; /* object is "constant" */ XXtypedef void * const UnivPtrConst; /* pointer is "constant" */ XX#else XXtypedef char Univ; XXtypedef char *UnivPtr; XXtypedef const char *UnivConstPtr; /* object is "constant" */ XXtypedef char * const UnivPtrConst; /* pointer is "constant" */ XX#endif XX XX/* XX * According to the ANSI standard for C, any library routine may XX * be defined as a macro with parameters. In order to prevent XX * the expansion of this macro in a declaration of the routine, XX * ANSI suggests parenthesizing the identifier. This is a reasonable XX * and legal approach, even for K&R C. XX * XX * A bug in the MIPS compiler used on MIPS, IRIS, and probably other XX * MIPS R[23]000 based systems, causes the compiler to reject XX * these declarations (at least at the current time, 1989 August). XX * To avoid this bug, we conditionally define and use UNMACRO. XX */ XX#if defined(MIPS) /* || defined(IRIS) || defined(NEC) */ XX# define UNMACRO(proc) proc XX#else XX# define UNMACRO(proc) (proc) XX#endif XX XX/* XX * This is a bit tricky. Often, when compiling on a POSIX compatible system, XX * one will *not* want to define _POSIX_SOURCE. However, not doing so does XX * not remove the typedefs from the system headers. Perhaps the opposite XX * logic should be used, and these should be defined *only* for those system XX * variants that need them.... The problem being that some compilers get XX * right upset if you try and re-typedef something, even if to the exact same XX * fundamental type. NOTE: some are ushort, some ulong or long. XX */ XX#if !defined(SYSVR4) && !defined(_AIX) && \ XX !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) XX# ifdef V7 XXtypedef int uid_t; XXtypedef int gid_t; XX# else XX# ifdef M_XENIX XXtypedef unsigned short uid_t; XXtypedef unsigned short gid_t; XX# else XXtypedef unsigned int uid_t; XXtypedef unsigned int gid_t; XX# endif XX# endif XX#endif XX XX/* XX * size_t is required for at least for att-3b1 (defined(u3b)) and most M_XENIX XX */ XX#if !defined(_SIZE_T) && defined(NEED_SIZE_T) || ((REALSTDC == 0) && \ XX !defined(SYSVR2) && !defined(SYSVR3) && !defined(SYSVR4) && \ XX !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) XX# define _SIZE_T 1 /* _AIX only? */ XXtypedef unsigned int size_t; /* int on some, ulong on some? */ XX#endif XX XX/* XX * 8-bit type & 16-bit macros to avoid sign problems XX */ XX#ifndef NO_BYTE XX# if defined(V7) || defined(M_XENIX) || defined(BSD2_8) XXtypedef char byte; /* WARNING: machine dependent! */ XX# define BYTE(x) ((x) && 0xff) XX# else XXtypedef unsigned char byte; /* WARNING: machine dependent! */ XX# define BYTE(x) (x) XX# endif XX# define HIBYTE(x) (((x) >> 8) & 0xff) /* hi byte of short */ XX# define LOBYTE(x) ((x) & 0xff) /* lo byte of short */ XX# define HIWORD(x) (((x) >> 16) & 0xffffL) /* hi 16-bits of long */ XX# define LOWORD(x) ((x) & 0xffffL) /* lo 16-bits of long */ XX# define CHAR(x) ((x) & 0x7f) XX# define WORD(x) ((x) & 0xffffL) /* i.e. 16-bit word */ XX#endif XX XX/* XX * more ANSI-C types more properly found in XX */ XX#if !defined(_WCHAR_T) && (defined(NEED_WCHAR_T) || (!defined(REALSTDC))) XX# define _WCHAR_T 1 /* _AIX only? */ XXtypedef unsigned short wchar_t; XX#endif XX#if !defined(_PTRDIFF_T) && (defined(NEED_PTRDIFF_T) || (!defined(REALSTDC))) XX# define _PTRDIFF_T 1 /* _AIX only? */ XXtypedef long ptrdiff_t; XX#endif XX XX/* XX * as Henry Spencer says, 'char *sprintf()' is stupid and archaic! XX */ XX#if !defined(BSD) && (REALSTDC == 0) && !defined(NEED_VSPRINTF) && \ XX !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) XXtypedef int SPRINTF_T; XX#else XXtypedef char *SPRINTF_T; /* WARNING: don't use this with vsprintf.shar */ XX#endif XX XX/* XX * Offset of member MEMBER in a struct of type TYPE. XX * XX * WARNING: compiler dependent! XX */ XX#if !defined(offsetof) && !defined(_AIX) && !defined(_ANSI_C_SOURCE) XX# define offsetof(TYPE, MEMBER) ((size_t) &(((TYPE *)0)->MEMBER)) XX#endif XEND_OF_FILE Xif test 9731 -ne `wc -c <'sysdefs.h'`; then X echo shar: \"'sysdefs.h'\" unpacked with wrong size! Xfi X# end of 'sysdefs.h' Xfi Xif test -f 'libc.h' -a "${1}" != "-c" ; then X echo shar: Will not clobber existing file \"'libc.h'\" Xelse Xecho shar: Extracting \"'libc.h'\" \(6869 characters\) Xsed "s/^X//" >'libc.h' <<'END_OF_FILE' XX/* XX * libc.h - support for some older libc's XX */ XX XX#define SID_H "@(#)head:libc.h 1.5 92/10/09 23:40:41 (woods)" XX#define SID_NM libc_sccsid XX#include XX XX/* XX * DESCRIPTION: This file defines several things that are expected to be a XX * part of the compile-time environment for a normal UNIX program. In XX * particular, this header attempts to bend a non-POSIX (1003.1) environment XX * into some semblance of conformance. By no means am I advocating complete XX * compliance of POSIX is a good thing -- rather it is a necessary evil! XX */ XX/* XX * USAGE: If your system is POSIX compliant, this header assumes that XX * _POSIX_SOURCE will be defined. XX */ XX/* XX * NOTE: This file must always included *AFTER* , , XX * , and/or , if you're using either, and in fact you XX * might want to include it after *all* other includes. XX */ XX/* XX * ALSO NOTE: This file should probably be preceded by "sysdefs.h" XX */ XX/* XX * HISTORY: This header is modeled after one of the same name found in the C XX * News sources written at the University of Toronto by Geoff Collyer and XX * Henry Spencer. Greg A. Woods has adapted it to be XX * more complete and useful as a stand-alone header. Some of the following XX * bits have been derived from headers in many other tools, including Jove. XX */ XX XX#ifndef NULL XX# define NULL 0 XX#endif XX#ifndef EOF XX# define EOF (-1) XX#endif XX#ifndef EOS XX# define EOS '\0' XX#endif XX XX/* XX * Yes, it's ugly to define the following things in here, but the alternative XX * is to have several copies of each clause spread around many files. XX */ XX XX/* XX * this _should_ be in , but SYSVR2 & BSD don't have one XX */ XX#ifndef PATH_MAX XX# ifdef MAXPATHLEN XX# define PATH_MAX MAXPATHLEN XX# else XX# define PATH_MAX 1024 XX# endif XX#endif XX#ifndef NAME_MAX XX# ifdef MAXNAMELEN XX# define NAME_MAX MAXNAMELEN XX# else XX# define NAME_MAX 14 XX# endif XX#endif XX XX/* XX * Symbolic constants for the "lseek" routine (should be in ). XX * Don't bother with the old BSD "L*" things. XX */ XX#ifndef SEEK_SET XX# define SEEK_SET 0 /* Set file pointer to "offset" */ XX# define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ XX# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ XX#endif XX XX/* XX * these _should_ be in ! XX */ XX#ifndef S_IRWXU XX# define S_IRWXU 00700 /* read, write, execute: owner */ XX# define S_IRWXG 00070 /* read, write, execute: group */ XX# define S_IRWXO 00007 /* read, write, execute: other */ XX#endif XX#ifndef S_IRUSR XX# define S_IRUSR 00400 /* read permission: owner */ XX# define S_IWUSR 00200 /* write permission: owner */ XX# define S_IXUSR 00100 /* execute permission: owner */ XX# define S_IRGRP 00040 /* read permission: group */ XX# define S_IWGRP 00020 /* write permission: group */ XX# define S_IROTH 00004 /* read permission: other */ XX# define S_IWOTH 00002 /* write permission: other */ XX# define S_IXOTH 00001 /* execute permission: other */ XX#endif XX XX/* XX * signal types: tailor to suit local needs (usually 'VOID' is OK, as it will XX * be either 'void' or 'int', and most systems that support 'void' will have XX * "void (*signal)();", and 'VOID' will be 'int' otherwise.) XX */ XXtypedef VOID (*sigret_t)(); XXtypedef VOID (*sigarg_t)(); XX XX/* XX * The SCO UNIX, Solaris 2.0, and probably others have getopt(3c)'s that are not XX * POSIX compliant. These should be in ! XX */ XX#if !defined(NO_GETOPT) /* might force in getopt(3c) */ XXextern int optind; XXextern char *optarg; XX#endif XX XX#if !REALSTDC && \ XX !defined(_POSIX_SOURCE) && !defined(XOPEN_SOURCE) XX XX/* XX * these _should_ be in other system header files.... , , XX * , etc. XX * XX * NOTE: There are some in here you may not have. XX * XX * WARNING: These are the "standard" declarations, and some "broken" systems XX * may define things a bit differently. Hopefully a re-declaration clash XX * will make this obvious! XX */ XX XXextern int errno; /* always(?) in */ XX XXextern SPRINTF_T sprintf(); XX XXextern sigret_t signal(); XX XXextern void exit(); XXextern void _exit(); XX XXextern void abort(); XXextern void _assert(); XXextern void longjmp(); XX XXextern char *crypt(); XXextern void setkey(); XXextern void encrypt(); XX XXextern void monitor(); XXextern void profil(); XX XX#ifndef M_UNIX /* on SCO, it's a macro! */ XXextern char *strerror(); XX#endif /* M_UNIX */ XX XXextern unsigned int sleep(); XX XXextern time_t time(); XXextern struct tm *gmtime(); XXextern char *ctime(); XX XXextern struct passwd *getpwent(); XXextern struct passwd *getpwuid(); XXextern struct passwd *getpwnam(); XXextern void setpwent(); XXextern void endpwent(); XXextern struct passwd *fgetpwent(); XX XXextern struct group *getgrent(); XXextern struct group *getgrgid(); XXextern struct group *getgrnam(); XXextern void setgrent(); XXextern void endgrent(); XXextern struct group *fgetgrent(); XX XXextern uid_t getuid(); XXextern uid_t geteuid(); XXextern gid_t getgid(); XXextern gid_t getegid(); XX XXextern FILE *fopen(); XXextern FILE *freopen(); XXextern FILE *popen(); XXextern FILE *tmpfile(); XXextern char *mktemp(); XXextern char *tempnam(); XXextern char *fgets(); XXextern char *gets(); XXextern long ftell(); XXextern void setbuf(); XX#if 0 XXextern void clearerr(); /* a macro in most ! */ XX#endif XXextern void rewind(); XXextern void perror(); XX XXextern char *getenv(); XXextern char *cuserid(); XX XX#ifndef M_UNIX /* SCO's compiler (i.e. Microsoft's) barfs on some of these */ XXextern char *strcpy(); XXextern char *strncpy(); XXextern char *strcat(); XXextern char *strncat(); XXextern char *strchr(); XXextern char *strrchr(); XXextern char *strpbrk(); XXextern char *strtok(); XXextern char *strdup(); XXextern char *strstr(); XX#endif /* M_UNIX */ XXextern int strcmp(); XXextern int strncmp(); XXextern int strlen(); XXextern int strspn(); XXextern int strcspn(); XX XX#ifndef M_UNIX /* more SCO inconsitency */ XXextern UnivPtr memccpy(); XXextern UnivPtr memchr(); XXextern UnivPtr memcpy(); XXextern UnivPtr memmove(); XXextern UnivPtr memset(); XX#endif /* M_UNIX */ XXextern int memcmp(); XX XXextern UnivPtr bsearch(); XXextern void qsort(); XXextern void twalk(); XX XXextern void srand(); XX XXextern void swab(); XX XX#ifndef USE_MALLOC XXextern void free(); XXextern UnivPtr calloc(); XXextern UnivPtr malloc(); XXextern UnivPtr realloc(); XX#endif /* USE_MALLOC */ XX XXextern double atof(); XXextern long atol(); XXextern long labs(); XX XXextern double strtod(); XXextern long strtol(); XX# if 0 XXextern unsigned long strtoul(); /* 'unsigned long' not portable */ XX# endif XX XX#endif XX XX/* XX * The following prototypes are esp. useful since they are stdargs-like. XX * If they clash, please let me know! XX */ XX#if !REALSTDC && defined(USE_PROTOTYPES) XXextern int printf(const char *fmt, ...); XXextern int fprintf(FILE *fp, const char *fmt, ...); XXextern int sprintf(char *buf, const char *fmt, ...); XXextern int scanf(const char *fmt, ...); XXextern int fscanf(FILE *fp, const char *fmt, ...); XXextern int sscanf(char *s, const char *fmt, ...); XX#endif XEND_OF_FILE Xif test 6869 -ne `wc -c <'libc.h'`; then X echo shar: \"'libc.h'\" unpacked with wrong size! Xfi X# end of 'libc.h' Xfi Xif test -f 'str.h' -a "${1}" != "-c" ; then X echo shar: Will not clobber existing file \"'str.h'\" Xelse Xecho shar: Extracting \"'str.h'\" \(1389 characters\) Xsed "s/^X//" >'str.h' <<'END_OF_FILE' XX/* XX * str.h XX * XX * some stuff borrowed from C News and elsewhere... XX */ XX XX#define SID_H "@(#)head:str.h 1.2 92/04/20 09:53:14 (woods)" XX#define SID_NM str_sccsid XX#include "sccsid.h" XX XX/* XX * simple in-lining for older compilers... XX */ XX#ifndef FASTSTRCHR XX# define STRCHR(src, chr, dest) (dest) = strchr(src, chr) XX#else XX# define STRCHR(src, chr, dest) \ XX for ((dest) = (src); *(dest) != '\0' && *(dest) != (chr); ++(dest)) \ XX ; \ XX if (*(dest) == '\0') \ XX (dest) = NULL /* N.B.: missing semi-colon */ XX#endif XX XX/* XX * more useful things... XX */ XX XX/* XX * STREQ is an optimised strcmp(a,b)==0 XX */ XX#define STREQ(s1, s2) ((s1)[0] == (s2)[0] && strcmp(s1, s2) == 0) XX#define STRNE(s1, s2) (!((s1)[0] == (s2)[0] && strcmp(s1, s2) == 0)) XX XX#define STRLT(s1, s2) (strcmp(s1, s2) < 0) XX#define STRGT(s1, s2) (strcmp(s1, s2) > 0) XX#define STRLE(s1, s2) (strcmp(s1, s2) <= 0) XX#define STRGE(s1, s2) (strcmp(s1, s2) >= 0) XX XX/* XX * STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0 XX */ XX#define STREQN(s1, s2, len) ((s1)[0] == (s2)[0] && strncmp(s1, s2, len) == 0) XX#define STRNEN(s1, s2, len) (!((s1)[0] == (s2)[0] && strncmp(s1, s2, len) == 0)) XX XX#define STRLTN(s1, s2, len) (strncmp(s1, s2, len) < 0) XX#define STRGTN(s1, s2, len) (strncmp(s1, s2, len) > 0) XX#define STRLEN(s1, s2, len) (strncmp(s1, s2, len) <= 0) XX#define STRGEN(s1, s2, len) (strncmp(s1, s2, len) >= 0) XX XX/* see case.h for case-independent stuff */ XEND_OF_FILE Xif test 1389 -ne `wc -c <'str.h'`; then X echo shar: \"'str.h'\" unpacked with wrong size! Xfi X# end of 'str.h' Xfi Xif test -f 'extern.h' -a "${1}" != "-c" ; then X echo shar: Will not clobber existing file \"'extern.h'\" Xelse Xecho shar: Extracting \"'extern.h'\" \(311 characters\) Xsed "s/^X//" >'extern.h' <<'END_OF_FILE' XX/* XX * #include in each module referencing (declaring) global variables XX */ XX XX/*#define SID_H "@(#)head:extern.h 1.1 92/04/20 00:26:48 (woods)" /* */ XX/*#define SID_NM extern_sccsid /* */ XX/*#include "sccsid.h" /* */ XX XX#undef EXT XX#define EXT extern XX XX#undef INIT XX#define INIT(val) /* nothing */ XX XX#undef DOINIT XEND_OF_FILE Xif test 311 -ne `wc -c <'extern.h'`; then X echo shar: \"'extern.h'\" unpacked with wrong size! Xfi X# end of 'extern.h' Xfi Xif test -f 'intern.h' -a "${1}" != "-c" ; then X echo shar: Will not clobber existing file \"'intern.h'\" Xelse Xecho shar: Extracting \"'intern.h'\" \(299 characters\) Xsed "s/^X//" >'intern.h' <<'END_OF_FILE' XX/* XX * #include in each module defining global variables XX */ XX XX/*#define SID_H "@(#)head:intern.h 1.1 92/04/20 00:26:52 (woods)" /* */ XX/*#define SID_NM intern_sccsid /* */ XX/*#include "sccsid.h" /* */ XX XX#undef EXT XX#define EXT /* nothing */ XX XX#undef INIT XX#define INIT(val) = val XX XX#define DOINIT 1 XEND_OF_FILE Xif test 299 -ne `wc -c <'intern.h'`; then X echo shar: \"'intern.h'\" unpacked with wrong size! Xfi X# end of 'intern.h' Xfi Xecho shar: End of shell archive. Xecho "Put these in your local include directory." Xexit 0 END_OF_FILE if test 24610 -ne `wc -c <'externhdr.shar'`; then echo shar: \"'externhdr.shar'\" unpacked with wrong size! fi # end of 'externhdr.shar' fi echo shar: End of archive 2 \(of 4\). cp /dev/null ark2isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. echo "Please read the file README first" rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0