From 503e6362290d56bce0ed71f8164f24e25108bbbc Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 17 Nov 2018 18:25:08 -0600 Subject: Convert more GLOBALS argument vars to the new single letter code style. --- toys/lsb/dmesg.c | 7 +++---- toys/lsb/killall.c | 8 ++++---- toys/lsb/mknod.c | 7 +++---- toys/lsb/mktemp.c | 10 +++++----- toys/lsb/passwd.c | 5 ++--- 5 files changed, 17 insertions(+), 20 deletions(-) (limited to 'toys/lsb') diff --git a/toys/lsb/dmesg.c b/toys/lsb/dmesg.c index 30f90e3a..42f642ce 100644 --- a/toys/lsb/dmesg.c +++ b/toys/lsb/dmesg.c @@ -34,8 +34,7 @@ config DMESG #include GLOBALS( - long level; - long size; + long n, s; int use_color; time_t tea; @@ -157,7 +156,7 @@ void dmesg_main(void) klogctl_mode: // Figure out how much data we need, and fetch it. - if (!(size = TT.size)) size = xklogctl(10, 0, 0); + if (!(size = TT.s)) size = xklogctl(10, 0, 0); data = from = xmalloc(size+1); data[size = xklogctl(3+(toys.optflags&FLAG_c), data, size)] = 0; @@ -175,7 +174,7 @@ klogctl_mode: no_output: // Set the log level? - if (toys.optflags & FLAG_n) xklogctl(8, 0, TT.level); + if (toys.optflags & FLAG_n) xklogctl(8, 0, TT.n); // Clear the buffer? if (toys.optflags & (FLAG_C|FLAG_c)) xklogctl(5, 0, 0); diff --git a/toys/lsb/killall.c b/toys/lsb/killall.c index 2772b432..d524107c 100644 --- a/toys/lsb/killall.c +++ b/toys/lsb/killall.c @@ -25,7 +25,7 @@ config KILLALL #include "toys.h" GLOBALS( - char *sig; + char *s; int signum; pid_t cur_pid; @@ -72,12 +72,12 @@ void killall_main(void) return; } - if (TT.sig || (*TT.names && **TT.names == '-')) { - if (0 > (TT.signum = sig_to_num(TT.sig ? TT.sig : (*TT.names)+1))) { + if (TT.s || (*TT.names && **TT.names == '-')) { + if (0 > (TT.signum = sig_to_num(TT.s ? TT.s : (*TT.names)+1))) { if (toys.optflags & FLAG_q) exit(1); error_exit("Invalid signal"); } - if (!TT.sig) { + if (!TT.s) { TT.names++; toys.optc--; } diff --git a/toys/lsb/mknod.c b/toys/lsb/mknod.c index 8148c857..f8c33183 100644 --- a/toys/lsb/mknod.c +++ b/toys/lsb/mknod.c @@ -31,8 +31,7 @@ config MKNOD_Z #include "toys.h" GLOBALS( - char *arg_context; - char *m; + char *Z, *m; ) void mknod_main(void) @@ -51,8 +50,8 @@ void mknod_main(void) } if (toys.optflags & FLAG_Z) - if (-1 == lsm_set_create(TT.arg_context)) - perror_exit("-Z '%s' failed", TT.arg_context); + if (-1 == lsm_set_create(TT.Z)) + perror_exit("-Z '%s' failed", TT.Z); if (mknod(*toys.optargs, mode|modes[type], dev_makedev(major, minor))) perror_exit_raw(*toys.optargs); } diff --git a/toys/lsb/mktemp.c b/toys/lsb/mktemp.c index 118daccf..21bb9b36 100644 --- a/toys/lsb/mktemp.c +++ b/toys/lsb/mktemp.c @@ -28,7 +28,7 @@ config MKTEMP #include "toys.h" GLOBALS( - char *tmpdir; + char *p; ) void mktemp_main(void) @@ -38,16 +38,16 @@ void mktemp_main(void) if (!template) template = "tmp.XXXXXX"; - if (!TT.tmpdir) TT.tmpdir = getenv("TMPDIR"); - if (!TT.tmpdir || !*TT.tmpdir) TT.tmpdir = "/tmp"; + if (!TT.p) TT.p = getenv("TMPDIR"); + if (!TT.p || !*TT.p) TT.p = "/tmp"; template = strchr(template, '/') ? xstrdup(template) - : xmprintf("%s/%s", TT.tmpdir, template); + : xmprintf("%s/%s", TT.p, template); if (d_flag ? !mkdtemp(template) : mkstemp(template) == -1) { if (toys.optflags & FLAG_q) toys.exitval = 1; else perror_exit("Failed to create %s %s/%s", - d_flag ? "directory" : "file", TT.tmpdir, template); + d_flag ? "directory" : "file", TT.p, template); } else { if (toys.optflags & FLAG_u) unlink(template); xputs(template); diff --git a/toys/lsb/passwd.c b/toys/lsb/passwd.c index e23de1c6..0f51c0c0 100644 --- a/toys/lsb/passwd.c +++ b/toys/lsb/passwd.c @@ -36,7 +36,7 @@ config PASSWD_SAD #include "toys.h" GLOBALS( - char *algo; + char *a; ) // Sad advisory heuristic, won't find password1 password2 password3... @@ -84,8 +84,7 @@ void passwd_main(void) printf("Deleting password for '%s'\n", name); encrypted = ""; } else { - if (get_salt(salt, TT.algo ? TT.algo : "des")<0) - error_exit("bad -a '%s'", TT.algo); + if (get_salt(salt, TT.a ? TT.a : "des")<0) error_exit("bad -a '%s'", TT.a); printf("Changing password for %s\n", name); if (myuid) { -- cgit v1.2.3