|
|
1.1 root 1: /*
2: * A R P C O N F I G
3: *
4: * Ethernet address resolution setup procedure.
5: * For use with the Chaosnet Line Discipline and/or TCP/IP.
6: * Invoked from 'netconfig' with fd 0 open to an ethernet channel.
7: *
8: *
9: * (c) Copyright 1985 Nirvonics, Inc.
10: *
11: * Written by Kurt Gollhardt
12: * Last update Thu Mar 14 13:24:01 1985
13: *
14: * This software is the property of Nirvonics, Inc.
15: * All rights reserved.
16: *
17: */
18:
19: #include <stdio.h>
20: #include <sys/ioctl.h>
21: #include <sys/types.h>
22: #include <sys/order.h>
23: #include <sys/ethernet.h>
24:
25: extern int arp_ld;
26: int arp_type;
27:
28:
29: main(ac,av)
30: char **av;
31: {
32: unsigned char en_addr[6];
33: int i;
34:
35: if (ioctl(0, FIOPUSHLD, &arp_ld) < 0) {
36: fprintf(stderr, "Can't push arp line discipline\n");
37: exit(1);
38: }
39: arp_type = hfirst_short(ETHERPUP_ARPTYPE);
40: if (ioctl(0, ENIOTYPE, &arp_type) < 0) {
41: fprintf(stderr, "Can't set arp type\n");
42: exit(1);
43: }
44:
45: if (ioctl(0, ENIOADDR, en_addr) < 0) {
46: fprintf(stderr, "Can't get ethernet address\n");
47: exit(1);
48: }
49:
50: printf("%s: running on ethernet", av[0]);
51: for (i = 0; i < 6; i++)
52: printf(" %02x", en_addr[i]);
53: putchar('\n');
54: fflush(stdout);
55:
56: pause();
57: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.