summaryrefslogtreecommitdiffstats
path: root/sys-utils/ldattach.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys-utils/ldattach.c')
-rw-r--r--sys-utils/ldattach.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index 5d6dc0ba0..9a3915b1c 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -188,9 +188,9 @@ static int parse_iflag(char *str, int *set_iflag, int *clr_iflag)
}
-static void __attribute__ ((__noreturn__)) usage(int exitcode)
+static void __attribute__((__noreturn__)) usage(void)
{
- FILE *out = exitcode == EXIT_SUCCESS ? stdout : stderr;
+ FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out, _(" %s [options] <ldisc> <device>\n"), program_invocation_short_name);
@@ -224,7 +224,7 @@ static void __attribute__ ((__noreturn__)) usage(int exitcode)
print_table(out, ld_iflags);
fprintf(out, USAGE_MAN_TAIL("ldattach(8)"));
- exit(exitcode);
+ exit(EXIT_SUCCESS);
}
static int my_cfsetspeed(struct termios *ts, int speed)
@@ -315,7 +315,8 @@ int main(int argc, char **argv)
/* parse options */
if (argc == 0)
- usage(EXIT_SUCCESS);
+ errx(EXIT_FAILURE, _("bad usage"));
+
while ((optc =
getopt_long(argc, argv, "dhV78neo12s:i:c:p:", opttbl,
NULL)) >= 0) {
@@ -354,15 +355,16 @@ int main(int argc, char **argv)
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
case 'h':
- usage(EXIT_SUCCESS);
+ usage();
default:
errtryhelp(EXIT_FAILURE);
}
}
- if (argc - optind != 2)
- usage(EXIT_FAILURE);
-
+ if (argc - optind != 2) {
+ warnx(_("not enough arguments"));
+ errtryhelp(EXIT_FAILURE);
+ }
/* parse line discipline specification */
ldisc = lookup_table(ld_discs, argv[optind]);
if (ldisc < 0)