diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-04-30 00:40:49 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2012-04-30 00:42:27 -0400 |
commit | ecc6a1d1580086572c4c505330be52dbad205c27 (patch) | |
tree | 07196d6a352f897a07a7546ba1ba08405f927e4c | |
parent | ea4389f7c11ef401a92b4b748321dce8fc3de1d8 (diff) |
rpmatch: simple inline version
Since rpmatch will match ^[Yy] and ^[Nn] regardless of locale, this
lets us create a simple inline version. Newer procps versions use
this function.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r-- | include/stdlib.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 352e58ab3..05a18eb8f 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -828,12 +828,17 @@ __END_NAMESPACE_STD #endif /* __UCLIBC_HAS_WCHAR__ */ -#if 0 /*def __USE_SVID*/ +#ifdef __USE_SVID /* Determine whether the string value of RESPONSE matches the affirmation or negative response expression as specified by the LC_MESSAGES category in the program's current locale. Returns 1 if affirmative, 0 if negative, and -1 if not matching. */ -extern int rpmatch (__const char *__response) __THROW __nonnull ((1)) __wur; +__THROW __nonnull ((1)) __wur +static inline int rpmatch (__const char *__response) +{ + return (__response[0] == 'y' || __response[0] == 'Y') ? 1 : + (__response[0] == 'n' || __response[0] == 'N') ? 0 : -1; +} #endif |