simple patch from Ajax <ajax@firest0rm.org> (corrected) to print DDP
[oss-qm-packages.git] / lib / ax25_gr.c
blob4dce92d019461fd6dbe7bc9472083931104156bb
1 /*
2 * lib/ax25_gr.c This file contains an implementation of the "AX.25"
3 * route print support functions.
5 * Version: $Id: ax25_gr.c,v 1.4 1999/01/05 20:53:21 philip Exp $
7 * Author: Bernd Eckenfels, <ecki@lina.inka.de>
8 * Copyright 1999 Bernd Eckenfels, Germany
9 * base on Code from Jonathan Naylor <jsn@Cs.Nott.AC.UK>
11 * This program is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU General
13 * Public License as published by the Free Software
14 * Foundation; either version 2 of the License, or (at
15 * your option) any later version.
17 #include "config.h"
19 #if HAVE_AFAX25
20 #if 0
21 #include <sys/types.h>
22 #include <sys/ioctl.h>
23 #include <sys/socket.h>
24 #include <linux/ax25.h>
25 #include <linux/if_arp.h> /* ARPHRD_AX25 */
26 #include <ctype.h>
27 #include <errno.h>
28 #include <fcntl.h>
29 #include <string.h>
30 #include <termios.h>
31 #endif
32 #include <stdlib.h>
33 #include <stdio.h>
34 #include <unistd.h>
35 #include "net-support.h"
36 #include "pathnames.h"
37 #include "intl.h"
39 int AX25_rprint(int options)
41 FILE *f = fopen(_PATH_PROCNET_AX25_ROUTE, "r");
42 char buffer[256];
43 int use;
45 if (f == NULL) {
46 perror(_PATH_PROCNET_AX25_ROUTE);
47 printf(_("AX.25 not configured in this system.\n")); /* xxx */
48 return 1;
50 printf(_("Kernel AX.25 routing table\n")); /* xxx */
51 printf(_("Destination Iface Use\n")); /* xxx */
52 fgets(buffer, 256, f);
53 while (fgets(buffer, 256, f)) {
54 buffer[9] = 0;
55 buffer[14] = 0;
56 use = atoi(buffer + 15);
57 printf("%-9s %-5s %5d\n",
58 buffer, buffer + 10, use);
60 fclose(f);
61 return 0;
64 #endif /* HAVE_AFAX25 */