mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
needed to use strwicmp() in smbclient code, so I moved it to util_str.c
and made it non-static --jerry
This commit is contained in:
parent
e89117f418
commit
dfdca21bd9
@ -302,6 +302,36 @@ BOOL strcsequal(const char *s1,const char *s2)
|
||||
return(strcmp(s1,s2)==0);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Do a case-insensitive, whitespace-ignoring string compare.
|
||||
***************************************************************************/
|
||||
int strwicmp(char *psz1, char *psz2)
|
||||
{
|
||||
/* if BOTH strings are NULL, return TRUE, if ONE is NULL return */
|
||||
/* appropriate value. */
|
||||
if (psz1 == psz2)
|
||||
return (0);
|
||||
else if (psz1 == NULL)
|
||||
return (-1);
|
||||
else if (psz2 == NULL)
|
||||
return (1);
|
||||
|
||||
/* sync the strings on first non-whitespace */
|
||||
while (1)
|
||||
{
|
||||
while (isspace(*psz1))
|
||||
psz1++;
|
||||
while (isspace(*psz2))
|
||||
psz2++;
|
||||
if (toupper(*psz1) != toupper(*psz2) || *psz1 == '\0'
|
||||
|| *psz2 == '\0')
|
||||
break;
|
||||
psz1++;
|
||||
psz2++;
|
||||
}
|
||||
return (*psz1 - *psz2);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
convert a string to lower case
|
||||
|
@ -1786,37 +1786,6 @@ BOOL lp_add_printer(char *pszPrintername, int iDefaultService)
|
||||
return (True);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
Do a case-insensitive, whitespace-ignoring string compare.
|
||||
***************************************************************************/
|
||||
static int strwicmp(char *psz1, char *psz2)
|
||||
{
|
||||
/* if BOTH strings are NULL, return TRUE, if ONE is NULL return */
|
||||
/* appropriate value. */
|
||||
if (psz1 == psz2)
|
||||
return (0);
|
||||
else if (psz1 == NULL)
|
||||
return (-1);
|
||||
else if (psz2 == NULL)
|
||||
return (1);
|
||||
|
||||
/* sync the strings on first non-whitespace */
|
||||
while (1)
|
||||
{
|
||||
while (isspace(*psz1))
|
||||
psz1++;
|
||||
while (isspace(*psz2))
|
||||
psz2++;
|
||||
if (toupper(*psz1) != toupper(*psz2) || *psz1 == '\0'
|
||||
|| *psz2 == '\0')
|
||||
break;
|
||||
psz1++;
|
||||
psz2++;
|
||||
}
|
||||
return (*psz1 - *psz2);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Map a parameter's string representation to something we can use.
|
||||
Returns False if the parameter string is not recognised, else TRUE.
|
||||
|
Loading…
Reference in New Issue
Block a user