diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c index b1f4ed0a1c43..4664d7ad39dd 100644 --- a/sys/arch/amiga/dev/ite.c +++ b/sys/arch/amiga/dev/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.65 2003/08/07 16:26:41 agc Exp $ */ +/* $NetBSD: ite.c,v 1.66 2003/11/01 12:56:32 jdolecek Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -83,7 +83,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.65 2003/08/07 16:26:41 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.66 2003/11/01 12:56:32 jdolecek Exp $"); #include #include @@ -154,7 +154,6 @@ static char sample[20] = { -39,-75,-103,-121,-127,-121,-103,-75,-39 }; -static char *index(const char *, char); void iteputchar(int c, struct ite_softc *ip); void ite_putstr(const char * s, int len, dev_t dev); void iteattach(struct device *, struct device *, void *); @@ -1021,7 +1020,7 @@ ite_filter(u_char c, enum caller caller) 0x5c /* / */, 0x5d /* * */ }; static char *out = "pqrstuvwxymlnMPQRS"; - char *cp = index (in, c); + char *cp = strchr(in, c); /* * keypad-appmode sends SS3 followed by the above @@ -1049,7 +1048,7 @@ ite_filter(u_char c, enum caller caller) */ if (c >= 0x4c && c <= 0x4f && kbd_ite->cursor_appmode && !bcmp(str, "\x03\x1b[", 3) && - index("ABCD", str[3])) + strchr("ABCD", str[3])) str = app_cursor + 4 * (str[3] - 'A'); /* @@ -1298,15 +1297,6 @@ atoi(const char *cp) return n; } -static char * -index(const char *cp, char ch) -{ - while (*cp && *cp != ch) cp++; - return *cp ? (char *) cp : 0; -} - - - inline static int ite_argnum(struct ite_softc *ip) { @@ -1817,7 +1807,7 @@ iteputchar(register int c, struct ite_softc *ip) *ip->ap = 0; y = atoi(ip->argbuf); x = 0; - cp = index(ip->argbuf, ';'); + cp = strchr(ip->argbuf, ';'); if (cp) x = atoi(cp + 1); if (x) @@ -1927,7 +1917,7 @@ iteputchar(register int c, struct ite_softc *ip) x = atoi(ip->argbuf); x = x ? x : 1; y = ip->rows; - cp = index(ip->argbuf, ';'); + cp = strchr(ip->argbuf, ';'); if (cp) { y = atoi(cp + 1); y = y ? y : ip->rows; diff --git a/sys/arch/atari/dev/ite.c b/sys/arch/atari/dev/ite.c index dff028cb7f6e..cc40986be14d 100644 --- a/sys/arch/atari/dev/ite.c +++ b/sys/arch/atari/dev/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.41 2003/08/07 16:27:00 agc Exp $ */ +/* $NetBSD: ite.c,v 1.42 2003/11/01 12:56:32 jdolecek Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.41 2003/08/07 16:27:00 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.42 2003/11/01 12:56:32 jdolecek Exp $"); #include "opt_ddb.h" @@ -164,7 +164,6 @@ static __inline__ void ite_sendstr __P((char *)); static __inline__ void snap_cury __P((struct ite_softc *)); static void alignment_display __P((struct ite_softc *)); -static char *index __P((const char *, int)); static struct ite_softc *getitesp __P((dev_t)); static void itecheckwrap __P((struct ite_softc *)); static void iteprecheckwrap __P((struct ite_softc *)); @@ -1112,9 +1111,9 @@ enum caller caller; } else if((key.mode & KBD_MODE_KPAD) && (kbd_ite && kbd_ite->keypad_appmode)) { - static char *in = "0123456789-+.\r()/*"; - static char *out = "pqrstuvwxymlnMPQRS"; - char *cp = index(in, code); + static const char * const in = "0123456789-+.\r()/*"; + static const char * const out = "pqrstuvwxymlnMPQRS"; + char *cp = strchr(in, code); /* * keypad-appmode sends SS3 followed by the above @@ -1143,7 +1142,7 @@ enum caller caller; if(((c == 0x48) || (c == 0x4b) || (c == 0x4d) || (c == 0x50)) && kbd_ite->cursor_appmode && !bcmp(str, "\x03\x1b[", 3) && - index("ABCD", str[3])) + strchr("ABCD", str[3])) str = app_cursor + 4 * (str[3] - 'A'); /* @@ -1414,16 +1413,6 @@ atoi (cp) return n; } -static char * -index (cp, ch) - const char *cp; - int ch; -{ - while (*cp && *cp != ch) cp++; - return *cp ? (char *) cp : 0; -} - - static __inline__ int ite_argnum (ip) struct ite_softc *ip; @@ -1937,7 +1926,7 @@ iteputchar(c, ip) *ip->ap = 0; y = atoi (ip->argbuf); x = 0; - cp = index (ip->argbuf, ';'); + cp = strchr(ip->argbuf, ';'); if (cp) x = atoi (cp + 1); if (x) x--; @@ -2054,7 +2043,7 @@ iteputchar(c, ip) x = atoi (ip->argbuf); x = x ? x : 1; y = ip->rows; - cp = index (ip->argbuf, ';'); + cp = strchr(ip->argbuf, ';'); if (cp) { y = atoi (cp + 1); diff --git a/sys/arch/x68k/dev/ite.c b/sys/arch/x68k/dev/ite.c index 2491538b5f03..97393fbdcd69 100644 --- a/sys/arch/x68k/dev/ite.c +++ b/sys/arch/x68k/dev/ite.c @@ -1,4 +1,4 @@ -/* $NetBSD: ite.c,v 1.35 2003/08/07 16:30:24 agc Exp $ */ +/* $NetBSD: ite.c,v 1.36 2003/11/01 12:56:32 jdolecek Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.35 2003/08/07 16:30:24 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.36 2003/11/01 12:56:32 jdolecek Exp $"); #include "ite.h" #if NITE > 0 @@ -151,7 +151,6 @@ static int ite_argnum __P((struct ite_softc *ip)); static int ite_zargnum __P((struct ite_softc *ip)); static void ite_sendstr __P((struct ite_softc *ip, char *str)); __inline static int atoi __P((const char *cp)); -__inline static char *index __P((const char *cp, char ch)); void ite_reset __P((struct ite_softc *ip)); struct ite_softc *getitesp __P((dev_t)); int iteon __P((dev_t, int)); @@ -948,9 +947,9 @@ ite_filter(c) code |= 0x80; } else if ((key.mode & KBD_MODE_KPAD) && (kbd_ite && kbd_ite->keypad_appmode)) { - static char *in = "0123456789-+.\r()/*"; - static char *out = "pqrstuvwxymlnMPQRS"; - char *cp = index (in, code); + static const char * const in = "0123456789-+.\r()/*"; + static const char * const out = "pqrstuvwxymlnMPQRS"; + char *cp = strchr(in, code); /* * keypad-appmode sends SS3 followed by the above @@ -978,7 +977,7 @@ ite_filter(c) */ if (c >= 0x3b && c <= 0x3e && kbd_ite->cursor_appmode && !memcmp(str, "\x03\x1b[", 3) && - index("ABCD", str[3])) + strchr("ABCD", str[3])) str = app_cursor + 4 * (str[3] - 'A'); /* @@ -1251,16 +1250,6 @@ atoi (cp) return n; } -__inline static char * -index(cp, ch) - const char *cp; - char ch; -{ - while (*cp && *cp != ch) - cp++; - return *cp ? (char *) cp : 0; -} - __inline static int ite_argnum (ip) struct ite_softc *ip; @@ -1836,7 +1825,7 @@ iteputchar(c, ip) *ip->ap = 0; y = atoi (ip->argbuf); x = 0; - cp = index (ip->argbuf, ';'); + cp = strchr(ip->argbuf, ';'); if (cp) x = atoi (cp + 1); if (x) x--; @@ -1983,7 +1972,7 @@ iteputchar(c, ip) x = atoi (ip->argbuf); x = x ? x : 1; y = ip->rows; - cp = index (ip->argbuf, ';'); + cp = strchr(ip->argbuf, ';'); if (cp) { y = atoi (cp + 1); y = y ? y : ip->rows;