summaryrefslogtreecommitdiffstats
path: root/include/optutils.h
diff options
context:
space:
mode:
authorKarel Zak2011-11-29 18:21:49 +0100
committerKarel Zak2011-11-29 18:21:49 +0100
commit732a631126a00ee52b9582e8adb7cc64bbcbaec0 (patch)
treed3d4f01dcdf85d4abea4c5c72e4eb3450af7885a /include/optutils.h
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 'include/optutils.h')
-rw-r--r--include/optutils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/optutils.h b/include/optutils.h
new file mode 100644
index 000000000..f66d669c8
--- /dev/null
+++ b/include/optutils.h
@@ -0,0 +1,15 @@
+#ifndef UTIL_LINUX_OPTUTILS_H
+#define UTIL_LINUX_OPTUTILS_H
+
+static inline const char *option_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;
+}
+
+#endif
+