Keith MARSHALL wrote:
I wonder if it exists a script capable of transforming a mingw
path to a windows path with respect to the fstab file.

For example the script would transform :
  /c/foobar         into   c:\foobar
  /myMountingPoint  into   c:\foobar\myMountingPoint

if one can see "c:\foobar\myMountingPoint /myMountingPoint" in
fstab file.

  (cd /c/foobar && pwd -W)

will give you the Windows path for /c/foobar, IRRESPECTIVE of what
is in /etc/fstab, PROVIDED /c/foobar exists as a directory.

  awk '$2 == "/c/foobar" { print $1 }' /etc/fstab

will extract the Windows path for /c/foobar's mount point, if it is
defined in /etc/fstab.

If you want something more robust, which can transform ANY path from
MSYS to Windows semantics, relative to the MSYS virtual root, even if
the MSYS path refers to a file, or to a nonexistent directory, here's
a shell fragment I'm using in my autoconf scripts:

<script name=win32path>
 # Usage: win32path msyspath
 pwd -W >/dev/null 2>&1 && ac_pwd_w="pwd -W" || ac_pwd_w=pwd
 until ac_val=`exec 2>/dev/null; cd "$ac_dir" && $ac_pwd_w`
   ac_dir=`dirname "$ac_dir"`
 ac_dir=`echo "$ac_dir" | sed 's?^[./]*??'`
 ac_val=`echo "$ac_val" | sed 's?/*$??'`
 echo "$1" | sed -e "s?^[./]*$ac_dir/*?$ac_val/?" -e 's?/*$??'

(Take care with the quoting in that final sed command; the first
 -e expression MUST be in DOUBLE quotes, the second in SINGLE).

You may find these return a Windows path with slashes, rather than
backslashes, but that's mostly ok -- Windows doesn't care, UNLESS you
are passing the path to some assinine MS command line application,
which insists on the backslashes.  In that case, filter the path
generated by any of the above techniques through "tr / '\\'", e.g.

  (cd /c/foobar && pwd -W) | tr / '\\'



SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement *
Mingw-msys mailing list
Thank you very much everybody!
It fits perfectly my needs for my

Have a nice day