This is the mail archive of the cygwin 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: PATHEXT is fundamental to Windows and Should be recognised by CYGWIN

> > Problem 1:  Cygwin does not support PATHEXT and really should.
> No, it should not. Cygwin is a POSIX environment, and it uses POSIX
> conventions to determine if a file is executable somehow.
> > PATHEXT is as fundamental component of Windows program execution as
> PATHEXT is a shell (CMD) extension. Some programs do make use of it,
> notable file managers and CMD replacements do, but overall, this is a
> mechanism of finding the file to execute, not of executing it per se.
> You can write your own extension to bash-completion "file-not-found"
> handler, if you so desire.
[Bill Smith] 

A couple of years ago I was involved with porting a very large code base of makefiles
& shell scripts to work with Cygwin.  In our environment, the main issue was shell scripts calling 
*.bat files without the .bat suffix because of the $PATHEXT.  The fix was to change 



where ${BAT} would be set to .bat on Windows.

Another option available was to create wrapper shell script.  So I would create a script named "somescript"
that is only in $PATH on Windows and it would look something like this:

adaptman.bat "$@"

Granted our *.bat files are simple and don't have to worry about arguments with spaces.

> > Problem 2:  Cygwin does not support CR-LF delimiters.
> Cygwin, in this case, is a library (newlib), and it doesn't care about delimiters.
> This is an application's choice and right to support various EOL's or not.
> > For the same reason, it is unfortunate that CYGWIN/bash does not cope

[Bill Smith] 

You can tell bash to ignore carriage returns in scripts by doing the following:

set -o igncr

> > I have been using and developing system software within Unix since
> > 1974 and Windows since the mid-80's.  in more recent years (since the
> > mid-90's) I have developed extensive sets of tools (sh/awk/etc..) for
> > corporate and public sector clients - on the order of 100,000 lines of
> > code for representative projects.  Most had to run under both Solaris
> > and Windows environments for which I used the MKS toolkit.
> And they do run fine, as long as you are not making stupid mistakes, like
> using bogus EOL terminators and expecting the program to work equally on
> different systems.
[Bill Smith] 
Agreed.  If you need advice on porting scripts to work both in Cygwin and MKS, feel free
to send me email.   

Problem reports:
Unsubscribe info:

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