[comp.sources.unix] v20i001: POSIX 1003.1 #include file tester

rsalz@uunet.uu.net (Rich Salz) (09/19/89)

Submitted-by: aixsm!bbooks@uunet.UU.NET (Barry Books)
Posting-number: Volume 20, Issue 1
Archive-name: posix.h-tester

This test sorts thru the POSIX and ANSI include files and reports missing
items, additional items in the standard, additional items allowed by the
standard, and items not allowed by the standard.  References to the
standards document are included in the source code and the report.

The test assumes a traditional implementation of include files and
requires two things not stated  in the POSIX  standard or the ANSI C ( Dec
1988 ).  The first is the include files must be readable.  This is the
case for almost all installations I know of ( even the ones with
precompiled include files have readable ones also ).  The other is the -E
option to the C compiler.  This option is available on most UNIX C
compilers and possibly others.  This option runs only the C preprocessor
and writes the results to stdout.  If your compiler does not support this
option I suggest getting one the public domain C preprocessors such as
GNU.


# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
# Then read the README and WARRANTY files.
# Contents:  include/ include/inc/ include/structs/ include/types/
#	include/WARRANTY include/defines include/defines.awk include/catinc
#	include/squash include/catinc.awk include/inc/dirent include/inc/errno
#	include/inc/fcntl include/inc/grp include/inc/limits include/inc/pwd
#	include/inc/signal include/inc/stdio include/inc/termios
#	include/inc/unistd include/inc/utime include/inc/stat include/inc/times
#	include/inc/types include/inc/utsname include/inc/wait
#	include/inc/assert include/inc/ctype include/inc/float
#	include/inc/locale include/inc/math include/inc/setjmp
#	include/inc/stdarg include/inc/stddef include/inc/stdlib
#	include/inc/string include/inc/time include/inc/tar include/testinc
#	include/README include/report include/incfiles include/files
#	include/struct include/struct.awk include/functions
#	include/structs/assert include/structs/ctype include/structs/dirent
#	include/structs/errno include/structs/fcntl include/structs/float
#	include/structs/grp include/structs/limits include/structs/locale
#	include/structs/math include/structs/pwd include/structs/setjmp
#	include/structs/signal include/structs/stat include/structs/stdarg
#	include/structs/stddef include/structs/stdio include/structs/stdlib
#	include/structs/string include/structs/tar include/structs/termios
#	include/structs/time include/structs/times include/structs/types
#	include/structs/unistd include/structs/utime include/structs/utsname
#	include/structs/wait include/structs/grp.h include/structs/locale.h
#	include/structs/pwd.c include/structs/stdlib.h include/report.str.awk
#	include/struct1.awk include/types/assert include/types/ctype
#	include/types/dirent include/types/errno include/types/fcntl
#	include/types/float include/types/grp include/types/limits
#	include/types/locale include/types/math include/types/pwd
#	include/types/setjmp include/types/signal include/types/stat
#	include/types/stdarg include/types/stddef include/types/stdio
#	include/types/stdlib include/types/string include/types/tar
#	include/types/termios include/types/time include/types/times
#	include/types/types include/types/unistd include/types/utime
#	include/types/utsname include/types/wait include/typedef
#	include/typedef.awk include/ctypes include/report.t include/tr.testrig
 
echo mkdir - include
mkdir include
chmod u=rwx,g=rx,o=rx include
 
echo x - include/WARRANTY
sed 's/^@//' > "include/WARRANTY" <<'@//E*O*F include/WARRANTY//'

                             NOTICE STATEMENT

       This code was developed by IBM Corporation.  Copyright is
       disclaimed.

                           WARRANTY DISCLAIMER

       THE CODE AND ITS DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
       WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED.  THE ENTIRE
       RISK AS TO THE QUALITY AND PERFORMANCE OF THE CODE IS WITH
       THE USER.  SHOULD THE CODE PROVE DEFECTIVE, THE USER (AND
       NOT IBM) ASSUMES THE ENTIRE COST OF ALL NECESSARY SERVICING,
       REPAIR OR CORRECTION.

       IBM does not warrant that the function contained in the code
       will meet the user's requirements or that the operation of
       the code will be uninterrupted or error free or that code
       defects will be corrected.

       IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE AND
       DOCUMENTATION, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
       LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
       FITNESS FOR A PARTICULAR PURPOSE.

       IN NO EVENT WILL IBM BE LIABLE FOR ANY ACTUAL DAMAGES FOR
       ANY CAUSE WHATSOEVER, NOR WILL IBM BE LIABLE FOR ANY LOST
       PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL
       DAMAGES ARISING OUT OF THE USE OF OR INABILITY TO USE THE
       CODE OR DOCUMENTATION EVEN IF IBM HAS BEEN ADVISED OF THE
       POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER
       PARTY.

       Nothing contained herein shall be construed as granting
       permission to use IBM's trademark or trade name in
       connection with any advertising or publicity pertaining
       directly or indirectly to the distribution of the code or
       documentation without the prior written approval of IBM.

@//E*O*F include/WARRANTY//
chmod u=r,g=r,o=r include/WARRANTY
 
echo x - include/defines
sed 's/^@//' > "include/defines" <<'@//E*O*F include/defines//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

 # set up environment
NAME=`$MKTEMP`
rm -f $NAME.f
touch $NAME.f
export NAME
for x in $INCLUDES
do
	TIF="$TIF -I $x"
done
if [ -n "$IFLAGS" ]
then
	IFLAGS=$TIF
fi
#BSD could not handle this
#IFLAGS=${IFLAGS:-$TIF}

# write C code
# header for each file
echo "#include \"$1\"" > $NAME.c
echo "main() {" >> $NAME.c

# find all possible defines in the include files
@./catinc $1 | sh | awk -f defines.awk  >> $NAME.c 2> /dev/null

# trailer for each file
echo "}" >> $NAME.c

# compile the file
# the _POSIX_SOURCE flag should eleminate all defines not found in POSIX 1003.1
# or ANSI (1003.1 2.8.2)
cc $CFLAGS $IFLAGS -D_POSIX_SOURCE $NAME.c -o $NAME  > /dev/null

#generate a report
@./report -d $1 $NAME

# cleanup
rm -f $NAME.f $NAME $NAME.c
@//E*O*F include/defines//
chmod u=rwx,g=rx,o=rx include/defines
 
echo x - include/defines.awk
sed 's/^@//' > "include/defines.awk" <<'@//E*O*F include/defines.awk//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

 # this awk script finds defines and writes C code to print them
#  #ifdef DEFINE
# printf("DEFINE\n");
# #endif

/^[ 	]*#[ 	]*define/ {
		if ( i = index($2,"(") )
			def = substr($2,1,i-1);
		else
			def = $2;
		printf("#ifdef %s\n",def);
		printf("printf(\"%s\\n\");\n",def);
		printf("#endif\n");
	}
@//E*O*F include/defines.awk//
chmod u=rw,g=r,o=r include/defines.awk
 
echo x - include/catinc
sed 's/^@//' > "include/catinc" <<'@//E*O*F include/catinc//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

 # run the awk script that follows includes of other include files
awk -f catinc.awk < $1 2> /dev/null
@//E*O*F include/catinc//
chmod u=rwx,g=rx,o=rx include/catinc
 
echo x - include/squash
sed 's/^@//' > "include/squash" <<'@//E*O*F include/squash//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

# finds include files using include path
# get rid of junk like  #   define  and #  include
# don't include things twice

grep $1 $NAME.f
if [ $? -ne 0 ]
then
	for x in $INCLUDES
	do
		if [ -s $x/$1 ]
		then
			sed 's/[ 	]*#[ 	]*define/#define/
				s/[ 	]*#[ 	]*include/#include/
				s/[ 	]*#[ 	]*if/#if/
				s/[ 	]*#[ 	]*end/#end/' < $x/$1
			break
		fi
	done
fi

echo $1 >> $NAME.f
@//E*O*F include/squash//
chmod u=rwx,g=rx,o=rx include/squash
 
echo x - include/catinc.awk
sed 's/^@//' > "include/catinc.awk" <<'@//E*O*F include/catinc.awk//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

# this awk script writes a shell script which to recursivly follow
# includes of other include files.  It attempts to resolve the
# problem of two include files including each other by 
# only reading each file once.
#!/bin/awk -f $1

BEGIN {
		EOF = "EnDoFfIlE"
		printf("cat <<%s\n",EOF);
	}

# if it is an include line follow it down
#it seems this is allowed 
/#include</ {
		printf("%s\n",EOF);
		a = substr($1,10);
		a = substr(a,1,length(a)-1);
		printf("./squash %s | ./catinc 2> /dev/null | sh\n",a);
		printf("cat <<%s\n",EOF);
		next;
	}


/#include/ {
		printf("%s\n",EOF);
		a = substr($2,2);
		a = substr(a,1,length(a)-1);
		printf("./squash %s | ./catinc 2> /dev/null | sh\n",a);
		printf("cat <<%s\n",EOF);
		next;
	}

# just copy input to output
/./	{
		print $0
	}

END {
	printf("%s\n",EOF);
	}


@//E*O*F include/catinc.awk//
chmod u=rw,g=r,o=r include/catinc.awk
 
echo mkdir - include/inc
mkdir include/inc
chmod u=rwx,g=rx,o=rx include/inc
 
echo x - include/inc/dirent
sed 's/^@//' > "include/inc/dirent" <<'@//E*O*F include/inc/dirent//'

@//E*O*F include/inc/dirent//
chmod u=rw,g=r,o=r include/inc/dirent
 
echo x - include/inc/errno
sed 's/^@//' > "include/inc/errno" <<'@//E*O*F include/inc/errno//'
EDOM
ERANGE

E2BIG
EACCES
EAGAIN
EBADF
EBUSY
ECHILD
EDEADLK
EEXIST
EFAULT
EFBIG
EINTR
EINVAL
EIO
EISDIR
EMFILE
EMLINK
ENAMETOOLONG
ENFILE
ENODEV
ENOENT
ENOEXEC
ENOLCK
ENOMEM
ENOSPC
ENOSYS
ENOTDIR
ENOTEMPTY
ENOTTY
ENXIO
EPERM
EPIPE
EROFS
ESPIPE
ESRCH
EXDEV
@//E*O*F include/inc/errno//
chmod u=rw,g=r,o=r include/inc/errno
 
echo x - include/inc/fcntl
sed 's/^@//' > "include/inc/fcntl" <<'@//E*O*F include/inc/fcntl//'
F_DUPFD
F_GETFD
F_GETLK
F_SETFD
F_GETFL
F_SETFL
F_SETLK
F_SETLKW
FD_CLOEXEC
F_RDLCK
F_WRLCK
F_UNLCK
O_CREAT
O_EXCL
O_NOCTTY
O_TRUNC
O_APPEND
O_NONBLOCK
O_RDONLY
O_RDWR
O_WRONLY
O_ACCMODE
@//E*O*F include/inc/fcntl//
chmod u=rw,g=r,o=r include/inc/fcntl
 
echo x - include/inc/grp
sed 's/^@//' > "include/inc/grp" <<'@//E*O*F include/inc/grp//'

@//E*O*F include/inc/grp//
chmod u=rw,g=r,o=r include/inc/grp
 
echo x - include/inc/limits
sed 's/^@//' > "include/inc/limits" <<'@//E*O*F include/inc/limits//'
CHAR_BIT
CHAR_MAX
CHAR_MIN
INT_MAX
INT_MIN
LONG_MAX
LONG_MIN
MB_LEN_MAX
SCHAR_MAX
SCHAR_MIN
SHRT_MAX
SHRT_MIN
UCHAR_MAX
UINT_MAX
ULONG_MAX
USHRT_MAX

_POSIX_ARG_MAX
_POSIX_CHILD_MAX
_POSIX_LINK_MAX
_POSIX_MAX_CANON
_POSIX_MAX_INPUT
_POSIX_NAME_MAX
_POSIX_NGROUPS_MAX
_POSIX_OPEN_MAX
_POSIX_PATH_MAX
_POSIX_PIPE_BUF

NGROUPS_MAX
ARG_MAX
CHILD_MAX
OPEN_MAX
LINK_MAX
MAX_CANON
MAX_INPUT
NAME_MAX
PATH_MAX
PIPE_BUF

CLK_TCK
@//E*O*F include/inc/limits//
chmod u=rw,g=r,o=r include/inc/limits
 
echo x - include/inc/pwd
sed 's/^@//' > "include/inc/pwd" <<'@//E*O*F include/inc/pwd//'

@//E*O*F include/inc/pwd//
chmod u=rw,g=r,o=r include/inc/pwd
 
echo x - include/inc/signal
sed 's/^@//' > "include/inc/signal" <<'@//E*O*F include/inc/signal//'
SIG_DFL
SIG_IGN
SIG_ERR

SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM

SIGALRM
SIGHUP
SIGKILL
SIGPIPE
SIGQUIT
SIGUSR1
SIGUSR2
SIGCHLD
SIGCONT
SIGSTOP
SIGTSTP
SIGTTIN
SIGTTOU
SIG_BLOCK
SIG_UNBLOCK
SIG_SETMASK

SA_NOCLDSTOP
@//E*O*F include/inc/signal//
chmod u=rw,g=r,o=r include/inc/signal
 
echo x - include/inc/stdio
sed 's/^@//' > "include/inc/stdio" <<'@//E*O*F include/inc/stdio//'
_IOFBF
_IOLBF
_IONBF
BUFSIZ
EOF
FILENAME_MAX
FOPEN_MAX
L_tmpnam
NULL
SEEK_CUR
SEEK_END
SEEK_SET
stdin
stdout
stderr
TMP_MAX

L_ctermid
L_cuserid
@//E*O*F include/inc/stdio//
chmod u=rw,g=r,o=r include/inc/stdio
 
echo x - include/inc/termios
sed 's/^@//' > "include/inc/termios" <<'@//E*O*F include/inc/termios//'
NCCS
BRKINT
ICRNL
IGNBRK
IGNCR
IGNPAR
INLCR
INPCK
ISTRIP
IXOFF
IXON
PARMRK
OPOST
CLOCAL
CREAD
CSIZE
CS5
CS6
CS7
CS8
CSTOPB
HUPCL
PARENB
PARODD
ECHO
ECHOE
ECHOK
ECHONL
ICANON
IEXTEN
ISIG
NOFLSH
TOSTOP
VEOF
VEOL
VERASE
VINTR
VKILL
VMIN
VQUIT
VSUSP
VTIME
VSTART
VSTOP
B0
B50
B75
B110
B134
B150
B200
B300
B600
B1200
B1800
B2400
B4800
B9600
B19200
B38400
TCSANOW
TCSADRAIN
TCSAFLUSH
TCIFLUSH
TCOFLUSH
TCIOFLUSH
TCIOFF
TCION
TCOOFF
TCOON
@//E*O*F include/inc/termios//
chmod u=rw,g=r,o=r include/inc/termios
 
echo x - include/inc/unistd
sed 's/^@//' > "include/inc/unistd" <<'@//E*O*F include/inc/unistd//'
NULL

R_OK
W_OK
X_OK
F_OK

SEEK_SET
SEEK_CUR
SEEK_END

_POSIX_JOB_CONTROL
_POSIX_SAVED_IDS
_POSIX_VERSION

_POSIX_CHOWN_RESTRICTED
_POSIX_NO_TRUNC
_POSIX_VDISABLE

_SC_ARG_MAX
_SC_CHILD_MAX
_SC_JOB_CONTROL
_SC_NGROUPS_MAX
_SC_OPEN_MAX
_SC_SAVED_IDS
_SC_VERSION

_PC_CHOWN_RESTRICTED
_PC_LINK_MAX
_PC_MAX_CANON
_PC_MAX_INPUT
_PC_NAME_MAX
_PC_NO_TRUNC
_PC_PATH_MAX
_PC_PIPE_BUF
_PC_VDISABLE

STDIN_FILENO
STDOUT_FILENO
STDERR_FILENO
@//E*O*F include/inc/unistd//
chmod u=rw,g=r,o=r include/inc/unistd
 
echo x - include/inc/utime
sed 's/^@//' > "include/inc/utime" <<'@//E*O*F include/inc/utime//'

@//E*O*F include/inc/utime//
chmod u=rw,g=r,o=r include/inc/utime
 
echo x - include/inc/stat
sed 's/^@//' > "include/inc/stat" <<'@//E*O*F include/inc/stat//'
S_IRWXU
S_IRUSR
S_IWUSR
S_IXUSR

S_IRWXG
S_IRGRP
S_IWGRP
S_IXGRP

S_IRWXO
S_IROTH
S_IWOTH
S_IXOTH

S_ISUID
S_ISGID
@//E*O*F include/inc/stat//
chmod u=rw,g=r,o=r include/inc/stat
 
echo x - include/inc/times
sed 's/^@//' > "include/inc/times" <<'@//E*O*F include/inc/times//'

@//E*O*F include/inc/times//
chmod u=rw,g=r,o=r include/inc/times
 
echo x - include/inc/types
sed 's/^@//' > "include/inc/types" <<'@//E*O*F include/inc/types//'

@//E*O*F include/inc/types//
chmod u=rw,g=r,o=r include/inc/types
 
echo x - include/inc/utsname
sed 's/^@//' > "include/inc/utsname" <<'@//E*O*F include/inc/utsname//'

@//E*O*F include/inc/utsname//
chmod u=rw,g=r,o=r include/inc/utsname
 
echo x - include/inc/wait
sed 's/^@//' > "include/inc/wait" <<'@//E*O*F include/inc/wait//'
WNOHANG
WUNTRACED
@//E*O*F include/inc/wait//
chmod u=rw,g=r,o=r include/inc/wait
 
echo x - include/inc/assert
sed 's/^@//' > "include/inc/assert" <<'@//E*O*F include/inc/assert//'

@//E*O*F include/inc/assert//
chmod u=rw,g=r,o=r include/inc/assert
 
echo x - include/inc/ctype
sed 's/^@//' > "include/inc/ctype" <<'@//E*O*F include/inc/ctype//'

@//E*O*F include/inc/ctype//
chmod u=rw,g=r,o=r include/inc/ctype
 
echo x - include/inc/float
sed 's/^@//' > "include/inc/float" <<'@//E*O*F include/inc/float//'
FLT_ROUNDS
DBL_DIG
DBL_MANT_DIG
DBL_MAX_10_EXP
DBL_MAX_EXP
DBL_MIN_10_EXP
DBL_MIN_EXP
FLT_DIG
FLT_MANT_DIG
FLT_MAX_10_EXP
FLT_MAX_EXP
FLT_MIN_10_EXP
FLT_MIN_EXP
FLT_RADIX
LDBL_DIG
LDBL_MANT_DIG
LDBL_MAX_10_EXP
LDBL_MAX_EXP
LDBL_MIN_10_EXP
LDBL_MIN_EXP
DBL_MAX
FLT_MAX
LDBL_MAX
DBL_EPSILON
DBL_MIN
FLT_EPSILON
FLT_MIN
LDBL_EPSIOLON
LDBL_MIN
@//E*O*F include/inc/float//
chmod u=rw,g=r,o=r include/inc/float
 
echo x - include/inc/locale
sed 's/^@//' > "include/inc/locale" <<'@//E*O*F include/inc/locale//'
NULL
LC_ALL
LC_COLLATE
LC_CTYPE
LC_MONETARY
LC_NUMERIC
LC_TIME
@//E*O*F include/inc/locale//
chmod u=rw,g=r,o=r include/inc/locale
 
echo x - include/inc/math
sed 's/^@//' > "include/inc/math" <<'@//E*O*F include/inc/math//'
HUGE_VAL
@//E*O*F include/inc/math//
chmod u=rw,g=r,o=r include/inc/math
 
echo x - include/inc/setjmp
sed 's/^@//' > "include/inc/setjmp" <<'@//E*O*F include/inc/setjmp//'

@//E*O*F include/inc/setjmp//
chmod u=rw,g=r,o=r include/inc/setjmp
 
echo x - include/inc/stdarg
sed 's/^@//' > "include/inc/stdarg" <<'@//E*O*F include/inc/stdarg//'

@//E*O*F include/inc/stdarg//
chmod u=rw,g=r,o=r include/inc/stdarg
 
echo x - include/inc/stddef
sed 's/^@//' > "include/inc/stddef" <<'@//E*O*F include/inc/stddef//'
NULL
@//E*O*F include/inc/stddef//
chmod u=rw,g=r,o=r include/inc/stddef
 
echo x - include/inc/stdlib
sed 's/^@//' > "include/inc/stdlib" <<'@//E*O*F include/inc/stdlib//'
EXIT_FAILURE
EXIT_SUCCESS
MB_CUR_MAX
NULL
RAND_MAX
@//E*O*F include/inc/stdlib//
chmod u=rw,g=r,o=r include/inc/stdlib
 
echo x - include/inc/string
sed 's/^@//' > "include/inc/string" <<'@//E*O*F include/inc/string//'
NULL
@//E*O*F include/inc/string//
chmod u=rw,g=r,o=r include/inc/string
 
echo x - include/inc/time
sed 's/^@//' > "include/inc/time" <<'@//E*O*F include/inc/time//'

@//E*O*F include/inc/time//
chmod u=rw,g=r,o=r include/inc/time
 
echo x - include/inc/tar
sed 's/^@//' > "include/inc/tar" <<'@//E*O*F include/inc/tar//'
TMAGIC
TMAGLEN
TVERSION
TVERSLEN
REGTYPE
AREGTYPE
LNKTYPE
SYMTYPE
CHRTYPE
BLKTYPE
DIRTYPE
FIFOTYPE
CONTTYPE
TSUID
TSGID
TSVTX
TUREAD
TUWRITE
TUEXEC
TGREAD
TGWRITE
TGEXEC
TOREAD
TOWRITE
TOEXEC
@//E*O*F include/inc/tar//
chmod u=rw,g=r,o=r include/inc/tar
 
echo x - include/testinc
sed 's/^@//' > "include/testinc" <<'@//E*O*F include/testinc//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

 # set up environment
# put the include paths to search the INCLUDES variable
INCLUDES="/usr/include"
export INCLUDES

# if you need move C flags put them here
#CFLAGS=
#export CFLAGS

# This is the command the test will use to create tmp files
MKTEMP="echo /tmp/t$$"
export MKTEMP

cat report.t
# infiles is the list of all include files in POISX 1003.1 and ANSI dec. 88
for x in `cat incfiles`
do
	FILE=$x
	for y in $INCLUDES
	do
		if [ -r $y/$x ]
		then
			./defines $y/$x
			./struct $y/$x
			./typedef $y/$x
			FILE=""
			break
		fi
	done
	if [ "$FILE" != "" ]
	then 
echo "--------------------------------------------------------------------------"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!  $FILE not found !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "--------------------------------------------------------------------------"
		echo ""
	fi
done
@//E*O*F include/testinc//
chmod u=rwx,g=rx,o=rx include/testinc
 
echo x - include/README
sed 's/^@//' > "include/README" <<'@//E*O*F include/README//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

OVERVIEW:
This test sorts thru the POSIX and ANSI include files and reports missing
items, additional items in the standard, additional items allowed by the
standard, and items not allowed by the standard.  References to the 
standards document are included in the source code and the report.

The test assumes a traditional implementation of include files and requires
two things not stated  in the POSIX  standard or the ANSI C ( Dec 1988 ).
The first is the include files must be readable.  This is the case for
almost all installations I know of ( even the ones with precompiled
include files have readable ones also ).  The other is  
the -E option to the C compiler.  This option is available on most
UNIX C compilers and possibly others.  This option runs only the C
preprocessor and writes the results to stdout.  If your compiler does
not support this option I suggest getting one the public domain C
preprocessors such as GNU.

The test makes a few assumptions about the include files.  The biggest is
in order to pass the requirement that include files may be used in any
order, an include file will include everything it needs to compile.  The
define test finds all the defines in an include file then 
writes a C program using ifdef and printf to print all the defines that 
can be seen.  The typedef and struct test just use cc -E to get the structs
and typedefs then parse the output.  This strategy works on AIX, System V
rel 3, and BSD 4.3.  My experience is the more conforming the system the
more meaningful the results.  This makes the test most useful for keeping 
extra things from creeping into the include files of conforming systems.

OPERATION:
The test is a bunch of shell and awk scripts which use the files in inc, structs
and types as samples of what should be in the include files.  Unfortunately
there are exceptions to the rules and currently these are taken care of
by report.  These should be moved to an exception directory but at least
they are in one file.

SETUP:
If you need to search other directories add them to INCLUDES in testinc.
If you need other compiler flags set CFLAGS.
Put something in MKTEMP that will make tmp files.  If your system is 1003.2
you can use mktemp.

RUN:
To run just type ./testinc and the report goes to stdout.

PROBLEMS:
Since the parser is nowhere near a full C compiler I'm sure it can be fooled.

The construct typedef thing[num]; yields incorrect results.

@//E*O*F include/README//
chmod u=rw,g=r,o=r include/README
 
echo x - include/report
sed 's/^@//' > "include/report" <<'@//E*O*F include/report//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

 # this sh script writes a report to stdout
# -d for defines
# -s for structs
# -t for typedefs

USAGE="usage: $0"

case $1 in 
	-d)
# $1 is option
# $2 include file
# $3 program

echo ""
echo "--------------------------------------------------------------------------"
echo "               report for include file $2"
echo "--------------------------------------------------------------------------"
echo "***************************  defines section  ****************************"
# should be -x but none in BSD
if [ -s $3 ]
then
	echo "extra		other		missing		macros"
	TMP=`$MKTEMP`
# this is what should be there
	sort inc/`basename $2 .h` | grep -v '^$' > $TMP.g
# these could be macros for functions
	sort functions | grep -v '^$' > $TMP.f
# one file could include another
	cat inc/* | sort | grep -v '^$' > $TMP.o

# this gives all extra stuff
	$3 | sort -u | comm -23 - $TMP.g | grep -v "^_" > $TMP.e
# this gives extra stuff not in standard
	case `basename $2`
	in
		errno.h)
# get rid of E([0-9]|[A-Z]) in errno.h as per ansi future lib directions
	cat $TMP.f $TMP.o | sort | comm  -23 $TMP.e - | grep -v "^_" | grep -v "^E[0-9]" | grep -v "^E[A-Z]" > $TMP.1
		;;
		signal.h)
# get rid of SIG(_|[A-Z]) in errno.h as per ansi future lib directions
	cat $TMP.f $TMP.o | sort | comm  -23 $TMP.e - | grep -v "^_" | grep -v "^SIG_" | grep -v "^SIG[A-Z]" > $TMP.1
		;;
		*)
	cat $TMP.f $TMP.o | sort | comm  -23 $TMP.e - | grep -v "^_" > $TMP.1
		;;
	esac
# things elsewhere in standard
	comm -23 $TMP.e $TMP.1 > $TMP.t
	cat $TMP.f $TMP.o | comm -23 $TMP.t -  | sed "s/^/		/" > $TMP.2
# these are missing
	$3 | sort -u | comm -13 - $TMP.g | grep -v "^_" | sed "s/^/				/" >  $TMP.3
# macros for funtions
	comm -12 $TMP.e $TMP.f | sed "s/^/ 						/" > $TMP.4

	cat $TMP.1 $TMP.2 $TMP.3 $TMP.4  | sort -b

	echo
	rm -f $TMP.*
else
	echo "!!!!!!!!!  problem compiling with $2 !!!!!!!!!"
	echo
fi
;;

# structure report
	-s)
# $1 option
# $2 include file

echo "**************************  structure section  ***************************"
echo "extra structures		extra elements"
	TMP=`$MKTEMP`
	sort > $TMP.i
#get what should be there
	sort structs/`basename $2 .h` | grep -v '^$' > $TMP.g
	cat structs/* | sort | grep -v '^$' > $TMP.o
#difference between what should be and what is
	awk '{print $1}' $TMP.i | uniq | comm -23 - $TMP.o

# types ending in _t are OK (1003.1 2.6)
	join $TMP.o $TMP.i | sort | uniq | grep -v "_t$" > $TMP.t
	sort ctypes | join -j1 1 -j2 2 -o 2.1 2.2 - $TMP.t | comm -13 - $TMP.t | uniq | sed "s/^/				/"
;;

# typedef report
	-t)
# $1 option
# $2 include file

echo "***************************  typedef section  ****************************"
	TMP=`$MKTEMP`
# sort them and save them for now
	sort > $TMP.i
# this is what should be there
	sort types/`basename $2 .h` | grep -v '^$' > $TMP.g
# one file could include another
	cat types/* | sort | grep -v '^$' > $TMP.o


	echo "extra		other		missing"

# this gives all extra stuff
#	types ending in _t are ok (POSIX 1003.1 2.6)
	cat $TMP.i | sort -u | comm -23 - $TMP.g > $TMP.e

# this gives extra stuff not in standard
#	types ending in _t are ok (POSIX 1003.1 2.6)
	cat $TMP.o | sort | comm  -23 $TMP.e - | grep -v "_t$" > $TMP.1

# things elsewhere in standard
#	types ending in _t are ok (POSIX 1003.1 2.6)
	comm -23 $TMP.e $TMP.1 > $TMP.t
	cat $TMP.o | comm -23 $TMP.t -  | grep -v "_t$" | sed "s/^/		/" > $TMP.2

# these are missing
	cat $TMP.i | sort -u | comm -13 - $TMP.g | sed "s/^/				/" >  $TMP.3


	cat $TMP.1 $TMP.2 $TMP.3 | sort -b

;;
	*)
echo $USAGE
;;
esac

#clean up
rm -f $TMP.c $TMP.g $TMP.i $TMP.o
@//E*O*F include/report//
chmod u=rwx,g=rx,o=rx include/report
 
echo x - include/incfiles
sed 's/^@//' > "include/incfiles" <<'@//E*O*F include/incfiles//'
assert.h
ctype.h
dirent.h
errno.h
fcntl.h
float.h
grp.h
limits.h
locale.h
math.h
pwd.h
setjmp.h
signal.h
stdarg.h
stddef.h
stdio.h
stdlib.h
string.h
sys/stat.h
sys/times.h
sys/types.h
sys/utsname.h
sys/wait.h
tar.h
termios.h
time.h
unistd.h
utime.h
@//E*O*F include/incfiles//
chmod u=rw,g=r,o=r include/incfiles
 
echo x - include/files
sed 's/^@//' > "include/files" <<'@//E*O*F include/files//'
defines
defines.awk
catinc
squash
catinc.awk
inc/dirent
inc/errno
inc/fcntl
inc/grp
inc/limits
inc/pwd
inc/signal
inc/stdio
inc/termios
inc/unistd
inc/utime
inc/stat
inc/times
inc/types
inc/utsname
inc/wait
inc/assert
inc/ctype
inc/float
inc/locale
inc/math
inc/setjmp
inc/stdarg
inc/stddef
inc/stdlib
inc/string
inc/time
inc/tar
testinc
README
report
incfiles
files
functions
@//E*O*F include/files//
chmod u=rw,g=r,o=r include/files
 
echo x - include/struct
sed 's/^@//' > "include/struct" <<'@//E*O*F include/struct//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

 #finds structure declarations in include files

#copy the .h to a .c for some cc commands
TMP=`$MKTEMP`
touch $TMP.c
cp $1 $TMP.c

#run the preprocessor with _POSIX_SOURCE defined
#change all the white space to newlines so there is one token per line
#run the awk parser to find struct defs
cc -D _POSIX_SOURCE -E $TMP.c | tr  -s " 	" "\012\012" | awk -f struct.awk | awk '{ if ( NF > 1) print $0}' | ./report -s $1

#clean up
rm -f $TMP.c
@//E*O*F include/struct//
chmod u=rwx,g=rx,o=rx include/struct
 
echo x - include/struct.awk
sed 's/^@//' > "include/struct.awk" <<'@//E*O*F include/struct.awk//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

# this awk script is a state machine that find structure definetions
# it outputs the structure name and each element in the structure
# in the form
#NAME ELEMENT_TYPE

#the order of expressions to find is important

BEGIN {
	STRUCT=0;
	OPEN = 0;
	SEMI = 1;
	TYPEDEF = 0;
}

#ignore a few keywords
/unsigned/	{
	next;
	}

/extern/	{
	next;
	}

/signed/	{
	next;
	}

#braces signal begining structure elements
/{/	{
		OPEN += 1;
		SEMI = 1;
		next;
	}

/}/	{
		OPEN -= 1;
		next;
	}

#semi colon signals end of statement
#now we can look for a struct
/;/	{
		SEMI = 1;
		next;
	}

# this matches anything
#typedefs look like structures so weed them out
# if struct == 1 just print the name of the structure
# if struct == 2 print the name and the element type
/^/	{
		if ( TYPEDEF == 1 )
		{
			if ( OPEN == 0 )
			{
				if ( SEMI == 1 )
					SEMI = 0;
					TYPEDEF = 0;
			}
			next;
		}
		if ( STRUCT == 1 )
		{
			printf("%s\n",$1);
			STRUCT = 2;
			NAME = $1;
			next;
		}
		if ( STRUCT == 2 )
		{
			if ( OPEN == 1 )
			{
				if ( SEMI == 1 )
				{
					printf("%s %s\n",NAME,$1);
					SEMI = 0;
				}
				
			}
			if ( OPEN == 0 )
			{
				STRUCT = 0;
			}
		}
	}

# set flags for keywords
/typedef/	{
	TYPEDEF=1;
	next;
	}

/struct/	{
	STRUCT=1;
	next;
	}


@//E*O*F include/struct.awk//
chmod u=rw,g=r,o=r include/struct.awk
 
echo x - include/functions
sed 's/^@//' > "include/functions" <<'@//E*O*F include/functions//'
assert
isalnum
isalpha
iscntrl
isdigit
isgraph
islower
isprint
ispunct
isspace
isupper
isxdigit
tolower
toupper
setlocale
localeconv
acos
asin
atan
atan2
cos
sin
tan
cosh
sinh
tanh
exp
frexp
lsexp
log
log10
modf
pow
sqrt
ceil
fabs
floor
fmod
setjmp
longjmp
signal
raise
va_start
va_arg
va_end
remove
rename
tmpfile
tmpnam
fclose
fflush
fopen
freopen
setbuf
setvbuf
fprintf
fscanf
printf
scanf
sprinf
sscanf
vfprintf
vprintf
vsprintf
fgetc
fgets
fputc
fputs
getc
getchar
gets
putc
putchar
puts
ungetc
fread
fwrite
fgetpos
fseek
fsetpos
ftell
rewind
clearerr
feof
ferror
perror
atof
atoi
atol
strtod
strtol
strtoul
rand
srand
calloc
free
malloc
realloc
abort
atexit
exit
getenv
systems
bsearch
qsort
abs
div
labs
ldiv
mblen
mbtowc
wctomb
mbstowcs
wcstombs
memcpy
memmove
strcpy
strncpy
strcat
strncat
memcmp
strcmp
strcol
strncmp
strxfrm
memchr
strchr
strcspan
strpbrk
strrchr
strspn
strstr
strtok
memset
strerror
strlen
clock
difftime
mktime
time
asctime
ctime
gmtive
lcoaltime
strftime
access
alarm
asctime
cfgetispeed
cfgetospeed
cfsetispeed
cfsetospeed
chdir
chmod
chown
close
closedir
creat
ctermid
cuserid
dup
dup2
execl
execle
execlp
execv
execve
execvp
_exit
fcntl
fdopen
fileno
fork
fpathconf
fstat
getcwd
getegid
getenv
geteuid
getgid
getgrgid
getgrnam
getgroups
getlogin
getpgrp
getpid
getppid
getpwnam
getpwuid
getuid
isatty
kill
link
lingjmp
lseek
mkdir
mkfifo
open
opendir
pathconf
pause
pipe
read
readdir
rename
rewinddir
rmdir
setgid
setjmp
setlocale
setpgid
setsid
setuid
sigaction
sigaddset
sigdelset
sigemptyset
sigfillset
sigismember
siglongjmp
sigpending
sigprocmask
sigsetjmp
sigsuspend
sleep
stat
sysconf
tcdrain
tcflow
tcflush
tcgetattr
tcgetpgrp
time
times
ttyname
tzset
umask
uname
unlink
utime
wait
waitpid
write

S_ISDIR
S_ISCHR
S_ISBLK
S_ISREG
S_ISFIFO
WIFEXITED
WEXITSTATUS
WIFSIGNALED
WTERMSIG
WIFSTOPPED
WSTOPSIG
@//E*O*F include/functions//
chmod u=rw,g=r,o=r include/functions
 
echo mkdir - include/structs
mkdir include/structs
chmod u=rwx,g=rx,o=rx include/structs
 
echo x - include/structs/assert
sed 's/^@//' > "include/structs/assert" <<'@//E*O*F include/structs/assert//'
@//E*O*F include/structs/assert//
chmod u=rw,g=r,o=r include/structs/assert
 
echo x - include/structs/ctype
sed 's/^@//' > "include/structs/ctype" <<'@//E*O*F include/structs/ctype//'
@//E*O*F include/structs/ctype//
chmod u=rw,g=r,o=r include/structs/ctype
 
echo x - include/structs/dirent
sed 's/^@//' > "include/structs/dirent" <<'@//E*O*F include/structs/dirent//'
dirent
@//E*O*F include/structs/dirent//
chmod u=rw,g=r,o=r include/structs/dirent
 
echo x - include/structs/errno
sed 's/^@//' > "include/structs/errno" <<'@//E*O*F include/structs/errno//'
@//E*O*F include/structs/errno//
chmod u=rw,g=r,o=r include/structs/errno
 
echo x - include/structs/fcntl
sed 's/^@//' > "include/structs/fcntl" <<'@//E*O*F include/structs/fcntl//'
flock
@//E*O*F include/structs/fcntl//
chmod u=rw,g=r,o=r include/structs/fcntl
 
echo x - include/structs/float
sed 's/^@//' > "include/structs/float" <<'@//E*O*F include/structs/float//'
@//E*O*F include/structs/float//
chmod u=rw,g=r,o=r include/structs/float
 
echo x - include/structs/grp
sed 's/^@//' > "include/structs/grp" <<'@//E*O*F include/structs/grp//'
@//E*O*F include/structs/grp//
chmod u=rw,g=r,o=r include/structs/grp
 
echo x - include/structs/limits
sed 's/^@//' > "include/structs/limits" <<'@//E*O*F include/structs/limits//'
@//E*O*F include/structs/limits//
chmod u=rw,g=r,o=r include/structs/limits
 
echo x - include/structs/locale
sed 's/^@//' > "include/structs/locale" <<'@//E*O*F include/structs/locale//'
@//E*O*F include/structs/locale//
chmod u=rw,g=r,o=r include/structs/locale
 
echo x - include/structs/math
sed 's/^@//' > "include/structs/math" <<'@//E*O*F include/structs/math//'
@//E*O*F include/structs/math//
chmod u=rw,g=r,o=r include/structs/math
 
echo x - include/structs/pwd
sed 's/^@//' > "include/structs/pwd" <<'@//E*O*F include/structs/pwd//'
@//E*O*F include/structs/pwd//
chmod u=rw,g=r,o=r include/structs/pwd
 
echo x - include/structs/setjmp
sed 's/^@//' > "include/structs/setjmp" <<'@//E*O*F include/structs/setjmp//'
@//E*O*F include/structs/setjmp//
chmod u=rw,g=r,o=r include/structs/setjmp
 
echo x - include/structs/signal
sed 's/^@//' > "include/structs/signal" <<'@//E*O*F include/structs/signal//'
sigset
sigaction

@//E*O*F include/structs/signal//
chmod u=rw,g=r,o=r include/structs/signal
 
echo x - include/structs/stat
sed 's/^@//' > "include/structs/stat" <<'@//E*O*F include/structs/stat//'
stat
@//E*O*F include/structs/stat//
chmod u=rw,g=r,o=r include/structs/stat
 
echo x - include/structs/stdarg
sed 's/^@//' > "include/structs/stdarg" <<'@//E*O*F include/structs/stdarg//'
@//E*O*F include/structs/stdarg//
chmod u=rw,g=r,o=r include/structs/stdarg
 
echo x - include/structs/stddef
sed 's/^@//' > "include/structs/stddef" <<'@//E*O*F include/structs/stddef//'
@//E*O*F include/structs/stddef//
chmod u=rw,g=r,o=r include/structs/stddef
 
echo x - include/structs/stdio
sed 's/^@//' > "include/structs/stdio" <<'@//E*O*F include/structs/stdio//'
@//E*O*F include/structs/stdio//
chmod u=rw,g=r,o=r include/structs/stdio
 
echo x - include/structs/stdlib
sed 's/^@//' > "include/structs/stdlib" <<'@//E*O*F include/structs/stdlib//'
@//E*O*F include/structs/stdlib//
chmod u=rw,g=r,o=r include/structs/stdlib
 
echo x - include/structs/string
sed 's/^@//' > "include/structs/string" <<'@//E*O*F include/structs/string//'
@//E*O*F include/structs/string//
chmod u=rw,g=r,o=r include/structs/string
 
echo x - include/structs/tar
sed 's/^@//' > "include/structs/tar" <<'@//E*O*F include/structs/tar//'
@//E*O*F include/structs/tar//
chmod u=rw,g=r,o=r include/structs/tar
 
echo x - include/structs/termios
sed 's/^@//' > "include/structs/termios" <<'@//E*O*F include/structs/termios//'
termios
@//E*O*F include/structs/termios//
chmod u=rw,g=r,o=r include/structs/termios
 
echo x - include/structs/time
sed 's/^@//' > "include/structs/time" <<'@//E*O*F include/structs/time//'
tm
@//E*O*F include/structs/time//
chmod u=rw,g=r,o=r include/structs/time
 
echo x - include/structs/times
sed 's/^@//' > "include/structs/times" <<'@//E*O*F include/structs/times//'
tms
@//E*O*F include/structs/times//
chmod u=rw,g=r,o=r include/structs/times
 
echo x - include/structs/types
sed 's/^@//' > "include/structs/types" <<'@//E*O*F include/structs/types//'
@//E*O*F include/structs/types//
chmod u=rw,g=r,o=r include/structs/types
 
echo x - include/structs/unistd
sed 's/^@//' > "include/structs/unistd" <<'@//E*O*F include/structs/unistd//'
@//E*O*F include/structs/unistd//
chmod u=rw,g=r,o=r include/structs/unistd
 
echo x - include/structs/utime
sed 's/^@//' > "include/structs/utime" <<'@//E*O*F include/structs/utime//'
utimbuf
@//E*O*F include/structs/utime//
chmod u=rw,g=r,o=r include/structs/utime
 
echo x - include/structs/utsname
sed 's/^@//' > "include/structs/utsname" <<'@//E*O*F include/structs/utsname//'
utsname
@//E*O*F include/structs/utsname//
chmod u=rw,g=r,o=r include/structs/utsname
 
echo x - include/structs/wait
sed 's/^@//' > "include/structs/wait" <<'@//E*O*F include/structs/wait//'
@//E*O*F include/structs/wait//
chmod u=rw,g=r,o=r include/structs/wait
 
echo x - include/structs/grp.h
sed 's/^@//' > "include/structs/grp.h" <<'@//E*O*F include/structs/grp.h//'
group
@//E*O*F include/structs/grp.h//
chmod u=rw,g=r,o=r include/structs/grp.h
 
echo x - include/structs/locale.h
sed 's/^@//' > "include/structs/locale.h" <<'@//E*O*F include/structs/locale.h//'
lconv

@//E*O*F include/structs/locale.h//
chmod u=rw,g=r,o=r include/structs/locale.h
 
echo x - include/structs/pwd.c
sed 's/^@//' > "include/structs/pwd.c" <<'@//E*O*F include/structs/pwd.c//'
passwd
@//E*O*F include/structs/pwd.c//
chmod u=rw,g=r,o=r include/structs/pwd.c
 
echo x - include/structs/stdlib.h
sed 's/^@//' > "include/structs/stdlib.h" <<'@//E*O*F include/structs/stdlib.h//'
div_t
ldiv_t
@//E*O*F include/structs/stdlib.h//
chmod u=rw,g=r,o=r include/structs/stdlib.h
 
echo x - include/report.str.awk
sed 's/^@//' > "include/report.str.awk" <<'@//E*O*F include/report.str.awk//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

# just ignore these
/	char/	{ next; }
/	const/	{ next; }
/	double/	{ next; }
/	float/	{ next; }
/	int/	{ next; }
/	long/	{ next; }
/	short/	{ next; }
/	signed/	{ next; }
/	unsigned/	{ next; }
/	void/	{ next; }

# this is a structure name
$1 ~ /^\t/	{
	}
@//E*O*F include/report.str.awk//
chmod u=rw,g=r,o=r include/report.str.awk
 
echo x - include/struct1.awk
sed 's/^@//' > "include/struct1.awk" <<'@//E*O*F include/struct1.awk//'
 #
#**********************************************************************
# THERE MUST BE A SPACE in the first character of the first line.
#**********************************************************************
#
#			NOTICE STATEMENT
#
# This code was developed by IBM Corporation.  Copyright is disclaimed.
#
# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS CODE.  IN NO EVENT
# WILL IBM BE LIABLE FOR ANY DAMAGES, LOST PROFITS, OR LOST SAVINGS.
#
#	"@(#) This code was developed by IBM Corporation. "
#	"@(#) Copyright is disclaimed. "
#
#**********************************************************************
#  Written by:  Barry Books
#**********************************************************************

# this awk script strips off C types and typedefs ending in _t



# regular C types
$2 ~ /^char$/	{ next; }
$2 ~ /^const$/	{ next; }
$2 ~ /^double$/	{ next; }
$2 ~ /^float$/	{ next; }
$2 ~ /^int$/	{ next; }
$2 ~ /^long$/	{ next; }
$2 ~ /^short$/	{ next; }
$2 ~ /^signed$/	{ next; }
$2 ~ /^unsigned$/	{ next; }
$2 ~ /^void$/	{ next; }

# additional ansi types

# additional posix types

# posix says _t is ok
$2 ~ /.*_t/	{ next; }

/^/ { print $0 }
@//E*O*F include/struct1.awk//
chmod u=rw,g=r,o=r include/struct1.awk
 
echo mkdir - include/types
mkdir include/types
chmod u=rwx,g=rx,o=rx include/types
 
echo x - include/types/assert
sed 's/^@//' > "include/types/assert" <<'@//E*O*F include/types/assert//'

@//E*O*F include/types/assert//
chmod u=rw,g=r,o=r include/types/assert
 
echo x - include/types/ctype
sed 's/^@//' > "include/types/ctype" <<'@//E*O*F include/types/ctype//'

@//E*O*F include/types/ctype//
chmod u=rw,g=r,o=r include/types/ctype
 
echo x - include/types/dirent
sed 's/^@//' > "include/types/dirent" <<'@//E*O*F include/types/dirent//'
DIR
@//E*O*F include/types/dirent//
chmod u=rw,g=r,o=r include/types/dirent
 
echo x - include/types/errno
sed 's/^@//' > "include/types/errno" <<'@//E*O*F include/types/errno//'

@//E*O*F include/types/errno//
chmod u=rw,g=r,o=r include/types/errno
 
echo x - include/types/fcntl
sed 's/^@//' > "include/types/fcntl" <<'@//E*O*F include/types/fcntl//'

@//E*O*F include/types/fcntl//
chmod u=rw,g=r,o=r include/types/fcntl
 
echo x - include/types/float
sed 's/^@//' > "include/types/float" <<'@//E*O*F include/types/float//'

@//E*O*F include/types/float//
chmod u=rw,g=r,o=r include/types/float
 
echo x - include/types/grp
sed 's/^@//' > "include/types/grp" <<'@//E*O*F include/types/grp//'

@//E*O*F include/types/grp//
chmod u=rw,g=r,o=r include/types/grp
 
echo x - include/types/limits
sed 's/^@//' > "include/types/limits" <<'@//E*O*F include/types/limits//'

@//E*O*F include/types/limits//
chmod u=rw,g=r,o=r include/types/limits
 
echo x - include/types/locale
sed 's/^@//' > "include/types/locale" <<'@//E*O*F include/types/locale//'

@//E*O*F include/types/locale//
chmod u=rw,g=r,o=r include/types/locale
 
echo x - include/types/math
sed 's/^@//' > "include/types/math" <<'@//E*O*F include/types/math//'

@//E*O*F include/types/math//
chmod u=rw,g=r,o=r include/types/math
 
echo x - include/types/pwd
sed 's/^@//' > "include/types/pwd" <<'@//E*O*F include/types/pwd//'

@//E*O*F include/types/pwd//
chmod u=rw,g=r,o=r include/types/pwd
 
echo x - include/types/setjmp
sed 's/^@//' > "include/types/setjmp" <<'@//E*O*F include/types/setjmp//'
jmp_buf
sigjmp_buf
@//E*O*F include/types/setjmp//
chmod u=rw,g=r,o=r include/types/setjmp
 
echo x - include/types/signal
sed 's/^@//' > "include/types/signal" <<'@//E*O*F include/types/signal//'
sigset_t
sig_atomic_t
@//E*O*F include/types/signal//
chmod u=rw,g=r,o=r include/types/signal
 
echo x - include/types/stat
sed 's/^@//' > "include/types/stat" <<'@//E*O*F include/types/stat//'

@//E*O*F include/types/stat//
chmod u=rw,g=r,o=r include/types/stat
 
echo x - include/types/stdarg
sed 's/^@//' > "include/types/stdarg" <<'@//E*O*F include/types/stdarg//'
va_list
@//E*O*F include/types/stdarg//
chmod u=rw,g=r,o=r include/types/stdarg
 
echo x - include/types/stddef
sed 's/^@//' > "include/types/stddef" <<'@//E*O*F include/types/stddef//'
ptrdiff_t
size_t
wchar_t
@//E*O*F include/types/stddef//
chmod u=rw,g=r,o=r include/types/stddef
 
echo x - include/types/stdio
sed 's/^@//' > "include/types/stdio" <<'@//E*O*F include/types/stdio//'
FILE
fpos_t
@//E*O*F include/types/stdio//
chmod u=rw,g=r,o=r include/types/stdio
 
echo x - include/types/stdlib
sed 's/^@//' > "include/types/stdlib" <<'@//E*O*F include/types/stdlib//'
size_t
fpos_t
div_t
ldiv_t
@//E*O*F include/types/stdlib//
chmod u=rw,g=r,o=r include/types/stdlib
 
echo x - include/types/string
sed 's/^@//' > "include/types/string" <<'@//E*O*F include/types/string//'
size_t
@//E*O*F include/types/string//
chmod u=rw,g=r,o=r include/types/string
 
echo x - include/types/tar
sed 's/^@//' > "include/types/tar" <<'@//E*O*F include/types/tar//'

@//E*O*F include/types/tar//
chmod u=rw,g=r,o=r include/types/tar
 
echo x - include/types/termios
sed 's/^@//' > "include/types/termios" <<'@//E*O*F include/types/termios//'
tc_flag_t
cc_t
speed_t
@//E*O*F include/types/termios//
chmod u=rw,g=r,o=r include/types/termios
 
echo x - include/types/time
sed 's/^@//' > "include/types/time" <<'@//E*O*F include/types/time//'
size_t
time_t
@//E*O*F include/types/time//
chmod u=rw,g=r,o=r include/types/time
 
echo x - include/types/times
sed 's/^@//' > "include/types/times" <<'@//E*O*F include/types/times//'
clock_t
@//E*O*F include/types/times//
chmod u=rw,g=r,o=r include/types/times
 
echo x - include/types/types
sed 's/^@//' > "include/types/types" <<'@//E*O*F include/types/types//'
clock_t
dev_t
gid_t
ino_t
mode_t
nlink_t
off_t
pid_t
size_t
time_t
uid_t
@//E*O*F include/types/types//
chmod u=rw,g=r,o=r include/types/types
 
echo x - include/types/unistd
sed 's/^@//' > "include/types/unistd" <<'@//E*O*F include/types/unistd//'

@//E*O*F include/types/unistd//
chmod u=rw,g=r,o=r include/types/unistd
 
echo x - include/types/utime
sed 's/^@//' > "include/types/utime" <<'@//E*O*F include/types/utime//'

@//E*O*F include/types/utime//
chmod u=rw,g=r,o=r include/types/utime
 
echo x - include/types/utsname
sed 's/^@//' > "include/types/utsname" <<'@//E*O*F include/types/utsname//'

@//E*O*F include/types/utsname//
chmod u=rw,g=r,o=r include/types/utsname
 
echo x - include/types/wait
sed 's/^@//' > "include/types/wait" <<'@//E*O*F include/types/wait//'

@//E*O*
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.