Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 2009 16:46:18 -0700
From:      Gary Kline <kline@thought.org>
To:        Patrick Mahan <mahan@mahan.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: need C help, passing char buffer[] by-value....
Message-ID:  <20091020234618.GC17456@thought.org>
In-Reply-To: <4ADD2D81.4060002@mahan.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>

next in thread | previous in thread | raw e-mail | index | archive | help
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:
> >
> >	<BODY BGCOLOR="#FFFFFF" LINK="#00FFFF" VLINK="#006633"><FONT 
> >	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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091020234618.GC17456>