[alt.sources] Rich $alz's cshar package, new alpha release, Part03/05

rsalz@bbn.com (Rich Salz) (02/21/89)

This is what I use to create shell archives of small-to-humongous source
distributions.  Hope you find it useful.  Hope you find bugs, and send
them to me.  This will appear in comp.sources.unix after the bug reports
die down.  It runs on all sort of Unix machines, and a raft of other OS's,
too.

For more details, see the README file in the first shar.

Please don't pass this version around, wait for the "REAL" one.
	/rich $alz

#! /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 <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 3 (of 5)."
# Contents:  Makefile config.3b1 config.bsd config.dos config.hpx
#   config.x38 findsrc.c
# Wrapped by rsalz@fig.bbn.com on Mon Feb 20 18:15:46 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(6707 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X##
X##  SOURCE-SHIPPING TOOLS MAKEFILE
X##  $Header: Makefile,v 2.1 88/06/03 11:38:35 rsalz Locked $
X##
X
X##  Which one are you editing?
XCONFIG_FILE=config.bsd
X
X##  Grrr...  But we use it to install manpages, below.
XSHELL	= /bin/sh
X
X##  How to remove a file and make it read-only.
XREMOVE	= rm -f
X#REMOVE	= -rm /f
XREAD_ONLY	= chmod 444
X#READ_ONLY	= echo Do not edit
X
X##  Edit appropriately, such as -g if you don't trust me...
XCFLAGS	= -g
XLNFLAGS	=
X
X##  Prolog file.
XPROLOG	=
X
X##  Microsoft C, v5.0.
X##  NOTE:  You will have to rename *.o to *.obj, and add .exe in a few
X##  places.  This makefile is ugly enough; I refuse to do it.
X#CC	= cl
X#MODEL	= S
X#CFLAGS	= -A$(MODEL) -Zid -Od -W3
X#CFLAGS	= -A$(MODEL) -O
X#LNFLAGS	= -link /stack:0x4000 /noe
X#PROLOG	= c:\msc\lib\$(MODEL)setargv.obj
X#.c.obj:
X#	$(CC) $(CFLAGS) -c $*.c
X
X##  If the directory library is built into the shar library, edit these
X##  two lines.
X#DIRSRC	= dirmsd.c
X#DIROBJ	= dirmsd.o
X#DIRSRC	= dirami.c
X#DIROBJ	= dirami.o
X
X##  If the directory library is somewhere else, use this.
X#DIRLIB	= -lndir
X
X##   Library
XMYLIB	= lib.a
X#MYLIB	= shar.obj
X##  Use these two lines if you use ranlib...
XAR_OBJ	= $(LIB_OBJ)
XRANLIB	= ranlib $(MYLIB)
X##  This is for UNOS.
X#RANLIB = genlib lib.lib $(MYLIB)
X##  ...or use these two if you need tsort instead...
X#AR_OBJ	= `lorder $(LIB_OBJ) | tsort`
X#RANLIB	= @echo
X##  ...or these two if you need neither.
X#AR_OBJ	= $(LIB_OBJ)
X#RANLIB	= @echo
X
X##  Where executables should be put.
XDESTDIR	= /usr/local/bin
X
X##  The "foo" manpage will get put in $(MANDIR)/foo.$(MANEXT)
XMANDIR	= /usr/man/man1
XMANEXT	= 1
X#MANDIR	= /usr/man/u_man/manl
X#MANEXT	= 1L
X#MANDIR	= /usr/man/local/man1
X#MANEXT	= 1
X#MANDIR	= /usr/man/man.M
X#MANEXT	= M
X
X##
X##  END OF MAIN CONFIGURATION SECTION
X##
X
X##  Header files.
XHDRS	= shar.h config.h
X
X##  Programs.
XPROGRAMS= findsrc makekit maniscan manipull shar unshar shell
X
X##  Documentation.  Can't use the rules below because if you set MANEXT=l,
X##  above, then make will try to run lex on findsrc.l in order to create
X##  findsrc.c, which is not bad.  Instead, I use a loop and basename(1)
X##  in the install actions.  I suppose if I cleared the .SUFFIXES variable
X##  it would work, but this is good enough.
XMANPAGES= findsrc.man makekit.man maniscan.man manipull.man \
X	shar.man unshar.man shell.man uuencode.man uudecode.man
X##  For systems without nroff manpages are nearly useless.  But see the
X##  "doc" target before giving this package to one of those systems.
X#MANPAGES=
X
X##  Creating manpages.
X#.SUFFIXES	:	.$(MANEXT) .man
X#.man.$(MANEXT)	:
X#	@$(REMOVE) $@
X#	cp $< $@
X#	@$(READ_ONLY) $@
X
X##  If you want to keep lpt-formatted manpages around, use this.
XDOCPAGES= findsrc.doc makekit.doc maniscan.doc manipull.doc \
X	shar.doc unshar.doc shell.doc uuencode.doc uudecode.doc
X.SUFFIXES	:	.doc .man
X.man.doc	:
X	@$(REMOVE) $@
X	$(SHELL) dodoc.sh $*
X	@$(READ_ONLY) $@
X
X##  UNOS needs this default rule, can you believe it?
X#.SUFFIXES	:	.o
X#.c.o		:
X#	$(CC) $(CFLAGS) -c $<
X
X##  Our library of utility functions.
XLIB_SRC	= glue.c parser.c lcwd.c lexec.c lfiles.c lhost.c llib.c \
X	lmem.c luser.c $(DIRSRC)
XLIB_OBJ	= glue.o parser.o lcwd.o lexec.o lfiles.o lhost.o llib.o \
X	lmem.o luser.o $(DIROBJ)
X
X
Xall		:	$(PROGRAMS) $(MANPAGES)
X	-touch all
X
Xdoc		:	dodoc.sh $(DOCPAGES)
X	-touch doc
X
X##  You might want to change these actions...
Xinstall		:	all
X	cd $(DESTDIR) ; $(REMOVE) $(PROGRAMS)
X	cp $(PROGRAMS) $(DESTDIR)
X	cd $(DESTDIR) ; strip $(PROGRAMS) ; chmod 755 $(PROGRAMS)
X#	cd $(DESTDIR) ; /etc/chown root $(PROGRAMS)
X	-$(SHELL) -c "for I in $(PROGRAMS) ; do \
X		rm -f $(MANDIR)/`basename $$I .man` ; \
X		cp $$I $(MANDIR)/`basename $$I .man`.$(MANEXT); \
X	done"
X	-touch install
X
Xclean		:
X	$(REMOVE) *.[oa] *.doc *.BAK $(PROGRAMS) unshar2
X	$(REMOVE) lint lib.ln tags core foo a.out uuencode uudecode
X	$(REMOVE) Part?? all install doc clean
X#	$(REMOVE) *.obj *.lib *.exe
X
X
X##  Header hacking.
X#$(LIB_OBJ)	:	$(HDRS)
Xconfig.h	:	$(CONFIG_FILE)
X	@$(REMOVE) config.h
X	cp $(CONFIG_FILE) config.h
X	@$(READ_ONLY) config.h
X
X
X##  Programs.
Xfindsrc		:	findsrc.o $(MYLIB)
X	@$(REMOVE) findsrc
X	$(CC) $(CFLAGS) -o findsrc \
X		$(PROLOG) findsrc.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
Xmakekit		:	makekit.o $(MYLIB)
X	@$(REMOVE) makekit
X	$(CC) $(CFLAGS) -o makekit \
X		$(PROLOG) makekit.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
Xmaniscan	:	maniscan.o $(MYLIB)
X	@$(REMOVE) maniscan
X	$(CC) $(CFLAGS) -o maniscan \
X		$(PROLOG) maniscan.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
Xmanipull	:	manipull.o $(MYLIB)
X	@$(REMOVE) manipull
X	$(CC) $(CFLAGS) -o manipull \
X		$(PROLOG) manipull.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
Xshar		:	shar.o $(MYLIB)
X	@$(REMOVE) shar
X	$(CC) $(CFLAGS) -o shar \
X		$(PROLOG) shar.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
Xshell		:	shell.o $(MYLIB)
X	@$(REMOVE) shell
X	$(CC) $(CFLAGS) -o shell \
X		$(PROLOG) shell.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
Xunshar		:	unshar.o $(MYLIB)
X	@$(REMOVE) unshar
X	$(CC) $(CFLAGS) -o unshar \
X		$(PROLOG) unshar.o $(MYLIB) $(DIRLIB) $(LNFLAGS)
X
X##  Not documented, just thrown in for free.
Xuudecode	:	uudecode.c $(MYLIB)
X	@$(REMOVE) uudecode uudecode.o
X	$(CC) $(CFLAGS) -DSTANDALONE -o uudecode \
X		$(PROLOG) uudecode.c $(MYLIB) $(DIRLIB) $(LNFLAGS)
X	@$(REMOVE) uudecode.o
X
X##  .eerf rof ni nworht tsuj ,detnemucod toN
Xuuencode	:	uuencode.c $(MYLIB)
X	@$(REMOVE) uuencode uuencode.o
X	$(CC) $(CFLAGS) -DSTANDALONE -o uuencode \
X		$(PROLOG) uuencode.c $(MYLIB) $(DIRLIB) $(LNFLAGS)
X	@$(REMOVE) uuencode.o
X
X##  Special case, a version of unshar that uses the /bin/sh interpreter.
Xunshar2		:	unshar.c $(HDRS) $(MYLIB)
X	@$(REMOVE) unshar2 unshar.o
X	$(CC) $(CFLAGS) -DUSE_MY_SHELL -o unshar \
X		$(PROLOG) unshar.c $(MYLIB) $(DIRLIB) $(LNFLAGS)
X	@$(REMOVE) unshar.o
X
X
X##  Support your local library.
X$(MYLIB)	:	$(LIB_OBJ)
X	@$(REMOVE) $(MYLIB)
X	ar r $(MYLIB) $(AR_OBJ)
X# 	archive -u $(MYLIB) $(AR_OBJ)
X	$(RANLIB)
X#$(MYLIB)	:	$(LIB_OBJ)
X#	lib unix -+glue -+parser -+lcwd -+lexec -+lfiles -+lhost \
X#		-+llib -+lmem -+luser -+msd_dir;
X
X##  Lint; this is probably only good for BSD-derived lints.
X##  Ultrix 1.2 lint really hates the !var construct, for some reason.
X#LINTF	= -p -ahb
XLINTF	= -ahb
X##  A slight speed hack...
XX	= exec
Xlint		:	$(PROGRAMS) lib.ln
X	@$(REMOVE) lint
X	$(X) lint $(LINTF) -u $(LIB_SRC)          >lint
X	$(X) lint $(LINTF)    findsrc.c   lib.ln >>lint
X	$(X) lint $(LINTF)    makekit.c   lib.ln >>lint
X	$(X) lint $(LINTF)    maniscan.c  lib.ln >>lint
X	$(X) lint $(LINTF)    manipull.c  lib.ln >>lint
X	$(X) lint $(LINTF)    shar.c      lib.ln >>lint
X	$(X) lint $(LINTF)    shell.c     lib.ln >>lint
X	$(X) lint $(LINTF)    unshar.c    lib.ln >>lint
X#	$(X) lint $(LINTF) -DUSE_MY_SHELL >>lint unshar.c  lib.ln
X
Xlib.ln		:	$(LIB_SRC)
X	@$(REMOVE) lib.ln
X	lint -CX $(LIB_SRC)
X	mv llib-lX.ln lib.ln
END_OF_FILE
if test 6707 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'config.3b1' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.3b1'\"
else
echo shar: Extracting \"'config.3b1'\" \(6639 characters\)
sed "s/^X//" >'config.3b1' <<'END_OF_FILE'
X/*
X**  Configuration file for shar and friends.
X**
X**  This is for System V release 2, modified w/ release 3 system calls.
X**  This package will NOT install without the readdir() function, which
X**  comes in another package.
X**
X**  Bud Hovell @ Overture Systems Corp <whizz!bbh>
X**  $Header$
X*/
X
X
X/*
X**  Higher-level controls for which operating system we're running on.
X*/
X#define UNIX				/* Works			*/
X/*efine MSDOS				/* Should work			*/
X/*efine VMS				/* Doesn't work			*/
X
X
X/*
X**  A dense section of one-line compilation controls.  If you're confused,
X**  your best bet is to search through the source to see where and how
X**  each one of these is used.
X*/
X#define IDX		strchr		/* Maybe strchr?		*/
X#define RDX		strrchr		/* Maybe strrchr?		*/
X/*efine NEED_CTERMID			/* Don't make ctermid(3)?	*/
X#define NEED_MKDIR			/* Don't have mkdir(2)?		*/
X/*efine UNOS_MKDIR			/* Use makedir, not mkdir?	*/
X/*efine NEED_QSORT			/* Don't have qsort(3)?		*/
X/*efine NEED_GETOPT			/* Need local getopt object?	*/
X#define CAN_POPEN			/* Can invoke file(1) command?	*/
X/*efine USE_MY_SHELL			/* Don't popen("/bin/sh")?	*/
X/*efine void		int		/* If you don't have void	*/
X/*pedef void		 sigret_t;	/* What a signal handler returns */
Xtypedef int		 sigret_t;	/* What a signal handler returns */
Xtypedef int		*align_t;	/* Worst-case alignment, for lint */
Xtypedef long		time_t;		/* Needed for non-BSD sites?	*/
Xtypedef long		off_t;		/* Needed for non-BSD sites?	*/
X/*efine SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X#define HAS_VFORK			/* Have vfork but no <sys/wait.h> */
X/*efine USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X/*efine USE_LONGJMP			/* Don't exit() within parser?	*/
X/*efine USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X#define USE_GETPWUID			/* Use getpwuid(3)?		*/
X#define DEF_SAVEIT	TRUE		/* Save headers by default?	*/
X#define NAME_FORMAT	"%s%2.2d"	/* To get things like Part02	*/
X/*efine NAME_FORMAT	"%s%02.2d"	/* To get things like Part02	*/
X#define MANI_FORMAT	" %-25s %2d\t%s\n"	/* This should be safe	*/
X50c51
X#define MAX_LEVELS	6		/* Levels for findsrc to walk	*/
X#define THE_TTY		"/dev/tty"	/* Maybe "con:" for MS-DOS?	*/
X/*efine RCSID				/* Compile in the RCS strings?	*/
X#define USERNAME	"Somebody"	/* Your name, if not in environ	*/
X/* efine PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X/*efine DECLARE_PROTOTYPES		/* Use prototypes in our decls?	*/
X/*efine ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X#define REGISTER	register	/* Do you trust your compiler?	*/
X#define PEDAGOGY			/* Advertise tools?		*/
X
X
X/*
X**  How do we test to see if a character is okay to pass to one of
X**  the macros in <ctype.h>?  Note that we never give it EOF.
X*/
X#define CTYPE(c)	(isascii((c)))	/* Common			*/
X/*efine CTYPE(c)	((c) > 0)	/* Less common			*/
X/*efine CTYPE(c)	(TRUE)		/* Uncommon			*/
X
X
X/*
X**  We often want to make a backup copy of a file (usually a manifest).
X**  The following sets of #define's control how the copying is done.
X*/
X#define BU_VIA_RENAME			/* Use rename call?		*/
X/*efine BU_VIA_LINK			/* Use link/unlink calls?	*/
X/*efine BU_VIA_COPY			/* Use fopen() and such?	*/
X/*efine BU_NONE				/* System has generations?	*/
X/*efine BU_PREFIX	"B-"		/* Instead of ".BAK" suffix?	*/
X#define BU_SUFFIX	".BAK"		/* Instead of "B-" prefix?	*/
X/*efine BU_NAME_LEN	14		/* For non-BSD filesystems	*/
X
X
X/*
X**  The programs create up to two temporary files at one time, using
X**  mktemp(3).  Decide where you want the files to go, and if you wanna
X**  use a special directory for them (see MakeTempName).
X*/
X#define TEMP_NAME1	"/tmp/csharXXXXXX"	/* Unix			*/
X#define TEMP_NAME2	"/tmp/csharXXXXXX"	/* Unix			*/
X/*efine TEMP_NAME1	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME2	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME1	"sys$login:csharXXXXXX"	/* VMS			*/
X/*efine TEMP_NAME2	"sys$login:csharXXXXXX"	/* VMS			*/
X#define TEMPSIZE	40		/* Size of temp file name	*/
X/*efine TEMPVAR		"TMPDIR"	/* Place for temp files		*/
X
X
X/*
X**  There are several ways to get current machine name.  Enable just one
X**  of one of the following lines.
X*/
X/*efine GETHOSTNAME			/* Use gethostname(2) call	*/
X#define UNAME				/* Use uname(2) call		*/
X/*efine UUNAME				/* Invoke "uuname -l"		*/
X/*efine	WHOAMI		"/etc/whoami"	/* Try /etc/whoami & <whoami.h>	*/
X/*efine HOST_STRING			/* Just use DEF_HOST		*/
X#define DEF_HOST	"SITE"		/* If all else fails		*/
X
X
X/*
X**  There are several different ways to get the current working directory.
X**  Enable just one of the following lines.
X*/
X/*efine GETWD				/* Use getwd(3) routine		*/
X#define GETCWD				/* Use getcwd(3) routine	*/
X/*efine PWDPOPEN			/* Invoke "pwd"			*/
X/*efine PWDGETENV	"PWD"		/* Get $PWD from environment	*/
X
X
X/*
X**  If you're a notes site, you might have to tweaks these two #define's.
X**  If you don't care, then set them equal to something that doesn't
X**  start with the comment-begin sequence and they'll be effectively no-ops
X**  at the cost of an extra strcmp.  I've also heard of broken MS-DOS
X**  compilers that don't ignore slash-star inside comments!  Anyhow, for
X**  more details see unshar.c
X*/
X/*efine NOTES1		"/* Written "	/* This is what notes 1.7 uses	*/
X/*efine NOTES2		"/* ---"	/* This is what notes 1.7 uses	*/
X#define NOTES1		"$$"		/* This is a don't care		*/
X#define NOTES2		"$$"		/* This is a don't care		*/
X
X
X/*
X**  The findsrc program uses the readdir() routines to read directories.
X**  If your system doesn't have this interface, there are public domain
X**  implementations available for Unix from the comp.sources.unix archives,
X**  GNU has a VMS one inside EMACS, and this package comes with kits for
X**  MS-DOS and the Amiga.  Help save the world and use or write a readdir()
X**  package for your system!
X*/
X
X/* Now then, where did I put that header file?   Pick one. */
X/*efine IN_SYS_DIR			/* <sys/dir.h>			*/
X/*efine IN_SYS_NDIR			/* <sys/ndir.h>			*/
X/*efine IN_DIR				/* <dir.h>			*/
X/*efine IN_DIRECT			/* <direct.h>			*/
X/*efine IN_NDIR				/* "ndir.h"			*/
X#define IN_DIRENT			/* <dirent.h>			*/
X
X/*  What readdir() returns.  Must be a #define because of #include order. */
X#ifdef	IN_DIRENT
X#define DIRENTRY	struct dirent
X#else
X#define DIRENTRY	struct direct
X#endif	/* IN_DIRENT */
X
X
X/*
X**  Limits.  The shell parser can be compiled with some safety-checks.
X**  This includes creating too many files, or writing long ones, creating
X**  too many directories, overwriting existing files, etc.
X*/
X/*efine PATH_CHECK			/* Check filenames in shars?	*/
X/*efine MAX_FOPENS	40		/* Max # of files/archive	*/
X/*efine MAX_LINES	1200		/* Max # of lines in a file	*/
X/*efine MAX_MKDIRS	10		/* Max directory depth		*/
X
X
X/*
X**  Congratulations, you're done!
X*/
END_OF_FILE
if test 6639 -ne `wc -c <'config.3b1'`; then
    echo shar: \"'config.3b1'\" unpacked with wrong size!
fi
# end of 'config.3b1'
fi
if test -f 'config.bsd' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.bsd'\"
else
echo shar: Extracting \"'config.bsd'\" \(6607 characters\)
sed "s/^X//" >'config.bsd' <<'END_OF_FILE'
X/*
X**  Configuration file for shar and friends.
X**
X**  This is known to work on Ultrix1.2 and Sun3.4 machines; it may work
X**  on other BSD variants, too.
X**
X**  $Header: config.h,v 2.2 88/06/06 22:05:27 rsalz Exp $
X*/
X
X
X/*
X**  Higher-level controls for which operating system we're running on.
X*/
X#define UNIX				/* Works			*/
X/*efine MSDOS				/* Should work			*/
X/*efine VMS				/* Doesn't work			*/
X
X
X/*
X**  A dense section of one-line compilation controls.  If you're confused,
X**  your best bet is to search through the source to see where and how
X**  each one of these is used.
X*/
X#define IDX		index		/* Maybe strchr?		*/
X#define RDX		rindex		/* Maybe strrchr?		*/
X#define NEED_CTERMID			/* Don't make ctermid(3)?	*/
X/*efine NEED_MKDIR			/* Don't have mkdir(2)?		*/
X/*efine UNOS_MKDIR			/* Use makedir, not mkdir?	*/
X/*efine NEED_QSORT			/* Don't have qsort(3)?		*/
X#define NEED_GETOPT			/* Need local getopt object?	*/
X#define CAN_POPEN			/* Can invoke file(1) command?	*/
X/*efine USE_MY_SHELL			/* Don't popen("/bin/sh")?	*/
X/*efine void		int		/* If you don't have void	*/
X/*pedef void		 sigret_t;	/* What a signal handler returns */
Xtypedef int		 sigret_t;	/* What a signal handler returns */
Xtypedef int		*align_t;	/* Worst-case alignment, for lint */
X/*pedef long		time_t		/* Needed for non-BSD sites?	*/
X/*pedef long		off_t		/* Needed for non-BSD sites?	*/
X#define SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X#define HAS_VFORK			/* Have vfork but no <sys/wait.h> */
X/*efine USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X/*efine USE_LONGJMP			/* Don't exit() within parser?	*/
X#define USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X#define USE_GETPWUID			/* Use getpwuid(3)?		*/
X#define DEF_SAVEIT	TRUE		/* Save headers by default?	*/
X#define UNIX_FILES			/* stat(file) gives true size?	*/
X#define NAME_FORMAT	"%s%2.2d"	/* To get things like Part02	*/
X/*efine NAME_FORMAT	"%s%02.2d"	/* To get things like Part02	*/
X#define MANI_FORMAT	" %-25s %2d\t%s\n"	/* This should be safe	*/
X#define MAX_LEVELS	6		/* Levels for findsrc to walk	*/
X#define THE_TTY		"/dev/tty"	/* Maybe "con:" for MS-DOS?	*/
X#define RCSID				/* Compile in the RCS strings?	*/
X#define USERNAME	"Somebody"	/* Your name, if not in environ	*/
X#define PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X/*efine DECLARE_PROTOTYPES		/* Use prototypes in our decls?	*/
X/*efine ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X#define REGISTER	register	/* Do you trust your compiler?	*/
X#define PEDAGOGY			/* Advertise tools?		*/
X
X
X/*
X**  How do we test to see if a character is okay to pass to one of
X**  the macros in <ctype.h>?  Note that we never give it EOF.
X*/
X#define CTYPE(c)	(isascii((c)))	/* Common			*/
X/*efine CTYPE(c)	((c) > 0)	/* Less common			*/
X/*efine CTYPE(c)	(TRUE)		/* Uncommon			*/
X
X
X/*
X**  We often want to make a backup copy of a file (usually a manifest).
X**  The following sets of #define's control how the copying is done.
X*/
X#define BU_VIA_RENAME			/* Use rename call?		*/
X/*efine BU_VIA_LINK			/* Use link/unlink calls?	*/
X/*efine BU_VIA_COPY			/* Use fopen() and such?	*/
X/*efine BU_NONE				/* System has generations?	*/
X/*efine BU_PREFIX	"B-"		/* Instead of ".BAK" suffix?	*/
X#define BU_SUFFIX	".BAK"		/* Instead of "B-" prefix?	*/
X/*efine BU_NAME_LEN	14		/* For non-BSD filesystems	*/
X
X
X/*
X**  The programs create up to two temporary files at one time, using
X**  mktemp(3).  Decide where you want the files to go, and if you wanna
X**  use a special directory for them (see MakeTempName).
X*/
X#define TEMP_NAME1	"/tmp/csharXXXXXX"	/* Unix			*/
X#define TEMP_NAME2	"/tmp/csharXXXXXX"	/* Unix			*/
X/*efine TEMP_NAME1	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME2	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME1	"sys$login:csharXXXXXX"	/* VMS			*/
X/*efine TEMP_NAME2	"sys$login:csharXXXXXX"	/* VMS			*/
X#define TEMPSIZE	40		/* Size of temp file name	*/
X/*efine TEMPVAR		"TMPDIR"	/* Place for temp files		*/
X
X
X/*
X**  There are several ways to get current machine name.  Enable just one
X**  of one of the following lines.
X*/
X#define GETHOSTNAME			/* Use gethostname(2) call	*/
X/*efine UNAME				/* Use uname(2) call		*/
X/*efine UUNAME				/* Invoke "uuname -l"		*/
X/*efine	WHOAMI		"/etc/whoami"	/* Try /etc/whoami & <whoami.h>	*/
X/*efine HOST_STRING			/* Just use DEF_HOST		*/
X#define DEF_HOST	"SITE"		/* If all else fails		*/
X
X
X/*
X**  There are several different ways to get the current working directory.
X**  Enable just one of the following lines.
X*/
X#define GETWD				/* Use getwd(3) routine		*/
X/*efine GETCWD				/* Use getcwd(3) routine	*/
X/*efine PWDPOPEN			/* Invoke "pwd"			*/
X/*efine PWDGETENV	"PWD"		/* Get $PWD from environment	*/
X
X
X/*
X**  If you're a notes site, you might have to tweaks these two #define's.
X**  If you don't care, then set them equal to something that doesn't
X**  start with the comment-begin sequence and they'll be effectively no-ops
X**  at the cost of an extra strcmp.  I've also heard of broken MS-DOS
X**  compilers that don't ignore slash-star inside comments!  Anyhow, for
X**  more details see unshar.c
X*/
X/*efine NOTES1		"/* Written "	/* This is what notes 1.7 uses	*/
X/*efine NOTES2		"/* ---"	/* This is what notes 1.7 uses	*/
X#define NOTES1		"$$"		/* This is a don't care		*/
X#define NOTES2		"$$"		/* This is a don't care		*/
X
X
X/*
X**  The findsrc program uses the readdir() routines to read directories.
X**  If your system doesn't have this interface, there are public domain
X**  implementations available for Unix from the comp.sources.unix archives,
X**  GNU has a VMS one inside EMACS, and this package comes with kits for
X**  MS-DOS and the Amiga.  Help save the world and use or write a readdir()
X**  package for your system!
X*/
X
X/* Now then, where did I put that header file?   Pick one. */
X#define IN_SYS_DIR			/* <sys/dir.h>			*/
X/*efine IN_SYS_NDIR			/* <sys/ndir.h>			*/
X/*efine IN_DIR				/* <dir.h>			*/
X/*efine IN_DIRECT			/* <direct.h>			*/
X/*efine IN_NDIR				/* "ndir.h"			*/
X/*efine IN_DIRENT			/* <dirent.h>			*/
X
X/*  What readdir() returns.  Must be a #define because of #include order. */
X#ifdef	IN_DIRENT
X#define DIRENTRY	struct dirent
X#else
X#define DIRENTRY	struct direct
X#endif	/* IN_DIRENT */
X
X
X/*
X**  Limits.  The shell parser can be compiled with some safety-checks.
X**  This includes creating too many files, or writing long ones, creating
X**  too many directories, overwriting existing files, etc.
X*/
X/*efine PATH_CHECK			/* Check filenames in shars?	*/
X/*efine MAX_FOPENS	40		/* Max # of files/archive	*/
X/*efine MAX_LINES	1200		/* Max # of lines in a file	*/
X/*efine MAX_MKDIRS	10		/* Max directory depth		*/
X
X
X/*
X**  Congratulations, you're done!
X*/
END_OF_FILE
if test 6607 -ne `wc -c <'config.bsd'`; then
    echo shar: \"'config.bsd'\" unpacked with wrong size!
fi
# end of 'config.bsd'
fi
if test -f 'config.dos' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.dos'\"
else
echo shar: Extracting \"'config.dos'\" \(6618 characters\)
sed "s/^X//" >'config.dos' <<'END_OF_FILE'
X/*
X**  Configuration file for shar and friends.
X**
X**  This is for MS-DOS.  It works on Microsoft C, release 5.1
X**
X**  $Header: config.dos,v 2.1 88/06/06 22:05:40 rsalz Exp $
X*/
X
X
X/*
X**  Higher-level controls for which operating system we're running on.
X*/
X/*efine UNIX				/* Works			*/
X	/* Microsoft C 5.1 predefines MSDOS */
X/*efine MSDOS				/* Should work			*/
X/*efine VMS				/* Doesn't work			*/
X
X
X/*
X**  A dense section of one-line compilation controls.  If you're confused,
X**  your best bet is to search through the source to see where and how
X**  each one of these is used.
X*/
X#define IDX		strchr		/* Maybe strchr?		*/
X#define RDX		strrchr		/* Maybe strrchr?		*/
X#define NEED_CTERMID			/* Don't make ctermid(3)?	*/
X/*efine NEED_MKDIR			/* Don't have mkdir(2)?		*/
X/*efine UNOS_MKDIR			/* Use makedir, not mkdir?	*/
X/*efine NEED_QSORT			/* Don't have qsort(3)?		*/
X#define NEED_GETOPT			/* Need local getopt object?	*/
X/*efine CAN_POPEN			/* Can invoke file(1) command?	*/
X#define USE_MY_SHELL			/* Don't popen("/bin/sh")?	*/
X/*efine void		int		/* If you don't have void	*/
Xtypedef void		 sigret_t;	/* What a signal handler returns */
Xtypedef void		 sigret_t;	/* What a signal handler returns */
Xtypedef int		*align_t;	/* Worst-case alignment, for lint */
X/*pedef long		time_t;		/* Needed for non-BSD sites?	*/
X/*pedef long		off_t;		/* Needed for non-BSD sites?	*/
X/*efine SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X/*efine HAS_VFORK			/* Have vfork but no <sys/wait.h> */
X#define USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X/*efine USE_LONGJMP			/* Don't exit() within parser?	*/
X#define USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X/*efine USE_GETPWUID			/* Use getpwuid(3)?		*/
X#define DEF_SAVEIT	TRUE		/* Save headers by default?	*/
X#define UNIX_FILES			/* stat(file) gives true size?	*/
X#define NAME_FORMAT	"%s%2.2d"	/* To get things like Part02	*/
X/*efine NAME_FORMAT	"%s%02.2d"	/* To get things like Part02	*/
X#define MANI_FORMAT	" %-25s %2d\t%s\n"	/* This should be safe	*/
X#define MAX_LEVELS	6		/* Levels for findsrc to walk	*/
X#define THE_TTY		(getenv("DEVTTY") ? getenv("DEVTTY") : "/dev/con")
X#define RCSID				/* Compile in the RCS strings?	*/
X#define USERNAME	"Somebody"	/* Your name, if not in environ	*/
X/*efine PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X#define DECLARE_PROTOTYPES		/* Use prototypes in our decls?	*/
X#define ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X#define REGISTER	register	/* Do you trust your compiler?	*/
X#define PEDAGOGY			/* Advertise tools?		*/
X
X
X/*
X**  How do we test to see if a character is okay to pass to one of
X**  the macros in <ctype.h>?  Note that we never give it EOF.
X*/
X#define CTYPE(c)	(isascii((c)))	/* Common			*/
X/*efine CTYPE(c)	((c) > 0)	/* Less common			*/
X/*efine CTYPE(c)	(TRUE)		/* Uncommon			*/
X
X
X/*
X**  We often want to make a backup copy of a file (usually a manifest).
X**  The following sets of #define's control how the copying is done.
X*/
X#define BU_VIA_RENAME			/* Use rename call?		*/
X/*efine BU_VIA_LINK			/* Use link/unlink calls?	*/
X/*efine BU_VIA_COPY			/* Use fopen() and such?	*/
X/*efine BU_NONE				/* System has generations?	*/
X#define BU_PREFIX	"B-"		/* Instead of ".BAK" suffix?	*/
X/*efine BU_SUFFIX	".BAK"		/* Instead of "B-" prefix?	*/
X#define BU_NAME_LEN	14		/* For non-BSD filesystems	*/
X
X
X/*
X**  The programs create up to two temporary files at one time, using
X**  mktemp(3).  Decide where you want the files to go, and if you wanna
X**  use a special directory for them (see MakeTempName).
X*/
X#define TEMP_NAME1	"/tmp/csharXXXXXX"	/* Unix			*/
X#define TEMP_NAME2	"/tmp/csharXXXXXX"	/* Unix			*/
X/*efine TEMP_NAME1	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME2	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME1	"sys$login:csharXXXXXX"	/* VMS			*/
X/*efine TEMP_NAME2	"sys$login:csharXXXXXX"	/* VMS			*/
X#define TEMPSIZE	40		/* Size of temp file name	*/
X/*efine TEMPVAR		"TMPDIR"	/* Place for temp files		*/
X
X
X/*
X**  There are several ways to get current machine name.  Enable just one
X**  of one of the following lines.
X*/
X/*efine GETHOSTNAME			/* Use gethostname(2) call	*/
X/*efine UNAME				/* Use uname(2) call		*/
X/*efine UUNAME				/* Invoke "uuname -l"		*/
X/*efine	WHOAMI		"a:\host.txt"	/* Try /etc/whoami & <whoami.h>	*/
X#define HOST_STRING			/* Just use DEF_HOST		*/
X#define DEF_HOST	"pc"		/* If all else fails		*/
X
X
X/*
X**  There are several different ways to get the current working directory.
X**  Enable just one of the following lines.
X*/
X/*efine GETWD				/* Use getwd(3) routine		*/
X#define GETCWD				/* Use getcwd(3) routine	*/
X/*efine PWDPOPEN			/* Invoke "pwd"			*/
X/*efine PWDGETENV	"PWD"		/* Get $PWD from environment	*/
X
X
X/*
X**  If you're a notes site, you might have to tweaks these two #define's.
X**  If you don't care, then set them equal to something that doesn't
X**  start with the comment-begin sequence and they'll be effectively no-ops
X**  at the cost of an extra strcmp.  I've also heard of broken MS-DOS
X**  compilers that don't ignore slash-star inside comments!  Anyhow, for
X**  more details see unshar.c
X*/
X/*efine NOTES1		"/* Written "	/* This is what notes 1.7 uses	*/
X/*efine NOTES2		"/* ---"	/* This is what notes 1.7 uses	*/
X#define NOTES1		"$$"		/* This is a don't care		*/
X#define NOTES2		"$$"		/* This is a don't care		*/
X
X
X/*
X**  The findsrc program uses the readdir() routines to read directories.
X**  If your system doesn't have this interface, there are public domain
X**  implementations available for Unix from the comp.sources.unix archives,
X**  GNU has a VMS one inside EMACS, and this package comes with kits for
X**  MS-DOS and the Amiga.  Help save the world and use or write a readdir()
X**  package for your system!
X*/
X
X/* Now then, where did I put that header file?   Pick one. */
X/*efine IN_SYS_DIR			/* <sys/dir.h>			*/
X/*efine IN_SYS_NDIR			/* <sys/ndir.h>			*/
X/*efine IN_DIR				/* <dir.h>			*/
X#define IN_DIRECT			/* <direct.h>			*/
X/*efine IN_NDIR				/* "ndir.h"			*/
X/*efine IN_DIRENT			/* <dirent.h>			*/
X
X/*  What readdir() returns.  Must be a #define because of #include order. */
X#ifdef	IN_DIRENT
X#define DIRENTRY	struct dirent
X#else
X#define DIRENTRY	struct direct
X#endif	/* IN_DIRENT */
X
X
X/*
X**  Limits.  The shell parser can be compiled with some safety-checks.
X**  This includes creating too many files, or writing long ones, creating
X**  too many directories, overwriting existing files, etc.
X*/
X/*efine PATH_CHECK			/* Check filenames in shars?	*/
X/*efine MAX_FOPENS	40		/* Max # of files/archive	*/
X/*efine MAX_LINES	1200		/* Max # of lines in a file	*/
X/*efine MAX_MKDIRS	10		/* Max directory depth		*/
X
X/*
X**  Congratulations, you're done!
X*/
END_OF_FILE
if test 6618 -ne `wc -c <'config.dos'`; then
    echo shar: \"'config.dos'\" unpacked with wrong size!
fi
# end of 'config.dos'
fi
if test -f 'config.hpx' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.hpx'\"
else
echo shar: Extracting \"'config.hpx'\" \(6559 characters\)
sed "s/^X//" >'config.hpx' <<'END_OF_FILE'
X/*
X**  Configuration file for shar and friends.
X**
X**  This is known to work on HP-UX 9000/300 /500 /800; it make work on
X**  other hockey-pucks, too.
X**
X**  $Header$
X*/
X
X
X/*
X**  Higher-level controls for which operating system we're running on.
X*/
X#define UNIX				/* Works			*/
X/*efine MSDOS				/* Should work			*/
X/*efine VMS				/* Doesn't work			*/
X
X
X/*
X**  A dense section of one-line compilation controls.  If you're confused,
X**  your best bet is to search through the source to see where and how
X**  each one of these is used.
X*/
X#define IDX		strchr		/* Maybe strchr?		*/
X#define RDX		strrchr		/* Maybe strrchr?		*/
X#define NEED_CTERMID			/* Don't make ctermid(3)?	*/
X/*efine NEED_MKDIR			/* Don't have mkdir(2)?		*/
X/*efine UNOS_MKDIR			/* Use makedir, not mkdir?	*/
X/*efine NEED_QSORT			/* Don't have qsort(3)?		*/
X/*efine NEED_GETOPT			/* Need local getopt object?	*/
X#define CAN_POPEN			/* Can invoke file(1) command?	*/
X/*efine USE_MY_SHELL			/* Don't popen("/bin/sh")?	*/
X/*efine void		int		/* If you don't have void	*/
X/*pedef void		 sigret_t;	/* What a signal handler returns */
Xtypedef int		 sigret_t;	/* What a signal handler returns */
Xtypedef int		*align_t;	/* Worst-case alignment, for lint */
X/*pedef long		time_t		/* Needed for non-BSD sites?	*/
X/*pedef long		off_t		/* Needed for non-BSD sites?	*/
X/*efine SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X#define HAS_VFORK			/* Have vfork only, no sys/wait.h */
X/*efine USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X/*efine USE_LONGJMP			/* Don't exit() within parser?	*/
X#define USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X#define USE_GETPWUID			/* Use getpwuid(3)?		*/
X#define DEF_SAVEIT	TRUE		/* Save headers by default?	*/
X#define UNIX_FILES			/* stat(file) gives true size?	*/
X#define NAME_FORMAT	"%s%2.2d"	/* To get things like Part02	*/
X/*efine NAME_FORMAT	"%s%02.2d"	/* To get things like Part02	*/
X#define MANI_FORMAT	" %-25s %2d\t%s\n"	/* This should be safe	*/
X#define MAX_LEVELS	6		/* Levels for findsrc to walk	*/
X#define THE_TTY		"/dev/tty"	/* Maybe "con:" for MS-DOS?	*/
X#define RCSID				/* Compile in the RCS strings?	*/
X#define USERNAME	"Sombody"	/* Your name, if not in environ	*/
X#define PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X/*efine DECLARE_PROTOTYPES		/* Use prototypes in our decls?	*/
X/*efine ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X#define REGISTER	register	/* Do you trust your compiler?	*/
X#define PEDAGOGY			/* Advertise tools?		*/
X
X
X/*
X**  How do we test to see if a character is okay to pass to one of
X**  the macros in <ctype.h>?  Note that we never give it EOF.
X*/
X#define CTYPE(c)	(isascii((c)))	/* Common			*/
X/*efine CTYPE(c)	((c) > 0)	/* Less common			*/
X/*efine CTYPE(c)	(TRUE)		/* Uncommon			*/
X
X
X/*
X**  We often want to make a backup copy of a file (usually a manifest).
X**  The following sets of #define's control how the copying is done.
X*/
X#define BU_VIA_RENAME			/* Use rename call?		*/
X/*efine BU_VIA_LINK			/* Use link/unlink calls?	*/
X/*efine BU_VIA_COPY			/* Use fopen() and such?	*/
X/*efine BU_NONE				/* System has generations?	*/
X/*efine BU_PREFIX	"B-"		/* Instead of ".BAK" suffix?	*/
X#define BU_SUFFIX	".BAK"		/* Instead of "B-" prefix?	*/
X#define BU_NAME_LEN	14		/* For non-BSD filesystems	*/
X
X
X/*
X**  The programs create up to two temporary files at one time, using
X**  mktemp(3).  Decide where you want the files to go, and if you wanna
X**  use a special directory for them (see MakeTempName).
X*/
X#define TEMP_NAME1	"/tmp/csharXXXXXX"	/* Unix			*/
X#define TEMP_NAME2	"/tmp/csharXXXXXX"	/* Unix			*/
X/*efine TEMP_NAME1	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME2	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME1	"sys$login:csharXXXXXX"	/* VMS			*/
X/*efine TEMP_NAME2	"sys$login:csharXXXXXX"	/* VMS			*/
X#define TEMPSIZE	40		/* Size of temp file name	*/
X/*efine TEMPVAR		"TMPDIR"	/* Place for temp files		*/
X
X
X/*
X**  There are several ways to get current machine name.  Enable just one
X**  of one of the following lines.
X*/
X#define GETHOSTNAME			/* Use gethostname(2) call	*/
X/*efine UNAME				/* Use uname(2) call		*/
X/*efine UUNAME				/* Invoke "uuname -l"		*/
X/*efine	WHOAMI		"/etc/whoami"	/* Try /etc/whoami & <whoami.h>	*/
X/*efine HOST_STRING			/* Just use DEF_HOST		*/
X#define DEF_HOST	"SITE"		/* If all else fails		*/
X
X
X/*
X**  There are several different ways to get the current working directory.
X**  Enable just one of the following lines.
X*/
X/*efine GETWD				/* Use getwd(3) routine		*/
X#define GETCWD				/* Use getcwd(3) routine	*/
X/*efine PWDPOPEN			/* Invoke "pwd"			*/
X/*efine PWDGETENV	"PWD"		/* Get $PWD from environment	*/
X
X
X/*
X**  If you're a notes site, you might have to tweaks these two #define's.
X**  If you don't care, then set them equal to something that doesn't
X**  start with the comment-begin sequence and they'll be effectively no-ops
X**  at the cost of an extra strcmp.  I've also heard of broken MS-DOS
X**  compilers that don't ignore slash-star inside comments!  Anyhow, for
X**  more details see unshar.c
X*/
X/*efine NOTES1		"/* Written "	/* This is what notes 1.7 uses	*/
X/*efine NOTES2		"/* ---"	/* This is what notes 1.7 uses	*/
X#define NOTES1		"$$"		/* This is a don't care		*/
X#define NOTES2		"$$"		/* This is a don't care		*/
X
X
X/*
X**  The findsrc program uses the readdir() routines to read directories.
X**  If your system doesn't have this interface, there are public domain
X**  implementations available for Unix from the comp.sources.unix archives,
X**  GNU has a VMS one inside EMACS, and this package comes with kits for
X**  MS-DOS and the Amiga.  Help save the world and use or write a readdir()
X**  package for your system!
X*/
X
X/* Now then, where did I put that header file?   Pick one. */
X/*efine IN_SYS_DIR			/* <sys/dir.h>			*/
X/*efine IN_SYS_NDIR			/* <sys/ndir.h>			*/
X/*efine IN_DIR				/* <dir.h>			*/
X/*efine IN_DIRECT			/* <direct.h>			*/
X#define IN_NDIR				/* "ndir.h"			*/
X/*efine IN_DIRENT			/* <dirent.h>			*/
X
X/*  What readdir() returns.  Must be a #define because of #include order. */
X#ifdef	IN_DIRENT
X#define DIRENTRY	struct dirent
X#else
X#define DIRENTRY	struct direct
X#endif	/* IN_DIRENT */
X
X
X/*
X**  Limits.  The shell parser can be compiled with some safety-checks.
X**  This includes creating too many files, or writing long ones, creating
X**  too many directories, overwriting existing files, etc.
X*/
X/*efine PATH_CHECK			/* Check filenames in shars?	*/
X/*efine MAX_FOPENS	40		/* Max # of files/archive	*/
X/*efine MAX_LINES	1200		/* Max # of lines in a file	*/
X/*efine MAX_MKDIRS	10		/* Max directory depth		*/
X
X
X/*
X**  Congratulations, you're done!
X*/
END_OF_FILE
if test 6559 -ne `wc -c <'config.hpx'`; then
    echo shar: \"'config.hpx'\" unpacked with wrong size!
fi
# end of 'config.hpx'
fi
if test -f 'config.x38' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'config.x38'\"
else
echo shar: Extracting \"'config.x38'\" \(6736 characters\)
sed "s/^X//" >'config.x38' <<'END_OF_FILE'
X/*
X**  Configuration file for shar and friends.
X**
X**  This config file is for Xenix on a 386 (and 286).
X**  In the Makefile, set DIRLIB=-lx, and tweak the MANDIR and 1 variables.
X**
X**  For a 286, you need '-F 2000' for unshar, and don't forget to use
X** '-M2' in the CFLAGS.
X**
X**  $Header: config.x386,v 2.1 88/06/06 22:05:52 rsalz Locked $
X*/
X
X
X/*
X**  Higher-level controls for which operating system we're running on.
X*/
X#define UNIX				/* Works			*/
X/*efine MSDOS				/* Should work			*/
X/*efine VMS				/* Doesn't work			*/
X
X
X/*
X**  A dense section of one-line compilation controls.  If you're confused,
X**  your best bet is to search through the source to see where and how
X**  each one of these is used.
X*/
X#define IDX		strchr		/* Maybe strchr?		*/
X#define RDX		strrchr		/* Maybe strrchr?		*/
X#define NEED_CTERMID			/* Don't make ctermid(3)?	*/
X#define NEED_MKDIR			/* Don't have mkdir(2)?		*/
X/*efine UNOS_MKDIR			/* Use makedir, not mkdir?	*/
X/*efine NEED_QSORT			/* Don't have qsort(3)?		*/
X/*efine NEED_GETOPT			/* Need local getopt object?	*/
X#define CAN_POPEN			/* Can invoke file(1) command?	*/
X/*efine USE_MY_SHELL			/* Don't popen("/bin/sh")?	*/
X/*efine void		int		/* If you don't have void	*/
X/*pedef void		 sigret_t;	/* What a signal handler returns */
Xtypedef int		 sigret_t;	/* What a signal handler returns */
Xtypedef int		*align_t;	/* Worst-case alignment, for lint */
X/*pedef long		time_t		/* Needed for non-BSD sites?	*/
X/*pedef long		off_t		/* Needed for non-BSD sites?	*/
X/*efine SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X/*efine HAS_VFORK			/* Have vfork but no <sys/wait.h> */
X/*efine USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X/*efine USE_LONGJMP			/* Don't exit() within parser?	*/
X#define USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X#define USE_GETPWUID			/* Use getpwuid(3)?		*/
X#define DEF_SAVEIT	TRUE		/* Save headers by default?	*/
X#define UNIX_FILES			/* stat(file) gives true size?	*/
X#define NAME_FORMAT	"%s%2.2d"	/* To get things like Part02	*/
X/*efine NAME_FORMAT	"%s%02.2d"	/* To get things like Part02	*/
X#define MANI_FORMAT	" %-25s %2d\t%s\n"	/* This should be safe	*/
X#define MAX_LEVELS	6		/* Levels for findsrc to walk	*/
X#define THE_TTY		"/dev/tty"	/* Maybe "con:" for MS-DOS?	*/
X#define RCSID				/* Compile in the RCS strings?	*/
X#define USERNAME	"Someone"	/* Your name, if not in environ	*/
X#define PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X/*efine DECLARE_PROTOTYPES		/* Use prototypes in our decls?	*/
X/*efine ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X#define REGISTER	register	/* Do you trust your compiler?	*/
X#define PEDAGOGY			/* Advertise tools?		*/
X
X
X/*
X**  How do we test to see if a character is okay to pass to one of
X**  the macros in <ctype.h>?  Note that we never give it EOF.
X*/
X#define CTYPE(c)	(isascii((c)))	/* Common			*/
X/*efine CTYPE(c)	((c) > 0)	/* Less common			*/
X/*efine CTYPE(c)	(TRUE)		/* Uncommon			*/
X
X
X/*
X**  We often want to make a backup copy of a file (usually a manifest).
X**  The following sets of #define's control how the copying is done.
X*/
X/*efine BU_VIA_RENAME			/* Use rename call?		*/
X#define BU_VIA_LINK			/* Use link/unlink calls?	*/
X/*efine BU_VIA_COPY			/* Use fopen() and such?	*/
X/*efine BU_NONE				/* System has generations?	*/
X/*efine BU_PREFIX	"B-"		/* Instead of ".BAK" suffix?	*/
X#define BU_SUFFIX	".BAK"		/* Instead of "B-" prefix?	*/
X#define BU_NAME_LEN	14		/* For non-BSD filesystems	*/
X
X
X/*
X**  The programs create up to two temporary files at one time, using
X**  mktemp(3).  Decide where you want the files to go, and if you wanna
X**  use a special directory for them (see MakeTempName).
X*/
X#define TEMP_NAME1	"/tmp/csharXXXXXX"	/* Unix			*/
X#define TEMP_NAME2	"/tmp/csharXXXXXX"	/* Unix			*/
X/*efine TEMP_NAME1	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME2	"csharXXXXXX"		/* MS-DOS		*/
X/*efine TEMP_NAME1	"sys$login:csharXXXXXX"	/* VMS			*/
X/*efine TEMP_NAME2	"sys$login:csharXXXXXX"	/* VMS			*/
X#define TEMPSIZE	40		/* Size of temp file name	*/
X/*efine TEMPVAR		"TMPDIR"	/* Place for temp files		*/
X
X
X/*
X**  There are several ways to get current machine name.  Enable just one
X**  of one of the following lines.
X*/
X/*efine GETHOSTNAME			/* Use gethostname(2) call	*/
X#define UNAME				/* Use uname(2) call		*/
X/*efine UUNAME				/* Invoke "uuname -l"		*/
X/*efine	WHOAMI		"/etc/whoami"	/* Try /etc/whoami & <whoami.h>	*/
X/*efine HOST_STRING			/* Just use DEF_HOST		*/
X#define DEF_HOST	"SITE"		/* If all else fails		*/
X
X
X/*
X**  There are several different ways to get the current working directory.
X**  Enable just one of the following lines.
X*/
X/*efine GETWD				/* Use getwd(3) routine		*/
X#define GETCWD				/* Use getcwd(3) routine	*/
X/*efine PWDPOPEN			/* Invoke "pwd"			*/
X/*efine PWDGETENV	"PWD"		/* Get $PWD from environment	*/
X
X
X/*
X**  If you're a notes site, you might have to tweaks these two #define's.
X**  If you don't care, then set them equal to something that doesn't
X**  start with the comment-begin sequence and they'll be effectively no-ops
X**  at the cost of an extra strcmp.  I've also heard of broken MS-DOS
X**  compilers that don't ignore slash-star inside comments!  Anyhow, for
X**  more details see unshar.c
X*/
X/*efine NOTES1		"/* Written "	/* This is what notes 1.7 uses	*/
X/*efine NOTES2		"/* ---"	/* This is what notes 1.7 uses	*/
X#define NOTES1		"$$"		/* This is a don't care		*/
X#define NOTES2		"$$"		/* This is a don't care		*/
X
X
X/*
X**  The findsrc program uses the readdir() routines to read directories.
X**  If your system doesn't have this interface, there are public domain
X**  implementations available for Unix from the comp.sources.unix archives,
X**  GNU has a VMS one inside EMACS, and this package comes with kits for
X**  MS-DOS and the Amiga.  Help save the world and use or write a readdir()
X**  package for your system!
X*/
X
X/* Now then, where did I put that header file?   Pick one. */
X/*efine IN_SYS_DIR			/* <sys/dir.h>			*/
X#define IN_SYS_NDIR			/* <sys/ndir.h>			*/
X/*efine IN_DIR				/* <dir.h>			*/
X/*efine IN_DIRECT			/* <direct.h>			*/
X/*efine IN_NDIR				/* "ndir.h"			*/
X/*efine IN_DIRENT			/* <dirent.h>			*/
X
X/*  What readdir() returns.  Must be a #define because of #include order. */
X#ifdef	IN_DIRENT
X#define DIRENTRY	struct dirent
X#else
X#define DIRENTRY	struct direct
X#endif	/* IN_DIRENT */
X
X
X/*
X**  Limits.  The shell parser can be compiled with some safety-checks.
X**  This includes creating too many files, or writing long ones, creating
X**  too many directories, overwriting existing files, etc.
X*/
X/*efine PATH_CHECK			/* Check filenames in shars?	*/
X/*efine MAX_FOPENS	40		/* Max # of files/archive	*/
X/*efine MAX_LINES	1200		/* Max # of lines in a file	*/
X/*efine MAX_MKDIRS	10		/* Max directory depth		*/
X
X
X/*
X**  Congratulations, you're done!
X*/
END_OF_FILE
if test 6736 -ne `wc -c <'config.x38'`; then
    echo shar: \"'config.x38'\" unpacked with wrong size!
fi
# end of 'config.x38'
fi
if test -f 'findsrc.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'findsrc.c'\"
else
echo shar: Extracting \"'findsrc.c'\" \(7772 characters\)
sed "s/^X//" >'findsrc.c' <<'END_OF_FILE'
X/*
X**  FINDSRC
X**
X**  Walk directories, trying to find source files.
X*/
X#include "shar.h"
X#ifdef	RCSID
Xstatic char RCS[] =
X	"$Header: findsrc.c,v 2.2 88/06/06 22:04:03 rsalz Exp $";
X#endif	/* RCSID */
X
X
X/*
X**  Global variables.
X*/
Xstatic int	 DoDOTFILES;		/* Do .newsrc and friends?	*/
Xstatic int	 DoRCS;			/* Do RCS and SCCS files?	*/
Xstatic int	 Default;		/* Default answer from user	*/
Xstatic int	 Verbose;		/* List rejected files, too?	*/
Xstatic char	 Dname[TEMPSIZE];	/* Filename of directory list	*/
Xstatic char	 Fname[TEMPSIZE];	/* Filename of file list	*/
Xstatic FILE	*Dfile;			/* List of directories found	*/
Xstatic FILE	*Ffile;			/* List of files found		*/
Xstatic FILE	*DEVTTY;		/* The tty, if in filter mode	*/
X
X
X/*
X**  Signal handler.  Clean up and die.
X*/
Xstatic sigret_t
XFCatch(s)
X    int		 s;
X{
X    int		 e;
X
X    e = errno;
X    if (Dname[0])
X	(void)unlink(Dname);
X    if (Fname[0])
X	(void)unlink(Fname);
X    Fprintf(stderr, "Got signal %d, %s.\n", s, Ermsg(e));
X    exit(1);
X    /* NOTREACHED */
X}
X
X
X/*
X**  Given a filename, apply heuristics to see if we want it.
X*/
Xstatic int
XWanted(Name)
X    REGISTER char	*Name;
X{
X    REGISTER FILE	*F;
X    REGISTER char	*s;
X    REGISTER char	*p;
X    REGISTER char	*d;
X    char		 buff[BUFSIZ];
X
X    /* Get down to brass tacks. */
X    s = (p = RDX(Name, '/')) ? p + 1 : Name;
X
X    /* Only do directories other than . and .. and regular files. */
X    if ((Ftype(Name) != F_DIR && Ftype(Name) != F_FILE)
X     || EQ(s, ".") || EQ(s, ".."))
X	return FALSE;
X
X    /* Common cruft we never want. */
X    if (EQ(s, "foo") || EQ(s, "core") || EQ(s, "tags") || EQ(s, "lint"))
X	return FALSE;
X
X    /* Disregard stuff with bogus suffixes. */
X    d = RDX(s, '.');
X    if ((p = d)
X     && (EQ(++p, "out") || EQ(p, "orig") || EQ(p, "rej") || EQ(p, "BAK")
X      || EQ(p, "CKP") || EQ(p, "old") || EQ(p, "o") || EQ(p, "EXE")
X      || EQ(p, "OBJ")))
X	return FALSE;
X
X    /* Want .cshrc, .newsrc, etc.? */
X    if (*s == '.' && CTYPE(s[1]) && isalpha(s[1]))
X	return DoDOTFILES;
X
X    /* RCS or SCCS file or directory? */
X    if (EQ(s, "RCS")
X     || ((p = RDX(s, ',')) && *++p == 'v' && *++p == '\0')
X     || EQ(s, "SCCS") || (s[0] == 's' && s[1] == '.'))
X	return DoRCS;
X
X    /* Mlisp, m4 (yes to .m? but no to .mo)? */
X    /* really, no to .mo but yes to names matching the regexp ".m?" */
X    if ((p = d) && *++p == 'm' && p[2] == '\0')
X	return *++p != 'o';
X
X    /* Gnu Emacs elisp (yes to .el*, but no to .elc)? */
X    if ((p = d) && *++p == 'e' && *++p == 'l')
X	return *++p != 'c' || *++p;
X
X    /* C source (*.[ch])? */
X    if ((p = d) && (*++p == 'c' || *p == 'h') && *++p == '\0')
X	return TRUE;
X
X    /* Manpage (*.[1234567890] or *.man)? */
X    if ((p = d) && CTYPE(s[1]) && isdigit(*p))
X	return TRUE;
X    if ((p = d) && *++p == 'm' && *++p == 'a' && *++p == 'n')
X	return TRUE;
X
X    /* Make control file? */
X    if ((*s == 'M' || *s == 'm') && EQ(s + 1, "akefile"))
X	return TRUE;
X
X    /* VMS makefile? */
X    if (EQ(s, "descrip.mms"))
X	return TRUE;
X
X    /* Convert to lowercase, and see if it's a README or MANIFEST. */
X    for (p = strcpy(buff, s); *p; p++)
X	if (CTYPE(*p) && isupper(*p))
X	    *p = tolower(*p);
X    if (EQ(buff, "readme") || EQ(buff, "read_me") || EQ(buff, "read-me")
X     || EQ(buff, "read.me") || EQ(buff, "manifest"))
X	return TRUE;
X
X    /* Larry Wall-style template file (*.SH)? */
X    if ((p = d) && *++p == 'S' && *++p == 'H')
X	return TRUE;
X
X    /* If we have a default, give it back. */
X    if (Default)
X	return Default == 'y';
X
X#ifdef	CAN_POPEN
X    /* See what file(1) has to say; if it says executable, punt. */
X    (void)sprintf(buff, "exec file '%s'", Name);
X    if (F = popen(buff, "r")) {
X	(void)fgets(buff, sizeof buff, F);
X	(void)pclose(F);
X	for (p = buff; p = IDX(p, 'e'); p++)
X	    if (PREFIX(p, "executable"))
X		return FALSE;
X	(void)fputs(buff, stderr);
X    }
X    else
X	Fprintf(stderr, "%s -- ", Name);
X#else
X    Fprintf(stderr, "%s -- ", Name);
X#endif	/* CAN_POPEN */
X
X    /* Add it? */
X    while (TRUE) {
X	if (DEVTTY == NULL)
X	    DEVTTY = fopen(ctermid((char *)NULL), "r");
X	Fprintf(stderr, "Add this one (y or n)[y]?  ");
X	(void)fflush(stderr);
X	if (fgets(buff, sizeof buff, DEVTTY) == NULL
X	 || buff[0] == '\n' || buff[0] == 'y' || buff[0] == 'Y')
X	    break;
X	if (buff[0] == 'n' || buff[0] == 'N')
X	    return FALSE;
X	if (buff[0] == '!' )
X	    (void)system(&buff[1]);
X	Fprintf(stderr, "--------------------\n%s:  ", Name);
X	clearerr(DEVTTY);
X    }
X    return TRUE;
X}
X
X
X/*
X**  Quick and dirty recursive routine to walk down directory tree.
X**  Could be made more general, but why bother?
X*/
Xstatic void
XProcess(p, level)
X    REGISTER char	 *p;
X    REGISTER int	  level;
X{
X    REGISTER char	 *q;
X    DIR			 *Dp;
X    DIRENTRY		 *E;
X    char		  buff[BUFSIZ];
X
X#ifdef	MSDOS
X    /* Downcase the path.  I dunno why, somebody told me to. */
X    for (q = p; *q; q++)
X	if (CTYPE(*q) && isupper(*q))
X	    *q = tolower(*q);
X#endif	/* MSDOS */
X
X    if (!GetStat(p))
X	Fprintf(stderr, "Can't walk down %s, %s.\n", p, Ermsg(errno));
X    else {
X	/* Skip leading ./ which find(1), e.g., likes to put out. */
X	if (p[0] == '.' && p[1] == '/')
X	    p += 2;
X
X	if (Wanted(p))
X	    Fprintf(Ftype(p) == F_FILE ? Ffile : Dfile, "%s\n", p);
X	else if (Verbose)
X	    Fprintf(Ftype(p) == F_FILE ? Ffile : Dfile, "PUNTED %s\n", p);
X
X	if (Ftype(p) == F_DIR)
X	    if (++level == MAX_LEVELS)
X		Fprintf(stderr, "Won't walk down %s -- more than %d levels.\n",
X			p, level);
X	    else if (Dp = opendir(p)) {
X		q = buff + strlen(strcpy(buff, p));
X		for (*q++ = '/'; E = readdir(Dp); )
X		    if (!EQ(E->d_name, ".") && !EQ(E->d_name, "..")) {
X			(void)strcpy(q, E->d_name);
X			Process(buff, level);
X		    }
X		(void)closedir(Dp);
X	    }
X	    else
X		Fprintf(stderr, "Can't open directory %s, %s.\n",
X			p, Ermsg(errno));
X    }
X}
X
X
Xmain(ac, av)
X    REGISTER int	 ac;
X    REGISTER char	*av[];
X{
X    REGISTER char	*p;
X    REGISTER int	 i;
X    REGISTER int	 Oops;
X    char		 buff[BUFSIZ];
X
X    /* Parse JCL. */
X    for (Oops = FALSE; (i = getopt(ac, av, "d:ho:rsv")) != EOF; )
X	switch (i) {
X	default:
X	    Oops = TRUE;
X	    break;
X	case 'd':
X	    switch (optarg[0]) {
X	    default:
X		Oops = TRUE;
X		break;
X	    case 'y':
X	    case 'Y':
X		Default = 'y';
X		break;
X	    case 'n':
X	    case 'N':
X		Default = 'n';
X		break;
X	    }
X	    break;
X	case 'h':
X	    DoDOTFILES = TRUE;
X	    break;
X	case 'o':
X	    if (freopen(optarg, "w", stdout) == NULL) {
X		Fprintf(stderr, "Can't open %s for output, %s.\n",
X			optarg, Ermsg(errno));
X		exit(1);
X		/* NOTREACHED */
X	    }
X	    break;
X	case 'r':
X	case 's':
X	    DoRCS = TRUE;
X	    break;
X	case 'v':
X	    Verbose = TRUE;
X	    break;
X	}
X    ac -= optind;
X    av += optind;
X
X    if (Oops) {
X	Fprintf(stderr, "Usage:\n  findsrc %s files...\n",
X		"[-d{yn}] [-h] [-o name] [-r] [-s] [-v]");
X	exit(1);
X	/* NOTREACHED */
X    }
X
X    /* Open temp files, set signal catcher. */
X    MakeTempName(Dname, TEMP_NAME1);
X    Dfile = fopen(Dname, "w");
X    MakeTempName(Fname, TEMP_NAME2);
X    Ffile = fopen(Fname, "w");
X    SetSigs(FCatch);
X
X    /* Read list of files, determine their status. */
X    if (*av)
X	for (DEVTTY = stdin; *av; av++)
X	    Process(*av, 0);
X    else
X	while (fgets(buff, sizeof buff, stdin)) {
X	    if (p = IDX(buff, '\n'))
X		*p = '\0';
X	    else
X		Fprintf(stderr, "Warning, line too long:\n\t%s\n", buff);
X	    Process(buff, 0);
X	}
X
X    /* First print directories. */
X    if (freopen(Dname, "r", Dfile)) {
X	while (fgets(buff, sizeof buff, Dfile))
X	    (void)fputs(buff, stdout);
X	(void)fclose(Dfile);
X    }
X
X    /* Now print regular files. */
X    if (freopen(Fname, "r", Ffile)) {
X	while (fgets(buff, sizeof buff, Ffile))
X	    (void)fputs(buff, stdout);
X	(void)fclose(Ffile);
X    }
X
X    /* That's all she wrote. */
X    (void)unlink(Dname);
X    (void)unlink(Fname);
X    exit(0);
X    /* NOTREACHED */
X}
END_OF_FILE
if test 7772 -ne `wc -c <'findsrc.c'`; then
    echo shar: \"'findsrc.c'\" unpacked with wrong size!
fi
# end of 'findsrc.c'
fi
echo shar: End of archive 3 \(of 5\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 archives.
    echo "Now go find those bugs, and report them to rsalz@uunet.uu.net"
    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
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.