diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-04-23 22:53:54 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-04-27 16:54:42 -0700 |
commit | 7942cfdb5fad5c6fe9d2d9c622f080b4c52b0c97 (patch) | |
tree | 7aa2ce041d3b98db13efc40575f61be0c581b8d3 /xkill.c | |
parent | 3115919a3bbb230b541b5ad8ccd2e363b8a4e4ab (diff) |
Use strcasecmp instead of a tolower loop & strcmp
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
Diffstat (limited to 'xkill.c')
-rw-r--r-- | xkill.c | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -55,7 +55,7 @@ static char *ProgramName; #define SelectButtonAny (-1) #define SelectButtonFirst (-2) -static int parse_button ( char *s, int *buttonp ); +static int parse_button ( const char *s, int *buttonp ); static XID get_window_id ( Display *dpy, int screen, int button, const char *msg ); static int catch_window_errors ( Display *dpy, XErrorEvent *ev ); static int kill_all_windows ( Display *dpy, int screenno, Bool top ); @@ -240,22 +240,11 @@ main(int argc, char *argv[]) } static int -parse_button(char *s, int *buttonp) +parse_button(const char *s, int *buttonp) { - register char *cp; + const char *cp; - /* lower case name */ - for (cp = s; *cp; cp++) { - if (isascii (*cp) && isupper (*cp)) { -#ifdef _tolower - *cp = (char) _tolower (*cp); -#else - *cp = (char) tolower (*cp); -#endif /* _tolower */ - } - } - - if (strcmp (s, "any") == 0) { + if (strcasecmp (s, "any") == 0) { *buttonp = SelectButtonAny; return (1); } |