Path: utzoo!attcan!uunet!husc6!bbn!bbn.com!rsalz
From: rsalz@bbn.com (Rich Salz)
Newsgroups: comp.sources.d
Subject: Poll on shar formats
Message-ID: <868@fig.bbn.com>
Date: 1 Jun 88 16:48:50 GMT
Organization: BBN Laboratories Inc., Cambridge MA
Lines: 72

The shar stuff I just released only puts out the leading 'X' when
the first character is a non-alphabetic.  I decided to do this to
save space, and sort of as a compromise between shar's that put
lots of stuff (I particularly hate "X") and those that put
nothing, and just use cat.

As a minimum, for safety when going through mail systems, etc.,
the lines I protect need that protection.  (They shouldn't, but
such is reality.)

For example, manpages come out looking like this:

X.TH SHELL 1l
X.\" $Header: shell.man,v 2.0 88/05/27 13:28:55 rsalz Exp $
X.SH NAME
shell \- Interpreter for shell archives
X.SH SYNOPSIS
X.B shell
X[ file...  ]
X.SH DESCRIPTION
This program interprets enough UNIX shell syntax, and command usage,
to enable it to unpack many different types of UNIX shell archives,
or ``shar's.''
It is primarily intended to be used on non-UNIX systems that need to
unpack such archives.
X.PP
X.I Shell
does
X.B not
check for security holes, and will blithely execute commands like
X.RS
On text files, the savings is significant.

C code ends up looking like this:
X/*
X**  Return current working directory.  Something for everyone.
X*/
X/* LINTLIBRARY */
X#include "shar.h"
X#ifdef	RCSID
static char RCS[] =
X	"$Header: lcwd.c,v 2.0 88/05/27 13:26:24 rsalz Exp $";
X#endif	/* RCSID */
X
X
X#ifdef	PWDGETENV
X/* ARGSUSED */
char *
Cwd(p, i)
X    char	*p;
X    int		 i;
X{
X    char	*q;
X
X    return((q = getenv(PWDGETENV)) ? strcpy(p, q) : NULL);
X}
X#endif	/* PWDGETENV */

On C code the savings is usually miniscule.

Which do people prefer?  Putting X only where needed seems esthetically
pure (i.e., Gilmore's "Just the files, ma'am" quote from some time ago),
and can save space.  Putting a leading X all the time means things like
RN's [TAB] work nicely, and supposedly makes things easier on some
text editors (delete all first chars).  I suppose if you use unshar,
you've the text editor isn't an issue...

I'd like to see some discussion here, thanks.

	/rich $alz
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.