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 --- include/optutils.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/optutils.h (limited to 'include/optutils.h') 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 + -- cgit v1.2.3-55-g7522