IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2011-04-20 13:15:19 (12 years 11 months ago) |
---|---|
Author: | Werner Almesberger |
Commit: | 4fa909debc047bb008da9dc8cbe9155ead5feff6 |
Message: | 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" |
Files: |
tools/include/atrf.h (1 diff) tools/lib/atrf.c (3 diffs) |
Change Details
tools/include/atrf.h | ||
---|---|---|
30 | 30 | void *atrf_ben_regs(struct atrf_dsc *dsc); /* hack for atrf-xtal */ |
31 | 31 | |
32 | 32 | const char *atrf_default_driver_name(void); |
33 | struct atrf_dsc *atrf_open(const char *arg); | |
33 | struct atrf_dsc *atrf_open(const char *spec); | |
34 | 34 | void atrf_close(struct atrf_dsc *dsc); |
35 | 35 | |
36 | 36 | int atrf_error(struct atrf_dsc *dsc); |
tools/lib/atrf.c | ||
---|---|---|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
113 | static const struct atrf_driver *select_driver(const char *arg, | |
113 | static const struct atrf_driver *select_driver(const char *spec, | |
114 | 114 | const char **opt) |
115 | 115 | { |
116 | 116 | const struct atrf_driver **drv; |
... | ... | |
123 | 123 | } |
124 | 124 | |
125 | 125 | *opt = NULL; |
126 | if (!arg || !strcmp(arg, "default")) | |
126 | if (!spec || !strcmp(spec, "default")) | |
127 | 127 | return *drivers; |
128 | 128 | |
129 | end = strchr(arg, ':'); | |
129 | end = strchr(spec, ':'); | |
130 | 130 | if (!end) |
131 | end = strchr(arg, 0); | |
132 | len = end-arg; | |
131 | end = strchr(spec, 0); | |
132 | len = end-spec; | |
133 | 133 | for (drv = drivers; *drv; drv++) |
134 | if (!strncmp((*drv)->name, arg, len) && | |
134 | if (!strncmp((*drv)->name, spec, len) && | |
135 | 135 | strlen((*drv)->name) == len) |
136 | 136 | break; |
137 | 137 | if (!*drv) { |
138 | fprintf(stderr, "no driver \"%.*s\" found\n", (int) len, arg); | |
138 | fprintf(stderr, "no driver \"%.*s\" found\n", (int) len, spec); | |
139 | 139 | return NULL; |
140 | 140 | } |
141 | 141 | if (*end) |
... | ... | |
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | struct atrf_dsc *atrf_open(const char *arg) | |
147 | struct atrf_dsc *atrf_open(const char *spec) | |
148 | 148 | { |
149 | 149 | struct atrf_dsc *dsc; |
150 | 150 | const struct atrf_driver *driver; |
151 | 151 | const char *opt; |
152 | 152 | void *handle; |
153 | 153 | |
154 | driver = select_driver(arg, &opt); | |
154 | driver = select_driver(spec, &opt); | |
155 | 155 | if (!driver) |
156 | 156 | return NULL; |
157 | 157 | handle = driver->open(opt); |