summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-08-29 14:33:39 +0000
committerGerald Carter <jerry@samba.org>2000-08-29 14:33:39 +0000
commit4326894f6a10c55a1b95b94023952c4e30439074 (patch)
treed64b87043207328f365e1433724d3e1989a8d859 /source3
parente0d09910a1f0d4c28dd3b0b76da6a09736c556d8 (diff)
downloadsamba-4326894f6a10c55a1b95b94023952c4e30439074.tar.gz
samba-4326894f6a10c55a1b95b94023952c4e30439074.tar.bz2
samba-4326894f6a10c55a1b95b94023952c4e30439074.zip
needed to use strwicmp() in smbclient code, so I moved it to util_str.c
and made it non-static --jerry (This used to be commit dfdca21bd90b9c83f195d580ec9d774f1be8f9cb)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_str.c30
-rw-r--r--source3/param/loadparm.c31
2 files changed, 30 insertions, 31 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 41c012ba34..822267f5d5 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -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
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 957ba88011..da23ab1cb6 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -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.