diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-09-23 06:14:13 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-09-23 06:14:13 +0000 |
commit | a7014de16e80c2864b6f25c7a67c110184c0cb5e (patch) | |
tree | 239c01f267612fb4b54ee1581524ea6086875d6f /usr.bin | |
parent | 1e5c466a5216b4f283c29f68b3e51d08a99833fc (diff) | |
download | FreeBSD-src-a7014de16e80c2864b6f25c7a67c110184c0cb5e.zip FreeBSD-src-a7014de16e80c2864b6f25c7a67c110184c0cb5e.tar.gz |
Check to see if we should print a space, rather than using the annoying
prefix methodology. Adjust nearby style.
Sponsored by: Bright Path Solutions
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/uname/uname.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c index 7ca9edf..7078fc3 100644 --- a/usr.bin/uname/uname.c +++ b/usr.bin/uname/uname.c @@ -75,7 +75,7 @@ void setup_get(void); void usage(void); char *platform, *hostname, *arch, *release, *sysname, *version; -const char *prefix; +int space; int main(int argc, char *argv[]) @@ -83,11 +83,8 @@ main(int argc, char *argv[]) u_int flags; int ch; - prefix = ""; - setup_get(); - flags = 0; while ((ch = getopt(argc, argv, "amnprsv")) != -1) switch(ch) { case 'a': @@ -129,13 +126,13 @@ main(int argc, char *argv[]) exit(0); } -#define CHECK_ENV(opt,var) \ -do { \ +#define CHECK_ENV(opt,var) \ +do { \ if ((var = getenv("UNAME_" opt)) == NULL) { \ - get_##var = native_##var; \ - } else { \ - get_##var = (get_t)NULL; \ - } \ + get_##var = native_##var; \ + } else { \ + get_##var = (get_t)NULL; \ + } \ } while (0) void @@ -151,10 +148,13 @@ setup_get(void) #define PRINT_FLAG(flags,flag,var) \ if ((flags & flag) == flag) { \ + if (space) \ + printf(" "); \ + else \ + space++; \ if (get_##var != NULL) \ (*get_##var)(); \ - printf("%s%s", prefix, var); \ - prefix = " "; \ + printf("%s", var); \ } void |