/* vi: set sw=4 ts=4: */
/*
- * $Id: hostname.c,v 1.34 2002/11/10 22:07:48 bug1 Exp $
+ * $Id: hostname.c,v 1.36 2003/07/14 21:21:01 andersen Exp $
* Mini hostname implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
*
- * adjusted by Erik Andersen <andersee@debian.org> to remove
+ * adjusted by Erik Andersen <andersen@codepoet.org> to remove
* use of long options and GNU getopt. Improved the usage info.
*
* This program is free software; you can redistribute it and/or modify
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) {
+ while ((opt = getopt(argc, argv, "dfisF:")) > 0) {
+ switch (opt) {
case 'd':
case 'f':
case 'i':
filename = optarg;
break;
default:
- show_usage();
+ bb_show_usage();
}
}