v14i089: "mn" mail summary/tally; patch01
William Lewis
wiml at milton.u.washington.edu
Sun Sep 16 11:02:09 AEST 1990
Posting-number: Volume 14, Issue 89
Submitted-by: William Lewis <wiml at milton.u.washington.edu>
Archive-name: mn/patch01
A very small patch to "mn" of a month or two ago is included below.
The README in the shar gives details (what few there are on a 5-line
patch =8) ). Thanks.
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
# README_patch1
# patch1
# This archive created: Wed Sep 12 19:20:45 1990
export PATH; PATH=/bin:/usr/bin:$PATH
echo shar: "extracting 'README_patch1'" '(405 characters)'
if test -f 'README_patch1'
then
echo shar: "will not over-write existing file 'README_patch1'"
else
sed 's/^X//' << \SHAR_EOF > 'README_patch1'
X This is a trivial change; mn wasn't handling messages without a
X"Subject: " header line correctly. Thanks to Kingsley Kerce and
XHenry Bruce (who I couldn't respond to by mail; sorry) for pointing
Xout the problem.
X As patched, mn substitutes the null string "" as the subject for
Xsubjectless messages. However, line 60,
X static char *nullsub = "";
Xcan be changed to any string constant if desired.
SHAR_EOF
if test 405 -ne "`wc -c < 'README_patch1'`"
then
echo shar: "error transmitting 'README_patch1'" '(should have been 405 characters)'
fi
fi
echo shar: "extracting 'patch1'" '(2864 characters)'
if test -f 'patch1'
then
echo shar: "will not over-write existing file 'patch1'"
else
sed 's/^X//' << \SHAR_EOF > 'patch1'
X*** postd/mn.c Thu Aug 23 18:16:31 1990
X--- mn.c Thu Aug 23 18:33:32 1990
X***************
X*** 5,10
X of output, mainly for human consumption.
X
X */
X /*
X options:
X
X
X--- 5,11 -----
X of output, mainly for human consumption.
X
X */
X+ /* Version:1 Patchlevel:1 */
X /*
X options:
X
X***************
X*** 56,61
X
X extern char *index(), *rindex(), *malloc(); /* minimal header files? */
X char *dynamicize();
X
X main(argc, argv) int argc; char **argv;
X {int state; /* 0 = waiting for 'from', 1=in header, 2=in body */
X
X--- 57,63 -----
X
X extern char *index(), *rindex(), *malloc(); /* minimal header files? */
X char *dynamicize();
X+ static char *nullsub = "";
X
X main(argc, argv) int argc; char **argv;
X {int state; /* 0 = waiting for 'from', 1=in header, 2=in body */
X***************
X*** 197,202
X ; /* search for first blank */
X buf[i] = (char)0; /* terminate the string there */
X from = dynamicize(buf+FROMOFF);
X }
X if(state==1 && !(style==OFROM || style==ADDRONLY) &&
X !strncmp("Subject:", buf, SUBOFF)) /* grab the subj string */
X
X--- 199,206 -----
X ; /* search for first blank */
X buf[i] = (char)0; /* terminate the string there */
X from = dynamicize(buf+FROMOFF);
X+ if(sub) free(sub); /* don't reuse old subject lines */
X+ sub = NULL;
X }
X if(state==1 && !(style==OFROM || style==ADDRONLY) &&
X !strncmp("Subject:", buf, SUBOFF)) /* grab the subj string */
X***************
X*** 237,242
X if(!index(buf+STATOFF, 'R')) /* read mail? */
X unread++; else tych = (tych == 'U')?'O':'?';
X
X switch(style) /* output this msg. in correct style */
X {
X case SIMPLE:
X
X--- 241,248 -----
X if(!index(buf+STATOFF, 'R')) /* read mail? */
X unread++; else tych = (tych == 'U')?'O':'?';
X
X+ if(!sub) sub = nullsub; /* non-dynamic null string to ease output */
X+ /* should be reset to NULL after output so as not to be freed */
X switch(style) /* output this msg. in correct style */
X {
X case SIMPLE:
X***************
X*** 290,295
X default:
X puts("Unimplemented style"); break; /* this should never happen ;-) */
X } /* end of style-output switch() */
X } /* end of if(Status:) test */
X if(remains > 0 && (state == 0 || state == 2)) /*need to fill rest of line?*/
X {char *cp; int spflag = 0; /* stick this line onto end of line */
X
X--- 296,302 -----
X default:
X puts("Unimplemented style"); break; /* this should never happen ;-) */
X } /* end of style-output switch() */
X+ if(sub == nullsub) sub = NULL; /* reset null sub. to NULL again */
X } /* end of if(Status:) test */
X if(remains > 0 && (state == 0 || state == 2)) /*need to fill rest of line?*/
X {char *cp; int spflag = 0; /* stick this line onto end of line */
SHAR_EOF
if test 2864 -ne "`wc -c < 'patch1'`"
then
echo shar: "error transmitting 'patch1'" '(should have been 2864 characters)'
fi
fi
exit 0
# End of shell archive
More information about the Comp.sources.misc
mailing list