inet_makeaddr(net, host)
u_long net, host;
{
- u_long addr;
+ struct in_addr a;
if (net < 128U)
- addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+ a.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
else if (net < 65536U)
- addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
+ a.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
else if (net < 16777216L)
- addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
+ a.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
else
- addr = net | host;
- addr = htonl(addr);
- return (*(struct in_addr *)&addr);
+ a.s_addr = net | host;
+ a.s_addr = htonl(a.s_addr);
+ return (a);
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_print.c,v 1.8 2004/09/16 00:56:12 marka Exp $";
+static const char rcsid[] = "$Id: ns_print.c,v 1.9 2004/09/16 07:02:52 marka Exp $";
#endif
/* Import. */
char *p;
len = SPRINTF((tmp, "\\# %u%s\t; %s", (unsigned)(edata - rdata),
- rdlen != 0 ? " (" : "", comment));
+ rdlen != 0U ? " (" : "", comment));
T(addstr(tmp, len, &buf, &buflen));
while (rdata < edata) {
p = tmp;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: print.c,v 1.3 2004/09/16 01:01:27 marka Exp $ */
+/* $Id: print.c,v 1.4 2004/09/16 07:02:53 marka Exp $ */
#include <config.h>
case 'x':
case 'X':
doint:
- if (precision != 0)
+ if (precision != 0U)
zero = 0;
switch (*format) {
case 'n':
tmpui = va_arg(ap, unsigned int);
if (alt) {
head = "0x";
- if (precision > 2)
+ if (precision > 2U)
precision -= 2;
}
sprintf(buf, "%llx", tmpui);
tmpui = va_arg(ap, unsigned int);
if (alt) {
head = "0X";
- if (precision > 2)
+ if (precision > 2U)
precision -= 2;
}
sprintf(buf, "%llX", tmpui);
goto printint;
printint:
- if (precision != 0 || width != 0) {
+ if (precision != 0U || width != 0U) {
length = strlen(buf);
if (length < precision)
zeropad = precision - length;
else if (length < width && zero)
zeropad = width - length;
- if (width != 0) {
+ if (width != 0U) {
pad = width - length -
zeropad - strlen(head);
if (pad < 0)
cp = va_arg(ap, char *);
REQUIRE(cp != NULL);
- if (precision != 0) {
+ if (precision != 0U) {
/*
* cp need not be NULL terminated.
*/
n = precision;
tp = cp;
- while (n != 0 && *tp != '\0')
+ while (n != 0U && *tp != '\0')
n--, tp++;
length = precision - n;
} else {
length = strlen(cp);
}
- if (width != 0) {
+ if (width != 0U) {
pad = width - length;
if (pad < 0)
pad = 0;
size--;
pad--;
}
- if (precision != 0)
- while (precision > 0 && *cp != '\0' &&
+ if (precision != 0U)
+ while (precision > 0U && *cp != '\0' &&
size > 1U) {
*str++ = *cp++;
size--;
break;
case 'c':
c = va_arg(ap, int);
- if (width > 0) {
+ if (width > 0U) {
count += width;
width--;
if (left) {
*str++ = c;
size--;
}
- while (width-- > 0 && size > 1U) {
+ while (width-- > 0U && size > 1U) {
*str++ = ' ';
size--;
}
length = strlen(buf);
if (precision > length)
zeropad = precision - length;
- if (width > 0) {
+ if (width > 0U) {
pad = width - length - zeropad;
if (pad < 0)
pad = 0;
* if we cap the precision at 512 we will not
* overflow buf.
*/
- if (precision > 512)
+ if (precision > 512U)
precision = 512;
sprintf(fmt, "%%%s%s.%lu%s%c", alt ? "#" : "",
plus ? "+" : space ? " " : "",
sprintf(buf, fmt, dbl);
}
length = strlen(buf);
- if (width > 0) {
+ if (width > 0U) {
pad = width - length;
if (pad < 0)
pad = 0;