From 732a631126a00ee52b9582e8adb7cc64bbcbaec0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 29 Nov 2011 18:21:49 +0100 Subject: include,optutils: add option_to_longopt() Signed-off-by: Karel Zak --- libmount/samples/mount.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'libmount/samples/mount.c') diff --git a/libmount/samples/mount.c b/libmount/samples/mount.c index bb7ee9e54..2e58eedb3 100644 --- a/libmount/samples/mount.c +++ b/libmount/samples/mount.c @@ -32,6 +32,7 @@ #include "nls.h" #include "c.h" #include "env.h" +#include "optutils.h" /*** TODO: DOCS: * @@ -75,7 +76,7 @@ static void __attribute__((__noreturn__)) print_version(void) mnt_get_library_version(&ver); - printf("%s from %s (libmount %s)\n", + printf(_("%s from %s (libmount %s)\n"), program_invocation_short_name, PACKAGE_STRING, ver); exit(EX_SUCCESS); } @@ -89,16 +90,6 @@ static int table_parser_errcb(struct libmnt_table *tb __attribute__((__unused__) return 0; } -static const char *opt_to_longopt(int c, const struct option *opts) -{ - const struct option *o; - - for (o = opts; o->name; o++) - if (o->val == c) - return o->name; - return NULL; -} - static void print_all(struct libmnt_context *cxt, char *pattern, int show_label) { struct libmnt_table *tb; @@ -328,7 +319,7 @@ int main(int argc, char **argv) /* only few options are allowed for non-root users */ if (mnt_context_is_restricted(cxt) && !strchr("hlLUVv", c)) - exit_non_root(opt_to_longopt(c, longopts)); + exit_non_root(option_to_longopt(c, longopts)); switch(c) { case 'a': -- cgit v1.2.3-55-g7522