Mail Archives: djgpp/2002/12/19/02:37:28
At 10:11 PM 18/12/2002, Eli Zaretskii wrote:
> > dir: c\:/djgpp/tmp/dj500000: No such file or directory (ENOENT)
>And I'm guessing that the backslash is not a real one: it's added by
>`dir.exe' for semi-cosmetic purposes, namely, if you want to pass the
>message printed by `dir.exe' to some Bash command, it's a good idea to
>escape the colon, since otherwise that other Bash command might fail.
Yes, I believe you're right about the "c\:".
>If you want to invoke the command.com's `dir', try creating the command
>you pass to `system' like this:
>
> sprintf(buf, "command.com /c dir %s", n);
>
>(Btw, the subtleties of the `system' operation are described in great
>detail in the DJGPP libc reference; I suggest to read that if you didn't
>already.)
`dir' was just for the sake of example - this all came about because I am
trying to compile Atlas, and the `config' program is failing to run `uname'
with this error even _after_ I unset SHELL!
system("uname -s > c:\djgpp\tmp/dj710000 2>&1");
c:\djgpp\tmp/dj910000: c:djgpptmp/dj710000: No such file or directory (ENOENT)
I won't worry about a detailed investigation of this until I sort out the
following simpler problem.
>Given that the issue of the backslash before the colon is understood,
>what problem(s) are left that you don't know how to solve?
Why the exported environment variable TMPDIR is set with forward-slashes,
yet getenv() returns it with back-slashes.
marlborough#1(c:/djgpp)$ echo $HOME
C:/djgpp
marlborough#1(c:/djgpp)$ grep TMPDIR djgpp.env .bash*
djgpp.env:+TMPDIR=%DJDIR%/tmp
djgpp.env:+GROFF_TMPDIR=%DJDIR%/tmp
djgpp.env:+GROFF_TMPDIR=%TMPDIR%
.bashrc: TMPDIR="${DJDIR}/tmp"
.bashrc: export CVSROOT EDITOR TMPDIR
marlborough#1(c:/djgpp/src)$ export|grep TMPDIR
declare -x TMPDIR="c:/djgpp/tmp"
marlborough#1(c:/djgpp)$ cat test_getenv.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
puts(getenv("TMPDIR"));
return 0;
}
marlborough#1(c:/djgpp)$ gcc -o test_getenv test_getenv.c -W -Wall -O2 &&
./test_getenv.exe
c:\djgpp\tmp
>You should strive to have them forward-slashed if your SHELL variable
>points to Bash, back-slashed otherwise.
As you can see above, I do strive to have them forward-slashed, but
something is working against me! As I said in a previous message, if I
explicitly set TMPDIR in djgpp.env, getenv() will return whatever it was
set to, which is a work-around for TMPDIR, but not a complete solution and
doesn't fix the `problem'. Phew, so have I explained myself clearly
now? :) Thanks for your help in this.
Jeremy
- Raw text -