delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/08/16/12:13:45

From: mchase AT ix DOT netcom DOT com ("Michael A. Chase")
Subject: Re: How to avoid GNU make case sensitivity?
16 Aug 1997 12:13:45 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199708161818.NAA17846.cygnus.gnu-win32@dfw-ix9.ix.netcom.com>
Mime-Version: 1.0
Original-To: "Richard Stanton" <stanton AT haas DOT berkeley DOT edu>, <gnu-win32 AT cygnus DOT com>
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1008.3
X-MimeOle: Produced By Microsoft MimeOLE Engine V4.71.1008.3
Original-Sender: owner-gnu-win32 AT cygnus DOT com

The following script works under sh, ksh, and bash.  One caution, it
doesn't deal with spaces in filenames.

:
# llcase, lucase, lxcase, ulcase, uucase, uxcase, xlcase, xucase, xxcase
# Convert file name case
# The first  character of the script name indicates the base name change
# The second character indicates the extension name change
#    u = force to upper case
#    l = force to lower case
#    [^ul] = leave alone

upper_name=0
lower_name=0
upper_type=0
lower_type=0
base=`basename $0`
case $base in
   u?*) upper_name=1 ;;
   l?*) lower_name=1 ;;
esac
case $base in
   ?u*) upper_type=1 ;;
   ?l*) lower_type=1 ;;
esac

for file in $*
do
   [ ! -f $file ] && continue      # skip non-files
   filepath=`dirname  $file`
   filename=`basename $file`
   basename=$filename
   filetype=`echo $filename | sed -ne 's/^.*\(\.[^\.]*\)$/\1/p'`
   filename=`echo $filename | sed -e  's/^\(.*\)\.[^.]*$/\1/'`
   [ $upper_name = 1 ] && filename=`echo $filename | tr '[a-z]' '[A-Z]'`
   [ $lower_name = 1 ] && filename=`echo $filename | tr '[A-Z]' '[a-z]'`
   [ $upper_type = 1 ] && filetype=`echo $filetype | tr '[a-z]' '[A-Z]'`
   [ $lower_type = 1 ] && filetype=`echo $filetype | tr '[A-Z]' '[a-z]'`
   [ "X$basename" != "X${filename}${filetype}" ] && \
      mv $file ${filepath}/${filename}${filetype}  # skip if name won't
change
done
-----Original Message-----
From: Richard Stanton <stanton AT haas DOT berkeley DOT edu>
To: gnu-win32 AT cygnus DOT com <gnu-win32 AT cygnus DOT com>
Date: Friday, August 15, 1997 01:08
Subject: How to avoid GNU make case sensitivity?



>I have lots of C files on a FAT (DOS style) formatted disk. Now I'm
>running NT, and when I try to use GNU make to compile stuff, it
>doesn't recognize the files' existence, since NT thinks all the
>filenames are upper case. For example, if I type
>
>make test.o
>
>I get an error message about not having a rule to make test.o, when a
>directory listing shows the file TEST.C existing on the
>drive. Renaming it manually to test.c allows me to compile it OK, but
>I'd rather avoid manually renaming every .C file on my system one at a
>time.


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019