aboutsummaryrefslogtreecommitdiff
path: root/toys/lsb/hostname.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-11-13 17:14:08 -0600
committerRob Landley <rob@landley.net>2012-11-13 17:14:08 -0600
commit7aa651a6a4496d848f86de9b1e6b3a003256a01f (patch)
tree6995fb4b7cc2e90a6706b0239ebaf95d9dbab530 /toys/lsb/hostname.c
parent571b0706cce45716126776d0ad0f6ac65f4586e3 (diff)
downloadtoybox-7aa651a6a4496d848f86de9b1e6b3a003256a01f.tar.gz
Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
The actual code should be the same afterward, this is just cosmetic refactoring.
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);
+ }
}