/* vi: set sw=4 ts=4: */
/*
- * $Id: hostname.c,v 1.33 2002/10/18 22:13:23 andersen Exp $
+ * $Id: hostname.c,v 1.35 2003/03/19 09:12:37 mjn3 Exp $
* Mini hostname implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
if (!isfile) {
if (sethostname(s, strlen(s)) < 0) {
if (errno == EPERM)
- error_msg_and_die("you must be root to change the hostname");
+ bb_error_msg_and_die("you must be root to change the hostname");
else
- perror_msg_and_die("sethostname");
+ bb_perror_msg_and_die("sethostname");
}
} else {
- f = xfopen(s, "r");
+ f = bb_xfopen(s, "r");
while (fgets(buf, 255, f) != NULL) {
if (buf[0] =='#') {
continue;
char *p = NULL;
if (argc < 1)
- show_usage();
+ bb_show_usage();
while ((opt = getopt(argc, argv, "dfisF:")) > 0) {
switch (opt) {
filename = optarg;
break;
default:
- show_usage();
+ bb_show_usage();
}
}
if (p != NULL) {
*p = 0;
}
- puts(buf);
+ puts(hp->h_name);
} else if (type == 'd') {
if (p) puts(p + 1);
} else if (type == 'i') {