Bug fixes for "packmail" and "unshar"
Joe Orost
joe at petsd.UUCP
Wed Feb 6 12:43:45 AEST 1985
Bugs I fixed:
Infinite loop in "packmail" comparing "char c" to "EOF" - only
fails on machines with unsigned chars.
Changed default size to "31000" to work with PDP mailers (32767 max)
Optimized register declarations to improve speed.
"quit" routine does not exist on all systems - added.
Corresponding changes to document.
The program works nice after I made these changes.
Run this through "patch":
diff -c orig/packmail.1 ./packmail.1
*** orig/packmail.1 Tue Feb 5 21:29:10 1985
--- ./packmail.1 Tue Feb 5 21:26:56 1985
***************
*** 96,103
specifies that files f1 f2 f3 and f4 are to be packed into files not
more than 10,000 characters each (although no file will be split in
half, so if f1 were larger than 10,000 characters long it would be put
! in one file by itself). The default is 48,000 characters, since some
! local networks have limits of 50,000 bytes, and we want to leave 2000
bytes for mail headers. Remember that some computers have 16 bit
words, so files longer than 65,536 will break many site's mailers.
.TP
--- 96,103 -----
specifies that files f1 f2 f3 and f4 are to be packed into files not
more than 10,000 characters each (although no file will be split in
half, so if f1 were larger than 10,000 characters long it would be put
! in one file by itself). The default is 31,000 characters, since some
! local networks have limits of 32,767 bytes, and we want to leave 1767
bytes for mail headers. Remember that some computers have 16 bit
words, so files longer than 65,535 will break many site's mailers.
.TP
***************
*** 99,105
in one file by itself). The default is 48,000 characters, since some
local networks have limits of 50,000 bytes, and we want to leave 2000
bytes for mail headers. Remember that some computers have 16 bit
! words, so files longer than 65,536 will break many site's mailers.
.TP
.B -t
.I title
--- 99,105 -----
in one file by itself). The default is 31,000 characters, since some
local networks have limits of 32,767 bytes, and we want to leave 1767
bytes for mail headers. Remember that some computers have 16 bit
! words, so files longer than 65,535 will break many site's mailers.
.TP
.B -t
.I title
***************
*** 106,112
option, specifies a title which will be echoed when each file is
run through the 'sh' command at the receiving end. For example:
.sp
! packamil -t'Junk file mailing' f1 f2 f3 f4
.sp
Would give the user at the other end the following output:
.sp
--- 106,112 -----
option, specifies a title which will be echoed when each file is
run through the 'sh' command at the receiving end. For example:
.sp
! packmail -t'Junk file mailing' f1 f2 f3 f4
.sp
Would give the user at the other end the following output:
.sp
diff -c orig/packmail.c ./packmail.c
*** orig/packmail.c Tue Feb 5 21:29:15 1985
--- ./packmail.c Tue Feb 5 21:19:19 1985
***************
*** 35,41
*/
int cmpsize (a, b)
! struct filestruct *a, *b;
{ return (b->size - a->size);
}
--- 35,41 -----
*/
int cmpsize (a, b)
! register struct filestruct *a, *b;
{ return (b->size - a->size);
}
***************
*** 45,51
*/
int cmpbin (a, b)
! struct filestruct *a, *b;
{ register int result;
if (result=(a->bin - b->bin)) return (result);
return (strcmp (a->name, b->name));
--- 45,51 -----
*/
int cmpbin (a, b)
! register struct filestruct *a, *b;
{ register int result;
if (result=(a->bin - b->bin)) return (result);
return (strcmp (a->name, b->name));
***************
*** 58,65
main (argc, argv)
int argc;
char *argv[];
! { int maxsize=48000, count, bol, total=0, check=0, quick=0;
! int i, assigned, b, maxb=1, ch, headsize = 0, overhead = 0;
char *outnam = "pack.out", *headnam = NULL, *title = NULL, *filnam;
char pname[128], fname[128];
FILE *infile = NULL, *outfil = NULL, *headfil = NULL;
--- 58,65 -----
main (argc, argv)
int argc;
char *argv[];
! { int maxsize=31000, count, bol, total=0, check=0, quick=0;
! register int i, assigned, b, maxb=1, ch, headsize = 0, overhead = 0;
char *outnam = "pack.out", *headnam = NULL, *title = NULL, *filnam;
char pname[128], fname[128];
FILE *infile = NULL, *outfil = NULL, *headfil = NULL;
***************
*** 282,288
cnt_extra (fname, add)
char *fname;
! int add;
{ register int count = 0;
register FILE *cfil;
char c, lastc = '\0';
--- 282,288 -----
cnt_extra (fname, add)
char *fname;
! register int add;
{ register int count = 0;
register FILE *cfil;
register int c, lastc = '\0';
***************
*** 285,291
int add;
{ register int count = 0;
register FILE *cfil;
! char c, lastc = '\0';
if (cfil = fopen (fname, "r"))
{ while ((c = getc (cfil)) != EOF)
--- 285,291 -----
register int add;
{ register int count = 0;
register FILE *cfil;
! register int c, lastc = '\0';
if (cfil = fopen (fname, "r"))
{ while ((c = getc (cfil)) != EOF)
diff -c orig/unshar.c ./unshar.c
*** orig/unshar.c Tue Feb 5 21:29:20 1985
--- ./unshar.c Tue Feb 5 21:22:03 1985
***************
*** 20,26
main (argc, argv)
int argc;
char *argv[];
! { int i, ch;
FILE *in, *shpr, *popen ();
for (i=1; i<argc; i++)
--- 20,26 -----
main (argc, argv)
int argc;
char *argv[];
! { register int i, ch;
FILE *in, *shpr, *popen ();
for (i=1; i<argc; i++)
***************
*** 190,193
dat = ++starend; /* Rescan after copied char */
}
}
}
--- 190,200 -----
dat = ++starend; /* Rescan after copied char */
}
}
+ }
+ quit(code, message)
+ register int code;
+ register char *message;
+ {
+ fprintf(stderr, "%s", message);
+ exit(code);
}
regards,
joe
--
Full-Name: Joseph M. Orost
UUCP: ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe
ARPA: vax135!petsd!joe at BERKELEY
US Mail: MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724
Phone: (201) 870-5844
Location: 40 19'49" N / 74 04'37" W
More information about the Comp.sources.bugs
mailing list