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: Switching between DOS and UNIX mode


> From: Elberger, Richard A.
> Sent: Friday, January 09, 2004 6:02 PM

> I am looking to have "switchability" between UNIX mode and DOS mode in
> cygwin (the choice during the installation).  We install all of our
> cygwin installations in UNIX mode.

 A good choice ;-) - my personal opinion.

> A subset of our developers use Windows-based editors. We use the cygwin
> cvs to checkout files from a remote repository.
>
> For some reason, this hiccups the windows editors -- probably CR/LFs.

 Moving the files to a text based mount might just as well move the "hiccup"
from the editor to some other place; e.g. make or gcc.
 IMO this is a "tricky corner" to be in. It happens just because of the
mixed environment of cygwin and windows as a combination - and having EOL
conventions differ.

> Is there a way to "switch" to DOS mode either through setting a variable
> in local shell, .profile, or some config file in /etc?

 I wouldn't expect so. Only possible way might be text mounts, but that has
limitations too...

 May I suggest that persons, preferring an Windows-based editor, take
actions to launch such an editor from a bash script like this (note
UNTESTED!):

-- wed -- (i.e. Windows EDitor)
#!/bin/bash
#Quick and Simple version: assuming ONE filename as argument
# and no problems WRT multiple people attempting to edit same file.

EDITOR="notepad"
file="$1"

if [ -z "`which $EDITOR`" ] ;then
  echo "$EDITOR is not in \$PATH"
else
  cmd="`cygpath -w $EDITOR` `cygpath -w $file`"
  u2d "$file"
  cmd /c $cmd
  d2u "$file"
fi
-- eof --

Assumed benefit: Keep all files in UNIX EOL mode at all times, except when
they're actually edited by use of u2d/d2u.

Culprit: Editor saves files in CRLF mode, making stuff misbehave _while the
editor is still running_ . This is asynchronous, remember.

Fix(?): run the "d2u" utility as soon as the file is to be used, e.g. in a
makefile.
...or an example at a more complex level: create/maintain a list of files
"currently being edited" in the script above. Then have the makefile use
that list as argument to "d2u" just before use.

My experience, from some twenty years being in a similar sitiation, is that:
It will always require 'self discipline' from the people using Win-editors
for cygwin files. Independent of the measures you take to avoid it and/or
protect from it.
A saying in Swedish "Hur du an vander dig sa har du andan dar bak"
(something like "No matter how you turn, your bottom is still behind you" in
translation)


/Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E

** on a mailing list; please keep replies on that particular list **

-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--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]