1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #ifndef lint
   8: char copyright[] =
   9: "@(#) Copyright (c) 1983 Regents of the University of California.\n\
  10:  All rights reserved.\n";
  11: #endif not lint
  12: 
  13: #ifndef lint
  14: static char sccsid[] = "@(#)hostname.c	5.1 (Berkeley) 4/30/85";
  15: #endif not lint
  16: 
  17: /*
  18:  * hostname -- get (or set hostname)
  19:  */
  20: #include <stdio.h>
  21: 
  22: char hostname[32];
  23: extern int errno;
  24: 
  25: main(argc,argv)
  26:     char *argv[];
  27: {
  28:     int myerrno;
  29: 
  30:     argc--;
  31:     argv++;
  32:     if (argc) {
  33:         if (sethostname(*argv,strlen(*argv)))
  34:             perror("sethostname");
  35:         myerrno = errno;
  36:     } else {
  37:         gethostname(hostname,sizeof(hostname));
  38:         myerrno = errno;
  39:         printf("%s\n",hostname);
  40:     }
  41:     exit(myerrno);
  42: }

Defined functions

main defined in line 25; never used

Defined variables

copyright defined in line 8; never used
hostname defined in line 22; used 3 times
sccsid defined in line 14; never used
Last modified: 1985-04-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 949
Valid CSS Valid XHTML 1.0 Strict