Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 28th, 2020 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef STRCASECMP_H
  2. #define STRCASECMP_H
  3.  
  4. #include <cctype>
  5. #include <iostream>
  6.  
  7. //definitions.h
  8. //#define strcasecmp _stricmp
  9. //#define strncasecmp _strnicmp
  10.  
  11. int strcasecmp (const char *s1, const char *s2)
  12. {
  13.     while (*s1 != 0 && *s2 != 0)
  14.     {
  15.         if (*s1 != *s2 && ::toupper (*s1) != ::toupper(*s2))
  16.         {
  17.             return -1;
  18.         }
  19.         s1++;
  20.         s2++;
  21.     }
  22.     return (*s1 == 0 && *s2 == 0) ? 0 : -1;
  23. }
  24.  
  25.  
  26. int strncasecmp(const char *s1, const char *s2, int n)
  27. {
  28.     if (n && s1 != s2)
  29.     {
  30.         do {
  31.             int d = tolower(*s1) - tolower(*s2);
  32.             if (d || *s1 == '\0' || *s2 == '\0') return d;
  33.             s1++;
  34.             s2++;
  35.         } while (--n);
  36.     }
  37.     return 0;
  38. }
  39.  
  40. #endif // STRCASECMP_H
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top