Mercurial > hg > toybox
diff toys/lsb/hostname.c @ 694:786841fdb1e0
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.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 13 Nov 2012 17:14:08 -0600 |
parents | 7e846e281e38 |
children |
line wrap: on
line diff
--- a/toys/lsb/hostname.c Tue Nov 13 16:13:45 2012 -0600 +++ b/toys/lsb/hostname.c Tue Nov 13 17:14:08 2012 -0600 @@ -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 @@ 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); + } }