Date: Mon, 30 Mar 2009 21:15:27 -0600 From: Joshua Gimer <jgimer@gmail.com> To: Gary Kline <kline@thought.org> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: Why?? (prog question) Message-ID: <cf939bff0903302015y64ac6ed4lf7cdc4d9c90953ec@mail.gmail.com> In-Reply-To: <cf939bff0903302013mdc4f432yacd7109c46341193@mail.gmail.com> References: <20090331025726.GA10888@thought.org> <cf939bff0903302013mdc4f432yacd7109c46341193@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Just 5 minutes too late. :) On Mon, Mar 30, 2009 at 9:13 PM, Joshua Gimer <jgimer@gmail.com> wrote: > main(int argc, char *argv[]) > > On Mon, Mar 30, 2009 at 8:57 PM, Gary Kline <kline@thought.org> wrote: >> people, i've been under the weather for days and will probably be for a = few more. >> new =A0and TEMPORARY meds dont like me, ugh. >> >> can anybody clue me in why the followin joinline program fails to catch = if argc =3D=3D 1? >> >> >> /* >> =A0* simple prog to join all | very nearly all lines of a text file that >> =A0* make up one paragraph into one LONG line. >> =A0* >> =A0* paragraphs are delimiated by a single \n break. >> =A0*/ >> >> #include <stdio.h> >> #include <string.h> >> #include <stdlib.h> >> >> main(int argc, char argv[]) >> { >> =A0 char buf[65536]; >> >> =A0 if (argc =3D=3D 1) >> =A0 { >> =A0 =A0 =A0 =A0printf("Usage: %s < file > newfile\n", argv[0]); >> =A0 =A0 =A0 =A0exit (-1); >> =A0 } >> =A0 while (fgets(buf, sizeof buf, stdin) ) >> =A0 { >> =A0 =A0 if (*buf =3D=3D '\n') >> =A0 =A0 { >> =A0 =A0 =A0 fprintf(stdout, "\n\n"); >> =A0 =A0 } >> =A0 =A0 else >> =A0 =A0 { >> =A0 =A0 =A0 buf[strlen(buf)-1] =3D ' '; >> =A0 =A0 =A0 fputs(buf, stdout); >> =A0 =A0 } >> =A0 } >> } >> >> >> -- >> =A0Gary Kline =A0kline@thought.org =A0http://www.thought.org =A0Public S= ervice Unix >> =A0 =A0 =A0 =A0http://jottings.thought.org =A0 http://transfinite.though= t.org >> =A0 =A0The 2.41a release of Jottings: http://jottings.thought.org/index.= php >> >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.= org" >> > > > > -- > Thx > Joshua Gimer > --=20 Thx Joshua Gimer
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cf939bff0903302015y64ac6ed4lf7cdc4d9c90953ec>