home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / kpathsea / tex-file.c < prev    next >
C/C++ Source or Header  |  1994-03-13  |  2KB  |  80 lines

  1. /* tex-file.c: stuff for all TeX formats.
  2.  
  3. Copyright (C) 1993, 94 Karl Berry.
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. #include <kpathsea/config.h>
  20.  
  21. #include <kpathsea/default.h>
  22. #include <kpathsea/pathsearch.h>
  23. #include <kpathsea/tex-file.h>
  24.  
  25.  
  26. /* See tex-font.h.  */
  27. const_string kpse_fallback_font = NULL;
  28. unsigned *kpse_fallback_resolutions = NULL;
  29. string kpse_font_override_path = NULL;
  30.  
  31. /* The compiled-in default list, DEFAULT_FONT_SIZES, is intended to be
  32.    set from the command line (presumably via the Makefile).  */
  33.  
  34. #ifndef DEFAULT_FONT_SIZES
  35. #define DEFAULT_FONT_SIZES ""
  36. #endif
  37.  
  38. void
  39. kpse_init_fallback_resolutions P1C(string, envvar)
  40. {
  41.   const_string size_var = ENVVAR (envvar, "TEXSIZES");
  42.   string size_str = getenv (size_var);
  43.   unsigned *last_resort_sizes = NULL;
  44.   unsigned size_count = 0;
  45.   string size_list = kpse_expand_default (size_str, DEFAULT_FONT_SIZES);
  46.  
  47.   /* Initialize the list of last-resort sizes.  */
  48.   for (size_str = kpse_path_element (size_list); size_str != NULL;
  49.        size_str = kpse_path_element (NULL))
  50.     {
  51.       if (! *size_str)
  52.         continue;
  53.  
  54.       size_count++;
  55.       XRETALLOC (last_resort_sizes, size_count, unsigned);
  56.       last_resort_sizes[size_count - 1] = atoi (size_str);
  57.     }
  58.  
  59.   /* Add a zero to mark the end of the list.  */
  60.   size_count++;
  61.   XRETALLOC (last_resort_sizes, size_count, unsigned);
  62.   last_resort_sizes[size_count - 1] = 0;
  63.  
  64.   kpse_fallback_resolutions = last_resort_sizes;
  65. }
  66.  
  67. /* See the .h file for the description.  */
  68.  
  69. string
  70. kpse_find_file P4C(const_string, name,  const_string, ext,
  71.                    const_string, path,  boolean, must_exist)
  72. {
  73.   string full_name = concat3 (name, ".", ext);
  74.   string ret = kpse_path_search (path, full_name, must_exist);
  75.   
  76.   free (full_name);
  77.  
  78.   return ret;
  79. }
  80.