2 * lib/econet.c This file contains an implementation of the Econet
3 * support functions for the net-tools.
4 * (NET-3 base distribution).
6 * Version: $Id: econet.c,v 1.11 2000/05/27 17:36:16 pb Exp $
8 * Author: Philip Blundell <philb@gnu.org>
12 * This program is free software; you can redistribute it
13 * and/or modify it under the terms of the GNU General
14 * Public License as published by the Free Software
15 * Foundation; either version 2 of the License, or (at
16 * your option) any later version.
23 #include <sys/types.h>
24 #include <sys/socket.h>
26 #include <neteconet/ec.h>
29 #include "net-support.h"
30 #include "pathnames.h"
34 /* Display an Econet address */
36 ec_print(unsigned char *ptr)
39 struct ec_addr *ec = (struct ec_addr *) ptr;
40 sprintf(buff, "%d.%d", ec->net, ec->station);
45 /* Display an Econet socket address */
47 ec_sprint(struct sockaddr *sap, int numeric)
49 struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
51 if (sap->sa_family != AF_ECONET)
52 return _("[NONE SET]");
54 return ec_print((unsigned char *) &sec->addr);
58 ec_input(int type, char *bufp, struct sockaddr *sap)
60 struct sockaddr_ec *sec = (struct sockaddr_ec *) sap;
62 switch (sscanf(bufp, "%d.%d", &net, &stn)) {
64 sec->addr.station = stn;
68 if (sscanf(bufp, "%d", &stn) == 1) {
70 sec->addr.station = stn;
77 struct aftype ec_aftype =
79 "ec", NULL, AF_ECONET, 0,
80 ec_print, ec_sprint, ec_input, NULL,
83 "/proc/sys/net/econet"
86 #endif /* HAVE_AFECONET */