Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
/* $XConsortium: Makefile /main/3 1996/05/10 17:19:02 drk $ */
:MAKE: lib[0-9]* - libast - *

View File

@@ -0,0 +1,522 @@
:
# Glenn Fowler
# AT&T Bell Laboratories
#
# @(#)C.probe (AT&T Bell Laboratories) 05/09/95
#
# probe [ -d ] c-compiler-path [ attributes ]
#
# common C probe preamble for the tool specific probes
#
# NOTE: some cc -E's do syntax analysis!
#
# probe_* are first eval'd and then attempted from left to right
#
probe_arflags="-xar"
probe_binding="-dy -dn -Bdynamic -Bstatic -Wl,-ashared -Wl,-aarchive -call_shared -non_shared '' -static"
probe_env="CC_OPTIONS CCOPTS LD_OPTIONS LDOPTS LIBPATH LPATH"
probe_include="stdio.h iostream.h complex.h ctype.h plot.h stdarg.h varargs.h ranlib.h hash.h sys/types.h stab.h"
probe_l="l yyreject m sin mopt sin"
probe_lxx="C exit ++ exit g++ exit"
probe_ld="ld link"
probe_ldlib="LD_LIBRARY_PATH LIBPATH LPATH"
probe_ldmap="'-Wl,-M' '-Qoption ld -M' '-Wl,-m' '-m'"
probe_lib="a lib"
probe_members="-all"
probe_nm="nm"
probe_nmflags="'' -p -B"
probe_pic="-Kpic -fpic -pic +z '-G 0'"
probe_ppprefix="a n"
probe_shared="'' -G -b -c -shared"
probe_size="size"
probe_src="cxx C cc c"
probe_readonly="-R -xMerge -Wa,-r"
probe_sa=".sa"
probe_so=".so .sl"
probe_symprefix="_"
probe_unresolved="'-expect_unresolved \"*\"'"
probe_verbose="'-v -v' '-# -#' '-d -d' -dryrun"
#
# the following are set by the preamble for the tool specific probe
#
cc=cc
debug=
dir=.
dynamic=
exe=exe
executable="test -x"
hosted=
obj=o
ppenv=
ppopt=
predef=
prepred=
sa=
so=
sov=
static=
stdlib=
stdpp=
suffix_command=
tmpdir=/tmp/probe$$
undef="define defined elif else endif error if ifdef ifndef include line pragma undef __STDC__ __STDPP__ __ARGC__ __BASE__ __BASE_FILE__ __DATE__ __FILE__ __INCLUDE_LEVEL__ __LINE__ __PATH__ __TIME__ __VERSION__"
#
# now the common probes
#
case $1 in
-d) debug=1; shift ;;
-*) set x ;;
*) debug= ;;
esac
cc=$1
case $cc in
/*) ;;
*) echo "Usage: $0 [ -d ] c-compiler-path [ attributes ]" >&2; exit 1 ;;
esac
ATTRIBUTES=
eval $2
_probe_PATH=$PATH
PATH=/bin:/usr/bin:$PATH
case $0 in
*/*) dir=`echo $0 | sed -e 's,//*[^/]*\$,,'` ;;
esac
$executable . 2>/dev/null || executable='test -r'
trap 'code=$?; cd ..; rm -rf $tmpdir; exit $code' 0 1 2 3
mkdir $tmpdir
cd $tmpdir
exec 3>&1 4>&2 </dev/null
case $debug in
"") exec >/dev/null 2>&1
;;
*) PS4='+$LINENO+ '
set -x
;;
esac
if (xxx=xxx; unset xxx)
then eval unset $probe_env
else eval set x $probe_env
while :
do shift
case $# in
0) break ;;
esac
eval x='$'$1
case $x in
"") ;;
*) eval $1=
export $1
;;
esac
done
fi
mkdir suffix
cd suffix
for src in $probe_src
do echo "main(){return 0;}" > ../test.$src
rm -f test*
if $cc -c ../test.$src
then set test.*
if test -f "$1"
then o="$*"
mv $* ..
for i in $o
do if $cc -o test.exe ../$i
then obj=`echo "$i" | sed -e 's,test.,,'`
$executable test.exe || executable="test -r"
set test*
rm *
if $cc -o test ../$i
then rm $*
set test.*
if $executable "$1"
then exe=`echo "$1" | sed -e 's,test.,,'`
suffix_command=.$exe
fi
fi
break 2
fi
done
fi
fi
done
cd ..
case $src in
c) ;;
*) echo '// (
main()
{
class { public: int i; } j;
j.i = 0;
int k = j.i + 1;
return k;
}' > dialect.$src
if $cc -c dialect.$src && $cc -o dialect.$exe dialect.$obj && $executable dialect.$exe
then mv dialect.$src dialect.c
rm -f dialect.$obj dialect.$exe
if $cc -c dialect.c && $cc -o dialect.$exe dialect.$obj && $executable dialect.$exe
then src=c
else set x $cc
while :
do shift
case $# in
0) break ;;
esac
case $1 in
*=*) continue ;;
esac
case `echo $1 | sed -e 's,.*/,,'` in
*CC*|*++*|*[xX][xX]*|*[pP][lL][uU][sS]*) ;;
*) src=c ;;
esac
break
done
fi
else src=c
fi
;;
esac
set x x '(' 1 'int x;' 0
while :
do shift
shift
case $# in
[01]) break ;;
esac
rm -f test.$obj
echo "$1" > test.$src
$cc -c test.$src
r=$?
case $r in
0) test -f test.$obj || r=1 ;;
*) r=1 ;;
esac
case $2:$r in
0:0) ;;
0:1) echo "$cc: not a C compiler: failed to compile \`\`$1''" >&4
exit 1
;;
1:0) echo "$cc: not a C compiler: successfully compiled \`\`$1''" >&4
exit 1
;;
esac
done
echo '#include <stdio.h>
main(){printf("hello");return(0);}' > dynamic.$src
if $cc -c dynamic.$src
then eval set x $probe_so
while :
do shift
case $# in
0) break ;;
esac
k=
for i in "" .1 .2 .3 .4 .5 .6 .7 .8 .9
do rm -f dynamic.$exe > libc$1$i
$cc -L. -o dynamic.$exe dynamic.$obj && $executable dynamic.$exe
x=$?
(cd ..; rm $tmpdir/libc$1$i)
case $x in
0) ;;
*) k=X$k
case $k in
XXX) break ;;
esac
;;
esac
done
case $k in
XXX) so=$1
sov=1
break
;;
?*) so=$1
break
;;
esac
done
rm -f dynamic.$exe
if $cc -o dynamic.$exe dynamic.$obj 2>e && $executable dynamic.$exe
then e=`wc -l e`
maybe=
eval set x x $probe_binding
while :
do shift
shift
case $# in
0) break ;;
esac
rm -f dynamic.$exe
$cc -o dynamic.$exe $1 dynamic.$obj 2>e && $executable dynamic.$exe || continue
case $1 in
?*) case $maybe in
"") maybe=$1 ;;
*) maybe=-- ;;
esac
;;
esac
case `wc -l e` in
$e) ;;
*) continue ;;
esac
d=`ls -s dynamic.$exe`
rm -f dynamic.$exe
$cc -o dynamic.$exe $2 dynamic.$obj 2>e && $executable dynamic.$exe || continue
case `wc -l e` in
$e) ;;
*) continue ;;
esac
case `ls -s dynamic.$exe` in
$d) ;;
*) dynamic=$1
static=$2
maybe=
break
;;
esac
done
case $maybe in
""|--) ;;
*) dynamic=$maybe ;;
esac
fi
fi
echo 'main(){return(0);}' > hosted.$src
$cc -o hosted.$exe hosted.$src && ./hosted.$exe && hosted=1
cp /bin/echo cpp
chmod u+w cpp
for prefix in $probe_ppprefix `echo $cc | sed -e '/cc\$/!d' -e 's,cc\$,,' -e 's,.*/,,'`
do cp cpp ${prefix}cpp
done
echo "" > flags.$src
echo '#pragma pp:version' > libpp.$src
if test `realcppC=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='realcppC=${ppcmd}'
elif test `cppC=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='cppC=${ppcmd}'
elif test `_CPPNAME=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='_CPPNAME=${ppcmd}'
elif test `_CPP=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='_CPP=${ppcmd}'
elif test `$cc -Dprobe -E -%p+. flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1 && test `$cc -Dprobe -E -%p+. flags.$src | wc -l` -eq 1
then ppopt='-%p+${ppdir}'
elif test `$cc -Dprobe -E -Yp,. flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-Yp,${ppdir}'
elif test `$cc -Dprobe -E -Qpath $tmpdir flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-Qpath ${ppdir}'
elif test `$cc -Dprobe -E -tp -B./ flags.$src 2>err.out | tee cpp.out | grep -c '[-]Dprobe'` -eq 1 -a ! -s err.out
then ppopt='-tp -B${ppdir}/'
elif test `$cc -Dprobe -E -B./ flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-B${ppdir}/'
elif test `$cc -Dprobe -E -tp -h./ -B flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-tp -h${ppdir}/ -B'
elif test `$cc -Dprobe -E -t p,./cpp flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-t p,${ppcmd}'
else {
eval set x $probe_verbose
shift
for o in "$@"
do $cc -E $o flags.$src
done
} 2>&1 | sed -e "s/['\"]//g" > cpp.out
fi
set x `cat cpp.out`
def=
definclude="-I+C -I-H"
stdinclude=$definclude
usrinclude=/usr/include
while :
do case $# in
0|1) break ;;
esac
shift
case $1 in
-A) case $2 in
*\(*\)) shift
prepred="$prepred `echo $1 | sed 's/\(.*\)(\(.*\))/\1 \2/'`"
;;
esac
;;
-A\(*\))
prepred="$prepred `echo $1 | sed 's/-A\(.*\)(\(.*\))/\1 \2/'`"
;;
-[DI][-+][A-Z]*)
stdpp=1
case $1 in
-I?[CH]) case $def in
?*) definclude="$definclude $1" ;;
*) stdinclude="$stdinclude $1" ;;
esac
;;
-I-S*|-YI,*) usrinclude="`echo $1 | sed 's/....//'`" ;;
-Y?,*) ;;
-Y*) usrinclude="`echo $1 | sed 's/..//'`" ;;
esac
;;
-D) shift
case $1 in
[A-Za-z_]*=*) predef="$predef
`echo $1 | sed -e 's/=.*//'`" ;;
[A-Za-z_]*) predef="$predef
$1" ;;
esac
;;
-Dprobe);;
-D*) case $1 in
-D[A-Za-z_]*=*) predef="$predef
`echo $1 | sed -e 's/^-D//' -e 's/=.*//'`" ;;
-D[A-Za-z_]*) predef="$predef
`echo $1 | sed -e 's/^-D//'`" ;;
esac
;;
-I) shift
case $1 in
[\\/]*) case $def in
?*) definclude="$definclude $1" ;;
*) stdinclude="$stdinclude $1" ;;
esac
;;
esac
;;
-I[\\/]*)
case $def in
?*) definclude="$definclude `echo $1 | sed 's/-I//'`" ;;
*) stdinclude="$stdinclude `echo $1 | sed 's/-I//'`" ;;
esac
;;
-U) shift
undef="$undef $1"
;;
-U*) undef="$undef `echo $1 | sed 's/^-U//'`"
;;
flags.$src)def=
;;
esac
done
stdinclude="$stdinclude $definclude"
case " $stdinclude " in
*\ $usrinclude\ *)
case $usrinclude in
[\\/]usr[\\/]include)
usrinclude=
;;
*) case " $stdinclude " in
*\ [\\/]usr[\\/]include\ *)
usrinclude=
;;
*) usrinclude=/usr/include
;;
esac
;;
esac
;;
esac
case $ppopt$ppenv in
?*) echo '#!/bin/sh
echo $VIRTUAL_ROOT | sed "s/:.*//"' > cpp
chmod +x cpp
ppcmd=cpp
ppdir=.
eval x='`'$ppenv '$'cc -E $ppopt flags.$src'`'
case $x in
?*) tstinclude=$x/usr/include
;;
esac
cp /bin/echo cpp
chmod u+w cpp
;;
esac
eval set x $probe_include
while :
do shift
case $# in
0) break ;;
esac
echo "#include <$1>" > include.$src
$cc -E include.$src
done > include.out
ccinclude=
x=$stdinclude
stdinclude=
for f in $x $tstinclude `sed -e '/^#[line ]*[0-9][0-9]*[ ][ ]*"[\\\\/]/!d' -e s'/^#[line ]*[0-9][0-9]*[ ][ ]*"\(.*\)[\\\\/].*".*/\1/' include.out | sort -u`
do case $f in
-I*) ;;
*[\\/]cc)
ccinclude=1
;;
*[\\/]sys)
f=`echo $f | sed -e 's/.sys\$//'`
case $f in
${usrinclude}[\\/]*)
test -d $f/sys -o -f $f/stdio.h -o -f $f/iostream.h || continue
;;
$usrinclude)
continue
;;
esac
;;
${usrinclude}[\\/]*)
test -d $f/sys -o -f $f/stdio.h -o -f $f/iostream.h || continue
;;
$usrinclude)
continue
;;
esac
if test -d $f
then case " $stdinclude " in
*\ $f\ *) ;;
*) stdinclude="$stdinclude $f" ;;
esac
fi
done
rm include.out
case $ccinclude in
?*) eval set x $probe_include
while :
do shift
case $# in
0) break ;;
esac
echo "#include <cc/$1>" > include.$src
if $cc -E include.$src > /dev/null
then break
fi
done
case $# in
0) ;;
*) x=$stdinclude
stdinclude=
for f in $x
do case $f in
*[\\/]cc) ;;
*) stdinclude="$stdinclude $f" ;;
esac
done
;;
esac
;;
esac

View File

@@ -0,0 +1,35 @@
/* $XConsortium: Makefile /main/2 1996/05/10 17:19:23 drk $ */
/*
* ast package initialization
*/
:PACKAGE: ast
hostinfo :: hostinfo.sh
/*
* probe initialization
*/
for T C.probe
$(LIBDIR)/probe/$(T:B)/probe :INSTALL: $(T)
end
$(LIBDIR)/make :INSTALLDIR: PROBE.mk
:: RELEASE hosttype.tst
/*
* proto initialization
*/
$(INCLUDEDIR) :INSTALLDIR: prototyped.h
$(BINDIR)/proto : .DONTCARE
prototyped.h : $(BINDIR)/proto
$(PROTO) -f /dev/null > h.$(tmp).h
if $(CMP) -s h.$(tmp).h $(<)
then $(RM) -f h.$(tmp).h
else $(MV) h.$(tmp).h $(<)
fi

View File

@@ -0,0 +1,186 @@
note : : make abstract machine file generated from Makefile : : note
info mam static 00000 07/17/94 make (AT&T Bell Laboratories) 3.2 research 07/17/95
setv INSTALLROOT ../../..
setv PACKAGE_ast ${INSTALLROOT}
setv PACKAGE_ast_INCLUDE ${PACKAGE_ast}/include
setv PACKAGE_ast_LIB ${PACKAGE_ast}/lib
setv AR ar
setv ARFLAGS cr
setv AS as
setv ASFLAGS
setv CC cc
setv CCFLAGS "-O"
setv COTEMP $$
setv CPIO cpio
setv CPIOFLAGS
setv CPP "${CC} -E"
setv F77 f77
setv HOSTCC ${CC}
setv IGNORE
setv LD ld
setv LDFLAGS
setv LEX lex
setv LEXFLAGS
setv LPR lpr
setv LPRFLAGS
setv M4FLAGS
setv MAKE nmake
setv MAKEFLAGS
setv PR pr
setv PRFLAGS
setv SHELL /bin/sh
setv SILENT
setv TAR tar
setv YACC yacc
setv YACCFLAGS -d
make install
make all
make hostinfo
make hostinfo.sh
done hostinfo.sh
prev hostinfo.sh
exec - case static,port:$OPTIND:$RANDOM in
exec - ?*:*:*|*::*|*:*:$RANDOM)
exec - ;;
exec - *) if ENV= x= $SHELL -n -c '${list[level]} ' 2>/dev/null
exec - then ENV= $SHELL -n hostinfo.sh
exec - fi
exec - ;;
exec - esac
exec - case '' in
exec - "") cp hostinfo.sh hostinfo
exec - ;;
exec - *) {
exec - i=`(read x; echo $x) < hostinfo.sh`
exec - case $i in
exec - '#!'*|*'||'*|':'*|'":"'*|"':'"*) echo $i ;;
exec - esac
exec - echo
exec - cat hostinfo.sh
exec - } > hostinfo
exec - ;;
exec - esac
exec - chmod u+w,+x hostinfo
done hostinfo generated
done all virtual
make ${INSTALLROOT}/bin
exec - set -
exec - if test ! -d ${INSTALLROOT}/bin
exec - then set -x && mkdir -p ${INSTALLROOT}/bin 2>/dev/null && set - ||
exec - {
exec - test -d ./-p && rm -rf ./-p
exec - p=
exec - for d in `echo ${INSTALLROOT}/bin | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done ${INSTALLROOT}/bin generated
make ${INSTALLROOT}/bin/hostinfo
prev hostinfo
exec - { mv ${INSTALLROOT}/bin/hostinfo ${INSTALLROOT}/bin/hostinfo.old 2>/dev/null; cp hostinfo ${INSTALLROOT}/bin/hostinfo 2>/dev/null ;} || true
done ${INSTALLROOT}/bin/hostinfo generated
make ${INSTALLROOT}/lib/probe/C
exec - set -
exec - if test ! -d ${INSTALLROOT}/lib/probe/C
exec - then set -x && mkdir -p ${INSTALLROOT}/lib/probe/C 2>/dev/null && set - ||
exec - {
exec - test -d ./-p && rm -rf ./-p
exec - p=
exec - for d in `echo ${INSTALLROOT}/lib/probe/C | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done ${INSTALLROOT}/lib/probe/C generated
make ${INSTALLROOT}/lib/probe/C/probe
make C.probe
done C.probe
exec - { mv ${INSTALLROOT}/lib/probe/C/probe ${INSTALLROOT}/lib/probe/C/probe.old 2>/dev/null; cp C.probe ${INSTALLROOT}/lib/probe/C/probe 2>/dev/null ;} || true
done ${INSTALLROOT}/lib/probe/C/probe generated
make ${INSTALLROOT}/lib/make
exec - set -
exec - if test ! -d ${INSTALLROOT}/lib/make
exec - then set -x && mkdir -p ${INSTALLROOT}/lib/make 2>/dev/null && set - ||
exec - {
exec - test -d ./-p && rm -rf ./-p
exec - p=
exec - for d in `echo ${INSTALLROOT}/lib/make | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done ${INSTALLROOT}/lib/make generated
make ${INSTALLROOT}/lib/make/PROBE.mk
make PROBE.mk
done PROBE.mk
exec - { mv ${INSTALLROOT}/lib/make/PROBE.mk ${INSTALLROOT}/lib/make/PROBE.mk.old 2>/dev/null; cp PROBE.mk ${INSTALLROOT}/lib/make/PROBE.mk 2>/dev/null ;} || true
done ${INSTALLROOT}/lib/make/PROBE.mk generated
make ${INSTALLROOT}/include/ast
exec - set -
exec - if test ! -d ${INSTALLROOT}/include/ast
exec - then set -x && mkdir -p ${INSTALLROOT}/include/ast 2>/dev/null && set - ||
exec - {
exec - test -d ./-p && rm -rf ./-p
exec - p=
exec - for d in `echo ${INSTALLROOT}/include/ast | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done ${INSTALLROOT}/include/ast generated
make ${INSTALLROOT}/include/ast/prototyped.h
make prototyped.h
exec - proto -f /dev/null > h.${COTEMP}.h
exec - if cmp -s h.${COTEMP}.h prototyped.h
exec - then rm -f h.${COTEMP}.h
exec - else mv h.${COTEMP}.h prototyped.h
exec - fi
done prototyped.h generated
exec - { mv ${INSTALLROOT}/include/ast/prototyped.h ${INSTALLROOT}/include/ast/prototyped.h.old 2>/dev/null; cp prototyped.h ${INSTALLROOT}/include/ast/prototyped.h 2>/dev/null ;} || true
done ${INSTALLROOT}/include/ast/prototyped.h generated
done install virtual

View File

@@ -0,0 +1,14 @@
/* $XConsortium: PROBE.mk /main/2 1996/10/30 14:44:50 drk $ */
/*
* @(#)probe (AT&T Bell Laboratories) 11/11/91
*
* <lang> <tool> :PROBE: *.probe *.sh *
*
* common probe script installation
* generates probe.sh and probe in .
*/
":PROBE:" : .MAKE .OPERATOR
probe.sh : $(LIBDIR)/probe/$(<:O=1)/probe $(>:N=*.(probe|sh))
cat $(*) > $(<)
$(LIBDIR)/probe/$(<:O=1)/$(<:O=2) :INSTALLDIR: probe $(>:N!=*.(probe|sh))

View File

@@ -0,0 +1,13 @@
recent -last initialization changes
05/09/95 save original PATH in _probe_PATH
hostinfo with no args equivalent to `hostinfo type'
beef up library dir probe
04/01/95 use c source suffix if it still preserves the dialect
add hostinfo
add lib/hostinfo/typemap user type map
add sol.sun4 cpu count
fix C.probe to properly handle C/C++ combined compiler drivers
add NeXT to hostinfo
bummer: mach has /usr/bin/hostinfo
03/19/95 fix dialect executable test

View File

@@ -0,0 +1,475 @@
: $XConsortium: hostinfo.sh /main/2 1996/05/10 16:42:59 drk $
:
# hostinfo [ cpu debug name rating regress type ... ]
#
# print info for the current host on one line in argument order
#
# some of this is a stretch but we have to standardize on something
# if you don't like the results then change it here
#
# to generate a type regression record for the current host:
#
# hostinfo regress type < /dev/null
#
# to test a file of type regression records:
#
# hostinfo regress type < hosttype.tst
#
# lib/hostinfo/typemap is a file of <pattern> <value> pairs
# if the generated type matches a <pattern> then the type
# is changed to the corresponding <value>
#
# @(#)hostinfo (gsf@research.att.com) 05/09/95
#
command=hostinfo
args=$*
debug=
ifs=$IFS
magic=4400000
map=
regress=
shell=`(eval 'typeset -l x=$((0+0))KSH; echo ${x#0}') 2>/dev/null`
something=
PATH=$PATH:/usr/kvm:/usr/ccs/bin:/usr/local/bin:/usr/add-on/gnu/bin:/usr/add-on/GNU/bin:/opt/gnu/bin:/opt/GNU/bin
export PATH
# validate the args
for info in $args
do case $info in
debug) debug=1
;;
regress)regress=1
;;
cpu|name|rating|type)
something=1
;;
*) echo "$0: $info: unknown info name" >&2
echo "Usage: $0 [ cpu debug name rating regress type ... ]" >&2
exit 1
;;
esac
done
case $regress$something in
"") set "$@" type ;;
esac
case $debug in
"") exec 2>/dev/null
;;
*) PS4='+$LINENO+ '
set -x
;;
esac
# compute the info
output=
for info in $args
do case $info in
cpu) cpu=1
set /usr/kvm/mpstat 'cpu[0-9]' \
/usr/etc/cpustatus 'enable' \
/usr/alliant/showsched 'CE' \
prtconf 'cpu-unit'
while :
do case $# in
0) break ;;
esac
i=`$1 2>/dev/null | tr ' ' '
' | grep -c "^$2"`
case $i in
[1-9]*) cpu=$i
break
;;
esac
shift 2
done
case $cpu in
1) set \
\
hinv \
'/^[0-9][0-9]* .* Processors*$/' \
'/[ ].*//' \
\
/usr/bin/hostinfo \
'/^[0-9][0-9]* .* physically available\.*$/' \
'/[ ].*//' \
while :
do case $# in
0) break ;;
esac
i=`$1 2>/dev/null | sed -e "${2}!d" -e "s${3}"`
case $i in
[1-9]*) cpu=$i
break
;;
esac
shift 3
done
;;
esac
output="$output $cpu"
;;
name) name=`hostname || uname -n || cat /etc/whoami || echo local`
output="$output $name"
;;
rating) cd /tmp
tmp=hi$$
trap 'rm -f $tmp.*' 0 1 2
cat > $tmp.c <<!
main()
{
register unsigned long i;
register unsigned long j;
register unsigned long k = 0;
for (i = 0; i < 5000; i++)
for (j = 0; j < 50000; j++)
k += j;
return k == 0;
}
!
rating=1
if cc -o $tmp.exe -O $tmp.c ||
gcc -o $tmp.exe -O $tmp.c
then set "" `{ time ./$tmp.exe; } 2>&1`
while :
do shift
case $# in
0) break ;;
esac
case $1 in
*[uU]*) case $1 in
[uU]*) shift
;;
*) IFS=${ifs}uU
set $1
IFS=$ifs
;;
esac
case $shell in
ksh) IFS=${ifs}mMsS.
set $1
IFS=$ifs
;;
*) m=`echo $1 | tr '[mMsS.]' ' '`
set $m
;;
esac
case $# in
1) m=0 s=$1 f=0 ;;
2) m=0 s=$1 f=$2 ;;
*) m=$1 s=$2 f=$3 ;;
esac
case $shell in
ksh) i="$(( $magic / ( ( $m * 60 + $s ) * 100 + $f ) ))"
j="$(( ( $i % 10 ) / 10 ))"
i="$(( i / 100 ))"
if (( $i >= 10 ))
then if (( $j >= 5 ))
then i="$(( $i + 1 ))"
fi
j=
else j=.$j
fi
;;
*) i=`expr $magic / \( \( $m \* 60 + $s \) \* 100 + $f \)`
j=`expr \( $i % 10 \) / 10`
i=`expr $i / 100`
if expr $i \>= 10 >/dev/null
then if expr $j \>= 5 >/dev/null
then i=`expr $i + 1`
fi
j=
else j=.$j
fi
;;
esac
rating=$i$j
break
;;
esac
done
fi
output="$output $rating"
;;
type) IFS=:
set /:$PATH
IFS=$ifs
shift
f=../lib/hostinfo/typemap
for i
do case $i in
"") i=. ;;
esac
if test -f $i/$f
then map="`grep -v '^#' $i/$f` $map"
fi
done
while :
do case $regress in
?*) read expected host arch mach os sys rel ver ||
case $regress in
1) regress=0 ;;
*) break ;;
esac
;;
esac
case $regress in
""|0) set "" \
`hostname || uname -n || cat /etc/whoami || echo local` \
`{ arch || uname -m || att uname -m || uname -s || att uname -s || echo unknown ;} | sed "s/[ ]/-/g"` \
`{ mach || machine || uname -p || att uname -p || echo unknown ;} | sed -e "s/[ ]/-/g"` \
`uname -a || att uname -a || echo unknown $host unknown unknown unknown unknown unknown`
expected=$1 host=$2 arch=$3 mach=$4 os=$5 sys=$6 rel=$7 ver=$8
;;
esac
type=unknown
case $regress in
?*) regress=hostname
case $host in
*.*) regress="$regress.domain" ;;
esac
regress="$regress $arch $mach $os hostname"
case $sys in
*.*) regress="$regress.domain" ;;
esac
regress="$regress $rel $ver"
;;
esac
case $host in
*.*) case $shell in
ksh) host=${host%%.*} ;;
*) host=`echo $host | sed -e 's/\..*//'` ;;
esac
;;
esac
case $mach in
unknown)
mach=
;;
r[3-9]000)
case $shell in
ksh) mach="mips$((${mach#r}/1000-2))"
;;
*) mach=`echo $mach | sed -e 's/^.//'`
mach=mips`expr $mach / 1000 - 2`
;;
esac
;;
esac
case $os in
$host|unknown)
set \
\
/NextDeveloper -d next \
while :
do case $# in
0) break ;;
esac
if test $2 $1
then os=$3
break
fi
shift 3
done
;;
esac
case $os in
AIX*|aix*)
type=ibm.risc
;;
HP-UX) case $arch in
9000/[78]*)
type=hp.pa
;;
*) type=hp.ux
;;
esac
;;
IRIX*|irix*)
type=sgi.mips
case $arch in
[a-zA-Z][a-zA-Z][0-9][0-9]*|[a-zA-Z][a-zA-Z]1[3-9]*)
type=${type}2
;;
[a-zA-Z][a-zA-Z][0-9]*)
type=${type}1
;;
esac
;;
OSx*|SMP*|pyramid)
type=pyr
;;
[Ss]ol*)
type=sol.sun4
;;
[Ss]un*)
case $shell in
ksh) x=${arch#sun?}
type=${arch%$x}
;;
*) type=`echo $arch | sed -e 's/\(sun.\).*/\1/'`
;;
esac
case $rel in
[0-4]*) ;;
*) case $type in
'') case $mach in
sparc*) type=sun4 ;;
*) type=$mach ;;
esac
;;
esac
type=sol.$type
;;
esac
;;
$host) type=$arch
case $type in
*.*|*[0-9]*86|*68*)
;;
*) case $mach in
*[0-9]*86|*68*|mips)
type=$type.$mach
;;
esac
;;
esac
;;
unknown)
case $arch in
?*) case $arch in
sun*) mach= ;;
esac
type=$arch
case $mach in
?*) type=$type.$mach ;;
esac
;;
esac
;;
*) case $ver in
FTX*|ftx*)
case $mach in
*[0-9][a-zA-Z]*)
case $shell in
ksh) mach="${mach%%+([a-zA-Z])}" ;;
*) mach=`echo $mach | sed -e 's/[a-zA-Z]*$//'` ;;
esac
;;
esac
type=stratus.$mach
;;
*) case $shell in
ksh) type=${os%[0-9]*}
type=${type%%[!A-Za-z_0-9.]*}
;;
*) type=`echo $os | sed -e 's/[0-9].*//'`
;;
esac
case $arch in
'') case $mach in
?*) type=$type.$mach ;;
esac
;;
*) type=$type.$arch ;;
esac
;;
esac
esac
case $type in
[0-9]*) case $mach in
?*) type=$mach ;;
esac
case $type in
*/MC) type=ncr.$type ;;
esac
;;
*.*) ;;
*[0-9]*86|*68*)
case $rel in
[34].[0-9]*)
type=att.$type
;;
esac
;;
[a-z]*[0-9])
;;
[a-z]*) case $mach in
$type) case $ver in
Fault*|fault*|FAULT*)
type=ft.$type
;;
esac
;;
?*) type=$type.$mach
;;
esac
;;
esac
case $shell in
ksh) type=${type%%[-+/]*} ;;
*) type=`echo $type | sed -e 's/[-+/].*//'` ;;
esac
case $type in
*.*) case $shell in
ksh) lhs=${type%.*}
rhs=${type#*.}
;;
*) lhs=`echo $type | sed -e 's/\..*//'`
rhs=`echo $type | sed -e 's/.*\.//'`
;;
esac
case $rhs in
[0-9]*86)
rhs=i$rhs
;;
68*) rhs=m$rhs
;;
esac
case $rhs in
i[2-9]86) rhs=i386 ;;
esac
case $lhs in
$rhs) type=$lhs ;;
*) type=$lhs.$rhs ;;
esac
;;
esac
case $shell in
ksh) typeset -l type=$type ;;
*) type=`echo $type | tr '[A-Z]' '[a-z]'` ;;
esac
# last chance mapping
set "" "" $map
while :
do case $# in
[012]) break ;;
esac
shift 2
eval " case \$type in
$1) type=\$2; break ;;
esac"
done
case $regress in
"") break ;;
esac
case $expected in
""|$type) echo $type $regress ;;
*) echo FAIL $expected $type $regress ;;
esac
done
output="$output $type"
;;
esac
done
case $regress in
"") echo $output ;;
esac

View File

@@ -0,0 +1,5 @@
hp.pa hostname 9000/730 hp9000s700 HP-UX hostname A.09.01 A
linux.i386 hostname i586 i386 linux hostname 1.1.59 #1
sgi.mips2 hostname.domain IP22 mips IRIX hostname 5.2 02282016
sol.sun4 hostname.domain sun4 sparc SunOS hostname.domain 5.4 Generic_101945-13
sun4 hostname.domain sun4 sparc SunOS hostname.domain 4.1.1 1 sun4c

View File

@@ -0,0 +1,417 @@
:
# Glenn Fowler
# AT&T Bell Laboratories
#
# @(#)C.probe (AT&T Bell Laboratories) 11/11/93
#
# probe [ -d ] c-compiler-path [ attributes ]
#
# common C probe preamble for the tool specific probes
#
#
# probe_* are first eval'd and then attempted from left to right
#
probe_binding="-dy -dn -Bdynamic -Bstatic -Wl,-ashared -Wl,-aarchive -call_shared -non_shared '' -static"
probe_env="CC_OPTIONS CCOPTS LD_OPTIONS LDOPTS LIBPATH LPATH"
probe_include="stdio.h iostream.h complex.h ctype.h plot.h stdarg.h varargs.h ranlib.h hash.h sys/types.h"
probe_ld="ld link"
probe_ldlib="LD_LIBRARY_PATH LIBPATH LPATH"
probe_ldmap="'-Wl,-M' '-Qoption ld -M' '-m'"
probe_members="-all"
probe_nm="nm"
probe_nmflags="'' -p -B"
probe_obj="o obj"
probe_pic="-Kpic -fpic -pic +z '-G 0'"
probe_ppprefix="a n"
probe_shared="'' -G -b -c -shared"
probe_size="size"
probe_src="cxx C cc c"
probe_readonly="-R -Wa,-r"
probe_so=".so.1 .so .sl"
probe_symprefix="_"
probe_unresolved="'-expect_unresolved \"*\"'"
probe_verbose="'-v -v' '-# -#' '-d -d' -dryrun"
#
# the following are set by the preamble for the tool specific probe
#
cc=cc
debug=
dir=.
dynamic=
exe=exe
executable="test -x"
hosted=
ppenv=
ppopt=
predef=
prepred=
so=
static=
stdlib=
stdpp=
tmpdir=/tmp/probe$$
undef="define defined elif else endif error if ifdef ifndef include line pragma undef __STDC__ __STDPP__ __ARGC__ __BASE__ __DATE__ __FILE__ __LINE__ __PATH__ __TIME__ __VERSION__"
#
# now the common probes
#
case $1 in
-d) debug=1; shift ;;
-*) set x ;;
*) debug= ;;
esac
cc=$1
case $cc in
/*) ;;
*) echo "Usage: $0 [ -d ] c-compiler-path [ attributes ]" >&2; exit 1 ;;
esac
ATTRIBUTES=
eval $2
PATH=/bin:/usr/bin:$PATH
case $0 in
*/*) dir=`echo $0 | sed -e 's,//*[^/]*\$,,'` ;;
esac
$executable . 2>/dev/null || executable='test -r'
trap 'code=$?; cd ..; rm -rf $tmpdir; exit $code' 0 1 2 3
mkdir $tmpdir
cd $tmpdir
exec 3>&1 4>&2 </dev/null
case $debug in
"") exec >/dev/null 2>&1
;;
*) PS4='+$LINENO+ '
set -x
;;
esac
if (xxx=xxx; unset xxx)
then eval unset $probe_env
else eval set x $probe_env
while :
do shift
case $# in
0) break ;;
esac
eval x='$'$1
case $x in
"") ;;
*) eval $1=
export $1
;;
esac
done
fi
for src in $probe_src
do echo "int x;" > test.$src
for obj in $probe_obj
do rm -f test.$obj
done
if $cc -c test.$src
then for obj in $probe_obj
do if test -f test.$obj
then break 2
fi
done
fi
done
case $src in
c) ;;
*) echo '#include <iostream.h>
main()
{
cout << "hello world";
return 0;
}' > dialect.$src
if $cc -c dialect.$src && $cc -o dialect.$exe dialect.$obj && executable dynamic.$exe
then : probably C++
else src=c
fi
;;
esac
set x x '(' 1 'int x;' 0
while :
do shift
shift
case $# in
[01]) break ;;
esac
rm -f test.$obj
echo "$1" > test.$src
$cc -c test.$src
r=$?
case $r in
0) test -f test.$obj || r=1 ;;
*) r=1 ;;
esac
case $2:$r in
0:0) ;;
0:1) echo "$cc: not a C compiler: failed to compile \`\`$1''" >&4
exit 1
;;
1:0) echo "$cc: not a C compiler: successfully compiled \`\`$1''" >&4
exit 1
;;
esac
done
echo '#include <stdio.h>
main(){printf("hello");return(0);}' > dynamic.$src
if $cc -c dynamic.$src
then eval set x $probe_so
while :
do shift
case $# in
0) break ;;
esac
rm -f dynamic.$exe > libc$1
$cc -L. -o dynamic.$exe dynamic.$obj && $executable dynamic.$exe
x=$?
(cd ..; rm $tmpdir/libc$1)
case $x in
0) ;;
*) so=$1
break
;;
esac
done
rm -f dynamic.$exe
if $cc -o dynamic.$exe dynamic.$obj 2>e && $executable dynamic.$exe
then e=`wc -l e`
maybe=
eval set x x $probe_binding
while :
do shift
shift
case $# in
0) break ;;
esac
rm -f dynamic.$exe
$cc -o dynamic.$exe $1 dynamic.$obj 2>e && $executable dynamic.$exe || continue
case $1 in
?*) case $maybe in
"") maybe=$1 ;;
*) maybe=-- ;;
esac
;;
esac
case `wc -l e` in
$e) ;;
*) continue ;;
esac
d=`ls -s dynamic.$exe`
rm -f dynamic.$exe
$cc -o dynamic.$exe $2 dynamic.$obj 2>e && $executable dynamic.$exe || continue
case `wc -l e` in
$e) ;;
*) continue ;;
esac
case `ls -s dynamic.$exe` in
$d) ;;
*) dynamic=$1
static=$2
maybe=
break
;;
esac
done
case $maybe in
""|--) ;;
*) dynamic=$maybe ;;
esac
fi
fi
echo 'main(){return(0);}' > hosted.$src
$cc -o hosted.$exe hosted.$src && ./hosted.$exe && hosted=1
cp /bin/echo cpp
chmod u+w cpp
for prefix in $probe_ppprefix `echo $cc | sed -e '/cc\$/!d' -e 's,cc\$,,' -e 's,.*/,,'`
do cp cpp ${prefix}cpp
done
echo "" > flags.$src
eval set x $probe_include
while :
do shift
case $# in
0) break ;;
esac
echo "#include <$1>"
done > include.$src
echo '#pragma pp:version' > libpp.$src
if test `realcppC=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='realcppC=${ppcmd}'
elif test `cppC=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='cppC=${ppcmd}'
elif test `_CPPNAME=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='_CPPNAME=${ppcmd}'
elif test `_CPP=./cpp $cc -Dprobe -E flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppenv='_CPP=${ppcmd}'
elif test `$cc -Dprobe -E -%p+. flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1 && test `$cc -Dprobe -E -%p+. flags.$src | wc -l` -eq 1
then ppopt='-%p+${ppdir}'
elif test `$cc -Dprobe -E -Yp,. flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-Yp,${ppdir}'
elif test `$cc -Dprobe -E -Qpath $tmpdir flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-Qpath ${ppdir}'
elif test `$cc -Dprobe -E -tp -B./ flags.$src 2>err.out | tee cpp.out | grep -c '[-]Dprobe'` -eq 1 -a ! -s err.out
then ppopt='-tp -B${ppdir}/'
elif test `$cc -Dprobe -E -B./ flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-B${ppdir}/'
elif test `$cc -Dprobe -E -tp -h./ -B flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-tp -h${ppdir}/ -B'
elif test `$cc -Dprobe -E -t p,./cpp flags.$src | tee cpp.out | grep -c '[-]Dprobe'` -eq 1
then ppopt='-t p,${ppcmd}'
else { $cc -E -# -# flags.$src; $cc -E -v -v flags.$src; $cc -E -d -d flags.$src;} 2>&1 | sed -e "s/['\"]//g" > cpp.out
fi
set x `cat cpp.out`
def=
definclude="-I+C -I-H"
stdinclude=$definclude
usrinclude=/usr/include
while :
do case $# in
0|1) break ;;
esac
shift
case $1 in
-A) case $2 in
*\(*\)) shift
prepred="$prepred `echo $1 | sed 's/\(.*\)(\(.*\))/\1 \2/'`"
;;
esac
;;
-A\(*\))
prepred="$prepred `echo $1 | sed 's/-A\(.*\)(\(.*\))/\1 \2/'`"
;;
-[DI][-+][A-Z]*)
stdpp=1
case $1 in
-I?[CH]) case $def in
?*) definclude="$definclude $1" ;;
*) stdinclude="$stdinclude $1" ;;
esac
;;
-I-S*|-YI,*) usrinclude="`echo $1 | sed 's/....//'`" ;;
-Y?,*) ;;
-Y*) usrinclude="`echo $1 | sed 's/..//'`" ;;
esac
;;
-D) shift
case $1 in
[A-Za-z_]*=*) predef="$predef
`echo $1 | sed -e 's/=.*//'`" ;;
[A-Za-z_]*) predef="$predef
$1" ;;
esac
;;
-Dprobe);;
-D*) case $1 in
-D[A-Za-z_]*=*) predef="$predef
`echo $1 | sed -e 's/^-D//' -e 's/=.*//'`" ;;
-D[A-Za-z_]*) predef="$predef
`echo $1 | sed -e 's/^-D//'`" ;;
esac
;;
-I) shift
case $1 in
[\\/]*) case $def in
?*) definclude="$definclude $1" ;;
*) stdinclude="$stdinclude $1" ;;
esac
;;
esac
;;
-I[\\/]*)
case $def in
?*) definclude="$definclude `echo $1 | sed 's/-I//'`" ;;
*) stdinclude="$stdinclude `echo $1 | sed 's/-I//'`" ;;
esac
;;
-U) shift
undef="$undef $1"
;;
-U*) undef="$undef `echo $1 | sed 's/^-U//'`"
;;
flags.$src)def=
;;
esac
done
stdinclude="$stdinclude $definclude"
case " $stdinclude " in
*\ $usrinclude\ *)
case $usrinclude in
[\\/]usr[\\/]include)
usrinclude=
;;
*) case " $stdinclude " in
*\ [\\/]usr[\\/]include\ *)
usrinclude=
;;
*) usrinclude=/usr/include
;;
esac
;;
esac
;;
esac
case $ppopt$ppenv in
?*) echo '#!/bin/sh
echo $VIRTUAL_ROOT | sed "s/:.*//"' > cpp
chmod +x cpp
ppcmd=cpp
ppdir=.
eval x='`'$ppenv '$'cc -E $ppopt flags.$src'`'
case $x in
?*) tstinclude=$x/usr/include
;;
esac
cp /bin/echo cpp
chmod u+w cpp
;;
esac
x=$stdinclude
stdinclude=
for f in $x $tstinclude `$cc -E include.$src | sed -e '/^#[line ]*1[ ][ ]*"[\\\\/]/!d' -e s'/^#[line ]*1[ ][ ]*"\(.*\)[\\\\/].*".*/\1/'`
do case $f in
-I*) stdinclude="$stdinclude $f"
;;
*[\\/]sys|*[\\/]cc)
;;
$usrinclude[\\/]*)
if test -d $f/sys -o -f $f/stdio.h -o -f $f/iostream.h
then case " $stdinclude " in
*\ $f\ *) ;;
*) stdinclude="$stdinclude $f" ;;
esac
fi
;;
$usrinclude)
;;
*) if test -d $f
then case " $stdinclude " in
*\ $f\ *) ;;
*) stdinclude="$stdinclude $f" ;;
esac
fi
;;
esac
done

View File

@@ -0,0 +1,31 @@
/* $XConsortium: Makefile /main/2 1996/05/10 17:19:42 drk $ */
/*
* ast package installation inialization
*/
:PACKAGE: ast
/*
* probe initialization
*/
for T C.probe
$(LIBDIR)/probe/$(T:B)/probe :INSTALL: $(T)
end
$(LIBDIR)/make :INSTALLDIR: PROBE.mk
/*
* proto initialization
*/
$(INCLUDEDIR) :INSTALLDIR: prototyped.h
$(BINDIR)/proto : .DONTCARE
prototyped.h : $(BINDIR)/proto
$(PROTO) -f /dev/null > h.$(tmp).h
if $(CMP) -s h.$(tmp).h $(<)
then $(RM) -f h.$(tmp).h
else $(MV) h.$(tmp).h $(<)
fi

View File

@@ -0,0 +1,128 @@
note : : make abstract machine file generated from Makefile : : note
info mam static 0 03/01/94 make (AT&T Bell Laboratories) 3.0 03/01/94
setv INSTALLROOT ../../..
setv PACKAGE_ast $INSTALLROOT
setv PACKAGE_ast_INCLUDE $PACKAGE_ast/include
setv PACKAGE_ast_LIB $PACKAGE_ast/lib
setv AR ar
setv ARFLAGS cr
setv AS as
setv ASFLAGS
setv CC cc
setv CCFLAGS "-O"
setv COTEMP $$
setv CPIO cpio
setv CPIOFLAGS
setv CPP "$CC -E"
setv F77 f77
setv HOSTCC $CC
setv IGNORE
setv LD ld
setv LDFLAGS
setv LEX lex
setv LEXFLAGS
setv LPR lpr
setv LPRFLAGS
setv M4FLAGS
setv MAKE nmake
setv MAKEFLAGS
setv PR pr
setv PRFLAGS
setv SHELL /bin/sh
setv SILENT
setv TAR tar
setv YACC yacc
setv YACCFLAGS -d
make install
make all
done all virtual
make $INSTALLROOT/lib/probe/C
exec - set -
exec - if test ! -d $INSTALLROOT/lib/probe/C
exec - then set -x && mkdir -p $INSTALLROOT/lib/probe/C 2>/dev/null && set - ||
exec - {
exec - p=
exec - for d in `echo $INSTALLROOT/lib/probe/C | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done $INSTALLROOT/lib/probe/C
make $INSTALLROOT/lib/probe/C/probe
make C.probe
done C.probe
exec - { mv $INSTALLROOT/lib/probe/C/probe $INSTALLROOT/lib/probe/C/probe.old 2>/dev/null; cp C.probe $INSTALLROOT/lib/probe/C/probe 2>/dev/null ;} || true
done $INSTALLROOT/lib/probe/C/probe
make $INSTALLROOT/lib/make
exec - set -
exec - if test ! -d $INSTALLROOT/lib/make
exec - then set -x && mkdir -p $INSTALLROOT/lib/make 2>/dev/null && set - ||
exec - {
exec - p=
exec - for d in `echo $INSTALLROOT/lib/make | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done $INSTALLROOT/lib/make
make $INSTALLROOT/lib/make/PROBE.mk
make PROBE.mk
done PROBE.mk
exec - { mv $INSTALLROOT/lib/make/PROBE.mk $INSTALLROOT/lib/make/PROBE.mk.old 2>/dev/null; cp PROBE.mk $INSTALLROOT/lib/make/PROBE.mk 2>/dev/null ;} || true
done $INSTALLROOT/lib/make/PROBE.mk
make $INSTALLROOT/include/ast
exec - set -
exec - if test ! -d $INSTALLROOT/include/ast
exec - then set -x && mkdir -p $INSTALLROOT/include/ast 2>/dev/null && set - ||
exec - {
exec - p=
exec - for d in `echo $INSTALLROOT/include/ast | sed -e 's%\\(.\\)/%\\1 %g'`
exec - do case $p in
exec - "") p=$d ;;
exec - *) p=$p/$d ;;
exec - esac
exec - case $d in
exec - .|..) ;;
exec - *) if test ! -d $p
exec - then rm -f $p
exec - set -x && mkdir $p && set -
exec - fi
exec - ;;
exec - esac
exec - done
exec - } && set -x
exec - fi
done $INSTALLROOT/include/ast
make $INSTALLROOT/include/ast/prototyped.h
make prototyped.h
exec - proto -f /dev/null > h.$COTEMP.h
exec - if cmp -s h.$COTEMP.h prototyped.h
exec - then rm -f h.$COTEMP.h
exec - else mv h.$COTEMP.h prototyped.h
exec - fi
done prototyped.h
exec - { mv $INSTALLROOT/include/ast/prototyped.h $INSTALLROOT/include/ast/prototyped.h.old 2>/dev/null; cp prototyped.h $INSTALLROOT/include/ast/prototyped.h 2>/dev/null ;} || true
done $INSTALLROOT/include/ast/prototyped.h
done install virtual

View File

@@ -0,0 +1,14 @@
/* $XConsortium: PROBE.mk /main/2 1996/10/30 14:45:57 drk $ */
/*
* @(#)probe (AT&T Bell Laboratories) 11/11/91
*
* <lang> <tool> :PROBE: *.probe *.sh *
*
* common probe script installation
* generates probe.sh and probe in .
*/
":PROBE:" : .MAKE .OPERATOR
probe.sh : $(LIBDIR)/probe/$(<:O=1)/probe $(>:N=*.(probe|sh))
cat $(*) > $(<)
$(LIBDIR)/probe/$(<:O=1)/$(<:O=2) :INSTALLDIR: probe $(>:N!=*.(probe|sh))

View File

@@ -0,0 +1,171 @@
/* $XConsortium: Makefile /main/3 1996/05/10 17:20:03 drk $ */
/*
* ast library
*/
ID = ast
VERSION = 4.0
CCFLAGS = -O $(CC.PIC)
:PACKAGE: $(ID)
.SOURCE : obsolete comp dir disc hash man misc path port \
preroot re sfio stdio string tm vec vmalloc
.SOURCE.h : include
PARANOID == "make"
DEBUG ==
HEADERSRC = ast.h ast_dir.h ast_std.h debug.h error.h find.h \
ftwalk.h fs3d.h hash.h hashpart.h ls.h magic.h \
modecanon.h modex.h namval.h option.h proc.h re.h sfio.h \
sfdisc.h sfstr.h stack.h stak.h stdio.h stk.h swap.h tar.h \
times.h tm.h tok.h vdb.h vecargs.h vmalloc.h wait.h
HEADERGEN = align.h int.h limits.h preroot.h sig.h \
$(ID)_botch.h $(ID)_fcntl.h $(ID)_fs.h $(ID)_hdr.h \
$(ID)_lib.h $(ID)_mode.h $(ID)_param.h $(ID)_time.h \
$(ID)_tty.h $(ID)_types.h $(ID)_unistd.h $(ID)_wait.h
$(ID) $(VERSION) :LIBRARY: README RELEASE \
LIBAST.3 ast.3 chr.3 compatibility.3 error.3 find.3 fmt.3 \
fmtls.3 fs3d.3 ftwalk.3 getcwd.3 hash.3 iblocks.3 int.3 \
magic.3 mem.3 modecanon.3 optget.3 path.3 preroot.3 proc.3 \
re.3 setenviron.3 sfdisc.3 sfio.3 sig.3 spawnveg.3 stak.3 \
stk.3 strcopy.3 strdup.3 strelapsed.3 strerror.3 stresc.3 \
streval.3 strgid.3 strmatch.3 stropt.3 strperm.3 strsignal.3 \
strsort.3 strtape.3 strton.3 struid.3 swap.3 tab.3 tm.3 \
tok.3 touch.3 vecargs.3 vmalloc.3 \
$(HEADERSRC) $(HEADEROLD) \
state.c \
dirlib.h opendir.c readdir.c rewinddir.c seekdir.c telldir.c \
getcwd.c fastfind.c \
hashlib.h hashalloc.c hashdump.c hashfree.c hashlast.c \
hashlook.c hashscan.c hashsize.c hashwalk.c \
memhash.c memsum.c strhash.c strsum.c \
mematoe.c memetoa.c \
chresc.c chrtoi.c streval.c strexpr.c strmatch.c strcopy.c \
modelib.h modei.c modex.c strmode.c strlook.c \
stresc.c stropt.c strtape.c tok.c tokline.c tokscan.c \
pathaccess.c pathcat.c pathcanon.c pathcheck.c pathpath.c \
pathkey.c pathprobe.c pathrepl.c pathtemp.c pathstat.c \
pathgetlink.c pathsetlink.c pathbin.c pathshell.c pathcd.c \
fs3d.c ftwalk.c ftwflags.c setenviron.c \
optget.c optjoin.c strsort.c \
astcopy.c astconf.c astquery.c astwinsize.c \
magic.c signal.c systrace.c \
error.c liberror.c \
fmtbase.c fmtdev.c fmtelapsed.c fmterror.c fmtesc.c fmtfs.c \
fmtls.c fmtmatch.c fmtmode.c fmtperm.c fmtre.c \
fmttime.c fmtuid.c fmtgid.c fmtsignal.c \
strelapsed.c strperm.c struid.c strgid.c stack.c stk.c \
swapget.c swapmem.c swapop.c swapput.c \
sigdata.c sigcrit.c sigunblock.c \
proclib.h procopen.c procclose.c procrun.c procfree.c \
relib.h recomp.c reerror.c reexec.c resub.c ressub.c \
tmdate.c tmfix.c tmfmt.c tmform.c tmgoff.c \
tminit.c tmleap.c tmlex.c tmmake.c tmpoff.c \
tmtime.c tmtype.c tmword.c tmzone.c \
vecargs.c vecfile.c vecfree.c vecload.c vecstring.c \
vmhdr.h vmbest.c vmclear.c vmclose.c vmdcheap.c \
vmdcsbrk.c vmdebug.c vmdisc.c vmexit.c vmlast.c vmopen.c \
vmpool.c vmprivate.c vmprofile.c vmregion.c vmsegment.c \
vmset.c vmstat.c vmstrdup.c vmtrace.c \
univlib.h univdata.c touch.c \
memccpy.c memchr.c memcmp.c memcpy.c memdup.c memmove.c memset.c \
mkdir.c mkfifo.c mknod.c rmdir.c remove.c rename.c link.c unlink.c \
strdup.c strchr.c strrchr.c strtod.c strtol.c strtoul.c strton.c \
setlocale.c mktemp.c tmpnam.c \
execve.c spawnve.c spawnveg.c vfork.c killpg.c \
lstat.c readlink.c statvfs.c symlink.c \
getpgrp.c setpgid.c setsid.c waitpid.c \
confmap.c conftab.c confstr.c pathconf.c sysconf.c \
fcntl.c open.c \
atexit.c getdents.c getwd.c dup2.c errno.c \
getpreroot.c ispreroot.c realopen.c setpreroot.c \
getgroups.c mount.c system.c iblocks.c \
modedata.c tmdata.c \
sfkeyprintf.c sfslowio.c \
/* sfio */ \
_sfhdr.h sfhdr.h \
sfclose.c sfclrlock.c sfdisc.c sfdlen.c sfexcept.c \
sfcvt.c sfecvt.c sffcvt.c \
sfextern.c sffilbuf.c sfflsbuf.c sfprints.c sfgetd.c sfgetl.c \
sfgetr.c sfgetu.c sfllen.c sfmode.c sfmove.c sfnew.c \
sfpkrd.c sfnotify.c sfnputc.c sfopen.c sfpeek.c sfpoll.c \
sfpool.c sfpopen.c sfprintf.c sfputd.c sfputl.c sfputr.c \
sfputu.c sfrd.c sfread.c sfreserve.c sfscanf.c sfseek.c sfset.c \
sfsetbuf.c sfsetfd.c sfsize.c sfsk.c sfstack.c sfstrtod.c sfsync.c \
sfswap.c sftable.c sftell.c sftmp.c sfungetc.c sfvprintf.c \
sfvscanf.c sfwr.c sfwrite.c sfpurge.c \
_sfclrerr.c _sfeof.c _sferror.c _sffileno.c \
_sfgetc.c _sfgetl.c _sfgetu.c _sfstacked.c _sfputc.c _sfputd.c \
_sfputl.c _sfputu.c _sfslen.c _sfulen.c \
stdgets.c stdprintf.c stdscanf.c stdvbuf.c stdsprnt.c \
stdvsprnt.c stdvsnprnt.c stdvsscn.c stdopen.c \
/* obsolete */ \
fdcopy.c getpath.c getshell.c getsymlink.c getuniv.c \
getwinsize.c hsort.c lpstat.c putsymlink.c query.c \
setcwd.c setenv.c setuniv.c slowio.c strerror.c \
strsignal.c tablook.c astfeature.c
:INSTALLDIR: conf
conf :: conf.sh
conflib.h conflim.h confmap.h conftab.h confuni.h \
confmap.c conftab.c confstr.c pathconf.c sysconf.c :JOINT: \
conf conf.tab
: generate : $(<:N=*.h)
: generate : $(<:N=*.c)
$(*) $(CC) $(CCFLAGS:N!=-[DIU]*)
/* NOTE: sun4 runtime link botches ro data so advertized sig_info is rw */
:READONLY: confmap.c conftab.c modedata.c sftable.c \
/*sigdata.c*/ tmdata.c univdata.c
$(INCLUDEDIR) :INSTALLPROTO: $(HEADERSRC) $(HEADERGEN)
$(HEADERGEN) :COPY: FEATURE/$$(<:B:/$(ID)_//)
$(LIBDIR)/file/magic :INSTALL: magic.tab
/* dirent.h is problematic */
:INSTALL: $(INCLUDEDIR)/dirent.h
$(INCLUDEDIR)/dirent.h : dirstd.h dirnsys.h dirsys.h ast_lib.h
if grep _hdr_dirent $(*:N=*ast_lib.h) >/dev/null 2>&1
then :
elif grep _hdr_ndir $(*:N=*ast_lib.h) >/dev/null 2>&1 && grep _lib_opendir $(*:N=*ast_lib.h) >/dev/null 2>&1
then $(CP) $(*:N=*dirnsys.h) $(<)
elif grep _sys_dir $(*:N=*ast_lib.h) >/dev/null 2>&1 && grep _lib_opendir $(*:N=*ast_lib.h) >/dev/null 2>&1
then $(CP) $(*:N=*dirsys.h) $(<)
else $(CP) $(*:N=*dirstd.h) $(<)
fi
if _just_the_std
std $(VERSION) :LIBRARY: \
state.c \
opendir.c readdir.c rewinddir.c seekdir.c telldir.c \
getcwd.c setcwd.c \
memccpy.c memchr.c memcmp.c memcpy.c memdup.c memmove.c memset.c \
mkdir.c mkfifo.c mknod.c rmdir.c remove.c rename.c link.c unlink.c \
strchr.c strrchr.c strtod.c strtol.c strtoul.c \
setlocale.c signal.c \
mktemp.c tmpnam.c \
execve.c spawnve.c vfork.c killpg.c \
lstat.c readlink.c statvfs.c symlink.c \
getpgrp.c setpgid.c setsid.c waitpid.c \
pathconf.c sysconf.c fcntl.c open.c \
atexit.c getdents.c dup2.c errno.c \
getgroups.c mount.c system.c
std.h :COPY: ast_std.h
$(INCLUDEDIR) :INSTALLPROTO: std.h
end

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
/* $XConsortium: README /main/2 1996/07/15 14:14:37 drk $ */
The advanced software technology department has been collecting useful C
routines in a single library called libast. libast is used by nmake, the
nmake cpp (which is mainly based on another library (libpp)), CIA
(C information abstractor from Robin Chen), and a collection of other
/bin and /usr/bin commands that benefit from concentrating functionality
in libast.
More detail is available in the man pages. libast contains:
(1) routines to support a generic environment for
a variety of UNIX operating system variants
(2) routines that update standard libc routines
(3) routines shared between several commands
If you already have nmake 2.0 or newer installed then use
`nmake install' from this directory, otherwise use
ship/shipin from the root of the distribution directory tree.
Some of the routines not found in section 3:
hash: generic, scoped hash table support
hashalloc create a hash table or push new scope
hashdump debug dump of one or all hash tables
hashfree free a hashalloc()'d table
hashlook low level name lookup
hashscan entry generator for scoped table scan
hashsize explicitly change table size (usually automatic)
hashwalk apply function to each table entry
memhash return hash code for n-char chunk of memory
strhash return hash code for null terminated string
include/ast: libast support headers
align.h compile time type alignmnent support
dirent.h POSIX directory(3) interface definitions
error.h error() interface definitions
ftw.h ftwalk() interface definitions
hash.h hash*() interface definitions
ls.h strls() interface definitions
re.h re*() interface definitions
tar.h POSIX ustar format interface definitions
tm.h tm*() interface definitions
misc:
cmdargs apply a sequence of cmd line option parsers
cmdopen like popen() but stdin and stdout are specified
cvtatoe convert ASCII to EBCDIC
cvtetoa convert EBCDIC to ASCII
error output generic error and trace messages
ftwalk an ftw(3) that works -- used in new tw(1)
getcwd uses $PWD if ok, doesn't use /bin/pwd
getshell return full path of shell for cmdopen()
ooptget optget() for obsolete ar(1) and tar(1) options
optget YA getopt(3) but no argc or error message output
pathaccess find file with specific acces on list of dirs
pathcanon canonicalize path name in place
pathcmd return full path name of executable using $PATH
pathroot determine `related root' directory for command
perror uses strerror()
readargs append each line of file to argv[0]
re: egrep(1) and ed(1) style re's from V9
(not the good awk(1) algorithm)
recomp compile re pattern
reerror report re*() errors
reexec match string using compiled re
resub ed(1) style substitute using last reexec()
string:
chresc return next char in string converting \ sequences
ctoi convert char constant string to int
strcopy like strcpy(3) but returns end of destination
strdup malloc(3) and strcpy(3) smashed together
strerror return error message string given errno
stresc convert \ sequences in string in place
streval evaluate C expression in string
strls ls -l format support
strmatch Korn shell file pattern match
strmode return ls -l style output given st.st_mode
strsignal return signal id string given SIG* number
strtape convert generic tape unit to /dev/* file
token generate space separated tokens in string
tm: time conversion support
tmdate convert date string to time_t
tmform format time_t to date string
tmmake return current time_t
tmtime convert struct tm to time_t

View File

@@ -0,0 +1,109 @@
libast changes
08/11/95 fix malloc bug in magic
update linux and bsd 386 magic entries
07/17/95 fix port/astconf universe initialization
fix misc/optget opt_info.nopt initialization
drop tmset() TZ=... because it only worked when TZ=... was ignored
05/09/95 mongo <ast.h> namespace cleanup
drop > 2 year old obsolete interfaces
sfvprintf.c fix for (char:8 short:16 int:32 long:64) architectures
TMP_MAX back into conf.tab
pathbin() and pathshell() now use astconf()
fix pathtemp() to not cache getenv("TMPDIR")
fix ftwalk() metaphysical to handle non-dirs too
initialize *_info = { 0 }; for ancient ld semantics (NeXT)
fix magic() to do vmfree()
astconf(X_OK) must prefix lines with "getconf"
use <wchar.h> and wctype in strmatch() if available
_lib_utime_now checks utime(path,0)
_lib_poll_notimer checks poll(x,0,timeout)
add another _lib_utime_now check to port/touch.c
fix dd_buf cast in dir/opendir.c
split getconf.h into conftab.h and conftab.c for :READONLY:
use mbtowc() only if MB_LEN_MAX>1
sfio char* -> Void_t* cleanup
handle old syntax in misc/magic.c
sigdata.c holds readonly signal strings
pathcheck() does AT&T checks for tools matching PARANOID - yuk
unused var cleanup
deprecate hash_info in favor of hashlast()
fix bad conf.sh ksh integer interactions
dll cleanup
magic.c falls back to malloc for now
add environ to <ast.h> -- C library global data syms are *RESERVED*
sfhdr.h memccpy(1,2,3,size_t) prototype
04/01/95 version 4.0
convert to vmalloc
allow sigcritical() nesting mismatch to work around vfork() bug
add strexpr() primitive for streval() with user handle (like ftwalk)
add <magic.h> and magic.c file command magic interface
update magic mail message entry
fix keyprintf() invisible char count nesting bug
add sfstrnew(SF_READ|SF_WRITE) for alternate sfstropen() modes
sfstrnew(SF_READ) but reading requires sfseek(), sfreserve()
add conf.tab and conf.sh to nail C/POSIX limits/unistd macros
add getconf() string interface to *conf*
_DLL_INTERMEDIATE_DATA for systems that require indirect globals
_DLL for building shared libraries with _DLL_INTERMEDIATE_DATA
vecfile() restricted to S_ISREG()
add spawnveg() for job control
convert procopen() PROC_PGRP(id) to spawnveg()
fmterror() returns error text given errno (strerror() does same)
fmtsignal() returns signal text given errno (strsignal() does same)
{sig_name,sig_text,SIG_MAX} -> sig_info.{name,text,sigmax}
liberror("",...) omits [%s library] prefix
update features/signal.c table
add vmdisc() and change vmnewof() to use vmresize()
fix conf.sh to allow refs to previously defined limits
fix undefined entries in getconf()
magic data in magic.tab
fix stropt() pointer cast
vmalloc() exception handler replaces nomalloc()
merge sigdata.c into fmtsignal.c -- sun link needs function w/ data!
sftmp() bug fix
drop local <unistd.h> even with _POSIX_SOURCE
fix vmstrdup() macro arg miscount
fix conf.sh to handle enum'd symbolic constants in unistd.h
drop malloc() et.al. prototypes from vmalloc.h
fix sfvprintf() %d argument reference
add OSF/1 AES symbol(s) to conf.tab
determine standards prefix from conf.tab
add _CS_SHELL to conf.tab
getpath() default is confstr(_CS_PATH)
getshell() default is confstr(_CS_SHELL)
unify keyprintf user function args (should have learned by now!)
add quad type to magic
add astfeature() to unify universe style dynamic features
add ftwflags() to determine FTW_* flags from astfeature()
03/11/95 fix stropt() to not modify its *const* arg
handle "'\ quotes and chresc() in stropt() values
, treated like :space: between stropt() options
fix procopen() fd dup to ignore self-dups
add library id[] to misc/state.c
add ftwalk(FTW_METAPHYSICAL) for posix -H
sfvprintf() now handles balanced () in %()
add tmfmt() with buffer size check to replace tmform()
add fmttime() calling tmfmt() to fit fmt*() mold
add <keyprintf.h> and keyprintf() to support %(...)? in commands
add Hash_table_t for size==0 in stropt()
add EXTTYPE extended header to tar.h
02/14/95 sfmove() buffer size overflow fix
add _SFSTDIO_H to sfio.h
rename setenv() to setenviron() -- posix finally decided
rename <option.h> opt_* to opt_info.*
update features/unistd.c for _SC_* and _PC_* posix additions
01/19/95 (char*)uchar cast in fmtesc()
fix hash bucket memory leak in hashlook() [via John Mocenigo]
update strings/strtape()
fix optget()/optjoin() to handle leading +
add ALIGN_ prefix to <align.h> identifiers
01/11/95 change tm/*.c tmset(0) to tmset(tm_info.zone) to keep user setting
fix tmform() %Z null pointer dereference
01/01/95 add this RELEASE file
fix strperm() to properly handle "644 file"
fix tokline() to return last '\0' terminated line in string
fix tokscan() to properly handle \\n splice
add fmtesc() to complement stresc()
add LS_NUMBER to fmtls()
drop spurious optusage() ' '

View File

@@ -0,0 +1,152 @@
/* $XConsortium: atexit.c /main/3 1995/11/01 17:10:09 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_atexit
NoN(atexit)
#else
#if _lib_onexit || _lib_on_exit
#if !_lib_onexit
#define onexit on_exit
#endif
extern __MANGLE__ int onexit __PROTO__((void(*)(void)));
int
atexit __PARAM__((void (*func)(void)), (func)) __OTORP__(void (*func)();){
return(onexit(func));
}
#else
struct list
{
struct list* next;
void (*func) __PROTO__((void));
};
static struct list* funclist;
extern __MANGLE__ void _exit __PROTO__((int));
int
atexit __PARAM__((void (*func)(void)), (func)) __OTORP__(void (*func)();){
register struct list* p;
if (!(p = newof(0, struct list, 1, 0))) return(-1);
p->func = func;
p->next = funclist;
funclist = p;
return(0);
}
void
_ast_atexit __PARAM__((void), ()){
register struct list* p;
while (p = funclist)
{
funclist = p->next;
(*p->func)();
}
}
#if _std_cleanup
#if _lib__cleanup
extern __MANGLE__ void _cleanup __PROTO__((void));
#endif
void
exit __PARAM__((int code), (code)) __OTORP__(int code;){
_ast_atexit();
#if _lib__cleanup
_cleanup();
#endif
_exit(code);
}
#else
void
_cleanup __PARAM__((void), ()){
_ast_atexit();
}
#endif
#endif
#endif

View File

@@ -0,0 +1,843 @@
: $XConsortium: conf.sh /main/3 1996/05/10 16:43:15 drk $
: generate conf info
#
# @(#)conf.sh (AT&T Bell Laboratories) 06/22/95
#
# this script generates these files from the table file in the first arg
# the remaining args are the C compiler name and flags
#
# conflib.h common generator definitions
# conflim.h limits.h generator code
# confmap.c internal index to external op map data
# confmap.h internal index to external op map definitions
# confstr.c confstr() implementation
# conftab.c readonly string table data
# conftab.h readonly string table definitions
# confuni.h unistd.h generator code
# pathconf.c pathconf() and fpathconf() implementation
# sysconf.c sysconf() implementation
#
# you may think it should be simpler
# but in the process you shall be confused
#
case $RANDOM in
$RANDOM) shell=bsh ;;
*) shell=ksh ;;
esac
test -f $1 || { echo "$0: $1: cannot read" >&2; exit 1; }
exec < $1
generated="/* : : generated by $0 from $1 : : */"
shift
case $# in
0) cc=cc ;;
*) cc=$* ;;
esac
ifs=$IFS
sym=[A-Za-z_]*
tmp=CF_$$
rm -f $tmp.*
trap "rm -f $tmp.*" 0 1 2
cat > $tmp.u <<!
/*
* some implementations (could it beee aix) think empty
* definitions constitute symbolic constants
*/
{
long num;
char* str;
int hit;
!
# walk through the table
case $shell in
ksh) integer len limit_max name_max ;;
esac
limit_max=0
name_max=1
line=
next=
standards=
while :
do prev=$line
line=$next
IFS=""
read next
eof=$?
IFS=$ifs
case $line in
""|\#*) continue ;;
" "*)
set x $line
shift
echo "$*" >> $tmp.h
;;
*) set x $line
shift; name=$1
conf_name=$name
shift; index=$1
conf_index=$index
shift; standard=$1
case " $standards " in
*" $standard "*)
;;
*) standards="$standards $standard"
;;
esac
conf_standard=CONF_${standard}
shift; call=$1
case $call in
CS) conf_call=CONF_confstr
;;
PC) conf_call=CONF_pathconf
;;
SC) conf_call=CONF_sysconf
;;
XX) conf_call=CONF_nop
;;
*) echo "$0: $name: $call: invalid call" >&2
exit 1
;;
esac
shift; section=$1
conf_section=$section
shift; flags=$1
conf_flags=0
case $flags in
*[ABCDEGHIJKOPQRTVWYZa-z1-9_]*)
echo "$0: $name: $flags: invalid flag(s)" >&2
exit 1
;;
esac
case $flags in
*F*) conf_flags="${conf_flags}|CONF_FEATURE" ;;
esac
case $flags in
*L*) conf_flags="${conf_flags}|CONF_LIMIT" ;;
esac
case $flags in
*M*) conf_flags="${conf_flags}|CONF_MINMAX" ;;
esac
case $flags in
*N*) conf_flags="${conf_flags}|CONF_NOSECTION" ;;
esac
case $flags in
*S*) conf_flags="${conf_flags}|CONF_STANDARD" ;;
esac
case $flags in
*U*) conf_flags="${conf_flags}|CONF_UNDERSCORE" ;;
esac
case $shell in
ksh) conf_flags=${conf_flags#0?} ;;
esac
shift; values=$*
set x $prev
set x $2 $next
case $conf_name in
$2|$3) conf_flags="${conf_flags}|CONF_PREFIXED" ;;
esac
case $flags in
*L*) conf_value=$conf_name ;;
*) conf_value=0 ;;
esac
local=LOCAL
case $section in
[01]) ;;
*) case $flags in
*N*) ;;
*) name=${section}_${name} ;;
esac
local=${local}${section}
standard=${standard}${section}
;;
esac
case $call in
XX) conf_op=0
;;
*) case $flags in
*S*) conf_op=_${call}_${standard}_${name} ;;
*) conf_op=_${call}_${name} ;;
esac
cat >> $tmp.u <<!
printf("#undef ${conf_op}\n");
printf("#define ${conf_op} (-${index})\n");
!
cat > $tmp.c <<!
#ifndef _POSIX_SOURCE
#define _POSIX_SOURCE 1
#endif
#include <sys/types.h>
#include <limits.h>
#include <unistd.h>
#include <stdio.h>
main()
{
#ifndef ${conf_op}
printf("#define ${conf_op} %d\n", ${conf_op});
#endif
return 0;
}
!
if $cc -o $tmp.exe $tmp.c >/dev/null 2>&1
then $tmp.exe >> $tmp.e 2>/dev/null
fi
echo ${index} ${conf_op} >> $tmp.m
;;
esac
case $standard:$flags in
C:*) ;;
*:*L*) case $next in
" "*)
values="_${local}_${conf_name} $values"
;;
esac
{
echo " hit = 0;"
case $call in
PC) cat <<!
#if _lib_pathconf && defined(${conf_op})
if ((num = pathconf("/", ${conf_op})) != -1)
hit = 1;
else
#endif
!
;;
SC) cat <<!
#if _lib_sysconf && defined(${conf_op})
if ((num = sysconf(${conf_op})) != -1)
hit = 1;
else
#endif
!
;;
esac
echo " {"
endif=
default=
for i in $conf_name $values
do case $i in
_${standard}_${conf_name})
;;
$sym) cat <<!
#ifdef ${i}
if (!hit && ${i} > 0)
{
hit = 1;
num = ${i};
}
#else
!
endif="#endif
$endif"
case $conf_op:$flags:$i in
0*|*X*:*)
;;
*:*:$conf_name)
echo "#ifndef ${conf_op}"
endif="#endif
$endif"
;;
esac
;;
*) case $default in
"") default=${i} ;;
esac
;;
esac
done
case $default in
?*) cat <<!
if (!hit)
{
hit = 1;
num = ${default};
}
!
;;
esac
echo "${endif} }"
cat <<!
if (hit) printf("#define ${conf_name} %ld\n", num);
else num = -1;
lim[${limit_max}] = num;
#ifndef ${conf_name}
#define ${conf_name} lim[${limit_max}]
#endif
!
} >> $tmp.l
case $shell in
ksh) ((limit_max=limit_max+1)) ;;
*) limit_max=`expr $limit_max + 1` ;;
esac
;;
esac
case $standard:$flags in
C:*) ;;
*:*[FM]*)
case $flags in
*M*) header=l ;;
*) header=u ;;
esac
minmax=
for i in $values
do case $i in
$sym) ;;
*) minmax=${i} ;;
esac
done
macro=_${standard}_${conf_name}
conf_value=${macro}
values="$values ${macro}"
case $minmax in
"") default=1 ;;
*) default=$minmax ;;
esac
{
case $call in
CS) type="char*" var=str fmt='\"%s\"' ;;
*) type=long var=num fmt='%ld' ;;
esac
cat <<!
#if defined(${macro})
{
static ${type} x[] = { ${default}, ${macro} };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
${var} = x[0];
}
else ${var} = x[1];
}
printf("#undef ${macro}\n");
!
case $minmax in
?*) cat <<!
#else
${var} = ${minmax};
#endif
!
;;
esac
cat <<!
printf("#define ${macro} ${fmt}\n", ${var});
!
case $minmax in
"") cat <<!
#endif
!
;;
esac
} >> $tmp.$header
;;
esac
case $call in
CS) conf_value=0 ;;
esac
echo $conf_name $conf_section $conf_standard $conf_value $conf_flags $conf_call $conf_op >> $tmp.G
case $shell in
ksh) len=${#conf_name}
if ((len>=name_max))
then ((name_max=len+1))
fi
;;
*) if expr length ${conf_name} \>= ${name_max} >/dev/null
then name_max=`expr length ${conf_name} + 1`
fi
;;
esac
case $conf_op in
0) ;;
*) {
echo "#ifdef ${conf_op}
case ${conf_op}:"
endif="#endif"
minmax=
for i in $name $values
do case $i in
$sym) echo "#ifdef $i
return($i-0);
#else"
endif="$endif
#endif"
;;
*) case $flags in
*M*) minmax=$i ;;
esac
;;
esac
done
case $minmax in
?*) echo " return($minmax-0);" ;;
*) echo " break;" ;;
esac
echo "$endif"
} >> $tmp.c$call
;;
esac
;;
esac
case $eof in
0) ;;
*) break ;;
esac
done
IFS=$ifs
# internal to external map
base=confmap
{
cat <<!
#pragma prototyped
#define ${base} _conf_map
${generated}
extern const short ${base}[];
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.h || mv $tmp.c ${base}.h
sort -n $tmp.m | {
case $shell in
ksh) integer next ;;
esac
next=0
while read index macro
do case $shell in
ksh) while :
do ((next=next+1))
((next>=$index)) && break
echo " -1,"
done
;;
*) while :
do next=`expr $next + 1`
expr $next \>= $index > /dev/null && break
echo " -1,"
done
;;
esac
cat <<!
#ifdef $macro
$macro,
#else
-1,
#endif
!
done
echo $next >&3
} > $tmp.c 3> $tmp.x
map_max=`cat $tmp.x`
{
cat <<!
#pragma prototyped
#include "FEATURE/limits.lcl"
#include "FEATURE/unistd.lcl"
#include "${base}.h"
${generated}
!
if test -s $tmp.e
then cat <<!
/*
* enum used on an extensible namespace -- bad idea
*/
!
cat $tmp.e
fi
cat <<!
/*
* internal to external conf index map
*/
const short ${base}[] =
{
$map_max,
!
cat $tmp.c
echo "};"
} | proto > $tmp.m
cmp -s $tmp.m ${base}.c || mv $tmp.m ${base}.c
# conf string table
base=conftab
case $shell in
ksh) ((name_max=(name_max+3)/4*4)) ;;
*) name_max=`expr \( $name_max + 3 \) / 4 \* 4` ;;
esac
{
cat <<!
#pragma prototyped
#ifndef _CONFTAB_H
#define _CONFTAB_H
${generated}
#define conf _conf_data
#define conf_elements _conf_ndata
#define prefix _conf_prefix
#define prefix_elements _conf_nprefix
#define CONF_nop 0
#define CONF_confstr 1
#define CONF_pathconf 2
#define CONF_sysconf 3
!
index=0
for standard in $standards
do echo "#define CONF_${standard} ${index}"
case $shell in
ksh) ((index=index+1)) ;;
*) index=`expr ${index} + 1` ;;
esac
done
cat <<!
#define CONF_DEFINED (1<<0)
#define CONF_FEATURE (1<<1)
#define CONF_LIMIT (1<<2)
#define CONF_MINMAX (1<<3)
#define CONF_NOSECTION (1<<4)
#define CONF_PREFIXED (1<<5)
#define CONF_STANDARD (1<<6)
#define CONF_UNDERSCORE (1<<7)
#define CONF_USER (1<<8)
typedef struct
{
const char name[${name_max}];
long value;
short flags;
short standard;
short section;
short call;
short op;
} Conf_t;
typedef struct
{
const char name[8];
short length;
short standard;
short call;
} Prefix_t;
extern const Conf_t conf[];
extern int conf_elements;
extern const Prefix_t prefix[];
extern int prefix_elements;
#endif
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.h || mv $tmp.c ${base}.h
{
cat <<!
#pragma prototyped
#include <ast.h>
#include "${base}.h"
${generated}
/*
* prefix strings -- the first few are indexed by Conf_t.standard
*/
const Prefix_t prefix[] =
{
!
for standard in $standards
do case $shell in
ksh) len=${#standard} ;;
*) len=`expr length ${standard}` ;;
esac
echo " \"${standard}\", ${len}, CONF_${standard}, -1,"
done
cat <<!
"CS", 2, CONF_POSIX, CONF_confstr,
"PC", 2, CONF_POSIX, CONF_pathconf,
"SC", 2, CONF_POSIX, CONF_sysconf,
};
int prefix_elements = elementsof(prefix);
/*
* conf strings sorted in ascending order
*/
const Conf_t conf[] =
{
!
if test -f $tmp.G
then sort -u < $tmp.G |
while read name section standard value flags call op
do case $value in
$sym) echo "\"$name\",
#ifdef $value
$value, $flags|CONF_DEFINED,
#else
0, $flags,
#endif
$standard, $section, $call, $op,"
;;
*) echo \"$name\", $value, $flags, $standard, $section, $call, $op,
;;
esac
done
else echo '""'
fi
cat <<!
};
int conf_elements = elementsof(conf);
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.c || mv $tmp.c ${base}.c
# conf generator definitions
base=conflib
{
cat <<!
#pragma prototyped
#define _ast_sysconf(x) 0
#define _sysconf(x) 0
${generated}
!
cat $tmp.h
cat <<!
#undef _ast_sysconf
#undef _sysconf
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.h || mv $tmp.c ${base}.h
# limits.h generation code
base=conflim
{
cat <<!
/*
* some implementations (could it beee aix) think empty
* definitions constitute symbolic constants
*/
{
long num;
char* str;
int hit;
long lim[${limit_max}];
!
cat $tmp.l
echo " }"
} > $tmp.c
cmp -s $tmp.c ${base}.h || mv $tmp.c ${base}.h
# unistd.h generation code
base=confuni
echo " }" >> $tmp.u
cmp -s $tmp.u ${base}.h || mv $tmp.u ${base}.h
# confstr implementation
base=confstr pfx=CS
{
cat <<!
#pragma prototyped
#include <ast.h>
#include <error.h>
${generated}
#include "confmap.h"
#include "conflib.h"
static char*
local_${base}(int op)
{
switch (op)
{
!
test -f $tmp.c${pfx} && cat $tmp.c${pfx}
cat <<!
default:
break;
}
return(0);
}
size_t
${base}(int op, char* buf, size_t siz)
{
char* s;
int n;
#if _lib_${base}
#undef ${base}
if (((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0) && (n = ${base}(n, buf, siz)) > 0)
return(n);
#endif
if (s = local_${base}(op))
{
if ((n = strlen(s) + 1) >= siz)
{
if (siz == 0)
return(n + 1);
buf[n = siz - 1] = 0;
}
memcpy(buf, s, n);
return(n);
}
errno = EINVAL;
return(0);
}
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.c || mv $tmp.c ${base}.c
# pathconf implementation
base=pathconf pfx=PC
{
cat <<!
#pragma prototyped
#include <ast.h>
#include <error.h>
${generated}
#include "confmap.h"
#include "conflib.h"
static long
statconf(struct stat* st, int op)
{
switch (op)
{
!
test -f $tmp.c${pfx} && cat $tmp.c${pfx}
cat <<!
default:
break;
}
errno = EINVAL;
return(-1);
}
long
f${base}(int fd, int op)
{
int n;
struct stat st;
#if _lib_f${base}
#undef f${base}
if ((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0)
{
long val;
int olderrno;
int syserrno;
olderrno = errno;
errno = 0;
val = f${base}(fd, n);
syserrno = errno;
errno = olderrno;
if (val != -1L || syserrno == 0)
return(val);
}
#endif
return((n = fstat(fd, &st)) ? n : statconf(&st, op));
}
long
${base}(const char* path, int op)
{
int n;
struct stat st;
#if _lib_${base}
#undef ${base}
if ((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0)
{
long val;
int olderrno;
int syserrno;
olderrno = errno;
errno = 0;
val = ${base}(path, n);
syserrno = errno;
errno = olderrno;
if (val != -1L || syserrno == 0)
return(val);
}
#endif
return((n = stat(path, &st)) ? n : statconf(&st, op));
}
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.c || mv $tmp.c ${base}.c
# sysconf implementation
base=sysconf pfx=SC
{
cat <<!
#pragma prototyped
#include <ast.h>
#include <error.h>
${generated}
#include "confmap.h"
#include "conflib.h"
long
${base}(int op)
{
int n;
#if _lib_${base}
#undef ${base}
if ((n = op) >= 0 || -op <= confmap[0] && (n = confmap[-op]) >= 0)
{
long val;
int olderrno;
int syserrno;
olderrno = errno;
errno = 0;
val = ${base}(n);
syserrno = errno;
errno = olderrno;
if (val != -1L || syserrno == 0)
return(val);
}
#endif
switch (op)
{
!
test -f $tmp.c${pfx} && cat $tmp.c${pfx}
cat <<!
default:
break;
}
errno = EINVAL;
return(-1);
}
!
} | proto > $tmp.c
cmp -s $tmp.c ${base}.c || mv $tmp.c ${base}.c

View File

@@ -0,0 +1,310 @@
#
# posix limits,unistd,confstr,fpathconf,pathconf,sysconf macro table
#
# @(#)conf.tab (AT&T Bell Laboratories) 05/09/95
#
# name index standard section call flags [ value ... ]
# [ <tab> _LOCAL_name macro definition ... ]
#
# name: sans prefix
# index: starts at 1, must not change or be reused
# standard: AST, C, POSIX, SVID, XOPEN, <vendor-name> { SUN, SGI, ... }
# section: section number in standard
# call: CS=confstr PC=pathconf SC=sysconf XX=none
# flags: 0 no flags
# F feature for unistd.h
# L constant for limits.h
# M has _<standard><section>_<name> minmax value
# N _<call>_<name>
# S _<call>_<standard><section>_<name>
# U <standard><section>_<name> prefixed by underscore
# X define even if local is indeterminant (ast special)
#
# default names if <section> <= 1
#
# _<call>_<name>
# <standard>_<name>
#
# default names if <section> > 1
#
# _<call>_<section>_<name>
# <standard><section>_<name>
#
# the [ENSU] flags modify the default names
#
# NOTE: 132 is the next index
#
AIO_LISTIO_MAX 1 POSIX SC 1 LMU 2
AIO_MAX 2 POSIX SC 1 LMU 1
AIO_PRIO_DELTA_MAX 3 POSIX SC 1 LMU
ARG_MAX 4 POSIX SC 1 LMU NCARGS 4096
ASYNCHRONOUS_IO 5 POSIX SC 1 FU
ASYNC_IO 6 POSIX PC 1 FU
ATEXIT_MAX 82 XOPEN SC 1 LMU 32
AVPHYS_PAGES 121 SUN SC 1 0
BC_BASE_MAX 7 POSIX SC 2 LMN 99
BC_DIM_MAX 8 POSIX SC 2 LMN 2048
BC_SCALE_MAX 9 POSIX SC 2 LMN 99
BC_STRING_MAX 10 POSIX SC 2 LMN 1000
CHARCLASS_NAME_MAX 102 XOPEN XX 1 L 14
CHAR_BIT 13 C XX 1 L 8
CHAR_MAX 14 C XX 1 L
CHAR_MIN 15 C XX 1 L
CHAR_TERM 16 POSIX SC 2 F
CHILD_MAX 17 POSIX SC 1 LMU 6
#define _LOCAL_CHILD_MAX local_child_max()
#if _lib_fork
#define child() fork()
#else
#ifdef _map_spawnve
#define _map_spawnve _map_spawnve
#endif
extern int spawnve(const char*, char* const[], char* const[]);
static char* cmd[] = { "/bin/echo", 0 };
#define child() spawnve(cmd[0],cmd,(char**)0)
#endif
static int
local_child_max(void)
{
int i;
int n;
for (i = 3; i < 512 && (n = child()) >= 0; i++)
if (!n) _exit(0);
while (wait((int*)0) > 0);
for (n = 8; n < i; n <<= 1);
return(n);
}
CHOWN_RESTRICTED 18 POSIX PC 1 FU
CKPT 97 POSIX SC 1 FU
CLK_TCK 19 AST SC 1 MU HZ 60
CLOCKRES_MIN 20 POSIX SC 1 MU 1
COLL_WEIGHTS_MAX 21 POSIX SC 2 LMN 2
CRYPT 116 XOPEN SC 1 FSU
C_BIND 11 POSIX SC 2 F
C_DEV 12 POSIX SC 2 F
C_VERSION 98 POSIX SC 2 F
DELAYTIMER_MAX 22 POSIX SC 1 LMU 32
ENH_I18N 117 XOPEN SC 1 FSU
EXPR_NEST_MAX 23 POSIX SC 2 LMN 32
FCHR_MAX 24 SVID SC 1 LMU LONG_MAX 2147483647
FORT_DEV 25 POSIX SC 2 F
FORT_RUN 26 POSIX SC 2 F
FSYNC 27 POSIX SC 1 FU _lib_fsync
INT_MAX 28 C XX 1 L 32767
INT_MIN 29 C XX 1 L -32767
IOV_MAX 100 XOPEN SC 1 LMU 16
JOB_CONTROL 30 POSIX SC 1 FU
#include "FEATURE/wait"
#ifdef WUNTRACED
#define _LOCAL_JOB_CONTROL 1
#endif
LINE_MAX 31 POSIX SC 2 LMN 2048
LINK_MAX 32 POSIX PC 1 LMU MAXLINK SHRT_MAX 8
LOCALEDEF 99 POSIX SC 1 FU
LOCALEDEF 33 POSIX SC 2 F
LOGNAME_MAX 129 SVID SC 1 MU 8
LONG_BIT 56 XOPEN XX 1 L 32
#ifdef CHAR_BIT
#define _LOCAL_LONG_BIT (CHAR_BIT*sizeof(long))
#else
#define _LOCAL_LONG_BIT (8*sizeof(int))
#endif
LONG_MAX 34 C XX 1 L 2147483647
LONG_MIN 35 C XX 1 L -2147483647
MAPPED_FILES 36 POSIX SC 1 FU _lib_mmap
MAX_CANON 37 POSIX PC 1 LMU CANBSIZ 255
MAX_INPUT 38 POSIX PC 1 LMU MAX_CANON 255
MB_LEN_MAX 39 C XX 1 L 1
MEMLOCK 40 POSIX SC 1 FU
MEMLOCK_RANGE 41 POSIX SC 1 FU
MEMORY_PROTECTION 42 POSIX SC 1 FU
MESSAGE_PASSING 43 POSIX SC 1 FU
MQ_OPEN_MAX 44 POSIX SC 1 LMU 8
MQ_PRIO_MAX 45 POSIX SC 1 LMU 32
NACLS_MAX 122 SVID SC 1 0
NAME_MAX 46 POSIX PC 1 LMU 14
#ifdef MAXNAMLEN
#define _LOCAL_NAME_MAX MAXNAMLEN
#else
#define _LOCAL_NAME_MAX local_name_max()
#if !_lib_remove || _lib_unlink
#define remove unlink
#endif
static int
local_name_max(void)
{
int i;
int n;
int v;
char name[256];
for (i = 0; i < sizeof(name); i++)
name[i] = 'F';
name[8] = '.';
name[sizeof(name) - 1] = 0;
if ((n = creat(name, 0666)) >= 0)
{
close(n);
for (v = 12; v < sizeof(name); v++)
{
name[v] = 0;
if (remove(name) >= 0) break;
name[v] = 'F';
}
}
else for (v = 12; v < sizeof(name); v++)
{
name[v] = 0;
if ((n = creat(name, 0666)) >= 0)
{
close(n);
remove(name);
name[v] = 'F';
}
else
{
v--;
break;
}
}
return(v);
}
#endif
NGROUPS_MAX 47 POSIX SC 1 LMU 0
#if _lib_getgroups
#define _LOCAL_NGROUPS_MAX local_ngroups_max()
static int
local_ngroups_max()
{
int n;
gid_t g;
if ((n = getgroups(0, &g)) < 0)
n = 0;
return(n);
}
#endif
NL_ARGMAX 103 XOPEN XX 1 L 9
NL_LANGMAX 104 XOPEN XX 1 L 14
NL_MSGMAX 105 XOPEN XX 1 L 32767
NL_NMAX 106 XOPEN XX 1 L
NL_SETMAX 107 XOPEN XX 1 L 255
NL_TEXTMAX 108 XOPEN XX 1 L LINE_MAX
NO_TRUNC 48 POSIX PC 1 FU
NPROCESSORS_CONF 123 SVID SC 1 0
NPROCESSORS_ONLN 124 SVID SC 1 0
NZERO 109 XOPEN XX 1 L 20
OPEN_MAX 49 POSIX SC 1 LMU 16
#if _lib_getdtablesize
extern int getdtablesize(void);
#define _LOCAL_OPEN_MAX getdtablesize()
#else
#define _LOCAL_OPEN_MAX local_open_max()
#if _lib_getrlimit && _sys_resource
#include <sys/time.h>
#include <sys/resource.h>
#endif
#ifdef RLIMIT_NOFILE
static int
local_open_max(void)
{
struct rlimit rlim;
if (getrlimit(RLIMIT_NOFILE, &rlim))
return(-1);
return(rlim.rlim_cur);
}
#else
static int
local_open_max(void)
{
int i;
int n;
int v;
n = 0;
v = 2;
while ((i = dup(0)) >= 0)
{
if (!n) n = i;
if (i > v) v = i;
}
while (n <= v) close(n++);
return(v + 1);
}
#endif
#endif
OPEN_MAX_CEIL 50 AST XX 1 L OPEN_MAX
OS_VERSION 119 AES SC 1 FSU
PAGESIZE 51 POSIX SC 1 L PAGE_SIZE 4096
#if _lib_getpagesize
extern ssize_t getpagesize(void);
#define _LOCAL_PAGESIZE getpagesize()
#endif
PAGE_SIZE 101 XOPEN SC 1 L PAGESIZE
PASS_MAX 130 SVID SC 1 MU 8
PATH 52 POSIX CS 1 MU "/bin:/usr/bin"
PATH_MAX 53 POSIX PC 1 LMUX MAXPATHLEN 1024 256
PHYS_PAGES 125 SUN SC 1 0
PID_MAX 54 SVID SC 1 LMU 30000
PIPE_BUF 55 POSIX PC 1 LMU 512
PRIORITIZED_IO 57 POSIX SC 1 FU
PRIORITY_SCHEDULING 58 POSIX SC 1 FU
PRIO_IO 59 POSIX PC 1 FU
REALTIME_SIGNALS 60 POSIX SC 1 FU
REGEXP 95 POSIX SC 1 FU
RESOURCE_LIMITS 96 POSIX SC 1 FU
RE_DUP_MAX 61 POSIX SC 2 LMN 255
RTSIG_MAX 62 POSIX SC 1 LMU 8
SAVED_IDS 63 POSIX SC 1 FU
#if _lib_setuid && !_lib_setreuid
#define _LOCAL_SAVED_IDS 1
#endif
SCHAR_MAX 64 C XX 1 L 127
SCHAR_MIN 65 C XX 1 L -127
SEMAPHORES 66 POSIX SC 1 FU
SEM_NSEMS_MAX 67 POSIX SC 1 LMU 256
SEM_VALUE_MAX 68 POSIX SC 1 LMU 32767
SHARED_MEMORY_OBJECTS 69 POSIX SC 1 FU
SHELL 120 AST CS 1 MU "/bin/sh"
SHM 118 XOPEN SC 1 FSU
SHRT_MAX 70 C XX 1 L 32767
SHRT_MIN 71 C XX 1 L -32767
SIGQUEUE_MAX 72 POSIX SC 1 LMU 32
SIGRT_MAX 126 SVID SC 1 0
SIGRT_MIN 127 SVID SC 1 0
SSIZE_MAX 73 POSIX XX 1 LMU INT_MAX 32767
STD_BLK 74 SVID SC 1 LMU 1024
STREAM_MAX 75 POSIX SC 1 LMU OPEN_MAX 8
SW_DEV 76 POSIX SC 2 F
SYMLINK_MAX 93 POSIX PC 1 LMU 255
#if PATH_MAX
#define _LOCAL_SYMLINK_MAX (PATH_MAX-1)
#endif
SYMLOOP_MAX 94 POSIX PC 1 LMU 8
SYNCHRONIZED_IO 77 POSIX SC 1 FU
SYNC_IO 78 POSIX PC 1 FU
SYSPID_MAX 79 SVID SC 1 LMU 2
TIMERS 80 POSIX SC 1 FU
TIMER_MAX 81 POSIX SC 1 LMU 32
TMP 131 AST CS 1 MU "/tmp"
TMP_MAX 128 C SC 1 MU 10000
TZNAME_MAX 83 POSIX SC 1 LMU 6
UCHAR_MAX 84 C XX 1 L 255
UID_MAX 85 SVID SC 1 LMU 60002
UINT_MAX 86 C XX 1 L 65535
ULONG_MAX 87 C XX 1 L 4294967295
UNIX 115 XOPEN SC 1 FSU
UPE 89 POSIX SC 2 F
USHRT_MAX 88 C XX 1 L 65535
VDISABLE 90 POSIX PC 1 FU
VERSION 91 POSIX SC 1 FU 199009
VERSION 92 POSIX SC 2 F 199209
VERSION 110 XOPEN SC 1 FSU 4
WORD_BIT 56 XOPEN XX 1 L 16
#ifdef CHAR_BIT
#define _LOCAL_WORD_BIT (CHAR_BIT*sizeof(int))
#else
#define _LOCAL_WORD_BIT (8*sizeof(int))
#endif
XCU_VERSION 111 XOPEN SC 1 FSU
XPG2 112 XOPEN XX 1 FU
XPG3 113 XOPEN XX 1 FU
XPG4 114 XOPEN XX 1 FU

View File

@@ -0,0 +1,92 @@
/* $XConsortium: dup2.c /main/3 1995/11/01 17:11:02 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_dup2
NoN(dup2)
#else
#include <error.h>
int
dup2 __PARAM__((int d1, int d2), (d1, d2)) __OTORP__(int d1; int d2;){
int save_errno;
if (d1 == d2) return(d1);
save_errno = errno;
close(d2);
errno = save_errno;
return(fcntl(d1, F_DUPFD, d2));
}
#endif

View File

@@ -0,0 +1,87 @@
/* $XConsortium: errno.c /main/3 1995/11/01 17:11:15 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _tst_errno
NoN(errno)
#else
/*
* this avoids multiple definitions with some libc's
* that define both an ast library supplied routine and
* errno in the same .o
*/
int errno;
#endif

View File

@@ -0,0 +1,111 @@
/* $XConsortium: execve.c /main/3 1995/11/01 17:11:30 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_execve
NoN(execve)
#else
#include <sig.h>
#include <wait.h>
#include <error.h>
static pid_t childpid;
static void
execsig __PARAM__((int sig), (sig)) __OTORP__(int sig;){
kill(childpid, sig);
signal(sig, execsig);
}
int
execve __PARAM__((const char* path, char* const argv[], char* const arge[]), (path, argv, arge)) __OTORP__(const char* path; char* const argv[]; char* const arge[];){
int status;
if ((childpid = spawnve(path, argv, arge)) < 0)
return(-1);
for (status = 0; status < 64; status++)
signal(status, execsig);
while (waitpid(childpid, &status, 0) == -1)
if (errno != EINTR) return(-1);
if (WIFSIGNALED(status))
{
signal(WTERMSIG(status), SIG_DFL);
kill(getpid(), WTERMSIG(status));
pause();
}
else status = WEXITSTATUS(status);
exit(status);
}
#endif

View File

@@ -0,0 +1,141 @@
/* $XConsortium: fcntl.c /main/3 1995/11/01 17:11:43 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifndef fcntl
NoN(fcntl)
#else
#include <ls.h>
#include <ast_tty.h>
#include <error.h>
#if F_SETFD >= _ast_F_LOCAL
#if _sys_filio
#include <sys/filio.h>
#endif
#endif
#if _lib_fcntl
#undef fcntl
extern __MANGLE__ int fcntl __PROTO__((int, int, ...));
#endif
int
_ast_fcntl __PARAM__((int fd, int op, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(int fd; int op; )
int n;
int save_errno;
struct stat st;
va_list ap;
save_errno = errno;
__VA_START__(ap, op); __OTORP__(fd = va_arg(ap, int );op = va_arg(ap, int );)
if (op >= _ast_F_LOCAL) switch (op)
{
#if F_DUPFD >= _ast_F_LOCAL
case F_DUPFD:
n = va_arg(ap, int);
op = dup2(fd, n);
break;
#endif
#if F_GETFL >= _ast_F_LOCAL
case F_GETFL:
op = fstat(fd, &st);
break;
#endif
#if F_SETFD >= _ast_F_LOCAL && defined(FIOCLEX)
case F_SETFD:
n = va_arg(ap, int);
op = ioctl(fd, n == FD_CLOEXEC ? FIOCLEX : FIONCLEX, 0);
break;
#endif
default:
errno = EINVAL;
op = -1;
break;
}
else
#if _lib_fcntl
op = fcntl(fd, op, va_arg(ap, int));
#else
{
errno = EINVAL;
op = -1;
}
#endif
va_end(ap);
return(op);
}
#endif

View File

@@ -0,0 +1,120 @@
/* $XConsortium: getgroups.c /main/3 1995/11/01 17:11:56 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#if !defined(getgroups) && defined(_lib_getgroups)
NoN(getgroups)
#else
#include <error.h>
#if defined(getgroups)
#undef getgroups
#define ast_getgroups _ast_getgroups
#define botched 1
extern __MANGLE__ int getgroups __PROTO__((int, int*));
#else
#define ast_getgroups getgroups
#endif
int
ast_getgroups __PARAM__((int len, gid_t* set), (len, set)) __OTORP__(int len; gid_t* set;){
#if botched
#if NGROUPS_MAX < 1
#undef NGROUPS_MAX
#define NGROUPS_MAX 1
#endif
register int i;
int big[NGROUPS_MAX];
#else
#undef NGROUPS_MAX
#define NGROUPS_MAX 1
#endif
if (!len) return(NGROUPS_MAX);
if (len < 0 || !set)
{
errno = EINVAL;
return(-1);
}
#if botched
len = getgroups(len > NGROUPS_MAX ? NGROUPS_MAX : len, big);
for (i = 0; i < len; i++)
set[i] = big[i];
return(len);
#else
*set = getgid();
return(1);
#endif
}
#endif

View File

@@ -0,0 +1,76 @@
/* $XConsortium: getpgrp.c /main/3 1995/11/01 17:12:12 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
extern __MANGLE__ int getpgrp __PROTO__((int));
int
_ast_getpgrp __PARAM__((void), ()){
return(getpgrp(0));
}

View File

@@ -0,0 +1,78 @@
/* $XConsortium: getwd.c /main/3 1995/11/01 17:12:30 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
char*
getwd __PARAM__((char* path), (path)) __OTORP__(char* path;){
if (getcwd(path, PATH_MAX)) return(path);
strcpy(path, "getwd: error in . or ..");
return(0);
}

View File

@@ -0,0 +1,86 @@
/* $XConsortium: killpg.c /main/3 1995/11/01 17:12:44 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_killpg
NoN(killpg)
#else
#include <sig.h>
int
killpg __PARAM__((pid_t g, int s), (g, s)) __OTORP__(pid_t g; int s;){
return(kill(-g, s));
}
#endif

View File

@@ -0,0 +1,89 @@
/* $XConsortium: link.c /main/3 1995/11/01 17:12:57 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_link
NoN(link)
#else
#include <error.h>
int
link __PARAM__((const char* from, const char* to), (from, to)) __OTORP__(const char* from; const char* to;){
NoP(from);
NoP(to);
errno = EINVAL;
return(-1);
}
#endif

View File

@@ -0,0 +1,86 @@
/* $XConsortium: lstat.c /main/3 1995/11/01 17:13:10 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_lstat
NoN(lstat)
#else
#include <ls.h>
int
lstat __PARAM__((const char* path, struct stat* st), (path, st)) __OTORP__(const char* path; struct stat* st;){
return(stat(path, st));
}
#endif

View File

@@ -0,0 +1,97 @@
/* $XConsortium: memccpy.c /main/3 1995/11/01 17:13:23 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_memccpy
NoN(memccpy)
#else
/*
* Copy s2 to s1, stopping if character c is copied. Copy no more than n bytes.
* Return a pointer to the byte after character c in the copy,
* or 0 if c is not found in the first n bytes.
*/
__V_*
memccpy __PARAM__((__V_* as1, const __V_* as2, register int c, size_t n), (as1, as2, c, n)) __OTORP__(__V_* as1; const __V_* as2; register int c; size_t n;){
register char* s1 = (char*)as1;
register const char* s2 = (char*)as2;
register const char* ep = s2 + n;
while (s2 < ep)
if ((*s1++ = *s2++) == c)
return(s1);
return(0);
}
#endif

View File

@@ -0,0 +1,95 @@
/* $XConsortium: memchr.c /main/3 1995/11/01 17:13:36 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_memchr
NoN(memchr)
#else
/*
* Return the ptr in sp at which the character c appears;
* 0 if not found in n chars; don't stop at \0.
*/
__V_*
memchr __PARAM__((const __V_* asp, register int c, size_t n), (asp, c, n)) __OTORP__(const __V_* asp; register int c; size_t n;){
register const char* sp = (char*)asp;
register const char* ep = sp + n;
while (sp < ep)
if (*sp++ == c)
return(--sp);
return(0);
}
#endif

View File

@@ -0,0 +1,91 @@
/* $XConsortium: memcmp.c /main/3 1995/11/01 17:13:49 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_memcmp
NoN(memcmp)
#else
int
memcmp __PARAM__((const __V_* ab1, const __V_* ab2, size_t n), (ab1, ab2, n)) __OTORP__(const __V_* ab1; const __V_* ab2; size_t n;){
register const unsigned char* b1 = (const unsigned char*)ab1;
register const unsigned char* b2 = (const unsigned char*)ab2;
register const unsigned char* e = b1 + n;
while (b1 < e)
if (*b1++ != *b2++)
return(*--b1 - *--b2);
return(0);
}
#endif

View File

@@ -0,0 +1,105 @@
/* $XConsortium: memcpy.c /main/3 1995/11/01 17:14:04 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_memcpy
NoN(memcpy)
#else
#undef memcpy
#ifdef _lib_bcopy
extern __MANGLE__ void bcopy __PROTO__((__V_*, __V_*, size_t));
__V_*
memcpy __PARAM__((__V_* s1, __V_* s2, size_t n), (s1, s2, n)) __OTORP__(__V_* s1; __V_* s2; size_t n;){
bcopy(s2, s1, n);
return(s1);
}
#else
__V_*
memcpy __PARAM__((__V_* as1, const __V_* as2, register size_t n), (as1, as2, n)) __OTORP__(__V_* as1; const __V_* as2; register size_t n;){
register char* s1 = (char*)as1;
register const char* s2 = (const char*)as2;
while (n-- > 0)
*s1++ = *s2++;
return(as1);
}
#endif
#endif

View File

@@ -0,0 +1,99 @@
/* $XConsortium: memmove.c /main/3 1995/11/01 17:14:18 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_memmove
NoN(memmove)
#else
__V_*
memmove __PARAM__((__V_* to, const __V_* from, register size_t n), (to, from, n)) __OTORP__(__V_* to; const __V_* from; register size_t n;){
register char* out = (char*)to;
register char* in = (char*)from;
if (n <= 0) /* works if size_t is signed or not */
;
else if (in + n <= out || out + n <= in)
return(memcpy(to, from, n)); /* hope it's fast*/
else if (out < in)
do *out++ = *in++; while (--n > 0);
else
{
out += n;
in += n;
do *--out = *--in; while(--n > 0);
}
return(to);
}
#endif

View File

@@ -0,0 +1,88 @@
/* $XConsortium: memset.c /main/3 1995/11/01 17:14:31 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_memset
NoN(memset)
#else
__V_*
memset __PARAM__((__V_* asp, register int c, register size_t n), (asp, c, n)) __OTORP__(__V_* asp; register int c; register size_t n;){
register char* sp = (char*)asp;
while (n-- > 0)
*sp++ = c;
return(asp);
}
#endif

View File

@@ -0,0 +1,108 @@
/* $XConsortium: mkdir.c /main/3 1995/11/01 17:14:44 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_mkdir
NoN(mkdir)
#else
#include <ls.h>
#include <wait.h>
#include <error.h>
int
mkdir __PARAM__((const char* path, mode_t mode), (path, mode)) __OTORP__(const char* path; mode_t mode;){
register int n;
char* av[3];
static char* cmd[] = { "/bin/mkdir", "/usr/5bin/mkdir", 0 };
n = errno;
if (!access(path, F_OK))
{
errno = EEXIST;
return(-1);
}
if (errno != ENOENT) return(-1);
errno = n;
av[0] = "mkdir";
av[1] = path;
av[2] = 0;
for (n = 0; n < elementsof(cmd); n++)
if (procclose(procopen(cmd[n], av, NiL, NiL, 0)) != -1)
break;
return(chmod(path, mode));
}
#endif

View File

@@ -0,0 +1,92 @@
/* $XConsortium: mkfifo.c /main/3 1995/11/01 17:14:57 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_mkfifo
NoN(mkfifo)
#else
#include <ls.h>
#include <error.h>
int
mkfifo __PARAM__((const char* path, mode_t mode), (path, mode)) __OTORP__(const char* path; mode_t mode;){
#ifdef S_IFIFO
return(mknod(path, S_IFIFO|(mode & ~S_IFMT), 0));
#else
errno = EINVAL;
return(-1);
#endif
}
#endif

View File

@@ -0,0 +1,90 @@
/* $XConsortium: mknod.c /main/3 1995/11/01 17:15:11 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_mknod
NoN(mknod)
#else
#include <ls.h>
#include <error.h>
int
mknod __PARAM__((const char* path, mode_t mode, dev_t dev), (path, mode, dev)) __OTORP__(const char* path; mode_t mode; dev_t dev;){
if (S_ISFIFO(mode)) return(mkfifo(path, mode));
if (S_ISDIR(mode)) return(mkdir(path, mode));
errno = EINVAL;
return(-1);
}
#endif

View File

@@ -0,0 +1,105 @@
/* $XConsortium: mktemp.c /main/3 1995/11/01 17:15:24 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_mktemp
NoN(mktemp)
#else
char*
mktemp __PARAM__((char* buf), (buf)) __OTORP__(char* buf;){
char* s;
char* d;
int n;
if (s = strrchr(buf, '/'))
{
*s++ = 0;
d = buf;
}
else
{
s = buf;
d = "";
}
if ((n = strlen(s)) < 6 || strcmp(s + n - 6, "XXXXXX"))
{
*buf = 0;
return(buf);
}
*(s + n - 6) = 0;
if (!pathtemp(buf, d, s)) *buf = 0;
return(buf);
}
#endif

View File

@@ -0,0 +1,91 @@
/* $XConsortium: mount.c /main/3 1995/11/01 17:15:37 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_mount
NoN(mount)
#else
#include <error.h>
int
mount __PARAM__((const char* a, char* b, int c, __V_* d), (a, b, c, d)) __OTORP__(const char* a; char* b; int c; __V_* d;){
NoP(a);
NoP(b);
NoP(c);
NoP(d);
errno = EINVAL;
return(-1);
}
#endif

View File

@@ -0,0 +1,162 @@
/* $XConsortium: open.c /main/3 1995/11/01 17:15:50 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifndef open
NoN(open)
#else
#undef open
extern __MANGLE__ int open __PROTO__((const char*, int, ...));
#include <ls.h>
#include <error.h>
#ifdef O_NOCTTY
#include <ast_tty.h>
#endif
int
_ast_open __PARAM__((const char* path, int op, ...), (va_alist)) __OTORP__(va_dcl)
{ __OTORP__(const char* path; int op; )
int fd;
int mode;
int save_errno;
struct stat st;
va_list ap;
save_errno = errno;
__VA_START__(ap, op); __OTORP__(path = va_arg(ap, const char* );op = va_arg(ap, int );)
mode = (op & O_CREAT) ? va_arg(ap, int) : S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
va_end(ap);
if (op & ~(_ast_O_LOCAL-1))
{
if (!(op & O_CREAT))
op &= ~O_EXCL;
for (;;)
{
if (op & O_TRUNC)
{
if ((op & O_EXCL) && !access(path, F_OK))
{
errno = EEXIST;
return(-1);
}
if ((fd = creat(path, (op & O_EXCL) ? 0 : mode)) < 0)
return(-1);
if (op & O_EXCL)
{
if (fstat(fd, &st) || (st.st_mode & S_IPERM))
{
errno = EEXIST;
close(fd);
return(-1);
}
#if _lib_fchmod
if (mode && fchmod(fd, mode))
#else
if (mode && chmod(path, mode))
#endif
errno = save_errno;
}
if (op & O_RDWR)
{
close(fd);
op &= ~(O_CREAT|O_TRUNC);
continue;
}
}
else if ((fd = open(path, op & (_ast_O_LOCAL-1), mode)) < 0)
{
if (op & O_CREAT)
{
op |= O_TRUNC;
continue;
}
return(-1);
}
else if ((op & O_APPEND) && lseek(fd, 0L, SEEK_END) == -1L)
errno = save_errno;
#if O_NOCTTY
if ((op & O_NOCTTY) && ioctl(fd, TIOCNOTTY, 0))
errno = save_errno;
#endif
break;
}
}
else fd = open(path, op, mode);
return(fd);
}
#endif

View File

@@ -0,0 +1,167 @@
/* $XConsortium: pathconf.c /main/3 1995/11/01 17:16:03 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 3
#include <ast.h>
#if _lib_pathconf
NoN(pathconf)
#else
#include <ls.h>
#include <errno.h>
#include <ast_param.h>
#ifndef errno
extern __MANGLE__ int errno;
#endif
static long
statconf __PARAM__((struct stat* st, int op), (st, op)) __OTORP__(struct stat* st; int op;)
#line 21
{
NoP(st);
switch (op)
{
case _PC_LINK_MAX:
return(LINK_MAX);
case _PC_MAX_CANON:
return(MAX_CANON);
case _PC_MAX_INPUT:
return(MAX_INPUT);
case _PC_NAME_MAX:
#ifdef NAME_MAX
return(NAME_MAX);
#else
return(-1);
#endif
case _PC_PATH_MAX:
#ifdef PATH_MAX
return(PATH_MAX);
#else
return(-1);
#endif
case _PC_PIPE_BUF:
#ifdef PIPE_BUF
return(PIPE_BUF);
#else
return(-1);
#endif
case _PC_CHOWN_RESTRICTED:
#ifdef _POSIX_CHOWN_RESTRICTED
return(_POSIX_CHOWN_RESTRICTED);
#else
return(-1);
#endif
case _PC_NO_TRUNC:
#ifdef _POSIX_NO_TRUNC
return(_POSIX_NO_TRUNC);
#else
return(-1);
#endif
case _PC_VDISABLE:
#ifdef _POSIX_VDISABLE
return(_POSIX_VDISABLE);
#else
return(-1);
#endif
}
errno = EINVAL;
return(-1);
}
long
fpathconf __PARAM__((int fd, int op), (fd, op)) __OTORP__(int fd; int op;)
#line 74
{
struct stat st;
return(fstat(fd, &st) ? -1 : statconf(&st, op));
}
long
pathconf __PARAM__((const char* path, int op), (path, op)) __OTORP__(const char* path; int op;)
#line 82
{
struct stat st;
return(stat(path, &st) ? -1 : statconf(&st, op));
}
#endif

View File

@@ -0,0 +1,95 @@
/* $XConsortium: readlink.c /main/4 1995/11/17 15:17:44 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_readlink
NoN(readlink)
#else
#include <error.h>
int
#ifdef _AIX
readlink __PARAM__((const char* path, char* buf, size_t siz), (path, buf, siz)) __OTORP__(const char* path; char* buf; size_t siz;)
#else
readlink __PARAM__((const char* path, char* buf, int siz), (path, buf, siz)) __OTORP__(const char* path; char* buf; int siz;)
#endif
{
NoP(path);
NoP(buf);
NoP(siz);
errno = EINVAL;
return(-1);
}
#endif

View File

@@ -0,0 +1,86 @@
/* $XConsortium: remove.c /main/3 1995/11/01 17:16:31 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifndef _lib_unlink
NoN(remove)
#else
#undef remove
int
remove __PARAM__((const char* path), (path)) __OTORP__(const char* path;){
return(unlink(path));
}
#endif

View File

@@ -0,0 +1,101 @@
/* $XConsortium: rename.c /main/3 1995/11/01 17:16:45 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_rename
NoN(rename)
#else
#include <error.h>
int
rename __PARAM__((const char* from, const char* to), (from, to)) __OTORP__(const char* from; const char* to;){
int oerrno;
int ooerrno;
ooerrno = errno;
while (link(from, to))
{
oerrno = errno;
if (unlink(to))
{
errno = oerrno;
return(-1);
}
}
errno = ooerrno;
unlink(from);
return(0);
}
#endif

View File

@@ -0,0 +1,112 @@
/* $XConsortium: rmdir.c /main/3 1995/11/01 17:16:58 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_rmdir
NoN(rmdir)
#else
#include <ls.h>
#include <error.h>
int
rmdir __PARAM__((const char* path), (path)) __OTORP__(const char* path;){
register int n;
struct stat st;
char* av[3];
static char* cmd[] = { "/bin/rmdir", "/usr/5bin/rmdir", 0 };
if (stat(path, &st) < 0) return(-1);
if (!S_ISDIR(st.st_mode))
{
errno = ENOTDIR;
return(-1);
}
av[0] = "rmdir";
av[1] = path;
av[2] = 0;
for (n = 0; n < elementsof(cmd); n++)
if (procclose(procopen(cmd[n], av, NiL, NiL, 0)) != -1)
break;
n = errno;
if (access(path, F_OK) < 0)
{
errno = n;
return(0);
}
errno = EPERM;
return(-1);
}
#endif

View File

@@ -0,0 +1,135 @@
/* $XConsortium: setlocale.c /main/3 1995/11/01 17:17:13 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#undef setlocale
#undef strcmp
#undef strcoll
typedef struct
{
int category;
int set;
char* locale;
} Locale_t;
char*
_ast_setlocale __PARAM__((register int category, const char* locale), (category, locale)) __OTORP__(register int category; const char* locale;){
#if _hdr_locale && _lib_setlocale
register Locale_t* lc;
register char* p;
static Locale_t def[] =
{
{ LC_ALL, ~0 },
{ LC_COLLATE, LC_SET_COLLATE },
{ LC_CTYPE, LC_SET_CTYPE },
#ifdef LC_MESSAGES
{ LC_MESSAGES, LC_SET_MESSAGES },
#endif
{ LC_MONETARY, LC_SET_MONETARY },
{ LC_NUMERIC, LC_SET_NUMERIC },
{ LC_TIME, LC_SET_TIME },
};
if (!def[0].locale)
for (lc = def; lc < def + elementsof(def); lc++)
{
if (!(p = setlocale(lc->category, NiL)) || !(p = strdup(p)))
p = "C";
lc->locale = p;
}
if ((p = setlocale(category, locale)) && locale)
{
ast.locale.serial++;
for (lc = def; lc < def + elementsof(def); lc++)
if (lc->category == category)
{
if (streq(lc->locale, p))
{
ast.locale.set &= ~lc->set;
if (lc->set & LC_SET_COLLATE)
ast.collate = strcmp;
}
else
{
ast.locale.set |= lc->set;
if (lc->set & LC_SET_COLLATE)
ast.collate = strcoll;
}
break;
}
}
return(p);
#else
return(!locale || !*locale || !strcmp(locale, "C") || !strcmp(locale, "POSIX") ? "C" : (char*)0);
#endif
}

View File

@@ -0,0 +1,126 @@
/* $XConsortium: setpgid.c /main/3 1995/11/01 17:17:27 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#if _lib_setpgid
NoN(setpgid)
#else
#include <error.h>
#ifndef ENOSYS
#define ENOSYS EINVAL
#endif
#if _lib_setpgrp2
#define setpgrp setpgrp2
#else
#if _lib_BSDsetpgrp
#define _lib_setpgrp2 1
#define setpgrp BSDsetpgrp
#else
#if _lib_wait3
#define _lib_setpgrp2 1
#endif
#endif
#endif
#if _lib_setpgrp2
extern __MANGLE__ int setpgrp __PROTO__((int, int));
#else
extern __MANGLE__ int setpgrp __PROTO__((void));
#endif
/*
* set process group id
*/
int
setpgid __PARAM__((pid_t pid, pid_t pgid), (pid, pgid)) __OTORP__(pid_t pid; pid_t pgid;){
#if _lib_setpgrp2
return(setpgrp(pid, pgid));
#else
#if _lib_setpgrp
int caller = getpid();
if ((pid == 0 || pid == caller) && (pgid == 0 || pgid == caller))
return(setpgrp());
errno = EINVAL;
#else
errno = ENOSYS;
#endif
return(-1);
#endif
}
#endif

View File

@@ -0,0 +1,136 @@
/* $XConsortium: setsid.c /main/3 1995/11/01 17:17:40 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_setsid
NoN(setsid)
#else
#include <ast_tty.h>
#include <error.h>
/*
* become new process group leader and drop control tty
*/
pid_t
setsid __PARAM__((void), ()){
int pg;
#ifdef TIOCNOTTY
int fd;
#endif
/*
* become a new process group leader
*/
if ((pg = getpid()) == getpgrp())
{
errno = EPERM;
return(-1);
}
setpgid(pg, pg);
#ifdef TIOCNOTTY
/*
* drop the control tty
*/
if ((fd = open("/dev/tty", 0)) >= 0)
{
ioctl(fd, TIOCNOTTY, 0);
close(fd);
}
#else
/*
* second child in s5 to avoid reacquiring the control tty
*/
#if _lib_fork && HUH920711 /* some s5's botch this */
switch (fork())
{
case -1:
exit(1);
case 0:
break;
default:
exit(0);
}
#endif
#endif
return(pg);
}
#endif

View File

@@ -0,0 +1,96 @@
/* $XConsortium: sigsetmask.c /main/3 1995/11/01 17:17:52 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#define __VOID__ __V_
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 3
#include <ast.h>
#ifdef _lib_sigsetmask
NoN(sigsetmask)
#else
int
sigsetmask __PARAM__((unsigned long s), (s)) __OTORP__(unsigned long s;)
#line 13
{
NoP(s);
return(0);
}
#endif

View File

@@ -0,0 +1,109 @@
/* $XConsortium: sigunblock.c /main/3 1995/11/01 17:18:05 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_sigunblock
NoN(sigunblock)
#else
#include <sig.h>
#ifndef SIG_UNBLOCK
#undef _lib_sigprocmask
#endif
int
sigunblock __PARAM__((int s), (s)) __OTORP__(int s;){
#if _lib_sigprocmask
int op;
sigset_t mask;
sigemptyset(&mask);
if (s)
{
sigaddset(&mask, s);
op = SIG_UNBLOCK;
}
else op = SIG_SETMASK;
return(sigprocmask(op, &mask, NiL));
#else
#if _lib_sigsetmask
return(sigsetmask(s ? (sigsetmask(0L) & ~sigmask(s)) : 0L));
#else
NoP(s);
return(0);
#endif
#endif
}
#endif

View File

@@ -0,0 +1,84 @@
/* $XConsortium: spawnve.c /main/3 1995/11/01 17:18:18 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#if _lib_spawnve
NoN(spawnve)
#else
pid_t
spawnve __PARAM__((const char* cmd, char* const argv[], char* const envv[]), (cmd, argv, envv)) __OTORP__(const char* cmd; char* const argv[]; char* const envv[];){
return(spawnveg(cmd, argv, envv, 0));
}
#endif

View File

@@ -0,0 +1,226 @@
/* $XConsortium: spawnveg.c /main/2 1996/05/08 19:40:35 drk $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#if _lib_spawnveg
NoN(spawnveg)
#else
#include <error.h>
#ifndef ENOSYS
#define ENOSYS EINVAL
#endif
#if _lib_vfork
#if _hdr_vfork
#include <vfork.h>
#endif
#if _sys_vfork
#include <sys/vfork.h>
#endif
#endif
#if !_lib_spawnve
#ifdef _map_spawnve
#undef spawnve
#define spawnve _map_spawnve
extern __MANGLE__ pid_t spawnve __PROTO__((const char*, char* const[], char* const[]));
#undef _lib_spawnve
#define _lib_spawnve 1
#endif
#endif
/*
* fork+exec+(setsid|setpgid) with script check to avoid shell double fork
*/
pid_t
spawnveg __PARAM__((const char* cmd, char* const argv[], char* const envv[], pid_t pgid), (cmd, argv, envv, pgid)) __OTORP__(const char* cmd; char* const argv[]; char* const envv[]; pid_t pgid;){
#if _lib_fork || _lib_vfork
int n;
pid_t pid;
#if !_real_vfork
int err[2];
#endif
#endif
#if _lib_spawnve
#if _lib_fork || _lib_vfork
if (!pgid)
#endif
return(spawnve(cmd, argv, envv));
#endif
#if _lib_fork || _lib_vfork
n = errno;
#if _real_vfork
errno = 0;
#else
if (pipe(err) < 0) err[0] = -1;
else
{
fcntl(err[0], F_SETFD, FD_CLOEXEC);
fcntl(err[1], F_SETFD, FD_CLOEXEC);
}
#endif
sigcritical(1);
#if _lib_vfork
pid = vfork();
#else
pid = fork();
#endif
sigcritical(0);
if (!pid)
{
if (pgid < 0)
setsid();
else if (pgid > 0)
{
if (pgid == 1)
pgid = 0;
if (setpgid(0, pgid) < 0 && pgid && errno == EPERM)
setpgid(0, 0);
}
execve(cmd, argv, envv);
if (errno == ENOEXEC)
{
register char** o;
register char** p;
register char** v;
for (p = o = (char**)argv; *p; p++);
if (v = newof(0, char*, p - o + 2, 0))
{
p = v;
if (*p = *o) o++;
else *p = (char*)cmd;
*++p = (char*)cmd;
while (*++p = *o++);
execve(pathshell(), v, envv);
free(v);
}
#ifdef ENOMEM
else errno = ENOMEM;
#endif
}
#if !_real_vfork
if (err[0] != -1)
{
n = errno;
write(err[1], &n, sizeof(n));
}
#endif
_exit(errno == ENOENT ? EXIT_NOTFOUND : EXIT_NOEXEC);
}
else if (pid != -1)
{
#if _real_vfork
if (errno) pid = -1;
else
#endif
{
if (pgid > 0)
{
/*
* parent and child are in a race here
*/
if (pgid == 1)
pgid = pid;
if (setpgid(pid, pgid) < 0 && pid != pgid && errno == EPERM)
setpgid(pid, pid);
}
errno = n;
}
}
#if !_real_vfork
if (err[0] != -1)
{
close(err[1]);
if (read(err[0], &n, sizeof(n)) == sizeof(n))
{
while (waitpid(pid, NiL, 0) == -1 && errno == EINTR);
pid = -1;
errno = n;
}
close(err[0]);
}
#endif
return(pid);
#else
errno = ENOSYS;
return(-1);
#endif
}
#endif

View File

@@ -0,0 +1,193 @@
/* $XConsortium: statvfs.c /main/3 1995/11/01 17:18:45 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#include <ls.h>
#if _lib_statvfs
NoN(statvfs)
#else
#include <error.h>
#define HUH (-1)
#if _lib_statfs && _mem_f_files_statfs && ( _sys_statfs || _sys_vfs || _sys_mount )
#if _sys_statfs
#include <sys/statfs.h>
#else
#if _sys_vfs
#include <sys/vfs.h>
#else
#if _sys_mount
#include <sys/mount.h>
#endif
#endif
#endif
#if _lib_statfs4
#define FSTATFS(a,b) fstatfs(a,b,sizeof(struct statfs),0)
#define STATFS(a,b) statfs(a,b,sizeof(struct statfs),0)
#else
#define FSTATFS(a,b) fstatfs(a,b)
#define STATFS(a,b) statfs(a,b)
#endif
static void
us2v __PARAM__((register struct statfs* ufs, register struct stat* st, register struct statvfs* vfs), (ufs, st, vfs)) __OTORP__(register struct statfs* ufs; register struct stat* st; register struct statvfs* vfs;){
memset(vfs, 0, sizeof(*vfs));
vfs->f_bsize = vfs->f_frsize = ufs->f_bsize;
vfs->f_blocks = ufs->f_blocks;
vfs->f_bfree = ufs->f_bfree;
vfs->f_bavail =
#if _mem_f_bavail_statfs
ufs->f_bavail;
#else
ufs->f_bfree;
#endif
vfs->f_files = ufs->f_files;
vfs->f_ffree = ufs->f_ffree;
vfs->f_favail = (ufs->f_ffree > 10) ? (ufs->f_ffree - 10) : 0;
vfs->f_fsid = st->st_dev;
strncpy(vfs->f_basetype, FS_default, sizeof(vfs->f_basetype) - 1);
vfs->f_namemax = 14;
strncpy(vfs->f_fstr, vfs->f_basetype, sizeof(vfs->f_fstr) - 1);
}
int
fstatvfs __PARAM__((int fd, struct statvfs* vfs), (fd, vfs)) __OTORP__(int fd; struct statvfs* vfs;){
struct statfs ufs;
struct stat st;
if (FSTATFS(fd, &ufs) || fstat(fd, &st))
return(-1);
us2v(&ufs, &st, vfs);
return(0);
}
int
statvfs __PARAM__((const char* path, struct statvfs* vfs), (path, vfs)) __OTORP__(const char* path; struct statvfs* vfs;){
struct statfs ufs;
struct stat st;
if (STATFS(path, &ufs) || stat(path, &st))
return(-1);
us2v(&ufs, &st, vfs);
return(0);
}
#else
static void
s2v __PARAM__((register struct stat* st, register struct statvfs* vfs), (st, vfs)) __OTORP__(register struct stat* st; register struct statvfs* vfs;){
memset(vfs, 0, sizeof(*vfs));
vfs->f_bsize = vfs->f_frsize =
#if _mem_st_blksize_stat
st->st_blksize;
#else
512;
#endif
vfs->f_blocks = HUH;
vfs->f_bfree = HUH;
vfs->f_files = HUH;
vfs->f_ffree = HUH;
vfs->f_favail = HUH;
vfs->f_fsid = st->st_dev;
strncpy(vfs->f_basetype, FS_default, sizeof(vfs->f_basetype) - 1);
vfs->f_namemax = 14;
strncpy(vfs->f_fstr, vfs->f_basetype, sizeof(vfs->f_fstr) - 1);
}
int
fstatvfs __PARAM__((int fd, struct statvfs* vfs), (fd, vfs)) __OTORP__(int fd; struct statvfs* vfs;){
struct stat st;
if (fstat(fd, &st))
return(-1);
s2v(&st, vfs);
return(0);
}
int
statvfs __PARAM__((const char* path, struct statvfs* vfs), (path, vfs)) __OTORP__(const char* path; struct statvfs* vfs;){
struct stat st;
if (stat(path, &st))
return(-1);
s2v(&st, vfs);
return(0);
}
#endif
#endif

View File

@@ -0,0 +1,102 @@
/* $XConsortium: strchr.c /main/3 1995/11/01 17:18:59 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_strchr
NoN(strchr)
#else
#undef strchr
#ifdef _lib_index
#undef index
extern __MANGLE__ char* index __PROTO__((const char*, int));
char*
strchr __PARAM__((const char* s, int c), (s, c)) __OTORP__(const char* s; int c;){
return(index(s, c));
}
#else
char*
strchr __PARAM__((register const char* s, register int c), (s, c)) __OTORP__(register const char* s; register int c;){
do if (*s == c) return((char*)s); while(*s++);
return(0);
}
#endif
#endif

View File

@@ -0,0 +1,105 @@
/* $XConsortium: strrchr.c /main/3 1995/11/01 17:19:12 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_strrchr
NoN(strrchr)
#else
#undef strrchr
#ifdef _lib_rindex
#undef rindex
extern __MANGLE__ char* rindex __PROTO__((const char*, int));
char*
strrchr __PARAM__((const char* s, int c), (s, c)) __OTORP__(const char* s; int c;){
return(rindex(s, c));
}
#else
char*
strrchr __PARAM__((register const char* s, register int c), (s, c)) __OTORP__(register const char* s; register int c;){
register const char* r;
r = 0;
do if (*s == c) r = s; while(*s++);
return((char*)r);
}
#endif
#endif

View File

@@ -0,0 +1,104 @@
/* $XConsortium: strtod.c /main/3 1995/11/01 17:19:25 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_strtod
NoN(strtod)
#else
#include <ctype.h>
extern __MANGLE__ double atof __PROTO__((const char*));
double
strtod __PARAM__((register const char* s, char** e), (s, e)) __OTORP__(register const char* s; char** e;){
double n;
n = atof(s);
if (e)
{
while (isspace(*s)) s++;
if (*s == '-' || *s == '+') s++;
while (isdigit(*s)) s++;
if (*s == '.') while (isdigit(*++s));
if (*s == 'e' || *s == 'E')
{
if (*++s == '-' || *s == '+') s++;
while (isdigit(*s)) s++;
}
*e = (char*)s;
}
return(n);
}
#endif

View File

@@ -0,0 +1,130 @@
/* $XConsortium: strtol.c /main/3 1995/11/01 17:19:38 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_strtol
NoN(strtol)
#else
/* @(#)strtol.c 2.1 */
/*LINTLIBRARY*/
#include <ctype.h>
#define DIGIT(x) (isdigit(x) ? (x) - '0' : \
islower(x) ? (x) + 10 - 'a' : (x) + 10 - 'A')
#define MBASE ('z' - 'a' + 1 + 10)
long
strtol __PARAM__((register const char* str, char** ptr, register int base), (str, ptr, base)) __OTORP__(register const char* str; char** ptr; register int base;){
register long val;
register int c;
int xx, neg = 0;
if (ptr)
*ptr = (char*)str; /* in case no number is formed */
if (base < 0 || base > MBASE)
return (0); /* base is invalid -- should be a fatal error */
if (!isalnum(c = *str)) {
while (isspace(c))
c = *++str;
switch (c) {
case '-':
neg++;
case '+': /* fall-through */
c = *++str;
}
}
if (base == 0)
if (c != '0')
base = 10;
else if (str[1] == 'x' || str[1] == 'X')
base = 16;
else
base = 8;
/*
* for any base > 10, the digits incrementally following
* 9 are assumed to be "abc...z" or "ABC...Z"
*/
if (!isalnum(c) || (xx = DIGIT(c)) >= base)
return (0); /* no number formed */
if (base == 16 && c == '0' && isxdigit(str[2]) &&
(str[1] == 'x' || str[1] == 'X'))
c = *(str += 2); /* skip over leading "0x" or "0X" */
for (val = -DIGIT(c); isalnum(c = *++str) && (xx = DIGIT(c)) < base; )
/* accumulate neg avoids surprises near MAXLONG */
val = base * val - xx;
if (ptr)
*ptr = str;
return (neg ? val : -val);
}
#endif

View File

@@ -0,0 +1,84 @@
/* $XConsortium: strtoul.c /main/3 1995/11/01 17:19:53 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_strtoul
NoN(strtoul)
#else
unsigned long
strtoul __PARAM__((const char* str, char** ptr, int base), (str, ptr, base)) __OTORP__(const char* str; char** ptr; int base;){
return((unsigned long)strtol(str, ptr, base));
}
#endif

View File

@@ -0,0 +1,89 @@
/* $XConsortium: symlink.c /main/3 1995/11/01 17:20:06 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_symlink
NoN(symlink)
#else
#include <error.h>
int
symlink __PARAM__((const char* a, char* b), (a, b)) __OTORP__(const char* a; char* b;){
NoP(a);
NoP(b);
errno = EINVAL;
return(-1);
}
#endif

View File

@@ -0,0 +1,159 @@
/* $XConsortium: sysconf.c /main/3 1995/11/01 17:20:18 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 3
#include <ast.h>
#ifdef _lib_sysconf
NoN(sysconf)
#else
#include <errno.h>
#ifndef errno
extern __MANGLE__ int errno;
#endif
#if _lib_getdtablesize
extern __MANGLE__ int getdtablesize __PROTO__((void));
#else
#if _lib_getrlimit && _sys_resource
#include <sys/time.h>
#include <sys/resource.h>
extern __MANGLE__ int getrlimit __PROTO__((int, struct rlimit*));
#endif
#endif
long
sysconf __PARAM__((int op), (op)) __OTORP__(int op;)
#line 29
{
int n;
switch (op)
{
case _SC_ARG_MAX:
return(ARG_MAX);
case _SC_CHILD_MAX:
return(CHILD_MAX);
case _SC_CLK_TCK:
return(_AST_CLK_TCK);
case _SC_NGROUPS_MAX:
if ((n = getgroups(0, (gid_t*)&n)) <= 0) n = NGROUPS_MAX;
return(n);
case _SC_OPEN_MAX:
#if _lib_getdtablesize
return(getdtablesize());
#else
#ifdef RLIMIT_NOFILE
{
struct rlimit rlim;
return(getrlimit(RLIMIT_NOFILE, &rlim) ? OPEN_MAX_CEIL : rlim.rlim_cur);
}
#else
return(OPEN_MAX_CEIL);
#endif
#endif
case _SC_JOB_CONTROL:
#ifdef _POSIX_JOB_CONTROL
return(_POSIX_JOB_CONTROL);
#else
return(-1);
#endif
case _SC_SAVED_IDS:
#ifdef _POSIX_SAVED_IDS
return(_POSIX_SAVED_IDS);
#else
return(-1);
#endif
case _SC_TZNAME_MAX:
return(3);
case _SC_VERSION:
#ifdef _POSIX_VERSION
return(_POSIX_VERSION);
#else
return(-1);
#endif
}
errno = EINVAL;
return(-1);
}
#endif

View File

@@ -0,0 +1,83 @@
/* $XConsortium: system.c /main/3 1995/11/01 17:20:32 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#include <proc.h>
int
system __PARAM__((const char* cmd), (cmd)) __OTORP__(const char* cmd;){
char* sh[4];
sh[0] = "sh";
sh[1] = "-c";
sh[2] = (char*)cmd;
sh[3] = 0;
return(procrun(NiL, sh));
}

View File

@@ -0,0 +1,104 @@
/* $XConsortium: tmpnam.c /main/3 1995/11/01 17:20:47 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_tmpnam
NoN(tmpnam)
#else
#include <stdio.h>
#ifndef P_tmpdir
#define P_tmpdir "/usr/tmp/"
#endif
#ifndef L_tmpnam
#define L_tmpnam (sizeof(P_tmpdir)+10)
#endif
static char buf[L_tmpnam];
static char seed[] = { 'a', 'a', 'a', 0 };
char*
tmpnam __PARAM__((register char* p), (p)) __OTORP__(register char* p;){
register char* q;
if (!p) p = buf;
strcopy(strcopy(strcopy(p, P_tmpdir), seed), "XXXXXX");
q = seed;
while (*q == 'z') *q++ = 'a';
if (*q) ++*q;
return(mktemp(p));
}
#endif

View File

@@ -0,0 +1,84 @@
/* $XConsortium: unlink.c /main/3 1995/11/01 17:21:00 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_unlink
NoN(unlink)
#else
int
unlink __PARAM__((const char* path), (path)) __OTORP__(const char* path;){
return(remove(path));
}
#endif

View File

@@ -0,0 +1,95 @@
/* $XConsortium: vfork.c /main/3 1995/11/01 17:21:14 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#ifdef _lib_vfork
NoN(vfork)
#else
#include <error.h>
#ifndef ENOSYS
#define ENOSYS EINVAL
#endif
pid_t
vfork __PARAM__((void), ()){
#if _lib_fork
return(fork());
#else
errno = ENOSYS;
return(-1);
#endif
}
#endif

View File

@@ -0,0 +1,238 @@
/* $XConsortium: waitpid.c /main/3 1995/11/01 17:21:28 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#include <wait.h>
#if _lib_waitpid
NoN(waitpid)
#else
#if _lib_wait4
struct rusage;
extern __MANGLE__ int wait4 __PROTO__((int, int*, int, struct rusage*));
pid_t
waitpid __PARAM__((pid_t pid, int* status, int flags), (pid, status, flags)) __OTORP__(pid_t pid; int* status; int flags;){
return(wait4(pid, status, flags, NiL));
}
#else
#undef SIGCLD
#if _lib_wait3
extern __MANGLE__ int wait3 __PROTO__((int*, int, struct rusage*));
#else
#if _lib_wait2
#define wait3(s,f,u) wait2(s,f)
extern __MANGLE__ int wait2 __PROTO__((int*, int));
#else
#include <sig.h>
#define wait3(s,f,u) wait(s)
static int caught;
static void
catch(sig)
int sig;
{
NoP(sig);
caught = 1;
}
#endif
#endif
#include <error.h>
struct zombie
{
struct zombie* next;
int status;
pid_t pid;
};
pid_t
waitpid __PARAM__((pid_t pid, int* status, int flags), (pid, status, flags)) __OTORP__(pid_t pid; int* status; int flags;){
register struct zombie* zp;
register struct zombie* pp;
register int p;
int s;
#if !_lib_wait2 && !_lib_wait3
#if !defined(SIGCLD)
int n;
int oerrno;
#endif
Handler_t handler;
#endif
static struct zombie* zombies;
pp = 0;
zp = zombies;
while (zp)
{
if (zp->pid >= 0 && (zp->pid == pid || pid <= 0))
{
if (pp) pp->next = zp->next;
else zombies = zp->next;
if (status) *status = zp->status;
pid = zp->pid;
free(zp);
return(pid);
}
}
if (pid > 0 && kill(pid, 0) < 0) return(-1);
for (;;)
{
#if !_lib_wait2 && !_lib_wait3
#if !defined(SIGCLD)
oerrno = errno;
#endif
if (flags & WNOHANG)
{
caught = 0;
#if defined(SIGCLD)
handler = signal(SIGCLD, catch);
if (!caught)
{
signal(SIGCLD, handler);
return(0);
}
#else
#if defined(SIGALRM)
handler = signal(SIGALRM, catch);
n = alarm(1);
#endif
#endif
}
#endif
p = wait3(&s, flags, NiL);
#if !_lib_wait3
#if !_lib_wait2
#if defined(SIGCLD)
if (flags & WNOHANG) signal(SIGCLD, handler);
#else
#if defined(SIGALRM)
if (flags & WNOHANG)
{
if (n == 0 && !caught || n == 1) alarm(n);
else if (n > 1) alarm(n - caught);
signal(SIGALRM, handler);
}
if (p == -1 && errno == EINTR)
{
errno = oerrno;
p = 0;
s = 0;
}
#endif
#endif
#else
if (p == -1 && errno == EINVAL && (flags & ~WNOHANG))
p = wait3(&s, flags & WNOHANG, NiL);
#endif
#endif
if (p <= 0)
{
if (p == 0 && status) *status = s;
return(p);
}
if (pid <= 0 || p == pid)
{
if (status) *status = s;
return(p);
}
if (!(zp = newof(0, struct zombie, 1, 0))) return(-1);
zp->pid = p;
zp->status = s;
zp->next = zombies;
zombies = zp;
}
/*NOTREACHED*/
}
#endif
#endif

View File

@@ -0,0 +1,314 @@
#
# posix limits,unistd,confstr,fpathconf,pathconf,sysconf macro table
#
# @(#)conf.tab (AT&T Bell Laboratories) 05/09/95
#
# name index standard section call flags [ value ... ]
# [ <tab> _LOCAL_name macro definition ... ]
#
# name: sans prefix
# index: starts at 1, must not change or be reused
# standard: AST, C, POSIX, SVID, XOPEN, <vendor-name> { SUN, SGI, ... }
# section: section number in standard
# call: CS=confstr PC=pathconf SC=sysconf XX=none
# flags: 0 no flags
# F feature for unistd.h
# L constant for limits.h
# M has _<standard><section>_<name> minmax value
# N _<call>_<name>
# S _<call>_<standard><section>_<name>
# U <standard><section>_<name> prefixed by underscore
# X define even if local is indeterminant (ast special)
#
# default names if <section> <= 1
#
# _<call>_<name>
# <standard>_<name>
#
# default names if <section> > 1
#
# _<call>_<section>_<name>
# <standard><section>_<name>
#
# the [ENSU] flags modify the default names
#
# NOTE: 132 is the next index
#
AIO_LISTIO_MAX 1 POSIX SC 1 LMU 2
AIO_MAX 2 POSIX SC 1 LMU 1
AIO_PRIO_DELTA_MAX 3 POSIX SC 1 LMU
ARG_MAX 4 POSIX SC 1 LMU NCARGS 4096
ASYNCHRONOUS_IO 5 POSIX SC 1 FU
ASYNC_IO 6 POSIX PC 1 FU
ATEXIT_MAX 82 XOPEN SC 1 LMU 32
AVPHYS_PAGES 121 SUN SC 1 0
BC_BASE_MAX 7 POSIX SC 2 LMN 99
BC_DIM_MAX 8 POSIX SC 2 LMN 2048
BC_SCALE_MAX 9 POSIX SC 2 LMN 99
BC_STRING_MAX 10 POSIX SC 2 LMN 1000
CHARCLASS_NAME_MAX 102 XOPEN XX 1 L 14
CHAR_BIT 13 C XX 1 L 8
CHAR_MAX 14 C XX 1 L
CHAR_MIN 15 C XX 1 L
CHAR_TERM 16 POSIX SC 2 F
CHILD_MAX 17 POSIX SC 1 LMU 6
#define _LOCAL_CHILD_MAX local_child_max()
#if _lib_fork
#define child() fork()
#else
#ifdef _map_spawnve
#define _map_spawnve _map_spawnve
#endif
extern int spawnve(const char*, char* const[], char* const[]);
static char* cmd[] = { "/bin/echo", 0 };
#define child() spawnve(cmd[0],cmd,(char**)0)
#endif
static int
local_child_max(void)
{
int i;
int n;
for (i = 3; i < 512 && (n = child()) >= 0; i++)
if (!n) _exit(0);
while (wait((int*)0) > 0);
for (n = 8; n < i; n <<= 1);
return(n);
}
CHOWN_RESTRICTED 18 POSIX PC 1 FU
CKPT 97 POSIX SC 1 FU
CLK_TCK 19 AST SC 1 MU HZ 60
CLOCKRES_MIN 20 POSIX SC 1 MU 1
COLL_WEIGHTS_MAX 21 POSIX SC 2 LMN 2
CRYPT 116 XOPEN SC 1 FSU
C_BIND 11 POSIX SC 2 F
C_DEV 12 POSIX SC 2 F
C_VERSION 98 POSIX SC 2 F
DELAYTIMER_MAX 22 POSIX SC 1 LMU 32
ENH_I18N 117 XOPEN SC 1 FSU
EXPR_NEST_MAX 23 POSIX SC 2 LMN 32
FCHR_MAX 24 SVID SC 1 LMU LONG_MAX 2147483647
FORT_DEV 25 POSIX SC 2 F
FORT_RUN 26 POSIX SC 2 F
FSYNC 27 POSIX SC 1 FU _lib_fsync
INT_MAX 28 C XX 1 L 32767
INT_MIN 29 C XX 1 L -32767
IOV_MAX 100 XOPEN SC 1 LMU 16
JOB_CONTROL 30 POSIX SC 1 FU
#include "FEATURE/wait"
#ifdef WUNTRACED
#define _LOCAL_JOB_CONTROL 1
#endif
LINE_MAX 31 POSIX SC 2 LMN 2048
LINK_MAX 32 POSIX PC 1 LMU MAXLINK SHRT_MAX 8
LOCALEDEF 99 POSIX SC 1 FU
LOCALEDEF 33 POSIX SC 2 F
LOGNAME_MAX 129 SVID SC 1 MU 8
LONG_BIT 56 XOPEN XX 1 L 32
#ifdef CHAR_BIT
#define _LOCAL_LONG_BIT (CHAR_BIT*sizeof(long))
#else
#define _LOCAL_LONG_BIT (8*sizeof(int))
#endif
LONG_MAX 34 C XX 1 L 2147483647
LONG_MIN 35 C XX 1 L -2147483647
MAPPED_FILES 36 POSIX SC 1 FU _lib_mmap
MAX_CANON 37 POSIX PC 1 LMU CANBSIZ 255
MAX_INPUT 38 POSIX PC 1 LMU MAX_CANON 255
MB_LEN_MAX 39 C XX 1 L 1
MEMLOCK 40 POSIX SC 1 FU
MEMLOCK_RANGE 41 POSIX SC 1 FU
MEMORY_PROTECTION 42 POSIX SC 1 FU
MESSAGE_PASSING 43 POSIX SC 1 FU
MQ_OPEN_MAX 44 POSIX SC 1 LMU 8
MQ_PRIO_MAX 45 POSIX SC 1 LMU 32
NACLS_MAX 122 SVID SC 1 0
NAME_MAX 46 POSIX PC 1 LMU 14
#ifdef MAXNAMLEN
#define _LOCAL_NAME_MAX MAXNAMLEN
#else
#define _LOCAL_NAME_MAX local_name_max()
#if !_lib_remove || _lib_unlink
#define remove unlink
#endif
static int
local_name_max(void)
{
int i;
int n;
int v;
char name[256];
for (i = 0; i < sizeof(name); i++)
name[i] = 'F';
name[8] = '.';
name[sizeof(name) - 1] = 0;
if ((n = creat(name, 0666)) >= 0)
{
close(n);
for (v = 12; v < sizeof(name); v++)
{
name[v] = 0;
if (remove(name) >= 0) break;
name[v] = 'F';
}
}
else for (v = 12; v < sizeof(name); v++)
{
name[v] = 0;
if ((n = creat(name, 0666)) >= 0)
{
close(n);
remove(name);
name[v] = 'F';
}
else
{
v--;
break;
}
}
return(v);
}
#endif
NGROUPS_MAX 47 POSIX SC 1 LMU 0
#if _lib_getgroups
#define _LOCAL_NGROUPS_MAX local_ngroups_max()
static int
local_ngroups_max()
{
int n;
gid_t g;
if ((n = getgroups(0, &g)) < 0)
#ifdef NGROUPS
n = NGROUPS;
#else
n = 0;
#endif
return(n);
}
#endif
NL_ARGMAX 103 XOPEN XX 1 L 9
NL_LANGMAX 104 XOPEN XX 1 L 14
NL_MSGMAX 105 XOPEN XX 1 L 32767
NL_NMAX 106 XOPEN XX 1 L
NL_SETMAX 107 XOPEN XX 1 L 255
NL_TEXTMAX 108 XOPEN XX 1 L LINE_MAX
NO_TRUNC 48 POSIX PC 1 FU
NPROCESSORS_CONF 123 SVID SC 1 0
NPROCESSORS_ONLN 124 SVID SC 1 0
NZERO 109 XOPEN XX 1 L 20
OPEN_MAX 49 POSIX SC 1 LMU 16
#if _lib_getdtablesize
extern int getdtablesize(void);
#define _LOCAL_OPEN_MAX getdtablesize()
#else
#define _LOCAL_OPEN_MAX local_open_max()
#if _lib_getrlimit && _sys_resource
#include <sys/time.h>
#include <sys/resource.h>
#endif
#ifdef RLIMIT_NOFILE
static int
local_open_max(void)
{
struct rlimit rlim;
if (getrlimit(RLIMIT_NOFILE, &rlim))
return(-1);
return(rlim.rlim_cur);
}
#else
static int
local_open_max(void)
{
int i;
int n;
int v;
n = 0;
v = 2;
while ((i = dup(0)) >= 0)
{
if (!n) n = i;
if (i > v) v = i;
}
while (n <= v) close(n++);
return(v + 1);
}
#endif
#endif
OPEN_MAX_CEIL 50 AST XX 1 L OPEN_MAX
OS_VERSION 119 AES SC 1 FSU
PAGESIZE 51 POSIX SC 1 L PAGE_SIZE 4096
#if _lib_getpagesize
extern ssize_t getpagesize(void);
#define _LOCAL_PAGESIZE getpagesize()
#endif
PAGE_SIZE 101 XOPEN SC 1 L PAGESIZE
PASS_MAX 130 SVID SC 1 MU 8
PATH 52 POSIX CS 1 MU "/bin:/usr/bin"
PATH_MAX 53 POSIX PC 1 LMUX MAXPATHLEN 1024 256
PHYS_PAGES 125 SUN SC 1 0
PID_MAX 54 SVID SC 1 LMU 30000
PIPE_BUF 55 POSIX PC 1 LMU 512
PRIORITIZED_IO 57 POSIX SC 1 FU
PRIORITY_SCHEDULING 58 POSIX SC 1 FU
PRIO_IO 59 POSIX PC 1 FU
REALTIME_SIGNALS 60 POSIX SC 1 FU
REGEXP 95 POSIX SC 1 FU
RESOURCE_LIMITS 96 POSIX SC 1 FU
RE_DUP_MAX 61 POSIX SC 2 LMN 255
RTSIG_MAX 62 POSIX SC 1 LMU 8
SAVED_IDS 63 POSIX SC 1 FU
#if _lib_setuid && !_lib_setreuid
#define _LOCAL_SAVED_IDS 1
#endif
SCHAR_MAX 64 C XX 1 L 127
SCHAR_MIN 65 C XX 1 L -127
SEMAPHORES 66 POSIX SC 1 FU
SEM_NSEMS_MAX 67 POSIX SC 1 LMU 256
SEM_VALUE_MAX 68 POSIX SC 1 LMU 32767
SHARED_MEMORY_OBJECTS 69 POSIX SC 1 FU
SHELL 120 AST CS 1 MU "/bin/sh"
SHM 118 XOPEN SC 1 FSU
SHRT_MAX 70 C XX 1 L 32767
SHRT_MIN 71 C XX 1 L -32767
SIGQUEUE_MAX 72 POSIX SC 1 LMU 32
SIGRT_MAX 126 SVID SC 1 0
SIGRT_MIN 127 SVID SC 1 0
SSIZE_MAX 73 POSIX XX 1 LMU INT_MAX 32767
STD_BLK 74 SVID SC 1 LMU 1024
STREAM_MAX 75 POSIX SC 1 LMU OPEN_MAX 8
SW_DEV 76 POSIX SC 2 F
SYMLINK_MAX 93 POSIX PC 1 LMU 255
#if PATH_MAX
#define _LOCAL_SYMLINK_MAX (PATH_MAX-1)
#endif
SYMLOOP_MAX 94 POSIX PC 1 LMU 8
SYNCHRONIZED_IO 77 POSIX SC 1 FU
SYNC_IO 78 POSIX PC 1 FU
SYSPID_MAX 79 SVID SC 1 LMU 2
TIMERS 80 POSIX SC 1 FU
TIMER_MAX 81 POSIX SC 1 LMU 32
TMP 131 AST CS 1 MU "/tmp"
TMP_MAX 128 C SC 1 MU 10000
TZNAME_MAX 83 POSIX SC 1 LMU 6
UCHAR_MAX 84 C XX 1 L 255
UID_MAX 85 SVID SC 1 LMU 60002
UINT_MAX 86 C XX 1 L 65535
ULONG_MAX 87 C XX 1 L 4294967295
UNIX 115 XOPEN SC 1 FSU
UPE 89 POSIX SC 2 F
USHRT_MAX 88 C XX 1 L 65535
VDISABLE 90 POSIX PC 1 FU
VERSION 91 POSIX SC 1 FU 199009
VERSION 92 POSIX SC 2 F 199209
VERSION 110 XOPEN SC 1 FSU 4
WORD_BIT 56 XOPEN XX 1 L 16
#ifdef CHAR_BIT
#define _LOCAL_WORD_BIT (CHAR_BIT*sizeof(int))
#else
#define _LOCAL_WORD_BIT (8*sizeof(int))
#endif
XCU_VERSION 111 XOPEN SC 1 FSU
XPG2 112 XOPEN XX 1 FU
XPG3 113 XOPEN XX 1 FU
XPG4 114 XOPEN XX 1 FU

View File

@@ -0,0 +1,176 @@
/* $XConsortium: dirlib.h /main/3 1995/11/01 17:21:59 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
/*
* AT&T Bell Laboratories
*
* directory stream access library private definitions
* library routines should include this file rather than <dirent.h>
*/
#ifndef _DIRLIB_H
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#define _DIRLIB_H
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide getdents
#else
#define getdents ______getdents
#endif
#include <ast.h>
#include <errno.h>
#if _lib_opendir && ( _hdr_dirent || _hdr_ndir || _sys_dir )
#define _dir_ok 1
#include <ls.h>
#ifndef _DIRENT_H
#if _hdr_dirent
#include <dirent.h>
#else
#if _hdr_ndir
#include <ndir.h>
#else
#include <sys/dir.h>
#endif
#ifndef dirent
#define dirent direct
#endif
#endif
#endif
#else
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide DIR closedir dirent opendir readdir seekdir telldir
#else
#define DIR ______DIR
#define closedir ______closedir
#define dirent ______dirent
#define opendir ______opendir
#define readdir ______readdir
#define seekdir ______seekdir
#define telldir ______telldir
#endif
#include <ast_param.h>
#include <ls.h>
#include <limits.h>
#include <sys/dir.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide DIR closedir dirent opendir readdir seekdir telldir
#else
#undef DIR
#undef closedir
#undef dirent
#undef opendir
#undef readdir
#undef seekdir
#undef telldir
#endif
#define _DIR_PRIVATE_ \
int dd_loc; /* offset in block */ \
int dd_size; /* valid data in block */ \
char* dd_buf; /* directory block */
#include "dirstd.h"
#ifndef DIRBLKSIZ
#ifdef DIRBLK
#define DIRBLKSIZ DIRBLK
#else
#ifdef DIRBUF
#define DIRBLKSIZ DIRBUF
#else
#define DIRBLKSIZ 8192
#endif
#endif
#endif
#endif
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide getdents
#else
#undef getdents
#endif
#ifndef errno
extern __MANGLE__ int errno;
#endif
extern __MANGLE__ ssize_t getdents __PROTO__((int, __V_*, size_t));
#endif

View File

@@ -0,0 +1,122 @@
/* $XConsortium: dirnsys.h /main/3 1995/11/01 17:22:15 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
/*
* AT&T Bell Laboratories
*
* <dirent.h> for systems with opendir() and <ndir.h>
*/
#ifndef _DIRENT_H
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#define _DIRENT_H
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide closedir opendir readdir seekdir telldir
#else
#define closedir ______closedir
#define opendir ______opendir
#define readdir ______readdir
#define seekdir ______seekdir
#define telldir ______telldir
#endif
#include <ndir.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide closedir opendir readdir seekdir telldir
#else
#undef closedir
#undef opendir
#undef readdir
#undef seekdir
#undef telldir
#endif
#ifndef dirent
#define dirent direct
#endif
#if !defined(d_fileno) && !defined(d_ino)
#define d_fileno d_ino
#endif
#ifdef rewinddir
#undef rewinddir
#define rewinddir(p) seekdir(p,0L)
#endif
extern __MANGLE__ DIR* opendir __PROTO__((const char*));
extern __MANGLE__ void closedir __PROTO__((DIR*));
extern __MANGLE__ struct dirent* readdir __PROTO__((DIR*));
extern __MANGLE__ void seekdir __PROTO__((DIR*, long));
extern __MANGLE__ long telldir __PROTO__((DIR*));
#endif

View File

@@ -0,0 +1,108 @@
/* $XConsortium: dirstd.h /main/3 1995/11/01 17:22:29 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
/*
* AT&T Bell Laboratories
*
* <dirent.h> for systems with no opendir()
*/
#ifndef _DIRENT_H
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#define _DIRENT_H
typedef struct
{
int dd_fd; /* file descriptor */
#ifdef _DIR_PRIVATE_
_DIR_PRIVATE_
#endif
} DIR;
struct dirent
{
long d_fileno; /* entry serial number */
int d_reclen; /* entry length */
int d_namlen; /* entry name length */
char d_name[1]; /* entry name */
};
#ifdef rewinddir
#undef rewinddir
#define rewinddir(p) seekdir(p,0L)
#endif
extern __MANGLE__ DIR* opendir __PROTO__((const char*));
extern __MANGLE__ void closedir __PROTO__((DIR*));
extern __MANGLE__ struct dirent* readdir __PROTO__((DIR*));
extern __MANGLE__ void seekdir __PROTO__((DIR*, long));
extern __MANGLE__ long telldir __PROTO__((DIR*));
#endif

View File

@@ -0,0 +1,122 @@
/* $XConsortium: dirsys.h /main/3 1995/11/01 17:22:42 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
/*
* AT&T Bell Laboratories
*
* <dirent.h> for systems with opendir() and no <ndir.h>
*/
#ifndef _DIRENT_H
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#define _DIRENT_H
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide closedir opendir readdir seekdir telldir
#else
#define closedir ______closedir
#define opendir ______opendir
#define readdir ______readdir
#define seekdir ______seekdir
#define telldir ______telldir
#endif
#include <sys/dir.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide closedir opendir readdir seekdir telldir
#else
#undef closedir
#undef opendir
#undef readdir
#undef seekdir
#undef telldir
#endif
#ifndef dirent
#define dirent direct
#endif
#if !defined(d_fileno) && !defined(d_ino)
#define d_fileno d_ino
#endif
#ifdef rewinddir
#undef rewinddir
#define rewinddir(p) seekdir(p,0L)
#endif
extern __MANGLE__ DIR* opendir __PROTO__((const char*));
extern __MANGLE__ void closedir __PROTO__((DIR*));
extern __MANGLE__ struct dirent* readdir __PROTO__((DIR*));
extern __MANGLE__ void seekdir __PROTO__((DIR*, long));
extern __MANGLE__ long telldir __PROTO__((DIR*));
#endif

View File

@@ -0,0 +1,212 @@
/* $XConsortium: getdents.c /main/3 1995/11/01 17:22:56 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include "dirlib.h"
#if _dir_ok || _lib_getdents
NoN(getdents)
#else
/*
* getdents
*
* read directory entries into directory block
*
* NOTE: directory entries must fit within DIRBLKSIZ boundaries
*/
#ifndef MAXNAMLEN
#define MAXNAMLEN 255
#endif
#if _lib_dirread
extern __MANGLE__ int dirread __PROTO__((int, char*, int));
#endif
#if _lib_getdirentries
extern __MANGLE__ int getdirentries __PROTO__((int, char*, int, long*));
#endif
ssize_t
getdents __PARAM__((int fd, __V_* buf, size_t siz), (fd, buf, siz)) __OTORP__(int fd; __V_* buf; size_t siz;){
struct stat st;
if (siz < DIRBLKSIZ)
{
errno = EINVAL;
return(-1);
}
if (fstat(fd, &st)) return(-1);
if (!S_ISDIR(st.st_mode))
{
#ifdef ENOTDIR
errno = ENOTDIR;
#else
errno = EBADF;
#endif
return(-1);
}
#if _lib_getdirentries
{
long off;
return(getdirentries(fd, buf, siz, &off));
}
#else
#if _lib_dirread
{
register char* sp; /* system */
register struct dirent* up; /* user */
char* u;
int n;
int m;
int i;
m = (siz * 6) / 10;
m = roundof(m, 8);
sp = (char*)buf + siz - m - 1;
if (!(n = dirread(fd, sp, m))) return(0);
if (n > 0)
{
up = (struct dirent*)buf;
sp[n] = 0;
while (sp < (char*)buf + siz - m + n)
{
i = 0;
while (*sp >= '0' && *sp <= '9')
i = 10 * i + *sp++ - '0';
while (*sp && *sp != '\t') sp++;
if (*sp++)
{
up->d_fileno = i;
u = up->d_name;
while ((*u = *sp++) && u < up->d_name + MAXNAMLEN) u++;
*u = 0;
up->d_reclen = sizeof(struct dirent) - sizeof(up->d_name) + (up->d_namlen = u - up->d_name) + 1;
up->d_reclen = roundof(up->d_reclen, 8);
up = (struct dirent*)((char*)up + up->d_reclen);
}
}
return((char*)up - (char*)buf);
}
}
#else
#if _mem_d_reclen_direct
return(read(fd, buf, siz));
#else
{
#define MAXREC roundof(sizeof(*up)-sizeof(up->d_name)+sizeof(sp->d_name)+1,8)
register struct direct* sp; /* system */
register struct dirent* up; /* user */
register char* s;
register char* u;
int n;
int m;
char tmp[sizeof(sp->d_name) + 1];
/*
* we assume sizeof(struct dirent) > sizeof(struct direct)
*/
up = (struct dirent*)buf;
n = (siz / MAXREC) * sizeof(struct direct);
if ((!(m = n & ~511) || m < MAXREC) && (!(m = n & ~255) || m < MAXREC)) m = n;
do
{
if ((n = read(fd, (char*)buf + siz - m, m)) <= 0) break;
sp = (struct direct*)((char*)buf + siz - m);
while (sp < (struct direct*)((char*)buf + siz - m + n))
{
if (sp->d_ino)
{
up->d_fileno = sp->d_ino;
s = sp->d_name;
u = tmp;
while (s < sp->d_name + sizeof(sp->d_name) && *s)
*u++ = *s++;
*u = 0;
strcpy(up->d_name, tmp);
up->d_reclen = sizeof(struct dirent) - sizeof(up->d_name) + (up->d_namlen = u - tmp) + 1;
up->d_reclen = roundof(up->d_reclen, 8);
up = (struct dirent*)((char*)up + up->d_reclen);
}
sp++;
}
} while (up == (struct dirent*)buf);
return((char*)up - (char*)buf);
}
#endif
#endif
#endif
}
#endif

View File

@@ -0,0 +1,128 @@
/* $XConsortium: opendir.c /main/3 1995/11/01 17:23:11 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include "dirlib.h"
#if _dir_ok
NoN(opendir)
#else
static const char id_dir[] = "\n@(#)directory (AT&T Bell Laboratories) 04/01/93\0\n";
static DIR* freedirp; /* always keep one dirp */
DIR*
opendir __PARAM__((register const char* path), (path)) __OTORP__(register const char* path;){
register DIR* dirp = 0;
register int fd;
struct stat st;
if ((fd = open(path, 0)) < 0) return(0);
if (fstat(fd, &st) < 0 ||
!S_ISDIR(st.st_mode) && (errno = ENOTDIR) ||
fcntl(fd, F_SETFD, FD_CLOEXEC) ||
!(dirp = freedirp ? freedirp :
#if defined(_DIR_PRIVATE) || _ptr_dd_buf
newof(0, DIR, 1, DIRBLKSIZ)
#else
newof(0, DIR, 1, 0)
#endif
))
{
close(fd);
if (dirp)
{
if (!freedirp) freedirp = dirp;
else free(dirp);
}
return(0);
}
freedirp = 0;
dirp->dd_fd = fd;
dirp->dd_loc = dirp->dd_size = 0; /* refill needed */
#if defined(_DIR_PRIVATE) || _ptr_dd_buf
dirp->dd_buf = (__V_*)((char*)dirp + sizeof(DIR));
#endif
return(dirp);
}
void
closedir __PARAM__((register DIR* dirp), (dirp)) __OTORP__(register DIR* dirp;){
if (dirp)
{
close(dirp->dd_fd);
if (!freedirp) freedirp = dirp;
else free(dirp);
}
}
#endif

View File

@@ -0,0 +1,100 @@
/* $XConsortium: readdir.c /main/3 1995/11/01 17:23:29 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include "dirlib.h"
#if _dir_ok
NoN(readdir)
#else
struct dirent*
readdir __PARAM__((register DIR* dirp), (dirp)) __OTORP__(register DIR* dirp;){
register struct dirent* dp;
for (;;)
{
if (dirp->dd_loc >= dirp->dd_size)
{
if (dirp->dd_size < 0) return(0);
dirp->dd_loc = 0;
if ((dirp->dd_size = getdents(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ)) <= 0)
return(0);
}
dp = (struct dirent*)&dirp->dd_buf[dirp->dd_loc];
if (dp->d_reclen <= 0) return(0);
dirp->dd_loc += dp->d_reclen;
if (dp->d_fileno) return(dp);
}
/*NOTREACHED*/
}
#endif

View File

@@ -0,0 +1,86 @@
/* $XConsortium: rewinddir.c /main/3 1995/11/01 17:23:42 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include "dirlib.h"
#if _dir_ok && ( defined(rewinddir) || _lib_rewinddir )
NoN(rewinddir)
#else
#undef rewinddir
void
rewinddir __PARAM__((DIR* dirp), (dirp)) __OTORP__(DIR* dirp;){
seekdir(dirp, 0L);
}
#endif

View File

@@ -0,0 +1,94 @@
/* $XConsortium: seekdir.c /main/3 1995/11/01 17:23:59 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include "dirlib.h"
#if _dir_ok
NoN(seekdir)
#else
void
seekdir __PARAM__((register DIR* dirp, long loc), (dirp, loc)) __OTORP__(register DIR* dirp; long loc;){
off_t base; /* file location of block */
off_t offset; /* offset within block */
if (telldir(dirp) != loc)
{
lseek(dirp->dd_fd, 0L, SEEK_SET);
dirp->dd_loc = dirp->dd_size = 0;
while (telldir(dirp) != loc)
if (!readdir(dirp))
break; /* "can't happen" */
}
}
#endif

View File

@@ -0,0 +1,84 @@
/* $XConsortium: telldir.c /main/3 1995/11/01 17:24:14 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include "dirlib.h"
#if _dir_ok
NoN(telldir)
#else
long
telldir __PARAM__((DIR* dirp), (dirp)) __OTORP__(DIR* dirp;){
return(lseek(dirp->dd_fd, 0L, SEEK_CUR) + (long)dirp->dd_loc);
}
#endif

View File

@@ -0,0 +1,407 @@
/* $XConsortium: sfkeyprintf.c /main/2 1996/05/08 19:40:49 drk $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#include <ctype.h>
#include <sfdisc.h>
#include <sfstr.h>
#include <re.h>
#define ESC '\033'
#define FMT_case 1
#define FMT_edit 2
#define RE_STOP (1<<(RE_EXTERNAL+0))
static struct
{
char args[sizeof(va_list)];
__V_* handle;
char* format;
Sf_key_lookup_t lookup;
Sf_key_convert_t convert;
Sfio_t* tmp[2];
int invisible;
int level;
} state;
typedef struct
{
char* next;
int delimiter;
int first;
} Field_t;
typedef union
{
char** p;
char* s;
long l;
int i;
char c;
} Value_t;
#define initfield(f,s) ((f)->first = (f)->delimiter = *((f)->next = (s)))
static char*
getfield __PARAM__((register Field_t* f, int restore), (f, restore)) __OTORP__(register Field_t* f; int restore;){
register char* s;
register int n;
register int c;
register int lp;
register int rp;
char* b;
if (!f->delimiter)
return(0);
s = f->next;
if (f->first)
f->first = 0;
else if (restore)
*s = f->delimiter;
b = ++s;
lp = rp = n = 0;
for (;;)
{
if (!(c = *s++))
{
f->delimiter = 0;
break;
}
else if (c == ESC || c == '\\')
{
if (*s) s++;
}
else if (c == lp) n++;
else if (c == rp) n--;
else if (n <= 0)
{
if (c == '(')
{
lp = '(';
rp = ')';
n = 1;
}
else if (c == '[')
{
lp = '[';
rp = ']';
n = 1;
}
else if (c == f->delimiter)
{
*(f->next = --s) = 0;
break;
}
}
}
return(b);
}
/*
* sfio %& extended format callout
*/
static int
extend __PARAM__((__V_* val, int fmt, int prec, char** out, int base, char* op, int oplen), (val, fmt, prec, out, base, op, oplen)) __OTORP__(__V_* val; int fmt; int prec; char** out; int base; char* op; int oplen;){
NoP(fmt);
NoP(prec);
NoP(base);
NoP(op);
NoP(oplen);
return(strlen(*out = (char*)val));
}
/*
* sfio %@ argument callout
*/
static int
getarg __PARAM__((int cc, Value_t* value, char* op, int oplen), (cc, value, op, oplen)) __OTORP__(int cc; Value_t* value; char* op; int oplen;){
char* a = 0;
char* s = 0;
long n = 0;
int h = 0;
int i = 0;
int x = 0;
char* v;
char* e;
char* t;
int c;
int d;
Re_program_t* re;
Field_t f;
state.level++;
if (op && oplen > 0)
{
c = op[oplen];
op[oplen] = 0;
v = op;
for (;;)
{
switch (*v++)
{
case 0:
break;
case '(':
h++;
continue;
case ')':
h--;
continue;
case '=':
case ':':
case ',':
if (h <= 0)
{
a = v;
break;
}
continue;
default:
continue;
}
if (i = *--v)
{
*v = 0;
if (i == ':' && cc == 's' && strlen(a) > 4 && !isalnum(*(a + 4)))
{
d = *(a + 4);
*(a + 4) = 0;
if (streq(a, "case")) x = FMT_case;
else if (streq(a, "edit")) x = FMT_edit;
*(a + 4) = d;
if (x) a = 0;
}
}
break;
}
h = (*state.lookup)(state.handle, op, a, cc, &s, &n);
if (i) *v++ = i;
op[oplen] = c;
}
switch (cc)
{
case 'c':
value->c = s ? *s : c;
break;
case 'd':
value->i = (int)(s ? strtol(s, NiL, 0) : n);
break;
case 'D':
value->l = (long)(s ? strtol(s, NiL, 0) : n);
break;
case 'p':
value->p = (char**)(s ? strtol(s, NiL, 0) : n);
break;
case 's':
if (!s)
{
if (h)
{
sfprintf(state.tmp[1], "%ld", n);
s = sfstruse(state.tmp[1]);
}
else s = "";
}
if (x)
{
c = op[oplen];
op[oplen] = 0;
h = 0;
d = initfield(&f, v + 4);
switch (x)
{
case FMT_case:
while ((a = getfield(&f, 1)) && (v = getfield(&f, 0)))
{
if (strmatch(s, a))
{
int aha = *f.next;
s = state.format;
state.format = v;
sfprintf(state.tmp[0], "%&%@%:", extend, getarg);
state.format = s;
s = sfstruse(state.tmp[0]);
*(v - 1) = d;
if (f.delimiter)
*f.next = d;
h = 1;
break;
}
*(v - 1) = d;
}
break;
case FMT_edit:
x = 1;
while ((a = getfield(&f, 1)) && (v = getfield(&f, 0)))
{
x ^= 1;
i = 0;
if (t = e = getfield(&f, 0))
{
for (;;)
{
switch (*t++)
{
case 0:
break;
case 'g':
i |= RE_ALL;
continue;
case 'l':
i |= RE_LOWER;
continue;
case 's':
i |= RE_STOP;
continue;
case 'u':
i |= RE_UPPER;
continue;
}
break;
}
}
if (re = recomp(a, RE_EDSTYLE|RE_MATCH))
{
if (reexec(re, s)) ressub(re, state.tmp[x], s, v, i);
else
{
i = 0;
sfputr(state.tmp[x], s, -1);
}
refree(re);
s = sfstruse(state.tmp[x]);
}
else i = 0;
*(v - 1) = d;
if (e) *(e - 1) = d;
if (i & RE_STOP)
{
if (f.delimiter)
*f.next = d;
break;
}
}
h = 1;
break;
}
op[oplen] = c;
if (!h) s = "";
}
value->s = s;
if (state.level == 1)
while ((s = strchr(s, ESC)) && *(s + 1) == '[')
do state.invisible++; while (*s && !islower(*s++));
break;
case 'u':
value->i = (unsigned int)(s ? strtoul(s, NiL, 0) : n);
break;
case 'U':
value->l = (unsigned long)(s ? strtoul(s, NiL, 0) : n);
break;
case '\n':
value->s = "\n";
break;
case '1':
value->s = state.format;
break;
case '2':
value->s = state.args;
break;
default:
if (!state.convert || !(value->s = (*state.convert)(state.handle, a, op, cc, s, n)))
{
sfprintf(state.tmp[0], "%%%c", cc);
value->s = sfstruse(state.tmp[0]);
}
break;
}
state.level--;
return(0);
}
int
sfkeyprintf __PARAM__((Sfio_t* sp, __V_* handle, const char* format, Sf_key_lookup_t lookup, Sf_key_convert_t convert), (sp, handle, format, lookup, convert)) __OTORP__(Sfio_t* sp; __V_* handle; const char* format; Sf_key_lookup_t lookup; Sf_key_convert_t convert;){
register int i;
for (i = 0; i < elementsof(state.tmp); i++)
if (!state.tmp[i] && !(state.tmp[i] = sfstropen()))
return(0);
state.handle = handle;
state.format = (char*)format;
state.lookup = lookup;
state.convert = convert;
state.invisible = 0;
state.level = 0;
return(sfprintf(sp, "%&%@%:", extend, getarg) - state.invisible);
}

View File

@@ -0,0 +1,110 @@
/* $XConsortium: sfslowio.c /main/2 1996/05/08 19:41:03 drk $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <ast.h>
#include <error.h>
#include <sfdisc.h>
/*
* sfslowio exception handler
* EOF in interrupt
* free on close
*/
static int
slowexcept __PARAM__((Sfio_t* sp, int op, Sfdisc_t* dp), (sp, op, dp)) __OTORP__(Sfio_t* sp; int op; Sfdisc_t* dp;){
NoP(sp);
switch (op)
{
case SF_CLOSE:
free(dp);
break;
case SF_READ:
case SF_WRITE:
if (errno == EINTR)
return(-1);
break;
}
return(0);
}
/*
* create and push sfio slowio discipline
*/
int
sfslowio __PARAM__((Sfio_t* sp), (sp)) __OTORP__(Sfio_t* sp;){
Sfdisc_t* dp;
if (!(dp = newof(0, Sfdisc_t, 1, 0)))
return(-1);
dp->exceptf = slowexcept;
return(sfdisc(sp, dp) ? 0 : -1);
}

View File

@@ -0,0 +1,204 @@
/* $XConsortium: align.c /main/3 1995/11/01 17:25:09 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 11
union _u_
{
long u1;
char* u2;
double u3;
char u4[1024];
};
struct _s_
{
char s1;
union _u_ s2;
};
#define roundof(x,y) (((x)+((y)-1))&~((y)-1))
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
register int i;
register int j;
register int k;
int align0;
int align1;
int align2;
unsigned long bit1;
unsigned long bit2;
unsigned long bits0;
unsigned long bits1;
unsigned long bits2;
union _u_ u;
union _u_ v;
u.u2 = u.u4;
v.u2 = u.u2 + 1;
bit1 = u.u1 ^ v.u1;
v.u2 = u.u2 + 2;
bit2 = u.u1 ^ v.u1;
align0 = sizeof(struct _s_) - sizeof(union _u_);
bits0 = 0;
k = 0;
for (j = 0; j < align0; j++)
{
u.u2 = u.u4 + j;
bits1 = 0;
for (i = 0; i < align0; i++)
{
v.u2 = u.u2 + i;
bits1 |= u.u1 ^ v.u1;
}
if (!bits0 || bits1 < bits0)
{
bits0 = bits1;
k = j;
}
}
align1 = roundof(align0, 2);
u.u2 = u.u4 + k;
for (bits1 = bits0; i < align1; i++)
{
v.u2 = u.u2 + i;
bits1 |= u.u1 ^ v.u1;
}
align2 = roundof(align0, 4);
for (bits2 = bits1; i < align2; i++)
{
v.u2 = u.u2 + i;
bits2 |= u.u1 ^ v.u1;
}
printf("typedef unsigned %s INTEGRAL;\n", sizeof(char*) >= sizeof(long) ? "long" : sizeof(char*) >= sizeof(int) ? "int" : "short");
printf("\n");
printf("#define CHUNK %d\n", sizeof(char*) >= 4 ? 8192 : 1024);
printf("#define INTEGRAL %s\n", sizeof(char*) >= sizeof(long) ? "long" : sizeof(char*) >= sizeof(int) ? "int" : "short");
printf("#define INTEGER(x) ((INTEGRAL)(x))\n");
printf("#define POINTER(x) ((char*)(x))\n");
if (bits2 == (align2 - 1)) printf("#define ROUND(x,y) POINTER(INTEGER((x)+(y)-1)&~((y)-1))\n");
else printf("#define ROUND(x,y) POINTER(INTEGER(ALIGN(x)+(((y)+%d)/%d)-1)&~((((y)+%d)/%d)-1))\n", align0, align0, align0, align0);
printf("\n");
if (align0 == align2)
{
printf("#define BOUND BOUND2\n");
printf("#define ALIGN(x) ALIGN2(x)\n");
printf("#define TRUNC(x) TRUNC2(x)\n");
}
else if (align0 == align1)
{
printf("#define BOUND BOUND1\n");
printf("#define ALIGN(x) ALIGN1(x)\n");
printf("#define TRUNC(x) TRUNC1(x)\n");
}
else
{
printf("#define BOUND 1\n");
printf("#define ALIGN(x) POINTER(x)\n");
printf("#define TRUNC(x) POINTER(x)\n");
}
printf("\n");
printf("#define BIT1 0x%lx\n", bit1);
if (align1 == align2)
{
printf("#define BOUND1 BOUND2\n");
printf("#define ALIGN1(x) ALIGN2(x)\n");
printf("#define TRUNC1(x) TRUNC2(x)\n");
}
else
{
printf("#define BOUND1 %d\n", align1);
printf("#define ALIGN1(x) TRUNC1((x)+%d)\n", align1 - 1);
printf("#define TRUNC1(x) POINTER(INTEGER((x)+%d)&0x%lx)\n", align1 - 1, ~(bits0|bits1));
}
printf("#define CLRBIT1(x) POINTER(INTEGER(x)&0x%lx)\n", ~bit1);
printf("#define SETBIT1(x) POINTER(INTEGER(x)|0x%lx)\n", bit1);
printf("#define TSTBIT1(x) POINTER(INTEGER(x)&0x%lx)\n", bit1);
printf("\n");
printf("#define BIT2 0x%lx\n", bit2);
printf("#define BOUND2 %d\n", align2);
printf("#define ALIGN2(x) TRUNC2((x)+%d)\n", align2 - 1);
printf("#define TRUNC2(x) POINTER(INTEGER(x)&0x%lx)\n", ~(bits0|bits1|bits2));
printf("#define CLRBIT2(x) POINTER(INTEGER(x)&0x%lx)\n", ~bit2);
printf("#define SETBIT2(x) POINTER(INTEGER(x)|0x%lx)\n", bit2);
printf("#define TSTBIT2(x) POINTER(INTEGER(x)&0x%lx)\n", bit2);
printf("\n");
return(0);
}

View File

@@ -0,0 +1,118 @@
/* $XConsortium: botch.c /main/3 1995/11/01 17:25:22 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 9
#include <sys/types.h>
#include "FEATURE/types"
#include <ast_lib.h>
extern __MANGLE__ int getgroups __PROTO__((int, gid_t*));
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
#if _lib_getgroups
if (sizeof(gid_t) < sizeof(int))
{
register int n;
gid_t groups[32 * sizeof(int) / sizeof(gid_t)];
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
groups[n] = ((gid_t)0);
if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / (sizeof(int) * sizeof(int)), groups)) > 0)
{
if (groups[1] != ((gid_t)0)) n = 0;
else
{
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
groups[n] = ((gid_t)-1);
if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / (sizeof(int) * sizeof(int)), groups)) > 0)
{
if (groups[1] != ((gid_t)-1)) n = 0;
}
}
}
if (n <= 0)
{
printf("#undef getgroups\n");
printf("#define getgroups _ast_getgroups /* implementation botches gid_t* arg */\n");
}
}
#endif
return(0);
}

View File

@@ -0,0 +1,391 @@
/* $XConsortium: fcntl.c /main/4 1995/11/01 17:25:34 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 9
#include <sys/types.h>
#include <sys/stat.h>
#include <ast_lib.h>
#define ioctl ______ioctl
#define printf ______printf
#include "FEATURE/lcl.fcntl"
#include "FEATURE/lcl.unistd"
#undef ioctl
#undef printf
#include "FEATURE/tty"
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
int f_local = 0;
int f_lck = 0;
int f_lk = 0;
int o_local = 2;
char tmp[64];
printf("#pragma prototyped\n");
printf("\n");
#if _hdr_lcl_fcntl
printf("#if defined(__STDPP__directive) && defined(__STDPP__hide)\n");
printf("__STDPP__directive pragma pp:hide chmod creat fcntl mkdir mkfifo mknod open umask\n");
printf("#else\n");
printf("#define chmod ______chmod\n");
printf("#define creat ______creat\n");
printf("#define fcntl ______fcntl\n");
printf("#define mkdir ______mkdir\n");
printf("#define mkfifo ______mkfifo\n");
printf("#define mknod ______mknod\n");
printf("#define open ______open\n");
printf("#define umask ______umask\n");
printf("#endif \n");
printf("\n");
#if defined(S_IRUSR)
printf("#include <ast_fs.h> /* <fcntl.h> includes <sys/stat.h>! */\n");
#endif
printf("#include <fcntl.h>\n");
printf("\n");
printf("#if defined(_AST_H) || defined(_POSIX_SOURCE)\n");
printf("#define _AST_mode_t mode_t\n");
printf("#else\n");
printf("#define _AST_mode_t int\n");
printf("#endif\n");
printf("#if defined(__STDPP__directive) && defined(__STDPP__hide)\n");
printf("__STDPP__directive pragma pp:nohide chmod creat fcntl mkdir mkfifo mknod open umask\n");
printf("extern int creat(const char*, _AST_mode_t);\n");
printf("extern int fcntl(int, int, ...);\n");
printf("extern int open(const char*, int, ...);\n");
printf("#else\n");
printf("#ifdef creat\n");
printf("#undef creat\n");
printf("extern int creat(const char*, _AST_mode_t);\n");
printf("#endif \n");
printf("#ifdef fcntl\n");
printf("#undef fcntl\n");
printf("extern int fcntl(int, int, ...);\n");
printf("#endif \n");
printf("#ifdef open\n");
printf("#undef open\n");
printf("extern int open(const char*, int, ...);\n");
printf("#endif \n");
printf("\n");
printf("#undef _AST_mode_t\n");
printf("#undef chmod\n");
printf("#undef mkdir\n");
printf("#undef mkfifo\n");
printf("#undef mknod\n");
printf("#undef umask\n");
printf("#endif \n");
printf("\n");
#endif
#ifndef FD_CLOEXEC
printf("#define FD_CLOEXEC 1\n");
printf("\n");
#endif
#ifndef F_DUPFD
#define NEED_F 1
#else
if (F_DUPFD > f_local) f_local = F_DUPFD;
#endif
#ifndef F_GETFD
#define NEED_F 1
#else
if (F_GETFD > f_local) f_local = F_GETFD;
#endif
#ifndef F_GETFL
#define NEED_F 1
#else
if (F_GETFL > f_local) f_local = F_GETFL;
#endif
#ifndef F_GETLK
#define NEED_F 1
f_lk++;
#else
if (F_GETLK > f_local) f_local = F_GETLK;
#endif
#ifndef F_RDLCK
#define NEED_F 1
#define NEED_LCK 1
#else
if (F_RDLCK > f_lck) f_lck = F_RDLCK;
#endif
#ifndef F_SETFD
#define NEED_F 1
#else
if (F_SETFD > f_local) f_local = F_SETFD;
#endif
#ifndef F_SETFL
#define NEED_F 1
#else
if (F_SETFL > f_local) f_local = F_SETFL;
#endif
#ifndef F_SETLK
#define NEED_F 1
f_lk++;
#else
if (F_SETLK > f_local) f_local = F_SETLK;
#endif
#ifndef F_SETLKW
#define NEED_F 1
f_lk++;
#else
if (F_SETLKW > f_local) f_local = F_SETLKW;
#endif
#ifndef F_UNLCK
#define NEED_F 1
#define NEED_LCK 1
#else
if (F_UNLCK > f_lck) f_lck = F_UNLCK;
#endif
#ifndef F_WRLCK
#define NEED_F 1
#define NEED_LCK 1
#else
if (F_WRLCK > f_lck) f_lck = F_WRLCK;
#endif
#if NEED_F
printf("#define fcntl _ast_fcntl\n");
#if _lib_fcntl
printf("#define _lib_fcntl 1\n");
#endif
printf("#define _ast_F_LOCAL %d\n", f_local + 1);
#ifndef F_DUPFD
printf("#define F_DUPFD %d\n", ++f_local);
#endif
#ifndef F_GETFD
printf("#define F_GETFD %d\n", ++f_local);
#endif
#ifndef F_GETFL
printf("#define F_GETFL %d\n", ++f_local);
#endif
#ifndef F_GETLK
printf("#define F_GETLK %d\n", ++f_local);
#endif
#ifndef F_SETFD
printf("#define F_SETFD %d\n", ++f_local);
#endif
#ifndef F_SETFL
printf("#define F_SETFL %d\n", ++f_local);
#endif
#ifndef F_SETLK
printf("#define F_SETLK %d\n", ++f_local);
#endif
#ifndef F_SETLKW
printf("#define F_SETLKW %d\n", ++f_local);
#endif
#if NEED_LCK && !defined(__osf__)
printf("\n");
#ifndef F_RDLCK
printf("#define F_RDLCK %d\n", f_lck++);
#endif
#ifndef F_WRLCK
printf("#define F_WRLCK %d\n", f_lck++);
#endif
#ifndef F_UNLCK
printf("#define F_UNLCK %d\n", f_lck++);
#endif
#endif
printf("\n");
if (f_lck == 3)
{
#if !defined(_AIX) && !defined(__osf__)
printf("struct flock\n");
printf("{\n");
printf(" short l_type;\n");
printf(" short l_whence;\n");
printf(" off_t l_start;\n");
printf(" off_t l_len;\n");
printf(" short l_pid;\n");
printf("};\n");
printf("\n");
#endif
}
printf("\n");
#endif
#ifndef O_APPEND
#define NEED_O 1
#else
if (O_APPEND > o_local) o_local = O_APPEND;
#endif
#ifndef O_CREAT
#define NEED_O 1
#else
if (O_CREAT > o_local) o_local = O_CREAT;
#endif
#ifndef O_EXCL
#define NEED_O 1
#else
if (O_EXCL > o_local) o_local = O_EXCL;
#endif
#ifndef O_NOCTTY
#ifdef TIOCNOTTY
#define NEED_O 1
#endif
#else
if (O_NOCTTY > o_local) o_local = O_NOCTTY;
#endif
#ifndef O_NONBLOCK
#ifndef O_NDELAY
#define NEED_O 1
#endif
#else
if (O_NONBLOCK > o_local) o_local = O_NONBLOCK;
#endif
#ifndef O_RDONLY
#define NEED_O 1
#endif
#ifndef O_RDWR
#define NEED_O 1
#endif
#ifndef O_TRUNC
#define NEED_O 1
#else
if (O_TRUNC > o_local) o_local = O_TRUNC;
#endif
#ifndef O_WRONLY
#define NEED_O 1
#endif
#if NEED_O
printf("#define open _ast_open\n");
printf("#define _ast_O_LOCAL 0%o\n", o_local<<1);
#ifndef O_RDONLY
printf("#define O_RDONLY 0\n");
#endif
#ifndef O_WRONLY
printf("#define O_WRONLY 1\n");
#endif
#ifndef O_RDWR
printf("#define O_RDWR 2\n");
#endif
#ifndef O_APPEND
printf("#define O_APPEND 0%o\n", o_local <<= 1);
#endif
#ifndef O_CREAT
printf("#define O_CREAT 0%o\n", o_local <<= 1);
#endif
#ifndef O_EXCL
printf("#define O_EXCL 0%o\n", o_local <<= 1);
#endif
#ifndef O_NOCTTY
#ifdef TIOCNOTTY
printf("#define O_NOCTTY 0%o\n", o_local <<= 1);
#endif
#endif
#ifndef O_NONBLOCK
#ifndef O_NDELAY
printf("#define O_NONBLOCK 0%o\n", o_local <<= 1);
#endif
#endif
#ifndef O_TRUNC
printf("#define O_TRUNC 0%o\n", o_local <<= 1);
#endif
#endif
#ifndef O_ACCMODE
printf("#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)\n");
#endif
#ifndef O_NOCTTY
#ifndef TIOCNOTTY
printf("#define O_NOCTTY 0\n");
#endif
#endif
#ifndef O_NONBLOCK
#ifdef O_NDELAY
printf("#define O_NONBLOCK O_NDELAY\n");
#endif
#endif
#if NEED_F || NEED_O
printf("\n");
#if NEED_F
printf("extern int fcntl(int, int, ...);\n");
#endif
#if NEED_O
printf("extern int open(const char*, int, ...);\n");
#endif
#endif
return(0);
}

View File

@@ -0,0 +1,180 @@
set prototyped
tst stat_ver sys/types.h sys/stat.h com{
#if _STAT_VER > 0
int i;
#else
)
#endif
}end pass{
cat <<!
#define _ver_fstat _fxstat
#define _ver_FSTAT _FXSTAT
#define _ver_lstat _lxstat
#define _ver_LSTAT _LXSTAT
#define _ver_stat _xstat
#define _ver_STAT _XSTAT
!
}end
tst mknod_ver sys/types.h sys/stat.h com{
#if _MKNOD_VER > 0
int i;
#else
)
#endif
}end pass{
cat <<!
#define _ver_mknod _xmknod
#define _ver_MKNOD _XMKNOD
!
}end
cat{
#if defined(__uxp__)
#include <sys/types.h>
#include <sys/mkdev.h>
#endif
#ifndef _def_param_lcl
#ifndef S_ISUID
#if !defined(_AST_H) && !defined(_TM_H)
#include <sys/types.h>
#endif
#if defined(__STDPP__directive) && defined(__STDPP__hide)
#if !defined(_ver_mknod)
__STDPP__directive pragma pp:hide mknod
#endif
#if !defined(_ver_stat)
__STDPP__directive pragma pp:hide fstat lstat
#endif
__STDPP__directive pragma pp:hide chmod mkdir mkfifo umask
#else
#if !defined(_ver_mknod)
#define mknod ______mknod
#endif
#if !defined(_ver_stat)
#define fstat ______fstat
#define lstat ______lstat
#endif
#define chmod ______chmod
#define mkdir ______mkdir
#define mkfifo ______mkfifo
#define umask ______umask
#endif
#include <sys/stat.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
#if !defined(_ver_mknod)
__STDPP__directive pragma pp:nohide mknod
#endif
#if !defined(_ver_stat)
__STDPP__directive pragma pp:nohide fstat lstat
#endif
__STDPP__directive pragma pp:nohide chmod mkdir mkfifo umask
#else
#if !defined(_ver_mknod)
#undef mknod
#endif
#if !defined(_ver_stat)
#undef fstat
#undef lstat
#endif
#undef chmod
#undef mkdir
#undef mkfifo
#undef umask
#endif
#endif
#endif
#define FS_default "ufs"
}end
mac{
#include <sys/types.h>
#include <sys/stat.h>
#ifndef major
#include <sys/param.h>
#ifndef major
#include <sys/sysmacros.h>
#endif
<<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
<<"__STDPP__directive pragma pp:initial">>
<<"#endif">>
<<"#ifndef major">>
#ifdef major
<<"#define major(x)">> major((x))
#else
<<"#define major(x)">> ((int)(((unsigned)(x)>>8)&0377))
#endif
<<"#endif">>
<<"#ifndef minor">>
#ifdef minor
<<"#define minor(x)">> minor((x))
#else
<<"#define minor(x)">> ((int)((x)&0377))
#endif
<<"#endif">>
<<"#ifndef makedev">>
#ifdef makedev
<<"#define makedev(x,y)">> makedev((x),(y))
#else
<<"#define makedev(x,y)">> ((dev_t)((((x)&0377)<<8)|((y)&0377)))
#endif
<<"#endif">>
#endif
<<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
<<"__STDPP__directive pragma pp:noinitial">>
<<"#endif">>
}end fail{
cat <<!
#ifndef major
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
#endif
#ifndef minor
#define minor(x) ((int)((x)&0377))
#endif
#ifndef makedev
#define makedev(x,y) ((dev_t)((((x)&0377)<<8)|((y)&0377)))
#endif
!
}end
mem stat.st_blocks,stat.st_blksize,stat.st_rdev sys/types.h sys/stat.h
mem statfs.f_files,statfs.f_bavail sys/types.h sys/mount.h sys/statfs.h sys/vfs.h
hdr mntent,mnttab
lib getmntent,statfs,statvfs
sys mount,statfs,statvfs,vfs
cat{
#if _sys_statvfs
#include <sys/statvfs.h>
#else
struct statvfs
{
unsigned long f_bsize; /* fundamental file system block size */
unsigned long f_frsize; /* fragment size */
unsigned long f_blocks; /* total # of blocks of f_frsize on fs */
unsigned long f_bfree; /* total # of free blocks of f_frsize */
unsigned long f_bavail; /* # of free blocks avail to non-superuser */
unsigned long f_files; /* total # of file nodes (inodes) */
unsigned long f_ffree; /* total # of free file nodes */
unsigned long f_favail; /* # of free nodes avail to non-superuser */
unsigned long f_fsid; /* file system id (dev for now) */
char f_basetype[16]; /* target fs type name, null-terminated */
unsigned long f_flag; /* bit-mask of flags */
unsigned long f_namemax; /* maximum file name length */
char f_fstr[32]; /* filesystem-specific string */
unsigned long f_filler[16]; /* reserved for future expansion */
};
extern int fstatvfs(int, struct statvfs*);
extern int statvfs(const char*, struct statvfs*);
#endif
}end
str st_fstype sys/types.h sys/stat.h com{
int f(st){struct stat* st;return st->st_fstype[0];}
}end
int st_fstype sys/types.h sys/stat.h com{
int f(st){struct stat* st;return st->st_fstype = 1;}
}end
int st_spare1 sys/types.h sys/stat.h com{
int f(st){struct stat* st;return st->st_spare1 = 1;}
}end
ary st_spare4 sys/types.h sys/stat.h com{
int f(st){struct stat* st;return st->st_spare4[0] = 1;}
}end
ary st_pad4 sys/types.h sys/stat.h com{
int f(st){struct stat* st;return st->st_pad4[0] = 1;}
}end

View File

@@ -0,0 +1,46 @@
tst std_stddef comp{
#include <sys/types.h>
#include <stddef.h>
ptrdiff_t i;
size_t j;
wchar_t k;
}end
tst std_stdlib comp{
#include <sys/types.h>
#include <stddef.h>
#include <stdlib.h>
div_t i;
ldiv_t j;
}end
tst std_def_calloc comp{
#include <sys/types.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef calloc
(
#endif
}end
tst std_def_free comp{
#include <sys/types.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef free
(
#endif
}end
tst std_def_malloc comp{
#include <sys/types.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef malloc
(
#endif
}end
tst std_def_realloc comp{
#include <sys/types.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef realloc
(
#endif
}end

View File

@@ -0,0 +1,136 @@
/* $XConsortium: int.c /main/3 1995/11/01 17:26:00 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 9
#include "FEATURE/types"
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
extern __MANGLE__ int printf __PROTO__((const char*, ...));
static char i_char = 1;
static short i_short = 1;
static int i_int = 1;
static long i_long = 1;
#if _typ_long_long
static long long i_long_long = 1;
#endif
static struct
{
char* name;
int size;
char* swap;
} type[] =
{
"char", sizeof(char), (char*)&i_char,
"short", sizeof(short), (char*)&i_short,
"int", sizeof(int), (char*)&i_int,
"long", sizeof(long), (char*)&i_long,
#if _typ_long_long
"long long", sizeof(long long), (char*)&i_long_long,
#endif
};
static int size[] = { 1, 2, 4, 8 };
main()
{
register int t;
register int s;
register int m = 1;
for (s = 0; s < elementsof(size); s++)
{
for (t = 0; t < elementsof(type) && type[t].size < size[s]; t++);
if (t < elementsof(type))
{
m = size[s];
printf("#ifndef int_%d\n", m);
printf("#define int_%d %s\n", m, type[t].name);
printf("#endif\n");
}
}
printf("#ifndef int_max\n");
printf("#define int_max int_%d\n", m);
printf("#endif\n");
for (t = 0; t < elementsof(type) - 1 && *type[t + 1].swap; t++);
printf("#ifndef int_swap\n");
printf("#define int_swap %d\n", t ? type[t].size : 0);
printf("#endif\n");
return(0);
}

View File

@@ -0,0 +1,231 @@
cmd universe
hdr dirent,filio,jioctl,locale,mman,ndir,utime,vfork
dat _tzname,tzname
lib _cleanup,BSDsetpgrp,atexit,bcopy,bzero,dirread,dup2,fchmod
lib fcntl,fnmatch,fork,getdents,getdirentries,getdtablesize,getgroups
lib getpagesize,getrlimit,getuniverse,index,killpg,link,localeconv,lstat
lib mbtowc,memccpy
lib memchr,memcmp,memcpy,memdup,memmove,memset,mkdir,mkfifo,mknod,mktemp
lib mount,on_exit,onexit,opendir,pathconf,readlink,remove,rename,rindex
lib rmdir,rewinddir,setlocale,setpgid,setpgrp,setpgrp2,setreuid,setsid
lib setuid,sigaction,sigprocmask,sigsetmask,sigunblock,sigvec
lib socketpair,spawnve,strchr,strcoll,strdup,strerror,strrchr
lib strtod,strtol,strtoul,strxfrm
lib symlink,sysconf,telldir,tmpnam,tzset,universe,unlink,utime
lib vfork,wait2,wait3,wait4,waitpid
lib execve,pcreateve,NutForkExecve
mem direct.d_reclen sys/types.h sys/dir.h
mem dirent.d_fileno,dirent.d_ino,dirent.d_namlen,dirent.d_off,dirent.d_reclen sys/types.h dirent.h
mem DIR.dd_fd sys/types.h - dirent.h - sys/dir.h
sys dir,filio,jioctl,mman,ptem,resource,socket,stream,universe
sys vfork,wait
tst tst_errno link{
#ifdef __cplusplus
extern "C" {
#endif
extern int errno;
error() { }
strerror() { }
#ifdef __cplusplus
}
#endif
main() { errno = 0; error(); strerror(); }
}end
tst lib_poll_fd_1 exec{
#include <poll.h>
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#if defined(__cplusplus)
extern "C" {
#endif
extern int pipe(int*);
#if defined(__cplusplus)
}
#endif
#endif
main()
{ int rw[2];
struct pollfd fd;
if (pipe(rw) < 0) return 1;
fd.fd = rw[0];
fd.events = POLLIN;
fd.revents = 0;
return poll(&fd, 1, 0) < 0;
}
}end
tst lib_poll_fd_2 exec{
#include <poll.h>
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#if defined(__cplusplus)
extern "C" {
#endif
extern int pipe(int*);
#if defined(__cplusplus)
}
#endif
#endif
main()
{ int rw[2];
struct pollfd fd;
if (pipe(rw) < 0) return 1;
fd.fd = rw[0];
fd.events = POLLIN;
fd.revents = 0;
return poll(1, &fd, 0) < 0;
}
}end
cat{
#if _lib_poll_fd_1 || _lib_poll_fd_2
#define _lib_poll 1
#endif
#if _lib_NutForkExecve
#define _map_spawnve NutForkExecve
#else
#if _lib_pcreateve
#define _map_spawnve pcreateve
#endif
#endif
}end
tst lib_select link{
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
main()
{ struct timeval tmb;
fd_set rd;
FD_ZERO(&rd);
FD_SET(0,&rd);
tmb.tv_sec = 0;
tmb.tv_usec = 0;
select(1,&rd,(fd_set*)0,(fd_set*)0,&tmb);
return 0;
}
}end
tst pipe_rw exec{
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#if defined(__cplusplus)
extern "C" {
#endif
extern int pipe(int*);
extern int read(int, void*, int);
extern int strcmp(const char*, const char*);
extern int write(int, void*, int);
#if defined(__cplusplus)
}
#endif
#endif
main()
{
static char test[] = "test\n";
int io[2];
char buf[sizeof(test)];
if (pipe(io)) return(1);
if (write(io[1], test, sizeof(test)) != sizeof(test)) return(1);
if (read(io[0], buf, sizeof(test)) != sizeof(test)) return(1);
if (strcmp(test, buf)) return(1);
if (write(io[0], test, sizeof(test)) != sizeof(test)) return(1);
if (read(io[1], buf, sizeof(test)) != sizeof(test)) return(1);
if (strcmp(test, buf)) return(1);
return(0);
}
}end
tst real_vfork exec{
int code;
extern int vfork();
main()
{
code = 1;
if (!vfork()) code = 0;
return code;
}
}end
tst stream_peek link{
#include <sys/types.h>
#include <stropts.h>
main()
{ struct strpeek pbuf;
pbuf.flags = 0;
pbuf.ctlbuf.maxlen = pbuf.databuf.maxlen =
pbuf.ctlbuf.len = pbuf.databuf.len = 0;
pbuf.ctlbuf.buf = pbuf.databuf.buf = 0;
ioctl(0,I_PEEK,&pbuf);
return 0;
}
}end
tst socket_peek link{
#include <sys/types.h>
#include <sys/socket.h>
main()
{ char buf[128];
recv(0,buf,sizeof(buf),MSG_PEEK);
return 0;
}
}end
tst lib_mmap sys/types.h fcntl.h mman.h sys/mman.h exec{
main(argc, argv)
int argc;
char** argv;
{
int fd;
caddr_t p;
return((fd = open(argv[0], 0)) < 0 || !(p = (caddr_t)mmap((caddr_t)0, 1024, PROT_READ, MAP_SHARED, fd, 0L)) || p == ((caddr_t)-1));
}
}end
tst ptr_dd_buf sys/types.h - dirent.h - ndir.h - sys/dir.h comp{
main()
{
DIR* dirp;
dirp->dd_buf = 0;
}
}end
tst run{
u=att
case `/bin/cat -s /dev/null/foo 2>&1` in
'') ;;
*) case `/bin/echo '\\\\t'` in
'\\t') u=ucb ;;
esac
;;
esac
echo "#define _UNIV_DEFAULT \\"$u\\""
}end
std malloc exec{
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#if __cplusplus
extern "C" {
#endif
extern char* strdup(const char*);
char* malloc(unsigned n) { return 0; }
#if __cplusplus
}
#endif
#else
extern char* strdup();
char* malloc(n) unsigned n; { return 0; }
#endif
main() { return strdup("yo") == 0; }
}end
std signal nolink{
#if __cplusplus
extern "C" {
#endif
extern int abort();
int signal() { return 0; }
#if __cplusplus
}
#endif
main() { signal(); abort(); return 0; }
}end

View File

@@ -0,0 +1,683 @@
/* $XConsortium: limits.c /main/3 1995/11/01 17:26:13 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 13
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide close creat dup fork remove spawnve unlink wait
#else
#define close ______close
#define creat ______creat
#define dup ______dup
#define fork ______fork
#define remove ______remove
#define spawnve ______spawnve
#define unlink ______unlink
#define wait ______wait
#endif
#include "FEATURE/lcl.limits"
#include "FEATURE/lib"
#include "FEATURE/param"
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide close creat dup fork remove spawnve unlink wait
#else
#undef close
#undef creat
#undef dup
#undef fork
#undef remove
#undef spawnve
#undef unlink
#undef wait
#endif
#if !_lib_remove || _lib_unlink
#define remove unlink
#endif
#ifdef _map_spawnve
#define spawnve _map_spawnve
#endif
extern __MANGLE__ int close __PROTO__((int));
extern __MANGLE__ int creat __PROTO__((const char*, int));
extern __MANGLE__ int dup __PROTO__((int));
extern __MANGLE__ int fork __PROTO__((void));
extern __MANGLE__ int printf __PROTO__((const char*, ...));
extern __MANGLE__ int remove __PROTO__((const char*));
extern __MANGLE__ int spawnve __PROTO__((const char*, char* const[], char* const[]));
extern __MANGLE__ int wait __PROTO__((int*));
#if _lib_fork
#define child() fork()
#else
static char* cmd[] = { "/bin/echo", 0 };
#define child() spawnve(cmd[0],cmd,(char**)0)
#endif
main()
{
register int i;
register int n;
char c;
unsigned char uc;
unsigned short us;
unsigned int ui;
unsigned long ul;
unsigned long val;
int child_max;
char name[256];
/*
* <limits.h> with *constant* valued macros
*/
#ifdef CHILD_MAX
child_max = CHILD_MAX;
#else
for (i = 3; i < 512 && (n = child()) >= 0; i++)
if (!n) return(0);
while (wait((int*)0) > 0);
for (n = 8; n < i; n <<= 1);
child_max = n;
#endif
printf("\n");
#ifdef CHAR_BIT
val = CHAR_BIT;
printf("#undef CHAR_BIT\n");
#else
uc = 0;
uc = ~uc;
val = 1;
while (uc >>= 1) val++;
#endif
printf("#define CHAR_BIT %lu\n", val);
#ifdef MB_LEN_MAX
val = MB_LEN_MAX;
printf("#undef MB_LEN_MAX\n");
#else
val = 1;
#endif
printf("#define MB_LEN_MAX %lu\n", val);
c = 0;
c = ~c;
uc = 0;
uc = ~uc;
us = 0;
us = ~us;
ui = 0;
ui = ~ui;
ul = 0;
ul = ~ul;
#ifdef UCHAR_MAX
val = UCHAR_MAX;
printf("#undef UCHAR_MAX\n");
#else
val = uc;
#endif
printf("#if defined(__STDC__)\n");
printf("#define UCHAR_MAX %luU\n", val);
printf("#else\n");
printf("#define UCHAR_MAX %lu\n", val);
printf("#endif\n");
#ifndef __osf__
#ifdef SCHAR_MIN
val = -(SCHAR_MIN);
printf("#undef SCHAR_MIN\n");
#else
val = (unsigned char)(uc >> 1) + 1;
#endif
printf("#define SCHAR_MIN -%lu\n", val);
#endif
#ifdef SCHAR_MAX
val = SCHAR_MAX;
printf("#undef SCHAR_MAX\n");
#else
val = (unsigned char)(uc >> 1);
#endif
printf("#define SCHAR_MAX %lu\n", val);
#ifndef __osf__
if (c < 0)
{
#ifdef CHAR_MIN
printf("#undef CHAR_MIN\n");
#endif
printf("#define CHAR_MIN SCHAR_MIN\n");
#ifdef CHAR_MAX
printf("#undef CHAR_MAX\n");
#endif
printf("#define CHAR_MAX SCHAR_MAX\n");
}
else
{
#ifdef CHAR_MIN
printf("#undef CHAR_MIN\n");
#endif
printf("#define CHAR_MIN 0\n");
#ifdef CHAR_MAX
printf("#undef CHAR_MAX\n");
#endif
printf("#define CHAR_MAX UCHAR_MAX\n");
}
#endif /* __osf__ */
#ifdef USHRT_MAX
val = USHRT_MAX;
printf("#undef USHRT_MAX\n");
#else
val = us;
#endif
printf("#if defined(__STDC__)\n");
printf("#define USHRT_MAX %luU\n", val);
printf("#else\n");
printf("#define USHRT_MAX %lu\n", val);
printf("#endif\n");
#ifndef __osf__
#ifdef SHRT_MIN
val = -(SHRT_MIN);
printf("#undef SHRT_MIN\n");
#else
val = (unsigned short)(us >> 1) + 1;
#endif
printf("#define SHRT_MIN -%lu\n", val);
#endif
#ifdef SHRT_MAX
val = SHRT_MAX;
printf("#undef SHRT_MAX\n");
#else
val = (unsigned short)(us >> 1);
#endif
printf("#define SHRT_MAX %lu\n", val);
if (ui == us)
{
#ifdef UINT_MAX
printf("#undef UINT_MAX\n");
#endif
printf("#define UINT_MAX USHRT_MAX\n");
#ifndef __osf__
#ifdef INT_MIN
printf("#undef INT_MIN\n");
#endif
printf("#define INT_MIN SHRT_MIN\n");
#endif
#ifdef INT_MAX
printf("#undef INT_MAX\n");
#endif
printf("#define INT_MAX SHRT_MAX\n");
}
else
{
#ifdef UINT_MAX
val = UINT_MAX;
printf("#undef UINT_MAX\n");
#else
val = ui;
#endif
printf("#if defined(__STDC__)\n");
printf("#define UINT_MAX %luU\n", val);
printf("#else\n");
printf("#define UINT_MAX %lu\n", val);
printf("#endif\n");
#ifndef __osf__
#ifdef INT_MIN
val = -(INT_MIN);
printf("#undef INT_MIN\n");
#else
val = (unsigned int)(ui >> 1) + 1;
#endif
if (ui == ul) printf("#define INT_MIN (-%lu-1)\n", val - 1);
else printf("#define INT_MIN -%lu\n", val);
#endif
#ifdef INT_MAX
val = INT_MAX;
printf("#undef INT_MAX\n");
#else
val = (unsigned int)(ui >> 1);
#endif
printf("#define INT_MAX %lu\n", val);
}
if (ul == ui)
{
#ifdef ULONG_MAX
printf("#undef ULONG_MAX\n");
#endif
printf("#define ULONG_MAX UINT_MAX\n");
#ifndef __osf__
#ifdef LONG_MIN
printf("#undef LONG_MIN\n");
#endif
printf("#define LONG_MIN INT_MIN\n");
#endif
#ifdef LONG_MAX
printf("#undef LONG_MAX\n");
#endif
printf("#define LONG_MAX INT_MAX\n");
}
else
{
#ifdef ULONG_MAX
val = ULONG_MAX;
printf("#undef ULONG_MAX\n");
#else
val = ui;
#endif
printf("#if defined(__STDC__)\n");
printf("#define ULONG_MAX %luU\n", val);
printf("#else\n");
printf("#define ULONG_MAX %lu\n", val);
printf("#endif\n");
#ifndef __osf__
#ifdef LONG_MIN
val = -(LONG_MIN);
printf("#undef LONG_MIN\n");
#else
val = (unsigned long)(ul >> 1) + 1;
#endif
printf("#define LONG_MIN (-%lu-1)\n", val - 1);
#endif
#ifdef LONG_MAX
val = LONG_MAX;
printf("#undef LONG_MAX\n");
#else
val = (unsigned long)(ul >> 1);
#endif
printf("#define LONG_MAX %lu\n", val);
}
/*
* POSIX values
*/
#ifndef _POSIX_ARG_MAX
#define _POSIX_ARG_MAX 4096
#endif
#ifndef _POSIX_CHILD_MAX
#define _POSIX_CHILD_MAX 6
#endif
#ifndef _POSIX_LINK_MAX
#define _POSIX_LINK_MAX 8
#endif
#ifndef _POSIX_MAX_CANON
#define _POSIX_MAX_CANON 255
#endif
#ifndef _POSIX_MAX_INPUT
#define _POSIX_MAX_INPUT 255
#endif
#ifndef _POSIX_NAME_MAX
#define _POSIX_NAME_MAX 14
#endif
#ifndef _POSIX_NGROUPS_MAX
#define _POSIX_NGROUPS_MAX 0
#endif
#ifndef _POSIX_OPEN_MAX
#define _POSIX_OPEN_MAX 16
#endif
#ifndef _POSIX_PATH_MAX
#define _POSIX_PATH_MAX 255
#endif
#ifndef _POSIX_PIPE_BUF
#define _POSIX_PIPE_BUF 512
#endif
#ifndef _POSIX_SSIZE_MAX
#define _POSIX_SSIZE_MAX 32767
#endif
#ifndef _POSIX_STREAM_MAX
#define _POSIX_STREAM_MAX 8
#endif
#ifndef _POSIX_TZNAME_MAX
#define _POSIX_TZNAME_MAX 3
#endif
printf("\n");
printf("/*\n");
printf(" * POSIX minima\n");
printf(" */\n");
printf("\n");
printf("#define _POSIX_ARG_MAX %d\n", _POSIX_ARG_MAX);
printf("#define _POSIX_CHILD_MAX %d\n", _POSIX_CHILD_MAX);
printf("#define _POSIX_LINK_MAX %d\n", _POSIX_LINK_MAX);
printf("#define _POSIX_MAX_CANON %d\n", _POSIX_MAX_CANON);
printf("#define _POSIX_MAX_INPUT %d\n", _POSIX_MAX_INPUT);
printf("#define _POSIX_NAME_MAX %d\n", _POSIX_NAME_MAX);
printf("#define _POSIX_NGROUPS_MAX %d\n", _POSIX_NGROUPS_MAX);
printf("#define _POSIX_OPEN_MAX %d\n", _POSIX_OPEN_MAX);
printf("#define _POSIX_PATH_MAX %d\n", _POSIX_PATH_MAX);
printf("#define _POSIX_PIPE_BUF %d\n", _POSIX_PIPE_BUF);
printf("#define _POSIX_SSIZE_MAX %d\n", _POSIX_SSIZE_MAX);
printf("#define _POSIX_STREAM_MAX %d\n", _POSIX_STREAM_MAX);
printf("#define _POSIX_TZNAME_MAX %d\n", _POSIX_TZNAME_MAX);
printf("\n");
printf("/*\n");
printf(" * system implementation limits\n");
printf(" */\n");
printf("\n");
#ifdef ARG_MAX
val = ARG_MAX;
printf("#undef ARG_MAX\n");
#else
#ifdef NCARGS
val = NCARGS;
#else
val = _POSIX_ARG_MAX;
#endif
#endif
if (val == _POSIX_ARG_MAX) printf("#define ARG_MAX _POSIX_ARG_MAX\n");
else printf("#define ARG_MAX %lu\n", val);
val = child_max;
if (val == _POSIX_CHILD_MAX) printf("#define CHILD_MAX _POSIX_CHILD_MAX\n");
else printf("#define CHILD_MAX %lu\n", val);
#ifdef LINK_MAX
val = LINK_MAX;
printf("#undef LINK_MAX\n");
#else
#ifdef MAXLINK
val = MAXLINK;
#else
#ifdef SHRT_MAX
val = SHRT_MAX;
#else
val = (unsigned short)(us >> 1);
#endif
#endif
#endif
printf("#define LINK_MAX %lu\n", val);
#ifndef __osf__
#ifdef MAX_CANON
val = MAX_CANON;
printf("#undef MAX_CANON\n");
#else
#ifdef CANBSIZ
val = CANBSIZ;
#else
val = _POSIX_MAX_CANON;
#endif
#endif
if (val == _POSIX_MAX_CANON) printf("#define MAX_CANON _POSIX_MAX_CANON\n");
else printf("#define MAX_CANON %lu\n", val);
#endif
#ifndef __osf__
#ifdef MAX_INPUT
val = MAX_INPUT;
printf("#undef MAX_INPUT\n");
if (val == _POSIX_MAX_INPUT) printf("#define MAX_INPUT _POSIX_MAX_INPUT\n");
else printf("#define MAX_INPUT %lu\n", val);
#else
printf("#define MAX_INPUT MAX_CANON\n");
#endif
#endif
#ifdef NAME_MAX
val = NAME_MAX;
printf("#undef NAME_MAX\n");
#else
#ifdef MAXNAMLEN
val = MAXNAMLEN;
#else
for (i = 0; i < sizeof(name); i++)
name[i] = 'F';
name[7] = '.';
name[sizeof(name) - 1] = 0;
if ((n = creat(name, 0)) >= 0)
{
close(n);
for (val = 12; val < sizeof(name); val++)
{
name[val] = 0;
if (remove(name) >= 0) break;
name[val] = 'F';
}
}
else for (val = 12; val < sizeof(name); val++)
{
name[val] = 0;
if ((n = creat(name, 0)) >= 0)
{
close(n);
remove(name);
name[val] = 'F';
}
else
{
val--;
break;
}
}
#endif
#endif
printf("#define NAME_MAX %lu\n", val);
#ifdef NGROUPS_MAX
val = NGROUPS_MAX;
printf("#undef NGROUPS_MAX\n");
#else
#ifdef NGROUPS
val = NGROUPS;
#else
val = _POSIX_NGROUPS_MAX;
#endif
#endif
if (val == _POSIX_NGROUPS_MAX) printf("#define NGROUPS_MAX _POSIX_NGROUPS_MAX\n");
else printf("#define NGROUPS_MAX %lu\n", val);
#ifdef PATH_MAX
val = PATH_MAX;
printf("#undef PATH_MAX\n");
#else
#ifdef MAXPATHLEN
val = MAXPATHLEN;
#else
val = 1024;
#endif
#endif
printf("#define PATH_MAX %lu\n", val);
#ifdef OPEN_MAX
val = OPEN_MAX;
printf("#undef OPEN_MAX\n");
#else
val = 2;
while ((i = dup(0)) >= 0)
if (i > val) val = i;
#endif
printf("#define OPEN_MAX %lu\n", val);
#ifdef OPEN_MAX_CEIL
val = OPEN_MAX_CEIL;
printf("#undef OPEN_MAX_CEIL\n");
printf("#define OPEN_MAX_CEIL %lu\n", val);
#else
printf("#define OPEN_MAX_CEIL OPEN_MAX\n");
#endif
#ifdef STREAM_MAX
val = STREAM_MAX;
printf("#undef STREAM_MAX\n");
printf("#define STREAM_MAX %lu\n", val);
#else
printf("#define STREAM_MAX OPEN_MAX\n");
#endif
#ifdef TZNAME_MAX
val = TZNAME_MAX;
printf("#undef TZNAME_MAX\n");
#else
val = _POSIX_TZNAME_MAX;
#endif
if (val == _POSIX_TZNAME_MAX) printf("#define TZNAME_MAX _POSIX_TZNAME_MAX\n");
else printf("#define TZNAME_MAX %lu\n", val);
#ifndef __osf__
#ifdef SSIZE_MAX
val = SSIZE_MAX;
printf("#undef SSIZE_MAX\n");
#else
val = _POSIX_SSIZE_MAX;
#endif
if (val == _POSIX_SSIZE_MAX) printf("#define SSIZE_MAX _POSIX_SSIZE_MAX\n");
else printf("#define SSIZE_MAX %lu\n", val);
#endif
#ifdef CLK_TCK
val = CLK_TCK;
#else
#ifdef HZ
val = HZ;
#else
val = 60;
#endif
#endif
printf("#define _AST_CLK_TCK %lu\n", val);
printf("\n");
/*
* pollution control
*/
printf("/*\n");
printf(" * pollution control\n");
printf(" */\n");
printf("\n");
printf("#if defined(__STDPP__directive) && defined(__STDPP__ignore)\n");
printf("__STDPP__directive pragma pp:ignore \"limits.h\"\n");
printf("#else\n");
#ifdef _limits_h
printf("#define _limits_h\n");
#endif
#ifdef __limits_h
printf("#define __limits_h\n");
#endif
#ifdef _sys_limits_h
printf("#define _sys_limits_h\n");
#endif
#ifdef __sys_limits_h
printf("#define __sys_limits_h\n");
#endif
#ifdef __LIMITS_H
printf("#define __LIMITS_H\n");
#endif
#ifdef __LIMITS_INCLUDED
printf("#define __LIMITS_INCLUDED\n");
#endif
#ifdef __SYS_LIMITS_H
printf("#define __SYS_LIMITS_H\n");
#endif
#ifdef __SYS_LIMITS_INCLUDED
printf("#define __SYS_LIMITS_INCLUDED\n");
#endif
#ifdef _H_LIMITS
printf("#define _H_LIMITS\n");
#endif
#ifdef __H_LIMITS
printf("#define __H_LIMITS\n");
#endif
#ifdef _H_SYS_LIMITS
printf("#define _H_SYS_LIMITS\n");
#endif
#ifdef __H_SYS_LIMITS
printf("#define __H_SYS_LIMITS\n");
#endif
printf("#endif\n");
printf("\n");
return(0);
}

View File

@@ -0,0 +1,267 @@
/* $XConsortium: mode.c /main/3 1995/11/01 17:26:29 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 9
#include "FEATURE/lcl.limits"
#include "FEATURE/param"
#include <modecanon.h>
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
int n;
int idperm;
int idtype;
idperm = idtype = 1;
#ifndef S_ITYPE
#ifdef S_IFMT
printf("#define S_ITYPE(m) ((m)&S_IFMT)\n");
#else
printf("#define S_ITYPE(m) ((m)&~S_IPERM)\n");
#endif
#endif
#ifdef S_ISBLK
if (!S_ISBLK(X_IFBLK)) idtype = 0;
#else
#ifdef S_IFBLK
printf("#define S_ISBLK(m) (S_ITYPE(m)==S_IFBLK)\n");
#else
printf("#define S_ISBLK(m) 0\n");
#endif
#endif
#ifdef S_ISCHR
if (!S_ISCHR(X_IFCHR)) idtype = 0;
#else
#ifdef S_IFCHR
printf("#define S_ISCHR(m) (S_ITYPE(m)==S_IFCHR)\n");
#else
printf("#define S_ISCHR(m) 0\n");
#endif
#endif
#ifdef S_ISCTG
if (!S_ISCTG(X_IFCTG)) idtype = 0;
#else
#ifdef S_IFCTG
printf("#define S_ISCTG(m) (S_ITYPE(m)==S_IFCTG)\n");
#endif
#endif
#ifdef S_ISDIR
if (!S_ISDIR(X_IFDIR)) idtype = 0;
#else
#ifdef S_IFDIR
printf("#define S_ISDIR(m) (S_ITYPE(m)==S_IFDIR)\n");
#else
printf("#define S_ISDIR(m) 0\n");
#endif
#endif
#ifdef S_ISFIFO
if (!S_ISFIFO(X_IFIFO)) idtype = 0;
#else
#ifdef S_IFIFO
printf("#define S_ISFIFO(m) (S_ITYPE(m)==S_IFIFO)\n");
#else
printf("#define S_ISFIFO(m) 0\n");
#endif
#endif
#ifdef S_ISLNK
if (!S_ISLNK(X_IFLNK)) idtype = 0;
#else
#ifdef S_IFLNK
printf("#define S_ISLNK(m) (S_ITYPE(m)==S_IFLNK)\n");
#else
printf("#define S_ISLNK(m) 0\n");
#endif
#endif
#ifdef S_ISREG
if (!S_ISREG(X_IFREG)) idtype = 0;
#else
#ifdef S_IFREG
printf("#define S_ISREG(m) (S_ITYPE(m)==S_IFREG)\n");
#else
printf("#define S_ISREG(m) 0\n");
#endif
#endif
#ifdef S_ISSOCK
if (!S_ISSOCK(X_IFSOCK)) idtype = 0;
#else
#ifdef S_IFSOCK
printf("#define S_ISSOCK(m) (S_ITYPE(m)==S_IFSOCK)\n");
#endif
#endif
printf("\n");
#ifndef S_IPERM
printf("#define S_IPERM (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)\n");
#endif
#ifndef S_ISUID
printf("#define S_ISUID 0%04o\n", X_ISUID);
#else
if (S_ISUID != X_ISUID) idperm = 0;
#endif
#ifndef S_ISGID
printf("#define S_ISGID 0%04o\n", X_ISGID);
#else
if (S_ISGID != X_ISGID) idperm = 0;
#endif
#ifndef S_ISVTX
printf("#define S_ISVTX 0%04o\n", X_ISVTX);
#else
if (S_ISVTX != X_ISVTX) idperm = 0;
#endif
#ifndef S_IRUSR
printf("#define S_IRUSR 0%04o\n", X_IRUSR);
#else
if (S_IRUSR != X_IRUSR) idperm = 0;
#endif
#ifndef S_IWUSR
printf("#define S_IWUSR 0%04o\n", X_IWUSR);
#else
if (S_IWUSR != X_IWUSR) idperm = 0;
#endif
#ifndef S_IXUSR
printf("#define S_IXUSR 0%04o\n", X_IXUSR);
#else
if (S_IXUSR != X_IXUSR) idperm = 0;
#endif
#ifndef S_IRGRP
printf("#define S_IRGRP 0%04o\n", X_IRGRP);
#else
if (S_IRGRP != X_IRGRP) idperm = 0;
#endif
#ifndef S_IWGRP
printf("#define S_IWGRP 0%04o\n", X_IWGRP);
#else
if (S_IWGRP != X_IWGRP) idperm = 0;
#endif
#ifndef S_IXGRP
printf("#define S_IXGRP 0%04o\n", X_IXGRP);
#else
if (S_IXGRP != X_IXGRP) idperm = 0;
#endif
#ifndef S_IROTH
printf("#define S_IROTH 0%04o\n", X_IROTH);
#else
if (S_IROTH != X_IROTH) idperm = 0;
#endif
#ifndef S_IWOTH
printf("#define S_IWOTH 0%04o\n", X_IWOTH);
#else
if (S_IWOTH != X_IWOTH) idperm = 0;
#endif
#ifndef S_IXOTH
printf("#define S_IXOTH 0%04o\n", X_IXOTH);
#else
if (S_IXOTH != X_IXOTH) idperm = 0;
#endif
#ifndef S_IRWXU
printf("#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)\n");
#endif
#ifndef S_IRWXG
printf("#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)\n");
#endif
#ifndef S_IRWXO
printf("#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)\n");
#endif
printf("\n");
if (idperm) printf("#define _S_IDPERM 1\n");
if (idtype) printf("#define _S_IDTYPE 1\n");
printf("\n");
#ifdef BUFFERSIZE
n = BUFFERSIZE;
#else
#ifdef MAXBSIZE
n = MAXBSIZE;
#else
#ifdef SBUFSIZE
n = SBUFSIZE;
#else
#ifdef BUFSIZ
n = BUFSIZ;
#else
if (sizeof(char*) > 4) n = 8192;
else if (sizeof(char*) < 4) n = 512;
else n = 4096;
#endif
#endif
#endif
#endif
printf("#define BUFFERSIZE %u\n", n);
printf("\n");
return(0);
}

View File

@@ -0,0 +1,23 @@
# $XConsortium: param.sh /main/2 1995/07/19 17:13:27 drk $
: generate "<sys/param.h> + <sys/types.h> + <sys/stat.h>" include sequence
eval $1
shift
for i in "#include <sys/param.h>" "#include <sys/param.h>
#ifndef S_IFDIR
#include <sys/stat.h>
#endif" "#include <sys/param.h>
#ifndef S_IFDIR
#include <sys/types.h>
#include <sys/stat.h>
#endif" "#ifndef S_IFDIR
#include <sys/types.h>
#include <sys/stat.h>
#endif"
do echo "$i
struct stat V_stat_V;
F_stat_F() { V_stat_V.st_mode = 0; }" > $tmp.c
if $cc -c $tmp.c >/dev/null
then echo "$i"
break
fi
done

View File

@@ -0,0 +1,22 @@
# $XConsortium: preroot.sh /main/2 1995/07/19 17:13:34 drk $
: generate preroot features
eval $1
shift
if /etc/preroot / /bin/echo >/dev/null
then cat <<!
#pragma prototyped
#define FS_PREROOT 1 /* preroot enabled */
#define PR_BASE "CCS" /* preroot base env var */
#define PR_COMMAND "/etc/preroot" /* the preroot command */
#define PR_REAL "/dev/.." /* real root pathname */
#define PR_SILENT "CCSQUIET" /* no command trace */
extern char* getpreroot(char*, const char*);
extern int ispreroot(const char*);
extern int realopen(const char*, int, int);
extern void setpreroot(char**, const char*);
!
else echo "/* preroot not enabled */"
fi

View File

@@ -0,0 +1,38 @@
sys filio,ioctl
# see if register layout is ok for vax string operations
vax asm exec{
main()
{
#ifndef vax
return absurd = -1;
#else
register int r11, r10, r9, r8, r7, r6;
r11 = r10 = r9 = r8 = r7 = r6 = -1;
asm("clrw r11");
asm("clrw r10");
asm("clrw r9");
asm("clrw r8");
asm("clrw r7");
asm("clrw r6");
if(sizeof(int) != sizeof(char*) || r11 || r10 || r9 || r8 || r7 || r6 )
return -1;
return 0;
#endif
}
}end
# 386 native floating point conversions are better than what we can do in C
i386 cvt link{
main()
{
#ifndef i386
return absurd = -1;
#else
ecvt();
fcvt();
strtod();
return 0;
#endif
}
}end

View File

@@ -0,0 +1,60 @@
# $XConsortium: sig.sh /main/2 1995/07/19 17:13:42 drk $
: generate sig features
: include FEATURE/signal
eval $1
shift
echo "int xxx;" > $tmp.c
$cc -c $tmp.c >/dev/null 2>$tmp.e
echo "#pragma prototyped
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide kill killpg
#else
#define kill ______kill
#define killpg ______killpg
#endif
#include <signal.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide kill killpg
#else
#undef kill
#undef killpg
#endif
#ifndef sigmask
#define sigmask(s) (1<<((s)-1))
#endif"
echo "#include <signal.h>
#ifdef TYPE
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
typedef TYPE (*Handler_t)(int);
#else
typedef TYPE (*Handler_t)();
#endif
#endif
Handler_t f()
{
Handler_t handler;
handler = signal(1, SIG_IGN);
return(handler);
}" > $tmp.c
if $cc -c $tmp.c >/dev/null
then :
else e=`wc -l $tmp.e`
for i in void int
do $cc -c -DTYPE=$i $tmp.c >/dev/null 2>$tmp.e || continue
case `wc -l $tmp.e` in
$e) break ;;
esac
done
echo "typedef $i (*Handler_t)(int);"
fi
case $# in
0) ;;
*) cat $* | grep '^#define [^_]' ;;
esac
echo '
extern char* sig_name[];
extern char* sig_text[];
extern int kill(pid_t, int);
extern int killpg(pid_t, int);
extern int sigunblock(int);'

View File

@@ -0,0 +1,271 @@
/* $XConsortium: signal.c /main/3 1995/11/01 17:26:43 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 9
#include <signal.h>
struct _m_
{
char* text;
char* name;
int value;
};
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
static struct _m_ map[] =
{
#ifdef SIGABRT
"Abort", "ABRT", SIGABRT,
#endif
#ifdef SIGALRM
"Alarm call", "ALRM", SIGALRM,
#endif
#ifdef SIGAPOLLO
"Apollo", "APOLLO", SIGAPOLLO,
#endif
#ifdef SIGBUS
"Bus error", "BUS", SIGBUS,
#endif
#ifdef SIGCHLD
"Child status change", "CHLD", SIGCHLD,
#endif
#ifdef SIGCLD
"Death of child", "CLD", SIGCLD,
#endif
#ifdef SIGCONT
"Stopped process continued", "CONT", SIGCONT,
#endif
#ifdef SIGDEBUG
"Debug trap", "DEBUG", SIGDEBUG,
#endif
#ifdef SIGEMT
"EMT trap", "EMT", SIGEMT,
#endif
#ifdef SIGERR
"ERR trap", "ERR", SIGERR,
#endif
#ifdef SIGEXIT
"Exit", "EXIT", SIGEXIT,
#endif
#ifdef SIGFPE
"Floating exception", "FPE", SIGFPE,
#endif
#ifdef SIGHUP
"Hangup", "HUP", SIGHUP,
#endif
#ifdef SIGILL
"Illegal instruction", "ILL", SIGILL,
#endif
#ifdef SIGINT
"Interrupt", "INT", SIGINT,
#endif
#ifdef SIGIO
"IO possible", "IO", SIGIO,
#endif
#ifdef SIGIOT
"IOT trap", "IOT", SIGIOT,
#endif
#ifdef SIGKILL
"Killed", "KILL", SIGKILL,
#endif
#ifdef SIGLAB
"LAB trap", "LAB", SIGLAB,
#endif
#ifdef SIGKILL
"Killed", "KILL", SIGKILL,
#endif
#ifdef SIGLOST
"Resources lost", "LOST", SIGLOST,
#endif
#ifdef SIGPHONE
"Phone status change", "PHONE", SIGPHONE,
#endif
#ifdef SIGPIPE
"Broken Pipe", "PIPE", SIGPIPE,
#endif
#ifdef SIGPOLL
"Poll event", "POLL", SIGPOLL,
#endif
#ifdef SIGPROF
"Profiling time alarm", "PROF", SIGPROF,
#endif
#ifdef SIGPWR
"Power fail", "PWR", SIGPWR,
#endif
#ifdef SIGQUIT
"Quit", "QUIT", SIGQUIT,
#endif
#ifdef SIGSEGV
"Memory fault", "SEGV", SIGSEGV,
#endif
#ifdef SIGSSTOP
"Sendable stop", "SSTOP", SIGSSTOP,
#endif
#ifdef gould
"Stack overflow", "STKOV", 28,
#endif
#ifdef SIGSTOP
"Stopped (signal)", "STOP", SIGSTOP,
#endif
#ifdef SIGSYS
"Bad system call", "SYS", SIGSYS,
#endif
#ifdef SIGTERM
"Terminated", "TERM", SIGTERM,
#endif
#ifdef SIGTINT
"Interrupt (terminal)", "TINT", SIGTINT,
#endif
#ifdef SIGTRAP
"Trace/BPT trap", "TRAP", SIGTRAP,
#endif
#ifdef SIGTSTP
"Stopped", "TSTP", SIGTSTP,
#endif
#ifdef SIGTTIN
"Stopped (tty input)", "TTIN", SIGTTIN,
#endif
#ifdef SIGTTOU
"Stopped (tty output)", "TTOU", SIGTTOU,
#endif
#ifdef SIGURG
"Urgent IO", "URG", SIGURG,
#endif
#ifdef SIGUSR1
"User signal 1", "USR1", SIGUSR1,
#endif
#ifdef SIGUSR2
"User signal 2", "USR2", SIGUSR2,
#endif
#ifdef SIGVTALRM
"Virtual time alarm", "VTALRM", SIGVTALRM,
#endif
#ifdef SIGWINCH
"Window change", "WINCH", SIGWINCH,
#endif
#ifdef SIGWIND
"Window change", "WIND", SIGWIND,
#endif
#ifdef SIGWINDOW
"Window change", "WINDOW", SIGWINDOW,
#endif
#ifdef SIGXCPU
"CPU time limit", "XCPU", SIGXCPU,
#endif
#ifdef SIGXFSZ
"File size limit", "XFSZ", SIGXFSZ,
#endif
0
};
static int index[64];
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
register int i;
register int j;
register int k;
k = 0;
for (i = 0; map[i].name; i++)
if ((j = map[i].value) > 0 && j < elementsof(index))
{
if (j > k) k = j;
index[j] = i;
}
printf("#define SIG_MAX %d\n", k);
printf("\n");
printf("char* sig_name[] =\n");
printf("{\n");
for (i = 0; i <= k; i++)
if (j = index[i]) printf(" \"%s\",\n", map[j].name);
else printf(" \"%d\",\n", i);
printf(" 0\n");
printf("};\n");
printf("\n");
printf("char* sig_text[] =\n");
printf("{\n");
for (i = 0; i <= k; i++)
if (j = index[i]) printf(" \"%s\",\n", map[j].text);
else printf(" \"Signal %d\",\n", i);
printf(" 0\n");
printf("};\n");
return(0);
}

View File

@@ -0,0 +1,39 @@
set prototyped
hdr,sys time,times
mem tm.tm_sec,timeval.tv_sec sys/time.h
typ clock_t,time_t
cat{
#if !_typ_clock_t
#define _typ_clock_t 1
typedef unsigned long clock_t;
#endif
#if !_typ_time_t
#define _typ_time_t 1
typedef unsigned long time_t;
#endif
#if _sys_time
#include <sys/time.h>
#endif
#if _hdr_time && !_mem_tm_sec_tm
#include <time.h>
#endif
#if _sys_times
#include <sys/times.h>
#else
struct tms
{
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
};
extern clock_t times(struct tms*);
#endif
#if !_mem_tv_sec_timeval
struct timeval
{
time_t tv_sec;
time_t tv_usec;
};
#endif
}end

View File

@@ -0,0 +1,17 @@
set prototyped
cat{
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide ioctl
#else
#define ioctl ______ioctl
#endif
}end
one termio.h termios.h sys/termios.h sgtty.h sys/ttyio.h sys/ioctl.h
cat{
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide ioctl
#else
#undef ioctl
#endif
extern int ioctl(int, int, ...);
}end

View File

@@ -0,0 +1,49 @@
typ dev_t,nlink_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef short $v;"
echo "#endif"
}end
typ gid_t,mode_t,uid_t,wchar_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef unsigned short $v;"
echo "#endif"
}end
typ pid_t,ssize_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef int $v;"
echo "#endif"
}end
typ size_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef unsigned int $v;"
echo "#endif"
}end
typ clock_t,ino_t,off_t,ptrdiff_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef long $v;"
echo "#endif"
}end
typ time_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef unsigned long $v;"
echo "#endif"
}end
typ div_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef struct { int quot; int rem; } $v;"
echo "#endif"
}end
typ ldiv_t fail{
echo "#ifndef _typ_$v"
echo "#define _typ_$v 1"
echo "typedef struct { long quot; long rem; } $v;"
echo "#endif"
}end
typ long.double,long.long

View File

@@ -0,0 +1,305 @@
/* $XConsortium: unistd.c /main/3 1995/11/01 17:26:56 rswiston $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
* AT&T BELL LABORATORIES *
* AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
* ACCORDANCE WITH APPLICABLE AGREEMENTS *
* *
* Copyright (c) 1994 AT&T Bell Laboratories *
* Unpublished & Not for Publication *
* All Rights Reserved *
* *
* The copyright notice above does not evidence any *
* actual or intended publication of such source code *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* advsoft@research.att.com *
* Randy Hackbarth 908-582-5245 *
* Dave Belanger 908-582-7427 *
* *
***************************************************************/
/* : : generated by proto : : */
#line 1
/*
* Glenn Fowler
* AT&T Bell Laboratories
*
* generate unistd.h definitions for posix sysconf() args
*/
#ifndef _POSIX_SOURCE
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#line 9
#define _POSIX_SOURCE
#endif
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:hide printf
#else
#define printf ______printf
#endif
#include <sys/types.h>
#include "FEATURE/types"
#include "FEATURE/lcl.unistd"
#include <ast_lib.h>
#if defined(__STDPP__directive) && defined(__STDPP__hide)
__STDPP__directive pragma pp:nohide printf
#endif
#if defined(__STDPP__hide) || defined(printf)
#undef printf
extern __MANGLE__ int printf __PROTO__((const char*, ...));
#endif
main()
{
int sep = 0;
long val;
/*
* some systems (could it beee aix) think empty definitions
* constitute symbolic constants
*/
#ifdef _POSIX_VERSION
{
static long x[] = { 0, _POSIX_VERSION };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
printf("#undef _POSIX_VERSION\n");
val = 199009L;
}
else val = x[1];
}
#else
val = 199009L;
#endif
printf("#define _POSIX_VERSION %ldL\n", val);
#ifndef _POSIX_JOB_CONTROL
#ifdef WUNTRACED
#define _POSIX_JOB_CONTROL 1
#endif
#endif
#ifdef _POSIX_JOB_CONTROL
{
static long x[] = { 0, _POSIX_JOB_CONTROL };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
printf("#undef _POSIX_JOB_CONTROL\n");
val = 1;
}
else val = x[1];
}
printf("#define _POSIX_JOB_CONTROL %ld\n", val);
#endif
#ifndef _POSIX_SAVED_IDS
#if _lib_setuid && !_lib_setreuid
#define _POSIX_SAVED_IDS 1
#endif
#endif
#ifdef _POSIX_SAVED_IDS
{
static long x[] = { 0, _POSIX_SAVED_IDS };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
printf("#undef _POSIX_SAVED_IDS\n");
val = 1;
}
else val = x[1];
}
printf("#define _POSIX_SAVED_IDS %ld\n", val);
#endif
printf("\n");
#ifdef _POSIX_CHOWN_RESTRICTED
{
static long x[] = { 0, _POSIX_CHOWN_RESTRICTED };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
printf("#undef _POSIX_CHOWN_RESTRICTED\n");
val = 1;
}
else val = x[1];
}
printf("#define _POSIX_CHOWN_RESTRICTED %ld\n", val);
sep = 1;
#endif
#ifdef _POSIX_NO_TRUNC
{
static long x[] = { 0, _POSIX_NO_TRUNC };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
printf("#undef _POSIX_NO_TRUNC\n");
val = 1;
}
else val = x[1];
}
printf("#define _POSIX_NO_TRUNC %ld\n", val);
sep = 1;
#endif
#ifdef _POSIX_VDISABLE
{
static long x[] = { 0, _POSIX_VDISABLE };
if ((sizeof(x)/sizeof(x[0])) == 1)
{
printf("#undef _POSIX_VDISABLE\n");
val = 1;
}
else val = x[1];
}
printf("#define _POSIX_VDISABLE %ld\n", val);
sep = 1;
#endif
if (sep)
{
sep = 0;
printf("\n");
}
#ifndef _SC_ARG_MAX
#define _SC_ARG_MAX (-1)
#endif
printf("#define _SC_ARG_MAX %ld\n", (long)_SC_ARG_MAX);
#ifndef _SC_CHILD_MAX
#define _SC_CHILD_MAX (-2)
#endif
printf("#define _SC_CHILD_MAX %ld\n", (long)_SC_CHILD_MAX);
#ifndef _SC_CLK_TCK
#define _SC_CLK_TCK (-3)
#endif
printf("#define _SC_CLK_TCK %ld\n", (long)_SC_CLK_TCK);
#ifndef _SC_NGROUPS_MAX
#define _SC_NGROUPS_MAX (-4)
#endif
printf("#define _SC_NGROUPS_MAX %ld\n", (long)_SC_NGROUPS_MAX);
#ifndef _SC_OPEN_MAX
#define _SC_OPEN_MAX (-5)
#endif
printf("#define _SC_OPEN_MAX %ld\n", (long)_SC_OPEN_MAX);
#ifndef _SC_JOB_CONTROL
#define _SC_JOB_CONTROL (-6)
#endif
printf("#define _SC_JOB_CONTROL %ld\n", (long)_SC_JOB_CONTROL);
#ifndef _SC_SAVED_IDS
#define _SC_SAVED_IDS (-7)
#endif
printf("#define _SC_SAVED_IDS %ld\n", (long)_SC_SAVED_IDS);
#ifndef _SC_TZNAME_MAX
#define _SC_TZNAME_MAX (-8)
#endif
printf("#define _SC_TZNAME_MAX %ld\n", (long)_SC_TZNAME_MAX);
#ifndef _SC_VERSION
#define _SC_VERSION (-9)
#endif
printf("#define _SC_VERSION %ld\n", (long)_SC_VERSION);
printf("\n");
#ifndef _PC_LINK_MAX
#define _PC_LINK_MAX (-1)
#endif
printf("#define _PC_LINK_MAX %ld\n", (long)_PC_LINK_MAX);
#ifndef _PC_MAX_CANON
#define _PC_MAX_CANON (-2)
#endif
printf("#define _PC_MAX_CANON %ld\n", (long)_PC_MAX_CANON);
#ifndef _PC_MAX_INPUT
#define _PC_MAX_INPUT (-3)
#endif
printf("#define _PC_MAX_INPUT %ld\n", (long)_PC_MAX_INPUT);
#ifndef _PC_NAME_MAX
#define _PC_NAME_MAX (-4)
#endif
printf("#define _PC_NAME_MAX %ld\n", (long)_PC_NAME_MAX);
#ifndef _PC_PATH_MAX
#define _PC_PATH_MAX (-5)
#endif
printf("#define _PC_PATH_MAX %ld\n", (long)_PC_PATH_MAX);
#ifndef _PC_PIPE_BUF
#define _PC_PIPE_BUF (-6)
#endif
printf("#define _PC_PIPE_BUF %ld\n", (long)_PC_PIPE_BUF);
#ifndef _PC_CHOWN_RESTRICTED
#define _PC_CHOWN_RESTRICTED (-7)
#endif
printf("#define _PC_CHOWN_RESTRICTED %ld\n", (long)_PC_CHOWN_RESTRICTED);
#ifndef _PC_NO_TRUNC
#define _PC_NO_TRUNC (-8)
#endif
printf("#define _PC_NO_TRUNC %ld\n", (long)_PC_NO_TRUNC);
#ifndef _PC_VDISABLE
#define _PC_VDISABLE (-9)
#endif
printf("#define _PC_VDISABLE %ld\n", (long)_PC_VDISABLE);
#ifndef _PC_LAST
#define _PC_LAST (-10)
#endif
printf("#define _PC_LAST %ld\n", (long)_PC_LAST);
return(0);
}

View File

@@ -0,0 +1,9 @@
lib wait,wait2,wait3,wait4,waitpid
tst ok_wif sys/types.h sys/wait.h comp{
int ifexited = WIFEXITED(0);
int exitstatus = WEXITSTATUS(0);
int ifsignaled = WIFSIGNALED(0);
int termsig = WTERMSIG(0);
int ifstopped = WIFSTOPPED(0);
int stopsig = WSTOPSIG(0);
}end

View File

@@ -0,0 +1,196 @@
/* $XConsortium: align.c /main/2 1996/05/08 19:41:16 drk $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
union _u_
{
long u1;
char* u2;
double u3;
char u4[1024];
};
struct _s_
{
char s1;
union _u_ s2;
};
#define roundof(x,y) (((x)+((y)-1))&~((y)-1))
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
register int i;
register int j;
register int k;
int align0;
int align1;
int align2;
unsigned long bit1;
unsigned long bit2;
unsigned long bits0;
unsigned long bits1;
unsigned long bits2;
union _u_ u;
union _u_ v;
u.u2 = u.u4;
v.u2 = u.u2 + 1;
bit1 = u.u1 ^ v.u1;
v.u2 = u.u2 + 2;
bit2 = u.u1 ^ v.u1;
align0 = sizeof(struct _s_) - sizeof(union _u_);
bits0 = 0;
k = 0;
for (j = 0; j < align0; j++)
{
u.u2 = u.u4 + j;
bits1 = 0;
for (i = 0; i < align0; i++)
{
v.u2 = u.u2 + i;
bits1 |= u.u1 ^ v.u1;
}
if (!bits0 || bits1 < bits0)
{
bits0 = bits1;
k = j;
}
}
align1 = roundof(align0, 2);
u.u2 = u.u4 + k;
for (bits1 = bits0; i < align1; i++)
{
v.u2 = u.u2 + i;
bits1 |= u.u1 ^ v.u1;
}
align2 = roundof(align0, 4);
for (bits2 = bits1; i < align2; i++)
{
v.u2 = u.u2 + i;
bits2 |= u.u1 ^ v.u1;
}
printf("typedef unsigned %s ALIGN_INTEGRAL;\n", sizeof(char*) >= sizeof(long) ? "long" : sizeof(char*) >= sizeof(int) ? "int" : "short");
printf("\n");
printf("#define ALIGN_CHUNK %d\n", sizeof(char*) >= 4 ? 8192 : 1024);
printf("#define ALIGN_INTEGRAL %s\n", sizeof(char*) >= sizeof(long) ? "long" : sizeof(char*) >= sizeof(int) ? "int" : "short");
printf("#define ALIGN_INTEGER(x) ((ALIGN_INTEGRAL)(x))\n");
printf("#define ALIGN_POINTER(x) ((char*)(x))\n");
if (bits2 == (align2 - 1)) printf("#define ALIGN_ROUND(x,y) ALIGN_POINTER(ALIGN_INTEGER((x)+(y)-1)&~((y)-1))\n");
else printf("#define ALIGN_ROUND(x,y) ALIGN_POINTER(ALIGN_INTEGER(ALIGN_ALIGN(x)+(((y)+%d)/%d)-1)&~((((y)+%d)/%d)-1))\n", align0, align0, align0, align0);
printf("\n");
if (align0 == align2)
{
printf("#define ALIGN_BOUND ALIGN_BOUND2\n");
printf("#define ALIGN_ALIGN(x) ALIGN_ALIGN2(x)\n");
printf("#define ALIGN_TRUNC(x) ALIGN_TRUNC2(x)\n");
}
else if (align0 == align1)
{
printf("#define ALIGN_BOUND ALIGN_BOUND1\n");
printf("#define ALIGN_ALIGN(x) ALIGN_ALIGN1(x)\n");
printf("#define ALIGN_TRUNC(x) ALIGN_TRUNC1(x)\n");
}
else
{
printf("#define ALIGN_BOUND 1\n");
printf("#define ALIGN_ALIGN(x) ALIGN_POINTER(x)\n");
printf("#define ALIGN_TRUNC(x) ALIGN_POINTER(x)\n");
}
printf("\n");
printf("#define ALIGN_BIT1 0x%lx\n", bit1);
if (align1 == align2)
{
printf("#define ALIGN_BOUND1 ALIGN_BOUND2\n");
printf("#define ALIGN_ALIGN1(x) ALIGN_ALIGN2(x)\n");
printf("#define ALIGN_TRUNC1(x) ALIGN_TRUNC2(x)\n");
}
else
{
printf("#define ALIGN_BOUND1 %d\n", align1);
printf("#define ALIGN_ALIGN1(x) ALIGN_TRUNC1((x)+%d)\n", align1 - 1);
printf("#define ALIGN_TRUNC1(x) ALIGN_POINTER(ALIGN_INTEGER((x)+%d)&0x%lx)\n", align1 - 1, ~(bits0|bits1));
}
printf("#define ALIGN_CLRBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", ~bit1);
printf("#define ALIGN_SETBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)|0x%lx)\n", bit1);
printf("#define ALIGN_TSTBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", bit1);
printf("\n");
printf("#define ALIGN_BIT2 0x%lx\n", bit2);
printf("#define ALIGN_BOUND2 %d\n", align2);
printf("#define ALIGN_ALIGN2(x) ALIGN_TRUNC2((x)+%d)\n", align2 - 1);
printf("#define ALIGN_TRUNC2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", ~(bits0|bits1|bits2));
printf("#define ALIGN_CLRBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", ~bit2);
printf("#define ALIGN_SETBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)|0x%lx)\n", bit2);
printf("#define ALIGN_TSTBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", bit2);
printf("\n");
return(0);
}

View File

@@ -0,0 +1,110 @@
/* $XConsortium: botch.c /main/2 1996/05/08 19:41:30 drk $ */
/***************************************************************
* *
* AT&T - PROPRIETARY *
* *
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
* AT&T CORP. *
* *
* Copyright (c) 1995 AT&T Corp. *
* All Rights Reserved *
* *
* This software is licensed by AT&T Corp. *
* under the terms and conditions of the license in *
* http://www.research.att.com/orgs/ssr/book/reuse *
* *
* This software was created by the *
* Software Engineering Research Department *
* AT&T Bell Laboratories *
* *
* For further information contact *
* gsf@research.att.com *
* *
***************************************************************/
/* : : generated by proto : : */
#if !defined(__PROTO__)
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
#if defined(__cplusplus)
#define __MANGLE__ "C"
#else
#define __MANGLE__
#endif
#define __STDARG__
#define __PROTO__(x) x
#define __OTORP__(x)
#define __PARAM__(n,o) n
#if !defined(__STDC__) && !defined(__cplusplus)
#if !defined(c_plusplus)
#define const
#endif
#define signed
#define void int
#define volatile
#define __V_ char
#else
#define __V_ void
#endif
#else
#define __PROTO__(x) ()
#define __OTORP__(x) x
#define __PARAM__(n,o) o
#define __MANGLE__
#define __V_ char
#define const
#define signed
#define void int
#define volatile
#endif
#if defined(__cplusplus) || defined(c_plusplus)
#define __VARARG__ ...
#else
#define __VARARG__
#endif
#if defined(__STDARG__)
#define __VA_START__(p,a) va_start(p,a)
#else
#define __VA_START__(p,a) va_start(p)
#endif
#endif
#include <sys/types.h>
#include "FEATURE/types"
#include <ast_lib.h>
extern __MANGLE__ int getgroups __PROTO__((int, gid_t*));
extern __MANGLE__ int printf __PROTO__((const char*, ...));
main()
{
#if _lib_getgroups
if (sizeof(gid_t) < sizeof(int))
{
register int n;
gid_t groups[32 * sizeof(int) / sizeof(gid_t)];
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
groups[n] = ((gid_t)0);
if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / (sizeof(int) * sizeof(int)), groups)) > 0)
{
if (groups[1] != ((gid_t)0)) n = 0;
else
{
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
groups[n] = ((gid_t)-1);
if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / (sizeof(int) * sizeof(int)), groups)) > 0)
{
if (groups[1] != ((gid_t)-1)) n = 0;
}
}
}
if (n <= 0)
{
printf("#undef getgroups\n");
printf("#define getgroups _ast_getgroups /* implementation botches gid_t* arg */\n");
}
}
#endif
return(0);
}

Some files were not shown because too many files have changed in this diff Show More