Annotation of 43BSD/contrib/notes/src/prtind.c, revision 1.1

1.1     ! root        1: #include       "parms.h"
        !             2: #include       "structs.h"
        !             3: 
        !             4: #ifdef RCSIDENT
        !             5: static char rcsid[] = "$Header: prtind.c,v 1.7.0.1 85/03/18 20:56:33 notes Rel $";
        !             6: #endif RCSIDENT
        !             7: 
        !             8: /*
        !             9:  *     print the index page for a notefile
        !            10:  *
        !            11:  *     Original author: Rob Kolstad    Winter, 1980.
        !            12:  *     Modifications:  Ray Essick      June 1981.
        !            13:  *
        !            14:  */
        !            15: 
        !            16: 
        !            17: prntind (io, firstdis, lastdis)
        !            18: struct io_f *io;
        !            19: int    *firstdis,
        !            20:        *lastdis;
        !            21: {
        !            22:     struct note_f   note;
        !            23:     struct when_f   date;
        !            24:     char    buf[NAMESZ + SYSSZ + 2];                   /* hold sys!author for truncation */
        !            25:     int     atrow;                                     /* printing row counter */
        !            26:     int     lyr,
        !            27:             lday,
        !            28:             lmon;                                      /* so we know if need to reprint date */
        !            29:     int     i;
        !            30: 
        !            31:     erase ();
        !            32:     at (1, 2);
        !            33:     printf ("%s", io -> descr.d_title);                        /* dump title */
        !            34:     gettime (&date);
        !            35:     at (1, 58);
        !            36:     prdate (&date);
        !            37: 
        !            38:     if (io -> descr.d_stat & ISARCH)
        !            39:     {
        !            40:        at (2, 2);
        !            41: #ifdef WRITEARCH                                       /* archive writes? */
        !            42:        printf ("[ARCHIVE]");
        !            43: #else  ! WRITEARCH
        !            44:        printf ("[ARCHIVE - NO WRITES]");
        !            45: #endif WRITEARCH
        !            46:     }
        !            47: 
        !            48:     atrow = 5;                                         /* start printing here */
        !            49:     lyr = lday = lmon = 0;                             /* unknown prev date */
        !            50:     if (*firstdis > io -> descr.d_nnote - Nindex + 1)
        !            51:        *firstdis = io -> descr.d_nnote - Nindex + 1;
        !            52:     if (*firstdis < 1)
        !            53:        *firstdis = 1;
        !            54:     *lastdis = *firstdis + Nindex - 1;
        !            55:     for (i = *firstdis; (i <= *lastdis) & (i <= io -> descr.d_nnote); i++)
        !            56:     {                                                  /* which does not execute for empty file */
        !            57:        getnrec (io, i, &note);
        !            58:        if (note.n_stat & DELETED)
        !            59:        {
        !            60:            if (++(*lastdis) > io -> descr.d_nnote)
        !            61:                *lastdis = io -> descr.d_nnote;
        !            62:            continue;                                   /* deleted note */
        !            63:        }
        !            64:        if (note.n_rcvd.w_year != lyr ||
        !            65:                note.n_rcvd.w_month != lmon ||
        !            66:                note.n_rcvd.w_day != lday)              /* need to print date? */
        !            67:        {
        !            68:            at (atrow, 1);
        !            69:            printf ("%d/%d", lmon = note.n_rcvd.w_month, lday = note.n_rcvd.w_day);
        !            70:            if (note.n_rcvd.w_year != lyr)
        !            71:                printf ("/%02d", (lyr = note.n_rcvd.w_year) % 100);
        !            72:        }
        !            73:        at (atrow, 10);
        !            74:        printf ("%3d", i);
        !            75:        if (note.n_stat & DIRMES)
        !            76:            printf ("*");
        !            77:        else
        !            78:            printf (" ");
        !            79:        clearerr (stdout);
        !            80:        fwrite (note.ntitle, 1, strlen (note.ntitle), stdout);
        !            81:        if (note.n_nresp != 0)
        !            82:        {
        !            83:            at (atrow, 10 + 4 + TITLEN + 1);
        !            84:            printf ("%3d", note.n_nresp);
        !            85:        }
        !            86:        at (atrow, 10 + 4 + TITLEN + 1 + 3 + 1);
        !            87:        if (strcmp (Authsystem, note.n_auth.asystem) != 0 &&
        !            88:                strcmp ("Anonymous", note.n_auth.aname) != 0)
        !            89:        {
        !            90: #ifdef USERHOST
        !            91:            sprintf (buf, "%s@%s", note.n_auth.aname, note.n_auth.asystem);
        !            92: #else
        !            93:            sprintf (buf, "%s!%s", note.n_auth.asystem, note.n_auth.aname);
        !            94: #endif USERHOST
        !            95:        }
        !            96:        else
        !            97:            sprintf (buf, "%s", note.n_auth.aname);
        !            98: 
        !            99:        buf[26] = '\0';                                 /* don't overflow line */
        !           100:        printf ("%s", buf);
        !           101:        if (isinput ())
        !           102:            return;                                     /* he typed */
        !           103:        atrow++;
        !           104:        if (intflag)                                    /* did he want out? */
        !           105:        {
        !           106:            *lastdis = i;                               /* show last displayed */
        !           107:            intflag = 0;                                /* don't do same one twice */
        !           108:        }
        !           109:     }
        !           110: 
        !           111:     if (*lastdis >= io -> descr.d_nnote)
        !           112:     {
        !           113:        at (++atrow, 14);
        !           114:        printf ("**** End of Notes ****");
        !           115:     }
        !           116: 
        !           117:     at (atrow + 2, 25);
        !           118:     printf ("- - - - - - - - - - - - - - -");
        !           119: 
        !           120: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.