Unofficial patch to shar3.49
Jeff Okamoto
okamoto at hpcc01.HP.COM
Tue Jan 8 05:27:14 AEST 1991
I like the features that shar3.49 offers, but there is one small thing
that I didn't like: shar prints out some status messages to stderr
while building the sharchve. Since I have an alias which effectively
does shar * >& shar.out you can see how that can cause problems.
I therefore submit context diffs of shar.c and shar.1 which add a new
flag: -q. This flag prevents shar from printing any non-error messages
while it is packing the sharchive. I hope they will be of use to you.
Jeff Okamoto
Hewlett-Packard Corporate Computing and Services
okamoto at ranma.corp.hp.com
-----Begin context diffs
*** shar.c.orig Wed Nov 14 09:03:33 1990
--- shar.c Wed Nov 14 09:13:18 1990
***************
*** 16,21
*/
/*+:EDITS:*/
/*:09-12-1990-14:24-rhg at cps.com-added missing return(0) to walkdown */
/*:09-12-1990-14:13-rhg at cps.com-deleted some redundant, unused, code */
/*:09-12-1990-00:28-rhg at cps.com-added more directions to the shar header */
--- 16,22 -----
*/
/*+:EDITS:*/
+ /*:11-14-1990-09:00-okamoto at corp.hp.com-added -q */
/*:09-12-1990-14:24-rhg at cps.com-added missing return(0) to walkdown */
/*:09-12-1990-14:13-rhg at cps.com-deleted some redundant, unused, code */
/*:09-12-1990-00:28-rhg at cps.com-added more directions to the shar header */
***************
*** 207,212
int InterOW = 0; /* interactive overwrite */
int PosParam = 0; /* allow positional parameters */
int FileStrip; /* strip directories from filenames */
#ifdef DEBUG
int de_bug = 0; /* switch for debugging on */
#define DeBug(f,v) if (de_bug) printf(f, v)
--- 208,214 -----
int InterOW = 0; /* interactive overwrite */
int PosParam = 0; /* allow positional parameters */
int FileStrip; /* strip directories from filenames */
+ int Quiet = 0; /* be quiet about what we're doing */
#ifdef DEBUG
int de_bug = 0; /* switch for debugging on */
#define DeBug(f,v) if (de_bug) printf(f, v)
***************
*** 238,244
extern int optind;
extern char *optarg;
! while((c = getopt(argc,argv,"VmSvwd:BTCb:xXcfMpPFas:n:l:L:o:h")) != -1)
{
switch(c)
{
--- 240,246 -----
extern int optind;
extern char *optarg;
! while((c = getopt(argc,argv,"VmSvwd:BTCb:xXcfMpPFas:n:l:L:o:qh")) != -1)
{
switch(c)
{
***************
*** 337,342
exit(1);
}
break;
#ifdef DEBUG
case '$': /* totally undocumented $ option, debug on */
de_bug = 1;
--- 339,347 -----
exit(1);
}
break;
+ case 'q': /* be quiet */
+ Quiet = 1;
+ break;
#ifdef DEBUG
case '$': /* totally undocumented $ option, debug on */
de_bug = 1;
***************
*** 473,479
{
fputs("rm -f _shar_seq_.tmp\n",fpout);
fputs("echo You have unpacked the last part\n",fpout);
! if(!Verbose)
fprintf(stderr,"Created %d files\n",filenum);
}
fputs("exit 0\n",fpout);
--- 478,484 -----
{
fputs("rm -f _shar_seq_.tmp\n",fpout);
fputs("echo You have unpacked the last part\n",fpout);
! if(!Quiet)
fprintf(stderr,"Created %d files\n",filenum);
}
fputs("exit 0\n",fpout);
***************
*** 964,970
/* form the next filename */
sprintf(filename,"%s%02d",outname,++filenum);
fpout = fopen(filename,"w");
! if(Verbose)
fprintf(stderr,"Starting file %s\n",filename);
if(Archive_name)
--- 969,975 -----
/* form the next filename */
sprintf(filename,"%s%02d",outname,++filenum);
fpout = fopen(filename,"w");
! if(!Quiet)
fprintf(stderr,"Starting file %s\n",filename);
if(Archive_name)
***************
*** 1090,1096
fputs("> _shar_wnt_.tmp\n",fpout);
}
! fprintf(stderr,"shar: saving %s (%s)\n",file,filetype);
if(Verbose)
{ /* info on archive and unpack */
fprintf(fpout,"echo 'x - extracting %s (%s)'\n",
--- 1095,1104 -----
fputs("> _shar_wnt_.tmp\n",fpout);
}
! if(!Quiet)
! { /* don't print this if we want to be quiet */
! fprintf(stderr,"shar: saving %s (%s)\n",file,filetype);
! }
if(Verbose)
{ /* info on archive and unpack */
fprintf(fpout,"echo 'x - extracting %s (%s)'\n",
***************
*** 1225,1231
else
fputs("if test -f _shar_wnt_.tmp; then\n",fpout);
! if(Verbose)
{ /* keep everybody informed */
fprintf(stderr,"Starting file %s\n",filename);
fprintf(fpout,"echo 'x - continuing file %s'\n",RstrName);
--- 1233,1239 -----
else
fputs("if test -f _shar_wnt_.tmp; then\n",fpout);
! if(!Quiet)
{ /* keep everybody informed */
fprintf(stderr,"Starting file %s\n",filename);
}
***************
*** 1228,1233
if(Verbose)
{ /* keep everybody informed */
fprintf(stderr,"Starting file %s\n",filename);
fprintf(fpout,"echo 'x - continuing file %s'\n",RstrName);
}
fprintf(fpout,"sed 's/^%c//' << '%s' >> '%s' &&\n",
--- 1236,1244 -----
if(!Quiet)
{ /* keep everybody informed */
fprintf(stderr,"Starting file %s\n",filename);
+ }
+ if(Verbose)
+ { /* keep everybody informed */
fprintf(fpout,"echo 'x - continuing file %s'\n",RstrName);
}
fprintf(fpout,"sed 's/^%c//' << '%s' >> '%s' &&\n",
***************
*** 1338,1344
char *helpinfo[] =
{
"-V produce \"vanilla\" shars demanding little of the unshar environment",
! "-v verbose messages OFF while executing",
"-m restore file modification dates & times with \"touch\" commands",
"-w don't check with 'wc -c' after unpack",
"-a generate Submitted-by: & Archive-name: headers",
--- 1349,1356 -----
char *helpinfo[] =
{
"-V produce \"vanilla\" shars demanding little of the unshar environment",
! "-v verbose messages OFF when unpacking archive",
! "-q be quiet while packing archive",
"-m restore file modification dates & times with \"touch\" commands",
"-w don't check with 'wc -c' after unpack",
"-a generate Submitted-by: & Archive-name: headers",
*** shar.1.orig Wed Nov 14 09:18:42 1990
--- shar.1 Wed Nov 14 09:19:57 1990
***************
*** 34,39
.IP "\f2\-v\f1"
Verbose OFF. Disables the inclusion of comments to be output when the archive
is unpacked.
.IP "\f2\-w\f1"
Do NOT check with 'wc \-c' after unpack. The default is to check.
.IP "\f2\-n\f1 name"
--- 34,41 -----
.IP "\f2\-v\f1"
Verbose OFF. Disables the inclusion of comments to be output when the archive
is unpacked.
+ .IP "\f2\-q\f1"
+ Do not print any non-error messages to stderr while packing the archive.
.IP "\f2\-w\f1"
Do NOT check with 'wc \-c' after unpack. The default is to check.
.IP "\f2\-n\f1 name"
-----End context diffs
More information about the Alt.sources
mailing list