Subject: Re: htonl and longs
To: None <port-alpha@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: port-alpha
Date: 06/18/1999 09:49:06
> : strfile.c: Tbl.str_version = htonl(Tbl.str_version);
> : strfile.h: unsigned long str_version; /* version number */
> htonl works on longs, not u_int32_t's.
That's not what the manpage says:
in_addr_t
htonl(in_addr_t host32);
[...]
in_addr_t
ntohl(in_addr_t net32);
[...]
DESCRIPTION
These routines convert 16 and 32 bit quantities between network byte or
der and host byte order. The types in_addr_t and in_port_t are defined by
X/Open as:
typedef u_int32_t in_addr_t;
typedef u_int16_t in_port_t;
Given their historical use, for converting 16 and 32 bit quantities for
network protocols, this is IMO the right thing, despite the unfortunate
naming scheme.
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B