From owner-freebsd-questions@FreeBSD.ORG Tue Oct 20 23:46:24 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 4C52D1065672 for ; Tue, 20 Oct 2009 23:46:24 +0000 (UTC) (envelope-from kline@thought.org) Received: from aristotle.thought.org (ns1.thought.org [209.180.213.210]) by mx1.freebsd.org (Postfix) with ESMTP id DEFC68FC16 for ; Tue, 20 Oct 2009 23:46:23 +0000 (UTC) Received: from thought.org (tao.thought.org [10.47.0.250]) (authenticated bits=0) by aristotle.thought.org (8.14.2/8.14.2) with ESMTP id n9KNkBN7042451; Tue, 20 Oct 2009 16:46:11 -0700 (PDT) (envelope-from kline@thought.org) Received: by thought.org (nbSMTP-1.00) for uid 1002 kline@thought.org; Tue, 20 Oct 2009 16:46:18 -0700 (PDT) Date: Tue, 20 Oct 2009 16:46:18 -0700 From: Gary Kline To: Patrick Mahan Message-ID: <20091020234618.GC17456@thought.org> References: <20091019013337.GA9522@thought.org> <4ADBFDBA.6040702@pchotshots.com> <20091019170634.GA12371@thought.org> <4ADCAB4F.5040707@mahan.org> <20091019222126.GB12488@thought.org> <4ADD2D81.4060002@mahan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ADD2D81.4060002@mahan.org> User-Agent: Mutt/1.4.2.3i X-Organization: Thought Unlimited. Public service Unix since 1986. X-Of_Interest: With 23 years of service to the Unix community. X-Spam-Status: No, score=-4.4 required=3.6 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on aristotle.thought.org Cc: FreeBSD Mailing List Subject: Re: need C help, passing char buffer[] by-value.... 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, 20 Oct 2009 23:46:24 -0000 On Mon, Oct 19, 2009 at 08:24:49PM -0700, Patrick Mahan wrote: > > > Gary Kline wrote: > >On Mon, Oct 19, 2009 at 11:09:19AM -0700, Patrick Mahan wrote: > >>See comments interspaced below - > > > > > > You've got it exactly right, Patrick. There were no "C" classes in > > 1978--I taught myself. Obviously, not that well because I have > > already dreaded pointers. ---Well, usually. > > You are welcome, glad to help. > > [examples snipped] > > > > > > > Your examples help a lot! Everything works except when there are > > two or more tags on one line such as: > > > > > SIZE="4"> > > > > > > I think I see where is your skiptags--pointer arithematic > > function--this can be > > caught. Thanks much! > > > > If I might make a suggestion. Make use of a case (switch) statement: > > switch(buf[c]) { > case '<': /* start of tag, skip it if requested */ > if (skiptags) c = skiptag(&buf[c]); > ... > > default: /* handle normal stuff */ > ... > } > > Inside your while() statement. It took me over half an hour of fumbling, until i understood that you meant the "while (fgets(buf, sixeof buf, fpin))" if that's right. then i fumbled the ball because i used your pointer example rather than the indexing-into method, case 'B'. Just a FWIW, But for middle-involved cases like this program--what? a couple k lines long--when i get wedged like this, i almost always break it down into like a main{ fgets() } THEN: skiptags() i didn't figure this 'keep it simple, Sire' paradigm until a few [7-9,10] years ago. that's godawful late to learn new tricks. it's hard to understand 35 lines of code in the midst of 2400 :_) gary > > Good luck, > > Patrick > > _______________________________________________ > 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" -- Gary Kline kline@thought.org http://www.thought.org Public Service Unix http://jottings.thought.org http://transfinite.thought.org The 7.31a release of Jottings: http://jottings.thought.org/index.php