From: robertl Date: Sun, 23 Jan 2005 04:19:50 +0000 (+0000) Subject: util.c: add case_ignore_strncmp X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~3813 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=662eb5d638e48f43b8bf168ffb702fcde8a714ee;p=gpsbabel.git util.c: add case_ignore_strncmp --- diff --git a/gpsbabel/util.c b/gpsbabel/util.c index 69f0d9370..165453a3e 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -326,6 +326,20 @@ case_ignore_strcmp(const char *s1, const char *s2) } +int +case_ignore_strncmp(const char *s1, const char *s2, int n) +{ + int rv = 0; + + while (n && ((rv = toupper(*s1) - toupper(*s2)) == 0) + && *s1) { + s1++; + s2++; + n--; + } + return rv; +} + void printposn(const double c, int is_lat) {