projects
/
unix-history
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
4.3BSD beta release manual page
[unix-history]
/
usr
/
src
/
bin
/
hostname
/
hostname.c
#ifndef lint
static char
*
sccsid
=
"@(#)hostname.c 1.4 (Berkeley) %G%"
;
#endif
/*
* hostname -- get (or set hostname)
*/
#include <stdio.h>
char
hostname
[
32
];
extern
int
errno
;
main
(
argc
,
argv
)
char
*
argv
[];
{
int
myerrno
;
argc
--;
argv
++;
if
(
argc
) {
if
(
sethostname
(*
argv
,
strlen
(*
argv
)))
perror
(
"sethostname"
);
myerrno
=
errno
;
}
else
{
gethostname
(
hostname
,
sizeof
(
hostname
));
myerrno
=
errno
;
printf
(
"%s
\n
"
,
hostname
);
}
exit
(
myerrno
);
}