byte order in rep_inet_ntoa()

Stefan (metze) Metzmacher metze at metzemix.de
Fri Nov 15 15:39:00 GMT 2002


Hi,

I add #define REPLACE_INET_NTOA 1 to config.h

and in the debug's I got '7.5.0.10' not not '10.0.5.7 as ip.

WORDS_BIGENDIAN is undefined (SuSE 7.3 i386)

is this really right???
(lib/replace.c)
...
#ifdef REPLACE_INET_NTOA
char *rep_inet_ntoa(struct in_addr ip)
{
         unsigned char *p = (unsigned char *)&ip.s_addr;
         static char buf[18];
#if WORDS_BIGENDIAN
         slprintf(buf, 17, "%d.%d.%d.%d",
                  (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
#else /* WORDS_BIGENDIAN */
         slprintf(buf, 17, "%d.%d.%d.%d",
                  (int)p[3], (int)p[2], (int)p[1], (int)p[0]);
#endif /* WORDS_BIGENDIAN */
         return buf;
}
#endif /* REPLACE_INET_NTOA */


metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>




More information about the samba-technical mailing list