|
|
1.1 ! root 1: #ifndef lint ! 2: static char *sccsid = "@(#)hostname.c 1.4 (Berkeley) 8/11/83"; ! 3: #endif ! 4: /* ! 5: * hostname -- get (or set hostname) ! 6: */ ! 7: #include <stdio.h> ! 8: ! 9: char hostname[32]; ! 10: extern int errno; ! 11: ! 12: main(argc,argv) ! 13: char *argv[]; ! 14: { ! 15: int myerrno; ! 16: ! 17: argc--; ! 18: argv++; ! 19: if (argc) { ! 20: if (sethostname(*argv,strlen(*argv))) ! 21: perror("sethostname"); ! 22: myerrno = errno; ! 23: } else { ! 24: gethostname(hostname,sizeof(hostname)); ! 25: myerrno = errno; ! 26: printf("%s\n",hostname); ! 27: } ! 28: exit(myerrno); ! 29: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.