2 * lib/netrom_gr.c This file contains an implementation of the NET/ROM
3 * route support functions.
5 * Version: $Id: netrom_gr.c,v 1.5 2000/10/08 01:00:44 ecki 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>
12 * 980701 {0.02} Arnaldo Carvalho de Melo GNU gettext instead of catgets
15 * This program is free software; you can redistribute it
16 * and/or modify it under the terms of the GNU General
17 * Public License as published by the Free Software
18 * Foundation; either version 2 of the License, or (at
19 * your option) any later version.
27 #include "net-support.h"
28 #include "pathnames.h"
33 int NETROM_rprint(int options
)
35 FILE *f1
= fopen(_PATH_PROCNET_NR_NODES
, "r");
36 FILE *f2
= fopen(_PATH_PROCNET_NR_NEIGH
, "r");
39 /*int ext = options & FLAG_EXT;
40 int numeric = options & FLAG_NUM_HOST; */
42 f1
= fopen(_PATH_PROCNET_NR_NODES
, "r");
43 if (!f1
) perror(_PATH_PROCNET_NR_NODES
);
44 f2
= fopen(_PATH_PROCNET_NR_NEIGH
, "r");
45 if (!f2
) perror(_PATH_PROCNET_NR_NEIGH
);
47 if (f1
== NULL
|| f2
== NULL
) {
48 printf(_("NET/ROM not configured in this system.\n"));
51 printf(_("Kernel NET/ROM routing table\n"));
52 printf(_("Destination Mnemonic Quality Neighbour Iface\n"));
53 fgets(buffer
, 256, f1
);
54 while (fgets(buffer
, 256, f1
)) {
57 w
= atoi(buffer
+ 19) - 1;
60 qual
= atoi(buffer
+ 24 + 15 * w
);
61 n
= atoi(buffer
+ 32 + 15 * w
);
63 fgets(buffer
, 256, f2
);
64 while (fgets(buffer
, 256, f2
)) {
65 if (atoi(buffer
) == n
) {
68 printf("%3d %-9s %s\n",
69 qual
, buffer
+ 6, buffer
+ 16);
79 #endif /* HAVE_AFNETROM */