diff options
author | Daniel Mack <github@zonque.org> | 2015-11-03 07:15:44 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-11-03 07:15:44 +0100 |
commit | a31afe1a18cca840046d976a637c7918ec6f5fe2 (patch) | |
tree | 11fd3c0d57bcae37069117036904fe3a8c7f7209 /src/basic/parse-util.c | |
parent | 3342582deb95b6e364541435654eb8f6fa320f40 (diff) | |
parent | 2c1a55cf3fe78bcf728f73487813ddd3ee020a98 (diff) |
Merge pull request #1758 from poettering/varietygalore
A grab bag of stuff
Diffstat (limited to 'src/basic/parse-util.c')
-rw-r--r-- | src/basic/parse-util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c index 1ee5783680..b6358c459a 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c @@ -81,6 +81,19 @@ int parse_mode(const char *s, mode_t *ret) { return 0; } +int parse_ifindex(const char *s, int *ret) { + int ifi, r; + + r = safe_atoi(s, &ifi); + if (r < 0) + return r; + if (ifi <= 0) + return -EINVAL; + + *ret = ifi; + return 0; +} + int parse_size(const char *t, uint64_t base, uint64_t *size) { /* Soo, sometimes we want to parse IEC binary suffixes, and |