summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/findfs.c14
-rw-r--r--misc-utils/namei.c10
2 files changed, 13 insertions, 11 deletions
diff --git a/misc-utils/findfs.c b/misc-utils/findfs.c
index 7d2d803dd..c01dc1d53 100644
--- a/misc-utils/findfs.c
+++ b/misc-utils/findfs.c
@@ -22,9 +22,9 @@
#define FINDFS_NOT_FOUND 1 /* label or uuid cannot be found */
#define FINDFS_USAGE_ERROR 2 /* user did something unexpected */
-static void __attribute__((__noreturn__)) usage(int rc)
+static void __attribute__((__noreturn__)) usage(void)
{
- FILE *out = rc ? stderr : stdout;
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] {LABEL,UUID,PARTUUID,PARTLABEL}=<value>\n"),
program_invocation_short_name);
@@ -36,7 +36,7 @@ static void __attribute__((__noreturn__)) usage(int rc)
fputs(USAGE_HELP, out);
fputs(USAGE_VERSION, out);
fprintf(out, USAGE_MAN_TAIL("findfs(8)"));
- exit(rc);
+ exit(FINDFS_SUCCESS);
}
int main(int argc, char **argv)
@@ -54,10 +54,12 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- if (argc != 2)
+ if (argc != 2) {
/* we return '2' for backward compatibility
* with version from e2fsprogs */
- usage(FINDFS_USAGE_ERROR);
+ warnx(_("bad usage"));
+ errtryhelp(FINDFS_USAGE_ERROR);
+ }
while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
switch (c) {
@@ -65,7 +67,7 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return FINDFS_SUCCESS;
case 'h':
- usage(FINDFS_SUCCESS);
+ usage();
default:
errtryhelp(FINDFS_USAGE_ERROR);
}
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index 0b0a0579c..dcaf5d2eb 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -320,10 +320,10 @@ print_namei(struct namei *nm, char *path)
return 0;
}
-static void usage(int rc)
+static void __attribute__((__noreturn__)) usage(void)
{
const char *p = program_invocation_short_name;
- FILE *out = rc == EXIT_FAILURE ? stderr : stdout;
+ FILE *out = stdout;
if (!*p)
p = "namei";
@@ -346,7 +346,7 @@ static void usage(int rc)
" -v, --vertical vertical align of modes and owners\n"), out);
fprintf(out, USAGE_MAN_TAIL("namei(1)"));
- exit(rc);
+ exit(EXIT_SUCCESS);
}
static const struct option longopts[] =
@@ -376,7 +376,7 @@ main(int argc, char **argv)
while ((c = getopt_long(argc, argv, "hVlmnovx", longopts, NULL)) != -1) {
switch(c) {
case 'h':
- usage(EXIT_SUCCESS);
+ usage();
break;
case 'V':
printf(UTIL_LINUX_VERSION);
@@ -406,7 +406,7 @@ main(int argc, char **argv)
if (optind == argc) {
warnx(_("pathname argument is missing"));
- usage(EXIT_FAILURE);
+ errtryhelp(EXIT_FAILURE);
}
ucache = new_idcache();