Xref: utzoo alt.folklore.computers:10231 misc.misc:11445 alt.sources:3440 Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: alt.folklore.computers,misc.misc,alt.sources Subject: Re: Jargon File Version is 2.7.1 Message-ID: <=LY9CM3@xds13.ferranti.com> Date: 7 Mar 91 19:17:43 GMT References: <1Zdm1N#6ywzzw8vnnG11rTV0O3Pg9MJ=eric@snark.thyrsus.com> <1991Mar5.115350.22361@gdr.bath.ac.uk> <1ZgmWc#02nhn98XshJO3XTCw17MjXDN=eric@snark.thyrsus.com> <19090@rpp386.cactus.org> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Followup-To: alt.folklore.computers,misc.misc,alt.sources.d Organization: Xenix Support, FICC Lines: 96 What is this discussion doing in alt.sources? In article <19090@rpp386.cactus.org> jfh@rpp386.cactus.org (John F Haugh II) writes: > Could you please limit it to newsgroups that I don't carry? I am getting > a bit tired of Jargon File du jour. Is there anyone else that feels the > same way? Can I get an "Amen" brother? I'm glad he finally started sending it to newsgroups I *do* carry. I've been wondering why the file hasn't been showing up recently. Alt.sources is a fine place for it. -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you debugged your wolf today?" -- Obligatory Source: a program to split mailbox files. #include #include #ifdef USG #define MAILBOX "/usr/mail/%s" #else #define MAILBOX "/usr/spool/mail/%s" #endif #define STRLEN 255 char line[STRLEN]; getline(fp, line) FILE *fp; char *line; { fgets(line, STRLEN, fp); line[strlen(line)-1] = 0; } main(ac, av) int ac; char **av; { FILE *fp = 0; while(--ac) if(fp = fopen(*++av, "r")) { fsplit(fp); fclose(fp); } else { perror(*av); exit(1); } if(!fp) { char buffer[255]; char *p, *getenv(), *getlogin(); if(!(p = getenv("MAIL"))) { if(!(p = getenv("LOGNAME"))) { if(!(p = getlogin())) { fprintf(stderr, "/etc/passwd: No login name.\n"); exit(1); } sprintf(buffer, MAILBOX, p); } } else sprintf(buffer, "%s", p); if(!(fp = fopen(buffer, "r"))) { perror(buffer); exit(1); } fsplit(fp); fclose(fp); } } fsplit(fp) FILE *fp; { char outname[16]; int outfile=0; FILE *outfp = 0; while(1) { getline(fp, line); if(feof(fp)) break; if(!strncmp(line, "From ", 5)) { if(outfp) fclose(outfp); sprintf(outname, "%d", ++outfile); if(!(outfp = fopen(outname, "w"))) { perror(outname); exit(1); } } if(outfp) fprintf(outfp, "%s\n", line); } if(outfp) fclose(outfp); }