Finding exact case of paths

Igor Pechtchanski pechtcha@cs.nyu.edu
Fri Sep 13 01:12:00 GMT 2002


On Thu, 12 Sep 2002, Igor Pechtchanski wrote:

> On Thu, 12 Sep 2002, Igor Pechtchanski wrote:
> > On a separate note, I found that "cygpath -l -w <path>" does not work on
> > my Win2k SP2 system, returning the same garbage (hex 20 FB 22 0a)
> > regardless of the path.  Anyone else have that problem?
>
> Well, after further reading of the code and experimenting I've determined
> two things:
> 1) the '-l' option of cygpath works in the cvs HEAD, and
> 2) it does exactly what we need (thanks, Corinna).
>
> So we can use $(cygpath -u $(cygpath -l -w "$WINETC/$WFILE")) in the
> script.  This would require people to upgrade to the new cygpath (which
> they would have to anyway, if they were to use the option we proposed),
> which means that this script can not be released before the next cygwin,
> but that is probably fine.  New version and diff attached.
>         Igor
> P.S. I'm racking my brain trying to figure out why -l didn't work for me
> in version 1.21 of cygpath, but did in version 1.22.  As far as I could
> see, the only changes to cygpath were some added newlines...

Whoops, forgot to quote the strings.  Better correct it.  New version
attached.
As for the '-l' in 1.21 issue, there were changes to newlib which have
probably fixed some string bug that caused this.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file
-------------- next part --------------
#!/bin/sh
#--
# Create symbolic links from some /etc files to the Windows equivalents
#--

FILES="hosts protocols services networks"

OSNAME="`/bin/uname -s`"
WINHOME="`/bin/cygpath -W`"

case "$OSNAME" in
  CYGWIN_NT*) WINETC="$WINHOME/system32/drivers/etc" ;;
  CYGWIN_9*|CYGWIN_ME*) WINETC="$WINHOME" ;;
  *) 
    echo "Unknown system type $OSNAME; exiting" >&2
    exit 0
  ;;
esac

if [ ! -d "$WINETC" ]
then
  echo "Directory $WINETC does not exist; exiting" >&2
  exit 0
fi

for FILE in $FILES
do
  if [ ! -e "/etc/$FILE" -a ! -L "/etc/$FILE" ]
  then
    # Windows only uses the first 8 characters
    WFILE="$WINETC/`expr substr "$FILE" 1 8`"
    WFILE="$(cygpath -u "$(cygpath -w -l "$WFILE")")"
    /bin/ln -s -v "$WFILE" "/etc/$FILE"
  fi
done


-------------- next part --------------
--- make-etc-links.sh-0.8	2002-09-12 22:37:16.000000000 -0400
+++ make-etc-links.sh	2002-09-12 23:05:43.000000000 -0400
@@ -5,8 +5,8 @@
 
 FILES="hosts protocols services networks"
 
-OSNAME=`/bin/uname -s`
-WINHOME=`/bin/cygpath -W`
+OSNAME="`/bin/uname -s`"
+WINHOME="`/bin/cygpath -W`"
 
 case "$OSNAME" in
   CYGWIN_NT*) WINETC="$WINHOME/system32/drivers/etc" ;;
@@ -28,8 +28,8 @@ do
   if [ ! -e "/etc/$FILE" -a ! -L "/etc/$FILE" ]
   then
     # Windows only uses the first 8 characters
-    WFILE="$WINETC/"`expr substr "$FILE" 1 8`
-    WFILE=$(cygpath -u "$(cygpath -w -l "$WFILE")")
+    WFILE="$WINETC/`expr substr "$FILE" 1 8`"
+    WFILE="$(cygpath -u "$(cygpath -w -l "$WFILE")")"
     /bin/ln -s -v "$WFILE" "/etc/$FILE"
   fi
 done
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list