|
|
1.1 ! root 1: #include <stdio.h> ! 2: #include <errno.h> ! 3: #include <signal.h> ! 4: #include <sys/param.h> ! 5: #include <sys/types.h> ! 6: #include <sgtty.h> ! 7: #include <sys/ethernet.h> ! 8: #include <sys/inet/in.h> ! 9: #include "config.h" ! 10: ! 11: extern errno; ! 12: extern int ip_ld; ! 13: ! 14: main() ! 15: { ! 16: char *me="loopback"; ! 17: unsigned long myaddr; ! 18: int ld, i; ! 19: int pfd[2]; ! 20: ! 21: myaddr = in_address(me); ! 22: if(myaddr == 0){ ! 23: fprintf(stderr, "ipconfig: unknown host %s\n", me); ! 24: exit(1); ! 25: } ! 26: signal(SIGHUP, SIG_IGN); ! 27: if (pipe(pfd)<0) { ! 28: perror("ipconfig"); ! 29: exit(1); ! 30: } ! 31: if(ioctl(pfd[0], FIOPUSHLD, &ip_ld) < 0){ ! 32: perror("PUSHLD"); ! 33: exit(1); ! 34: } ! 35: if(ioctl(pfd[1], FIOPUSHLD, &ip_ld) < 0){ ! 36: perror("PUSHLD"); ! 37: exit(1); ! 38: } ! 39: if(ioctl(pfd[0], IPIOLOCAL, &myaddr) < 0){ ! 40: perror("IPIOLOCAL"); ! 41: exit(1); ! 42: } ! 43: if(ioctl(pfd[0], IPIOHOST, &myaddr) < 0){ ! 44: perror("IPIOHOST"); ! 45: exit(1); ! 46: } ! 47: if(ioctl(pfd[1], IPIOLOCAL, &myaddr) < 0){ ! 48: perror("IPIOLOCAL"); ! 49: exit(1); ! 50: } ! 51: if(ioctl(pfd[1], IPIOHOST, &myaddr) < 0){ ! 52: perror("IPIOHOST"); ! 53: exit(1); ! 54: } ! 55: pause(); /* forever, hopefully */ ! 56: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.