#
# You should have received a copy of the GNU General Public License
# along with GNU CC; see the file COPYING. If not, write to
-# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
#
# This script munges the native include files provided with Windows NT
# 3.5 SDK systems so as to provide a reasonable namespace when
# compiling with gcc. The header files by default do not
# provide many essential definitions and declarations if
# __STDC__ is 1. This script modifies the header files to check
-# for __STRICT_ANSI__ being defined instead. However the most
-# important modification is to change all occurences of __stdcall
-# and __cdecl to __attribute__((stdcall)) and __attribute__((cdecl)),
-# respectively. Once munged, the
+# for __STRICT_ANSI__ being defined instead. Once munged, the
# resulting new system include files are placed in a directory
-# that GNU C will search *before* searching the /mstools/h
-# directory. This script should work properly for an /mstools/h
-# directory dated 9/4/94 on the installation CDROM.
+# that GNU C will search *before* searching the Include
+# directory.
#
# See README-fixinc for more information.
+ORIG_DIR=`pwd`
+
# Directory containing the original header files.
-INPUT=${2-${INPUT-/mstools/h}}
+cd $2; SEDFILE=`${PWDCMD-pwd}`/fixinc-nt.sed
+echo $SEDFILE
+if [ ! -f $SEDFILE ]
+then echo fixincludes: sed script 'fixinc-nt.sed' not found
+exit 1
+fi
+echo 'Using sed script: ' ${SEDFILE}
+
+cd $ORIG_DIR
+
+INPUT=${INCLUDE}
+echo 'Using the Include environment variable to find header files to fix'
# Fail if no arg to specify a directory for the output.
if [ x$1 = x ]
echo 'Checking header files:'
for file in $files; do
echo $file
- if egrep "!__STDC__|__stdcall|__cdecl" $file >NUL; then
+ if egrep "!__STDC__" $file >NUL; then
if [ -r $file ]; then
cp $file $2/$file >NUL 2>&1 || echo "Can't copy $file"
chmod +w,a+r $2/$file
sed -e '
s/!__STDC__/!defined (__STRICT_ANSI__)/g
- s/__stdcall/__attribute__((stdcall))/g
- s/__cdecl/__attribute__((cdecl))/g
' $2/$file > $2/$file.sed
mv $2/$file.sed $2/$file
if cmp $file $2/$file >NUL 2>&1; then