summaryrefslogtreecommitdiffstats
path: root/text-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 /text-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 'text-utils')
-rw-r--r--text-utils/colcrt.c7
-rw-r--r--text-utils/colrm.c7
-rw-r--r--text-utils/hexdump.c7
-rw-r--r--text-utils/hexdump.h2
-rw-r--r--text-utils/line.c7
-rw-r--r--text-utils/rev.c7
-rw-r--r--text-utils/ul.c8
7 files changed, 25 insertions, 20 deletions
diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c
index ff8cd4694..375d0d6f0 100644
--- a/text-utils/colcrt.c
+++ b/text-utils/colcrt.c
@@ -75,8 +75,9 @@ struct colcrt_control {
half_lines:1;
};
-static void __attribute__((__noreturn__)) usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] [<file>...]\n"), program_invocation_short_name);
@@ -93,7 +94,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fprintf(out, USAGE_MAN_TAIL("colcrt(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static void trim_trailing_spaces(wchar_t *s)
@@ -264,7 +265,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/text-utils/colrm.c b/text-utils/colrm.c
index b2816cd07..ebebca0bf 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -54,8 +54,9 @@ COLRM removes unwanted columns from a file
Jeff Schriebman UC Berkeley 11-74
*/
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fprintf(out, _("\nUsage:\n"
" %s [startcol [endcol]]\n"),
program_invocation_short_name);
@@ -69,7 +70,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fprintf(out, _("%s reads from standard input and writes to standard output\n\n"),
program_invocation_short_name);
fprintf(out, USAGE_MAN_TAIL("colrm(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static int process_input(unsigned long first, unsigned long last)
@@ -176,7 +177,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/text-utils/hexdump.c b/text-utils/hexdump.c
index bf0631654..53d10a6d9 100644
--- a/text-utils/hexdump.c
+++ b/text-utils/hexdump.c
@@ -131,7 +131,7 @@ parse_args(int argc, char **argv, struct hexdump *hex)
add_fmt("\"%07.7_ax \" 8/2 \" %04x \" \"\\n\"", hex);
break;
case 'h':
- usage(stdout);
+ usage();
case 'V':
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
@@ -149,8 +149,9 @@ parse_args(int argc, char **argv, struct hexdump *hex)
return optind;
}
-void __attribute__((__noreturn__)) usage(FILE *out)
+void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] <file>...\n"), program_invocation_short_name);
@@ -177,7 +178,7 @@ void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("hexdump(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
diff --git a/text-utils/hexdump.h b/text-utils/hexdump.h
index 741a57ad2..4a8d10916 100644
--- a/text-utils/hexdump.h
+++ b/text-utils/hexdump.h
@@ -101,7 +101,7 @@ void add_fmt(const char *, struct hexdump *);
void rewrite_rules(struct hexdump_fs *, struct hexdump *);
void addfile(char *, struct hexdump *);
void display(struct hexdump *);
-void __attribute__((__noreturn__)) usage(FILE *out);
+void __attribute__((__noreturn__)) usage(void);
void conv_c(struct hexdump_pr *, u_char *);
void conv_u(struct hexdump_pr *, u_char *);
int next(char **, struct hexdump *);
diff --git a/text-utils/line.c b/text-utils/line.c
index 486e5dd31..15d7d4adf 100644
--- a/text-utils/line.c
+++ b/text-utils/line.c
@@ -24,8 +24,9 @@
#include "nls.h"
#include "widechar.h"
-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);
@@ -36,7 +37,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("line(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -62,7 +63,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/text-utils/rev.c b/text-utils/rev.c
index feed2b167..9a778e383 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -71,8 +71,9 @@ static void sig_handler(int signo __attribute__ ((__unused__)))
_exit(EXIT_SUCCESS);
}
-static void __attribute__ ((__noreturn__)) usage(FILE * out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fprintf(out, _("Usage: %s [options] [file ...]\n"),
program_invocation_short_name);
@@ -84,7 +85,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out)
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("rev(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
static void reverse_str(wchar_t *str, size_t n)
@@ -125,7 +126,7 @@ int main(int argc, char *argv[])
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
diff --git a/text-utils/ul.c b/text-utils/ul.c
index 736483ef4..a2ad5ea42 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -135,9 +135,9 @@ static int halfpos;
static int upln;
static int iflag;
-static void __attribute__((__noreturn__))
-usage(FILE *out)
+static void __attribute__((__noreturn__)) usage(void)
{
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] [<file> ...]\n"), program_invocation_short_name);
@@ -153,7 +153,7 @@ usage(FILE *out)
fprintf(out, USAGE_MAN_TAIL("ul(1)"));
- exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+ exit(EXIT_SUCCESS);
}
int main(int argc, char **argv)
@@ -196,7 +196,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(stdout);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}