summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/kpathsea')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog10
-rw-r--r--Build/source/texk/kpathsea/dir.c12
-rw-r--r--Build/source/texk/kpathsea/elt-dirs.c4
-rw-r--r--Build/source/texk/kpathsea/pathsearch.c22
-rw-r--r--Build/source/texk/kpathsea/tex-file.c2
5 files changed, 42 insertions, 8 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 7e26c953e29..9e56ac31d83 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,13 @@
+2010-02-12 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * dir.c (kpathsea_dir_p), elt-dirs.c (kpathsea_normalize_path),
+ pathsearch.c (log_search, search, search_list),
+ tex-file.c (kpathsea_find_file_generic):
+ Add '#ifdef KPSE_DEBUG' to allow compilation with '-DNO_DEBUG'.
+
+ * dir.c (kpathsea_dir_p): Replace kpse_normalize_path() by
+ kpathsea_normalize_path().
+
2010-02-11 Peter Breitenlohner <peb@mppmu.mpg.de>
* db.h (kpathsea_init_db, kpse_init_db, kpathsea_db_search,
diff --git a/Build/source/texk/kpathsea/dir.c b/Build/source/texk/kpathsea/dir.c
index 5f599c15260..295e4dcb75c 100644
--- a/Build/source/texk/kpathsea/dir.c
+++ b/Build/source/texk/kpathsea/dir.c
@@ -1,6 +1,6 @@
/* dir.c: directory operations.
- Copyright 1992, 1993, 1994, 1995, 2008, 2009 Karl Berry.
+ Copyright 1992, 1993, 1994, 1995, 2008, 2009, 2010 Karl Berry.
Copyright 2000, 2002, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -36,9 +36,10 @@ kpathsea_dir_p (kpathsea kpse, const_string fn)
#ifdef WIN32
int fa;
- kpse_normalize_path((string)fn);
+ kpathsea_normalize_path(kpse, (string)fn);
fa = GetFileAttributes(fn);
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_STAT)) {
if (fa == 0xFFFFFFFF) {
fprintf(stderr, "failed to get file attributes for %s (%d)\n",
@@ -49,18 +50,19 @@ kpathsea_dir_p (kpathsea kpse, const_string fn)
"is" : "is not");
}
}
+#endif /* KPSE_DEBUG */
return (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY));
-#else
+#else /* !WIN32 */
struct stat stats;
return stat (fn, &stats) == 0 && S_ISDIR (stats.st_mode);
-#endif
+#endif /* !WIN32 */
}
#if defined(KPSE_COMPAT_API)
boolean
dir_p (const_string fn)
{
- return kpathsea_dir_p(kpse_def,fn);
+ return kpathsea_dir_p(kpse_def, fn);
}
#endif
diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c
index a8711cb0198..a13965db037 100644
--- a/Build/source/texk/kpathsea/elt-dirs.c
+++ b/Build/source/texk/kpathsea/elt-dirs.c
@@ -1,6 +1,6 @@
/* elt-dirs.c: Translate a path element to its corresponding director{y,ies}.
- Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009 Karl Berry.
+ Copyright 1993, 1994, 1995, 1996, 1997, 2008, 2009, 2010 Karl Berry.
Copyright 1997, 1998, 1999, 2000, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -377,8 +377,10 @@ kpathsea_normalize_path (kpathsea kpse, string elt)
;
}
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_STAT) && ret != 1)
DEBUGF2 ("kpse_normalize_path (%s) => %u\n", elt, ret);
+#endif /* KPSE_DEBUG */
return ret;
}
diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c
index 1ea9300c464..4bc0b974d29 100644
--- a/Build/source/texk/kpathsea/pathsearch.c
+++ b/Build/source/texk/kpathsea/pathsearch.c
@@ -1,6 +1,6 @@
/* pathsearch.c: look up a filename in a path.
- Copyright 1993, 1994, 1995, 1997, 2007, 2009 Karl Berry.
+ Copyright 1993, 1994, 1995, 1997, 2007, 2009, 2010 Karl Berry.
Copyright 1997-2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -63,7 +63,11 @@ log_search (kpathsea kpse, str_list_type filenames)
}
}
- if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH) || kpse->log_file) {
+ if (
+#ifdef KPSE_DEBUG
+ KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH) ||
+#endif /* KPSE_DEBUG */
+ kpse->log_file) {
unsigned e;
/* FILENAMES should never be null, but safety doesn't hurt. */
@@ -76,6 +80,7 @@ log_search (kpathsea kpse, str_list_type filenames)
fprintf (kpse->log_file, "%lu %s\n", (long unsigned) time (NULL),
filename);
+#ifdef KPSE_DEBUG
/* And show them online, if debugging. We've already started
the debugging line in `search', where this is called, so
just print the filename here, don't use DEBUGF. */
@@ -83,6 +88,7 @@ log_search (kpathsea kpse, str_list_type filenames)
putc (' ', stderr);
fputs (filename, stderr);
}
+#endif /* KPSE_DEBUG */
}
}
}
@@ -352,9 +358,11 @@ search (kpathsea kpse, const_string path, const_string original_name,
consider PATH at all. */
absolute_p = kpathsea_absolute_p (kpse, name, true);
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH))
DEBUGF4 ("start search(file=%s, must_exist=%d, find_all=%d, path=%s).\n",
name, must_exist, all, path);
+#endif /* KPSE_DEBUG */
/* Find the file(s). */
ret_list = absolute_p ? absolute_search (kpse, name)
@@ -373,11 +381,15 @@ search (kpathsea kpse, const_string path, const_string original_name,
} else {
/* Record the filenames we found, if desired. And wrap them in a
debugging line if we're doing that. */
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH))
DEBUGF1 ("search(%s) =>", original_name);
+#endif /* KPSE_DEBUG */
log_search (kpse, ret_list);
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH))
putc ('\n', stderr);
+#endif /* KPSE_DEBUG */
}
#ifdef __DJGPP__
@@ -428,6 +440,7 @@ search_list (kpathsea kpse, const_string path, const_string* names,
ret_list = str_list_init();
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH)) {
DEBUGF1 ("start search(files=[%s", *names);
for (namep = names+1; *namep != NULL; namep++) {
@@ -437,6 +450,7 @@ search_list (kpathsea kpse, const_string path, const_string* names,
fprintf (stderr, "], must_exist=%d, find_all=%d, path=%s).\n",
must_exist, all, path);
}
+#endif /* KPSE_DEBUG */
/* FIXME: is this really true? No need to do any expansion on names. */
@@ -519,6 +533,7 @@ search_list (kpathsea kpse, const_string path, const_string* names,
} else {
/* Record the filenames we found, if desired. And wrap them in a
debugging line if we're doing that. */
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH)) {
DEBUGF1 ("search([%s", *names);
for (namep = names+1; *namep != NULL; namep++) {
@@ -527,9 +542,12 @@ search_list (kpathsea kpse, const_string path, const_string* names,
}
fputs ("]) =>", stderr);
}
+#endif /* KPSE_DEBUG */
log_search (kpse, ret_list);
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH))
putc ('\n', stderr);
+#endif /* KPSE_DEBUG */
}
#ifdef __DJGPP__
diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c
index 75cc017d9ad..d31e55dce1f 100644
--- a/Build/source/texk/kpathsea/tex-file.c
+++ b/Build/source/texk/kpathsea/tex-file.c
@@ -984,9 +984,11 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name,
if (FMT_INFO.path == NULL)
kpathsea_init_format (kpse, format);
+#ifdef KPSE_DEBUG
if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH))
DEBUGF3 ("kpse_find_file: searching for %s of type %s (from %s)\n",
const_name, FMT_INFO.type, FMT_INFO.path_source);
+#endif /* KPSE_DEBUG */
/* Do variable and tilde expansion. */
name = kpathsea_expand (kpse, const_name);