9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Gabriel Diaz" <gabidiaz@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: [9fans] ip(2) man page: return code of parseip() and parsemaskip()
Date: Fri, 20 Oct 2006 11:04:19 +0200	[thread overview]
Message-ID: <82c890d00610200204u5dabf5f7x99be52901063d3b4@mail.gmail.com> (raw)

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

             reply	other threads:[~2006-10-20  9:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20  9:04 Gabriel Diaz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82c890d00610200204u5dabf5f7x99be52901063d3b4@mail.gmail.com \
    --to=gabidiaz@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).