MH 6.7 Updates - part 09/14
John Romine
mh at beanie.ICS.UCI.EDU
Sun Apr 15 04:15:52 AEST 1990
These are patches for MH 6.6 to bring it up to the current release MH
6.7. If you can FTP, you should instead retrieve the current release
(from ics.uci.edu [128.195.1.1] in pub/mh). See the announcement in
comp.mail.mh for all the details. A document descibing the changes
from MH 6.6 can also be found in comp.mail.mh.
There are fourteen parts to these patches; you *must* have all the
parts to compile MH. It will not work if you try to compile an
intermediate version.
Save this message, extract the file below and apply it with "patch -p"
from the top of your MH source tree:
cd mh-6.6/
patch -p < MH.6.6.n
If you have modified your source tree, you'll have to merge your local
changes in after you apply these patches to the original sources.
/JLR
: This is a shar archive. Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
echo 'Extracting MH.6.6.8'
sed 's/^X//' > MH.6.6.8 << '+ END-OF-FILE MH.6.6.8'
XPrereq: patch.7
X*** Patchlevel.orig Thu Apr 12 15:57:57 1990
X--- Patchlevel Thu Apr 12 15:58:25 1990
X***************
X*** 1 ****
X! MH.6.6 patch.7
X--- 1 ----
X! MH.6.6 patch.8
X*** /dev/null Thu Apr 12 15:37:43 1990
X--- ./uip/sortm.c Thu Apr 5 16:03:50 1990
X***************
X*** 0 ****
X--- 1,570 ----
X+ /* sortm.c - sort messages in a folder by date/time */
X+ /* 21Apr90 do subject sorts too - from V. Jacobson */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: sortm.c,v 1.12 90/04/05 15:02:27 sources Exp $";
X+ #endif lint
X+
X+ #include "../h/mh.h"
X+ #include "../zotnet/tws.h"
X+ #include <stdio.h>
X+ #include <sys/types.h>
X+ #include <sys/stat.h>
X+ #include <ctype.h>
X+
X+ static struct swit switches[] = {
X+ #define DATESW 0
X+ "datefield field", 0,
X+
X+ #define TEXTSW 1
X+ "textfield field", 0,
X+ #define NSUBJSW 2
X+ "notextfield", 0,
X+
X+ #define SUBJSW 3
X+ "subject", -3, /* backward-compatibility */
X+ #define LIMSW 4
X+ "limit days", 0,
X+ #define NLIMSW 5
X+ "nolimit", 0,
X+
X+ #define VERBSW 6
X+ "verbose", 0,
X+ #define NVERBSW 7
X+ "noverbose", 0,
X+
X+ #define HELPSW 8
X+ "help", 4,
X+
X+ NULL, NULL
X+ };
X+
X+ struct smsg {
X+ int s_msg;
X+ unsigned long s_clock;
X+ char *s_subj;
X+ };
X+
X+ static struct smsg *smsgs;
X+ int nmsgs;
X+
X+ char *subjsort = (char *)0; /* sort on subject if != 0 */
X+ u_long datelimit = 0;
X+ int submajor = 0; /* if true, sort on subject-major */
X+ int verbose;
X+
X+ static getws();
X+ static int dsort(), read_hdrs (), subsort(), txtsort();
X+ static void rename_chain(), rename_msgs();
X+
X+ /* */
X+
X+ main (argc, argv)
X+ int argc;
X+ char **argv;
X+ {
X+ int msgp = 0,
X+ i,
X+ msgnum;
X+ char *cp,
X+ *maildir,
X+ *datesw = NULL,
X+ *folder = NULL,
X+ buf[100],
X+ **ap,
X+ **argp,
X+ *arguments[MAXARGS],
X+ *msgs[MAXARGS];
X+ struct msgs *mp;
X+ struct smsg **dlist;
X+
X+ invo_name = r1bindex (argv[0], '/');
X+ if ((cp = m_find (invo_name)) != NULL) {
X+ ap = brkstring (cp = getcpy (cp), " ", "\n");
X+ ap = copyip (ap, arguments);
X+ }
X+ else
X+ ap = arguments;
X+ (void) copyip (argv + 1, ap);
X+ argp = arguments;
X+
X+ while (cp = *argp++) {
X+ if (*cp == '-')
X+ switch (smatch (++cp, switches)) {
X+ case AMBIGSW:
X+ ambigsw (cp, switches);
X+ done (1);
X+ case UNKWNSW:
X+ adios (NULLCP, "-%s unknown", cp);
X+ case HELPSW:
X+ (void) sprintf(buf, "%s [+folder] [msgs] [switches]",
X+ invo_name);
X+ help (buf, switches);
X+ done (1);
X+
X+ case DATESW:
X+ if (datesw)
X+ adios (NULLCP, "only one date field at a time");
X+ if (!(datesw = *argp++) || *datesw == '-')
X+ adios (NULLCP, "missing argument to %s", argp[-2]);
X+ continue;
X+
X+ case TEXTSW:
X+ if (subjsort)
X+ adios (NULLCP, "only one text field at a time");
X+ if (!(subjsort = *argp++) || *subjsort == '-')
X+ adios (NULLCP, "missing argument to %s", argp[-2]);
X+ continue;
X+
X+ case SUBJSW:
X+ subjsort = "subject";
X+ continue;
X+ case NSUBJSW:
X+ subjsort = (char *)0;
X+ continue;
X+
X+ case LIMSW:
X+ if (!(cp = *argp++) || *cp == '-')
X+ adios (NULLCP, "missing argument to %s", argp[-2]);
X+ while (*cp == '0')
X+ cp++; /* skip any leading zeros */
X+ if (!*cp) { /* hit end of string */
X+ submajor++; /* sort subject-major */
X+ continue;
X+ }
X+ if (!isdigit(*cp) || !(datelimit = atoi(cp)))
X+ adios (NULLCP, "impossible limit %s", cp);
X+ datelimit *= 60*60*24;
X+ continue;
X+ case NLIMSW:
X+ submajor = 0; /* use date-major, but */
X+ datelimit = 0; /* use no limit */
X+ continue;
X+
X+ case VERBSW:
X+ verbose++;
X+ continue;
X+ case NVERBSW:
X+ verbose = 0;
X+ continue;
X+ }
X+ if (*cp == '+' || *cp == '@') {
X+ if (folder)
X+ adios (NULLCP, "only one folder at a time!");
X+ else
X+ folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
X+ }
X+ else
X+ msgs[msgp++] = cp;
X+ }
X+
X+ if (!m_find ("path"))
X+ free (path ("./", TFOLDER));
X+ if (!msgp)
X+ msgs[msgp++] = "all";
X+ if (!datesw)
X+ datesw = "date";
X+ if (!folder)
X+ folder = m_getfolder ();
X+ maildir = m_maildir (folder);
X+
X+ if (chdir (maildir) == NOTOK)
X+ adios (maildir, "unable to change directory to");
X+ if (!(mp = m_gmsg (folder)))
X+ adios (NULLCP, "unable to read folder %s", folder);
X+ if (mp->hghmsg == 0)
X+ adios (NULLCP, "no messages in %s", folder);
X+
X+ for (msgnum = 0; msgnum < msgp; msgnum++)
X+ if (!m_convert (mp, msgs[msgnum]))
X+ done (1);
X+ m_setseq (mp);
X+
X+ if ((nmsgs = read_hdrs (mp, datesw)) <= 0)
X+ adios (NULLCP, "no messages to sort");
X+
X+ /*
X+ * sort a list of pointers to our "messages to be sorted".
X+ */
X+ dlist = (struct smsg **) malloc ((nmsgs+1) * sizeof(*dlist));
X+ if (! dlist)
X+ adios (NULLCP, "couldn't allocate sort memory");
X+ for (i = 0; i < nmsgs; i++)
X+ dlist[i] = &smsgs[i];
X+ dlist[nmsgs] = 0;
X+
X+ if (verbose) /* announce what we're doing */
X+ if (subjsort)
X+ printf ("sorting by %s-major %s-minor\n",
X+ submajor ? subjsort : datesw,
X+ submajor ? datesw : subjsort);
X+ else
X+ printf ("sorting by datefield %s\n", datesw);
X+
X+ /* first sort by date, or by subject-major, date-minor */
X+ qsort ((char *) dlist, nmsgs, sizeof(*dlist),
X+ submajor && subjsort ? txtsort : dsort);
X+
X+ /*
X+ * if we're sorting on subject, we need another list
X+ * in subject order, then a merge pass to collate the
X+ * two sorts.
X+ */
X+ if (!submajor && subjsort) { /* already date sorted */
X+ struct smsg **slist,
X+ **flist;
X+ register struct smsg ***il,
X+ **fp,
X+ **dp;
X+
X+ slist = (struct smsg **) malloc ((nmsgs+1) * sizeof(*slist));
X+ if (! slist)
X+ adios (NULLCP, "couldn't allocate sort memory");
X+ bcopy ((char *)dlist, (char *)slist, (nmsgs+1)*sizeof(*slist));
X+ qsort ((char *)slist, nmsgs, sizeof(*slist), subsort);
X+
X+ /*
X+ * make an inversion list so we can quickly find
X+ * the collection of messages with the same subj
X+ * given a message number.
X+ */
X+ il = (struct smsg ***) calloc (mp->hghsel+1, sizeof(*il));
X+ if (! il)
X+ adios (NULLCP, "couldn't allocate msg list");
X+ for (i = 0; i < nmsgs; i++)
X+ il[slist[i]->s_msg] = &slist[i];
X+ /*
X+ * make up the final list, chronological but with
X+ * all the same subjects grouped together.
X+ */
X+ flist = (struct smsg **) malloc ((nmsgs+1) * sizeof(*flist));
X+ if (! flist)
X+ adios (NULLCP, "couldn't allocate msg list");
X+ fp = flist;
X+ for (dp = dlist; *dp;) {
X+ register struct smsg **s = il[(*dp++)->s_msg];
X+
X+ /* see if we already did this guy */
X+ if (! s)
X+ continue;
X+
X+ *fp++ = *s++;
X+ /*
X+ * take the next message(s) if there is one,
X+ * its subject isn't null and its subject
X+ * is the same as this one and it's not too
X+ * far away in time.
X+ */
X+ while (*s && (*s)->s_subj[0] &&
X+ strcmp((*s)->s_subj, s[-1]->s_subj) == 0 &&
X+ (datelimit == 0 ||
X+ (*s)->s_clock - s[-1]->s_clock <= datelimit)) {
X+ il[(*s)->s_msg] = 0;
X+ *fp++ = *s++;
X+ }
X+ }
X+ *fp = 0;
X+ (void) free (slist);
X+ (void) free (dlist);
X+ dlist = flist;
X+ }
X+ rename_msgs (mp, dlist);
X+
X+ m_replace (pfolder, folder);
X+ m_sync (mp);
X+ m_update ();
X+ done (0);
X+ }
X+
X+ static int
X+ read_hdrs (mp, datesw)
X+ register struct msgs *mp;
X+ register char *datesw;
X+ {
X+ int msgnum;
X+ struct tws tb;
X+ register struct smsg *s;
X+
X+ twscopy (&tb, dtwstime ());
X+
X+ smsgs = (struct smsg *)
X+ calloc ((unsigned) (mp->hghsel - mp->lowsel + 2),
X+ sizeof *smsgs);
X+ if (smsgs == NULL)
X+ adios (NULLCP, "unable to allocate sort storage");
X+
X+ s = smsgs;
X+ for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
X+ if (mp->msgstats[msgnum] & SELECTED) {
X+ if (getws (datesw, msgnum, s)) {
X+ s->s_msg = msgnum;
X+ s++;
X+ }
X+ }
X+ }
X+ s->s_msg = 0;
X+ return(s - smsgs);
X+ }
X+
X+ static
X+ getws (datesw, msg, smsg)
X+ register char *datesw;
X+ int msg;
X+ register struct smsg *smsg;
X+ {
X+ register int state;
X+ int compnum;
X+ char *msgnam,
X+ buf[BUFSIZ],
X+ nam[NAMESZ];
X+ register struct tws *tw;
X+ register char *datecomp = NULLCP,
X+ *subjcomp = NULLCP;
X+ register FILE *in;
X+
X+ if ((in = fopen (msgnam = m_name (msg), "r")) == NULL) {
X+ admonish (msgnam, "unable to read message");
X+ return (0);
X+ }
X+ for (compnum = 1, state = FLD;;) {
X+ switch (state = m_getfld (state, nam, buf, sizeof buf, in)) {
X+ case FLD:
X+ case FLDEOF:
X+ case FLDPLUS:
X+ compnum++;
X+ if (uleq (nam, datesw)) {
X+ datecomp = add (buf, datecomp);
X+ while (state == FLDPLUS) {
X+ state = m_getfld (state, nam, buf, sizeof buf, in);
X+ datecomp = add (buf, datecomp);
X+ }
X+ if (!subjsort || subjcomp)
X+ break;
X+ }
X+ else if (subjsort && uleq (nam, subjsort)) {
X+ subjcomp = add (buf, subjcomp);
X+ while (state == FLDPLUS) {
X+ state = m_getfld (state, nam, buf, sizeof buf, in);
X+ subjcomp = add (buf, subjcomp);
X+ }
X+ if (datecomp)
X+ break;
X+ }
X+ else {
X+ /* just flush this guy */
X+ while (state == FLDPLUS)
X+ state = m_getfld (state, nam, buf, sizeof buf, in);
X+ }
X+ continue;
X+
X+ case BODY:
X+ case BODYEOF:
X+ case FILEEOF:
X+ break;
X+
X+ case LENERR:
X+ case FMTERR:
X+ if (state == LENERR || state == FMTERR)
X+ admonish (NULLCP, "format error in message %d (header #%d)",
X+ msg, compnum);
X+ if (datecomp)
X+ free (datecomp);
X+ if (subjcomp)
X+ free (subjcomp);
X+ (void) fclose (in);
X+ return (0);
X+
X+ default:
X+ adios (NULLCP, "internal error -- you lose");
X+ }
X+ break;
X+ }
X+
X+ if (!datecomp || (tw = dparsetime (datecomp)) == NULL) {
X+ struct stat st;
X+
X+ admonish (NULLCP, "can't parse %s field in message %d",
X+ datesw, msg);
X+
X+ /* use the modify time of the file as its date */
X+ (void) fstat (fileno (in), &st);
X+ smsg->s_clock = st.st_mtime;
X+ }
X+ else
X+ smsg->s_clock = twclock (tw);
X+
X+ if (subjsort) {
X+ if (subjcomp) {
X+ /*
X+ * try to make the subject "canonical": delete
X+ * leading "re:", everything but letters & smash
X+ * letters to lower case.
X+ */
X+ register char *cp,
X+ *cp2,
X+ c;
X+
X+ cp = subjcomp;
X+ cp2 = subjcomp;
X+ if (strcmp (subjsort, "subject") == 0)
X+ while (c = *cp++) {
X+ if (! isspace(c)) {
X+ if ((c == 'r' || c == 'R') &&
X+ (cp[0] == 'e' || cp[0] == 'E') &&
X+ cp[1] == ':')
X+ cp += 2;
X+ else {
X+ if (isalnum(c))
X+ *cp2++ = isupper(c) ? tolower(c) : c;
X+ break;
X+ }
X+ }
X+ }
X+ while (c = *cp++) {
X+ if (isalnum(c))
X+ *cp2++ = isupper(c) ? tolower(c) : c;
X+
X+ }
X+ *cp2 = '\0';
X+ }
X+ else
X+ subjcomp = "";
X+
X+ smsg->s_subj = subjcomp;
X+ }
X+ (void) fclose (in);
X+ if (datecomp)
X+ free (datecomp);
X+
X+ return (1);
X+ }
X+
X+ /*
X+ * sort on dates.
X+ */
X+ static int
X+ dsort (a, b)
X+ register struct smsg **a,
X+ **b;
X+ {
X+ if ((*a)->s_clock < (*b)->s_clock)
X+ return (-1);
X+ else if ((*a)->s_clock > (*b)->s_clock)
X+ return (1);
X+ else if ((*a)->s_msg < (*b)->s_msg)
X+ return (-1);
X+ else
X+ return (1);
X+ }
X+
X+ /*
X+ * sort on subjects.
X+ */
X+ static int
X+ subsort (a, b)
X+ register struct smsg **a,
X+ **b;
X+ {
X+ register int i;
X+
X+ if (i = strcmp ((*a)->s_subj, (*b)->s_subj))
X+ return (i);
X+
X+ return (dsort (a, b));
X+ }
X+
X+ static int
X+ txtsort (a, b)
X+ register struct smsg **a,
X+ **b;
X+ {
X+ register int i;
X+
X+ if (i = strcmp ((*a)->s_subj, (*b)->s_subj))
X+ return (i);
X+ else if ((*a)->s_msg < (*b)->s_msg)
X+ return (-1);
X+ else
X+ return (1);
X+ }
X+
X+ static void rename_chain (mp, mlist, msg, endmsg)
X+ register struct msgs *mp;
X+ struct smsg **mlist;
X+ int msg,
X+ endmsg;
X+ {
X+ int nxt,
X+ old,
X+ new;
X+ char *newname,
X+ oldname[BUFSIZ];
X+
X+ nxt = mlist[msg] - smsgs;
X+ mlist[msg] = 0;
X+ old = smsgs[nxt].s_msg;
X+ new = smsgs[msg].s_msg;
X+ (void) strcpy (oldname, m_name (old));
X+ newname = m_name (new);
X+ if (verbose)
X+ printf ("message %d becomes message %d\n", old, new);
X+
X+ if (rename (oldname, newname) == NOTOK)
X+ adios (newname, "unable to rename %s to", oldname);
X+
X+ mp->msgstats[new] = mp->msgstats[old];
X+ if (mp->curmsg == old)
X+ m_setcur (mp, new);
X+
X+ if (nxt != endmsg)
X+ rename_chain (mp, mlist, nxt, endmsg);
X+ }
X+
X+ static void
X+ rename_msgs (mp, mlist)
X+ register struct msgs *mp;
X+ register struct smsg **mlist;
X+ {
X+ register int i,
X+ j,
X+ old,
X+ new;
X+ short stats;
X+ char f1[BUFSIZ],
X+ f2[BUFSIZ],
X+ tmpfil[BUFSIZ];
X+ register struct smsg *sp;
X+
X+ (void) strcpy (tmpfil, m_scratch ("", invo_name));
X+
X+ for (i = 0; i < nmsgs; i++) {
X+ if (! (sp = mlist[i]))
X+ continue; /* did this one */
X+
X+ j = sp - smsgs;
X+ if (j == i)
X+ continue; /* this one doesn't move */
X+
X+ /*
X+ * the guy that was msg j is about to become msg i.
X+ * rename 'j' to make a hole, then recursively rename
X+ * guys to fill up the hole.
X+ */
X+ old = smsgs[j].s_msg;
X+ new = smsgs[i].s_msg;
X+ (void) strcpy (f1, m_name (old));
X+
X+ if (verbose)
X+ printf ("renaming message chain from %d to %d\n", old, new);
X+
X+ if (rename (f1, tmpfil) == NOTOK)
X+ adios (tmpfil, "unable to rename %s to ", f1);
X+ stats = mp->msgstats[old];
X+
X+ rename_chain (mp, mlist, j, i);
X+ if (rename (tmpfil, m_name(new)) == NOTOK)
X+ adios (m_name(new), "unable to rename %s to", tmpfil);
X+
X+ mp->msgstats[new] = stats;
X+ mp->msgflags |= SEQMOD;
X+ }
X+ }
X*** /dev/null Thu Apr 12 15:37:43 1990
X--- ./uip/pshsbr.c Thu Apr 5 16:02:55 1990
X***************
X*** 0 ****
X--- 1,450 ----
X+ /* pshsbr.c - NNTP client subroutines */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: pshsbr.c,v 2.2 90/04/05 14:56:13 sources Exp $";
X+ #endif lint
X+
X+ /* LINTLIBRARY */
X+
X+ #include "../h/strings.h"
X+ #include "../h/nntp.h"
X+ #include <stdio.h>
X+ #include <signal.h>
X+
X+
X+ #define NOTOK (-1)
X+ #define OK 0
X+ #define DONE 1
X+
X+ #define TRM "."
X+ #define TRMLEN (sizeof TRM - 1)
X+
X+ extern int errno;
X+ extern int sys_nerr;
X+ extern char *sys_errlist[];
X+
X+ static int poprint = 0;
X+ static int pophack = 0;
X+
X+ char response[BUFSIZ];
X+
X+ static FILE *input;
X+ static FILE *output;
X+
X+ #ifdef BPOP /* stupid */
X+ static int xtnd_last = -1,
X+ xtnd_first = 0;
X+ static char xtnd_name[512]; /* INCREDIBLE HACK!! */
X+ #endif
X+
X+ static int traverse(), command(), multiline(), getline();
X+ static putline();
X+ /* */
X+
X+ #ifndef RPOP
X+ int pop_init (host, user, pass, snoop)
X+ #else RPOP
X+ int pop_init (host, user, pass, snoop, rpop)
X+ int rpop;
X+ #endif RPOP
X+ char *host,
X+ *user,
X+ *pass;
X+ int snoop;
X+ {
X+ int fd1,
X+ fd2;
X+ #ifndef RPOP
X+ int rpop = 0;
X+ #endif RPOP
X+ char buffer[BUFSIZ];
X+
X+ if ((fd1 = client (host, "tcp", "nntp", rpop, response)) == NOTOK)
X+ return NOTOK;
X+
X+ if ((fd2 = dup (fd1)) == NOTOK) {
X+ (void) sprintf (response, "unable to dup connection descriptor: %s",
X+ errno > 0 && errno < sys_nerr ? sys_errlist[errno]
X+ : "unknown error");
X+ (void) close (fd1);
X+ return NOTOK;
X+ }
X+ if (pop_set (fd1, fd2, snoop, (char *)0) == NOTOK)
X+ return NOTOK;
X+
X+ (void) signal (SIGPIPE, SIG_IGN);
X+
X+ switch (getline (response, sizeof response, input)) {
X+ case OK:
X+ if (poprint)
X+ fprintf (stderr, "<--- %s\n", response);
X+ if (*response < CHAR_ERR)
X+ return OK;
X+ else {
X+ (void) strcpy (buffer, response);
X+ (void) command ("QUIT");
X+ (void) strcpy (response, buffer);
X+ } /* fall */
X+
X+ case NOTOK:
X+ case DONE:
X+ if (poprint)
X+ fprintf (stderr, "%s\n", response);
X+ (void) fclose (input);
X+ (void) fclose (output);
X+ return NOTOK;
X+ }
X+ /* NOTREACHED */
X+ }
X+
X+ /* */
X+
X+ int pop_set (in, out, snoop, myname)
X+ int in,
X+ out,
X+ snoop;
X+ char *myname;
X+ {
X+ if (myname && *myname)
X+ strcpy (xtnd_name, myname); /* interface from bbc to msh */
X+
X+ if ((input = fdopen (in, "r")) == NULL
X+ || (output = fdopen (out, "w")) == NULL) {
X+ (void) strcpy (response, "fdopen failed on connection descriptor");
X+ if (input)
X+ (void) fclose (input);
X+ else
X+ (void) close (in);
X+ (void) close (out);
X+ return NOTOK;
X+ }
X+
X+ poprint = snoop;
X+
X+ return OK;
X+ }
X+
X+
X+ int pop_fd (in, out)
X+ char *in,
X+ *out;
X+ {
X+ (void) sprintf (in, "%d", fileno (input));
X+ (void) sprintf (out, "%d", fileno (output));
X+ return OK;
X+ }
X+
X+ /* */
X+
X+ int pop_stat (nmsgs, nbytes)
X+ int *nmsgs,
X+ *nbytes;
X+ {
X+ char **ap;
X+ extern char **brkstring();
X+
X+ if (xtnd_last < 0) { /* in msh, xtnd_name is set from myname */
X+ if (command("GROUP %s", xtnd_name) == NOTOK)
X+ return NOTOK;
X+
X+ ap = brkstring (response, " ", "\n"); /* "211 nart first last ggg" */
X+ xtnd_first = atoi (ap[2]);
X+ xtnd_last = atoi (ap[3]);
X+ }
X+
X+ /* nmsgs is not the real nart, but an incredible simuation */
X+ if (xtnd_last > 0)
X+ *nmsgs = xtnd_last - xtnd_first + 1; /* because of holes... */
X+ else
X+ *nmsgs = 0;
X+ *nbytes = xtnd_first; /* for subtracting offset in msh() */
X+
X+ return OK;
X+ }
X+
X+ int pop_exists (action)
X+ int (*action) ();
X+ {
X+ if (traverse (action, "XMSGS %d-%d", xtnd_first, xtnd_last) == OK)
X+ return OK;
X+
X+ return traverse (action, "XHDR NONAME %d-%d", xtnd_first, xtnd_last);
X+ }
X+
X+
X+ #ifndef BPOP
X+ int pop_list (msgno, nmsgs, msgs, bytes)
X+ #else BPOP
X+ int pop_list (msgno, nmsgs, msgs, bytes, ids)
X+ int *ids;
X+ #endif BPOP
X+ int msgno,
X+ *nmsgs,
X+ *msgs,
X+ *bytes;
X+ {
X+ int i;
X+ #ifndef BPOP
X+ int *ids = NULL;
X+ #endif not BPOP
X+
X+ if (msgno) {
X+ *msgs = *bytes = 0;
X+ if (command ("STAT %d", msgno) == NOTOK)
X+ return NOTOK;
X+
X+ if (ids) {
X+ *ids = msgno;
X+ }
X+ return OK;
X+ }
X+ return NOTOK;
X+ }
X+
X+ /* */
X+
X+ /* VARARGS2 */
X+
X+ static int traverse (action, fmt, a, b, c, d)
X+ int (*action) ();
X+ char *fmt,
X+ *a,
X+ *b,
X+ *c,
X+ *d;
X+ {
X+ char buffer[sizeof response];
X+
X+ if (command (fmt, a, b, c, d) == NOTOK)
X+ return NOTOK;
X+ (void) strcpy (buffer, response);
X+
X+ for (;;)
X+ switch (multiline ()) {
X+ case NOTOK:
X+ return NOTOK;
X+
X+ case DONE:
X+ (void) strcpy (response, buffer);
X+ return OK;
X+
X+ case OK:
X+ (*action) (response);
X+ break;
X+ }
X+ }
X+
X+ /* */
X+
X+ int pop_dele (msgno)
X+ int msgno;
X+ {
X+ return command ("DELE %d", msgno);
X+ }
X+
X+
X+ int pop_noop () {
X+ return command ("NOOP");
X+ }
X+
X+
X+ int pop_rset () {
X+ return command ("RSET");
X+ }
X+
X+ /* */
X+
X+ int pop_top (msgno, lines, action)
X+ int msgno,
X+ lines, /* sadly, ignored */
X+ (*action) ();
X+ {
X+ return traverse (action, "HEAD %d", msgno);
X+ }
X+
X+
X+ int pop_retr (msgno, action)
X+ int msgno,
X+ (*action) ();
X+ {
X+ return traverse (action, "ARTICLE %d", msgno);
X+ }
X+
X+
X+ #ifdef BPOP
X+
X+ int pop_xtnd (action, fmt, a, b, c, d)
X+ int (*action) ();
X+ char *fmt, *a, *b, *c, *d;
X+ {
X+ extern char **brkstring();
X+ char buffer[BUFSIZ], **ap;
X+
X+ sprintf (buffer, fmt, a, b, c, d);
X+ ap = brkstring (buffer, " ", "\n"); /* a hack, i know... */
X+
X+ if (uleq(ap[0], "x-bboards")) { /* XTND "X-BBOARDS group */
X+ /* most of these parameters are meaningless under NNTP.
X+ * bbc.c was modified to set AKA and LEADERS as appropriate,
X+ * the rest are left blank.
X+ */
X+ return OK;
X+ }
X+ if (uleq (ap[0], "archive") && ap[1]) {
X+ sprintf (xtnd_name, "%s", ap[1]); /* save the name */
X+ xtnd_last = 0;
X+ xtnd_first = 1; /* setup to fail in pop_stat */
X+ return OK;
X+ }
X+ if (uleq (ap[0], "bboards")) {
X+
X+ if (ap[1]) { /* XTND "BBOARDS group" */
X+ sprintf (xtnd_name, "%s", ap[1]); /* save the name */
X+ if (command("GROUP %s", xtnd_name) == NOTOK)
X+ return NOTOK;
X+
X+ strcpy (buffer, response); /* action must ignore extra args */
X+ ap = brkstring (response, " ", "\n");/* "211 nart first last g" */
X+ xtnd_first = atoi (ap[2]);
X+ xtnd_last = atoi (ap[3]);
X+
X+ (*action) (buffer);
X+ return OK;
X+
X+ } else { /* XTND "BBOARDS" */
X+ return traverse (action, "LIST", a, b, c, d);
X+ }
X+ }
X+ return NOTOK; /* unknown XTND command */
X+ }
X+ #endif BPOP
X+
X+ /* */
X+
X+ int pop_quit () {
X+ int i;
X+
X+ i = command ("QUIT");
X+ (void) pop_done ();
X+
X+ return i;
X+ }
X+
X+
X+ int pop_done () {
X+ (void) fclose (input);
X+ (void) fclose (output);
X+
X+ return OK;
X+ }
X+
X+ /* */
X+
X+ /* VARARGS1 */
X+
X+ static int command (fmt, a, b, c, d)
X+ char *fmt,
X+ *a,
X+ *b,
X+ *c,
X+ *d;
X+ {
X+ char *cp,
X+ buffer[BUFSIZ];
X+
X+ (void) sprintf (buffer, fmt, a, b, c, d);
X+ if (poprint)
X+ if (pophack) {
X+ if (cp = index (buffer, ' '))
X+ *cp = NULL;
X+ fprintf (stderr, "---> %s ********\n", buffer);
X+ if (cp)
X+ *cp = ' ';
X+ pophack = 0;
X+ }
X+ else
X+ fprintf (stderr, "---> %s\n", buffer);
X+
X+ if (putline (buffer, output) == NOTOK)
X+ return NOTOK;
X+
X+ switch (getline (response, sizeof response, input)) {
X+ case OK:
X+ if (poprint)
X+ fprintf (stderr, "<--- %s\n", response);
X+ return (*response < CHAR_ERR ? OK : NOTOK);
X+
X+ case NOTOK:
X+ case DONE:
X+ if (poprint)
X+ fprintf (stderr, "%s\n", response);
X+ return NOTOK;
X+ }
X+ /* NOTREACHED */
X+ }
X+
X+ static int multiline () {
X+ char buffer[BUFSIZ + TRMLEN];
X+
X+ if (getline (buffer, sizeof buffer, input) != OK)
X+ return NOTOK;
X+ #ifdef DEBUG
X+ if (poprint)
X+ fprintf (stderr, "<--- %s\n", response);
X+ #endif DEBUG
X+ if (strncmp (buffer, TRM, TRMLEN) == 0) {
X+ if (buffer[TRMLEN] == NULL)
X+ return DONE;
X+ else
X+ (void) strcpy (response, buffer + TRMLEN);
X+ }
X+ else
X+ (void) strcpy (response, buffer);
X+
X+ return OK;
X+ }
X+
X+ /* */
X+
X+ static int getline (s, n, iop)
X+ char *s;
X+ int n;
X+ FILE * iop;
X+ {
X+ int c;
X+ char *p;
X+
X+ p = s;
X+ while (--n > 0 && (c = fgetc (iop)) != EOF)
X+ if ((*p++ = c) == '\n')
X+ break;
X+ if (ferror (iop) && c != EOF) {
X+ (void) strcpy (response, "error on connection");
X+ return NOTOK;
X+ }
X+ if (c == EOF && p == s) {
X+ (void) strcpy (response, "connection closed by foreign host");
X+ return DONE;
X+ }
X+ *p = NULL;
X+ if (*--p == '\n')
X+ *p = NULL;
X+ if (*--p == '\r')
X+ *p = NULL;
X+
X+ return OK;
X+ }
X+
X+
X+ static putline (s, iop)
X+ char *s;
X+ FILE * iop;
X+ {
X+ (void) fprintf (iop, "%s\r\n", s);
X+ (void) fflush (iop);
X+ if (ferror (iop)) {
X+ (void) strcpy (response, "lost connection");
X+ return NOTOK;
X+ }
X+
X+ return OK;
X+ }
X*** ../mh-6.6.0/./uip/inc.c Thu Oct 29 15:02:24 1987
X--- ./uip/inc.c Thu Apr 5 16:03:29 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* inc.c - incorporate messages from a maildrop into a folder */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: inc.c,v 1.4 90/04/05 14:57:51 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #ifdef POP
X***************
X*** 119,125 ****
X static int pd = NOTOK;
X static FILE *pf = NULL;
X
X! int pop_action (), pop_pack ();
X #endif POP
X
X /* * /
X--- 122,129 ----
X static int pd = NOTOK;
X static FILE *pf = NULL;
X
X! static int pop_action (), pop_pack ();
X! static int map_count();
X #endif POP
X
X /* * /
X***************
X*** 562,568 ****
X noisy);
X }
X else {
X! (void) fclose (pf);
X free (cp);
X }
X
X--- 566,573 ----
X noisy);
X }
X else {
X! if (ferror(pf) || fclose (pf))
X! adios (file, "write error on");
X free (cp);
X }
X
X*** ../mh-6.6.0/./uip/scansbr.c Wed May 4 17:11:09 1988
X--- ./uip/scansbr.c Thu Apr 5 16:03:30 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* scansbr.c - routines to help scan along... */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: scansbr.c,v 1.5 90/04/05 14:57:59 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include "../h/addrsbr.h"
X***************
X*** 12,18 ****
X
X
X #define MAXSCANL 256 /* longest possible scan line */
X! #define SBUFSIZ 128 /* buffer size for content part of header
X * fields. We want this to be large
X * enough so that we don't do a lot of
X * extra FLDPLUS calls on m_getfld but
X--- 15,21 ----
X
X
X #define MAXSCANL 256 /* longest possible scan line */
X! #define SBUFSIZ 256 /* buffer size for content part of header
X * fields. We want this to be large
X * enough so that we don't do a lot of
X * extra FLDPLUS calls on m_getfld but
X***************
X*** 99,109 ****
X wantcomp[i] = cptr;
X ncomps++;
X }
X! nxtbuf = compbuffers = (char **)calloc((unsigned) ncomps,sizeof(char *));
X! used_buf = (struct comp **)calloc((unsigned) (ncomps+1),sizeof(struct comp *));
X used_buf += ncomps+1; *--used_buf = 0;
X for (i = ncomps; i--; )
X! *nxtbuf++ = malloc( SBUFSIZ );
X }
X /* each-message initialization */
X nxtbuf = compbuffers;
X--- 102,122 ----
X wantcomp[i] = cptr;
X ncomps++;
X }
X! FINDCOMP (cptr, "dtimenow");
X! if (cptr)
X! cptr->c_text = getcpy(dtimenow ());
X! nxtbuf = compbuffers = (char **)calloc((unsigned) ncomps,
X! sizeof(char *));
X! if (nxtbuf == NULL)
X! adios (NULLCP, "unable to allocate component buffers");
X! used_buf = (struct comp **)calloc((unsigned) (ncomps+1),
X! sizeof(struct comp *));
X! if (used_buf == NULL)
X! adios (NULLCP, "unable to allocate component buffer stack");
X used_buf += ncomps+1; *--used_buf = 0;
X for (i = ncomps; i--; )
X! if ((*nxtbuf++ = malloc( SBUFSIZ )) == NULL)
X! adios (NULLCP, "unable to allocate component buffer");
X }
X /* each-message initialization */
X nxtbuf = compbuffers;
X***************
X*** 120,132 ****
X return SCNEOF;
X
X if (outnum) {
X! scnmsg = m_name (outnum);
X! if (*scnmsg == '?') /* msg num out of range */
X! return SCNNUM;
X if ((scnout = fopen (scnmsg, "w")) == NULL)
X adios (scnmsg, "unable to write");
X #ifdef RPATHS
X! if ((cp = unixline ()) && *cp) {
X FPUTS ("Return-Path: ");
X FPUTS (cp);
X }
X--- 133,149 ----
X return SCNEOF;
X
X if (outnum) {
X! if (outnum > 0) { /* Fix from Van -- I'm not sure why... */
X! scnmsg = m_name (outnum);
X! if (*scnmsg == '?') /* msg num out of range */
X! return SCNNUM;
X! }
X! else
X! scnmsg = "/dev/null";
X if ((scnout = fopen (scnmsg, "w")) == NULL)
X adios (scnmsg, "unable to write");
X #ifdef RPATHS
X! if ((cp = unixline ()) && *cp != '\n') {
X FPUTS ("Return-Path: ");
X FPUTS (cp);
X }
X***************
X*** 235,247 ****
X * format and output the scan line.
X */
X finished:
X! if (noisy) {
X! if (bodycomp)
X bodycomp->c_text = tmpbuf;
X
X if (size)
X dat[2] = size;
X! else if (outnum)
X dat[2] = ftell(scnout);
X
X if ( (datecomp && ! datecomp->c_text) || (!size && !outnum)) {
X--- 252,269 ----
X * format and output the scan line.
X */
X finished:
X! {
X! char *saved_c_text;
X!
X! if (bodycomp) {
X! /* Save and restore buffer so we don't trash our dynamic pool! */
X! saved_c_text = bodycomp->c_text;
X bodycomp->c_text = tmpbuf;
X+ }
X
X if (size)
X dat[2] = size;
X! else if (outnum > 0)
X dat[2] = ftell(scnout);
X
X if ( (datecomp && ! datecomp->c_text) || (!size && !outnum)) {
X***************
X*** 251,259 ****
X dat[2] = st.st_size;
X if (datecomp) {
X if (! datecomp->c_text) {
X! struct tws dmt;
X! dmt = *dlocaltime ((long *) &st.st_mtime);
X! *datecomp->c_tws = dmt;
X datecomp->c_flags = -1;
X } else {
X datecomp->c_flags = 0;
X--- 273,284 ----
X dat[2] = st.st_size;
X if (datecomp) {
X if (! datecomp->c_text) {
X! if (datecomp->c_tws == NULL)
X! datecomp->c_tws = (struct tws *)
X! calloc((unsigned) 1, sizeof(*datecomp->c_tws));
X! if (datecomp->c_tws == NULL)
X! adios (NULLCP, "unable to allocate tws buffer");
X! *datecomp->c_tws = *dlocaltime ((long *) &st.st_mtime);
X datecomp->c_flags = -1;
X } else {
X datecomp->c_flags = 0;
X***************
X*** 261,271 ****
X }
X }
X (void) fmtscan (fmt, scanl, slwidth, dat);
X- (void) fputs (scanl, stdout);
X
X if (bodycomp)
X! bodycomp->c_text = NULLCP;
X }
X
X FINDCOMP (cptr, "encrypted");
X encrypted = cptr && cptr -> c_text;
X--- 286,297 ----
X }
X }
X (void) fmtscan (fmt, scanl, slwidth, dat);
X
X if (bodycomp)
X! bodycomp->c_text = saved_c_text;
X }
X+ if (noisy)
X+ (void) fputs (scanl, stdout);
X
X FINDCOMP (cptr, "encrypted");
X encrypted = cptr && cptr -> c_text;
X*** ../mh-6.6.0/./uip/scan.c Thu Oct 29 15:02:46 1987
X--- ./uip/scan.c Thu Apr 5 16:03:37 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* scan.c - display a one-line "scan" listing */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: scan.c,v 1.8 90/04/05 14:59:58 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include "../h/formatsbr.h"
X***************
X*** 28,43 ****
X #define WIDSW 6
X "width columns", 0,
X
X- #ifdef BERK
X #define REVSW 7
X "reverse", 0,
X #define NREVSW 8
X "noreverse", 0,
X
X! #define HELPSW 9
X! #else not BERK
X! #define HELPSW 7
X! #endif not BERK
X "help", 4,
X
X NULL, NULL
X--- 31,45 ----
X #define WIDSW 6
X "width columns", 0,
X
X #define REVSW 7
X "reverse", 0,
X #define NREVSW 8
X "noreverse", 0,
X
X! #define FILESW 9
X! "file file", 4,
X!
X! #define HELPSW 10
X "help", 4,
X
X NULL, NULL
X***************
X*** 46,51 ****
X--- 48,56 ----
X /* */
X
X extern int errno;
X+ #ifdef VAN /* global for sbr/formatsbr.c - yech! */
X+ extern struct msgs *fmt_current_folder;
X+ #endif
X
X
X void clear_screen ();
X***************
X*** 60,79 ****
X {
X int clearflag = 0,
X hdrflag = 0,
X width = 0,
X msgp = 0,
X ontty,
X state,
X msgnum;
X- #ifdef BERK
X- register int revflag = 0,
X- firstlim,
X- lastlim,
X- incr;
X- #endif BERK
X long clock;
X char *cp,
X *maildir,
X *folder = NULL,
X *form = NULL,
X *format = NULL,
X--- 65,80 ----
X {
X int clearflag = 0,
X hdrflag = 0,
X+ revflag = 0, /* used to be #ifdef BERK */
X width = 0,
X msgp = 0,
X ontty,
X state,
X msgnum;
X long clock;
X char *cp,
X *maildir,
X+ *file = NULL,
X *folder = NULL,
X *form = NULL,
X *format = NULL,
X***************
X*** 87,92 ****
X--- 88,94 ----
X FILE * in;
X
X invo_name = r1bindex (argv[0], '/');
X+ mts_init (invo_name);
X if ((cp = m_find (invo_name)) != NULL) {
X ap = brkstring (cp = getcpy (cp), " ", "\n");
X ap = copyip (ap, arguments);
X***************
X*** 142,148 ****
X adios (NULLCP, "missing argument to %s", argp[-2]);
X width = atoi (cp);
X continue;
X- #ifdef BERK
X case REVSW:
X revflag++;
X continue;
X--- 144,149 ----
X***************
X*** 149,155 ****
X case NREVSW:
X revflag = 0;
X continue;
X! #endif BERK
X }
X if (*cp == '+' || *cp == '@') {
X if (folder)
X--- 150,161 ----
X case NREVSW:
X revflag = 0;
X continue;
X!
X! case FILESW:
X! if (!(cp = *argp++) || *cp == '-')
X! adios (NULLCP, "missing argument to %s", argp[-2]);
X! file = path (cp, TFILE);
X! continue;
X }
X if (*cp == '+' || *cp == '@') {
X if (folder)
X***************
X*** 161,167 ****
X msgs[msgp++] = cp;
X }
X
X- /* */
X
X if (!m_find ("path"))
X free (path ("./", TFOLDER));
X--- 167,172 ----
X***************
X*** 191,222 ****
X
X ontty = isatty (fileno (stdout));
X
X! /* */
X
X! #ifdef BERK
X! if (revflag) {
X! firstlim = mp -> hghsel;
X! lastlim = mp -> lowsel;
X! incr = -1;
X }
X! else {
X! firstlim = mp -> lowsel;
X! lastlim = mp -> hghsel;
X! incr = 1;
X! }
X
X! for (msgnum = firstlim;
X! (revflag ? msgnum >= lastlim : msgnum <= lastlim);
X! msgnum += incr)
X! #else not BERK
X! for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
X! #endif not BERK
X if (mp -> msgstats[msgnum] & SELECTED) {
X if ((in = fopen (cp = m_name (msgnum), "r")) == NULL) {
X if (errno != EACCES)
X admonish (cp, "unable to open message");
X else
X printf ("%*d unreadable\n", DMAXFOLDER, msgnum);
X continue;
X }
X
X--- 196,236 ----
X
X ontty = isatty (fileno (stdout));
X
X! if (file) {
X! /* we've been asked to scan a maildrop file */
X! in = fopen (file, "r");
X! if (in == NULL)
X! adios (NULLCP, "can't open %s (%d)", file, errno);
X
X! m_unknown (in);
X! for (msgnum = 1; ; ++msgnum) {
X! state = scan (in, msgnum, -1, nfs, width, 0, hdrflag, 0L, 1);
X! if (state != SCNMSG && state != SCNENC)
X! break;
X! }
X! fclose (in);
X! done (0);
X }
X! #ifdef VAN
X! else
X! fmt_current_folder = mp;
X! #endif
X
X! /* */
X!
X! for (msgnum = revflag ? mp -> hghsel : mp -> lowsel;
X! (revflag ? msgnum >= mp -> lowsel : msgnum <= mp -> hghsel);
X! msgnum += revflag ? (-1) : 1)
X if (mp -> msgstats[msgnum] & SELECTED) {
X if ((in = fopen (cp = m_name (msgnum), "r")) == NULL) {
X+ #ifdef notdef
X if (errno != EACCES)
X+ #endif
X admonish (cp, "unable to open message");
X+ #ifdef notdef
X else
X printf ("%*d unreadable\n", DMAXFOLDER, msgnum);
X+ #endif
X continue;
X }
X
X***************
X*** 237,243 ****
X--- 251,261 ----
X adios (NULLCP, "scan() botch (%d)", state);
X
X case SCNEOF:
X+ #ifdef notdef
X printf ("%*d empty\n", DMAXFOLDER, msgnum);
X+ #else
X+ advise (NULLCP, "message %d: empty", msgnum);
X+ #endif
X break;
X }
X hdrflag = 0;
X***************
X*** 245,250 ****
X--- 263,271 ----
X if (ontty)
X (void) fflush (stdout);
X }
X+ #ifdef VAN
X+ m_sync (mp); /* because formatsbr might have made changes */
X+ #endif
X
X /* */
X
X*** ../mh-6.6.0/./uip/annosbr.c Thu Oct 29 15:02:10 1987
X--- ./uip/annosbr.c Thu Apr 5 16:02:53 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* annosbr.c - prepend annotation to messages */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: annosbr.c,v 2.4 90/04/05 15:35:09 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include "../zotnet/tws.h"
X***************
X*** 9,24 ****
X
X
X extern int errno;
X-
X long lseek ();
X
X /* */
X
X! annotate (file, comp, text, inplace)
X register char *file,
X *comp,
X *text;
X! int inplace;
X {
X int i,
X fd;
X--- 12,28 ----
X
X
X extern int errno;
X long lseek ();
X+ static annosbr();
X
X /* */
X
X! annotate (file, comp, text, inplace, datesw)
X register char *file,
X *comp,
X *text;
X! int inplace,
X! datesw;
X {
X int i,
X fd;
X***************
X*** 35,41 ****
X return 1;
X }
X
X! i = annosbr (fd, file, comp, text, inplace);
X
X (void) lkclose (fd, file);
X
X--- 39,45 ----
X return 1;
X }
X
X! i = annosbr (fd, file, comp, text, inplace, datesw);
X
X (void) lkclose (fd, file);
X
X***************
X*** 44,55 ****
X
X /* */
X
X! static annosbr (src, file, comp, text, inplace)
X register char *file,
X *comp,
X *text;
X int src,
X! inplace;
X {
X int mode,
X fd;
X--- 48,60 ----
X
X /* */
X
X! static annosbr (src, file, comp, text, inplace, datesw)
X register char *file,
X *comp,
X *text;
X int src,
X! inplace,
X! datesw;
X {
X int mode,
X fd;
X***************
X*** 70,76 ****
X }
X (void) chmod (tmpfil, mode);
X
X! fprintf (tmp, "%s: %s\n", comp, dtimenow ());
X if (cp = text) {
X do {
X while (*cp == ' ' || *cp == '\t')
X--- 75,82 ----
X }
X (void) chmod (tmpfil, mode);
X
X! if (datesw)
X! fprintf (tmp, "%s: %s\n", comp, dtimenow ());
X if (cp = text) {
X do {
X while (*cp == ' ' || *cp == '\t')
X***************
X*** 99,105 ****
X else {
X (void) strcpy (buffer, m_backup (file));
X if (rename (file, buffer) == NOTOK) {
X! admonish (buffer, "unable to rename %s to", file);
X return 1;
X }
X if (rename (tmpfil, file) == NOTOK) {
X--- 105,119 ----
X else {
X (void) strcpy (buffer, m_backup (file));
X if (rename (file, buffer) == NOTOK) {
X! switch (errno) {
X! case ENOENT: /* unlinked early - no annotations */
X! (void) unlink (tmpfil);
X! break;
X!
X! default:
X! admonish (buffer, "unable to rename %s to", file);
X! break;
X! }
X return 1;
X }
X if (rename (tmpfil, file) == NOTOK) {
X*** ../mh-6.6.0/./uip/bbc.c Wed May 4 17:47:01 1988
X--- ./uip/bbc.c Thu Apr 5 16:02:56 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* bbc.c - ZOTnet BBoard checker */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: bbc.c,v 2.5 90/04/05 14:56:21 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include "../zotnet/bboards.h"
X***************
X*** 22,28 ****
X #include <sys/resource.h>
X #endif SIGTSTP
X
X-
X #define RCFILE ".bbrc"
X
X #define NBB 100
X--- 25,30 ----
X***************
X*** 63,69 ****
X #define FILESW 12
X "file BBoardsfile", 4,
X #define USERSW 13
X! "user BBoardsuser", 4,
X
X #define HOSTSW 14
X "host host",
X--- 65,76 ----
X #define FILESW 12
X "file BBoardsfile", 4,
X #define USERSW 13
X! "user BBoardsuser",
X! #ifndef NNTP
X! 4,
X! #else NNTP
X! -4,
X! #endif NNTP
X
X #define HOSTSW 14
X "host host",
X***************
X*** 141,147 ****
X--- 148,160 ----
X
X struct bbcount *add_count (), *seek_count ();
X struct bboard *getbbaux (), *getbbvis ();
X+ static void bbreset();
X
X+ #ifdef UCL
X+ extern char *bbs[];
X+ extern int called_bbc;
X+ static int bbp;
X+ #endif UCL
X /* */
X
X /* ARGSUSED */
X***************
X*** 150,157 ****
X--- 163,174 ----
X int argc;
X char **argv;
X {
X+ #ifndef UCL
X int bbp = 0,
X vecp = 1;
X+ #else UCL
X+ int vecp = 1;
X+ #endif UCL
X char *cp,
X *rc=NULL,
X **ap,
X***************
X*** 158,166 ****
X--- 175,189 ----
X **argp,
X buffer[80],
X *arguments[MAXARGS],
X+ #ifndef UCL
X *bbs[NBB + 1],
X+ #endif UCL
X *vec[MAXARGS];
X
X+ #ifdef UCL
X+ called_bbc = 1;
X+ bbp = 0;
X+ #endif UCL
X invo_name = r1bindex (argv[0], '/');
X #ifdef BPOP
X mts_init (invo_name);
X***************
X*** 295,302 ****
X--- 318,332 ----
X for (bbp = 0; cp = bbs[bbp]; bbp++)
X add_bb (cp, NOTOK);
X
X+ #ifdef UCL
X+ if (topicsw) {
X+ called_bbc = 0;
X+ topics ();
X+ }
X+ #else
X if (topicsw)
X topics ();
X+ #endif
X else {
X default_bboards ();
X if (checksw)
X***************
X*** 449,455 ****
X {
X int diff;
X #ifdef SIGTSTP
X! int (*tstat) ();
X #endif SIGTSTP
X register struct bboard *bb;
X
X--- 479,485 ----
X {
X int diff;
X #ifdef SIGTSTP
X! TYPESIG (*tstat) ();
X #endif SIGTSTP
X register struct bboard *bb;
X
X***************
X*** 465,471 ****
X printf ("%s -- empty\n", bb -> bb_name);
X continue;
X }
X! else
X if (verbosw || archivesw || diff > 0)
X bbread (bb, vecp, vec);
X else
X--- 495,508 ----
X printf ("%s -- empty\n", bb -> bb_name);
X continue;
X }
X! else {
X! if (diff < 0) {
X! printf (
X! "Oops! looks like someone reset %s -- assuming all unseen\n",
X! bb -> bb_name);
X! diff = bb -> bb_maxima;
X! bbreset (bb, 0);
X! }
X if (verbosw || archivesw || diff > 0)
X bbread (bb, vecp, vec);
X else
X***************
X*** 473,479 ****
X printf ("%s -- %d item%s (all seen)\n",
X bb -> bb_name, bb -> bb_maxima,
X plural (bb -> bb_maxima));
X!
X };
X
X #ifdef SIGTSTP
X--- 510,516 ----
X printf ("%s -- %d item%s (all seen)\n",
X bb -> bb_name, bb -> bb_maxima,
X plural (bb -> bb_maxima));
X! }
X };
X
X #ifdef SIGTSTP
X***************
X*** 523,530 ****
X }
X if (pop_stat (&nmsgs, &nbytes) == NOTOK)
X adios (NULLCP, "%s", response);
X! if (nmsgs == 0)
X return;
X if (pop_fd (buf4, buf5) == NOTOK)
X adios (NULLCP, "%s", response);
X }
X--- 560,570 ----
X }
X if (pop_stat (&nmsgs, &nbytes) == NOTOK)
X adios (NULLCP, "%s", response);
X! if (nmsgs == 0) {
X! if (verbosw)
X! printf ("%s -- empty\n", bb -> bb_name);
X return;
X+ }
X if (pop_fd (buf4, buf5) == NOTOK)
X adios (NULLCP, "%s", response);
X }
X***************
X*** 596,602 ****
X int i,
X j,
X n;
X! int (*estat) (), (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X char buffer[BUFSIZ];
X struct bbcount *selected;
X
X--- 636,642 ----
X int i,
X j,
X n;
X! TYPESIG (*estat) (), (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X char buffer[BUFSIZ];
X struct bbcount *selected;
X
X***************
X*** 723,729 ****
X /* */
X
X rcend () {
X! int (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X register FILE *bbrc;
X
X if (!changed)
X--- 763,769 ----
X /* */
X
X rcend () {
X! TYPESIG (*hstat) (), (*istat) (), (*qstat) (), (*tstat) ();
X register FILE *bbrc;
X
X if (!changed)
X***************
X*** 793,799 ****
X--- 833,853 ----
X #endif SIGTSTP
X
X /* */
X+ static void bbreset (bb, i)
X+ register struct bboard *bb;
X+ int i;
X+ {
X+ struct bbcount *selected;
X
X+ bb -> bb_count = i;
X+ if ((selected = seek_count (bbc, bb -> bb_name)) == NULL)
X+ bbc = add_count (bbc, bb -> bb_name, i);
X+ else
X+ selected -> count = i;
X+
X+ changed++;
X+ }
X+
X struct bbcount *add_count (p, w, i)
X register struct bbcount *p;
X register char *w;
X***************
X*** 837,842 ****
X--- 891,899 ----
X default_bboards () {
X register char *cp,
X **ap;
X+ #ifdef UCL
X+ register int i = bbp;
X+ #endif UCL
X
X if (bbl != NULL)
X return;
X***************
X*** 847,853 ****
X--- 904,917 ----
X #else BPOP
X for (ap = getip (cp); *ap; ap++)
X #endif BPOP
X+ #ifndef UCL
X add_bb (*ap, OK);
X+ #else UCL
X+ bbs[bbp++] = *ap;
X+ bbs[bbp] = NULL;
X+ while (i < bbp)
X+ add_bb (bbs[i++], OK);
X+ #endif UCL
X #ifndef BPOP
X free (cp);
X #endif not BPOP
X***************
X*** 855,862 ****
X advise (NULLCP, "please fix the %s: entry in your %s file",
X "bboards", mh_profile);
X }
X! else
X add_bb ("system", NOTOK);
X
X if (bbl == NULL)
X done (1);
X--- 919,942 ----
X advise (NULLCP, "please fix the %s: entry in your %s file",
X "bboards", mh_profile);
X }
X! else {
X! #ifdef UCL
X! bbs[bbp++] = "system";
X! bbs[bbp] = NULL;
X! #endif UCL
X! #ifndef NNTP
X add_bb ("system", NOTOK);
X+ #else NNTP
X+ add_bb ("general", NOTOK);
X+ #ifdef UCI
X+ add_bb ("ics.system", NOTOK);
X+ add_bb ("ics.general", NOTOK);
X+ #endif UCI
X+ #endif NNTP
X+ }
X+ #ifdef UCL
X+ bbs[bbp] = NULL;
X+ #endif UCL
X
X if (bbl == NULL)
X done (1);
X***************
X*** 913,927 ****
X--- 993,1023 ----
X if ((bb = (struct bboard *) calloc (1, sizeof *bb)) == NULL)
X adios (NULLCP, "insufficient memory");
X bb -> bb_name = getcpy (name);
X+ #ifdef NNTP
X+ if (index(name, '.')) {
X+ char *cp;
X+ bb -> bb_aka = getip (name);
X+ for (cp = *bb -> bb_aka; *cp; cp++)
X+ if (*cp == '.')
X+ *cp = '-';
X+ } else {
X+ #endif
X if ((bb -> bb_aka = (char **) calloc (1, sizeof *bb -> bb_aka)) == NULL)
X adios (NULLCP, "insufficient memory");
X *bb -> bb_aka = NULL;
X+ #ifdef NNTP
X+ }
X+ #endif NNTP
X bb -> bb_file = bb -> bb_archive = bb -> bb_info = bb -> bb_map = "";
X bb -> bb_passwd = "";
X+ #ifndef NNTP
X if ((bb -> bb_leader = (char **) calloc (1, sizeof *bb -> bb_leader))
X == NULL)
X adios (NULLCP, "insufficient memory");
X *bb -> bb_leader = NULL;
X+ #else NNTP
X+ bb -> bb_leader = getip ("usenet");
X+ #endif NNTP
X bb -> bb_addr = bb -> bb_request = bb -> bb_relay = "";
X if ((bb -> bb_dist = (char **) calloc (1, sizeof *bb -> bb_dist)) == NULL)
X adios (NULLCP, "insufficient memory");
X***************
X*** 946,955 ****
X static int xtnd3 (s)
X char *s;
X {
X! static int bbs = 0;
X static struct bboard *bb;
X
X! switch (bbs++) {
X case 0:
X for (bb = Bhead; bb; bb = bb -> bb_chain)
X if (strcmp (bb -> bb_name, s) == 0)
X--- 1042,1051 ----
X static int xtnd3 (s)
X char *s;
X {
X! static int bbs_int = 0;
X static struct bboard *bb;
X
X! switch (bbs_int++) {
X case 0:
X for (bb = Bhead; bb; bb = bb -> bb_chain)
X if (strcmp (bb -> bb_name, s) == 0)
X***************
X*** 1006,1012 ****
X break;
X case 13:
X bb -> bb_date = getcpy (s);
X! bbs = 0;
X break;
X }
X
X--- 1102,1108 ----
X break;
X case 13:
X bb -> bb_date = getcpy (s);
X! bbs_int = 0;
X break;
X }
X
X*** ../mh-6.6.0/./uip/bbl.c Thu Oct 29 15:02:12 1987
X--- ./uip/bbl.c Thu Apr 5 16:07:44 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* bbl.c - ease the tasks of a BBleader */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: bbl.c,v 2.1 90/04/05 14:56:46 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include "../h/local.h"
X***************
X*** 265,271 ****
X--- 268,278 ----
X {
X int child_id;
X struct stat st;
X+ #ifdef SYS5DIR
X+ struct dirent *dp;
X+ #else SYS5DIR
X struct direct *dp;
X+ #endif SYS5DIR
X DIR * dd;
X
X if (verbosw)
X*** ../mh-6.6.0/./uip/anno.c Thu Oct 29 15:02:09 1987
X--- ./uip/anno.c Thu Apr 5 16:02:54 1990
X***************
X*** 1,9 ****
X--- 1,13 ----
X /* anno.c - annotate messages */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: anno.c,v 2.3 90/04/05 15:35:14 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include <ctype.h>
X #include <stdio.h>
X
X+ static make_comp();
X /* */
X
X static struct swit switches[] = {
X***************
X*** 15,24 ****
X #define NINPLSW 2
X "noinplace", 0,
X
X! #define TEXTSW 3
X "text body", 0,
X
X! #define HELPSW 4
X "help", 4,
X
X NULL, NULL
X--- 19,33 ----
X #define NINPLSW 2
X "noinplace", 0,
X
X! #define DATESW 3
X! "date", 0,
X! #define NDATESW 4
X! "nodate", 0,
X!
X! #define TEXTSW 5
X "text body", 0,
X
X! #define HELPSW 6
X "help", 4,
X
X NULL, NULL
X***************
X*** 33,38 ****
X--- 42,48 ----
X char **argv;
X {
X int inplace = 0,
X+ datesw = 1,
X msgp = 0,
X msgnum;
X char *cp,
X***************
X*** 80,85 ****
X--- 90,102 ----
X adios (NULLCP, "missing argument to %s", argp[-2]);
X continue;
X
X+ case DATESW:
X+ datesw++;
X+ continue;
X+ case NDATESW:
X+ datesw = 0;
X+ continue;
X+
X case INPLSW:
X inplace++;
X continue;
X***************
X*** 103,108 ****
X--- 120,129 ----
X else
X msgs[msgp++] = cp;
X }
X+ #ifdef UCI
X+ if (strcmp(invo_name, "fanno") == 0) /* ugh! */
X+ datesw = 0;
X+ #endif UCI
X
X /* */
X
X***************
X*** 129,135 ****
X
X for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
X if (mp -> msgstats[msgnum] & SELECTED)
X! (void) annotate (m_name (msgnum), comp, text, inplace);
X
X m_replace (pfolder, folder);
X if (mp -> lowsel != mp -> curmsg)
X--- 150,156 ----
X
X for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
X if (mp -> msgstats[msgnum] & SELECTED)
X! (void) annotate (m_name (msgnum), comp, text, inplace, datesw);
X
X m_replace (pfolder, folder);
X if (mp -> lowsel != mp -> curmsg)
X*** ../mh-6.6.0/./uip/conflict.c Thu Oct 29 15:02:16 1987
X--- ./uip/conflict.c Thu Apr 5 16:03:26 1990
X***************
X*** 1,4 ****
X--- 1,7 ----
X /* conflict.c - the new conflict */
X+ #ifndef lint
X+ static char ident[] = "@(#)$Id: conflict.c,v 2.2 90/04/05 14:57:02 sources Exp $";
X+ #endif lint
X
X #include "../h/mh.h"
X #include "../h/aliasbr.h"
X***************
X*** 127,138 ****
X int akp;
X register char **akv;
X {
X! register int i;
X
X for (i = 0; i < akp; i++)
X! if ((i = alias (akv[i])) != AK_OK) {
X setup ();
X! fprintf (out, "aliasing error in %s - %s\n", akv[i], akerror (i));
X }
X else
X if (out && !mail)
X--- 130,141 ----
X int akp;
X register char **akv;
X {
X! register int i, err;
X
X for (i = 0; i < akp; i++)
X! if ((err = alias (akv[i])) != AK_OK) {
X setup ();
X! fprintf (out, "aliasing error in %s - %s\n", akv[i], akerror (err));
X }
X else
X if (out && !mail)
X***************
X*** 284,290 ****
X--- 287,297 ----
X register char *drop;
X {
X register int hit = 0;
X+ #ifdef SYS5DIR
X+ register struct dirent *dp;
X+ #else SYS5DIR
X register struct direct *dp;
X+ #endif SYS5DIR
X register DIR *dd = opendir (drop);
X
X if (!dd) {
+ END-OF-FILE MH.6.6.8
chmod 'u=rw,g=r,o=r' 'MH.6.6.8'
echo ' -rw-r--r-- 1 mh 49552 Apr 13 13:53 MH.6.6.8 (as sent)'
echo -n ' '
/bin/ls -l MH.6.6.8
exit 0
More information about the Comp.sources.bugs
mailing list