[comp.sources.d] You can help improve shar

howard@erix.ericsson.se (Howard Gayle) (09/12/88)

I am working on yet another version of shar, called trshar
because it uses the tr command when necessary.  Trshar will
archive any files containing any bytes, using tr if necessary
to encode unprintable characters in printable form.  It will
automatically switch to a binary encoding such as btoa or
uuencode if that is more compact than a tr encoding.  (Files
containing the NUL character must use a binary encoding since
tr can not handle NULs.)  Lines in trshar archives will always
be less than 80 columns, regardless of the line lengths of the
input files.  No leading Xs or other characters will be added
to lines, thus making archives more human-readable, and also
saving a little space.  I intend to release trshar as free
software when it is finished.  I expect it to be especially
useful for transmitting "almost ASCII" files such as documents
written in the ISO 8859 character sets.

To finish trshar, I need your help.  Below is a trshar archive
of a test file, together with the same file in btoa and
uuencode encodings.  You can help by unsharing this archive and
comparing the test file with one of its binary-encoded
versions.  Any difference reveals a problem I need to take into
account.  I have provided shell files to perform the
comparisons easily.  Just create a directory, cd to it, run the
Bourne shell on the archive there, and read the README.

Trshar currently makes the following assumptions about mail and
news systems.  If you know of a mail or news system for which
one or more of these assumptions does not hold, please let me
know.
   1) Backspace, tab, newline, and form feed are passed unchanged.
   2) Any printable character except '.' may appear alone on a line.
   3) Articles or messages may be at least 65535 bytes long.
   4) Lines may be at least 79 bytes long (with tab stops set 8
      spaces apart).

I posted this to comp.sources.d to avoid having it archived.
Please respond by mail.

Howard Gayle
TN/ETX/TX/UMG
Ericsson Telecom AB
S-126 25 Stockholm
Sweden
howard@ericsson.se
{mcvax, uunet}!enea!ericsson.se!howard
Phone: +46 8 719 5565
FAX  : +46 8 719 9598
Telex: 14910 ERIC S

CUT HERE
  : trshar1.8
export PATH||(echo 'sh (Bourne shell) extracts this archive';kill $$)
a='README'
b=1288
if test -f "$a"
then
echo "Will not overwrite $a"
else
echo "$a.."
cat<<'Z'>"$a"
The following files should be present:
   t.t        - Test file delivered by trshar.
   t.b.b      - The same test file, encoded by btoa.
   t.u.u      - The same test file, encoded by uuencode.
   t-btoa     - Bourne shell file to decode t.b.b and compare it with t.t.
   t-uuencode - Bourne shell file to decode t.u.u and compare it with t.t.

To run the test, simply execute either of the shell files t-btoa
or t-uuencode.  If all goes well, the shell file will print out
a message.  No further action is required.

If the test file as delivered by trshar differs from the
binary-encoded copy, the shell file will print an error message
and will also binary-encode the test file so you can mail it
back to me.  In your mail message, please include what kind of
hardware and software you have, for example VAX-11/750 running
4.3BSD.  If you can diagnose the problem, or even just have a
hunch, please include it.  If you don't mind my contacting you
for further information if necessary, please include your
electronic and snail addresses, phone, etc.

Thank you very much for your help!

Howard Gayle
TN/ETX/TX/UMG
Ericsson Telecom AB
S-126 25 Stockholm
Sweden
howard@ericsson.se
{mcvax, uunet}!enea!ericsson.se!howard
Phone: +46 8 719 5565
FAX  : +46 8 719 9598
Telex: 14910 ERIC S

Z
if test $b -ne `wc -c<"$a"`
then
echo "*** Error: $a should be $b bytes ***"
else
echo "$a..$b bytes"
fi
fi
a='t-btoa'
b=187
if test -f "$a"
then
echo "Will not overwrite $a"
else
echo "$a.."
cat<<'Z'>"$a"
  
atob<t.b.b>t.b
if cmp -s t.t t.b
then
   echo 'All is well.'
else
   btoa<t.t>t.t.b
   echo 'Something is wrong.  Please mail t.t.b back.'
fi
echo 'Thank you very much for your help.'
Z
if test $b -ne `wc -c<"$a"`
then
echo "*** Error: $a should be $b bytes ***"
else
chmod +x $a
echo "$a..$b bytes"
fi
fi
a='t-uuencode'
b=209
if test -f "$a"
then
echo "Will not overwrite $a"
else
echo "$a.."
cat<<'Z'>"$a"
  
chmod 777 .
uudecode t.u.u
if cmp -s t.t t.u
then
   echo 'All is well.'
else
   uuencode t.t t.t.u>t.t.u
   echo 'Something is wrong.  Please mail t.t.u back.'
fi
echo 'Thank you very much for your help.'
Z
if test $b -ne `wc -c<"$a"`
then
echo "*** Error: $a should be $b bytes ***"
else
chmod +x $a
echo "$a..$b bytes"
fi
fi
a='t.b.b'
b=2711
if test -f "$a"
then
echo "Will not overwrite $a"
else
echo "$a.."
cat<<'Z'>"$a"
xbtoa Begin
<+oue+D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$9ee]$:"qa$:5(e$:G4i$:Y@m$:kLq$;(Xu$;:e$$;Lq($;_(,$;q40$<.@4$<@L8$<RX<$
<dd@$=!pD$=4'H$=F3L$=X?P$=jKT$>'WX$>9c\$>Ko`$>^&d$>p2h$?->l$??Jp$?QVt$?cc#$?uo
'$@3&+$@E2/$@W>3$@iJ7$A&V;$A8b?$AJnC$A]%G$Ao1K$B,=O$B>IS$BPUW$Bba[$Btm_$C2$c$C
D0g$CV<k$ChHo$D%Ts$D7a"$DIm&$D\$*$Dn0.$E+<2$E=H6$EOT:$Ea`>$EslB$F1#F$FC/J$FU;N
$FgGR$G$SV$G6_Z$GHk^$G["b$Gm.f$H*:j$H<Fn$HNRr$H`_!$Hrk%$I0")$IB.-$IT:1$IfF5$J#
R9$J5^=$JGjA$JZ!E$Jl-I$K)9M$K;EQ$KMQU$K_]Y$Kqi]$L.ua$LA,e$LS8i$LeDm$M"Pq$M4\u$
MFi$$MXu($Mk,,$N(80$N:D4$49'ACh[cu+EMX5Ecc#5B-;D4FD)dE/gi[e/hRJ<5p0uXDIjr7Bln#
2@3BB)DIjq</gi[e/d_qSDIal.Afu2,F*&O:Bl%?5$31&+
xbtoa End N 2093 82d E 5a S 22100 R 8a6644ae
Z
if test $b -ne `wc -c<"$a"`
then
echo "*** Error: $a should be $b bytes ***"
else
echo "$a..$b bytes"
fi
fi
a='t.u.u'
b=2906
if test -f "$a"
then
echo "Will not overwrite $a"
else
echo "$a.."
cat<<'Z'>"$a"
begin 644 t.u
M5&AI<R!I<R!A('1E<W0@9FEL92!F;W(@=')S:&%R+@H*02!L:6YE('=I=&@@
M.2!T86)S.@H),0DR"3,)- DU"38)-PDX"3D*"D$@;&EN92!W:71H(#$P('1A
M8G,Z"@DQ"3(),PDT"34)-@DW"3@).0DP"@I!(&QI;F4@=VET:"!A;&P@8GET
M97,@97AC97!T($Y53"!A;F0@;F5W;&EN93H* 0(#! 4&!P@)"PP-#@\0$1(3
M%!46%Q@9&AL<'1X?("$B(R0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IF
M"F<*: II"FH*:PIL"FT*;@IO"G *<0IR"G,*= IU"G8*=PIX"GD*>@I["GP*
M?0I^"G\*@ J!"H(*@PJ$"H4*A@J'"H@*B0J*"HL*C J-"HX*CPJ0"I$*D@J3
M"I0*E0J6"I<*F J9"IH*FPJ<"IT*G@J?"J *H0JB"J,*I JE"J8*IPJH"JD*
MJ@JK"JP*K0JN"J\*L JQ"K(*LPJT"K4*M@JW"K@*N0JZ"KL*O J]"KX*OPK 
M"L$*P@K#"L0*Q0K&"L<*R K)"LH*RPK,"LT*S@K/"M *T0K2"M,*U K5"M8*
MUPK8"MD*V@K;"MP*W0K>"M\*X KA"N(*XPKD"N4*Y@KG"N@*Z0KJ"NL*[ KM
M"NX*[PKP"O$*\@KS"O0*]0KV"O<*^ KY"OH*^PK\"OT*_@K_"@I!(&QI;F4@
M<W1A<G1I;F<@=VET:" G+B<Z"BXN"@I!(&QI;F4@=VET:"!A(&QO;F4@)RXG
7.@HN"@I%;F0@;V8@=&5S="!F:6QE+@I!
 
end
Z
if test $b -ne `wc -c<"$a"`
then
echo "*** Error: $a should be $b bytes ***"
else
echo "$a..$b bytes"
fi
fi
a='t.t'
b=2093
if test -f "$a"
then
echo "Will not overwrite $a"
else
echo "$a.."
cat<<'Z'>"$a"
This is a test file for trshar.

A line with 9 tabs:
	1	2	3	4	5	6	7	8	9

A line with 10 tabs:
Z
tr -d '\12'<<'Z'|tr '\\' '\12'>>"$a"
	1	2	3	4	5	6	7	8	9
	0\
Z
cat<<'Z'>>"$a"

A line with all bytes except NUL and newline:
Z
c='bcdefghijklmnopqrstuvwxyz{|}'
d='\12\1\2\3\4\5\6\7\13\15\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36'
e='\37'
tr -d '\12'<<'Z'|tr "$c" "$d$e">>"$a"
cdefghi	jklmnopqrstuvwxyz{|} !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI
JKLMNOPQRSTUVWXYZ[\]^_`a
Z
c='!"#$%&\47()\*+,\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`'
d='\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220'
e='\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242'
f='\243\244\245\246\250\251\252\253\254\255\256\257\260\261\262\263\264\265'
g='\266\267\270\271\272\12\247\273\274\275'
tr -d '\12'<<'Z'|tr "$c" "$d$e$f$g">>"$a"
bcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH]IJKLMNOPQ
RSTUVWXYZ[^_`
Z
c='!"#$%&\47()\*+,\-./356789;<=>?@BCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]^_`acdf{|}'
d='~'
e='\276\300\301\302\303\305\306\307\310\312\313\314\315\316\317\320\322\323'
f='\324\325\326\327\330\331\332\333\311\335\336\340\342\343\345\346\347\350'
g='\352\353\354\355\356\357\360\362\363\364\365\366\367\370\371\372\304\321'
h='\277\334\373\351\374\375\376\377\344\361\341\337'
tr "$c$d" "$e$f$g$h"<<'Z'>>"$a"
!]"#$%[&'()@*+,-./3\56789;<=>?^BC~D}EF{GHIJ`KLMNOPQ|RSTUVWXYZ_acdf

A line with 1024 bytes:
Z
tr -d '\12'<<'Z'|tr '\\' '\12'>>"$a"
<---1----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
8----+----9----+---10----+---11----+---12----+---13----+---14----+---15----+---
16----+---17----+---18----+---19----+---20----+---21----+---22----+---23----+--
-24----+---25----+---26----+---27----+---28----+---29----+---30----+---31----+-
--32----+---33----+---34----+---35----+---36----+---37----+---38----+---39----+
---40----+---41----+---42----+---43----+---44----+---45----+---46----+---47----
+---48----+---49----+---50----+---51----+---52----+---53----+---54----+---55---
-+---56----+---57----+---58----+---59----+---60----+---61----+---62----+---63--
--+---64----+---65----+---66----+---67----+---68----+---69----+---70----+---71-
---+---72----+---73----+---74----+---75----+---76----+---77----+---78----+---79
----+---80----+---81----+---82----+---83----+---84----+---85----+---86----+---8
7----+---88----+---89----+---90----+---91----+---92----+---93----+---94----+---
95----+---96----+---97----+---98----+---99----+--100----+--101----+--102--->\
Z
c='STVWXY\[\\\]^_`fghjkmoquvwz{|}'
d='\1\2\3\4\5\6\7\13\15\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37'
tr "$c" "$d"<<'Z'>>"$a"

All bytes except NUL and '.', 1 per line:
S
T
V
W
X
Y
[

	

\

]
^
_
`
f
g
h
j
k
m
o
q
u
v
w
z
{
|
}
 
!
"
#
$
%
&
'
(
)
*
+
,
-
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
Z
c='"#$%&\47()\*+,\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ'
d='\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220'
e='\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242'
f='\243\244\245\246\247\250\251\252\253\254\255\256'
tr "$c" "$d$e$f"<<'!'>>"$a"
S
T
U
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
"
#
$
%
&
'
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
!
c='!"#$%&\47()\*+,\-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY\[\\\]^_`ab'
d='cdefghijklmn{|}~'
e='\257\261\262\263\264\265\266\267\270\271\272\273\274\275\276\300\301\302'
f='\303\305\306\307\310\312\313\314\315\316\317\320\322\311\323\324\325\326'
g='\327\330\331\332\333\335\336\340\342\343\344\345\346\347\350\352\353\354'
h='\355\356\357\304\321\277\334\360\351\362\363\364\365\366\367\370\371\372'
i='\373\374\375\376\377\260\361\341\337'
tr "$c$d" "$e$f$g$h$i"<<'Z'>>"$a"
!
{
"
#
$
%
&
'
(
)
*
+
,
-
.
/
]
0
1
2
3
[
4
5
6
7
@
8
9
:
;
<
=
>
\
?
A
B
C
D
E
F
G
H
I
^
J
K
~
L
}
M
N
O
P
Q
R
S
`
T
U
V
W
X
Y
_
|
a
b
c
d
e
f
g
h
i
j
k
l
m
n

Z
tr ',' '.'<<'Z'>>"$a"
A line starting with '.':
..

A line with a lone '.':
,

End of test file.
Z
if test $b -ne `wc -c<"$a"`
then
echo "*** Error: $a should be $b bytes ***"
else
echo "$a..$b bytes"
fi
fi
exit 0

rick@pcrat.UUCP (Rick Richardson) (09/13/88)

In article <1823@erix.ericsson.se> howard@erix.ericsson.se (Howard Gayle) writes:
>I am working on yet another version of shar, called trshar
>because it uses the tr command when necessary.  Trshar will
>archive any files containing any bytes, using tr if necessary
>to encode unprintable characters in printable form.  It will
>automatically switch to a binary encoding such as btoa or
>uuencode if that is more compact than a tr encoding.  (Files

I took Rich $alz's 'cshar' package a while back and modified it
to compress and then uuencode binary files.  I hacked it in
quickly, and haven't sent the changes to Rich to approve
as an official patch.  I would suggest, however, that anything
you do be based upon Rich's package.  The quick hack I did
will be readily apparent in the upcoming JetRoff shar's in
comp.sources.misc.  I had to change findsrc.c (to indicate to
makekit that a file is binary), makekit.c (to figure out what
the compressed/uuencoded size of a file will be), and shar.c
(to compress/uuencode the file and put the proper wrapper
around it).
-- 
		Rick Richardson, PC Research, Inc.
		rick%pcrat.uucp@uunet.uu.net (INTERNET)
		   uunet!pcrat!rick (UUCP, Personal Mail)
..!pcrat!jetroff (JetRoff Info)		..!pcrat!dry2 (Dhrystone Submissions)

rsalz@bbn.com (Rich Salz) (09/13/88)

=In <1823@erix.ericsson.se> howard@erix.ericsson.se (Howard Gayle) writes:
=I am working on yet another version of shar, called trshar
=because it uses the tr command when necessary.  Trshar will
=archive any files containing any bytes, using tr if necessary
=to encode unprintable characters in printable form.

In <574@pcrat.UUCP> rick@pcrat.UUCP (Rick Richardson) writes:
=I took Rich $alz's 'cshar' package a while back and modified it
=to compress and then uuencode binary files.  ...
=...  I would suggest, however, that anything
=you do be based upon Rich's package.

Thanks for the compliment, Rick.

Lemme just throw out a few words on shars.  As comp.sources.unix moderator
I've seen many different types, and with the release of my cshar package
I seem to have had a great influence on what the world uses.

There seem to be three major shar philosophies:
	1.  Use a generator that's dumb and simple and elegant.  Can't get
	any easier than this little fellow from Kernighan and Pike, "bundle":
	    #! /bin/sh
	    echo '#To unpack, delete all lines before this and feed to /bin/sh'
	    for I
	    do
		    echo "echo $I 1>&2"
		    echo "cat >$I <<'END'"
		    cat <$I
		    echo "END"
	    done
	Easy to use: "bundle *.[ch] | mail user@site.domain"

	2.  Write a generator that will split large files, wrap long
	lines, convert binary to ASCII for transmission, walk directories,
	etc.  Kind of easy to use:
		mondoshar -n '/tmp/files' /unix /etc/termcap
		for I in /tmp/files* ; do
		    mail user@site.domain <$I ; rm $I
		done

        3.  Write a generator that is fairly robust about shipping text
	files around in today's networks.

Method #1 is cool -- ultimate Unix philosophy.  It's also guaranteed to
generate files that are too big to mail around, or will otherwise cause
problems for some sites (lines with just a period in them, for example).

Method #2 is big and bulky.  Often easy to use, except when you run
across the one thing it can't handle ("whaddya mean it doesn't followed
the symlink?").  The resultant shars are often useless on non-Unix systems,
and can be subject to dialect differences even there.

Method #3 seems like a reasonable compromise.  Not surprisingly, it's the
one I took.  It works real well at getting SOURCES from here to there.  It
includes multi-part checks, is fairly easy to parse, and does some limited
error-checking.  Coupled with a "shar parser", this method gives you
something that works on a wide variety of systems -- MSDOS, VMS, Unix.  If
you want to send binary or really big files, you have to special-case it
and do some work by hand.  I don't mind that, because I've yet to find
a tool that really handles every one of those special cases -- and 
certainly nothing that works on all kinds of systems.

In conclusion, if you think the world really needs another shell archive
generator, give some serious thought to what problem you're trying to
solve, and where it will be solved.

Hope this info is useful.
	/rich $alz

-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.