diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2010-05-15 01:55:00 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2010-05-15 01:55:00 +0000 |
commit | ff95b300f8204c215384425032124f206349bca2 (patch) | |
tree | abdb4fced025cb35b974f9f0ba0c7d6c9fd01094 | |
parent | 64252d2baf23bb55ca90c388215779740c73e695 (diff) |
remove trailing spaces.
git-svn-id: svn://tug.org/texlive/trunk@18276 c570f23f-e606-0410-a88d-b1316a301751
66 files changed, 459 insertions, 444 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 34f7e3701c5..99c404467f5 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,18 @@ +2010-05-15 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + *absolute.c, access.c, atou.c, c-ctype.h, c-pathch.h, c-std.h, cnf.c, + concatn.c, config.h, db.c, db.h, debug.h, default.h, dir.c, + elt-dirs.c, expand.c, extend-fname.c, find-suffix.c, fn.c, + fontmap.c, getopt.c, kpathsea.c, kpsestat.c, kpsewhich.c, lib.h, + line.c, magstep.c, magstep.h, make-suffix.c, mingw32.c, mingw32.h, + path-elt.c, pathsearch.c, pathsearch.h, proginit.c, proginit.h, + progname.c, readable.c, readable.h, readlink.c, rm-suffix.c, + str-list.c, str-llist.c, strstr.c, tex-file.c, tex-glyph.c, + tex-glyph.h, tex-hush.c, tex-make.c, tex-make.h, truncate.c, + uppercasify.c, variable.h, version.c, win32lib.h, xbasename.c, + xcalloc.c, xdirname.c, xfopen.c, xftell.c, xftello.c, xgetcwd.c, + xopendir.c, xrealloc.c, xstat.c: remove trailing spaces. + 2010-05-10 Peter Breitenlohner <peb@mppmu.mpg.de> * c-fopen.h [SET_BINARY]: Add cast to void. diff --git a/Build/source/texk/kpathsea/absolute.c b/Build/source/texk/kpathsea/absolute.c index 0ff3aaa3c88..59f8b103de5 100644 --- a/Build/source/texk/kpathsea/absolute.c +++ b/Build/source/texk/kpathsea/absolute.c @@ -61,7 +61,7 @@ kpathsea_absolute_p (kpathsea kpse, const_string filename, boolean relative_ok) } #if defined (KPSE_COMPAT_API) -boolean +boolean kpse_absolute_p (const_string filename, boolean relative_ok) { return kpathsea_absolute_p (kpse_def, filename, relative_ok); diff --git a/Build/source/texk/kpathsea/access.c b/Build/source/texk/kpathsea/access.c index 90a23740005..c1b7cf24f2e 100644 --- a/Build/source/texk/kpathsea/access.c +++ b/Build/source/texk/kpathsea/access.c @@ -77,14 +77,14 @@ Try `%s --help' for more information.\n", argv[0], argv[0]); fprintf(stderr, "%s: Invalid MODE.\n", argv[0]); exit(1); } - + status = access(argv[2], mode); - + /* fail if the access call failed */ if (status != 0) { return 1; } - + /* otherwise, succeed */ return 0; } diff --git a/Build/source/texk/kpathsea/atou.c b/Build/source/texk/kpathsea/atou.c index 54edb046b82..78afdfe7ce7 100644 --- a/Build/source/texk/kpathsea/atou.c +++ b/Build/source/texk/kpathsea/atou.c @@ -21,7 +21,7 @@ unsigned atou (const_string s) { int i = atoi (s); - + if (i < 0) FATAL1 ("I expected a positive number, not %d", i); return i; diff --git a/Build/source/texk/kpathsea/c-ctype.h b/Build/source/texk/kpathsea/c-ctype.h index 53f7f4b5209..d05e5e139e8 100644 --- a/Build/source/texk/kpathsea/c-ctype.h +++ b/Build/source/texk/kpathsea/c-ctype.h @@ -79,5 +79,5 @@ Subject: ss-921123: using isascii with <ctype.h> macros ... then, use ISDIGIT, etc. instead of isdigit, etc. */ - + #endif /* not KPATHSEA_C_CTYPE_H */ diff --git a/Build/source/texk/kpathsea/c-pathch.h b/Build/source/texk/kpathsea/c-pathch.h index ff11fc45456..97970f40c67 100644 --- a/Build/source/texk/kpathsea/c-pathch.h +++ b/Build/source/texk/kpathsea/c-pathch.h @@ -65,10 +65,10 @@ #define IS_DIR_SEP(ch) ((ch) == DIR_SEP) #endif #ifndef IS_DEVICE_SEP /* No `devices' on, e.g., Unix. */ -#define IS_DEVICE_SEP(ch) 0 +#define IS_DEVICE_SEP(ch) 0 #endif #ifndef NAME_BEGINS_WITH_DEVICE -#define NAME_BEGINS_WITH_DEVICE(name) 0 +#define NAME_BEGINS_WITH_DEVICE(name) 0 #endif #ifndef IS_UNC_NAME /* Unc names are in practice found on Win32 only. */ #define IS_UNC_NAME(name) 0 diff --git a/Build/source/texk/kpathsea/c-std.h b/Build/source/texk/kpathsea/c-std.h index 40e0ce78bd0..6d0169d16ae 100644 --- a/Build/source/texk/kpathsea/c-std.h +++ b/Build/source/texk/kpathsea/c-std.h @@ -22,7 +22,7 @@ /* Header files that essentially all of our sources need, and that all implementations have. We include these first, to help with NULL being defined multiple times. */ -/* Workaround against a <math.h> MSVC bug : it can't be declared +/* Workaround against a <math.h> MSVC bug : it can't be declared extern "C" in a c++ source file. */ #ifndef __cplusplus #include <math.h> diff --git a/Build/source/texk/kpathsea/cnf.c b/Build/source/texk/kpathsea/cnf.c index 91ce92cb785..5c11ae30d00 100644 --- a/Build/source/texk/kpathsea/cnf.c +++ b/Build/source/texk/kpathsea/cnf.c @@ -55,15 +55,15 @@ do_line (kpathsea kpse, string line) string start; string value, var; string prog = NULL; - + /* Skip leading whitespace. */ while (ISSPACE (*line)) line++; - + /* More to do only if we have non-comment material left. */ if (*line == 0 || *line == '%' || *line == '#') return; - + /* The variable name is everything up to the next space or = or `.'. */ start = line; while (!ISSPACE (*line) && *line != '=' && *line != '.') @@ -74,7 +74,7 @@ do_line (kpathsea kpse, string line) var = (string)xmalloc (len + 1); strncpy (var, start, len); var[len] = 0; - + /* If the variable is qualified with a program name, find out which. */ while (ISSPACE (*line)) line++; @@ -103,13 +103,13 @@ do_line (kpathsea kpse, string line) while (ISSPACE (*line)) line++; } - + /* The value is whatever remains. Remove trailing whitespace. */ start = line; len = strlen (start); while (len > 0 && ISSPACE (start[len - 1])) len--; - + value = (string)xmalloc (len + 1); strncpy (value, start, len); value[len] = 0; @@ -119,11 +119,11 @@ do_line (kpathsea kpse, string line) : on Unix, ; on NT. We can't switch NT to allowing :'s, since : is the drive separator. So we switch Unix to allowing ;'s. On the other hand, we don't want to change IS_ENV_SEP and all the rest. - + So, simply translate all ;'s in the path values to :'s if we are a Unix binary. (Fortunately we don't use ; in other kinds of texmf.cnf values.) */ - + if (IS_ENV_SEP(':')) { string loc; for (loc = value; *loc; loc++) { @@ -143,7 +143,7 @@ do_line (kpathsea kpse, string line) var = lhs; } hash_insert (&(kpse->cnf_hash), var, value); - + /* We could check that anything remaining is preceded by a comment character, but let's not bother. */ } @@ -201,7 +201,7 @@ read_all_cnf (kpathsea kpse) string warn = getenv ("KPATHSEA_WARNING"); if (!(warn && STREQ (warn, "0"))) { WARNING1 - ("kpathsea: configuration file texmf.cnf not found in these directories: %s", + ("kpathsea: configuration file texmf.cnf not found in these directories: %s", cnf_path); } } @@ -224,19 +224,19 @@ kpathsea_cnf_get (kpathsea kpse, const_string name) compile-time path does not contain variable references. */ if (kpse->doing_cnf_init) return NULL; - + if (kpse->cnf_hash.size == 0) { /* Read configuration files and initialize databases. */ kpse->doing_cnf_init = true; read_all_cnf (kpse); kpse->doing_cnf_init = false; - + /* Since `kpse_init_db' recursively calls us, we must call it from outside a `kpse_path_element' loop (namely, the one in `read_all_cnf' above): `kpse_path_element' is not reentrant. */ kpathsea_init_db (kpse); } - + /* First look up NAME.`kpse->program_name', then NAME. */ assert (kpse->program_name); ctry = concat3 (name, ".", kpse->program_name); @@ -254,7 +254,7 @@ kpathsea_cnf_get (kpathsea kpse, const_string name) ret = NULL; } } - + return ret; } diff --git a/Build/source/texk/kpathsea/concatn.c b/Build/source/texk/kpathsea/concatn.c index e108aee9201..4e0b9eb923d 100644 --- a/Build/source/texk/kpathsea/concatn.c +++ b/Build/source/texk/kpathsea/concatn.c @@ -33,9 +33,9 @@ concatn (const_string str1, ...) if (!str1) return NULL; - + ret = xstrdup (str1); - + va_start (ap, str1); while ((arg = va_arg (ap, string)) != NULL) { @@ -44,7 +44,7 @@ concatn (const_string str1, ...) ret = temp; } va_end (ap); - + return ret; } diff --git a/Build/source/texk/kpathsea/config.h b/Build/source/texk/kpathsea/config.h index 4abd0b52b53..374eb3b5bac 100644 --- a/Build/source/texk/kpathsea/config.h +++ b/Build/source/texk/kpathsea/config.h @@ -107,7 +107,7 @@ #include <kpathsea/types.h> /* <sys/types.h>, boolean, string, etc. */ #include <kpathsea/progname.h> /* for program_invocation_*name */ - + /* If you want to find subdirectories in a directory with non-Unix semantics (specifically, if a directory with no subdirectories does not have exactly two links), define this. */ diff --git a/Build/source/texk/kpathsea/db.c b/Build/source/texk/kpathsea/db.c index d0ff236b583..a80f4adb212 100644 --- a/Build/source/texk/kpathsea/db.c +++ b/Build/source/texk/kpathsea/db.c @@ -65,13 +65,13 @@ static boolean ignore_dir_p (const_string dirname) { const_string dot_pos = dirname; - + while ((dot_pos = strchr (dot_pos + 1, '.'))) { /* If / before and no / after, skip it. */ if (IS_DIR_SEP (dot_pos[-1]) && dot_pos[1] && !IS_DIR_SEP (dot_pos[1])) return true; } - + return false; } @@ -87,10 +87,10 @@ db_build (kpathsea kpse, hash_table_type *table, const_string db_filename) string top_dir = (string)xmalloc (len + 1); string cur_dir = NULL; /* First thing in ls-R might be a filename. */ FILE *db_file = fopen (db_filename, FOPEN_R_MODE); - + strncpy (top_dir, db_filename, len); top_dir[len] = 0; - + if (db_file) { while ((line = read_line (db_file)) != NULL) { len = strlen (line); @@ -204,13 +204,13 @@ kpse_db_insert (const_string passed_fname) /* Return true if FILENAME could be in PATH_ELT, i.e., if the directory part of FILENAME matches PATH_ELT. Have to consider // wildcards, but $ and ~ expansion have already been done. */ - + static boolean match (const_string filename, const_string path_elt) { const_string original_filename = filename; boolean matched = false; - + for (; *filename && *path_elt; filename++, path_elt++) { if (FILECHARCASEEQ (*filename, *path_elt)) /* normal character match */ ; @@ -240,7 +240,7 @@ match (const_string filename, const_string path_elt) else /* normal character nonmatch, quit */ break; } - + /* If we've reached the end of PATH_ELT, check that we're at the last component of FILENAME, we've matched. */ if (!matched && *path_elt == 0) { @@ -252,12 +252,12 @@ match (const_string filename, const_string path_elt) But if not, that's ok, as long as there are no more dir separators. */ if (IS_DIR_SEP (*filename)) filename++; - + while (*filename && !IS_DIR_SEP (*filename)) filename++; matched = *filename == 0; } - + return matched; } @@ -266,12 +266,12 @@ match (const_string filename, const_string path_elt) That is, the question is whether to try the db for a file looked up in PATH_ELT. If PATH_ELT == ".", for example, the answer is no. If PATH_ELT == "/usr/local/lib/texmf/fonts//tfm", the answer is yes. - + In practice, ls-R is only needed for lengthy subdirectory comparisons, but there's no gain to checking PATH_ELT to see if it is a subdir match, since the only way to do that is to do a string search in it, which is all we do anyway. */ - + static boolean elt_in_db (const_string db_dir, const_string path_elt) { @@ -281,7 +281,7 @@ elt_in_db (const_string db_dir, const_string path_elt) /* If we've matched the entire db directory, it's good. */ if (*db_dir == 0) found = true; - + /* If we've reached the end of PATH_ELT, but not the end of the db directory, it's no good. */ else if (*path_elt == 0) @@ -315,7 +315,7 @@ alias_build (kpathsea kpse, hash_table_type *table, while (*alias && !ISSPACE (*alias)) alias++; *alias++ = 0; - while (*alias && ISSPACE (*alias)) + while (*alias && ISSPACE (*alias)) alias++; /* Is the check for errors strong enough? Should we warn the user for potential errors? */ @@ -361,7 +361,7 @@ kpathsea_init_db (kpathsea kpse) db_path = kpathsea_init_format (kpse, kpse_db_format); db_files = kpathsea_all_path_search_list (kpse, db_path, db_names); orig_db_files = db_files; - + /* Must do this after the path searching (which ends up calling kpse_db_search recursively), so kpse->db.buckets stays NULL. */ kpse->db = hash_create (DB_HASH_SIZE); @@ -372,7 +372,7 @@ kpathsea_init_db (kpathsea kpse) free (*db_files); db_files++; } - + if (!ok) { /* If db can't be built, leave `size' nonzero (so we don't rebuild it), but clear `buckets' (so we don't look in it). */ @@ -417,7 +417,7 @@ kpse_init_db (void) /* Avoid doing anything if this PATH_ELT is irrelevant to the databases. */ str_list_type * -kpathsea_db_search (kpathsea kpse, const_string name, +kpathsea_db_search (kpathsea kpse, const_string name, const_string orig_path_elt, boolean all) { string *db_dirs, *orig_dirs, *r; @@ -428,12 +428,12 @@ kpathsea_db_search (kpathsea kpse, const_string name, str_list_type *ret = NULL; string *aliases = NULL; boolean relevant = false; - + /* If we failed to build the database (or if this is the recursive call to build the db path), quit. */ if (kpse->db.buckets == NULL) return NULL; - + /* When tex-glyph.c calls us looking for, e.g., dpi600/cmr10.pk, we won't find it unless we change NAME to just `cmr10.pk' and append `/dpi600' to PATH_ELT. We are justified in using a literal `/' @@ -510,12 +510,12 @@ kpathsea_db_search (kpathsea kpse, const_string name, string found = NULL; if (kpathsea_readable_file (kpse, db_file)) { found = db_file; - + } else { string *a; - + free (db_file); /* `db_file' wasn't on disk. */ - + /* The hit in the DB doesn't exist in disk. Now try all its aliases. For example, suppose we have a hierarchy on CD, thus `mf.bas', but ls-R contains `mf.base'. Find it anyway. @@ -530,7 +530,7 @@ kpathsea_db_search (kpathsea kpse, const_string name, free (atry); } } - + /* If we have a real file, add it to the list, maybe done. */ if (found) { str_list_add (ret, found); @@ -540,7 +540,7 @@ kpathsea_db_search (kpathsea kpse, const_string name, } else { /* no match in the db */ free (db_file); } - + /* On to the next directory, if any. */ db_dirs++; @@ -550,9 +550,9 @@ kpathsea_db_search (kpathsea kpse, const_string name, if (orig_dirs && *orig_dirs) free (orig_dirs); } - + free (aliases); - + /* If we had to break up NAME, free the temporary PATH_ELT. */ if (path_elt != orig_path_elt) free (path_elt); @@ -570,7 +570,7 @@ kpse_db_search (const_string name, const_string orig_path_elt, #endif str_list_type * -kpathsea_db_search_list (kpathsea kpse, const_string* names, +kpathsea_db_search_list (kpathsea kpse, const_string* names, const_string path_elt, boolean all) { string *db_dirs, *orig_dirs, *r; @@ -581,7 +581,7 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, int n; str_list_type *ret = NULL; boolean relevant = false; - + /* If we failed to build the database (or if this is the recursive call to build the db path), quit. */ if (kpse->db.buckets == NULL) @@ -625,7 +625,7 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, } else { path = path_elt; } - + /* If we have aliases for this name, use them. */ if (kpse->alias_db.buckets) aliases = hash_lookup (kpse->alias_db, name); @@ -635,7 +635,7 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, if (!aliases) { aliases = XTALLOC1 (string); aliases[0] = NULL; - } + } { /* Push aliases up by one and insert the original name at front. */ unsigned i; unsigned len = 1; /* Have NULL element already allocated. */ @@ -653,7 +653,7 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, /* We have an ls-R db. Look up `try'. */ orig_dirs = db_dirs = hash_lookup (kpse->db, ctry); - + ret = XTALLOC1 (str_list_type); *ret = str_list_init (); @@ -709,18 +709,18 @@ kpathsea_db_search_list (kpathsea kpse, const_string* names, /* On to the next directory, if any. */ db_dirs++; } - + /* This is just the space for the pointers, not the strings. */ if (orig_dirs && *orig_dirs) free (orig_dirs); } - + free (aliases); if (path != path_elt) free((string)path); } return ret; - + } #if defined(KPSE_COMPAT_API) diff --git a/Build/source/texk/kpathsea/db.h b/Build/source/texk/kpathsea/db.h index 76dcb220e72..968f2b0da64 100644 --- a/Build/source/texk/kpathsea/db.h +++ b/Build/source/texk/kpathsea/db.h @@ -35,7 +35,7 @@ extern void kpathsea_init_db (kpathsea kpse); databases can be read, or PATH_ELT is not in any of the databases, return NULL. */ -extern str_list_type *kpathsea_db_search (kpathsea kpse, const_string name, +extern str_list_type *kpathsea_db_search (kpathsea kpse, const_string name, const_string path_elt, boolean all); extern str_list_type *kpathsea_db_search_list (kpathsea kpse, @@ -55,7 +55,7 @@ extern KPSEDLL void kpathsea_db_insert (kpathsea kpse, const_string fname); extern void kpse_init_db (void); -extern str_list_type *kpse_db_search (const_string name, +extern str_list_type *kpse_db_search (const_string name, const_string path_elt, boolean all); extern str_list_type *kpse_db_search_list (const_string* names, diff --git a/Build/source/texk/kpathsea/debug.h b/Build/source/texk/kpathsea/debug.h index 790f5e7e101..45180646c12 100644 --- a/Build/source/texk/kpathsea/debug.h +++ b/Build/source/texk/kpathsea/debug.h @@ -43,7 +43,7 @@ _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );\ } #else /* ! _DEBUG */ -#define SET_CRT_DEBUG_FIELD(a) +#define SET_CRT_DEBUG_FIELD(a) #define CLEAR_CRT_DEBUG_FIELD(a) #define SETUP_CRTDBG #endif /* _DEBUG */ diff --git a/Build/source/texk/kpathsea/default.h b/Build/source/texk/kpathsea/default.h index 2b3e0efea7b..cdf1bd30749 100644 --- a/Build/source/texk/kpathsea/default.h +++ b/Build/source/texk/kpathsea/default.h @@ -26,7 +26,7 @@ no extra colons, return PATH. Only one extra colon is replaced. DFLT may not be NULL. The result is always in new memory. */ -extern string kpathsea_expand_default (kpathsea kpse, const_string path, +extern string kpathsea_expand_default (kpathsea kpse, const_string path, const_string dflt); #if defined(KPSE_COMPAT_API) diff --git a/Build/source/texk/kpathsea/dir.c b/Build/source/texk/kpathsea/dir.c index 1062f28f63f..9e3e83fabbd 100644 --- a/Build/source/texk/kpathsea/dir.c +++ b/Build/source/texk/kpathsea/dir.c @@ -29,7 +29,7 @@ boolean kpathsea_dir_p (kpathsea kpse, const_string fn) { - /* FIXME : using the stat() replacement in gnuw32, + /* FIXME : using the stat() replacement in gnuw32, we could avoid this win32 specific code. However, I wonder if it would be as fast as this one is ? */ @@ -46,7 +46,7 @@ kpathsea_dir_p (kpathsea kpse, const_string fn) fn, (int)(GetLastError())); } else { fprintf(stderr, "path %s %s a directory\n", - fn , (fa & FILE_ATTRIBUTE_DIRECTORY) ? + fn , (fa & FILE_ATTRIBUTE_DIRECTORY) ? "is" : "is not"); } } @@ -71,7 +71,7 @@ dir_p (const_string fn) Return -1 if FN isn't a directory, else its number of links. Duplicate the call to stat; no need to incur overhead of a function call for that little bit of cleanliness. - + The process is a bit different under Win32 : the first call memoizes the nlinks value, the following ones retrieve it. */ @@ -79,7 +79,7 @@ int kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks) { string *hash_ret; - + if (kpse->link_table.size == 0) kpse->link_table = hash_create (457); @@ -91,7 +91,7 @@ kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks) #endif hash_ret = hash_lookup (kpse->link_table, fn); - + #ifdef KPSE_DEBUG if (KPATHSEA_DEBUG_P (KPSE_DEBUG_HASH)) kpse->debug_hash_lookup_int = false; @@ -105,7 +105,7 @@ kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks) #else nlinks = (long) *hash_ret; #endif - } else { + } else { #ifdef WIN32 /* Insert it only if we have some informations about it. */ if (nlinks) { @@ -132,7 +132,7 @@ kpathsea_dir_links (kpathsea kpse, const_string fn, long nlinks) #endif } - /* In any case, return nlinks + /* In any case, return nlinks (either 0, the value inserted or the value retrieved. */ return nlinks; } diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c index a13965db037..68196d51357 100644 --- a/Build/source/texk/kpathsea/elt-dirs.c +++ b/Build/source/texk/kpathsea/elt-dirs.c @@ -39,7 +39,7 @@ dir_list_add (str_llist_type *l, const_string dir) = IS_DIR_SEP (last_char) || IS_DEVICE_SEP (last_char) ? xstrdup (dir) : concat (dir, DIR_SEP_STRING); - + str_llist_add (l, saved_dir); } @@ -81,13 +81,13 @@ static str_llist_type * cached (kpathsea kpse, const_string key) { unsigned p; - + for (p = 0; p < kpse->cache_length; p++) { if (FILESTRCASEEQ (kpse->the_cache[p].key, key)) return kpse->the_cache[p].value; } - + return NULL; } @@ -121,13 +121,13 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, struct dirent *e; #endif /* not WIN32 */ fn_type name; - + /* Some old compilers don't allow aggregate initialization. */ name = fn_copy0 (elt, elt_length); - + assert (IS_DIR_SEP (elt[elt_length - 1]) || IS_DEVICE_SEP (elt[elt_length - 1])); - + #if defined (WIN32) strcpy(dirname, FN_STRING(name)); strcat(dirname, "/*.*"); /* "*.*" or "*" -- seems equivalent. */ @@ -158,7 +158,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, fn_str_grow (&name, find_file_data.cFileName); /* Maybe we have cached the leafness of this directory. - The function will return 0 if unknown, + The function will return 0 if unknown, else the actual (Unix-like) value. */ links = kpathsea_dir_links (kpse, FN_STRING (name), 0); @@ -169,7 +169,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, /* It's a directory, so append the separator. */ fn_str_grow (&name, DIR_SEP_STRING); - if (*post != 0) { + if (*post != 0) { fn_str_grow (&name, post); /* Unfortunately we can't check if the new element is a leaf directory, because we don't have a directory @@ -185,7 +185,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, not affect the leaf-ness. This is arguably wrong, but the only alternative I know of is to stat every entry in the directory, and that is unacceptably slow. */ - + if (links == 0 || links > 2) /* All criteria are met; find subdirectories. */ do_subdir (kpse, str_list_ptr, FN_STRING (name), @@ -213,7 +213,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, fn_free (&name); return; } - + /* Include top level before subdirectories, if nothing to match. */ if (*post == 0) dir_list_add (str_list_ptr, FN_STRING (name)); @@ -232,22 +232,22 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, if (e->d_name[0] != '.') { int links; - + /* Construct the potential subdirectory name. */ fn_str_grow (&name, e->d_name); - + /* If we can't stat it, or if it isn't a directory, continue. */ links = kpathsea_dir_links (kpse, FN_STRING (name), 0); if (links >= 0) - { + { unsigned potential_len = FN_LENGTH (name); /* It's a directory, so append the separator. */ fn_str_grow (&name, DIR_SEP_STRING); if (*post != 0) - { + { fn_str_grow (&name, post); /* Unfortunately we can't check if the new element is a leaf directory, because we don't have a directory @@ -258,14 +258,14 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, potential_len); fn_shrink_to (&name, potential_len); } - + /* Should we recurse? To see if the subdirectory is a leaf, check if it has two links (one for . and one for ..). This means that symbolic links to directories do not affect the leaf-ness. This is arguably wrong, but the only alternative I know of is to stat every entry in the directory, and that is unacceptably slow. - + The #ifdef here makes all this configurable at compile-time, so that if we're using VMS directories or some such, we can still find subdirectories, even if it @@ -293,7 +293,7 @@ do_subdir (kpathsea kpse, str_llist_type *str_list_ptr, const_string elt, fn_shrink_to (&name, elt_length); } } - + fn_free (&name); xclosedir (dir); #endif /* not WIN32 */ @@ -309,7 +309,7 @@ expand_elt (kpathsea kpse, str_llist_type * str_list_ptr, const_string elt, unsigned start) { const_string dir = elt + start, post; - + while (*dir != 0) { if (IS_DIR_SEP (*dir)) @@ -324,10 +324,10 @@ expand_elt (kpathsea kpse, str_llist_type * str_list_ptr, const_string elt, /* No special stuff at this slash. Keep going. */ } - + dir++; } - + /* When we reach the end of ELT, it will be a normal filename. */ checked_dir_list_add (kpse, str_list_ptr, elt); } @@ -342,7 +342,7 @@ expand_elt (kpathsea kpse, str_llist_type * str_list_ptr, const_string elt, - Always lower-case drive letters a-z, even those filesystem that preserve case in filenames do not care about the case of the drive letters. - - Remove unneeded double slashes. The problem is Windows does not + - Remove unneeded double slashes. The problem is Windows does not handle well filenames like c://dir/foo. So canonicalize the names. The resulting name will always be shorter than the one passed, so no problem. @@ -376,7 +376,7 @@ kpathsea_normalize_path (kpathsea kpse, string elt) for (ret = 0; IS_DIR_SEP(elt[ret]); ++ret) ; } - + #ifdef KPSE_DEBUG if (KPATHSEA_DEBUG_P (KPSE_DEBUG_STAT) && ret != 1) DEBUGF2 ("kpse_normalize_path (%s) => %u\n", elt, ret); @@ -452,12 +452,12 @@ void print_element_dirs (const_string elt) { str_llist_type *dirs; - + printf ("Directories of %s:\t", elt ? elt : "(nil)"); fflush (stdout); - + dirs = kpse_element_dirs (elt); - + if (!dirs) printf ("(nil)"); else @@ -469,7 +469,7 @@ print_element_dirs (const_string elt) printf ("%s ", *d ? d : "`'"); } } - + putchar ('\n'); } @@ -495,8 +495,8 @@ main () print_element_dirs ("/usr/local/lib/tex/fonts//times"); /* just one */ print_element_dirs ("/usr/local/lib/tex/fonts//"); /* lots again [cache] */ print_element_dirs ("~karl"); /* tilde expansion */ - print_element_dirs ("$karl"); /* variable expansion */ - print_element_dirs ("~${LOGNAME}"); /* both */ + print_element_dirs ("$karl"); /* variable expansion */ + print_element_dirs ("~${LOGNAME}"); /* both */ #endif /* not AMIGA */ return 0; } diff --git a/Build/source/texk/kpathsea/expand.c b/Build/source/texk/kpathsea/expand.c index 943043a666c..232a1245a48 100644 --- a/Build/source/texk/kpathsea/expand.c +++ b/Build/source/texk/kpathsea/expand.c @@ -35,13 +35,13 @@ kpathsea_expand (kpathsea kpse, const_string s) { string var_expansion = kpathsea_var_expand (kpse, s); string tilde_expansion = kpathsea_tilde_expand (kpse, var_expansion); - + /* `kpse_var_expand' always gives us new memory; `kpse_tilde_expand' doesn't, necessarily. So be careful that we don't free what we are about to return. */ if (tilde_expansion != var_expansion) free (var_expansion); - + return tilde_expansion; } @@ -67,7 +67,7 @@ kpathsea_expand_kpse_dot (kpathsea kpse, string path) #ifdef MSDOS boolean malloced_kpse_dot = false; #endif - + if (kpse_dot == NULL) return path; ret = (string)xmalloc(1); @@ -87,7 +87,7 @@ kpathsea_expand_kpse_dot (kpathsea kpse, string path) } #endif - for (elt = kpathsea_path_element (kpse, path); elt; + for (elt = kpathsea_path_element (kpse, path); elt; elt = kpathsea_path_element (kpse, NULL)) { string save_ret = ret; boolean ret_copied = true; @@ -177,7 +177,7 @@ kpathsea_brace_expand (kpathsea kpse, const_string path) string ret = (string)xmalloc (1); *ret = 0; - for (elt = kpathsea_path_element (kpse, xpath); elt; + for (elt = kpathsea_path_element (kpse, xpath); elt; elt = kpathsea_path_element (kpse, NULL)) { string save_ret = ret; /* Do brace expansion first, so tilde expansion happens in {~ka,~kb}. */ @@ -222,12 +222,12 @@ kpathsea_path_expand (kpathsea kpse, const_string path) ret = (string)xmalloc (1); *ret = 0; len = 0; - + /* Expand variables and braces first. */ xpath = kpathsea_brace_expand (kpse, path); /* Now expand each of the path elements, printing the results */ - for (elt = kpathsea_path_element (kpse, xpath); elt; + for (elt = kpathsea_path_element (kpse, xpath); elt; elt = kpathsea_path_element (kpse, NULL)) { str_llist_type *dirs; @@ -237,7 +237,7 @@ kpathsea_path_expand (kpathsea kpse, const_string path) /* Search the disk for all dirs in the component specified. Be faster to check the database, but this is more reliable. */ - dirs = kpathsea_element_dirs (kpse, elt); + dirs = kpathsea_element_dirs (kpse, elt); if (dirs && *dirs) { str_llist_elt_type *dir; @@ -294,7 +294,7 @@ static void expand_append (str_list_type* partial, str_list_add(&tmp, new_string); str_list_concat_elements(partial, tmp); } - + static str_list_type diff --git a/Build/source/texk/kpathsea/extend-fname.c b/Build/source/texk/kpathsea/extend-fname.c index 58b77ce4deb..022164c582b 100644 --- a/Build/source/texk/kpathsea/extend-fname.c +++ b/Build/source/texk/kpathsea/extend-fname.c @@ -21,7 +21,7 @@ /* We may or may not return NAME. It's up to the caller not to assume the return value is modifiable. */ -const_string +const_string extend_filename (const_string name, const_string default_suffix) { const_string new_s; diff --git a/Build/source/texk/kpathsea/find-suffix.c b/Build/source/texk/kpathsea/find-suffix.c index 499f8189feb..6fbb1f28c6b 100644 --- a/Build/source/texk/kpathsea/find-suffix.c +++ b/Build/source/texk/kpathsea/find-suffix.c @@ -28,15 +28,15 @@ find_suffix (const_string name) { const_string slash_pos; string dot_pos = strrchr (name, '.'); - + if (dot_pos == NULL) return NULL; - + for (slash_pos = name + strlen (name); slash_pos > dot_pos && !IS_DIR_SEP (*slash_pos); slash_pos--) ; - + return slash_pos > dot_pos ? NULL : dot_pos + 1; } diff --git a/Build/source/texk/kpathsea/fn.c b/Build/source/texk/kpathsea/fn.c index 3bfb468cb40..3464ced7722 100644 --- a/Build/source/texk/kpathsea/fn.c +++ b/Build/source/texk/kpathsea/fn.c @@ -30,10 +30,10 @@ fn_type fn_init (void) { fn_type ret; - + FN_ALLOCATED (ret) = FN_LENGTH (ret) = 0; FN_STRING (ret) = NULL; - + return ret; } @@ -42,14 +42,14 @@ fn_type fn_copy0 (const_string s, unsigned len) { fn_type ret; - + FN_ALLOCATED (ret) = CHUNK_SIZE > len ? CHUNK_SIZE : len + 1; FN_STRING (ret) = (string)xmalloc (FN_ALLOCATED (ret)); - + strncpy (FN_STRING (ret), s, len); FN_STRING (ret)[len] = 0; FN_LENGTH (ret) = len + 1; - + return ret; } diff --git a/Build/source/texk/kpathsea/fontmap.c b/Build/source/texk/kpathsea/fontmap.c index 1eeecde7d9c..2ed383d519e 100644 --- a/Build/source/texk/kpathsea/fontmap.c +++ b/Build/source/texk/kpathsea/fontmap.c @@ -47,19 +47,19 @@ token (const_string str) unsigned len; const_string start; string ret; - + while (*str && ISSPACE (*str)) str++; - + start = str; while (*str && !ISSPACE (*str)) str++; - + len = str - start; ret = (string)xmalloc (len + 1); strncpy (ret, start, len); ret[len] = 0; - + return ret; } @@ -89,7 +89,7 @@ map_file_parse (kpathsea kpse, const_string map_filename) if (!comment_loc) { comment_loc = strstr (l, "@c"); } - + /* Ignore anything after a % or @c. */ if (comment_loc) *comment_loc = 0; @@ -100,7 +100,7 @@ map_file_parse (kpathsea kpse, const_string map_filename) strtok since this routine is recursive. */ while (*l && ISSPACE (*l)) l++; - + /* If we don't have any filename, that's ok, the line is blank. */ filename = token (l); if (filename) { @@ -111,7 +111,7 @@ map_file_parse (kpathsea kpse, const_string map_filename) WARNING2 ("%s:%u: Filename argument for include directive missing", map_filename, map_lineno); } else { - string include_fname = kpathsea_path_search (kpse, + string include_fname = kpathsea_path_search (kpse, kpse->map_path, alias, false); if (include_fname) { map_file_parse (kpse, include_fname); @@ -141,7 +141,7 @@ map_file_parse (kpathsea kpse, const_string map_filename) free (orig_l); } - + xfclose (f, map_filename); } @@ -153,10 +153,10 @@ static void read_all_maps (kpathsea kpse) { string *filenames; - + kpse->map_path = kpathsea_init_format (kpse, kpse_fontmap_format); filenames = kpathsea_all_path_search (kpse, kpse->map_path, MAP_NAME); - + kpse->map = hash_create (MAP_HASH_SIZE); while (*filenames) { @@ -173,7 +173,7 @@ kpathsea_fontmap_lookup (kpathsea kpse, const_string key) { const_string *ret; string suffix = find_suffix (key); - + if (kpse->map.size == 0) { read_all_maps (kpse); } diff --git a/Build/source/texk/kpathsea/getopt.c b/Build/source/texk/kpathsea/getopt.c index 9fb7116c60e..3550e933848 100644 --- a/Build/source/texk/kpathsea/getopt.c +++ b/Build/source/texk/kpathsea/getopt.c @@ -8,7 +8,7 @@ Its master source is NOT part of the C library, however. The master source lives in libc. This version has been modified for use with libkpathsea. - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either diff --git a/Build/source/texk/kpathsea/kpathsea.c b/Build/source/texk/kpathsea/kpathsea.c index 86a4d053b63..7e1d3dbd5c0 100644 --- a/Build/source/texk/kpathsea/kpathsea.c +++ b/Build/source/texk/kpathsea/kpathsea.c @@ -27,7 +27,7 @@ #include <kpathsea/config.h> kpathsea -kpathsea_new (void) +kpathsea_new (void) { kpathsea ret; ret = xcalloc(1, sizeof(kpathsea_instance)); @@ -51,7 +51,7 @@ str_llist_free (str_llist_type p) } static void -cache_free (cache_entry *the_cache, int cache_size) +cache_free (cache_entry *the_cache, int cache_size) { int f ; for (f=0;f<cache_size;f++) { @@ -62,7 +62,7 @@ cache_free (cache_entry *the_cache, int cache_size) } #endif /* KPATHSEA_CAN_FREE */ -/* Sadly, quite a lot of the freeing is not safe: +/* Sadly, quite a lot of the freeing is not safe: it seems there are literals used all over. */ void kpathsea_finish (kpathsea kpse) @@ -78,7 +78,7 @@ kpathsea_finish (kpathsea kpse) hash_free (kpse->cnf_hash); hash_free (kpse->db); hash_free (kpse->alias_db); - str_list_free(&kpse->db_dir_list); + str_list_free(&kpse->db_dir_list); hash_free (kpse->link_table); cache_free (kpse->the_cache, kpse->cache_length); hash_free (kpse->map); @@ -113,7 +113,7 @@ kpathsea_finish (kpathsea kpse) for (i = 0; i != kpse->saved_count; ++i) string_free (kpse->saved_env[i]); free (kpse->saved_env); - } + } #if defined(WIN32) || defined(__MINGW32__) || defined(__CYGWIN__) if (kpse->suffixlist != NULL) { char **p; diff --git a/Build/source/texk/kpathsea/kpsestat.c b/Build/source/texk/kpathsea/kpsestat.c index 04a0d9835a5..49d884333df 100644 --- a/Build/source/texk/kpathsea/kpsestat.c +++ b/Build/source/texk/kpathsea/kpsestat.c @@ -114,7 +114,7 @@ Try `%s --help' for more information.\n", argv[0], argv[0]); perror(argv[2]); return 1; } - + result = f.st_mode & 07777; result |= to_set; result |= to_keep & result; diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c index ad6a340551e..ee3d1904361 100644 --- a/Build/source/texk/kpathsea/kpsewhich.c +++ b/Build/source/texk/kpathsea/kpsewhich.c @@ -108,7 +108,7 @@ format_abbr (const_string str) { kpse_file_format_type ret = kpse_last_format; unsigned a = 0; - + while (format_abbrs[a].abbr != NULL) { if (STREQ (str, format_abbrs[a].abbr)) { ret = format_abbrs[a].format; @@ -116,7 +116,7 @@ format_abbr (const_string str) } a++; } - + return ret; } @@ -130,7 +130,7 @@ find_dpi (string s) { unsigned dpi_number = 0; string extension = find_suffix (s); - + if (extension != NULL) sscanf (extension, "%u", &dpi_number); @@ -152,10 +152,10 @@ static kpse_file_format_type find_format (kpathsea kpse, string name, boolean is_filename) { kpse_file_format_type ret = kpse_last_format; - + if (is_filename && user_format != kpse_last_format) { ret = user_format; /* just return what we already computed */ - + } else if (FILESTRCASEEQ (name, "config.ps")) { ret = kpse_dvips_config_format; } else if (FILESTRCASEEQ (name, "fmtutil.cnf")) { @@ -181,7 +181,7 @@ find_format (kpathsea kpse, string name, boolean is_filename) /* Look for kpsewhich-specific format abbreviations. */ ret = format_abbr (name); } - + if (ret == kpse_last_format) { int f = 0; /* kpse_file_format_type */ unsigned name_len = strlen (name); @@ -210,7 +210,7 @@ find_format (kpathsea kpse, string name, boolean is_filename) } for (ext = kpse->format_info[f].suffix; !found && ext && *ext; ext++) { found = TRY_SUFFIX (*ext); - } + } for (ext=kpse->format_info[f].alt_suffix; !found && ext && *ext;ext++){ found = TRY_SUFFIX (*ext); } @@ -232,7 +232,7 @@ find_format (kpathsea kpse, string name, boolean is_filename) is, for a string S in MATCHES, its dirname must end with one of the elements in SUBDIRS. For instance, if subdir=foo/bar, that will match a string foo/bar/baz or /some/texmf/foo/bar/baz. - + We don't reallocate the actual strings, just the list elements. Perhaps later we will implement wildcards or // or something. */ @@ -242,7 +242,7 @@ subdir_match (str_list_type subdirs, string *matches) string *ret = XTALLOC1 (string); unsigned len = 1; unsigned m; - + for (m = 0; matches[m]; m++) { unsigned loc; unsigned e; @@ -253,7 +253,7 @@ subdir_match (str_list_type subdirs, string *matches) loc--; } s[loc] = 0; /* wipe out basename */ - + for (e = 0; e < STR_LIST_LENGTH (subdirs); e++) { string subdir = STR_LIST_ELT (subdirs, e); unsigned subdir_len = strlen (subdir); @@ -284,7 +284,7 @@ lookup (kpathsea kpse, string name) int i; string ret = NULL; string *ret_list = NULL; - + if (user_path) { /* Translate ; to : if that's our ENV_SEP. See cnf.c. */ if (IS_ENV_SEP (':')) { @@ -300,7 +300,7 @@ lookup (kpathsea kpse, string name) } else { ret = kpathsea_path_search (kpse, user_path, name, must_exist); } - + } else { /* No user-specified search path, check user format or guess from NAME. */ kpse_file_format_type fmt = find_format (kpse, name, true); @@ -334,7 +334,7 @@ lookup (kpathsea kpse, string name) } } } - + /* Turn single return into a null-terminated list for uniform treatment. */ if (ret) { ret_list = XTALLOC (2, string); @@ -357,7 +357,7 @@ lookup (kpathsea kpse, string name) ret = ret_list[0]; free (ret_list); } - + return ret == NULL; } @@ -413,11 +413,11 @@ help_message (kpathsea kpse, string *argv) const_string *ext; kpathsea_init_format (kpse, (kpse_file_format_type)f); printf ("%s", kpse->format_info[f].type); - + /* Show abbreviation if we accept one. We repeatedly go through the abbr list here, but it's so short, it doesn't matter. */ { - unsigned a = 0; + unsigned a = 0; while (format_abbrs[a].abbr != NULL) { if (f == format_abbrs[a].format) { printf (" (%s)", format_abbrs[a].abbr); @@ -426,14 +426,14 @@ help_message (kpathsea kpse, string *argv) a++; } } - + /* Regular suffixes. */ putchar (':'); for (ext = kpse->format_info[f].suffix; ext && *ext; ext++) { putchar (' '); fputs (*ext, stdout); } - + if (kpse->format_info[f].alt_suffix) { /* leave extra space between default and alt suffixes */ putchar (' '); @@ -442,10 +442,10 @@ help_message (kpathsea kpse, string *argv) putchar (' '); fputs (*ext, stdout); } - + putchar ('\n'); } - + exit (0); } @@ -509,10 +509,10 @@ read_command_line (kpathsea kpse, int argc, string *argv) } else if (ARGUMENT_IS ("engine")) { engine = optarg; - + } else if (ARGUMENT_IS ("expand-braces")) { braces_to_expand = optarg; - + } else if (ARGUMENT_IS ("expand-path")) { path_to_expand = optarg; @@ -569,7 +569,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"); /* Else it was just a flag; getopt has already done the assignment. */ } - + if (user_path && user_format_string) { fprintf (stderr, "-path (%s) and -format (%s) are mutually exclusive.\n", user_path, user_format_string); @@ -596,7 +596,7 @@ init_more (kpathsea kpse) { if (engine) kpathsea_xputenv (kpse, "engine", engine); - + /* Disable all mktex programs unless they were explicitly enabled on our command line. */ #define DISABLE_MKTEX(fmt) \ @@ -611,9 +611,9 @@ kpathsea_set_program_enabled (kpse, fmt, false, kpse_src_cmdline - 1) /* NULL for no fallback font. */ kpathsea_init_prog (kpse, uppercasify (kpse->program_name), dpi, mode, NULL); - + /* Have to do this after setting the program name. */ - if (user_format_string) { + if (user_format_string) { user_format = find_format (kpse, user_format_string, false); if (user_format == kpse_last_format) { WARNING1 ("kpsewhich: Ignoring unknown file type `%s'", @@ -629,16 +629,16 @@ main (int argc, string *argv) { unsigned unfound = 0; kpathsea kpse = kpathsea_new(); - + /* Read options, then dependent initializations. */ read_command_line (kpse, argc, argv); kpathsea_set_program_name (kpse, argv[0], progname); init_more (kpse); - + /* Perform actions. */ - + /* Variable expansion. */ if (var_to_expand) puts (kpathsea_var_expand (kpse, var_to_expand)); @@ -646,7 +646,7 @@ main (int argc, string *argv) /* Brace expansion. */ if (braces_to_expand) puts (kpathsea_brace_expand (kpse, braces_to_expand)); - + /* Path expansion. */ if (path_to_expand) puts (kpathsea_path_expand (kpse, path_to_expand)); @@ -671,23 +671,23 @@ main (int argc, string *argv) } puts (value); } - + if (safe_in_name) { if (!kpathsea_in_name_ok_silent (kpse, safe_in_name)) unfound++; } - + if (safe_out_name) { if (!kpathsea_out_name_ok_silent (kpse, safe_out_name)) unfound++; } - + /* --subdir must imply --all, since we filter here after doing the search, rather than inside the search itself. */ if (STR_LIST_LENGTH (subdir_paths) > 0) { show_all = 1; } - + /* Usual case: look up each given filename. */ for (; optind < argc; optind++) { unfound += lookup (kpse, argv[optind]); diff --git a/Build/source/texk/kpathsea/lib.h b/Build/source/texk/kpathsea/lib.h index 3dd1daffe70..25abea3e41e 100644 --- a/Build/source/texk/kpathsea/lib.h +++ b/Build/source/texk/kpathsea/lib.h @@ -49,7 +49,7 @@ #else #define START_FATAL() do { \ fprintf (stderr, "fatal: "); -#endif +#endif #define END_FATAL() fputs (".\n", stderr); exit (1); } while (0) @@ -96,7 +96,7 @@ /* I find this easier to read. */ #define STREQ(s1, s2) ((s1) && (s2) && (strcmp (s1, s2) == 0)) #define STRNEQ(s1, s2, n) ((s1) && (s2) && (strncmp (s1, s2, n) == 0)) - + /* Support for FAT/ISO-9660 filesystems. Theoretically this should be done at runtime, per filesystem, but that's painful to program. */ #ifdef MONOCASE_FILENAMES @@ -174,9 +174,9 @@ extern KPSEDLL const_string extend_filename (const_string name, /* Call putenv with the string `VAR=VALUE' and abort on error. */ extern KPSEDLL void kpathsea_xputenv (kpathsea kpse, const_string var, - const_string value); + const_string value); extern KPSEDLL void kpathsea_xputenv_int (kpathsea kpse, const_string var, - int value); + int value); #if defined (KPSE_COMPAT_API) extern KPSEDLL void xputenv (const_string var, const_string value); extern KPSEDLL void xputenv_int (const_string var, int value); @@ -197,7 +197,7 @@ extern KPSEDLL boolean dir_p (const_string fn); extern KPSEDLL int dir_links (const_string fn, long nlinks); #endif extern KPSEDLL int kpathsea_dir_links (kpathsea kpse, const_string fn, - long nlinks); + long nlinks); /* Like their stdio counterparts, but abort on error, after calling perror(3) with FILENAME as its argument. */ diff --git a/Build/source/texk/kpathsea/line.c b/Build/source/texk/kpathsea/line.c index 04d193a8d91..b1edb16f02d 100644 --- a/Build/source/texk/kpathsea/line.c +++ b/Build/source/texk/kpathsea/line.c @@ -29,11 +29,11 @@ read_line (FILE*f) unsigned limit = BLOCK_SIZE; unsigned loc = 0; char *line = (char*)xmalloc(limit); - + while ((c = getc (f)) != EOF && c != '\n' && c != '\r') { line[loc] = c; loc++; - + /* By testing after the assignment, we guarantee that we'll always have space for the null we append below. We know we always have room for the first char, since we start with BLOCK_SIZE. */ @@ -42,7 +42,7 @@ read_line (FILE*f) line = (char*)xrealloc(line, limit); } } - + /* If we read anything, return it. This can't represent a last ``line'' which doesn't end in a newline, but so what. */ if (c != EOF) { @@ -59,7 +59,7 @@ read_line (FILE*f) free(line); line = NULL; } - + return line; } diff --git a/Build/source/texk/kpathsea/magstep.c b/Build/source/texk/kpathsea/magstep.c index 4ce398b10e5..3f467148a2c 100644 --- a/Build/source/texk/kpathsea/magstep.c +++ b/Build/source/texk/kpathsea/magstep.c @@ -66,7 +66,7 @@ magstep (int n, int bdpi) part of Kpathsea now so all the drivers can use it. The idea is to return the true dpi corresponding to DPI with a base resolution of BDPI. If M_RET is non-null, we also set that to the mag value. */ - + /* Don't bother trying to use fabs or some other ``standard'' routine which can only cause trouble; just roll our own simple-minded absolute-value function that is all we need. */ @@ -83,7 +83,7 @@ kpathsea_magstep_fix (kpathsea kpse, unsigned dpi, unsigned bdpi, int *m_ret) unsigned real_dpi = 0; int sign = dpi < bdpi ? -1 : 1; /* negative or positive magsteps? */ (void)kpse; /* currenty not used */ - + for (m = 0; !real_dpi && m < MAGSTEP_MAX; m++) /* don't go forever */ { mdpi = magstep (m * sign, bdpi); @@ -92,7 +92,7 @@ kpathsea_magstep_fix (kpathsea kpse, unsigned dpi, unsigned bdpi, int *m_ret) else if ((mdpi - (int) dpi) * sign > 0) /* if gone too far, quit */ real_dpi = dpi; } - + /* If requested, return the encoded magstep (the loop went one too far). */ /* More unnecessary casts. */ if (m_ret) diff --git a/Build/source/texk/kpathsea/magstep.h b/Build/source/texk/kpathsea/magstep.h index 42f02aa96af..d7ccc70e3bf 100644 --- a/Build/source/texk/kpathsea/magstep.h +++ b/Build/source/texk/kpathsea/magstep.h @@ -25,27 +25,27 @@ /* If DPI is close enough to some magstep of BDPI, return the true dpi value, and the magstep found (or zero) in M_RET (if non-null). ``Close enough'' means within one pixel. - + M_RET is slightly encoded: the least significant bit is on for a half-magstep, off otherwise. Thus, a returned M_RET of 1 means \magstephalf, i.e., sqrt(1.2), i.e., 1.09544. Put another way, return twice the number of magsteps. - + In practice, this matters for magstephalf. Floating-point computation with the fixed-point DVI representation leads to 328 (for BDPI == 300); specifying `at 11pt' yields 330; the true \magstephalf is 329 (that's what you get if you run Metafont with mag:=magstep(.5)). - + The time to call this is after you read the font spec from the DVI file, but before you look up any files -- do the usual floating-point computations, and then fix up the result. */ -extern KPSEDLL unsigned kpathsea_magstep_fix (kpathsea kpse, unsigned dpi, +extern KPSEDLL unsigned kpathsea_magstep_fix (kpathsea kpse, unsigned dpi, unsigned bdpi, int *m_ret); #if defined (KPSE_COMPAT_API) extern KPSEDLL unsigned kpse_magstep_fix (unsigned dpi, unsigned bdpi, - int *m_ret); + int *m_ret); #endif #endif /* not KPATHSEA_MAGSTEP_H */ diff --git a/Build/source/texk/kpathsea/make-suffix.c b/Build/source/texk/kpathsea/make-suffix.c index 8962d7cc2ee..c578ab2b7a6 100644 --- a/Build/source/texk/kpathsea/make-suffix.c +++ b/Build/source/texk/kpathsea/make-suffix.c @@ -20,7 +20,7 @@ #include <kpathsea/c-pathch.h> /* Return a new string: S suffixed with SUFFIX, regardless of what it - was before. This returns a newly allocated string. */ + was before. This returns a newly allocated string. */ string make_suffix (const_string s, const_string suffix) @@ -28,7 +28,7 @@ make_suffix (const_string s, const_string suffix) string new_s; const_string dot_pos = strrchr (s, '.'); const_string slash_pos; - + for (slash_pos = s + strlen (s) - 1; slash_pos > dot_pos && slash_pos > s; slash_pos--) { if (IS_DIR_SEP (*slash_pos)) @@ -40,7 +40,7 @@ make_suffix (const_string s, const_string suffix) else { unsigned past_dot_index = dot_pos + 1 - s; - + new_s = (string)xmalloc (past_dot_index + strlen (suffix) + 1); strncpy (new_s, s, dot_pos + 1 - s); strcpy (new_s + past_dot_index, suffix); diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c index 7d953de0f7a..4f86e151290 100644 --- a/Build/source/texk/kpathsea/mingw32.c +++ b/Build/source/texk/kpathsea/mingw32.c @@ -13,13 +13,13 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with this library; if not, see <http://www.gnu.org/licenses/>. + along with this library; if not, see <http://www.gnu.org/licenses/>. */ /* Original sources lifted from the distribution of XEmacs for Windows NT, - Copyright 1994-1996 Free Software Foundation, later adapted to + Copyright 1994-1996 Free Software Foundation, later adapted to fpTeX 0.4 (2000) by Fabrice Popineau <Fabrice.Popineau@supelec.fr>, - then simplified and re-adapted to TeXLive (2009) by Taco Hoekwater + then simplified and re-adapted to TeXLive (2009) by Taco Hoekwater <taco@luatex.org>. */ @@ -60,9 +60,9 @@ init_user_info (void) putenv ((GetVersion () & 0x80000000) ? "SHELL=command" : "SHELL=cmd"); { - /* Win2K problem : we need a specific TEMP directory with + /* Win2K problem : we need a specific TEMP directory with full access rights so that any user building a format file - or a font file will build it with full access rights. The installer + or a font file will build it with full access rights. The installer takes care of defining TEXMFTEMP=$SELFAUTOPARENT/tmp in the environment. If it is defined, then use it as the TEMP and TMP variables. */ @@ -92,7 +92,7 @@ get_home_directory (void) goto done; } } - + { char *homedrive, *homepath; if ((homedrive = getenv("HOMEDRIVE")) != NULL && @@ -101,7 +101,7 @@ get_home_directory (void) goto done; } } - + /* This method is the prefered one because even if it requires a more recent shell32.dll, it does not need to call SHMalloc()->Free() */ { @@ -175,10 +175,10 @@ normalize_filename (char *fp, char path_sep) /* Remove unneeded double slashes */ ret = (IS_UNC_NAME(fp) ? 2 : - NAME_BEGINS_WITH_DEVICE(fp) ? + NAME_BEGINS_WITH_DEVICE(fp) ? (IS_DIR_SEP(*(fp+2)) ? 3 : 2) : IS_DIR_SEP(*fp) ? 1 : 0); - for (i = ret, p = fp+i; - IS_DIR_SEP(*p); + for (i = ret, p = fp+i; + IS_DIR_SEP(*p); i++, p++); if (i > ret) { int len = strlen(fp+i); @@ -199,7 +199,7 @@ normalize_filename (char *fp, char path_sep) #if 0 fprintf(stderr, "normalize_filename returned (%d) %s\n", ret, fp); -#endif +#endif return ret; } @@ -303,7 +303,7 @@ get_long_basename (char * name, char * buf, int size) #ifdef PIGSFLY char *p; - /* If the last component of NAME has a wildcard character, + /* If the last component of NAME has a wildcard character, return it as the basename. */ p = name + strlen (name); while (*p != '\\' && *p != ':' && p > name) p--; @@ -392,11 +392,11 @@ win32_get_long_filename (char * name, char * buf, int size) /* This part looks for the real location of the program invoked - by cmd. If it can find the program, that's good. Else + by cmd. If it can find the program, that's good. Else command processor is invoked. */ -BOOL +BOOL look_for_cmd(const char *cmd, char **app) { char *env_path; @@ -564,7 +564,7 @@ get_sym (char *s, char **beg, char **end) s++; *beg = s; - + do { *end = s + 1; @@ -739,7 +739,7 @@ parse_cmdline(char *line, char **input, char **output) narg++; cmd[ncmd] = xrealloc(cmd[ncmd], narg * sizeof(char *)); cmd[ncmd][narg - 1] = NULL; - ncmd++; + ncmd++; needcmd = TRUE; beg = end; again = TRUE; @@ -759,7 +759,7 @@ parse_cmdline(char *line, char **input, char **output) cmd[ncmd] = NULL; again = FALSE; break; - + case UNMATCHED_QUOTE: fprintf(stderr, "Unmatched quote character."); errno = EINVAL; @@ -781,7 +781,7 @@ parse_cmdline(char *line, char **input, char **output) char **p; /* Need to free everything that was allocated */ for (i = 0; i < ncmd; i++) { - for (p = cmd[i]; *p; p++) + for (p = cmd[i]; *p; p++) free(*p); free(cmd[i]); } @@ -797,7 +797,7 @@ parse_cmdline(char *line, char **input, char **output) } static char * -quote_elt(char *elt) +quote_elt(char *elt) { char *p; for (p = elt; *p; p++) @@ -979,10 +979,10 @@ win32_system(const char *cmd, int async) fprintf(stderr, "win32_system(%s) call failed (Error %d).\n", cmd, (int)GetLastError()); return -1; } - + /* Only the process handle is needed */ CloseHandle(pi.hThread); - + if (async == 0) { if (WaitForSingleObject(pi.hProcess, INFINITE) == WAIT_OBJECT_0) { if (GetExitCodeProcess(pi.hProcess, &ret) == 0) { @@ -1004,7 +1004,7 @@ win32_system(const char *cmd, int async) if (new_cmd) free(new_cmd); if (app_name) free(app_name); - + return ret; } diff --git a/Build/source/texk/kpathsea/mingw32.h b/Build/source/texk/kpathsea/mingw32.h index c17927b1244..938c519ee0f 100644 --- a/Build/source/texk/kpathsea/mingw32.h +++ b/Build/source/texk/kpathsea/mingw32.h @@ -3,7 +3,7 @@ #include <stdlib.h> /* The embedded rndnpc.h defines boolean as 'unsigned char', - and we do not want that. + and we do not want that. This should be safe as long as we don't use npc ourselves. */ #define boolean saved_boolean #include <windows.h> diff --git a/Build/source/texk/kpathsea/path-elt.c b/Build/source/texk/kpathsea/path-elt.c index 3cc3a1d1cff..eb45d38da02 100644 --- a/Build/source/texk/kpathsea/path-elt.c +++ b/Build/source/texk/kpathsea/path-elt.c @@ -37,18 +37,18 @@ element (kpathsea kpse, const_string passed_path, boolean env_p) string ret; int brace_level; unsigned len; - + if (passed_path) kpse->path = passed_path; /* Check if called with NULL, and no previous path (perhaps we reached the end). */ else if (!kpse->path) return NULL; - + /* OK, we have a non-null `path' if we get here. */ assert (kpse->path); p = kpse->path; - + /* Find the next colon not enclosed by braces (or the end of the path). */ brace_level = 0; while (*p != 0 && !(brace_level == 0 @@ -57,7 +57,7 @@ element (kpathsea kpse, const_string passed_path, boolean env_p) else if (*p == '}') --brace_level; ++p; } - + /* Return the substring starting at `path'. */ len = p - kpse->path; @@ -109,13 +109,13 @@ print_path_elements (const_string path) { string elt; printf ("Elements of `%s':", path ? path : "(null)"); - + for (elt = kpse_path_element (path); elt != NULL; elt = kpse_path_element (NULL)) { printf (" %s", *elt ? elt : "`'"); } - + puts ("."); } @@ -128,10 +128,10 @@ main () print_path_elements ("a"); /* a */ print_path_elements (ENV_SEP_STRING); /* "", "" */ print_path_elements (ENV_SEP_STRING ENV_SEP_STRING); /* "", "", "" */ - print_path_elements ("a" ENV_SEP_STRING); /* a, "" */ - print_path_elements (ENV_SEP_STRING "b"); /* "", b */ - print_path_elements ("a" ENV_SEP_STRING "b"); /* a, b */ - + print_path_elements ("a" ENV_SEP_STRING); /* a, "" */ + print_path_elements (ENV_SEP_STRING "b"); /* "", b */ + print_path_elements ("a" ENV_SEP_STRING "b"); /* a, b */ + return 0; } diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c index 8d376ab85ab..6a95bf492de 100644 --- a/Build/source/texk/kpathsea/pathsearch.c +++ b/Build/source/texk/kpathsea/pathsearch.c @@ -50,7 +50,7 @@ static void log_search (kpathsea kpse, str_list_type filenames) { - + if (kpse->log_opened == false) { /* Get name from either envvar or config file. */ string log_name = kpathsea_var_value (kpse, "TEXMFLOG"); @@ -116,28 +116,28 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, string potential = (string)xmalloc (allocated); ret = str_list_init (); - + for (elt = *dirs; elt; elt = STR_LLIST_NEXT (*elt)) { const_string dir = STR_LLIST (*elt); unsigned dir_len = strlen (dir); - + while (dir_len + name_len + 1 > allocated) { allocated += allocated; XRETALLOC (potential, allocated, char); } - + strcpy (potential, dir); strcat (potential, name); - + if (kpathsea_readable_file (kpse, potential)) - { + { str_list_add (&ret, potential); - + /* Move this element towards the top of the list. */ str_llist_float (dirs, elt); - + /* If caller only wanted one file returned, no need to terminate the list with NULL; the caller knows to only look at the first element. */ @@ -149,11 +149,11 @@ dir_list_search (kpathsea kpse, str_llist_type *dirs, const_string name, potential = (string)xmalloc (allocated); } } - + /* If we get here, either we didn't find any files, or we were finding all the files. But we're done with the last filename, anyway. */ free (potential); - + return ret; } @@ -172,7 +172,7 @@ dir_list_search_list (kpathsea kpse, str_llist_type *dirs, const_string* names, const_string dir = STR_LLIST (*elt); unsigned dir_len = strlen (dir); int i; - + for (i = 0; names[i]; i++) { const_string name = names[i]; unsigned name_len; @@ -180,7 +180,7 @@ dir_list_search_list (kpathsea kpse, str_llist_type *dirs, const_string* names, /* Don't bother with absolute & explicit relative. */ if (kpathsea_absolute_p(kpse, name, true)) continue; - + name_len = strlen(name); while (dir_len + name_len + 1 > allocated) { @@ -213,7 +213,7 @@ dir_list_search_list (kpathsea kpse, str_llist_type *dirs, const_string* names, /* If we get here, either we didn't find any files, or we were finding all the files. But we're done with the last filename, anyway. */ free (potential); - + return ret; } @@ -225,7 +225,7 @@ absolute_search (kpathsea kpse, string name) { str_list_type ret_list; string found = kpathsea_readable_file (kpse, name); - + /* Some old compilers can't initialize structs. */ ret_list = str_list_init (); @@ -236,7 +236,7 @@ absolute_search (kpathsea kpse, string name) /* Add `found' to the return list even if it's null; that tells the caller we didn't find anything. */ str_list_add (&ret_list, found); - + return ret_list; } @@ -266,7 +266,7 @@ path_search (kpathsea kpse, const_string path, string name, /* See elt-dirs.c for side effects of this function */ kpathsea_normalize_path(kpse, elt); - + /* Try ls-R, unless we're searching for texmf.cnf. Our caller (search), also tests first_search, and does the resetting. */ found = kpse->followup_search ? kpathsea_db_search (kpse, name, elt, all) @@ -274,7 +274,7 @@ path_search (kpathsea kpse, const_string path, string name, /* Search the filesystem if (1) the path spec allows it, and either (2a) we are searching for texmf.cnf ; or - (2b) no db exists; or + (2b) no db exists; or (2c) no db's are relevant to this elt; or (3) MUST_EXIST && NAME was not in the db. In (2*), `found' will be NULL. @@ -287,7 +287,7 @@ path_search (kpathsea kpse, const_string path, string name, *found = dir_list_search (kpse, dirs, name, all); } } - + /* Did we find anything anywhere? */ if (found && STR_LIST (*found)) { if (all) @@ -308,14 +308,14 @@ path_search (kpathsea kpse, const_string path, string name, /* Free the expanded name we were passed. It can't be in the return list, since the path directories got unconditionally prepended. */ free (name); - + return ret_list; -} +} /* Search PATH for ORIGINAL_NAME. If ALL is false, or ORIGINAL_NAME is absolute_p, check ORIGINAL_NAME itself. Otherwise, look at each element of PATH for the first readable ORIGINAL_NAME. - + Always return a list; if no files are found, the list will contain just NULL. If ALL is true, the list will be terminated with NULL. */ @@ -353,11 +353,11 @@ search (kpathsea kpse, const_string path, const_string original_name, /* Make a leading ~ count as an absolute filename, and expand $FOO's. */ name = kpathsea_expand (kpse, original_name); - + /* If the first name is absolute or explicitly relative, no need to 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", @@ -367,7 +367,7 @@ search (kpathsea kpse, const_string path, const_string original_name, /* Find the file(s). */ ret_list = absolute_p ? absolute_search (kpse, name) : path_search (kpse, path, name, must_exist, all); - + /* Append NULL terminator if we didn't find anything at all, or we're supposed to find ALL and the list doesn't end in NULL now. */ if (STR_LIST_LENGTH (ret_list) == 0 @@ -390,7 +390,7 @@ search (kpathsea kpse, const_string path, const_string original_name, if (KPATHSEA_DEBUG_P (KPSE_DEBUG_SEARCH)) putc ('\n', stderr); #endif /* KPSE_DEBUG */ - } + } #ifdef __DJGPP__ /* Undo any side effects. */ @@ -451,7 +451,7 @@ search_list (kpathsea kpse, const_string path, const_string* names, must_exist, all, path); } #endif /* KPSE_DEBUG */ - + /* FIXME: is this really true? No need to do any expansion on names. */ /* First catch any absolute or explicit relative names. */ @@ -493,7 +493,7 @@ search_list (kpathsea kpse, const_string path, const_string* names, /* Search the filesystem if (1) the path spec allows it, and either (2a) we are searching for texmf.cnf ; or - (2b) no db exists; or + (2b) no db exists; or (2c) no db's are relevant to this elt; or (3) MUST_EXIST && NAME was not in the db. In (2*), `found' will be NULL. @@ -522,7 +522,7 @@ search_list (kpathsea kpse, const_string path, const_string* names, /* Uniqify, since our paths can often end up finding the same file more than once. */ str_list_uniqify (&ret_list); - + /* Add NULL if we will be returning multiple elements. */ if (STR_LIST_LENGTH (ret_list) == 0 || (all && STR_LIST_LAST_ELT (ret_list) != NULL)) @@ -554,7 +554,7 @@ search_list (kpathsea kpse, const_string path, const_string* names, /* Undo any side effects. */ _djstat_flags = save_djgpp_flags; #endif - + return STR_LIST (ret_list); } @@ -577,7 +577,7 @@ kpathsea_path_search_list (kpathsea kpse, const_string path, const_string* names, boolean must_exist) { string *ret_list = kpathsea_path_search_list_generic (kpse, path, names, - must_exist, false); + must_exist, false); string ret = *ret_list; free (ret_list); return ret; @@ -597,19 +597,19 @@ kpathsea_all_path_search (kpathsea kpse, const_string path, const_string name) /* Many inputs, return list, allow specifying MUST_EXIST and ALL. */ string * -kpathsea_path_search_list_generic (kpathsea kpse, +kpathsea_path_search_list_generic (kpathsea kpse, const_string path, const_string* names, boolean must_exist, boolean all) { string *ret = search_list (kpse, path, names, must_exist, all); return ret; -} +} /* Many inputs, return list, MUST_EXIST and ALL always true. */ string * -kpathsea_all_path_search_list (kpathsea kpse, const_string path, +kpathsea_all_path_search_list (kpathsea kpse, const_string path, const_string* names) { return kpathsea_path_search_list_generic (kpse, path, names, true, true); @@ -642,7 +642,7 @@ kpse_path_search_list_generic (const_string path, const_string* names, { return kpathsea_path_search_list_generic (kpse_def, path, names, must_exist, all); -} +} string * kpse_all_path_search_list (const_string path, const_string* names) @@ -660,7 +660,7 @@ test_path_search (const_string path, const_string file) { string answer; string *answer_list; - + printf ("\nSearch %s for %s:\t", path, file); answer = kpse_path_search (path, file, 0); puts (answer ? answer : "(nil)"); @@ -693,18 +693,18 @@ main (int argc, char **argv) ENV_SEP_STRING ENV_SEP_STRING, "ptmr.vf"); test_path_search (TEXFONTS "/adobe//" ENV_SEP_STRING "/usr/local/src/TeX+MF/typefaces//", "plcr.pfa"); - + test_path_search ("~karl", ".bashrc"); test_path_search ("/k", "~karl/.bashrc"); xputenv ("NONEXIST", "nonexistent"); test_path_search (".", "$NONEXISTENT"); xputenv ("KPATHSEA", "kpathsea"); - test_path_search ("/k" ENV_SEP_STRING ".", "$KPATHSEA.texi"); - test_path_search ("/k" ENV_SEP_STRING ".", "${KPATHSEA}.texi"); - test_path_search ("$KPATHSEA" ENV_SEP_STRING ".", "README"); - test_path_search ("." ENV_SEP_STRING "$KPATHSEA", "README"); - + test_path_search ("/k" ENV_SEP_STRING ".", "$KPATHSEA.texi"); + test_path_search ("/k" ENV_SEP_STRING ".", "${KPATHSEA}.texi"); + test_path_search ("$KPATHSEA" ENV_SEP_STRING ".", "README"); + test_path_search ("." ENV_SEP_STRING "$KPATHSEA", "README"); + return 0; } diff --git a/Build/source/texk/kpathsea/pathsearch.h b/Build/source/texk/kpathsea/pathsearch.h index 1238baa696f..cdf91f0c3c7 100644 --- a/Build/source/texk/kpathsea/pathsearch.h +++ b/Build/source/texk/kpathsea/pathsearch.h @@ -45,7 +45,7 @@ extern unsigned kpathsea_normalize_path (kpathsea kpse, string elt); of the corresponding (existing) directory or directories, with trailing slashes, or NULL. If ELT is the empty string, check the current working directory. - + It's up to the caller to expand ELT. This is because this routine is most likely only useful to be called from `kpathsea_path_search', which has already assumed expansion has been done. */ @@ -56,19 +56,19 @@ extern KPSEDLL str_llist_type *kpathsea_element_dirs (kpathsea kpse, /* Call `kpathsea_expand' on NAME. If the result is an absolute or explicitly relative filename, check whether it is a readable (regular) file. - + Otherwise, look in each of the directories specified in PATH (also do tilde and variable expansion on elements in PATH), using a prebuilt db (see db.h) if it's relevant for a given path element. - + If the prebuilt db doesn't exist, or if MUST_EXIST is true and NAME isn't found in the prebuilt db, look on the filesystem. (I.e., if MUST_EXIST is false, and NAME isn't found in the db, do *not* look on the filesystem.) - + The caller must expand PATH. This is because it makes more sense to do this once, in advance, instead of for every search. - + In any case, return a matching filename if found, otherwise NULL. If more than one file matches, which one gets returned is unspecified. */ diff --git a/Build/source/texk/kpathsea/proginit.c b/Build/source/texk/kpathsea/proginit.c index 7a1b9744711..265b5ebb052 100644 --- a/Build/source/texk/kpathsea/proginit.c +++ b/Build/source/texk/kpathsea/proginit.c @@ -27,18 +27,18 @@ mess, but still better than repeating the code. */ void -kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, +kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, const_string mode, const_string fallback) { string font_var = concat (prefix, "FONTS"); string header_var = concat (prefix, "HEADERS"); string makepk_var = concat (prefix, "MAKEPK"); string size_var = concat (prefix, "SIZES"); - + /* Do both `pk_format' and `any_glyph_format' for the sake of xdvi; in general, mktexpk might apply to either, and the program will ask for the one it wants. */ - + /* Might have a program-specific name for mktexpk itself. */ if (getenv (makepk_var)) { /* If we did, we want to enable the program, I think. */ @@ -65,10 +65,10 @@ kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, kpathsea_init_fallback_resolutions (kpse, size_var); kpathsea_xputenv_int (kpse, "MAKETEX_BASE_DPI", dpi); kpse->fallback_font = fallback; - + /* Ugliness. See comments in kpse_make_tex in kpathsea/tex-make.c. */ kpathsea_xputenv (kpse, "MAKETEX_MODE", mode ? mode : DIR_SEP_STRING); - + free (font_var); free (header_var); free (makepk_var); @@ -77,7 +77,7 @@ kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, #if defined (KPSE_COMPAT_API) void -kpse_init_prog (const_string prefix, unsigned dpi, +kpse_init_prog (const_string prefix, unsigned dpi, const_string mode, const_string fallback) { kpathsea_init_prog(kpse_def,prefix,dpi,mode,fallback); diff --git a/Build/source/texk/kpathsea/proginit.h b/Build/source/texk/kpathsea/proginit.h index c6b8a8e657e..27d8c4f4421 100644 --- a/Build/source/texk/kpathsea/proginit.h +++ b/Build/source/texk/kpathsea/proginit.h @@ -28,7 +28,7 @@ etc., etc. See the source. */ extern KPSEDLL void -kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, +kpathsea_init_prog (kpathsea kpse, const_string prefix, unsigned dpi, const_string mode, const_string fallback); #if defined (KPSE_COMPAT_API) diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index 68b39badd6a..2585550e4d8 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -141,7 +141,7 @@ StripLast (register char *s) /* Copy first path element from B to A, removing it from B. */ -static void +static void CopyFirst (register char *a, char *b) { register int length = strlen (a); @@ -271,7 +271,7 @@ remove_dots (kpathsea kpse, string dir) string c; unsigned len; string ret = (string) ""; /* We always reassign. */ - + for (c = kpathsea_filename_component (kpse, dir); c; c = kpathsea_filename_component (kpse, NULL)) { if (STREQ (c, ".")) { @@ -317,7 +317,7 @@ remove_dots (kpathsea kpse, string dir) ret = temp; } } - + /* Remove a trailing /, just in case it snuck in. */ len = strlen (ret); if (len > 0 && ret[len - 1] == DIR_SEP) { @@ -336,7 +336,7 @@ kpathsea_selfdir (kpathsea kpse, const_string argv0) { string ret = NULL; string self = NULL; - + if (kpathsea_absolute_p (kpse, argv0, true)) { self = xstrdup (argv0); } else { @@ -356,7 +356,7 @@ kpathsea_selfdir (kpathsea kpse, const_string argv0) *self = '\0'; } else { strcat (self,DIR_SEP_STRING); - strcat (self,argv0); + strcat (self,argv0); } UnLock (lock); } @@ -370,10 +370,10 @@ kpathsea_selfdir (kpathsea kpse, const_string argv0) for (elt = kpathsea_path_element (kpse, getenv ("PATH")); !self && elt; elt = kpathsea_path_element (kpse, NULL)) { string name; - + /* UNIX tradition interprets the empty path element as "." */ if (*elt == 0) elt = "."; - + name = concat3 (elt, DIR_SEP_STRING, argv0); /* In order to do this perfectly, we'd have to check the owner bits only @@ -385,21 +385,21 @@ kpathsea_selfdir (kpathsea kpse, const_string argv0) necessary if we were to do it right. */ if (stat (name, &s) == 0 && s.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) { /* Do not stop at directories. */ - if (!S_ISDIR(s.st_mode)) + if (!S_ISDIR(s.st_mode)) self = name; } } #endif /* not AMIGA */ } - + /* If argv0 is somehow dir/exename, `self' will still be NULL. */ if (!self) self = concat3 (".", DIR_SEP_STRING, argv0); - + ret = xdirname (remove_dots (kpse, expand_symlinks (kpse, self))); free (self); - + return ret; } @@ -477,7 +477,7 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, string append_debug_output = getenv("KPATHSEA_DEBUG_APPEND"); int err, olderr; #endif - + /* Set debugging stuff first, in case we end up doing debuggable stuff during this initialization. */ if (s) { @@ -526,7 +526,7 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, stuff useless for win32. */ { char short_path[PATH_MAX], path[PATH_MAX], *fp; - + /* SearchPath() always gives back an absolute directory */ if (SearchPath(NULL, argv0, ".exe", PATH_MAX, short_path, &fp) == 0) LIB_FATAL1("Can't determine where the executable %s is.\n", argv0); @@ -643,10 +643,10 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, } } - /* Some of the utility routines (like atou() and xfopen()) will use + /* Some of the utility routines (like atou() and xfopen()) will use FATAL and variations thereof (see lib.h) if there is a problem. - The next trick makes it possible for that message to report some useful + The next trick makes it possible for that message to report some useful name instead of (NULL), if the backward compatible is compiled in. */ #if defined (KPSE_COMPAT_API) @@ -655,7 +655,7 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, kpse_def->invocation_short_name = xstrdup(kpse->invocation_short_name); } #endif - + kpathsea_xputenv (kpse, "progname", kpse->program_name); } diff --git a/Build/source/texk/kpathsea/readable.c b/Build/source/texk/kpathsea/readable.c index fecd305b0f0..96eae10b0ef 100644 --- a/Build/source/texk/kpathsea/readable.c +++ b/Build/source/texk/kpathsea/readable.c @@ -65,7 +65,7 @@ READABLE(const_string fn, unsigned int st) /* POSIX invented the brain-damage of not necessarily truncating filename components; the system's behavior is defined by the value of the symbol _POSIX_NO_TRUNC, but you can't change it dynamically! - + Generic const return warning. See extend-fname.c. */ string @@ -106,7 +106,7 @@ kpathsea_readable_file (kpathsea kpse, const_string name) #if defined (KPSE_COMPAT_API) string -kpse_readable_file (const_string name) +kpse_readable_file (const_string name) { return kpathsea_readable_file (kpse_def, name); } diff --git a/Build/source/texk/kpathsea/readable.h b/Build/source/texk/kpathsea/readable.h index 23e09c683ee..43e1e385f75 100644 --- a/Build/source/texk/kpathsea/readable.h +++ b/Build/source/texk/kpathsea/readable.h @@ -25,9 +25,9 @@ /* If NAME is readable and is a regular file, return it. If the error is ENAMETOOLONG, truncate any too-long path components, and if the result is a readable file, return that. Otherwise return NULL. */ - + extern KPSEDLL string kpathsea_readable_file (kpathsea kpse, - const_string name); + const_string name); #if defined (KPSE_COMPAT_API) extern KPSEDLL string kpse_readable_file (const_string name); diff --git a/Build/source/texk/kpathsea/readlink.c b/Build/source/texk/kpathsea/readlink.c index a828a5ea378..1a0fe72c26a 100644 --- a/Build/source/texk/kpathsea/readlink.c +++ b/Build/source/texk/kpathsea/readlink.c @@ -38,7 +38,7 @@ main (int argc, char **argv) int status; char path[PATH_MAX]; #endif - + if (argc > 1 && strcmp (argv[1], "--help") == 0) { printf("Usage: %s FILE\n\ If FILE exists and is a symlink, print the contents of the link and\n\ diff --git a/Build/source/texk/kpathsea/rm-suffix.c b/Build/source/texk/kpathsea/rm-suffix.c index 0b6c179ccae..984a78cbd0a 100644 --- a/Build/source/texk/kpathsea/rm-suffix.c +++ b/Build/source/texk/kpathsea/rm-suffix.c @@ -27,7 +27,7 @@ remove_suffix (const_string s) { string ret; const_string suffix = find_suffix (s); - + if (suffix) { /* Back up to before the dot. */ @@ -38,6 +38,6 @@ remove_suffix (const_string s) } else ret = (string) s; - + return ret; } diff --git a/Build/source/texk/kpathsea/str-list.c b/Build/source/texk/kpathsea/str-list.c index 86498f8fdd2..d4dcf86c5bf 100644 --- a/Build/source/texk/kpathsea/str-list.c +++ b/Build/source/texk/kpathsea/str-list.c @@ -28,10 +28,10 @@ str_list_type str_list_init (void) { str_list_type ret; - + STR_LIST_LENGTH (ret) = 0; STR_LIST (ret) = NULL; - + return ret; } @@ -47,7 +47,7 @@ str_list_add (str_list_type *l, string s) /* May as well save some reallocations and do everything in a chunk instead of calling str_list_add on each element. */ - + void str_list_concat (str_list_type *target, str_list_type more) { @@ -56,7 +56,7 @@ str_list_concat (str_list_type *target, str_list_type more) STR_LIST_LENGTH (*target) += STR_LIST_LENGTH (more); XRETALLOC (STR_LIST (*target), STR_LIST_LENGTH (*target), string); - + for (e = 0; e < STR_LIST_LENGTH (more); e++) STR_LIST_ELT (*target, prev_len + e) = STR_LIST_ELT (more, e); } @@ -126,7 +126,7 @@ str_list_uniqify (str_list_type *l) { unsigned e; str_list_type ret = str_list_init (); - + for (e = 0; e < STR_LIST_LENGTH (*l); e++) { string elt1 = STR_LIST_ELT (*l, e); unsigned f; @@ -139,14 +139,14 @@ str_list_uniqify (str_list_type *l) break; } } - + if (f == STR_LIST_LENGTH (*l)) { str_list_add (&ret, elt1); /* not found */ } else { free (elt1); /* duplicate, forget this one */ } } - + /* Replace the passed list with what we constructed. */ *l = ret; } diff --git a/Build/source/texk/kpathsea/str-llist.c b/Build/source/texk/kpathsea/str-llist.c index 45c8778aebf..cea178194cf 100644 --- a/Build/source/texk/kpathsea/str-llist.c +++ b/Build/source/texk/kpathsea/str-llist.c @@ -27,16 +27,16 @@ str_llist_add (str_llist_type *l, string str) { str_llist_elt_type *e; str_llist_elt_type *new_elt = XTALLOC1 (str_llist_elt_type); - + /* The new element will be at the end of the list. */ STR_LLIST (*new_elt) = str; STR_LLIST_MOVED (*new_elt) = false; STR_LLIST_NEXT (*new_elt) = NULL; - + /* Find the current end of the list. */ for (e = *l; e && STR_LLIST_NEXT (*e); e = STR_LLIST_NEXT (*e)) ; - + if (!e) *l = new_elt; else @@ -52,11 +52,11 @@ void str_llist_float (str_llist_type *l, str_llist_elt_type *mover) { str_llist_elt_type *last_moved, *unmoved; - + /* If we've already moved this element, never mind. */ if (STR_LLIST_MOVED (*mover)) return; - + /* Find the first unmoved element (to insert before). We're guaranteed this will terminate, since MOVER itself is currently unmoved, and it must be in L (by hypothesis). */ @@ -70,12 +70,12 @@ str_llist_float (str_llist_type *l, str_llist_elt_type *mover) predecessor to it. */ str_llist_elt_type *before_mover; str_llist_elt_type *after_mover = STR_LLIST_NEXT (*mover); - + /* Find `mover's predecessor. */ for (before_mover = unmoved; STR_LLIST_NEXT (*before_mover) != mover; before_mover = STR_LLIST_NEXT (*before_mover)) ; - + /* `before_mover' now links to `after_mover'. */ STR_LLIST_NEXT (*before_mover) = after_mover; diff --git a/Build/source/texk/kpathsea/strstr.c b/Build/source/texk/kpathsea/strstr.c index 0229f463fdc..6a56025c41c 100644 --- a/Build/source/texk/kpathsea/strstr.c +++ b/Build/source/texk/kpathsea/strstr.c @@ -63,7 +63,7 @@ strstr (phaystack, pneedle) goto jin; for (;;) - { + { register chartype a; register const unsigned char *rhaystack, *rneedle; diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index 6d02b7b4ee5..73f29ab0d5f 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -53,7 +53,7 @@ #define MFPOOL_ENVS "MFPOOL", "TEXMFINI" #define MFT_ENVS "MFTINPUTS" #define MP_ENVS "MPINPUTS" -#define MPPOOL_ENVS "MPPOOL", "TEXMFINI" +#define MPPOOL_ENVS "MPPOOL", "TEXMFINI" #define MPSUPPORT_ENVS "MPSUPPORT" #define OCP_ENVS "OCPINPUTS" #define OFM_ENVS "OFMFONTS", "TEXFONTS" @@ -109,9 +109,9 @@ kpathsea_init_fallback_resolutions (kpathsea kpse, string envvar) unsigned size_count = 0; const_string default_sizes = kpse->fallback_resolutions_string ? kpse->fallback_resolutions_string - : DEFAULT_FONT_SIZES; + : DEFAULT_FONT_SIZES; string size_list = kpathsea_expand_default (kpse, size_str, default_sizes); - + /* Initialize the list of last-resort sizes. */ for (size = kpathsea_path_element (kpse, size_list); size != NULL; size = kpathsea_path_element (kpse, NULL)) @@ -119,7 +119,7 @@ kpathsea_init_fallback_resolutions (kpathsea kpse, string envvar) unsigned s; if (! *size) /* Skip empty elements. */ continue; - + s = atoi (size); if (size_count && s < last_resort_sizes[size_count - 1]) { WARNING1 ("kpathsea: last resort size %s not in ascending order, ignored", @@ -137,7 +137,7 @@ kpathsea_init_fallback_resolutions (kpathsea kpse, string envvar) last_resort_sizes[size_count - 1] = 0; free (size_list); - + kpse->fallback_resolutions = last_resort_sizes; } @@ -154,7 +154,7 @@ kpse_init_fallback_resolutions ( string envvar) to mention the path values themselves. */ void -kpathsea_set_program_enabled (kpathsea kpse, kpse_file_format_type fmt, +kpathsea_set_program_enabled (kpathsea kpse, kpse_file_format_type fmt, boolean value, kpse_src_type level) { kpse_format_info_type *f = &(kpse->format_info[fmt]); @@ -167,7 +167,7 @@ kpathsea_set_program_enabled (kpathsea kpse, kpse_file_format_type fmt, #if defined (KPSE_COMPAT_API) void -kpse_set_program_enabled (kpse_file_format_type fmt, +kpse_set_program_enabled (kpse_file_format_type fmt, boolean value, kpse_src_type level) { kpathsea_set_program_enabled (kpse_def, fmt, value, level); @@ -183,7 +183,7 @@ void kpathsea_maketex_option (kpathsea kpse, const_string fmtname, boolean value) { kpse_file_format_type fmt = kpse_last_format; - + /* Trying to match up with the suffix lists unfortunately doesn't work well, since that would require initializing the formats. */ if (FILESTRCASEEQ (fmtname, "pk")) { @@ -235,13 +235,13 @@ kpse_maketex_option (const_string fmtname, boolean value) static void init_path (kpathsea kpse, kpse_format_info_type *info, - const_string default_path, ...) + const_string default_path, ...) { string env_name; string env_value = NULL; string var = NULL; va_list ap; - + info->default_path = default_path; va_start (ap, default_path); @@ -268,22 +268,22 @@ init_path (kpathsea kpse, kpse_format_info_type *info, free (evar); env_value = getenv (env_name); if (env_value && *env_value) { - var = env_name; + var = env_name; } } } } - + /* If we are initializing the cnf path, don't try to get any values from the cnf files; that's infinite loop time. */ if (!info->cnf_path && info != &(kpse->format_info[kpse_cnf_format])) info->cnf_path = kpathsea_cnf_get (kpse, env_name); - + if (var && info->cnf_path) break; } va_end (ap); - + /* Expand any extra :'s. For each level, we replace an extra : with the path at the next lower level. For example, an extra : in a user-set envvar should be replaced with the path from the cnf file. @@ -318,7 +318,7 @@ init_path (kpathsea kpse, kpse_format_info_type *info, /* Some file types have more than one suffix, and sometimes it is - convenient to modify the list of searched suffixes. */ + convenient to modify the list of searched suffixes. */ void kpathsea_set_suffixes (kpathsea kpse, kpse_file_format_type format, @@ -381,7 +381,7 @@ kpse_set_suffixes (kpse_file_format_type format, static void init_maketex (kpathsea kpse, kpse_file_format_type fmt, - const_string dflt_prog, ...) + const_string dflt_prog, ...) { kpse_format_info_type *f = &(kpse->format_info[fmt]); const_string prog = f->program ? f->program : dflt_prog; /* mktexpk */ @@ -410,9 +410,9 @@ init_maketex (kpathsea kpse, kpse_file_format_type fmt, /* This might actually be from an environment variable value, but in that case, we'll have previously set it from kpse_init_prog. */ kpathsea_set_program_enabled (kpse, fmt, *progval == '1', - kpse_src_client_cnf); + kpse_src_client_cnf); } - + free (PROG); } @@ -455,9 +455,9 @@ concatn_with_spaces (const_string str1, ...) if (!str1) return NULL; - + ret = xstrdup (str1); - + va_start (ap, str1); while ((arg = va_arg (ap, string)) != NULL) { @@ -466,7 +466,7 @@ concatn_with_spaces (const_string str1, ...) ret = temp; } va_end (ap); - + return ret; } @@ -481,7 +481,7 @@ kpathsea_init_format (kpathsea kpse, kpse_file_format_type format) /* If we get called twice, don't redo all the work. */ if (FMT_INFO.path) return FMT_INFO.path; - + switch (format) { /* We might be able to avoid repeating `gf' or whatever so many times with token pasting, but it doesn't seem worth it. */ @@ -859,7 +859,7 @@ kpse_init_format (kpse_file_format_type format) /* These are subroutines called twice when finding file, to construct the list of names to search for. */ - + /* We don't even use fontmaps any more in practice, they were for things like the lcircle10/lcirc10 name change many years ago, but let's keep the support working nonetheless. */ @@ -869,7 +869,7 @@ target_fontmaps (kpathsea kpse, string **target, unsigned *count, const_string name) { const_string *mapped_names = kpathsea_fontmap_lookup (kpse, name); - + if (mapped_names != NULL) { const_string mapped_name; /* We leak mapped_names and its elements, some of the time. */ @@ -919,16 +919,16 @@ target_suffixed_names (kpathsea kpse, string **target, unsigned *count, if (has_potential_suffix || !FMT_INFO.suffix) { return; } - + for (ext = FMT_INFO.suffix; *ext; ext++) { string name_with_suffix = concat (name, *ext); (*target)[(*count)] = name_with_suffix; (*count)++; XRETALLOC ((*target), (*count)+1, string); - + if (use_fontmaps) { target_fontmaps (kpse, target, count, name_with_suffix); - } + } } } @@ -936,7 +936,7 @@ target_suffixed_names (kpathsea kpse, string **target, unsigned *count, initializes the path spec for FORMAT if it's the first lookup of that type. Return the filename found, or NULL. This is the most likely thing for clients to call. */ - + string kpathsea_find_file (kpathsea kpse, const_string name, kpse_file_format_type format, boolean must_exist) @@ -980,7 +980,7 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, /* NAME being NULL is a programming bug somewhere. NAME can be empty, though; this happens with constructs like `\input\relax'. */ assert (const_name); - + if (FMT_INFO.path == NULL) kpathsea_init_format (kpse, format); @@ -992,9 +992,9 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, /* Do variable and tilde expansion. */ name = kpathsea_expand (kpse, const_name); - + try_std_extension_first - = kpathsea_var_value (kpse, "try_std_extension_first"); + = kpathsea_var_value (kpse, "try_std_extension_first"); has_any_suffix = strrchr (name, '.'); if (has_any_suffix) { string p = strchr (has_any_suffix, DIR_SEP); @@ -1048,7 +1048,7 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, /* Search, trying to minimize disk-pounding. */ ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, - (const_string*) target, false, all); + (const_string*) target, false, all); /* Do we need to pound the disk? */ if (! *ret && must_exist) { @@ -1067,14 +1067,14 @@ kpathsea_find_file_generic (kpathsea kpse, const_string const_name, } target[count] = NULL; ret = kpathsea_path_search_list_generic (kpse, FMT_INFO.path, - (const_string*) target, true, all); + (const_string*) target, true, all); } - + /* Free the list we created. */ for (count = 0; target[count]; count++) free (target[count]); free (target); - + /* If nothing was found, call mktex* to create a missing file. Since this returns a single string, morph it into a list. */ if (! *ret && must_exist) { @@ -1247,11 +1247,11 @@ executable_filep (kpathsea kpse, const_string fname, boolean silent) #if defined(__CYGWIN__) for (p = base; *p; p++) *p = TOLOWER (*p); - p = base; + p = base; #else p = (char *) strlwr (base); #endif - for (q = p + strlen (p) - 1; + for (q = p + strlen (p) - 1; (q >= p) && ((*q == '.') || (Isspace (*q))); q--) { *q = '\0'; /* remove trailing '.' , ' ' and '\t' */ } @@ -1338,7 +1338,7 @@ kpathsea_open_file (kpathsea kpse, const_string name, LIB_FATAL2 ("%s file `%s' not found", kpse->format_info[type].type,name); } } - + return f; } @@ -1375,7 +1375,7 @@ kpathsea_reset_program_name (kpathsea kpse, const_string progname) free (kpse->program_name); kpse->program_name = xstrdup (progname); kpathsea_xputenv(kpse, "progname", kpse->program_name); - + /* Clear paths -- do we want the db path to be cleared? */ for (i = 0; i != kpse_last_format; ++i) { /* Do not erase the cnf of db paths. This means that the filename diff --git a/Build/source/texk/kpathsea/tex-glyph.c b/Build/source/texk/kpathsea/tex-glyph.c index 8c97ccc44f6..6a2000829b5 100644 --- a/Build/source/texk/kpathsea/tex-glyph.c +++ b/Build/source/texk/kpathsea/tex-glyph.c @@ -52,10 +52,10 @@ try_format (kpathsea kpse, const_string fontname, unsigned dpi, (void)fontname; /* -Wunused */ if (!path) path = kpathsea_init_format (kpse, format); - + /* Set the suffix on the name we'll be searching for. */ sfx = kpse->format_info[format].suffix; - if (sfx && *sfx) + if (sfx && *sfx) kpathsea_xputenv (kpse, "KPATHSEA_FORMAT", *sfx); /* OK, the limits on this for loop are a little hokey, but it saves @@ -73,7 +73,7 @@ try_format (kpathsea kpse, const_string fontname, unsigned dpi, free (name); } } - + return ret; } @@ -92,7 +92,7 @@ try_size (kpathsea kpse, const_string fontname, unsigned dpi, boolean try_pk = format == kpse_pk_format || format == kpse_any_glyph_format; kpathsea_xputenv_int (kpse, "KPATHSEA_DPI", dpi); - + /* Look for PK first (since it's more likely to be found), then GF. */ ret = try_pk ? try_format (kpse, fontname, dpi, kpse_pk_format) : NULL; format_found = kpse_pk_format; @@ -102,14 +102,14 @@ try_size (kpathsea kpse, const_string fontname, unsigned dpi, ret = try_format (kpse, fontname, dpi, kpse_gf_format); format_found = kpse_gf_format; } - + if (ret != NULL && glyph_file) { /* Success. Fill in the return info. Discard const. */ glyph_file->name = (string) fontname; glyph_file->dpi = dpi; glyph_file->format = format_found; } - + return ret; } @@ -122,7 +122,7 @@ try_resolution (kpathsea kpse, const_string fontname, unsigned dpi, kpse_glyph_file_type *glyph_file) { string ret = try_size (kpse, fontname, dpi, format, glyph_file); - + if (!ret) { unsigned r; unsigned tolerance = KPSE_BITMAP_TOLERANCE (dpi); @@ -172,7 +172,7 @@ try_fontmap (kpathsea kpse, string *fontname_ptr, unsigned dpi, } else if (!kpathsea_fontmap_lookup (kpse, first_name)) { *fontname_ptr = xstrdup (first_name); } - } + } return ret; } @@ -182,7 +182,7 @@ try_fontmap (kpathsea kpse, string *fontname_ptr, unsigned dpi, along as usual. Assume `kpse_fallback_resolutions' is sorted. */ static string -try_fallback_resolutions (kpathsea kpse, +try_fallback_resolutions (kpathsea kpse, const_string fontname, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file) @@ -206,11 +206,11 @@ try_fallback_resolutions (kpathsea kpse, } if (s == 0) return ret; /* If nothing in list, quit now. */ - + max_loc = s; lower_loc = loc - 1; upper_loc = loc + 1; - + for (;;) { unsigned fallback = kpse->fallback_resolutions[loc]; @@ -221,17 +221,17 @@ try_fallback_resolutions (kpathsea kpse, if (ret) break; } - + /* That didn't work. How far away are the locs above or below? */ lower_diff = lower_loc > -1 ? dpi - kpse->fallback_resolutions[lower_loc] : INT_MAX; upper_diff = upper_loc < max_loc ? kpse->fallback_resolutions[upper_loc] - dpi : INT_MAX; - + /* But if we're at the end in both directions, quit. */ if (lower_diff == INT_MAX && upper_diff == INT_MAX) break; - + /* Go in whichever direction is closest. */ if (lower_diff < upper_diff) { @@ -251,7 +251,7 @@ try_fallback_resolutions (kpathsea kpse, /* See the .h file for description. This is the entry point. */ string -kpathsea_find_glyph (kpathsea kpse, +kpathsea_find_glyph (kpathsea kpse, const_string passed_fontname, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file) @@ -259,12 +259,12 @@ kpathsea_find_glyph (kpathsea kpse, string ret; kpse_glyph_source_type source; string fontname = (string) passed_fontname; /* discard const */ - + /* Start the search: try the name we're given. */ source = kpse_glyph_source_normal; kpathsea_xputenv (kpse, "KPATHSEA_NAME", fontname); ret = try_resolution (kpse, fontname, dpi, format, glyph_file); - + /* Try all the various possibilities in order of preference. */ if (!ret) { /* Maybe FONTNAME was an alias. */ @@ -308,7 +308,7 @@ kpathsea_find_glyph (kpathsea kpse, } } } - + /* If RET is null, then the caller is not supposed to look at GLYPH_FILE, so it doesn't matter if we assign something incorrect. */ if (glyph_file) @@ -319,7 +319,7 @@ kpathsea_find_glyph (kpathsea kpse, if (fontname != passed_fontname) free (fontname); */ - + return ret; } @@ -330,7 +330,7 @@ kpse_find_glyph (const_string passed_fontname, unsigned dpi, kpse_glyph_file_type *glyph_file) { return kpathsea_find_glyph (kpse_def, passed_fontname, dpi, format, - glyph_file); + glyph_file); } #endif @@ -364,7 +364,7 @@ test_find_glyph (kpathsea kpse, const_string fontname, unsigned dpi) { string answer; kpse_glyph_file_type ret; - + printf ("\nSearch for %s@%u:\n\t", fontname, dpi); answer = kpathsea_find_glyph (kpse, fontname, dpi, @@ -396,10 +396,10 @@ main (int argc, char **argv) test_find_glyph (kpse, "fallback", 300); /* find fallback font cmr10 */ kpathsea_init_fallback_resolutions (kpse, "KPATHSEA_TEST_SIZES"); test_find_glyph (kpse, "fallbackdpi", 759); /* find fallback cmr10@300 */ - + kpathsea_xputenv (kpse,"GFFONTS", "."); test_find_glyph (kpse, "cmr10", 300); /* different GFFONTS/TEXFONTS */ - + return 0; } diff --git a/Build/source/texk/kpathsea/tex-glyph.h b/Build/source/texk/kpathsea/tex-glyph.h index ee5b84951a9..7a6c87ae49f 100644 --- a/Build/source/texk/kpathsea/tex-glyph.h +++ b/Build/source/texk/kpathsea/tex-glyph.h @@ -58,7 +58,7 @@ typedef struct NULL. Also return information about the file found in *GLYPH_FILE. */ extern KPSEDLL string kpathsea_find_glyph (kpathsea kpse, - const_string font_name, unsigned dpi, + const_string font_name, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file); @@ -69,12 +69,12 @@ extern KPSEDLL string kpathsea_find_glyph (kpathsea kpse, #define KPSE_BITMAP_TOLERANCE(r) ((r) / 500.0 + 1) /* Check whether DPI1 is within KPSE_BITMAP_TOLERANCE of DPI2. */ -extern KPSEDLL boolean kpathsea_bitmap_tolerance (kpathsea kpse, +extern KPSEDLL boolean kpathsea_bitmap_tolerance (kpathsea kpse, double dpi1, double dpi2); #if defined (KPSE_COMPAT_API) -extern KPSEDLL string kpse_find_glyph (const_string font_name, unsigned dpi, +extern KPSEDLL string kpse_find_glyph (const_string font_name, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file); diff --git a/Build/source/texk/kpathsea/tex-hush.c b/Build/source/texk/kpathsea/tex-hush.c index 05df3ddb1db..6904f127c85 100644 --- a/Build/source/texk/kpathsea/tex-hush.c +++ b/Build/source/texk/kpathsea/tex-hush.c @@ -32,14 +32,14 @@ kpathsea_tex_hush (kpathsea kpse, const_string what) return true; if (STREQ (hush, "none")) return false; - for (h = kpathsea_path_element (kpse, hush); h; + for (h = kpathsea_path_element (kpse, hush); h; h = kpathsea_path_element (kpse, NULL)) { /* Don't do anything special with empty elements. */ if (STREQ (h, what)) return true; } } - + return false; } diff --git a/Build/source/texk/kpathsea/tex-make.c b/Build/source/texk/kpathsea/tex-make.c index cddb04dfc8f..c17eeec3ab9 100644 --- a/Build/source/texk/kpathsea/tex-make.c +++ b/Build/source/texk/kpathsea/tex-make.c @@ -47,11 +47,11 @@ set_maketex_mag (kpathsea kpse) /* If the environment variables aren't set, it's a bug. */ assert (dpi != 0 && bdpi != 0); - + /* Fix up for roundoff error. Hopefully the driver has already fixed up DPI, but may as well be safe, and also get the magstep number. */ (void) kpathsea_magstep_fix (kpse, dpi, bdpi, &m); - + if (m == 0) { if (bdpi <= 4000) { sprintf(q, "%u+%u/%u", dpi / bdpi, dpi % bdpi, bdpi); @@ -93,7 +93,7 @@ static void misstex (kpathsea kpse, kpse_file_format_type format, string *args) { string *s; - + /* If we weren't trying to make a font, do nothing. Maybe should allow people to specify what they want recorded? */ if (format != kpse_gf_format @@ -115,7 +115,7 @@ misstex (kpathsea kpse, kpse_file_format_type format, string *args) } /* else use user's name */ kpse->missfont - = missfont_name ? fopen (missfont_name, FOPEN_A_MODE) : NULL; + = missfont_name ? fopen (missfont_name, FOPEN_A_MODE) : NULL; if (!kpse->missfont && kpathsea_var_value (kpse, "TEXMFOUTPUT")) { missfont_name = concat3 (kpathsea_var_value (kpse, "TEXMFOUTPUT"), DIR_SEP_STRING, missfont_name); @@ -126,7 +126,7 @@ misstex (kpathsea kpse, kpse_file_format_type format, string *args) fprintf (stderr, "kpathsea: Appending font creation commands to %s.\n", missfont_name); } - + /* Write the command if we have a log file. */ if (kpse->missfont) { fputs (args[0], kpse->missfont); @@ -136,7 +136,7 @@ misstex (kpathsea kpse, kpse_file_format_type format, string *args) } putc ('\n', kpse->missfont); } -} +} /* Assume the script outputs the filename it creates (and nothing @@ -152,7 +152,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) string *s; string ret = NULL; string fn; - + if (!kpse->make_tex_discard_errors) { fprintf (stderr, "\nkpathsea: Running"); for (s = &args[0]; *s != NULL; s++) @@ -271,7 +271,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) &pi /* pointer to PROCESS_INFORMATION */ ) == 0) { LIB_FATAL2 ("kpathsea: CreateProcess() failed for `%s' (Error %d)\n", - new_cmd, (int)(GetLastError())); + new_cmd, (int)(GetLastError())); } CloseHandle(child_in); @@ -288,7 +288,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) if (num <= 0) { if (GetLastError() != ERROR_BROKEN_PIPE) { LIB_FATAL2 ("kpathsea: read() error code for `%s' (Error %d)", - new_cmd, (int)(GetLastError())); + new_cmd, (int)(GetLastError())); break; } } else { @@ -462,7 +462,7 @@ maketex (kpathsea kpse, kpse_file_format_type format, string* args) misstex (kpse, format, args); else kpathsea_db_insert (kpse, ret); - + return ret; } @@ -476,7 +476,7 @@ kpathsea_make_tex (kpathsea kpse, kpse_file_format_type format, { kpse_format_info_type spec; /* some compilers lack struct initialization */ string ret = NULL; - + spec = kpse->format_info[format]; if (!spec.type) { /* Not initialized yet? */ kpathsea_init_format (kpse, format); @@ -490,7 +490,7 @@ kpathsea_make_tex (kpathsea kpse, kpse_file_format_type format, /* Helpers */ int argnum; int i; - + /* FIXME * Check whether the name we were given is likely to be a problem. * Right now we err on the side of strictness: @@ -566,7 +566,7 @@ void test_make_tex (kpathsea kpse, kpse_file_format_type fmt, const_string base) { string answer; - + printf ("\nAttempting %s in format %d:\n", base, fmt); answer = kpathsea_make_tex (kpse, fmt, base); @@ -587,10 +587,10 @@ main (int argc, char **argv) /* Fail with mktextfm. */ kpathsea_set_program_enabled(kpse, kpse_tfm_format, 1, kpse_src_env); test_make_tex (kpse, kpse_tfm_format, "foozler99"); - + /* Call something disabled. */ test_make_tex (kpse, kpse_bst_format, "no-way"); - + return 0; } diff --git a/Build/source/texk/kpathsea/tex-make.h b/Build/source/texk/kpathsea/tex-make.h index 376d5acf7f9..c435c3beb92 100644 --- a/Build/source/texk/kpathsea/tex-make.h +++ b/Build/source/texk/kpathsea/tex-make.h @@ -28,7 +28,7 @@ the file is passed through environment variables. See the mktexpk stuff in `tex-make.c' for an example. */ -extern KPSEDLL string kpathsea_make_tex (kpathsea kpse, +extern KPSEDLL string kpathsea_make_tex (kpathsea kpse, kpse_file_format_type format, const_string base_file); diff --git a/Build/source/texk/kpathsea/truncate.c b/Build/source/texk/kpathsea/truncate.c index 48662c80e44..a4ea938f394 100644 --- a/Build/source/texk/kpathsea/truncate.c +++ b/Build/source/texk/kpathsea/truncate.c @@ -31,10 +31,10 @@ kpathsea_truncate_filename (kpathsea kpse, const_string name) { unsigned c_len = 0; /* Length of current component. */ unsigned ret_len = 0; /* Length of constructed result. */ - + /* Allocate enough space. */ string ret = (string) xmalloc (strlen (name) + 1); - + (void)kpse; /* currenty not used */ for (; *name; name++) diff --git a/Build/source/texk/kpathsea/uppercasify.c b/Build/source/texk/kpathsea/uppercasify.c index dcfc8924b23..9d96d381f77 100644 --- a/Build/source/texk/kpathsea/uppercasify.c +++ b/Build/source/texk/kpathsea/uppercasify.c @@ -25,11 +25,11 @@ uppercasify (const_string s) { string target; string ret = xstrdup (s); - + for (target = ret; *target; target++) { *target = TOUPPER (*target); } - + return ret; } diff --git a/Build/source/texk/kpathsea/variable.h b/Build/source/texk/kpathsea/variable.h index 2dd97c4cb30..992b9b36191 100644 --- a/Build/source/texk/kpathsea/variable.h +++ b/Build/source/texk/kpathsea/variable.h @@ -32,7 +32,7 @@ extern KPSEDLL string kpathsea_var_value (kpathsea kpse, const_string var); ignored. In the $VAR form, the variable name consists of consecutive letters, digits, and underscores. In the ${VAR} form, the variable name consists of whatever is between the braces. - + In any case, ``expansion'' means calling `getenv'; if the variable is not set, look in texmf.cnf files for a definition. If not set there, either, the expansion is the empty string (no error). */ diff --git a/Build/source/texk/kpathsea/version.c b/Build/source/texk/kpathsea/version.c index b8f374237b1..d4e5003160a 100644 --- a/Build/source/texk/kpathsea/version.c +++ b/Build/source/texk/kpathsea/version.c @@ -2,7 +2,7 @@ Copyright 1993, 1996, 2008, 2009 Karl Berry. Copyright 1997, 1999, 2005 Olaf Weber. - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either @@ -26,5 +26,5 @@ const char *kpathsea_version_string = KPSEVERSION; distribution, please change this address here, among many other places. Thanks. */ -const char *kpathsea_bug_address = +const char *kpathsea_bug_address = "Email bug reports to tex-k@tug.org.\n"; diff --git a/Build/source/texk/kpathsea/win32lib.h b/Build/source/texk/kpathsea/win32lib.h index 8349577f60a..abea8a2bb8d 100644 --- a/Build/source/texk/kpathsea/win32lib.h +++ b/Build/source/texk/kpathsea/win32lib.h @@ -20,7 +20,7 @@ #if _MSC_VER>=1200 #pragma warning(pop) -#else +#else #pragma warning(default: 4668) #pragma warning(default: 4255) #endif diff --git a/Build/source/texk/kpathsea/xbasename.c b/Build/source/texk/kpathsea/xbasename.c index 6bf651713e9..df066d68a6c 100644 --- a/Build/source/texk/kpathsea/xbasename.c +++ b/Build/source/texk/kpathsea/xbasename.c @@ -30,16 +30,16 @@ xbasename (const_string name) { const_string base = NULL; unsigned len; - + for (len = strlen(name); len > 0; len--) { if (IS_DIR_SEP(name[len - 1]) || IS_DEVICE_SEP(name[len - 1])) { base = name + len; break; } } - + if (!base) base = name; - + return base; } diff --git a/Build/source/texk/kpathsea/xcalloc.c b/Build/source/texk/kpathsea/xcalloc.c index 9e1fd9dcb86..aca15548a53 100644 --- a/Build/source/texk/kpathsea/xcalloc.c +++ b/Build/source/texk/kpathsea/xcalloc.c @@ -23,13 +23,13 @@ void * xcalloc (size_t nelem, size_t elsize) { void *new_mem = (void*)calloc(nelem ? nelem : 1, elsize ? elsize : 1); - + if (new_mem == NULL) { fprintf(stderr, "xcalloc: request for %lu elements of size %lu failed.\n", (unsigned long)nelem, (unsigned long)elsize); exit(EXIT_FAILURE); } - + return new_mem; } diff --git a/Build/source/texk/kpathsea/xdirname.c b/Build/source/texk/kpathsea/xdirname.c index dee5374754b..62da3d95c9c 100644 --- a/Build/source/texk/kpathsea/xdirname.c +++ b/Build/source/texk/kpathsea/xdirname.c @@ -30,11 +30,11 @@ xdirname (const_string name) { string ret; unsigned limit = 0, loc; - + /* Ignore a NULL name. */ if (!name) return NULL; - + if (NAME_BEGINS_WITH_DEVICE(name)) { limit = 2; #if defined(WIN32) || defined(__CYGWIN__) @@ -51,10 +51,10 @@ xdirname (const_string name) } #endif } - + for (loc = strlen (name); loc > limit && !IS_DIR_SEP (name[loc-1]); loc--) ; - + if (loc == limit && limit > 0) { if (limit == 2) { ret = (string)xmalloc(limit + 2); @@ -75,7 +75,7 @@ xdirname (const_string name) strncpy(ret, name, loc); ret[loc] = '\0'; } - + return ret; } @@ -98,7 +98,7 @@ char *tab[] = { "/usr/kpsewhich.exe", "///usr/kpsewhich.exe", "///kpsewhich.exe", - NULL + NULL }; int main() diff --git a/Build/source/texk/kpathsea/xfopen.c b/Build/source/texk/kpathsea/xfopen.c index 74c02ee297a..00bec3da043 100644 --- a/Build/source/texk/kpathsea/xfopen.c +++ b/Build/source/texk/kpathsea/xfopen.c @@ -26,9 +26,9 @@ FILE * xfopen (const_string filename, const_string mode) { FILE *f; - + assert(filename && mode); - + f = fopen(filename, mode); if (f == NULL) FATAL_PERROR(filename); @@ -41,7 +41,7 @@ void xfclose (FILE *f, const_string filename) { assert(f); - + if (fclose(f) == EOF) FATAL_PERROR(filename); diff --git a/Build/source/texk/kpathsea/xftell.c b/Build/source/texk/kpathsea/xftell.c index 39611a5e5ac..05bdc048ae6 100644 --- a/Build/source/texk/kpathsea/xftell.c +++ b/Build/source/texk/kpathsea/xftell.c @@ -23,9 +23,9 @@ unsigned long xftell (FILE *f, const_string filename) { long where = ftello (f); - + if (where < 0) FATAL_PERROR(filename); - + return where; } diff --git a/Build/source/texk/kpathsea/xftello.c b/Build/source/texk/kpathsea/xftello.c index 42f1a9b62f8..a01b42a5622 100644 --- a/Build/source/texk/kpathsea/xftello.c +++ b/Build/source/texk/kpathsea/xftello.c @@ -23,9 +23,9 @@ off_t xftello (FILE *f, const_string filename) { off_t where = ftello (f); - + if (where < 0) FATAL_PERROR(filename); - + return where; } diff --git a/Build/source/texk/kpathsea/xgetcwd.c b/Build/source/texk/kpathsea/xgetcwd.c index 1390da71c4f..905775d0fa1 100644 --- a/Build/source/texk/kpathsea/xgetcwd.c +++ b/Build/source/texk/kpathsea/xgetcwd.c @@ -49,28 +49,28 @@ xgetcwd (void) -- Olaf Weber <infovore@xs4all.nl */ #if defined (HAVE_GETCWD) && !defined (GETCWD_FORKS) string path = (string)xmalloc(PATH_MAX + 1); - + if (getcwd (path, PATH_MAX + 1) == 0) { fprintf(stderr, "getcwd: %s", path); exit(EXIT_FAILURE); } - + return path; #elif defined (HAVE_GETWD) string path = (string)xmalloc(PATH_MAX + 1); - + if (getwd (path) == 0) { fprintf(stderr, "getwd: %s", path); exit(EXIT_FAILURE); } - + return path; #else /* not HAVE_GETCWD && not HAVE_GETWD */ struct stat root_stat, cwd_stat; string cwd_path = (string)xmalloc(2); /* In case we assign "/" below. */ - + *cwd_path = 0; - + /* Find the inodes of the root and current directories. */ root_stat = xstat("/"); cwd_stat = xstat("."); @@ -81,7 +81,7 @@ xgetcwd (void) struct dirent *e; DIR *parent_dir; boolean found = false; - + xchdir(".."); parent_dir = xopendir("."); @@ -90,16 +90,16 @@ xgetcwd (void) while ((e = readdir (parent_dir)) != NULL && !found) { struct stat test_stat; test_stat = xlstat(e->d_name); - + if (SAME_FILE_P(test_stat, cwd_stat)) { /* We've found it. Prepend the pathname. */ string temp = cwd_path; cwd_path = concat3("/", e->d_name, cwd_path); free(temp); - + /* Set up to test the next parent. */ cwd_stat = xstat("."); - + /* Stop reading this directory. */ found = true; } @@ -107,10 +107,10 @@ xgetcwd (void) if (!found) LIB_FATAL2("No inode %d/device %d in parent directory", cwd_stat.st_ino, cwd_stat.st_dev); - + xclosedir(parent_dir); } - + /* If the current directory is the root, cwd_path will be the empty string, and we will have not gone through the loop. */ if (*cwd_path == 0) @@ -122,7 +122,7 @@ xgetcwd (void) #ifdef DOSISH /* Prepend the drive letter to CWD_PATH, since this technique never tells us what the drive is. - + Note that on MS-DOS/MS-Windows, the branch that works around missing `getwd' will probably only work for DJGPP (which does have `getwd'), because only DJGPP reports meaningful @@ -130,13 +130,13 @@ xgetcwd (void) { char drive[3]; string temp = cwd_path; - + /* Make the drive letter lower-case, unless it is beyond Z: (yes, there ARE such drives, in case of Novell Netware on MS-DOS). */ drive[0] = root_stat.st_dev + (root_stat.st_dev < 26 ? 'a' : 'A'); drive[1] = ':'; drive[2] = '\0'; - + cwd_path = concat(drive, cwd_path); free(temp); } diff --git a/Build/source/texk/kpathsea/xopendir.c b/Build/source/texk/kpathsea/xopendir.c index adf81d67b87..5d425569fff 100644 --- a/Build/source/texk/kpathsea/xopendir.c +++ b/Build/source/texk/kpathsea/xopendir.c @@ -39,7 +39,7 @@ xclosedir (DIR *d) closedir (d); #else int ret = closedir(d); - + if (ret != 0) FATAL("closedir failed"); #endif diff --git a/Build/source/texk/kpathsea/xrealloc.c b/Build/source/texk/kpathsea/xrealloc.c index 051b4834dbd..7561d72791d 100644 --- a/Build/source/texk/kpathsea/xrealloc.c +++ b/Build/source/texk/kpathsea/xrealloc.c @@ -24,7 +24,7 @@ void * xrealloc (void *old_ptr, size_t size) { void *new_mem; - + if (old_ptr == NULL) { new_mem = xmalloc(size); } else { @@ -40,6 +40,6 @@ xrealloc (void *old_ptr, size_t size) exit(EXIT_FAILURE); } } - + return new_mem; } diff --git a/Build/source/texk/kpathsea/xstat.c b/Build/source/texk/kpathsea/xstat.c index 17a3992c0dd..226ca62e983 100644 --- a/Build/source/texk/kpathsea/xstat.c +++ b/Build/source/texk/kpathsea/xstat.c @@ -25,10 +25,10 @@ struct stat xstat (const_string path) { struct stat s; - + if (stat(path, &s) != 0) FATAL_PERROR(path); - + return s; } @@ -46,9 +46,9 @@ struct stat xlstat (const_string path) { struct stat s; - + if (lstat(path, &s) != 0) - FATAL_PERROR(path); + FATAL_PERROR(path); return s; } #endif |