@ -1081,6 +1081,22 @@ int safecmp(const char *a, const char *b)
return (strcmp(a, b));
}
/* Returns whether there is a case insensitive match of buf to cmd, safely
* handling NULL or zero length strings. */
bool cmdmatch(const char *buf, const char *cmd)
{
int cmdlen, buflen;
if (!buf)
return false;
buflen = strlen(buf);
if (!buflen)
cmdlen = strlen(cmd);
if (buflen < cmdlen)
return !strncasecmp(buf, cmd, cmdlen);
static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@ -415,6 +415,7 @@ bool _hex2bin(void *p, const void *vhexstr, size_t len, const char *file, const
char *http_base64(const char *src);
void b58tobin(char *b58bin, const char *b58);
int safecmp(const char *a, const char *b);
bool cmdmatch(const char *buf, const char *cmd);
void address_to_pubkeytxn(char *pkh, const char *addr);
int ser_number(uchar *s, int32_t val);