summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/fixproto
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
committerobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
commit0bedf4fb30066e5e1d4342a1d3914dae7d37cba7 (patch)
tree68d8110b41afd0ebbf39167b1a4918eea667a7c5 /contrib/gcc/fixproto
parentd4db5fb866b7ad5216abd5047774a3973b9901a9 (diff)
downloadFreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.zip
FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.tar.gz
Virgin import of gcc from EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/fixproto')
-rwxr-xr-xcontrib/gcc/fixproto35
1 files changed, 28 insertions, 7 deletions
diff --git a/contrib/gcc/fixproto b/contrib/gcc/fixproto
index 79c8dfc..cd495e6 100755
--- a/contrib/gcc/fixproto
+++ b/contrib/gcc/fixproto
@@ -65,7 +65,7 @@ if [ `echo $1 | wc -w` = 0 ] ; then
exit 1
fi
-std_files="ctype.h dirent.h errno.h curses.h fcntl.h grp.h locale.h math.h pwd.h setjmp.h signal.h stdio.h stdlib.h string.h sys/stat.h sys/times.h sys/resource.h sys/utsname.h sys/wait.h tar.h termios.h time.h unistd.h"
+std_files="ctype.h dirent.h errno.h curses.h fcntl.h grp.h locale.h math.h pwd.h setjmp.h signal.h stdio.h stdlib.h string.h sys/socket.h sys/stat.h sys/times.h sys/resource.h sys/utsname.h sys/wait.h tar.h termios.h time.h unistd.h utime.h"
rel_target_dir=$1
# All files in $src_dir_all (normally same as $rel_target_dir) are
@@ -120,6 +120,7 @@ required_stdlib_h="abort abs atexit atof atoi atol bsearch calloc exit free gete
required_unistd_h="_exit access alarm chdir chown close ctermid cuserid dup dup2 execl execle execlp execv execve execvp fork fpathconf getcwd getegid geteuid getgid getlogin getopt getpgrp getpid getppid getuid isatty link lseek pathconf pause pipe read rmdir setgid setpgid setsid setuid sleep sysconf tcgetpgrp tcsetpgrp ttyname unlink write"
done_dirs=""
+subdirs_made=""
echo "" >fixproto.list
for code in ALL STD ; do
@@ -142,7 +143,7 @@ for code in ALL STD ; do
# for C++, so skip those.
subdirs="$subdirs "`cd $rel_source_dir/$d; find . -type d -print | \
sed -e '/^\.$/d' -e "s|^\./|${d}/|" -e 's|^\./||' \
- -e '/CC$/d' -e '/\+\+/d'`
+ -e '/CC$/d' -e '/[+][+]/d'`
links=
links=`cd $rel_source_dir; find $d/. -type l -print | \
sed -e "s|$d/./|$d/|" -e 's|^\./||'`
@@ -174,7 +175,9 @@ for code in ALL STD ; do
abs_target_subdir=${abs_target_dir}/${rel_source_subdir}
if [ \! -d $abs_target_subdir ] ; then
- mkdir $abs_target_subdir
+ if mkdir $abs_target_subdir ; then
+ subdirs_made="$abs_target_subdir $subdirs_made"
+ fi
fi
# Append "/"; remove initial "./". Hence "." -> "" and "sys" -> "sys/".
rel_source_prefix=`echo $rel_source_subdir | sed -e 's|$|/|' -e 's|^./||'`
@@ -199,7 +202,9 @@ for code in ALL STD ; do
# Create the dir where this file will go when fixed.
xxdir=`echo ./$file | sed -e 's|/[^/]*$||'`
if [ \! -d $abs_target_subdir/$xxdir ] ; then
- mkdir $abs_target_subdir/$xxdir
+ if mkdir $abs_target_subdir/$xxdir ; then
+ subdirs_made="$abs_target_subdir/$xxdir $subdirs_made"
+ fi
fi
# Just in case we have edited out a symbolic link
if [ -f $src_dir_std/$file -a -f $src_dir_std/$xxfile ] ; then
@@ -262,12 +267,28 @@ do
rel_source_ident=`echo $rel_source_file | tr ./ __`
required_list=`eval echo '${required_'${rel_source_ident}'-}'`
cat >tmp.h <<EOF
-#ifndef ${rel_source_ident}
-#define ${rel_source_ident}
-#endif
+#ifndef __${rel_source_ident}
+#define __${rel_source_ident}
+EOF
+ if test $rel_source_file = stdlib.h
+ then
+ # Make sure it contains a definition of size_t.
+ cat >>tmp.h <<EOF
+
+#define __need_size_t
+#include <stddef.h>
+EOF
+ fi
+ cat >>tmp.h <<EOF
+
+#endif /* __${rel_source_ident} */
EOF
${FIX_HEADER} $rel_source_file tmp.h $abs_target_dir/$rel_source_file ${DEFINES} $include_path
rm tmp.h
fi
done
+
+# Remove any directories that we made that are still empty.
+rmdir $subdirs_made 2>/dev/null
+
exit 0
OpenPOWER on IntegriCloud