1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-12-23 15:58:57 +02:00

libatrf: renamed driver specification argument from "arg" to "spec"

- tools/include/atrf.h (atrf_open), tools/lib/atrf.c (select_driver,
  atrf_open): renamed "arg" argument to "spec"
This commit is contained in:
Werner Almesberger 2011-04-20 08:15:19 -03:00
parent cd59b8524b
commit 4fa909debc
2 changed files with 10 additions and 10 deletions

View File

@ -30,7 +30,7 @@ void *atrf_usb_handle(struct atrf_dsc *dsc); /* hack for atrf-id */
void *atrf_ben_regs(struct atrf_dsc *dsc); /* hack for atrf-xtal */ void *atrf_ben_regs(struct atrf_dsc *dsc); /* hack for atrf-xtal */
const char *atrf_default_driver_name(void); const char *atrf_default_driver_name(void);
struct atrf_dsc *atrf_open(const char *arg); struct atrf_dsc *atrf_open(const char *spec);
void atrf_close(struct atrf_dsc *dsc); void atrf_close(struct atrf_dsc *dsc);
int atrf_error(struct atrf_dsc *dsc); int atrf_error(struct atrf_dsc *dsc);

View File

@ -110,7 +110,7 @@ const char *atrf_default_driver_name(void)
} }
static const struct atrf_driver *select_driver(const char *arg, static const struct atrf_driver *select_driver(const char *spec,
const char **opt) const char **opt)
{ {
const struct atrf_driver **drv; const struct atrf_driver **drv;
@ -123,19 +123,19 @@ static const struct atrf_driver *select_driver(const char *arg,
} }
*opt = NULL; *opt = NULL;
if (!arg || !strcmp(arg, "default")) if (!spec || !strcmp(spec, "default"))
return *drivers; return *drivers;
end = strchr(arg, ':'); end = strchr(spec, ':');
if (!end) if (!end)
end = strchr(arg, 0); end = strchr(spec, 0);
len = end-arg; len = end-spec;
for (drv = drivers; *drv; drv++) for (drv = drivers; *drv; drv++)
if (!strncmp((*drv)->name, arg, len) && if (!strncmp((*drv)->name, spec, len) &&
strlen((*drv)->name) == len) strlen((*drv)->name) == len)
break; break;
if (!*drv) { if (!*drv) {
fprintf(stderr, "no driver \"%.*s\" found\n", (int) len, arg); fprintf(stderr, "no driver \"%.*s\" found\n", (int) len, spec);
return NULL; return NULL;
} }
if (*end) if (*end)
@ -144,14 +144,14 @@ static const struct atrf_driver *select_driver(const char *arg,
} }
struct atrf_dsc *atrf_open(const char *arg) struct atrf_dsc *atrf_open(const char *spec)
{ {
struct atrf_dsc *dsc; struct atrf_dsc *dsc;
const struct atrf_driver *driver; const struct atrf_driver *driver;
const char *opt; const char *opt;
void *handle; void *handle;
driver = select_driver(arg, &opt); driver = select_driver(spec, &opt);
if (!driver) if (!driver)
return NULL; return NULL;
handle = driver->open(opt); handle = driver->open(opt);