From: "Mike Breuer" <mbreuer@NEW.RR.COM>
> From: "Alex" <ahdecker@HOME.NET>
> > my assumption is that, since it's negative, asciiflag_conv is choking on
the
> > '-' sign and returning 0 so that only 4 is set, which was not read from
the
> > file. Of course this is a total guess.. :P
-- snip (not very helpful response) --
Sorry, I guess I'm a bit tired. You are correct. asciiflag_conv calls
isdigit, which only checks to see if the character passed is in the range of 0
to 9. Here's a quick fix:
long asciiflag_conv(char *flag)
{
long flags = 0;
int is_number = 1;
register char *p;
+ p = flag;
+ if (*p == '-') p++;
- for (p = flag; *p; p++) {
+ for (;*p; p++) {
if (islower(*p))
flags |= 1 << (*p - 'a');
else if (isupper(*p))
flags |= 1 << (26 + (*p - 'A'));
if (!isdigit(*p))
is_number = 0;
}
if (is_number)
flags = atol(flag);
return (flags);
}
I think that should do it but as I said, I am a bit tired.
Mike
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/05/01 PST