[net.sources.bugs] Could we have a standard "shar" file format?

bill@persci.UUCP (09/14/85)

*** FOLLOW THIS LINE WITH YOUR MESSAGE ***

I see that yet another "shar" script has been posted to net.sources. I would
like to see if the net could agree on a standard format for shar files,
especially for the first line. I use a simple script to extract shar files
from within postings, but it looks for a line that starts with:
 #!/bin/sh
or something like that. It does *NOT* work with shar files that start with
a colon in column 1 of the first line! I'm seeing a few of these coming over
the net now, and although it doesn't take a tremendous effort to extract these,
it is a little annoying after having received and used the "unshar" script.

-- 
William Swan  {ihnp4,decvax,allegra,...}!uw-beaver!tikal!persci!bill

jjg@security.UUCP (Jeff Glass) (09/16/85)

In article <396@persci.UUCP> bill@persci.UUCP writes:
> I see that yet another "shar" script has been posted to net.sources. I would
> like to see if the net could agree on a standard format for shar files,
> especially for the first line. I use a simple script to extract shar files
> from within postings, but it looks for a line that starts with:
>  #!/bin/sh

If you replace the sed command in your version of unshar with this
sed command, it will be able to recognize shar scripts which begin
with a comment line ( "#" or ":" ) or with a "cut here" line.
It also recognizes a line consisting of "-- " as the beginning of
a signature, and stops the unshar.  sed is an amazing program,
even if it does remind me of assembly language...

sed -n	-e "/^#/b copy" -e "/^:/b copy" \
	-e "/^--*[ 	]*[Cc][Uu][Tt]/b comment" \
	-e d \
	-e :comment -e "s/^./#/" \
	-e :copy -e '/^-- $/q' -e p -e n -e "b copy" \
    ${1-} | /bin/sh
-- 
  security!jjg@mitre-bedford.ARPA				(MIL)
 {allegra,ihnp4,utzoo,philabs,uw-beaver}!linus!security!jjg	(UUCP)

jimb@amdcad.UUCP (Jim Budler) (09/16/85)

In article <396@persci.UUCP> bill@persci.UUCP writes:
>...
>from within postings, but it looks for a line that starts with:
> #!/bin/sh
>or something like that. It does *NOT* work with shar files that start with
>a colon in column 1 of the first line! I'm seeing a few of these coming over

And what are the poor folk with v7 supposed to do? v7 sh recognizes
a ':' as a comment and '#: program not found' for your solution.
-- 
 Jim Budler
 Advanced Micro Devices, Inc.
 (408) 749-5806
 UUCPnet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb
 Compuserve:	72415,1200

"... Don't sue me, I'm just the piano player!...."

campbell@maynard.UUCP (Larry Campbell) (09/17/85)

> >...
> >from within postings, but it looks for a line that starts with:
> > #!/bin/sh
> >or something like that. It does *NOT* work with shar files that start with
> >a colon in column 1 of the first line! I'm seeing a few of these coming over
> 
> And what are the poor folk with v7 supposed to do? v7 sh recognizes
> a ':' as a comment and '#: program not found' for your solution.
> -- 
>  Jim Budler
>  UUCPnet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb

It doesn't handle all the cases (like metachars after the #) but I wrote
the smallest possible C program: "main(){}", called it #, and put it
in /usr/local/bin.
-- 
Larry Campbell                     decvax!genrad
The Boston Software Works, Inc.                 \
120 Fulton St.                 seismo!harvard!wjh12!maynard!campbell
Boston MA 02109                         /       /
                                   ihnp4  cbosgd

ARPA: campbell%maynard.uucp@harvard.arpa

bill@persci.UUCP (09/17/85)

In article <4048@amdcad.UUCP> jimb@amdcad.UUCP (Jim Budler) writes:
>>...
>>from within postings, but it looks for a line that starts with:
>> #!/bin/sh
>>or something like that. It does *NOT* work with shar files that start with
>>a colon in column 1 of the first line! I'm seeing a few of these coming over
>And what are the poor folk with v7 supposed to do? v7 sh recognizes
>a ':' as a comment and '#: program not found' for your solution.

Jim, if you re-read my previous posting, you may see that I'm not so concerned
about *which* format is used as I am about a *standard* format. The problem
(and it *is* a small one) is that an "unshar" script must be able to handle
all of the formats that people are using. Whether I type "csh foo", "sh foo",
"foo", or "unshar foo", it doesn't matter to me (forgive grammer, plz). I
would like to be able to treat (unpack) shar files one way, all the time.
Preferably not by editing them first to remove all the stuff at the top (I am
lazy and impatient, and vi and emacs are incredibly slow to come up), hence
the "unshar" script.

'Nuff said?
-- 
William Swan  {ihnp4,decvax,allegra,...}!uw-beaver!tikal!persci!bill

ken@rochester.UUCP (Blittermuis) (09/17/85)

In article <4048@amdcad.UUCP> jimb@amdcad.UUCP (Jim Budler) writes:
>And what are the poor folk with v7 supposed to do? v7 sh recognizes
>a ':' as a comment and '#: program not found' for your solution.

Modify the unshar script to filter out lines starting with # or use
the C unshar.

	Ken
-- 
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken@rochester.arpa
USnail:	Dept. of Comp. Sci., U. of Rochester, NY 14627. Voice: Ken!

ahby@meccts.UUCP (Shane P. McCarron) (09/18/85)

In article <396@persci.UUCP> bill@persci.UUCP writes:
>it looks for a line that starts with:
> #!/bin/sh
>or something like that. It does *NOT* work with shar files that start with
>a colon in column 1 of the first line!

On our Sys III Plexus, csh will attempt to execute any shell that has
a '#' at the beginning of the first line.  I assume that some other
systems have a similar anomaly.  However, starting the first line with
a ':' will eliminate this problem.  That is why some scripts generate
a colon in the first line.

-- 

Shane P. McCarron
Minnesota Educational Computing Corporation - Technical Services

UUCP	ihnp4!dicomed!meccts!ahby

mason@utcsri.UUCP (Dave Mason) (09/19/85)

In article <153@maynard.UUCP> campbell@maynard.UUCP (Larry Campbell) writes:
>> >...
>> >from within postings, but it looks for a line that starts with:
>> > #!/bin/sh
>> >...
>> And what are the poor folk with v7 supposed to do? v7 sh recognizes
>> a ':' as a comment and '#: program not found' for your solution.
>>  UUCPnet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb (Jim Budler)
>
>It doesn't handle all the cases (like metachars after the #) but I wrote
>the smallest possible C program: "main(){}", called it #, and put it
>in /usr/local/bin.

true(1) already does this & is 0 bytes long.  Just link to it, or
	cat /dev/null ># ; chmod +x #
-- 
Usenet:	{dalcs dciem garfield musocs qucis sask titan trigraph ubc-vision
 	 utzoo watmath allegra cornell decvax decwrl ihnp4 uw-beaver}
	!utcsri!mason		Dave Mason, U. Toronto CSRI
CSNET:	mason@Toronto
ARPA:	mason%Toronto@CSNet-Relay

peter@graffiti.UUCP (Peter da Silva) (09/26/85)

> It doesn't handle all the cases (like metachars after the #) but I wrote
> the smallest possible C program: "main(){}", called it #, and put it
> in /usr/local/bin.

That's not a solution, since the #: messages only annoy. Metacharacters
are the things that cause most of the problems. Shar files should start
with : '...'.

dca@edison.UUCP (David C. Albrecht) (11/08/85)

> In article <396@persci.UUCP> bill@persci.UUCP writes:
> >...
> >from within postings, but it looks for a line that starts with:
> > #!/bin/sh
> >or something like that. It does *NOT* work with shar files that start with
> >a colon in column 1 of the first line! I'm seeing a few of these coming over
> 
> And what are the poor folk with v7 supposed to do? v7 sh recognizes
> a ':' as a comment and '#: program not found' for your solution.
> -- 

Write a friggin sed script for god sake, we are not supposed to be
helpless here this is .sources after all.

David Albrecht

jimb@amdcad.UUCP (Jim Budler) (11/15/85)

Boy do you get your news late!! I wrote that a long time ago.
BUT:

	1) Why is it that the computer that does not recognize #! /bin/sh
	has to write a sed script to allow for the original poster
	writing an inadequate script?

	2) Computers that recognize '#! /bin/sh' to direct a script to sh
	also recognize ':' for the same purpose.  Computers that do not
	recognize '#! /bin/sh' also recognize ':'.

In the quest for a standard shar format, shouldn't a potential developer 
work for the lowest common denominator?

Therefore:

	a) Shar scripts should be 'sh' scripts, because some unlucky
	people don't have 'csh', but everyone has 'sh'.

	b) Shar scripts, since they follow item 'a)' above should use ':'
	for the reasons mentioned in '2)', above.

By the way, I get by quite well.  I have BSD4.2, csh, unshar, and sed.  But I 
believe in the practices of Columbia Univ. i.e. try to make your
product compatible for the most people possible, even if that requires 
more effort on the developer's part.
-- 
 Jim Budler
 Advanced Micro Devices, Inc.
 (408) 749-5806
 Usenet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb
 Compuserve:	72415,1200

Bogus newsgroup: net.news: Move to end of .newsrc[yn^L]?

Don't be dictators, use thought.

tony@xios.UUCP (Keeper Of News) (11/22/85)

As an addendum to the request for a standard shar format, could we
eliminate the comments after the 'fi's that some shar programs
generate. Some primative sh's (ie. the one I use) croak on this.
And I'm sure others do too.
-- 
-------------------------------------------------------------------------------
Tony Lill	Keeper of News @ Xios Systems Corporation 
				 1024 Morrison Drive, Ottawa, Ontario
				 Canada, K2H 9E5	(613) 726-8850
				 utzoo!dciem!nrcaero!xios!tony
-------------------------------------------------------------------------------
		Not the edge of the world, but we can see it from here.

dv@well.UUCP (David W. Vezie) (12/03/85)

echo #define notdef >> /usr/include/stdio.h

	Could I propose a "standard" for articles posted to all.sources?
(I realize that by asking, I'm expecting a negative answer... :-).  It
is actually simple:

	1, entire article is a shar file (meaning, all you should have
	   to do is strip off the header and feed to sh).

	2, the order of the files in the shar file are as such:
		a, README - description of what the package contains
			    (this is usually found ABOVE the shar package)
		b, man pages
		c, Makefiles
		d, Header files
		e, Source files

	3, even if it is one file, package it as a shar file with a
	   README.  That way I don't have to use an editor with it,
	   I can just run it through unshar.  It also means that I
	   don't have to save the article itself to have all the
	   information about the software.

	4, use a shell archiver that puts an "exit 0" at the end of
	   the article (before the .signature).


Comments?
--- 
David W. Vezie
	    {dual|hplabs}!well!dv - Whole Earth 'Lectronics Link, Sausalito, CA
(4 lines, 114 chars)

avolio@decuac.UUCP (Frederick M. Avolio) (12/03/85)

In article <314@well.UUCP>, dv@well.UUCP (David W. Vezie) writes:
> 	Could I propose a "standard" for articles posted to all.sources?
Not only can you ... you did!

>       1, entire article is a shar file

Good idea -- has to be done by poster, not in software

>       2, the order of the files in the shar file are as such: ...

Why?  I don't see why it matters as long as they are in there.  Why
order the files?  I say "shar * > ~/sharfile"

> 	3, even if it is one file, package it as a shar file with a
>          README.  ...

Very good idea -- again, has to be done by poster, not in software

> 	4, use a shell archiver that puts an "exit 0" at the end of
> 	   the article (before the .signature).

Gary Perlman's does this as well as puts time stamp, user name, etc. in a
shell comment and allows one to create a shar file that checks character
counts, etc. at unshar time.  Remember, Gary's is one that people scoffed
at because it is a "complicated" C program instead of the simple 8 liner
distributed with news software:

	for i
	do
		echo "echo x - $i"
		echo "sed 's/^X//' >$i <<'*-*-END-of-$i-*-*'"
		sed 's/^/X/' $i
		echo "*-*-END-of-$i-*-*"
	done
	echo exit

The above can easily be changed to add an exit 0 line.  But Gary's is fast
and has some nice features.  And that is why I like it.  That and, as Gary
said in a recent magazine article, it's nice to be mentioned on the manual
page :-) !
-- 
Fred @ DEC Ultrix Applications Center    {decvax,seismo,cbosgd}!decuac!avolio

dave@lsuc.UUCP (David Sherman) (12/06/85)

For the benefits of those of us who sometimes read news at low
speeds, please put the man page first in the shar file. That way
it's easy to find and read. Maybe a README can go before, but not
the C source. Thanks.

Dave Sherman
-- 
{  ihnp4!utzoo  pesnta  utcs  hcr  decvax!utcsri  }  !lsuc!dave