On 09-Apr-06 Larry Kollar wrote:
Sourcing a file like this:
.so ~/Library/XSL/html2ms.xsl
Using either straight groff or soelim, I get the message:
./single.ms:207: can't open `~/Library/XSL/html2ms.xsl': No such file
or directory
It works with an explicit path. Is this a bug or a feature?
Neither! The "~" character is a "shell special", and depends on
the shell for "tilde expansion" [I'm talking Unix/Linux here;
I have no idea how Windows handles this sort of thing, if at all];
for example. "man bash" says:
Tilde Expansion
If a word begins with an unquoted tilde character (`~'),
all of the characters preceding the first unquoted slash
(or all characters, if there is no unquoted slash) are
considered a tilde-prefix. If none of the characters in
the tilde-prefix are quoted, the characters in the tilde-
prefix following the tilde are treated as a possible login
name. If this login name is the null string, the tilde is
replaced with the value of the shell parameter HOME. If
HOME is unset, the home directory of the user executing
the shell is substituted instead. Otherwise, the tilde-
prefix is replaced with the home directory associated with
the specified login name.
So when such a thing is processed by the shell (in a command line
or a shell script), the above expansion takes place.
However (though without checking) I should think that when any
of the 'groff' programs executes code which references a filename,
it goes straight to the kernel for the file (and I know from
C experience that the default "root" for names not beginning
with "/" is the working directory), and bypasses the shell.
Hence in
.so ~/Library/XSL/html2ms.xsl
the "~" is not expanded by the shell (since the shell does not
see the line) and so the kernel looks for a directory named "~"
in the working directory, fails to find it, and reports as such.
I think the is correct in principle, though I'm not sure about
some of the implied detail.
Best wishes,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 09-Apr-06 Time: 08:45:34
------------------------------ XFMail ------------------------------
_______________________________________________
Groff mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/groff