enable -fno-strict-aliasing until the code base gets a hefty clean up to fix all...
[platform/upstream/net-tools.git] / lib / rose_gr.c
1
2 /*
3  * lib/rose_gr.c      This file contains an implementation of the "ROSE"
4  *                      route print support functions.
5  *
6  * Version:     $Id: rose_gr.c,v 1.4 1999/01/05 20:54:07 philip Exp $
7  *
8  * Author:      Terry Dawson, VK2KTJ, <terry@perf.no.itg.telstra.com.au>
9  *              based on ax25_gr.c by:
10  *              Bernd Eckenfels, <ecki@lina.inka.de>
11  *              Copyright 1999 Bernd Eckenfels, Germany
12  *              base on Code from Jonathan Naylor <jsn@Cs.Nott.AC.UK>
13  *
14  *              This program is free software; you can redistribute it
15  *              and/or  modify it under  the terms of  the GNU General
16  *              Public  License as  published  by  the  Free  Software
17  *              Foundation;  either  version 2 of the License, or  (at
18  *              your option) any later version.
19  */
20 #include "config.h"
21
22 #if HAVE_AFROSE
23 #if 0
24 #include <sys/types.h>
25 #include <sys/ioctl.h>
26 #include <linux/rose.h>
27 #include <sys/socket.h>
28 #include <net/if_arp.h>         /* ARPHRD_ROSE */
29 #include <ctype.h>
30 #include <errno.h>
31 #include <fcntl.h>
32 #include <string.h>
33 #include <termios.h>
34 #endif
35 #include <stdlib.h>
36 #include <stdio.h>
37 #include <unistd.h>
38 #include "net-support.h"
39 #include "pathnames.h"
40 #include "intl.h"
41
42 int ROSE_rprint(int options)
43 {
44     FILE *f = NULL;
45     char buffer[256];
46     int use;
47
48     f=fopen(_PATH_PROCNET_ROSE_ROUTE, "r");
49     if (f == NULL) {
50         perror(_PATH_PROCNET_ROSE_ROUTE);
51         printf(_("ROSE not configured in this system.\n"));     /* xxx */
52         return 1;
53     }
54     printf(_("Kernel ROSE routing table\n"));
55     printf(_("Destination  Iface    Use\n"));
56     fgets(buffer, 256, f);
57     while (fgets(buffer, 256, f)) {
58         buffer[9] = 0;
59         buffer[14] = 0;
60         use = atoi(buffer + 15);
61         printf("%-9s    %-5s  %5d\n",
62                buffer, buffer + 10, use);
63     }
64     fclose(f);
65     return 0;
66 }
67
68 #endif                          /* HAVE_AFROSE */