From owner-freebsd-questions@FreeBSD.ORG Tue Mar 31 03:40:00 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 62D521065674 for ; Tue, 31 Mar 2009 03:40:00 +0000 (UTC) (envelope-from jgimer@gmail.com) Received: from mail-gx0-f176.google.com (mail-gx0-f176.google.com [209.85.217.176]) by mx1.freebsd.org (Postfix) with ESMTP id 1E1AF8FC08 for ; Tue, 31 Mar 2009 03:39:59 +0000 (UTC) (envelope-from jgimer@gmail.com) Received: by gxk24 with SMTP id 24so6703946gxk.19 for ; Mon, 30 Mar 2009 20:39:59 -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=slhQBLNUAlIKGodpl55J9EVaQEPJ+QRn4NuAXWTlNbQ=; b=iBUXeAc4ug11BB16g591JDPuvjHkxFaSBHvtmHMPJc4Vc3XmAKIZM+W20fNFp6NGxE iCpzikJSqRwjadI0r4F0V49EuglUVkFB9JQcEs3PjsEoTnuT19JFxlQf/3ozHOE1P8Qv +h+14tofm/qPVEh/lHD+ZHnE0cyZzj8P3Z/Hw= 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=tpgNOUjfv8w/3hr1co+OMkAtye1DCc9PotyDOdt0MI28qRw2fuDMrxKjDLsUSmZgN2 v8uJ/ozS2od3dCDDv3agh6giv6RoVpGmngXY2/KIKfSeLYDbW7u3WXQmuw0kQxTGcRt4 73TTywNlWCSH2XXs8TNH9/fpylsqXEA6hjiE0= MIME-Version: 1.0 Received: by 10.231.20.2 with SMTP id d2mr1259882ibb.27.1238469237534; Mon, 30 Mar 2009 20:13:57 -0700 (PDT) In-Reply-To: <20090331025726.GA10888@thought.org> References: <20090331025726.GA10888@thought.org> Date: Mon, 30 Mar 2009 21:13:57 -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:40:00 -0000 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 f= ew more. > new =A0and TEMPORARY meds dont like me, ugh. > > can anybody clue me in why the followin joinline program fails to catch i= f 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 Se= rvice Unix > =A0 =A0 =A0 =A0http://jottings.thought.org =A0 http://transfinite.thought= .org > =A0 =A0The 2.41a release of Jottings: http://jottings.thought.org/index.p= hp > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o= rg" > --=20 Thx Joshua Gimer