summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorRuediger Meier2017-06-20 20:20:29 +0200
committerRuediger Meier2017-06-26 14:38:24 +0200
commit86be6a32d3fd229dbb17bf5e3348a01e6e6e855a (patch)
tree04f05fd94b26d2b5a6304d69e93f2ec59e789e17 /sys-utils
parentmisc: cosmetics, remove argument from usage(int) (diff)
downloadkernel-qcow2-util-linux-86be6a32d3fd229dbb17bf5e3348a01e6e6e855a.tar.gz
kernel-qcow2-util-linux-86be6a32d3fd229dbb17bf5e3348a01e6e6e855a.tar.xz
kernel-qcow2-util-linux-86be6a32d3fd229dbb17bf5e3348a01e6e6e855a.zip
misc: cosmetics, remove argument from usage(FILE*)
This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/blkzone.c7
-rw-r--r--sys-utils/ctrlaltdel.c17
-rw-r--r--sys-utils/eject.c7
-rw-r--r--sys-utils/fallocate.c7
-rw-r--r--sys-utils/hwclock.c5
-rw-r--r--sys-utils/ipcs.c7
-rw-r--r--sys-utils/lsns.c7
-rw-r--r--sys-utils/prlimit.c7
-rw-r--r--sys-utils/readprofile.c8
-rw-r--r--sys-utils/setpriv.c7
-rw-r--r--sys-utils/wdctl.c7
-rw-r--r--sys-utils/zramctl.c7
12 files changed, 52 insertions, 41 deletions
diff --git a/sys-utils/blkzone.c b/sys-utils/blkzone.c
index 8fd55c066..ee4902e45 100644
--- a/sys-utils/blkzone.c
+++ b/sys-utils/blkzone.c
@@ -290,8 +290,9 @@ static int blkzone_reset(struct blkzone_control *ctl)
return 0;
}
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
size_t i;
fputs(USAGE_HEADER, out);
@@ -314,7 +315,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("blkzone(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -362,7 +363,7 @@ int main(int argc, char **argv)
switch (c) {
case 'h':
- usage(stdout);
+ usage();
break;
case 'c':
ctl.count = strtou32_or_err(optarg,
diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c
index 840945082..98c8ed832 100644
--- a/sys-utils/ctrlaltdel.c
+++ b/sys-utils/ctrlaltdel.c
@@ -21,19 +21,20 @@
#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
- fprintf(out, USAGE_HEADER);
+ FILE *out = stdout;
+ fputs(USAGE_HEADER, out);
fprintf(out, _(" %s hard|soft\n"), program_invocation_short_name);
- fprintf(out, USAGE_SEPARATOR);
+ fputs(USAGE_SEPARATOR, out);
fprintf(out, _("Set the function of the Ctrl-Alt-Del combination.\n"));
- fprintf(out, USAGE_OPTIONS);
- fprintf(out, USAGE_HELP);
- fprintf(out, USAGE_VERSION);
+ fputs(USAGE_OPTIONS, out);
+ fputs(USAGE_HELP, out);
+ fputs(USAGE_VERSION,out);
fprintf(out, USAGE_MAN_TAIL("ctrlaltdel(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static int get_cad(void)
@@ -98,7 +99,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 7cdd2db6e..296e5cba5 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -127,8 +127,9 @@ static inline void info(const char *fmt, ...)
va_end(va);
}
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] [<device>|<mountpoint>]\n"), program_invocation_short_name);
@@ -164,7 +165,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(_("\nBy default tries -r, -s, -f, and -q in order until success.\n"), out);
fprintf(out, USAGE_MAN_TAIL("eject(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
@@ -223,7 +224,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
ctl->F_option = 1;
break;
case 'h':
- usage(stdout);
+ usage();
break;
case 'i':
ctl->i_option = 1;
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index 7bbc36865..a2d212552 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -76,8 +76,9 @@
static int verbose;
static char *filename;
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
_(" %s [options] <filename>\n"), program_invocation_short_name);
@@ -105,7 +106,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fprintf(out, USAGE_MAN_TAIL("fallocate(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static loff_t cvtnum(char *s)
@@ -329,7 +330,7 @@ int main(int argc, char **argv)
switch(c) {
case 'h':
- usage(stdout);
+ usage();
break;
case 'c':
mode |= FALLOC_FL_COLLAPSE_RANGE;
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 07ad61385..f3448a569 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -1200,8 +1200,9 @@ static void out_version(void)
}
static void __attribute__((__noreturn__))
-usage(const struct hwclock_control *ctl, FILE *out)
+usage(const struct hwclock_control *ctl)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fputs(_(" hwclock [function] [option...]\n"), out);
@@ -1451,7 +1452,7 @@ int main(int argc, char **argv)
out_version();
return 0;
case 'h': /* --help */
- usage(&ctl, stdout);
+ usage(&ctl);
default:
errtryhelp(EXIT_FAILURE);
}
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 3c4e5df0e..943b09c4a 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -46,8 +46,9 @@ static void print_msg (int id, int unit);
/* we read time as int64_t from /proc, so cast... */
#define xctime(_x) ctime((time_t *) (_x))
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %1$s [resource-option...] [output-option]\n"
" %1$s -m|-q|-s -i <id>\n"), program_invocation_short_name);
@@ -78,7 +79,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(_(" -b, --bytes show sizes in bytes\n"), out);
fprintf(out, USAGE_MAN_TAIL("ipcs(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main (int argc, char **argv)
@@ -150,7 +151,7 @@ int main (int argc, char **argv)
unit = IPC_UNIT_BYTES;
break;
case 'h':
- usage(stdout);
+ usage();
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index 05d3ec620..6cadd0ef5 100644
--- a/sys-utils/lsns.c
+++ b/sys-utils/lsns.c
@@ -603,8 +603,9 @@ static int show_namespace_processes(struct lsns *ls, struct lsns_namespace *ns)
return 0;
}
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
size_t i;
fputs(USAGE_HEADER, out);
@@ -635,7 +636,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, USAGE_MAN_TAIL("lsns(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
@@ -698,7 +699,7 @@ int main(int argc, char *argv[])
ls.fltr_pid = strtos32_or_err(optarg, _("invalid PID argument"));
break;
case 'h':
- usage(stdout);
+ usage();
case 'n':
ls.no_headings = 1;
break;
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index 302103f8b..44db54ca5 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -151,8 +151,9 @@ static int prlimit(pid_t p, int resource,
}
#endif
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
size_t i;
fputs(USAGE_HEADER, out);
@@ -199,7 +200,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, USAGE_MAN_TAIL("prlimit(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static inline int get_column_id(int num)
@@ -584,7 +585,7 @@ int main(int argc, char **argv)
pid = strtos32_or_err(optarg, _("invalid PID argument"));
break;
case 'h':
- usage(stdout);
+ usage();
case 'o':
ncolumns = string_to_idarray(optarg,
columns, ARRAY_SIZE(columns),
diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c
index f18fa9bf2..dc14c64f2 100644
--- a/sys-utils/readprofile.c
+++ b/sys-utils/readprofile.c
@@ -97,9 +97,9 @@ static char *boot_uname_r_str(void)
return s;
}
-static void __attribute__ ((__noreturn__))
- usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
@@ -125,7 +125,7 @@ static void __attribute__ ((__noreturn__))
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("readprofile(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -211,7 +211,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 8d996e8be..310e6938d 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -92,8 +92,9 @@ struct privctx {
const char *apparmor_profile;
};
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] <program> [<argument>...]\n"),
program_invocation_short_name);
@@ -127,7 +128,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(_(" This tool can be dangerous. Read the manpage, and be careful.\n"), out);
fprintf(out, USAGE_MAN_TAIL("setpriv(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static int real_cap_last_cap(void)
@@ -797,7 +798,7 @@ int main(int argc, char **argv)
opts.apparmor_profile = optarg;
break;
case 'h':
- usage(stdout);
+ usage();
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
index 1790e8993..28a24c1f8 100644
--- a/sys-utils/wdctl.c
+++ b/sys-utils/wdctl.c
@@ -165,8 +165,9 @@ static struct colinfo *get_column_info(unsigned num)
return &infos[ get_column_id(num) ];
}
-static void __attribute__ ((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
size_t i;
fputs(USAGE_HEADER, out);
@@ -201,7 +202,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
fprintf(out, USAGE_MAN_TAIL("wdctl(8)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static void add_flag_line(struct libscols_table *table, struct wdinfo *wd, const struct wdflag *fl)
@@ -531,7 +532,7 @@ int main(int argc, char *argv[])
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
case 'F':
noflags = 1;
break;
diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c
index 7b001fe5d..948c58925 100644
--- a/sys-utils/zramctl.c
+++ b/sys-utils/zramctl.c
@@ -517,8 +517,9 @@ static void status(struct zram *z)
scols_unref_table(tb);
}
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
size_t i;
fputs(USAGE_HEADER, out);
@@ -550,7 +551,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, " %11s %s\n", infos[i].name, _(infos[i].help));
fprintf(out, USAGE_MAN_TAIL("zramctl(8)"));
- exit(out == stderr ? 1 : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
/* actions */
@@ -642,7 +643,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}