Commit fad25703 authored by Tristan Gingold's avatar Tristan Gingold Committed by Federico Vaga

adc-acq: allow decimal notation for device-id

parent 4a5209d6
......@@ -1137,6 +1137,7 @@ static int fald_acq_parse_args_basic(int argc, char *argv[])
switch (c) {
case 'D': {
char *strdevid;
char *eptr;
int len;
strdevid = strchr(optarg, '@');
......@@ -1145,13 +1146,17 @@ static int fald_acq_parse_args_basic(int argc, char *argv[])
_argv, optarg);
exit(1);
}
strdevid++; /* +1 to skip '@' */
sscanf(strdevid, "0x%x", &devid);
devid = strtoul(strdevid + 1, &eptr, 0);
if (*eptr != 0) {
fprintf(stderr, "%s: invalid device-id \"%s\" (<type>@<device-id>)\n",
_argv, optarg);
exit(1);
}
/* -1 count '@' it will be replaced by 0
* +1 for \0
*/
len = (int)(strdevid - 1 - optarg + 1);
len = (int)(strdevid - optarg + 1);
devname = malloc(len);
if (!devname) {
fprintf(stderr, "Cannot allocate memory\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment