ppr-list-digest volume 4, number 110, message 14

Note: please don't spam any of the e-mail addresses which you see here. Follow this link if you want some addresses to misuse.


From: David Chappell <David.Chappell@mail.cc.trincoll.edu>
Date: Wed, 13 Nov 2002 11:52:30 -0500
Subject: Re: PPR: Uprint and RH printconf fix

Kenneth Tindle writes:

> David,
>
> The new "claim_lpr.c" does not work.
>
> The first queue, which does not have a leading space char on
> its first definition line, is recognized and works, as before.
> All other queues, which have the leading space, do not return
> "queue not found" anymore.  Instead, printdest_claim_lpr()
> spits out "Segmentation fault."
>
> This line:
>
> fnbp = line += strspn(line, " \t");
>
> alters BOTH "line" AND "fnbp", doesn't it?  And the whole point
> of the new "fnbp" pointer is that then "line", which must be
> treated as const after being returned by gu_getline(), will in
> fact not be written? 

You are right.  It should read:

fnbp = line + strspn(line, " \t");

> The special case where strspn() returns zero, where there is no
> leading space char in the /etc/printcap line, will put the same
> lvalue back into "line" that it already had (and will init "fnbp"
> too), so it does not blow up.
>
> Also:
> For the sake of cleanliness, you should probably add:
>
> if(fnbp[0] == '#')
>   continue;

> right after the test for the continuation line- this will skip
> comment lines, which could be a problem if the comment has a
> colon char in its body.
>
> RH printconf-0.2 doesn't actually add comment lines with a
> colon, but it does use plenty of comment lines themselves.  We
> shouldn't process them. 

I agree.  I have incorporated your changes.

- -- 
================================================================
David Chappell			David.Chappell@Mail.Trincoll.Edu
Computing Center		Postmaster@Mail.Trincoll.Edu
Trinity College			(860) 297-2114
Hartford, Connecticut 06106
U.S.A.