/* Various utility functions.
- Copyright (C) 1996-2006 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Wget.
file, but you are not obligated to do so. If you do not wish to do
so, delete this exception statement from your version. */
-#include <config.h>
+#include "wget.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_MMAP
# include <sys/mman.h>
#endif
+#ifdef HAVE_PROCESS_H
+# include <process.h> /* getpid() */
+#endif
#ifdef HAVE_UTIME_H
# include <utime.h>
#endif
# define USE_SIGNAL_TIMEOUT
#endif
-#include "wget.h"
#include "utils.h"
#include "hash.h"
char *copy = xstrdup (s);
char *p = copy;
for (; *p; p++)
- *p = TOLOWER (*p);
+ *p = c_tolower (*p);
return copy;
}
res[++i] = NULL;
++s;
/* Skip the blanks following the ','. */
- while (ISSPACE (*s))
+ while (c_isspace (*s))
++s;
p = s;
}
}
\f
/* The Windows versions of the following two functions are defined in
- mswindows.c. */
+ mswindows.c. On MSDOS this function should never be called. */
-#ifndef WINDOWS
+#if !defined(WINDOWS) && !defined(MSDOS)
void
fork_to_background (void)
{
freopen ("/dev/null", "w", stdout);
freopen ("/dev/null", "w", stderr);
}
-#endif /* not WINDOWS */
+#endif /* !WINDOWS && !MSDOS */
\f
/* "Touch" FILE, i.e. make its mtime ("modified time") equal the time
specified with TM. The atime ("access time") is set to the current
char *strcopy = (char *) alloca (strlen (string) + 1);
char *p;
for (p = patcopy; *pattern; pattern++, p++)
- *p = TOLOWER (*pattern);
+ *p = c_tolower (*pattern);
*p = '\0';
for (p = strcopy; *string; string++, p++)
- *p = TOLOWER (*string);
+ *p = c_tolower (*string);
*p = '\0';
return fnmatch (patcopy, strcopy, flags);
#endif
for (; *d1 && *d2 && (*d1 == *d2); ++d1, ++d2)
;
else
- for (; *d1 && *d2 && (TOLOWER (*d1) == TOLOWER (*d2)); ++d1, ++d2)
+ for (; *d1 && *d2 && (c_tolower (*d1) == c_tolower (*d2)); ++d1, ++d2)
;
return *d1 == '\0' && (*d2 == '\0' || *d2 == '/');
else
{
for (i = strlen (string), j = strlen (tail); i >= 0 && j >= 0; i--, j--)
- if (TOLOWER (string[i]) != TOLOWER (tail[j]))
+ if (c_tolower (string[i]) != c_tolower (tail[j]))
break;
}
define it under Windows, because Windows has its own version of
run_with_timeout that uses threads. */
-int
+bool
run_with_timeout (double timeout, void (*fun) (void *), void *arg)
{
fun (arg);
when end of string is reached. */
#define NEXT_CHAR(c, p) do { \
c = (unsigned char) *p++; \
-} while (ISSPACE (c))
+} while (c_isspace (c))
#define IS_ASCII(c) (((c) & 0x80) == 0)