include,optutils: add option_to_longopt()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
e4c92d0617
commit
732a631126
2 changed files with 18 additions and 12 deletions
15
include/optutils.h
Normal file
15
include/optutils.h
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue