diff options
Diffstat (limited to 'Build/source/texk/kpathsea/kpsewhich.c')
-rw-r--r-- | Build/source/texk/kpathsea/kpsewhich.c | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c index 84194dbb58e..e8bb6ddbf65 100644 --- a/Build/source/texk/kpathsea/kpsewhich.c +++ b/Build/source/texk/kpathsea/kpsewhich.c @@ -72,7 +72,7 @@ string engine = NULL; that form. If it doesn't, return 0. */ static unsigned -find_dpi P1C(string, s) +find_dpi (string s) { unsigned dpi_number = 0; string extension = find_suffix (s); @@ -93,7 +93,7 @@ find_dpi P1C(string, s) differ from what would be inferred from their extensions. */ static kpse_file_format_type -find_format P2C(string, name, boolean, is_filename) +find_format (kpathsea kpse, string name, boolean is_filename) { kpse_file_format_type ret; @@ -136,19 +136,19 @@ find_format P2C(string, name, boolean, is_filename) const_string ftry; boolean found = false; - if (!kpse_format_info[f].type) - kpse_init_format ((kpse_file_format_type) f); + if (!kpse->format_info[f].type) + kpathsea_init_format (kpse, (kpse_file_format_type) f); if (!is_filename) { /* Allow the long name, but only in the -format option. We don't want a filename confused with a format name. */ - ftry = kpse_format_info[f].type; + ftry = kpse->format_info[f].type; found = TRY_SUFFIX (ftry); } - for (ext = kpse_format_info[f].suffix; !found && ext && *ext; ext++) { + 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++){ + for (ext = kpse->format_info[f].alt_suffix; !found && ext && *ext; ext++){ found = TRY_SUFFIX (*ext); } @@ -190,7 +190,7 @@ find_format P2C(string, name, boolean, is_filename) Perhaps later we will implement wildcards or // or something. */ static string * -subdir_match P2C(str_list_type, subdirs, string *, matches) +subdir_match (str_list_type subdirs, string *matches) { string *ret = XTALLOC1 (string); unsigned len = 1; @@ -232,7 +232,7 @@ subdir_match P2C(str_list_type, subdirs, string *, matches) /* Look up a single filename NAME. Return 0 if success, 1 if failure. */ static unsigned -lookup P1C(string, name) +lookup (kpathsea kpse, string name) { int i; string ret = NULL; @@ -240,14 +240,14 @@ lookup P1C(string, name) if (user_path) { if (show_all) { - ret_list = kpse_all_path_search (user_path, name); + ret_list = kpathsea_all_path_search (kpse, user_path, name); } else { - ret = kpse_path_search (user_path, name, must_exist); + 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 (name, true); + kpse_file_format_type fmt = find_format (kpse, name, true); switch (fmt) { case kpse_pk_format: @@ -259,8 +259,8 @@ lookup P1C(string, name) unsigned local_dpi = find_dpi (name); if (!local_dpi) local_dpi = dpi; - ret = kpse_find_glyph (remove_suffix (name), local_dpi, fmt, - &glyph_ret); + ret = kpathsea_find_glyph (kpse, remove_suffix (name), local_dpi, fmt, + &glyph_ret); } break; @@ -271,9 +271,9 @@ lookup P1C(string, name) default: if (show_all) { - ret_list = kpse_find_file_generic (name, fmt, must_exist, true); + ret_list = kpathsea_find_file_generic (kpse, name, fmt, must_exist, true); } else { - ret = kpse_find_file (name, fmt, must_exist); + ret = kpathsea_find_file (kpse, name, fmt, must_exist); } } } @@ -368,7 +368,7 @@ static struct option long_options[] { 0, 0, 0, 0 } }; static void -read_command_line P2C(int, argc, string *, argv) +read_command_line (kpathsea kpse, int argc, string *argv) { int g; /* `getopt' return code. */ int option_index; @@ -385,7 +385,7 @@ read_command_line P2C(int, argc, string *, argv) assert (g == 0); /* We have no short option names. */ if (ARGUMENT_IS ("debug")) { - kpathsea_debug |= atoi (optarg); + kpse->debug |= atoi (optarg); } else if (ARGUMENT_IS ("dpi") || ARGUMENT_IS ("D")) { dpi = atoi (optarg); @@ -407,30 +407,30 @@ read_command_line P2C(int, argc, string *, argv) } else if (ARGUMENT_IS ("help")) { int f; /* kpse_file_format_type */ - extern KPSEDLL char *kpse_bug_address; /* from version.c */ + extern KPSEDLL char *kpathsea_bug_address; /* from version.c */ printf ("Usage: %s [OPTION]... [FILENAME]...\n", argv[0]); fputs (USAGE, stdout); putchar ('\n'); - fputs (kpse_bug_address, stdout); + fputs (kpathsea_bug_address, stdout); /* Have to set this for init_format to work. */ - kpse_set_program_name (argv[0], progname); + kpathsea_set_program_name (kpse, argv[0], progname); puts ("\nRecognized format names and their suffixes:"); for (f = 0; f < kpse_last_format; f++) { const_string *ext; - kpse_init_format ((kpse_file_format_type)f); - printf ("%s:", kpse_format_info[f].type); - for (ext = kpse_format_info[f].suffix; ext && *ext; ext++) { + kpathsea_init_format (kpse, (kpse_file_format_type)f); + printf ("%s:", kpse->format_info[f].type); + for (ext = kpse->format_info[f].suffix; ext && *ext; ext++) { putchar (' '); fputs (*ext, stdout); } - if (kpse_format_info[f].alt_suffix) { + if (kpse->format_info[f].alt_suffix) { /* leave extra space between default and alt suffixes */ putchar (' '); } - for (ext = kpse_format_info[f].alt_suffix; ext && *ext; ext++) { + for (ext = kpse->format_info[f].alt_suffix; ext && *ext; ext++) { putchar (' '); fputs (*ext, stdout); } @@ -440,13 +440,13 @@ read_command_line P2C(int, argc, string *, argv) exit (0); } else if (ARGUMENT_IS ("mktex")) { - kpse_maketex_option (optarg, true); + kpathsea_maketex_option (kpse, optarg, true); } else if (ARGUMENT_IS ("mode")) { mode = optarg; } else if (ARGUMENT_IS ("no-mktex")) { - kpse_maketex_option (optarg, false); + kpathsea_maketex_option (kpse, optarg, false); } else if (ARGUMENT_IS ("path")) { user_path = optarg; @@ -493,23 +493,23 @@ There is NO WARRANTY, to the extent permitted by law.\n"); } int -main P2C(int, argc, string *, argv) +main (int argc, string *argv) { unsigned unfound = 0; + kpathsea kpse = kpathsea_new(); + read_command_line (kpse, argc, argv); - read_command_line (argc, argv); - - kpse_set_program_name (argv[0], progname); + kpathsea_set_program_name (kpse, argv[0], progname); if (engine) - xputenv ("engine", engine); + kpathsea_xputenv (kpse, "engine", engine); /* NULL for no fallback font. */ - kpse_init_prog (uppercasify (kpse_program_name), dpi, mode, NULL); + kpathsea_init_prog (kpse, uppercasify (kpse->program_name), dpi, mode, NULL); /* Have to do this after setting the program name. */ if (user_format_string) { - user_format = find_format (user_format_string, false); + user_format = find_format (kpse, user_format_string, false); if (user_format == kpse_last_format) { WARNING1 ("kpsewhich: Ignoring unknown file type `%s'", user_format_string); @@ -518,22 +518,22 @@ main P2C(int, argc, string *, argv) /* Variable expansion. */ if (var_to_expand) - puts (kpse_var_expand (var_to_expand)); + puts (kpathsea_var_expand (kpse, var_to_expand)); /* Brace expansion. */ if (braces_to_expand) - puts (kpse_brace_expand (braces_to_expand)); + puts (kpathsea_brace_expand (kpse, braces_to_expand)); /* Path expansion. */ if (path_to_expand) - puts (kpse_path_expand (path_to_expand)); + puts (kpathsea_path_expand (kpse, path_to_expand)); /* Show a search path. */ if (path_to_show) { if (user_format != kpse_last_format) { - if (!kpse_format_info[user_format].type) /* needed if arg was numeric */ - kpse_init_format (user_format); - puts (kpse_format_info[user_format].path); + if (!kpse->format_info[user_format].type) /* needed if arg was numeric */ + kpathsea_init_format (kpse, user_format); + puts (kpse->format_info[user_format].path); } else { WARNING ("kpsewhich: Cannot show path for unknown file type"); } @@ -541,7 +541,7 @@ main P2C(int, argc, string *, argv) /* Var to value. */ if (var_to_value) { - const_string value = kpse_var_value (var_to_value); + const_string value = kpathsea_var_value (kpse, var_to_value); if (!value) { unfound++; value=""; @@ -556,17 +556,17 @@ main P2C(int, argc, string *, argv) } for (; optind < argc; optind++) { - unfound += lookup (argv[optind]); + unfound += lookup (kpse, argv[optind]); } if (interactive) { for (;;) { string name = read_line (stdin); if (!name || STREQ (name, "q") || STREQ (name, "quit")) break; - unfound += lookup (name); + unfound += lookup (kpse, name); free (name); } } - + kpathsea_finish(kpse); return unfound > 255 ? 1 : unfound; } |