Mercurial > hg > toybox
diff toys/posix/uname.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 | fa858a67e231 |
children | b89ab13436fa |
line wrap: on
line diff
--- a/toys/posix/uname.c Tue Nov 13 16:13:45 2012 -0600 +++ b/toys/posix/uname.c Tue Nov 13 17:14:08 2012 -0600 @@ -1,6 +1,4 @@ -/* vi: set sw=4 ts=4: - * - * uname.c - return system name +/* uname.c - return system name * * Copyright 2008 Rob Landley <rob@landley.net> * @@ -9,19 +7,19 @@ USE_UNAME(NEWTOY(uname, "amvrns", TOYFLAG_BIN)) config UNAME - bool "uname" - default y - help - usage: uname [-asnrvmpio] + bool "uname" + default y + help + usage: uname [-asnrvmpio] - Print system information. + Print system information. - -s System name - -n Network (domain) name - -r Release number - -v Version (build date) - -m Machine (hardware) name - -a All of the above + -s System name + -n Network (domain) name + -r Release number + -v Version (build date) + -m Machine (hardware) name + -a All of the above */ #define FOR_uname @@ -42,34 +40,34 @@ void uname_main(void) { - int i, flags = toys.optflags, needspace=0; + int i, flags = toys.optflags, needspace=0; - uname((void *)toybuf); + uname((void *)toybuf); - if (!flags) flags = FLAG_s; - for (i=0; i<5; i++) { - char *c = toybuf+(65*i); + if (!flags) flags = FLAG_s; + for (i=0; i<5; i++) { + char *c = toybuf+(65*i); - if (flags & ((1<<i)|FLAG_a)) { - int len = strlen(c); + if (flags & ((1<<i)|FLAG_a)) { + int len = strlen(c); - // This problem originates in autoconf, so of course the solution - // is horribly ugly. + // This problem originates in autoconf, so of course the solution + // is horribly ugly. #ifdef GROSS - if (i==4 && !strcmp(c,"x86_64")) { - printf(GROSS); - continue; - } + if (i==4 && !strcmp(c,"x86_64")) { + printf(GROSS); + continue; + } #endif - if (needspace++) { - // We can't decrement on the first entry, because - // needspace would be 0 - *(--c)=' '; - len++; - } - xwrite(1, c, len); - } - } - putchar('\n'); + if (needspace++) { + // We can't decrement on the first entry, because + // needspace would be 0 + *(--c)=' '; + len++; + } + xwrite(1, c, len); + } + } + putchar('\n'); }