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 /Build/source/texk/kpathsea/pathsearch.c | |
parent | 64252d2baf23bb55ca90c388215779740c73e695 (diff) |
remove trailing spaces.
git-svn-id: svn://tug.org/texlive/trunk@18276 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/pathsearch.c')
-rw-r--r-- | Build/source/texk/kpathsea/pathsearch.c | 82 |
1 files changed, 41 insertions, 41 deletions
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; } |