1993-10-13 08:40:23 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/errno.h>
|
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/in_systm.h>
|
|
|
|
|
1993-10-16 10:57:36 +03:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "salibc.h"
|
|
|
|
|
|
|
|
#include "netboot.h"
|
1993-10-13 08:40:23 +03:00
|
|
|
|
|
|
|
void
|
|
|
|
#ifdef __STDC__
|
|
|
|
panic(const char *fmt, ...)
|
|
|
|
#else
|
|
|
|
panic(fmt /*, va_alist */)
|
|
|
|
char *fmt;
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
printf(fmt, ap);
|
|
|
|
printf("\n");
|
|
|
|
va_end(ap);
|
|
|
|
machdep_stop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Similar to inet_ntoa() */
|
|
|
|
char *
|
|
|
|
intoa(addr)
|
|
|
|
n_long addr;
|
|
|
|
{
|
|
|
|
register char *cp;
|
|
|
|
register u_int byte;
|
|
|
|
register int n;
|
1993-10-16 10:57:36 +03:00
|
|
|
static char buf[17]; /* strlen(".255.255.255.255") + 1 */
|
1993-10-13 08:40:23 +03:00
|
|
|
|
|
|
|
cp = &buf[sizeof buf];
|
|
|
|
*--cp = '\0';
|
|
|
|
|
|
|
|
n = 4;
|
|
|
|
do {
|
|
|
|
byte = addr & 0xff;
|
|
|
|
*--cp = byte % 10 + '0';
|
|
|
|
byte /= 10;
|
|
|
|
if (byte > 0) {
|
|
|
|
*--cp = byte % 10 + '0';
|
|
|
|
byte /= 10;
|
|
|
|
if (byte > 0)
|
|
|
|
*--cp = byte + '0';
|
|
|
|
}
|
|
|
|
*--cp = '.';
|
|
|
|
addr >>= 8;
|
|
|
|
} while (--n > 0);
|
|
|
|
|
1993-10-16 10:57:36 +03:00
|
|
|
return (cp+1);
|
1993-10-13 08:40:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert Ethernet address to printable (loggable) representation.
|
|
|
|
*/
|
|
|
|
static char digits[] = "0123456789abcdef";
|
|
|
|
char *
|
|
|
|
ether_sprintf(ap)
|
|
|
|
register u_char *ap;
|
|
|
|
{
|
|
|
|
register i;
|
|
|
|
static char etherbuf[18];
|
|
|
|
register char *cp = etherbuf;
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++) {
|
|
|
|
*cp++ = digits[*ap >> 4];
|
|
|
|
*cp++ = digits[*ap++ & 0xf];
|
|
|
|
*cp++ = ':';
|
|
|
|
}
|
|
|
|
*--cp = 0;
|
|
|
|
return (etherbuf);
|
|
|
|
}
|