home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume14 / 3bconnect / mynode.c < prev    next >
C/C++ Source or Header  |  1988-05-08  |  627b  |  28 lines

  1. /*
  2.  * Copyright (C) 1988 Dave Settle. All rights reserved.
  3.  * Permission is granted to use, copy and modify this software, providing
  4.  * that it is not sold for profit, and that this copyright notice is retained
  5.  * in any copies of the source.
  6.  */
  7. /*
  8.  * mynode.c: print physical ethernet address of the local node.
  9.  */
  10.  
  11. #include <sys/ni.h>
  12.  
  13. main(){
  14.     NI_PORT port;
  15.     int ethernet;
  16.     if((ethernet = open("/dev/ni", 2)) == -1) {
  17.         perror("/dev/ni");
  18.         exit(1);
  19.     }
  20.     if(ioctl(ethernet, NIGETA, &port)) {
  21.         perror("NIGETA");
  22.         exit(1);
  23.     }
  24.     printf("Physical ethernet address: %s\n", ipaddr(port.srcaddr));
  25.     close(ethernet);
  26.     exit(0);
  27. }
  28.