[OS X TeX] Spaces in file or folder names
Peter Dyballa
Peter_Dyballa at Web.DE
Sat Feb 12 13:13:03 CET 2005
Am 11.02.2005 um 14:10 schrieb Themis Matsoukas:
> On Feb 10, 2005, at 7:09 AM, Maarten Sneep wrote:
>>
>> Just avoid spaces in names that you have to pass to LaTeX. You'll be
>> much happier. Trust me on this.
>
> I disagree - in the 21st century, computers ought to submit to the
> human desire, not limit it...
Well, thinking of the computing power of recent CPUs, this law should
really be easily obeyed. So why is TeX not capable in its I/O routines
to scan a directory, get its file contents, and grep in this set for a
character string with spaces or other so-called strange characters?
Since there are limitations in this simple wish it should work to find
a safe translation for 'unsafe' characters (that could work in both
directions too if needed):
Sample code which searches a directory for entry ``name'' is:
len = strlen(name);
dirp = opendir(".");
while ((dp = readdir(dirp)) != NULL)
if (dp->d_namlen == len && !strcmp(dp->d_name,
name)) {
(void)closedir(dirp);
return FOUND;
}
(void)closedir(dirp);
return NOT_FOUND;
(as you can find in 'man readdir' too). But it's in TeX: TeX has
problems to handle the more complicated file names. So why not map a
read channel, analogous to \write16 etc, to a file descriptor as used
in the C source code, an abstract item of a very simple name? The log
file writing routine would then substitute the file descriptor with its
associated file name as contained in the dirent struct to make its
output readable for us humans ...
Total cost: less than a millisecond.
--
Greetings
Pete
Time flies like an error
but fruitflies like a banana
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the macostex-archives
mailing list