Commit 97077164 authored by Federico Vaga's avatar Federico Vaga

Merge branch 'feature/tools-improve' into develop

parents 4a5209d6 dfc48fbe
......@@ -40,7 +40,7 @@ static unsigned arg_plot_selected = 0;
static char git_version[] = "version: " GIT_VERSION;
static const char *help_msg =
"adc-acq -D <device-name>@0x<device-id> [OPTIONS]\n\n";
"adc-acq -D <device-name>@<device-id> [OPTIONS]\n\n";
static const char *help_msg_opt =
" --device|-D <device-name>@<device-id>: unique device identifier (e.g.: \"fmc-adc@0x0400\")\n"
" --acquisition|-a <parameters> configure the acquisition\n"
......@@ -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,18 @@ static int fald_acq_parse_args_basic(int argc, char *argv[])
_argv, optarg);
exit(1);
}
strdevid++; /* +1 to skip '@' */
sscanf(strdevid, "0x%x", &devid);
/* +1 to skip '@' */
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