aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb/hostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/lsb/hostname.c')
-rw-r--r--toys/lsb/hostname.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/toys/lsb/hostname.c b/toys/lsb/hostname.c
index ca436833..23467fb3 100644
--- a/toys/lsb/hostname.c
+++ b/toys/lsb/hostname.c
@@ -1,6 +1,4 @@
-/* vi: set sw=4 ts=4:
- *
- * hostname.c - Get/Set the hostname
+/* hostname.c - Get/Set the hostname
*
* Copyright 2012 Andre Renaud <andre@bluewatersys.com>
*
@@ -9,12 +7,12 @@
USE_HOSTNAME(NEWTOY(hostname, NULL, TOYFLAG_BIN))
config HOSTNAME
- bool "hostname"
- default y
- help
- usage: hostname [newname]
+ bool "hostname"
+ default y
+ help
+ usage: hostname [newname]
- Get/Set the current hostname
+ Get/Set the current hostname
*/
#define FOR_hostname
@@ -22,13 +20,12 @@ config HOSTNAME
void hostname_main(void)
{
- const char *hostname = toys.optargs[0];
- if (hostname) {
- if (sethostname(hostname, strlen(hostname)))
- perror_exit("set failed '%s'", hostname);
- } else {
- if (gethostname(toybuf, sizeof(toybuf)))
- perror_exit("get failed");
- xputs(toybuf);
- }
+ const char *hostname = toys.optargs[0];
+ if (hostname) {
+ if (sethostname(hostname, strlen(hostname)))
+ perror_exit("set failed '%s'", hostname);
+ } else {
+ if (gethostname(toybuf, sizeof(toybuf))) perror_exit("get failed");
+ xputs(toybuf);
+ }
}