Annotation of researchv10no/cmd/upas/common/mail.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: #include "mail.h"
                      3: #include "string.h"
                      4: 
                      5: /* format of REMOTE FROM lines */
                      6: char *REMFROMRE =
                      7:        "^>?From[ \t]+([^ \t]+)[ \t]+(.+)[ \t]+remote[ \t]+from[ \t]+(.*)\n$";
                      8: int REMSENDERMATCH = 1;
                      9: int REMDATEMATCH = 2;
                     10: int REMSYSMATCH = 3;
                     11: 
                     12: /* format of LOCAL FROM lines */
                     13: char *FROMRE =
                     14:        "^>?From[ \t]+([^ \t]+)[ \t]+(.+)\n$";
                     15: int SENDERMATCH = 1;
                     16: int DATEMATCH = 2;
                     17: 
                     18: /* output a unix style local header */
                     19: void
                     20: print_header(fp, sender, date)
                     21:        FILE *fp;
                     22:        char *sender, *date;
                     23: {
                     24:        fprintf(fp, "From %s %s\n", sender, date);
                     25: }
                     26: 
                     27: /* output a unix style remote header */
                     28: void
                     29: print_remote_header(fp, sender, date, system)
                     30:        FILE *fp;
                     31:        char *sender, *date, *system;
                     32: {
                     33:        fprintf(fp, "From %s %s remote from %s\n", sender, date, system);
                     34: }
                     35: 
                     36: /* parse a mailbox style header */
                     37: int
                     38: parse_header(line, sender, date)
                     39:        register char *line;
                     40:        register string *sender, *date;
                     41: {
                     42:        if (!IS_HEADER(line))
                     43:                return -1;
                     44:        line += sizeof("From ") - 1;
                     45:        s_restart(sender);
                     46:        while(*line==' '||*line=='\t')
                     47:                line++;
                     48:        while(*line&&*line!=' '&&*line!='\t')
                     49:                s_putc(sender, *line++);
                     50:        s_terminate(sender);
                     51:        s_restart(date);
                     52:        while(*line==' '||*line=='\t')
                     53:                line++;
                     54:        while(*line)
                     55:                s_putc(date, *line++);
                     56:        s_terminate(date);
                     57:        return 0;
                     58: }

unix.superglobalmegacorp.com

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