aboutsummaryrefslogtreecommitdiff
path: root/lib/libusbhid/usage.c
diff options
context:
space:
mode:
authorMatthew N. Dodd <mdodd@FreeBSD.org>2003-04-07 00:49:53 +0000
committerMatthew N. Dodd <mdodd@FreeBSD.org>2003-04-07 00:49:53 +0000
commit234e6b87fa54bdffd4589a7e4ee7cf7138381de6 (patch)
treea714331d7db10f0f6f48e74f6c46614ced47e9e0 /lib/libusbhid/usage.c
parentb0850075ac202e1c3de52279658d9e5eadbbc7eb (diff)
downloadsrc-234e6b87fa54bdffd4589a7e4ee7cf7138381de6.tar.gz
src-234e6b87fa54bdffd4589a7e4ee7cf7138381de6.zip
MF NetBSD:
- Reduce diffs with NetBSD. - Formatting and explicit values for enum declaration. - Order of prototypes. - zero report_size in hid_clear_local() - errx() needs no newline - Don't initialie variable in declaration in hid_parse_usage_in_page(). - Use fmtcheck() in hid_usage_in_page().
Notes
Notes: svn path=/head/; revision=113193
Diffstat (limited to 'lib/libusbhid/usage.c')
-rw-r--r--lib/libusbhid/usage.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c
index 00facf5c31bc..8e6bfcaa10de 100644
--- a/lib/libusbhid/usage.c
+++ b/lib/libusbhid/usage.c
@@ -96,7 +96,7 @@ hid_init(const char *hidname)
no = -1;
else if (sscanf(line, " 0x%x %[^\n]", &no, name) != 2 &&
sscanf(line, " %d %[^\n]", &no, name) != 2)
- errx(1, "file %s, line %d, syntax error\n",
+ errx(1, "file %s, line %d, syntax error",
hidname, lineno);
for (p = name; *p; p++)
if (isspace(*p) || *p == '.')
@@ -106,7 +106,7 @@ hid_init(const char *hidname)
err(1, "strdup");
if (isspace(line[0])) {
if (!curpage)
- errx(1, "file %s, line %d, syntax error\n",
+ errx(1, "file %s, line %d, syntax error",
hidname, lineno);
if (curpage->pagesize >= curpage->pagesizemax) {
curpage->pagesizemax += 10;
@@ -160,7 +160,7 @@ hid_usage_page(int i)
int k;
if (!pages)
- errx(1, "no hid table\n");
+ errx(1, "no hid table");
for (k = 0; k < npages; k++)
if (pages[k].usage == i)
@@ -185,8 +185,9 @@ hid_usage_in_page(unsigned int u)
for (j = 0; j < pages[k].pagesize; j++) {
us = pages[k].page_contents[j].usage;
if (us == -1) {
- sprintf(b, "%s %d",
- pages[k].page_contents[j].name, i);
+ sprintf(b,
+ fmtcheck(pages[k].page_contents[j].name, "%d"),
+ i);
return b;
}
if (us == i)
@@ -203,7 +204,7 @@ hid_parse_usage_page(const char *name)
int k;
if (!pages)
- errx(1, "no hid table\n");
+ errx(1, "no hid table");
for (k = 0; k < npages; k++)
if (strcmp(pages[k].name, name) == 0)
@@ -215,10 +216,11 @@ hid_parse_usage_page(const char *name)
int
hid_parse_usage_in_page(const char *name)
{
- const char *sep = strchr(name, ':');
+ const char *sep;
int k, j;
unsigned int l;
+ sep = strchr(name, ':');
if (sep == NULL)
return -1;
l = sep - name;