summaryrefslogtreecommitdiffstats
path: root/libmount/samples/mount.c
diff options
context:
space:
mode:
authorKarel Zak2011-11-29 18:21:49 +0100
committerKarel Zak2011-11-29 18:21:49 +0100
commit732a631126a00ee52b9582e8adb7cc64bbcbaec0 (patch)
treed3d4f01dcdf85d4abea4c5c72e4eb3450af7885a /libmount/samples/mount.c
parentlibmount: use USAGE_* from mount(8) sample (diff)
downloadkernel-qcow2-util-linux-732a631126a00ee52b9582e8adb7cc64bbcbaec0.tar.gz
kernel-qcow2-util-linux-732a631126a00ee52b9582e8adb7cc64bbcbaec0.tar.xz
kernel-qcow2-util-linux-732a631126a00ee52b9582e8adb7cc64bbcbaec0.zip
include,optutils: add option_to_longopt()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/samples/mount.c')
-rw-r--r--libmount/samples/mount.c15
1 files changed, 3 insertions, 12 deletions
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':