[330] in bug-owl

home help back first fref pref prev next nref lref last post

Re: port number displayed is byteswapped on little-endian architectures

daemon@ATHENA.MIT.EDU (James M. Kretchmar)
Sat Apr 10 11:01:37 2004

Message-Id: <200404101456.KAA18644@mission-control.mit.edu>
To: Arun A Tharuvai <aatharuv@MIT.EDU>
cc: bug-owl@MIT.EDU
In-Reply-To: Your message of "Fri, 09 Apr 2004 20:53:23 EDT."
             <Pine.GSO.4.55L.0404091827270.7763@multics.mit.edu> 
Date: Sat, 10 Apr 2004 10:56:38 -0400
From: "James M. Kretchmar" <kretch@MIT.EDU>

> On x86, and presumably other little-endian architectures, owl displays an
> ascii representation of the port, before the port is converted to a
> little-endian number. This is because Znotice_t.z_port is always in
> network byte order. Here's a patch, that causes the port to be displayed
> correctly on both big-endian and little-endian architectures.

-	sprintf(buff, "  Port      : %i\n", n->z_port);
+	sprintf(buff, "  Port      : %i\n", htons(n->z_port));

Thanks for catching this.  Though, if Znotice_t.z_port is always in
network byte order, don't we want ntohs() ?

kretch

home help back first fref pref prev next nref lref last post