This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Path separator

> From: []On Behalf
> Of Greg Fenton

> --- Max Bowsher <> wrote:
> >
> > No: Cygwin != _WIN32.
> >
> No argument from me here.  :-)
> > A native/Cygwin dual-mode binary sounds like a clever idea, but AFAIK
> > has never been done before, and is probably ridiculously infeasible
> on the balance of work/benefit.

> I don't see that the amount of work is ridiculous at all.  Any portable
> code will have a path-conversion (canonicalization) function in place
> for any and all file system access.  That canonicalization should be
> able to determine the PATH_SEPARATOR for the given environment.

What in particular is it that you wish to do?


 Windows <-link-> DOS
This means that %PATH% contains ':\' characters and ';' separators

 cygwin <-link-> Unix/Linux
Here we have '/' characters and ':' separators in $PATH

 Might it be possible to exploit this?

It won't work by simply reading the environment as cygwin.dll will be in
there, supplying you with the (converted) environment contents.
 To see the difference you neeed to recompile under the other OS.

/Hannu E K Nevalainen, Mariefred, Sweden, 59~14'N, 17~12'E. >17~C avg/d now.
~ <=> degree


 I have not seen 'char **env' _really_ documented -- pointers?

# include <stdio.h>

int main(int argc, char **argv, char **env) {
  int i;

  printf("*** Arg-vector *** %d items \n",argc);
    for (i=0; i<argc; i++)
    printf("%2d: \"%s\"\n",i,*argv++);

  printf("*** Env-vector ***\n");
  while (*env!=NULL) {
    printf("%2d: \"%s\"\n",i++,*env++);
  return 0;

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]