diff options
author | Dino Li <Dino.Li@ite.com.tw> | 2018-10-30 17:36:19 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-31 00:54:25 -0700 |
commit | 2a040ce6429b59ea27dd5c3d0ae9e2bf12dc2c90 (patch) | |
tree | 6a7dd294b5bbf12b7fefde62f143622ef3cbd3f4 | |
parent | 8a617f05b98c0d5bac6bb373751df937a249bdb8 (diff) | |
download | chrome-ec-2a040ce6429b59ea27dd5c3d0ae9e2bf12dc2c90.tar.gz |
util: add isupper() library function
This function checks whether a character is an uppercase alphabet or not.
BRANCH=none
BUG=none
TEST=The return value is non-zero if argument is an uppercase alphabet.
Change-Id: I8c7be3f8852be103b8f853caa426de7843c4ee40
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1307280
Reviewed-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
-rw-r--r-- | common/util.c | 5 | ||||
-rw-r--r-- | include/util.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c index 701419b073..054e8e839c 100644 --- a/common/util.c +++ b/common/util.c @@ -47,6 +47,11 @@ int isalpha(int c) return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); } +int isupper(int c) +{ + return c >= 'A' && c <= 'Z'; +} + int isprint(int c) { return c >= ' ' && c <= '~'; diff --git a/include/util.h b/include/util.h index 4d5c263182..9691669c19 100644 --- a/include/util.h +++ b/include/util.h @@ -62,6 +62,7 @@ __stdlib_compat int atoi(const char *nptr); __stdlib_compat int isdigit(int c); __stdlib_compat int isspace(int c); __stdlib_compat int isalpha(int c); +__stdlib_compat int isupper(int c); __stdlib_compat int isprint(int c); __stdlib_compat int memcmp(const void *s1, const void *s2, size_t len); __stdlib_compat void *memcpy(void *dest, const void *src, size_t len); |