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,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