2 * lib/unix.c This file contains the general hardware types.
4 * Version: $Id: unix.c,v 1.1 2006/02/25 18:23:25 marschap Exp $
6 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
7 * Copyright 1993 MicroWalt Corporation
9 * This program is free software; you can redistribute it
10 * and/or modify it under the terms of the GNU General
11 * Public License as published by the Free Software
12 * Foundation; either version 2 of the License, or (at
13 * your option) any later version.
17 #include <sys/types.h>
18 #include <sys/socket.h>
28 #include "net-support.h"
29 #include "pathnames.h"
34 /* Display an UNSPEC address. */
35 static char *UNSPEC_print(unsigned char *ptr
)
42 for (i
= 0; i
< sizeof(struct sockaddr
); i
++) {
43 pos
+= sprintf(pos
, "%02X-", (*ptr
++ & 0377));
45 buff
[strlen(buff
) - 1] = '\0';
50 /* Display an UNSPEC socket address. */
51 static char *UNSPEC_sprint(struct sockaddr
*sap
, int numeric
)
55 if (sap
->sa_family
== 0xFFFF || sap
->sa_family
== 0)
56 return safe_strncpy(buf
, _("[NONE SET]"), sizeof(buf
));
57 return (UNSPEC_print(sap
->sa_data
));
63 /* Display a UNIX domain address. */
64 static char *UNIX_print(unsigned char *ptr
)
70 /* Display a UNIX domain address. */
71 static char *UNIX_sprint(struct sockaddr
*sap
, int numeric
)
75 if (sap
->sa_family
== 0xFFFF || sap
->sa_family
== 0)
76 return safe_strncpy(buf
, _("[NONE SET]"), sizeof(buf
));
77 return (UNIX_print(sap
->sa_data
));
81 struct aftype unix_aftype
=
83 "unix", NULL
, /*"UNIX Domain", */ AF_UNIX
, 0,
84 UNIX_print
, UNIX_sprint
, NULL
, NULL
,
89 #endif /* HAVE_AFUNIX */
92 struct aftype unspec_aftype
=
94 "unspec", NULL
, /*"UNSPEC", */ AF_UNSPEC
, 0,
95 UNSPEC_print
, UNSPEC_sprint
, NULL
, NULL
,