Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.mel.connect.com.au!news.mira.net.au!vic.news.telstra.net!act.news.telstra.net!psgrain!reuter.cse.ogi.edu!news.co.intel.com!chnews!itnews.sc.intel.com!news.sprintlink.net!news-stk-200.sprintlink.net!tank.news.pipex.net!pipex!dish.news.pipex.net!pipex!tube.news.pipex.net!pipex!lade.news.pipex.net!pipex!news.be.innet.net!INbe.net!news.nl.innet.net!INnl.net!hunter.premier.net!netne ws.worldnet.att.net!ix.netcom.com!netcom.net.uk!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail From: brian@awfulhak.demon.co.uk (Brian Somers) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Problems redirecting e-mail Date: 26 Jun 1996 02:11:50 -0500 Organization: Coverform Ltd. Lines: 52 Message-ID: <4qqnrm$14r@anorak.coverform.lan> References: <31CEC62E.664C@host.bemarnet.es> NNTP-Posting-Host: localhost.coverform.lan X-NNTP-Posting-Host: awfulhak.demon.co.uk X-Newsreader: TIN [version 1.2 PL2] Antonio Navarro Navarro (antonio@host.bemarnet.es) wrote: [stuff deleted] : foo: "|/usr/local/bin/process" [stuff deleted] : #include <stdio.h> : #include <stdlib.h> : int main() { : int x; : char ch; : file *output; : output=fopen("/usr/local/bin/majordomo.txt", "a+"); : for(x=0;(!feof(stdin));x++) { : ch=fgetc(stdin); : putc(ch, output); : } : fclose(output); : return(0); : } [stuff deleted] : Memory fault Hmm, wouldn't you be better putting foo: "|cat >>/usr/local/bin/majordomo.txt" in you alias file? Why re-invent the wheel. The problem (I would think) is that the fopen is failing. The feof bit is wrong too. It should read: int ch; FILE *output = fopen( "/usr/local/bin/majordomo.txt", "a+" ); if( output ) { while( ch = getchar(), ch != EOF ) putc( ch, output ); fclose(output); } else perror( "/usr/local/bin/majordomo.txt" ); -- Brian <brian@awfulhak.demon.co.uk> Don't _EVER_ lose your sense of humour....