This is the mail archive of the cygwin@cygwin.com 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: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Greg Fenton

> --- Max Bowsher <maxb@ukf.net> 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?

Idea:

 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");
  i=0;
  while (*env!=NULL) {
    printf("%2d: \"%s\"\n",i++,*env++);
    }
  return 0;
}
--END OF MESSAGE--


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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