* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include "busybox.h"
+#include "libbb.h"
static void do_sethostname(char *s, int isfile)
{
}
} else {
f = xfopen(s, "r");
- while (fgets(bb_common_bufsiz1, sizeof(bb_common_bufsiz1), f) != NULL) {
- if (bb_common_bufsiz1[0] == '#') {
+#define strbuf bb_common_bufsiz1
+ while (fgets(strbuf, sizeof(strbuf), f) != NULL) {
+ if (strbuf[0] == '#') {
continue;
}
- chomp(bb_common_bufsiz1);
- do_sethostname(bb_common_bufsiz1, 0);
+ chomp(strbuf);
+ do_sethostname(strbuf, 0);
}
if (ENABLE_FEATURE_CLEAN_UP)
fclose(f);
}
}
-int hostname_main(int argc, char **argv);
+int hostname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int hostname_main(int argc, char **argv)
{
enum {
if (argc < 1)
bb_show_usage();
- getopt32(argc, argv, "dfisF:", &hostname_str);
+ getopt32(argv, "dfisF:", &hostname_str);
/* Output in desired format */
if (option_mask32 & OPT_dfis) {
while (hp->h_addr_list[0]) {
printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++)));
}
- puts("");
+ bb_putchar('\n');
}
}
/* Set the hostname */