[tex-k] new pathsearch functions

John W. Eaton jwe@bevo.che.wisc.edu
Thu, 26 Dec 2002 16:03:58 -0600


--lYjEjE9FfP
Content-Type: text/plain; charset=us-ascii
Content-Description: message body and .signature
Content-Transfer-Encoding: 7bit

I've been using the kpathsearch library with Octave (www.octave.org)
for years with great success.  However, it has never really done the
type of search I need.  Instead of searching an entire directory tree
for a single file, I need to be able to search each directory in the
tree for each element of a list of files and return the first one in
the list that is found, or all the files found, in the order that they
are found.  In other words

  foreach (directory in path)
    foreach (file in list)
      if (directory/file exists)
        add directory/file to list
        if (! find_all)
          return
      end
    end
  end

I couldn't see any way to make this happen using existing functions in
the library, so I came up with the following functions for
pathsearch.c (a patch is attached below):


  /* Search each element of PATH for each element in the list of NAMES.
     Return the first one found.  */
  extern string kpse_path_find_first_of P3H(const_string path,
					    const_string *names,
					    boolean must_exist);

  /* Like `kpse_path_find_first_of' with MUST_EXIST true, but return a
     list of all the filenames (or NULL if none), instead of taking the
     first.  */
  extern string *kpse_all_path_find_first_of P2H(const_string path,
						 const_string *names);


I'm not entirely happy with the names, but couldn't think of anything
better.

Would you be interested in including these new functions in future
kpathsearch versions?

Thanks,

jwe

-- 
www.octave.org        | Unfortunately we were hopelessly optimistic in 1954
www.che.wisc.edu/~jwe | about the problems of debugging FORTRAN programs.
                      |                                       -- J. Backus


--lYjEjE9FfP
Content-Type: application/octet-stream
Content-Disposition: attachment;
	filename="diffs"
Content-Transfer-Encoding: base64

MjAwMi0xMi0yNiAgSm9obiBXLiBFYXRvbiAgPGp3ZUBiZXZvLmNoZS53aXNjLmVkdT4KCgkqIHBh
dGhzZWFyY2guYyAocGF0aF9maW5kX2ZpcnN0X29mLCBmaW5kX2ZpcnN0X29mLAoJa3BzZV9wYXRo
X2ZpbmRfZmlyc3Rfb2YsIGtwc2VfYWxsX3BhdGhfZmluZF9maXJzdF9vZik6CglOZXcgZnVuY3Rp
b25zLiAKCSogcGF0aHNlYXJjaC5oIChrcHNlX3BhdGhfZmluZF9maXJ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