tools:iio:generic_buffer: catch errors for arguments conversion

Add handler to catch errors on conversion of numerical arguments.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Hartmut Knaack 2015-05-31 14:40:03 +02:00 committed by Jonathan Cameron
parent e9e45b43b8
commit c8ce9903cb
1 changed files with 9 additions and 0 deletions

View File

@ -206,13 +206,22 @@ int main(int argc, char **argv)
noevents = 1;
break;
case 'c':
errno = 0;
num_loops = strtoul(optarg, &dummy, 10);
if (errno)
return -errno;
break;
case 'w':
errno = 0;
timedelay = strtoul(optarg, &dummy, 10);
if (errno)
return -errno;
break;
case 'l':
errno = 0;
buf_len = strtoul(optarg, &dummy, 10);
if (errno)
return -errno;
break;
case 'g':
notrigger = 1;