From 4f5d9133717c648baa9d207c1f02fc66f265c6ac Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Thu, 11 Jul 2002 21:12:18 +0000 Subject: [PATCH] WARNS?=4 cleanup. --- usr.sbin/kbdcontrol/Makefile | 2 ++ usr.sbin/kbdcontrol/kbdcontrol.c | 48 +++++++++++++++++++++----------- usr.sbin/kbdcontrol/lex.l | 1 + 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/usr.sbin/kbdcontrol/Makefile b/usr.sbin/kbdcontrol/Makefile index ad6540a36c5..e7088a7eb1a 100644 --- a/usr.sbin/kbdcontrol/Makefile +++ b/usr.sbin/kbdcontrol/Makefile @@ -10,4 +10,6 @@ CFLAGS+= -I${.CURDIR} DPADD= ${LIBL} LDADD= -ll +WARNS?= 4 + .include diff --git a/usr.sbin/kbdcontrol/kbdcontrol.c b/usr.sbin/kbdcontrol/kbdcontrol.c index 8a2f46ff4e3..f44ea11d3b2 100644 --- a/usr.sbin/kbdcontrol/kbdcontrol.c +++ b/usr.sbin/kbdcontrol/kbdcontrol.c @@ -115,9 +115,29 @@ int number; char letter; int token; +void dump_accent_definition(char *name, accentmap_t *accentmap); +void dump_entry(int value); +void dump_key_definition(char *name, keymap_t *keymap); int get_accent_definition_line(accentmap_t *); +int get_entry(void); int get_key_definition_line(keymap_t *); -void usage(void); +void load_keymap(char *opt, int dumponly); +void load_default_functionkeys(void); +char * nextarg(int ac, char **av, int *indp, int oc); +char * mkfullname(const char *s1, const char *s2, const char *s3); +void print_accent_definition_line(FILE *fp, int accent, + struct acc_t *key); +void print_entry(FILE *fp, int value); +void print_key_definition_line(FILE *fp, int scancode, + struct keyent_t *key); +void print_keymap(void); +void release_keyboard(void); +void set_bell_values(char *opt); +void set_functionkey(char *keynumstr, char *string); +void set_keyboard(char *device); +void set_keyrates(char *opt); +void show_kbd_info(void); +void usage(void) __dead2; char * nextarg(int ac, char **av, int *indp, int oc) @@ -126,7 +146,6 @@ nextarg(int ac, char **av, int *indp, int oc) return(av[(*indp)++]); warnx("option requires two arguments -- %c", oc); usage(); - return(""); } @@ -158,7 +177,7 @@ mkfullname(const char *s1, const char *s2, const char *s3) int -get_entry() +get_entry(void) { switch ((token = yylex())) { case TNOP: @@ -489,7 +508,6 @@ print_entry(FILE *fp, int value) } } - void print_key_definition_line(FILE *fp, int scancode, struct keyent_t *key) { @@ -765,8 +783,9 @@ load_keymap(char *opt, int dumponly) FILE *fd; int i, j; char *name, *cp; - char *prefix[] = {"", "", KEYMAP_PATH, NULL}; - char *postfix[] = {"", ".kbd", NULL}; + char blank[] = "", keymap_path[] = KEYMAP_PATH, dotkbd[] = ".kbd"; + char *prefix[] = {blank, blank, keymap_path, NULL}; + char *postfix[] = {blank, dotkbd, NULL}; cp = getenv("KEYMAP_PATH"); if (cp != NULL) @@ -816,7 +835,7 @@ load_keymap(char *opt, int dumponly) } void -print_keymap() +print_keymap(void) { keymap_t keymap; accentmap_t accentmap; @@ -841,9 +860,8 @@ print_keymap() } - void -load_default_functionkeys() +load_default_functionkeys(void) { fkeyarg_t fkey; int i; @@ -883,7 +901,6 @@ set_functionkey(char *keynumstr, char *string) warn("setting function key"); } - void set_bell_values(char *opt) { @@ -924,7 +941,6 @@ set_bell_values(char *opt) fprintf(stderr, "[=%d;%dB", pitch, duration); } - void set_keyrates(char *opt) { @@ -974,18 +990,18 @@ set_keyrates(char *opt) } } -static char -*get_kbd_type_name(int type) +static const char * +get_kbd_type_name(int type) { static struct { int type; - char *name; + const char *name; } name_table[] = { { KB_84, "AT 84" }, { KB_101, "AT 101/102" }, { KB_OTHER, "generic" }, }; - int i; + unsigned int i; for (i = 0; i < sizeof(name_table)/sizeof(name_table[0]); ++i) { if (type == name_table[i].type) @@ -1009,7 +1025,6 @@ show_kbd_info(void) get_kbd_type_name(info.kb_type), info.kb_type); } - void set_keyboard(char *device) { @@ -1044,7 +1059,6 @@ set_keyboard(char *device) warn("unable to set keyboard"); } - void release_keyboard(void) { diff --git a/usr.sbin/kbdcontrol/lex.l b/usr.sbin/kbdcontrol/lex.l index 67223c16ebb..7d9fd53fa04 100644 --- a/usr.sbin/kbdcontrol/lex.l +++ b/usr.sbin/kbdcontrol/lex.l @@ -31,6 +31,7 @@ %{ #include "lex.h" +#define YY_NO_UNPUT %} -- 2.45.2