#include "config.h"
#include <stdio.h>
-#ifdef SEL_FILE_IGNORE_CASE
-#include <ctype.h>
-#endif /* def SEL_FILE_IGNORE_CASE */
-
#include <X11/Xos.h>
#include <pwd.h>
#include "SFinternal.h"
#endif /* defined (SVR4) || defined (SYSV) || defined (USG) */
#include <stdlib.h>
+#include <string.h>
+#ifndef _MSC_VER
+#include <strings.h>
+#endif
#include "SFDecls.h"
dir->nChars = strlen (cannotOpen);
}
-#ifdef SEL_FILE_IGNORE_CASE
-static int SFstrncmp (char *p, char *q, int n) {
- char c1, c2;
- char *psave, *qsave;
- int nsave;
-
- psave = p;
- qsave = q;
- nsave = n;
- c1 = *p++;
- if (islower (c1)) {
- c1 = toupper (c1);
- }
- c2 = *q++;
- if (islower (c2)) {
- c2 = toupper (c2);
- }
- while ((--n >= 0) && (c1 == c2)) {
- if (!c1) {
- return strncmp (psave, qsave, nsave);
- }
- c1 = *p++;
- if (islower (c1)) {
- c1 = toupper (c1);
- }
- c2 = *q++;
- if (islower (c2)) {
- c2 = toupper (c2);
- }
- }
- if (n < 0) {
- return strncmp (psave, qsave, nsave);
- }
- return c1 - c2;
-}
-#endif /* def SEL_FILE_IGNORE_CASE */
-
static void SFreplaceText (SFDir *dir, char *str) {
int len;
name[last] = 0;
#ifdef SEL_FILE_IGNORE_CASE
- result = SFstrncmp (str, name, len);
+#ifdef _MSC_VER
+ result = _strnicmp(str, name, len);
+#else
+ result = strncasecmp(str, name, len);
+#endif
#else /* def SEL_FILE_IGNORE_CASE */
result = strncmp (str, name, len);
#endif /* def SEL_FILE_IGNORE_CASE */
name[last] = 0;
#ifdef SEL_FILE_IGNORE_CASE
- result = SFstrncmp (str, name, len);
+#ifdef _MSC_VER
+ result = _strnicmp(str, name, len);
+#else
+ result = strncasecmp(str, name, len);
+#endif
#else /* def SEL_FILE_IGNORE_CASE */
result = strncmp (str, name, len);
#endif /* def SEL_FILE_IGNORE_CASE */