9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] ip(2) man page: return code of parseip() and parsemaskip()
@ 2006-10-20  9:04 Gabriel Diaz
  2006-10-20  9:48 ` [9fans] " Gabriel Diaz
  0 siblings, 1 reply; 7+ messages in thread
From: Gabriel Diaz @ 2006-10-20  9:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello

The synopsis say:

ulong       parseip(uchar *ipaddr, char *str)
ulong       parseipmask(uchar *ipaddr, char *str)

the description:

"Parseip converts a string pointed to by str to a 16–byte IP address
starting at ipaddr. As a concession to backwards compatibility, if the
string is a V4 address, the return value is an unsigned long integer
containing the big–endian V4 address. If not, the return value is 6.
Parseipmask converts a string pointed to by str to a 6–byte IP mask
starting at ipaddr. It too returns an unsigned long big–endian V4
address or 6. Both routines return –1 on errors."

and the compiler:

warning: spf.c:226 useless or misleading comparison: ULONG < 0
warning: spf.c:227 useless or misleading comparison: ULONG < 0
warning: spf.c:230 useless or misleading comparison: ULONG < 0

Is this check correct? can one return -1 with a ulong? or i should
cast it to long? or should i check against 0xffffffff?

there is not an obvious  return -1 in /sys/src/libip/parseip.c.

i'm confused about this,  i can't found anything on group archives about this.

thanks

gabi

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-10-20 15:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-20  9:04 [9fans] ip(2) man page: return code of parseip() and parsemaskip() Gabriel Diaz
2006-10-20  9:48 ` [9fans] " Gabriel Diaz
2006-10-20 12:56   ` erik quanstrom
2006-10-20 13:44     ` Russ Cox
2006-10-20 13:56       ` erik quanstrom
2006-10-20 14:38         ` Russ Cox
2006-10-20 15:20           ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).