v15i031: Tools to create and unpack shell archives, Patch1

Rich Salz rsalz at uunet.uu.net
Sat Jun 4 02:21:00 AEST 1988


Submitted-by: Rich Salz <rsalz at bbn.com>
Posting-number: Volume 15, Issue 31
Archive-name: cshar/patch1

This patch includes ports to SysVrel3.1, SysVrel3.2, Xenix, and now always
puts out a leading 'X' unless the otherwise undocumented -DTOO_FANCY flag
is used.

Description:
    From: Chuck Musciano <chuck at trantor.harris-atd.com>
    +In shar.c, main() didn't initialize Flist.

    From: Geoff Scully <egvideo!gws>
    +Here is a config.h file for Xenix on a 386.
    +Setting DIRLIB=-lx in Makefile results in "can't make -lx" errors.

    From: John L. Chmielewski <attmail!jlc> <ihnp4!rogue!jlc>
    +Here is a config.h file for System V release 3.1 or 3.2.
    +The synopsis and usage message for makekit were incomplete.
    +An fprintf was wrong, and could crash or print garbage if you
     try to findsrc a non-existant directory.
    +The file "dirent.h" is really <dirent.h>
    +There were a few niggling declaration inconsistancies that cause
     ANSI-ish compilers to complain.

    From: Rich $alz <rsalz at bbn.com>
    +The ctype macros (isdigit(), etc.) can cause problems if handed
     non-ASCII characters.

Fix:
    To aid in robustness, patches are not shipped "raw"; I apologize for
    the inconvenience.  Save this message and unshar it; from rn, say
    "|unshar -d DIR", where DIR is your cshar source directory.  Outside
    of rn, say "cd DIR; unshar <thisarticle".  This will create a file
    called patch01, which you can then feed to the patch program.

    If you don't have the patch program, make the changes by hand, or get
    patch.

    If patch indicates that patchlevel is the wrong version, you may need
    to apply one or more previous patches, or the patch may already have
    been applied.  See the patchlevel.h file to find out what has or has
    not been applied.  In any event, don't continue with the patch.

    If any patches are missing, they can be obtained from your nearest
    comp.sources.unix archive.

#! /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 shell archive."
# Contents:  patch01
# Wrapped by rsalz at fig.bbn.com on Fri Jun  3 12:17:51 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patch01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patch01'\"
else
echo shar: Extracting \"'patch01'\" \(29598 characters\)
sed "s/^X//" >'patch01' <<'END_OF_FILE'
Index: patchlevel.h
Prereq: 2.0
X
X*** /tmp/,RCSt1a25600	Fri Jun  3 12:17:03 1988
X--- patchlevel.h	Fri Jun  3 12:16:45 1988
X***************
X*** 2,10 ****
X  **  This file records official patches.  RCS records the edit log.
X  **
X  **  $Log:	patchlevel.h,v $
X  **  Revision 2.0  88/05/27  13:32:13  rsalz
X  **  First comp.sources.unix release
X- **  
X- **  
X  */
X! #define PATCHLEVEL 0
X--- 2,19 ----
X  **  This file records official patches.  RCS records the edit log.
X  **
X  **  $Log:	patchlevel.h,v $
X+ **  Revision 2.1  88/06/03  12:16:40  rsalz
X+ **  patch01:  Add config.x386 and config.sVr3; change "dirent.h" to <dirent.h>
X+ **  patch01:  In Makefile, use $(DIRLIB) only in actions, not dependencies;
X+ **  patch01:  add /usr/man/local option for MANDIR.
X+ **  patch01:  Put isascii() before every use of a <ctype.h> macro. 
X+ **  patch01:  Initialize Flist in shar.c/main().
X+ **  patch01:  Add -x to synopsis in makekit.man; improve the usage message and
X+ **  patch01:  put comments around note after an #endif (ANSI strikes again).
X+ **  patch01:  Remove extraneous declaration of Dispatch[] in parser.c
X+ **  patch01:  Add missing argument in fprintf call in findsrc.
X+ **  
X  **  Revision 2.0  88/05/27  13:32:13  rsalz
X  **  First comp.sources.unix release
X  */
X! #define PATCHLEVEL 1
X*** /tmp/,RCSt1a25447	Fri Jun  3 12:06:03 1988
X--- MANIFEST	Fri Jun  3 12:05:42 1988
X***************
X*** 4,11 ****
X   Makefile                   1	Control file for Unix make program
X   README                     1	Acknowledgements, installation notes
X   config.h                   1	Default configuration file
X   dir.amiga                  2	A partial Amiga readdir package
X!  dir.msdos                  1	An MS-DOS readdir package
X   findsrc.c                  2	Find source files, based on filename
X   findsrc.man                1	Manual page for findsrc
X   glue.c                     1	Glue that so unshar uses my /bin/sh parser
X--- 4,13 ----
X   Makefile                   1	Control file for Unix make program
X   README                     1	Acknowledgements, installation notes
X   config.h                   1	Default configuration file
X+  config.sVr3                1	Configuration for SystemV Releases 3.1 and 3.2
X+  config.x386                1	configuration for Xenix on a 386
X   dir.amiga                  2	A partial Amiga readdir package
X!  dir.msdos                  2	An MS-DOS readdir package
X   findsrc.c                  2	Find source files, based on filename
X   findsrc.man                1	Manual page for findsrc
X   glue.c                     1	Glue that so unshar uses my /bin/sh parser
X***************
X*** 17,23 ****
X   lmem.c                     1	Memory allocator, uses calloc
X   luser.c                    1	Get user's name
X   makekit.c                  2	Partition files into reasonable-sized kits
X!  makekit.man                1	Manual page for makekit
X   parser.c                   3	Interpreter for shell archives
X   patchlevel.h               1	Mistake recorder
X   shar.c                     2	Create script to create files
X--- 19,25 ----
X   lmem.c                     1	Memory allocator, uses calloc
X   luser.c                    1	Get user's name
X   makekit.c                  2	Partition files into reasonable-sized kits
X!  makekit.man                2	Manual page for makekit
X   parser.c                   3	Interpreter for shell archives
X   patchlevel.h               1	Mistake recorder
X   shar.c                     2	Create script to create files
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:53:57 1988
X--- Makefile	Fri Jun  3 11:52:32 1988
X***************
X*** 1,10 ****
X  ##
X  ##  SOURCE-SHIPPING TOOLS MAKEFILE
X! ##  $Header: Makefile,v 2.0 88/05/27 13:29:42 rsalz Exp $
X! ##  $Log:	Makefile,v $
X! # Revision 2.0  88/05/27  13:29:42  rsalz
X! # First comp.sources.unix release
X! # 
X  ##
X  
X  ## Grrrr...
X--- 1,6 ----
X  ##
X  ##  SOURCE-SHIPPING TOOLS MAKEFILE
X! ##  $Header: Makefile,v 2.1 88/06/03 11:38:35 rsalz Exp $
X  ##
X  
X  ## Grrrr...
X***************
X*** 34,39 ****
X--- 30,39 ----
X  1	= 1
X  #MANDIR	= /usr/man/u_man/manl
X  #1	= 1L
X+ #MANDIR	= /usr/man/local
X+ #1	= 1
X+ #MANDIR	= /usr/man/man.M
X+ #1	= M
X  
X  ##
X  ##  END OF CONFIGURATION SECTION
X***************
X*** 41,47 ****
X  
X  ##  Header files.
X  HDRS	= shar.h config.h
X! LIB	= lib.a $(DIRLIB)
X  
X  ##  Programs and documentation.
X  PROGRAMS= findsrc    makekit    shar    unshar    shell
X--- 41,47 ----
X  
X  ##  Header files.
X  HDRS	= shar.h config.h
X! LIB	= lib.a
X  
X  ##  Programs and documentation.
X  PROGRAMS= findsrc    makekit    shar    unshar    shell
X***************
X*** 81,103 ****
X  ##  Programs.
X  findsrc:	findsrc.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o findsrc findsrc.o $(LIB)
X  
X  makekit:	makekit.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o makekit makekit.o $(LIB)
X  
X  shar:		shar.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o shar shar.o $(LIB)
X  
X  shell:		shell.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o shell shell.o $(LIB)
X  
X  unshar:		unshar.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o unshar unshar.c $(LIB)
X  
X  
X  ##  Special case, a version of unshar that uses the /bin/sh interpreter.
X--- 81,103 ----
X  ##  Programs.
X  findsrc:	findsrc.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o findsrc findsrc.o $(LIB) $(DIRLIB)
X  
X  makekit:	makekit.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o makekit makekit.o $(LIB) $(DIRLIB)
X  
X  shar:		shar.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o shar shar.o $(LIB) $(DIRLIB)
X  
X  shell:		shell.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o shell shell.o $(LIB) $(DIRLIB)
X  
X  unshar:		unshar.o $(HDRS) $(LIB)
X  	@rm -f $@
X! 	$(CC) $(CFLAGS) -o unshar unshar.o $(LIB) $(DIRLIB)
X  
X  
X  ##  Special case, a version of unshar that uses the /bin/sh interpreter.
X***************
X*** 104,110 ****
X  unshar.safe:	unshar.c $(HDRS) $(LIB)
X  	@rm -f $@
X  	@rm -f unshar.o
X! 	$(CC) $(CFLAGS) -DUSE_MY_SHELL -o unshar unshar.c $(LIB)
X  	@rm -f unshar.o
X  
X  
X--- 104,110 ----
X  unshar.safe:	unshar.c $(HDRS) $(LIB)
X  	@rm -f $@
X  	@rm -f unshar.o
X! 	$(CC) $(CFLAGS) -DUSE_MY_SHELL -o unshar unshar.c $(LIB) $(DIRLIB)
X  	@rm -f unshar.o
X  
X  
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:00 1988
X--- config.h	Fri Jun  3 11:52:38 1988
X***************
X*** 4,10 ****
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.0 88/05/27 13:15:39 rsalz Exp $
X  */
X  
X  
X--- 4,10 ----
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.1 88/06/03 11:38:40 rsalz Exp $
X  */
X  
X  
X***************
X*** 98,104 ****
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--- 98,104 ----
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*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:03 1988
X--- findsrc.c	Fri Jun  3 11:52:49 1988
X***************
X*** 5,11 ****
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: findsrc.c,v 2.0 88/05/27 13:26:05 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X--- 5,11 ----
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: findsrc.c,v 2.1 88/06/03 11:38:51 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X***************
X*** 76,82 ****
X  	return(FALSE);
X  
X      /* Want .cshrc, .newsrc, etc.? */
X!     if (*s == '.' && isalpha(s[1]))
X  	return(DoDOTFILES);
X  
X      /* RCS or SCCS file or directory? */
X--- 76,82 ----
X  	return(FALSE);
X  
X      /* Want .cshrc, .newsrc, etc.? */
X!     if (*s == '.' && isascii(s[1]) && isalpha(s[1]))
X  	return(DoDOTFILES);
X  
X      /* RCS or SCCS file or directory? */
X***************
X*** 98,104 ****
X      if ((p = d) && (*++p == 'c' || *p == 'h') && *++p == '\0')
X  
X      /* Manpage (*.[1234567890] or *.man)? */
X!     if ((p = d) && isdigit(*p))
X  	return(TRUE);
X      if ((p = d) && *++p == 'm' && *++p == 'a' && *++p == 'n')
X  	return(TRUE);
X--- 98,104 ----
X      if ((p = d) && (*++p == 'c' || *p == 'h') && *++p == '\0')
X  
X      /* Manpage (*.[1234567890] or *.man)? */
X!     if ((p = d) && isascii(s[1]) && isdigit(*p))
X  	return(TRUE);
X      if ((p = d) && *++p == 'm' && *++p == 'a' && *++p == 'n')
X  	return(TRUE);
X***************
X*** 175,181 ****
X  #endif	/* MSDOS */
X  
X      if (!GetStat(p))
X! 	Fprintf(stderr, "Can't walk down %s, %s.\n", Ermsg(errno));
X      else {
X  	/* Skip leading ./ which find(1), e.g., likes to put out. */
X  	if (p[0] == '.' && p[1] == '/')
X--- 175,181 ----
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*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:09 1988
X--- makekit.c	Fri Jun  3 11:53:06 1988
X***************
X*** 5,11 ****
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: makekit.c,v 2.0 88/05/27 13:27:31 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X--- 5,11 ----
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: makekit.c,v 2.1 88/06/03 11:38:58 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X***************
X*** 51,57 ****
X  char	*TEMP;				/* Temporary manifest file	*/
X  #ifdef	MSDOS
X  char	*FLST;				/* File with list for shar	*/
X! #endif	MSDOS
X  int	 ArkCount = 20;			/* Max number of archives	*/
X  int	 ExcludeIt;			/* Leave out the output file?	*/
X  int	 Header;			/* Lines of prolog in input	*/
X--- 51,57 ----
X  char	*TEMP;				/* Temporary manifest file	*/
X  #ifdef	MSDOS
X  char	*FLST;				/* File with list for shar	*/
X! #endif	/* MSDOS */
X  int	 ArkCount = 20;			/* Max number of archives	*/
X  int	 ExcludeIt;			/* Leave out the output file?	*/
X  int	 Header;			/* Lines of prolog in input	*/
X***************
X*** 163,171 ****
X      while ((i = getopt(ac, av, "1eh:i:k:n:mo:p:s:t:x")) != EOF)
X  	switch (i) {
X  	default:
X! 	    Fprintf(stderr,
X! "usage: makekit -e -s# [-m | -iMANIFEST -oMANIFEST -h2] -nName -tText files..."
X! 		    );
X  	    exit(1);
X  	case '1':
X  	    Notkits = TRUE;
X--- 163,171 ----
X      while ((i = getopt(ac, av, "1eh:i:k:n:mo:p:s:t:x")) != EOF)
X  	switch (i) {
X  	default:
X! 	    Fprintf(stderr, "usage: makekit %s\n        %s\n",
X! 		    "[-1] [-e] [-x] [-k #] [-s #[k]] [-n Name] [-t Text]",
X! 		    "[-p] [-m | -i MANIFEST -o MANIFEST -h 2] [file ...]");
X  	    exit(1);
X  	case '1':
X  	    Notkits = TRUE;
X***************
X*** 266,272 ****
X  	    *p++ = '\0';
X  
X  	/* Skip <spaces><digits><spaces>; remainder is the file description. */
X! 	for (p = Skip(p); *p && isdigit(*p); )
X  	    p++;
X  	t->Text = Skip(p);
X  
X--- 266,272 ----
X  	    *p++ = '\0';
X  
X  	/* Skip <spaces><digits><spaces>; remainder is the file description. */
X! 	for (p = Skip(p); *p && isascii(*p) && isdigit(*p); )
X  	    p++;
X  	t->Text = Skip(p);
X  
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:14 1988
X--- makekit.man	Fri Jun  3 11:53:08 1988
X***************
X*** 1,5 ****
X  .TH MAKEKIT 1l
X! .\" $Header: makekit.man,v 2.0 88/05/27 13:28:41 rsalz Exp $
X  .SH NAME
X  makekit \- split files up into shell archive packages
X  .SH SYNOPSIS
X--- 1,5 ----
X  .TH MAKEKIT 1l
X! .\" $Header: makekit.man,v 2.1 88/06/03 11:39:05 rsalz Exp $
X  .SH NAME
X  makekit \- split files up into shell archive packages
X  .SH SYNOPSIS
X***************
X*** 9,14 ****
X--- 9,16 ----
X  ] [
X  [
X  .B -e
X+ ] [
X+ .B -x
X  ] [
X  .BI -h\| #
X  ] [
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:20 1988
X--- parser.c	Fri Jun  3 11:53:11 1988
X***************
X*** 11,17 ****
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: parser.c,v 2.0 88/05/27 13:27:39 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X--- 11,17 ----
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: parser.c,v 2.1 88/06/03 11:39:11 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X***************
X*** 66,72 ****
X  jmp_buf		 jEnv;			/* Pop out of main loop		*/
X  #endif	MSDOS
X  
X- extern COMTAB	 Dispatch[];		/* Defined below...		*/
X  static VAR	 VarList[MAX_VARS];	/* Our list of variables	*/
X  static char	 Text[BUFSIZ];		/* Current text line		*/
X  static int	 LineNum = 1;		/* Current line number		*/
X--- 66,71 ----
X***************
X*** 782,788 ****
X  	return(!EQ(Expand(av[0]), Expand(av[2])) ? V : !V);
X  
X      /* Testing a file's size? */
X!     if (ac == (av[5] && EQ(av[5], "<") ? 8 : 7) && isdigit(av[0][0])
X       && (EQ(av[1], "-ne") || EQ(av[1], "-eq"))
X       && EQ(av[2], "`") && EQ(av[3], "wc")
X       && EQ(av[4], "-c") && EQ(av[ac - 1], "`")) {
X--- 781,788 ----
X  	return(!EQ(Expand(av[0]), Expand(av[2])) ? V : !V);
X  
X      /* Testing a file's size? */
X!     if (ac == (av[5] && EQ(av[5], "<") ? 8 : 7)
X!      && isascii(av[0][0]) && isdigit(av[0][0])
X       && (EQ(av[1], "-ne") || EQ(av[1], "-eq"))
X       && EQ(av[2], "`") && EQ(av[3], "wc")
X       && EQ(av[4], "-c") && EQ(av[ac - 1], "`")) {
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:27 1988
X--- shar.c	Fri Jun  3 11:53:15 1988
X***************
X*** 5,11 ****
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: shar.c,v 2.0 88/05/27 14:10:47 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  /*
X--- 5,11 ----
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: shar.c,v 2.1 88/06/03 11:51:12 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  /*
X***************
X*** 74,84 ****
X  	/* Output the file contents. */
X  	for (Bads = 0; fgets(buf, BUFSIZ, stdin); )
X  	    if (buf[0]) {
X  		if (buf[0] == 'X' || buf[0] == 'E' || buf[0] == 'F'
X! 		 || !isalpha(buf[0]))
X  		    /* Protect non-alpha's, the shar pattern character, the
X  		     * END_OF_FILE message, and mail "From" lines. */
X  		    (void)putchar('X');
X  		for (s = buf; *s; s++) {
X  		    if (BADCHAR(*s))
X  			Bads++;
X--- 74,89 ----
X  	/* Output the file contents. */
X  	for (Bads = 0; fgets(buf, BUFSIZ, stdin); )
X  	    if (buf[0]) {
X+ #ifdef	TOO_FANCY
X  		if (buf[0] == 'X' || buf[0] == 'E' || buf[0] == 'F'
X! 		 || !isascii(buf[0]) || !isalpha(buf[0]))
X  		    /* Protect non-alpha's, the shar pattern character, the
X  		     * END_OF_FILE message, and mail "From" lines. */
X  		    (void)putchar('X');
X+ #else
X+ 		/* Always put out a leading X. */
X+ 		(void)putchar('X');
X+ #endif	/* TOO_FANCY */
X  		for (s = buf; *s; s++) {
X  		    if (BADCHAR(*s))
X  			Bads++;
X***************
X*** 90,96 ****
X  	Printf("END_OF_FILE\n", Name);
X  	if (Bads) {
X  	    Printf(
X! 	"echo shar: %d control character%s may be missing from \\\"'%s'\\\"\n",
X  		   Bads, Bads == 1 ? "" : "s", Name);
X  	    Fprintf(stderr, "Found %d control char%s in \"'%s'\"\n",
X  		    Bads, Bads == 1 ? "" : "s", Name);
X--- 95,101 ----
X  	Printf("END_OF_FILE\n", Name);
X  	if (Bads) {
X  	    Printf(
X!     "echo shar: %d control character%s may be missing from \\\"'%s'\\\"\n",
X  		   Bads, Bads == 1 ? "" : "s", Name);
X  	    Fprintf(stderr, "Found %d control char%s in \"'%s'\"\n",
X  		    Bads, Bads == 1 ? "" : "s", Name);
X***************
X*** 145,151 ****
X  	files[i] = COPY(buff);
X  	if (++i == count - 2) {
X  	    /* Get more space; some systems don't have realloc()... */
X! 	    for (count += MIN_FILES, temp = NEW(char*, count), j = 0; j < i; j++)
X  		temp[j] = files[j];
X  	    files = temp;
X  	}
X--- 150,157 ----
X  	files[i] = COPY(buff);
X  	if (++i == count - 2) {
X  	    /* Get more space; some systems don't have realloc()... */
X! 	    temp = NEW(char*, count);
X! 	    for (count += MIN_FILES, j = 0; j < i; j++)
X  		temp[j] = files[j];
X  	    files = temp;
X  	}
X***************
X*** 158,164 ****
X  }
X  
X  
X- 
X  main(ac, av)
X      int			 ac;
X      REGISTER char	*av[];
X--- 164,169 ----
X***************
X*** 181,186 ****
X--- 186,192 ----
X      Knum = 0;
X      Kmax = 0;
X      Trailer = NULL;
X+     Flist = NULL;
X      for (Oops = 0; (i = getopt(ac, av, "be:i:n:o:t:")) != EOF; )
X  	switch (i) {
X  	default:
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:30 1988
X--- shar.h	Fri Jun  3 11:53:18 1988
X***************
X*** 3,9 ****
X  **  If you have to edit this file, then I messed something up, please
X  **  let me know what.
X  **
X! **  $Header: shar.h,v 2.0 88/05/27 13:28:00 rsalz Exp $
X  */
X  
X  #include "config.h"
X--- 3,9 ----
X  **  If you have to edit this file, then I messed something up, please
X  **  let me know what.
X  **
X! **  $Header: shar.h,v 2.1 88/06/03 11:39:28 rsalz Exp $
X  */
X  
X  #include "config.h"
X***************
X*** 41,47 ****
X  #include "ndir.h"
X  #endif	/* IN_NDIR */
X  #ifdef	IN_DIRENT
X! #include "dirent.h"
X  #endif	/* IN_DIRENT */
X  
X  
X--- 41,47 ----
X  #include "ndir.h"
X  #endif	/* IN_NDIR */
X  #ifdef	IN_DIRENT
X! #include <dirent.h>
X  #endif	/* IN_DIRENT */
X  
X  
X***************
X*** 86,92 ****
X  /*
X  **  Macros.
X  */
X! #define BADCHAR(c)	(iscntrl((c)) && !isspace((c)))
X  #define EQ(a, b)	(strcmp((a), (b)) == 0)
X  #define EQn(a, b, n)	(strncmp((a), (b), (n)) == 0)
X  #define PREFIX(a, b)	(EQn((a), (b), sizeof b - 1))
X--- 86,93 ----
X  /*
X  **  Macros.
X  */
X! #define BADCHAR(c)	(!isascii((c)) || (iscntrl((c)) && !isspace((c))))
X! #define HDRCHAR(c)	((c) == '-' || (c) == '_' || (c) == '.')
X  #define EQ(a, b)	(strcmp((a), (b)) == 0)
X  #define EQn(a, b, n)	(strncmp((a), (b), (n)) == 0)
X  #define PREFIX(a, b)	(EQn((a), (b), sizeof b - 1))
X*** /tmp/,RCSt1a25265	Fri Jun  3 11:54:34 1988
X--- unshar.c	Fri Jun  3 11:53:30 1988
X***************
X*** 6,12 ****
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: unshar.c,v 2.0 88/05/27 13:28:13 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X--- 6,12 ----
X  #include "shar.h"
X  #ifdef	RCSID
X  static char RCS[] =
X! 	"$Header: unshar.c,v 2.1 88/06/03 11:39:33 rsalz Exp $";
X  #endif	/* RCSID */
X  
X  
X***************
X*** 41,47 ****
X  	return(FALSE);
X      if (WHITE(*p))
X  	return(TRUE);
X!     for (i = 0; *p == '-' || *p == '_' || *p == '.' || isalnum(*p); i++)
X  	p++;
X      return(i && *p == ':');
X  }
X--- 41,47 ----
X  	return(FALSE);
X      if (WHITE(*p))
X  	return(TRUE);
X!     for (i = 0; (isascii(*p) && isalnum(*p)) || HDRCHAR(*p); i++)
X  	p++;
X      return(i && *p == ':');
X  }
X***************
X*** 55,61 ****
X  IsSHcomment(p)
X      REGISTER char	*p;
X  {
X!     while (isalpha(*p) || WHITE(*p) || *p == '\n' || *p == ',' || *p == '.')
X  	p++;
X      return(*p == '\0');
X  }
X--- 55,62 ----
X  IsSHcomment(p)
X      REGISTER char	*p;
X  {
X!     while (isascii(*p) &&
X!       (isalpha(*p) || WHITE(*p) || *p == '\n' || *p == ',' || *p == '.'))
X  	p++;
X      return(*p == '\0');
X  }
X***************
X*** 78,90 ****
X      first = TRUE;
X  again: 
X      while (*p) {
X! 	if (!isalpha(*p)) {
X  	    p++;
X  	    continue;
X  	}
X  	while (*p++ == *wd++) {
X  	    if (*wd == '\0') {
X! 		if (!isalpha(*p)) {
X  		    if (!first)
X  			return(TRUE);
X  		    first = FALSE;
X--- 79,91 ----
X      first = TRUE;
X  again: 
X      while (*p) {
X! 	if (!isascii(*p) || !isalpha(*p)) {
X  	    p++;
X  	    continue;
X  	}
X  	while (*p++ == *wd++) {
X  	    if (*wd == '\0') {
X! 		if (!isascii(*p) || !isalpha(*p)) {
X  		    if (!first)
X  			return(TRUE);
X  		    first = FALSE;
X***************
X*** 94,100 ****
X  		break;
X  	    }
X  	}
X! 	while (isalpha(*p))
X  	    p++;
X  	wd = first ? wd1 : wd2;
X      }
X--- 95,101 ----
X  		break;
X  	    }
X  	}
X! 	while (isascii(*p) && isalpha(*p))
X  	    p++;
X  	wd = first ? wd1 : wd2;
X      }
X***************
X*** 139,146 ****
X  		p = "C code";
X  	    else if (PREFIX(buff, "(*"))		/* For vi :-) */
X  		p = "PASCAL code";
X! 	    else if (buff[0] == '.' && isalpha(buff[1]) && isalpha(buff[2])
X! 		  && !isalpha(buff[3]))
X  		p = "TROFF source";
X  	    else
X  		p = NULL;
X--- 140,149 ----
X  		p = "C code";
X  	    else if (PREFIX(buff, "(*"))		/* For vi :-) */
X  		p = "PASCAL code";
X! 	    else if (buff[0] == '.'
X! 		  && isascii(buff[1]) && isalpha(buff[1])
X! 		  && isascii(buff[2]) && isalpha(buff[2])
X! 		  && isascii(buff[3]) && !isalpha(buff[3]))
X  		p = "TROFF source";
X  	    else
X  		p = NULL;
X***************
X*** 175,181 ****
X  	    } while (*buff == '\n');
X  
X  	    /* If it starts with a comment or lower-case letter we win. */
X! 	    if (*buff == '#' || *buff == ':' || islower(*buff))
X  		return(TRUE);
X  
X  	    /* The cut message lied. */
X--- 178,185 ----
X  	    } while (*buff == '\n');
X  
X  	    /* If it starts with a comment or lower-case letter we win. */
X! 	    if (*buff == '#' || *buff == ':'
X! 	     || (isascii(*buff) && islower(*buff)))
X  		return(TRUE);
X  
X  	    /* The cut message lied. */
X*** /dev/null	Fri Jun  3 11:45:01 1988
X--- config.x386	Fri Jun  3 11:52:42 1988
X***************
X*** 0 ****
X--- 1,112 ----
X+ /*
X+ **  Configuration file for shar and friends.
X+ **
X+ **  This config file is for Xenix on a 386.
X+ **  In the Makefile, set DIRLIB=-lx, and tweak the MANDIR and 1 variables.
X+ **
X+ **  $Header: config.x386,v 2.0 88/06/03 11:46:28 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		strchr		/* Maybe strchr?		*/
X+ #define RDX		strrchr		/* Maybe strrchr?		*/
X+ #define NEED_MKDIR			/* Don't have mkdir(2)?		*/
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+ typedef int		 sigret_t;	/* What a signal handler returns */
X+ typedef int		*align_t;	/* Worst-case alignment, for lint */
X+ /* typedef long		time_t		/* Needed for non-BSD sites?	*/
X+ /* typedef long		off_t		/* Needed for non-BSD sites?	*/
X+ /*efine void		int		/* If you don't have void	*/
X+ /*efine SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X+ /*efine USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X+ #define USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X+ #define USE_GETPWUID			/* Use getpwuid(3)?		*/
X+ #define DEF_SAVEIT	1		/* Save headers by default?	*/
X+ /*efine FMT02d				/* Need "%02.2d", not "%2.2d"?	*/
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	"USER"		/* Your name, if not in environ	*/
X+ #define PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X+ /*efine ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X+ #define REGISTER	register	/* Do you trust your compiler?	*/
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				/* Try /etc/whoami & <whoami.h>	*/
X+ /*efine 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+ **  Congratulations, you're done!
X+ */
X*** /dev/null	Fri Jun  3 11:45:01 1988
X--- config.sVr3	Fri Jun  3 11:52:40 1988
X***************
X*** 0 ****
X--- 1,112 ----
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.sVr3,v 2.0 88/06/03 11:45:30 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		strchr		/* Maybe strchr?		*/
X+ #define RDX		strrchr		/* Maybe strrchr?		*/
X+ /*efine NEED_MKDIR			/* Don't have mkdir(2)?		*/
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+ typedef void		 sigret_t;	/* What a signal handler returns */
X+ typedef int		*align_t;	/* Worst-case alignment, for lint */
X+ typedef long		time_t;		/* Needed for non-BSD sites?	*/
X+ typedef long		off_t;		/* Needed for non-BSD sites?	*/
X+ /*efine void		int		/* If you don't have void	*/
X+ /*efine SYS_WAIT			/* Have <sys/wait.h> and vfork?	*/
X+ /*efine USE_SYSTEM			/* Use system(3), not exec(2)?	*/
X+ /*efine USE_SYSERRLIST			/* Have sys_errlist[], sys_nerr? */
X+ #define USE_GETPWUID			/* Use getpwuid(3)?		*/
X+ #define DEF_SAVEIT	1		/* Save headers by default?	*/
X+ /*efine FMT02d				/* Need "%02.2d", not "%2.2d"?	*/
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	"USER"		/* Your name, if not in environ	*/
X+ /*efine PTR_SPRINTF			/* Need extern char *sprinf()?	*/
X+ /*efine ANSI_HDRS			/* Use <stdlib.h>, etc.?	*/
X+ #define REGISTER	register	/* Do you trust your compiler?	*/
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				/* Try /etc/whoami & <whoami.h>	*/
X+ /*efine 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+ **  Congratulations, you're done!
X+ */
END_OF_FILE
if test 29598 -ne `wc -c <'patch01'`; then
    echo shar: \"'patch01'\" unpacked with wrong size!
fi
# end of 'patch01'
fi
echo shar: End of shell archive.
exit 0
-- 
Please send comp.sources.unix-related mail to rsalz at uunet.uu.net.



More information about the Comp.sources.unix mailing list