delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/19/02:37:28

Message-Id: <5.1.1.6.2.20021219042514.02872d00@bud.cc.swin.edu.au>
X-Sender: 0652113 AT bud DOT cc DOT swin DOT edu DOT au
X-Mailer: QUALCOMM Windows Eudora Version 5.1.1
Date: Thu, 19 Dec 2002 18:36:50 +1100
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
From: "Jeremy W. Murphy" <jwm AT bud DOT cc DOT swin DOT edu DOT au>
Subject: Re: Which editor, and, install prob with tmp dir
Cc: djgpp AT delorie DOT com
In-Reply-To: <Pine.SUN.3.91.1021218125721.8222D-100000@is>
References: <5 DOT 1 DOT 1 DOT 6 DOT 2 DOT 20021218174514 DOT 028a6ec0 AT bud DOT cc DOT swin DOT edu DOT au>
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019