Fix reporting of IPv6 multicast addresses.
[oss-qm-packages.git] / lib / ipx_gr.c
blob3d7ef1debc1313b5319bb877125ac907025ab3de
1 /* support for ap->rresolv missing */
2 /*
3 Modifications:
4 1998-07-01 - Arnaldo Carvalho de Melo - GNU gettext instead of catgets,
5 snprintf instead of sprintf
6 */
8 #include "config.h"
10 #if HAVE_AFIPX
11 #include <asm/types.h>
12 #include <sys/types.h>
13 #include <sys/socket.h>
14 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
15 #include <netipx/ipx.h>
16 #else
17 #include "ipx.h"
18 #endif
19 #include <stdlib.h>
20 #include <stdio.h>
21 #include <errno.h>
22 #include <ctype.h>
23 #include <string.h>
24 #include <unistd.h>
25 #include <netinet/in.h>
26 #include "version.h"
27 #include "net-support.h"
28 #include "pathnames.h"
29 #include "intl.h"
31 /* UGLY */
33 int IPX_rprint(int options)
35 /* int ext = options & FLAG_EXT; */
36 int numeric = options & FLAG_NUM_HOST;
37 char buff[1024];
38 char net[128], router_net[128];
39 char router_node[128];
40 int num;
41 FILE *fp = fopen(_PATH_PROCNET_IPX_ROUTE, "r");
42 struct aftype *ap;
43 struct sockaddr sa;
45 if ((ap = get_afntype(AF_IPX)) == NULL) {
46 EINTERN("lib/ipx_rt.c", "AF_IPX missing");
47 return (-1);
50 if (!fp) {
51 perror(_PATH_PROCNET_IPX_ROUTE);
52 printf(_("IPX not configured in this system.\n"));
53 return 1;
56 printf(_("Kernel IPX routing table\n")); /* xxx */
57 printf(_("Destination Router Net Router Node\n"));
59 fgets(buff, 1023, fp);
61 while (fgets(buff, 1023, fp)) {
62 num = sscanf(buff, "%s %s %s", net, router_net, router_node);
63 if (num < 3)
64 continue;
66 /* Fetch and resolve the Destination */
67 (void) ap->input(5, net, &sa);
68 strcpy(net, ap->sprint(&sa, numeric));
70 /* Fetch and resolve the Router Net */
71 (void) ap->input(5, router_net, &sa);
72 strcpy(router_net, ap->sprint(&sa, numeric));
74 /* Fetch and resolve the Router Node */
75 (void) ap->input(2, router_node, &sa);
76 strcpy(router_node, ap->sprint(&sa, numeric));
78 printf("%-25s %-25s %-25s\n", net, router_net, router_node);
81 (void) fclose(fp);
82 return (0);
85 #endif /* HAVE_AFIPX */