Change all uses of EX to SED.

From-SVN: r3355
This commit is contained in:
Jim Wilson 1993-01-26 15:29:45 -08:00
parent d58913603f
commit e13502d79c
1 changed files with 151 additions and 198 deletions

View File

@ -63,15 +63,6 @@ case $LIB in
;; ;;
esac esac
# This prevents /bin/ex from failing if the current terminal type is
# unrecognizable.
TERM=dumb
export TERM
# This prevents /bin/ex from failing if the EXINIT environment variable
# was set to something invalid.
EXINIT=""
export EXINIT
echo 'Building fixincludes in ' ${LIB} echo 'Building fixincludes in ' ${LIB}
# Determine whether this filesystem has symbolic links. # Determine whether this filesystem has symbolic links.
@ -279,28 +270,24 @@ if [ \! -z "$file_to_fix" ]; then
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
chmod a+r /tmp/$base chmod a+r /tmp/$base
ex /tmp/$base <<EOF sed -e '/^#define[ ]*NULL[ ]*0$/c\
/^#define[ ]*NULL[ ]*0$/c #ifndef NULL\
#ifndef NULL #ifdef __cplusplus\
#ifdef __cplusplus #define __NULL_TYPE\
#define __NULL_TYPE #else /* !defined(__cplusplus) */\
#else /* !defined(__cplusplus) */ #define __NULL_TYPE (void *)\
#define __NULL_TYPE (void *) #endif /* !defined(__cplusplus) */\
#endif /* !defined(__cplusplus) */ #define NULL (__NULL_TYPE 0)\
#define NULL (__NULL_TYPE 0) #endif /* !defined(NULL) */' /tmp/$base > /tmp/$base.sed
#endif /* !defined(NULL) */ if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Likewise fix the definition of NULL in <stdio.h> so that it is conditional # Likewise fix the definition of NULL in <stdio.h> so that it is conditional
@ -321,26 +308,22 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^#define[ ]*NULL[ ]*0$/c\
/^#define[ ]*NULL[ ]*0$/c #ifdef __cplusplus\
#ifdef __cplusplus #define __NULL_TYPE\
#define __NULL_TYPE #else /* !defined(__cplusplus) */\
#else /* !defined(__cplusplus) */ #define __NULL_TYPE (void *)\
#define __NULL_TYPE (void *) #endif /* !defined(__cplusplus) */\
#endif /* !defined(__cplusplus) */ #define NULL (__NULL_TYPE 0)' /tmp/$base > /tmp/$base.sed
#define NULL (__NULL_TYPE 0) if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Likewise fix the definition of NULL in <dbm.h> so that it is conditional # Likewise fix the definition of NULL in <dbm.h> so that it is conditional
@ -361,28 +344,24 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^#define[ ]*NULL[ ]*((char \*) 0)$/c\
/^#define[ ]*NULL[ ]*((char \*) 0)$/c #ifndef NULL\
#ifndef NULL #ifdef __cplusplus\
#ifdef __cplusplus #define __NULL_TYPE\
#define __NULL_TYPE #else /* !defined(__cplusplus) */\
#else /* !defined(__cplusplus) */ #define __NULL_TYPE (void *)\
#define __NULL_TYPE (void *) #endif /* !defined(__cplusplus) */\
#endif /* !defined(__cplusplus) */ #define NULL (__NULL_TYPE 0)\
#define NULL (__NULL_TYPE 0) #endif /* !defined(NULL) */' /tmp/$base > /tmp/$base.sed
#endif /* !defined(NULL) */ if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Add a prototyped declaration of mmap to <sys/mman.h>. # Add a prototyped declaration of mmap to <sys/mman.h>.
@ -402,26 +381,22 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^extern caddr_t mmap();$/c\
/^extern caddr_t mmap();$/c #ifdef __STDC__\
#ifdef __STDC__ extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags,\
extern caddr_t mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off);\
int fd, off_t off); #else /* !defined(__STDC__) */\
#else /* !defined(__STDC__) */ extern caddr_t mmap ();\
extern caddr_t mmap (); #endif /* !defined(__STDC__) */' /tmp/$base > /tmp/$base.sed
#endif /* !defined(__STDC__) */ if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Fix declarations of `ftw' and `nftw' in <ftw.h>. # Fix declarations of `ftw' and `nftw' in <ftw.h>.
@ -441,48 +416,42 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^extern int ftw(const/c\
/^extern int ftw(const/c #if !defined(_STYPES)\
#if !defined(_STYPES) static\
static #else\
#else extern\
extern #endif\
#endif int ftw(const char *, int (*)(const char *, const struct stat *, int), int);' \
int ftw(const char *, int (*)(const char *, const struct stat *, int), int); -e '/^extern int nftw/c\
. #if defined(_STYPES)\
/^extern int nftw/c static\
#if defined(_STYPES) #else\
static extern\
#else #endif\
extern int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int);' \
#endif -e '/^extern int ftw(),/c\
int nftw(const char *, int (*)(const char *, const struct stat *, int, struct FTW *),int, int); #if !defined(_STYPES)\
. static\
/^extern int ftw(),/c #else\
#if !defined(_STYPES) extern\
static #endif\
#else int ftw();\
extern #if defined(_STYPES)\
#endif static\
int ftw(); #else\
#if defined(_STYPES) extern\
static #endif\
#else int nftw();' /tmp/$base > /tmp/$base.sed
extern if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
#endif
int nftw();
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Add a `static' declaration of `getrnge' into <regexp.h>. # Add a `static' declaration of `getrnge' into <regexp.h>.
@ -509,24 +478,20 @@ if [ \! -z "$file_to_fix" ]; then
else else
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^static int[ ]*size;/c\
/^static int[ ]*size;/c static int size ;\
static int size ; \
static int getrnge ();' /tmp/$base > /tmp/$base.sed
static int getrnge (); if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Disable apparent native compiler optimization cruft in SVR4.2 <string.h> # Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
@ -548,19 +513,16 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e 'g/#define.*__std_hdr_/d' /tmp/$base > /tmp/$base.sed
g/#define.*__std_hdr_/d if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Add a #define of _SIGACTION_ into <sys/signal.h>. # Add a #define of _SIGACTION_ into <sys/signal.h>.
@ -581,23 +543,19 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^struct sigaction {/c\
/^struct sigaction {/c #define _SIGACTION_\
#define _SIGACTION_ struct sigaction {' \
struct sigaction { -e '1,$s/(void *(\*)())/(void (*)(int))/' /tmp/$base > /tmp/$base.sed
. if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
1,\$s/(void *(\*)())/(void (*)(int))/
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>. # Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
@ -617,36 +575,27 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^dev_t makedev(const/c\
/^dev_t makedev(const/c static dev_t makedev(const major_t, const minor_t);' \
static dev_t makedev(const major_t, const minor_t); -e '/^dev_t makedev()/c\
. static dev_t makedev();' \
/^dev_t makedev()/c -e '/^major_t major(const/c\
static dev_t makedev(); static major_t major(const dev_t);' \
. -e '/^major_t major()/c\
/^major_t major(const/c static major_t major();' \
static major_t major(const dev_t); -e '/^minor_t minor(const/c\
. static minor_t minor(const dev_t);' \
/^major_t major()/c -e '/^minor_t minor()/c\
static major_t major(); static minor_t minor();' /tmp/$base > /tmp/$base.sed
. if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
/^minor_t minor(const/c
static minor_t minor(const dev_t);
.
/^minor_t minor()/c
static minor_t minor();
.
wq
EOF
if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \
true true
else else
echo Fixed $file_to_fix echo Fixed $file_to_fix
rm -f ${LIB}/$file rm -f ${LIB}/$file
cp /tmp/$base ${LIB}/$file cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file chmod a+r ${LIB}/$file
fi fi
rm -f /tmp/$base rm -f /tmp/$base /tmp/$base.sed
fi fi
# Fix reference to NMSZ in <sys/adv.h>. # Fix reference to NMSZ in <sys/adv.h>.
@ -1126,46 +1075,50 @@ if [ \! -z "$file_to_fix" ]; then
echo Checking $file_to_fix echo Checking $file_to_fix
cp $file_to_fix /tmp/$base cp $file_to_fix /tmp/$base
chmod +w /tmp/$base chmod +w /tmp/$base
ex /tmp/$base <<EOF sed -e '/^stat(/{
/^stat(/ N
s/(.*$/(/ N
j s/(.*)\n/( /
s/;/,/ s/;\n/, /
j s/;$/)/
s/;/)/ }' \
/^lstat(/ -e '/^lstat(/{
s/(.*$/(/ N
j N
s/;/,/ s/(.*)\n/( /
j s/;\n/, /
s/;/)/ s/;$/)/
/^fstat(/ }' \
s/(.*$/(/ -e '/^fstat(/{
j N
s/;/,/ N
j s/(.*)\n/( /
s/;/)/ s/;\n/, /
/^mknod(/ s/;$/)/
s/(.*$/(/ }' \
j -e '/^mknod(/{
s/;/,/ N
j N
s/;/,/ N
j s/(.*)\n/( /
s/;/)/ s/;\n/, /g
1,\$s/\([^A-Za-z]\)path\([^A-Za-z]\)/\1__path\2/g s/;$/)/
1,\$s/\([^A-Za-z]\)buf\([^A-Za-z]\)/\1__buf\2/g }' \
1,\$s/\([^A-Za-z]\)fd\([^A-Za-z]\)/\1__fd\2/g -e '1,$s/\([^A-Za-z]\)path\([^A-Za-z]\)/\1__path\2/g' \
1,\$s/ret\([^u]\)/__ret\1/g -e '1,$s/\([^A-Za-z]\)buf\([^A-Za-z]\)/\1__buf\2/g' \
1,\$s/\([^_]\)mode\([^_]\)/\1__mode\2/g -e '1,$s/\([^A-Za-z]\)fd\([^A-Za-z]\)/\1__fd\2/g' \
1,\$s/\([^_r]\)dev\([^_]\)/\1__dev\2/g -e '1,$s/ret\([^u]\)/__ret\1/g' \
wq -e '1,$s/\([^_]\)mode\([^_]\)/\1__mode\2/g' \
EOF -e '1,$s/\([^_r]\)dev\([^_]\)/\1__dev\2/g' /tmp/$base > /tmp/$base.sed
echo Fixed $file_to_fix if cmp $file_to_fix /tmp/$base.sed >/dev/null 2>&1; then \
rm -f ${LIB}/$file true
cp /tmp/$base ${LIB}/$file else
chmod a+r ${LIB}/$file echo Fixed $file_to_fix
rm -f /tmp/$base rm -f ${LIB}/$file
cp /tmp/$base.sed ${LIB}/$file
chmod a+r ${LIB}/$file
fi
rm -f /tmp/$base /tmp/$base.sed
fi fi
# Sony NEWSOS 5.0 does not support the complete ANSI C standard. # Sony NEWSOS 5.0 does not support the complete ANSI C standard.