diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-02-24 16:37:54 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2005-02-24 16:37:54 +0000 |
commit | 9693a8bf05e5ef61a7a74ed14a985e7e16a037d8 (patch) | |
tree | 091afa4d513d7993dfbbe1d7da327b418ede5140 /opts.c | |
parent | 80748b39e4e9eb948e9b511222fcaee81473e931 (diff) | |
download | sshfs-9693a8bf05e5ef61a7a74ed14a985e7e16a037d8.tar sshfs-9693a8bf05e5ef61a7a74ed14a985e7e16a037d8.tar.gz sshfs-9693a8bf05e5ef61a7a74ed14a985e7e16a037d8.tar.bz2 sshfs-9693a8bf05e5ef61a7a74ed14a985e7e16a037d8.zip |
fix
Diffstat (limited to 'opts.c')
-rw-r--r-- | opts.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -7,6 +7,7 @@ */ #include "opts.h" +#include <stdio.h> #include <string.h> #include <stdlib.h> #include <glib.h> @@ -102,3 +103,20 @@ void process_options(int *argcp, char *argv[], struct opt opts[], } *argcp = newargctr; } + +int opt_get_unsigned(const struct opt *o, unsigned *valp) +{ + char *end; + unsigned val; + if (!o->value || !o->value[0]) { + fprintf(stderr, "Missing value for '%s' option\n", o->optname); + return -1; + } + val = strtoul(o->value, &end, 0); + if (end[0]) { + fprintf(stderr, "Invalid value for '%s' option\n", o->optname); + return -1; + } + *valp = val; + return 0; +} |