added code to do accounting for -T flag for netnews:
authorKurt A. Shoens <kurt@ucbvax.Berkeley.EDU>
Tue, 21 Jul 1981 08:06:19 +0000 (00:06 -0800)
committerKurt A. Shoens <kurt@ucbvax.Berkeley.EDU>
Tue, 21 Jul 1981 08:06:19 +0000 (00:06 -0800)
now records in the file of your choice the article-id's which were read
or deleted

SCCS-vsn: usr.bin/mail/fio.c 2.2

usr/src/usr.bin/mail/fio.c

index e43f068..7c4a934 100644 (file)
@@ -10,7 +10,7 @@
  * File I/O.
  */
 
  * File I/O.
  */
 
-static char *SccsId = "@(#)fio.c       2.1 %G%";
+static char *SccsId = "@(#)fio.c       2.2 %G%";
 
 /*
  * Set up the input pointers while copying the mail file into
 
 /*
  * Set up the input pointers while copying the mail file into
@@ -292,24 +292,32 @@ edstop()
 {
        register int gotcha, c;
        register struct message *mp;
 {
        register int gotcha, c;
        register struct message *mp;
-       FILE *obuf, *ibuf;
+       FILE *obuf, *ibuf, *readstat;
        struct stat statb;
        struct stat statb;
-       char tempname[30];
+       char tempname[30], *id;
        int (*sigs[3])();
 
        if (readonly)
                return;
        holdsigs();
        int (*sigs[3])();
 
        if (readonly)
                return;
        holdsigs();
+       if (Tflag != NOSTR) {
+               if ((readstat = fopen(Tflag, "w")) == NULL)
+                       Tflag = NOSTR;
+       }
        for (mp = &message[0], gotcha = 0; mp < &message[msgCount]; mp++) {
                if (mp->m_flag & MNEW) {
                        mp->m_flag &= ~MNEW;
                        mp->m_flag |= MSTATUS;
                }
        for (mp = &message[0], gotcha = 0; mp < &message[msgCount]; mp++) {
                if (mp->m_flag & MNEW) {
                        mp->m_flag &= ~MNEW;
                        mp->m_flag |= MSTATUS;
                }
-               if (mp->m_flag & (MODIFY|MDELETED|MSTATUS)) {
+               if (mp->m_flag & (MODIFY|MDELETED|MSTATUS))
                        gotcha++;
                        gotcha++;
-                       break;
+               if (Tflag != NOSTR && (mp->m_flag & (MREAD|MDELETED)) != 0) {
+                       if ((id = hfield("article-id", mp)) != NOSTR)
+                               fprintf(readstat, "%s\n", id);
                }
        }
                }
        }
+       if (Tflag != NOSTR)
+               fclose(readstat);
        if (!gotcha)
                goto done;
        ibuf = NULL;
        if (!gotcha)
                goto done;
        ibuf = NULL;