From owner-freebsd-questions@FreeBSD.ORG Tue Mar 31 03:44:37 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB59B1065680 for ; Tue, 31 Mar 2009 03:44:37 +0000 (UTC) (envelope-from jgimer@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mx1.freebsd.org (Postfix) with ESMTP id 735908FC08 for ; Tue, 31 Mar 2009 03:44:37 +0000 (UTC) (envelope-from jgimer@gmail.com) Received: by yw-out-2324.google.com with SMTP id 5so1580798ywh.13 for ; Mon, 30 Mar 2009 20:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Mwyp2xjGV4w8hEqXFwJfV1XCpRNqCpXC5LWmXJOd2EE=; b=sO1F3SDZxRJNaN/Unxh6pmuMNoaNME/UO3jUvDbQLj++dSoWY4GtrnRIt34yIpqZea 5+xAEmx0ucq2VeSkx3cj804Bpo5rL399PPVCiS8JfuQfubd7cwu9u0JAT9vb6Q696FTl HR9t6FVh16YHIXIzB8VyqIQ7C1vkIiwBorF1c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=aoIN9nw/ipgduwRc6qA2V84/eVT2fRt6SvBR1S0aBwO8g78Tnv+a7ZElc7ovztjga1 19bxBxJlRqTNpavvwTulyXnqebWmvcDxBqZ76Tax+YuSa6hkF2ShW4RjUhRlhxFRZ8He uEeL9mzhK1ywb/s4FSXXhebaRX89h5vNaD6wg= MIME-Version: 1.0 Received: by 10.231.12.138 with SMTP id x10mr1264772ibx.16.1238469327629; Mon, 30 Mar 2009 20:15:27 -0700 (PDT) In-Reply-To: References: <20090331025726.GA10888@thought.org> Date: Mon, 30 Mar 2009 21:15:27 -0600 Message-ID: From: Joshua Gimer To: Gary Kline Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Mailing List Subject: Re: Why?? (prog question) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2009 03:44:38 -0000 Just 5 minutes too late. :) On Mon, Mar 30, 2009 at 9:13 PM, Joshua Gimer wrote: > main(int argc, char *argv[]) > > On Mon, Mar 30, 2009 at 8:57 PM, Gary Kline 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 >> #include >> #include >> >> 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