Annotation of 43BSD/contrib/nntp/server/list.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char    *sccsid = "@(#)list.c   1.3     (Berkeley) 3/5/86";
                      3: #endif
                      4: 
                      5: #include "common.h"
                      6: 
                      7: /*
                      8:  * LIST
                      9:  *
                     10:  * List active newsgroups.
                     11:  *
                     12:  */
                     13: 
                     14: list(argc, argv)
                     15: int    argc;
                     16: char   *argv[];
                     17: {
                     18:        char            line[MAX_STRLEN];
                     19:        register char   *cp;
                     20:        register FILE   *active_fp;
                     21: 
                     22:        active_fp = fopen(ACTIVE_FILE, "r");
                     23: 
                     24:        if (active_fp == NULL) {
                     25:                printf("%d No list of newsgroups available.\r\n", ERR_FAULT);
                     26:                (void) fflush(stdout);
                     27:                syslog(LOG_ERR, "list: fopen %s: %m", ACTIVE_FILE);
                     28:                return;
                     29:        }
                     30: 
                     31:        printf("%d Newsgroups in form \"group high low y/n\".\r\n", OK_GROUPS);
                     32: 
                     33:        while (fgets(line, sizeof(line), active_fp) != NULL) {
                     34:                if ((cp = index(line, '\n')) != NULL)
                     35:                        *cp = '\0';
                     36:                printf("%s\r\n", line);
                     37:        }
                     38:        (void) fclose(active_fp);
                     39: 
                     40:        printf(".\r\n");
                     41:        (void) fflush(stdout);
                     42: }

unix.superglobalmegacorp.com

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