diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2008-05-12 18:49:34 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2008-05-12 18:50:04 -0700 |
commit | ed65e8b4f02a6da7f1c5d85984a9ccf6a94d0181 (patch) | |
tree | 950eef81dd55cdb79e31b8196667692590d7c4d5 /config/hal.c | |
parent | c50b5d978981b13cdb22a9ad41c1b64f90cebe51 (diff) |
Check for strcasestr and workaround it on systems without it
Diffstat (limited to 'config/hal.c')
-rw-r--r-- | config/hal.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/config/hal.c b/config/hal.c index 67ffa0304..e197cb1b4 100644 --- a/config/hal.c +++ b/config/hal.c @@ -260,7 +260,17 @@ device_added(LibHalContext *hal_ctx, const char *udi) * Since we can't predict the order in which the keys * arrive, we need to store them. */ +#ifndef HAVE_STRCASESTR + int psi_key_len = strlen(psi_key); + char *lower_psi_key = xalloc(psi_key_len + 1); + + CopyISOLatin1Lowered((unsigned char *) lower_psi_key, + (unsigned char *) psi_key, + psi_key_len); + if ((tmp = strstr(lower_psi_key, "xkb"))) +#else if ((tmp = strcasestr(psi_key, "xkb"))) +#endif { if (!strcasecmp(&tmp[3], "layout")) { @@ -289,6 +299,9 @@ device_added(LibHalContext *hal_ctx, const char *udi) add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val); xfree(tmp_val); } +#ifndef HAVE_STRCASESTR + xfree(lower_psi_key); +#endif } } else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){ |