Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
196
cde/programs/dtksh/ksh93/src/lib/libast/features/align.c
Normal file
196
cde/programs/dtksh/ksh93/src/lib/libast/features/align.c
Normal file
@@ -0,0 +1,196 @@
|
||||
/* $XConsortium: align.c /main/2 1996/05/08 19:41:16 drk $ */
|
||||
/***************************************************************
|
||||
* *
|
||||
* AT&T - PROPRIETARY *
|
||||
* *
|
||||
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
|
||||
* AT&T CORP. *
|
||||
* *
|
||||
* Copyright (c) 1995 AT&T Corp. *
|
||||
* All Rights Reserved *
|
||||
* *
|
||||
* This software is licensed by AT&T Corp. *
|
||||
* under the terms and conditions of the license in *
|
||||
* http://www.research.att.com/orgs/ssr/book/reuse *
|
||||
* *
|
||||
* This software was created by the *
|
||||
* Software Engineering Research Department *
|
||||
* AT&T Bell Laboratories *
|
||||
* *
|
||||
* For further information contact *
|
||||
* gsf@research.att.com *
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
/* : : generated by proto : : */
|
||||
|
||||
#if !defined(__PROTO__)
|
||||
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
|
||||
#if defined(__cplusplus)
|
||||
#define __MANGLE__ "C"
|
||||
#else
|
||||
#define __MANGLE__
|
||||
#endif
|
||||
#define __STDARG__
|
||||
#define __PROTO__(x) x
|
||||
#define __OTORP__(x)
|
||||
#define __PARAM__(n,o) n
|
||||
#if !defined(__STDC__) && !defined(__cplusplus)
|
||||
#if !defined(c_plusplus)
|
||||
#define const
|
||||
#endif
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#define __V_ char
|
||||
#else
|
||||
#define __V_ void
|
||||
#endif
|
||||
#else
|
||||
#define __PROTO__(x) ()
|
||||
#define __OTORP__(x) x
|
||||
#define __PARAM__(n,o) o
|
||||
#define __MANGLE__
|
||||
#define __V_ char
|
||||
#define const
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#endif
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
#define __VARARG__ ...
|
||||
#else
|
||||
#define __VARARG__
|
||||
#endif
|
||||
#if defined(__STDARG__)
|
||||
#define __VA_START__(p,a) va_start(p,a)
|
||||
#else
|
||||
#define __VA_START__(p,a) va_start(p)
|
||||
#endif
|
||||
#endif
|
||||
union _u_
|
||||
{
|
||||
long u1;
|
||||
char* u2;
|
||||
double u3;
|
||||
char u4[1024];
|
||||
};
|
||||
|
||||
struct _s_
|
||||
{
|
||||
char s1;
|
||||
union _u_ s2;
|
||||
};
|
||||
|
||||
#define roundof(x,y) (((x)+((y)-1))&~((y)-1))
|
||||
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
|
||||
main()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
|
||||
int align0;
|
||||
int align1;
|
||||
int align2;
|
||||
unsigned long bit1;
|
||||
unsigned long bit2;
|
||||
unsigned long bits0;
|
||||
unsigned long bits1;
|
||||
unsigned long bits2;
|
||||
union _u_ u;
|
||||
union _u_ v;
|
||||
|
||||
u.u2 = u.u4;
|
||||
v.u2 = u.u2 + 1;
|
||||
bit1 = u.u1 ^ v.u1;
|
||||
v.u2 = u.u2 + 2;
|
||||
bit2 = u.u1 ^ v.u1;
|
||||
align0 = sizeof(struct _s_) - sizeof(union _u_);
|
||||
bits0 = 0;
|
||||
k = 0;
|
||||
for (j = 0; j < align0; j++)
|
||||
{
|
||||
u.u2 = u.u4 + j;
|
||||
bits1 = 0;
|
||||
for (i = 0; i < align0; i++)
|
||||
{
|
||||
v.u2 = u.u2 + i;
|
||||
bits1 |= u.u1 ^ v.u1;
|
||||
}
|
||||
if (!bits0 || bits1 < bits0)
|
||||
{
|
||||
bits0 = bits1;
|
||||
k = j;
|
||||
}
|
||||
}
|
||||
align1 = roundof(align0, 2);
|
||||
u.u2 = u.u4 + k;
|
||||
for (bits1 = bits0; i < align1; i++)
|
||||
{
|
||||
v.u2 = u.u2 + i;
|
||||
bits1 |= u.u1 ^ v.u1;
|
||||
}
|
||||
align2 = roundof(align0, 4);
|
||||
for (bits2 = bits1; i < align2; i++)
|
||||
{
|
||||
v.u2 = u.u2 + i;
|
||||
bits2 |= u.u1 ^ v.u1;
|
||||
}
|
||||
printf("typedef unsigned %s ALIGN_INTEGRAL;\n", sizeof(char*) >= sizeof(long) ? "long" : sizeof(char*) >= sizeof(int) ? "int" : "short");
|
||||
printf("\n");
|
||||
printf("#define ALIGN_CHUNK %d\n", sizeof(char*) >= 4 ? 8192 : 1024);
|
||||
printf("#define ALIGN_INTEGRAL %s\n", sizeof(char*) >= sizeof(long) ? "long" : sizeof(char*) >= sizeof(int) ? "int" : "short");
|
||||
printf("#define ALIGN_INTEGER(x) ((ALIGN_INTEGRAL)(x))\n");
|
||||
printf("#define ALIGN_POINTER(x) ((char*)(x))\n");
|
||||
if (bits2 == (align2 - 1)) printf("#define ALIGN_ROUND(x,y) ALIGN_POINTER(ALIGN_INTEGER((x)+(y)-1)&~((y)-1))\n");
|
||||
else printf("#define ALIGN_ROUND(x,y) ALIGN_POINTER(ALIGN_INTEGER(ALIGN_ALIGN(x)+(((y)+%d)/%d)-1)&~((((y)+%d)/%d)-1))\n", align0, align0, align0, align0);
|
||||
printf("\n");
|
||||
if (align0 == align2)
|
||||
{
|
||||
printf("#define ALIGN_BOUND ALIGN_BOUND2\n");
|
||||
printf("#define ALIGN_ALIGN(x) ALIGN_ALIGN2(x)\n");
|
||||
printf("#define ALIGN_TRUNC(x) ALIGN_TRUNC2(x)\n");
|
||||
}
|
||||
else if (align0 == align1)
|
||||
{
|
||||
printf("#define ALIGN_BOUND ALIGN_BOUND1\n");
|
||||
printf("#define ALIGN_ALIGN(x) ALIGN_ALIGN1(x)\n");
|
||||
printf("#define ALIGN_TRUNC(x) ALIGN_TRUNC1(x)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("#define ALIGN_BOUND 1\n");
|
||||
printf("#define ALIGN_ALIGN(x) ALIGN_POINTER(x)\n");
|
||||
printf("#define ALIGN_TRUNC(x) ALIGN_POINTER(x)\n");
|
||||
}
|
||||
printf("\n");
|
||||
printf("#define ALIGN_BIT1 0x%lx\n", bit1);
|
||||
if (align1 == align2)
|
||||
{
|
||||
printf("#define ALIGN_BOUND1 ALIGN_BOUND2\n");
|
||||
printf("#define ALIGN_ALIGN1(x) ALIGN_ALIGN2(x)\n");
|
||||
printf("#define ALIGN_TRUNC1(x) ALIGN_TRUNC2(x)\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("#define ALIGN_BOUND1 %d\n", align1);
|
||||
printf("#define ALIGN_ALIGN1(x) ALIGN_TRUNC1((x)+%d)\n", align1 - 1);
|
||||
printf("#define ALIGN_TRUNC1(x) ALIGN_POINTER(ALIGN_INTEGER((x)+%d)&0x%lx)\n", align1 - 1, ~(bits0|bits1));
|
||||
}
|
||||
printf("#define ALIGN_CLRBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", ~bit1);
|
||||
printf("#define ALIGN_SETBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)|0x%lx)\n", bit1);
|
||||
printf("#define ALIGN_TSTBIT1(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", bit1);
|
||||
printf("\n");
|
||||
printf("#define ALIGN_BIT2 0x%lx\n", bit2);
|
||||
printf("#define ALIGN_BOUND2 %d\n", align2);
|
||||
printf("#define ALIGN_ALIGN2(x) ALIGN_TRUNC2((x)+%d)\n", align2 - 1);
|
||||
printf("#define ALIGN_TRUNC2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", ~(bits0|bits1|bits2));
|
||||
printf("#define ALIGN_CLRBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", ~bit2);
|
||||
printf("#define ALIGN_SETBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)|0x%lx)\n", bit2);
|
||||
printf("#define ALIGN_TSTBIT2(x) ALIGN_POINTER(ALIGN_INTEGER(x)&0x%lx)\n", bit2);
|
||||
printf("\n");
|
||||
return(0);
|
||||
}
|
||||
110
cde/programs/dtksh/ksh93/src/lib/libast/features/botch.c
Normal file
110
cde/programs/dtksh/ksh93/src/lib/libast/features/botch.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/* $XConsortium: botch.c /main/2 1996/05/08 19:41:30 drk $ */
|
||||
/***************************************************************
|
||||
* *
|
||||
* AT&T - PROPRIETARY *
|
||||
* *
|
||||
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
|
||||
* AT&T CORP. *
|
||||
* *
|
||||
* Copyright (c) 1995 AT&T Corp. *
|
||||
* All Rights Reserved *
|
||||
* *
|
||||
* This software is licensed by AT&T Corp. *
|
||||
* under the terms and conditions of the license in *
|
||||
* http://www.research.att.com/orgs/ssr/book/reuse *
|
||||
* *
|
||||
* This software was created by the *
|
||||
* Software Engineering Research Department *
|
||||
* AT&T Bell Laboratories *
|
||||
* *
|
||||
* For further information contact *
|
||||
* gsf@research.att.com *
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
/* : : generated by proto : : */
|
||||
|
||||
#if !defined(__PROTO__)
|
||||
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
|
||||
#if defined(__cplusplus)
|
||||
#define __MANGLE__ "C"
|
||||
#else
|
||||
#define __MANGLE__
|
||||
#endif
|
||||
#define __STDARG__
|
||||
#define __PROTO__(x) x
|
||||
#define __OTORP__(x)
|
||||
#define __PARAM__(n,o) n
|
||||
#if !defined(__STDC__) && !defined(__cplusplus)
|
||||
#if !defined(c_plusplus)
|
||||
#define const
|
||||
#endif
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#define __V_ char
|
||||
#else
|
||||
#define __V_ void
|
||||
#endif
|
||||
#else
|
||||
#define __PROTO__(x) ()
|
||||
#define __OTORP__(x) x
|
||||
#define __PARAM__(n,o) o
|
||||
#define __MANGLE__
|
||||
#define __V_ char
|
||||
#define const
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#endif
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
#define __VARARG__ ...
|
||||
#else
|
||||
#define __VARARG__
|
||||
#endif
|
||||
#if defined(__STDARG__)
|
||||
#define __VA_START__(p,a) va_start(p,a)
|
||||
#else
|
||||
#define __VA_START__(p,a) va_start(p)
|
||||
#endif
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "FEATURE/types"
|
||||
#include <ast_lib.h>
|
||||
|
||||
extern __MANGLE__ int getgroups __PROTO__((int, gid_t*));
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
|
||||
main()
|
||||
{
|
||||
#if _lib_getgroups
|
||||
if (sizeof(gid_t) < sizeof(int))
|
||||
{
|
||||
register int n;
|
||||
gid_t groups[32 * sizeof(int) / sizeof(gid_t)];
|
||||
|
||||
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
|
||||
groups[n] = ((gid_t)0);
|
||||
if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / (sizeof(int) * sizeof(int)), groups)) > 0)
|
||||
{
|
||||
if (groups[1] != ((gid_t)0)) n = 0;
|
||||
else
|
||||
{
|
||||
for (n = 0; n < sizeof(int) / sizeof(gid_t); n++)
|
||||
groups[n] = ((gid_t)-1);
|
||||
if ((n = getgroups((sizeof(groups) / sizeof(groups[0])) / (sizeof(int) * sizeof(int)), groups)) > 0)
|
||||
{
|
||||
if (groups[1] != ((gid_t)-1)) n = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (n <= 0)
|
||||
{
|
||||
printf("#undef getgroups\n");
|
||||
printf("#define getgroups _ast_getgroups /* implementation botches gid_t* arg */\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return(0);
|
||||
}
|
||||
377
cde/programs/dtksh/ksh93/src/lib/libast/features/fcntl.c
Normal file
377
cde/programs/dtksh/ksh93/src/lib/libast/features/fcntl.c
Normal file
@@ -0,0 +1,377 @@
|
||||
/* $XConsortium: fcntl.c /main/3 1996/05/08 19:41:44 drk $ */
|
||||
/***************************************************************
|
||||
* *
|
||||
* AT&T - PROPRIETARY *
|
||||
* *
|
||||
* THIS IS PROPRIETARY SOURCE CODE LICENSED BY *
|
||||
* AT&T CORP. *
|
||||
* *
|
||||
* Copyright (c) 1995 AT&T Corp. *
|
||||
* All Rights Reserved *
|
||||
* *
|
||||
* This software is licensed by AT&T Corp. *
|
||||
* under the terms and conditions of the license in *
|
||||
* http://www.research.att.com/orgs/ssr/book/reuse *
|
||||
* *
|
||||
* This software was created by the *
|
||||
* Software Engineering Research Department *
|
||||
* AT&T Bell Laboratories *
|
||||
* *
|
||||
* For further information contact *
|
||||
* gsf@research.att.com *
|
||||
* *
|
||||
***************************************************************/
|
||||
|
||||
/* : : generated by proto : : */
|
||||
|
||||
#if !defined(__PROTO__)
|
||||
#if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
|
||||
#if defined(__cplusplus)
|
||||
#define __MANGLE__ "C"
|
||||
#else
|
||||
#define __MANGLE__
|
||||
#endif
|
||||
#define __STDARG__
|
||||
#define __PROTO__(x) x
|
||||
#define __OTORP__(x)
|
||||
#define __PARAM__(n,o) n
|
||||
#if !defined(__STDC__) && !defined(__cplusplus)
|
||||
#if !defined(c_plusplus)
|
||||
#define const
|
||||
#endif
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#define __V_ char
|
||||
#else
|
||||
#define __V_ void
|
||||
#endif
|
||||
#else
|
||||
#define __PROTO__(x) ()
|
||||
#define __OTORP__(x) x
|
||||
#define __PARAM__(n,o) o
|
||||
#define __MANGLE__
|
||||
#define __V_ char
|
||||
#define const
|
||||
#define signed
|
||||
#define void int
|
||||
#define volatile
|
||||
#endif
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
#define __VARARG__ ...
|
||||
#else
|
||||
#define __VARARG__
|
||||
#endif
|
||||
#if defined(__STDARG__)
|
||||
#define __VA_START__(p,a) va_start(p,a)
|
||||
#else
|
||||
#define __VA_START__(p,a) va_start(p)
|
||||
#endif
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ast_lib.h>
|
||||
|
||||
#define ioctl ______ioctl
|
||||
#define printf ______printf
|
||||
|
||||
#include "FEATURE/fcntl.lcl"
|
||||
#include "FEATURE/unistd.lcl"
|
||||
|
||||
#undef ioctl
|
||||
#undef printf
|
||||
|
||||
#include "FEATURE/tty"
|
||||
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
|
||||
main()
|
||||
{
|
||||
int f_local = 0;
|
||||
int f_lck = 0;
|
||||
int f_lk = 0;
|
||||
int o_local = 2;
|
||||
char tmp[64];
|
||||
|
||||
#if _hdr_lcl_fcntl
|
||||
printf("#if defined(__STDPP__directive) && defined(__STDPP__hide)\n");
|
||||
printf("__STDPP__directive pragma pp:hide chmod creat fcntl mkdir mkfifo mknod open umask\n");
|
||||
printf("#else\n");
|
||||
printf("#define chmod ______chmod\n");
|
||||
printf("#define creat ______creat\n");
|
||||
printf("#define fcntl ______fcntl\n");
|
||||
printf("#define mkdir ______mkdir\n");
|
||||
printf("#define mkfifo ______mkfifo\n");
|
||||
printf("#define mknod ______mknod\n");
|
||||
printf("#define open ______open\n");
|
||||
printf("#define umask ______umask\n");
|
||||
printf("#endif \n");
|
||||
printf("\n");
|
||||
#if defined(S_IRUSR)
|
||||
printf("#include <ast_fs.h> /* <fcntl.h> includes <sys/stat.h>! */\n");
|
||||
#endif
|
||||
printf("#include <fcntl.h>\n");
|
||||
printf("\n");
|
||||
printf("#if defined(_AST_H) || defined(_POSIX_SOURCE)\n");
|
||||
printf("#define _AST_mode_t mode_t\n");
|
||||
printf("#else\n");
|
||||
printf("#define _AST_mode_t int\n");
|
||||
printf("#endif\n");
|
||||
printf("#if defined(__STDPP__directive) && defined(__STDPP__hide)\n");
|
||||
printf("__STDPP__directive pragma pp:nohide chmod creat fcntl mkdir mkfifo mknod open umask\n");
|
||||
printf("extern int creat(const char*, _AST_mode_t);\n");
|
||||
printf("extern int fcntl(int, int, ...);\n");
|
||||
printf("extern int open(const char*, int, ...);\n");
|
||||
printf("#else\n");
|
||||
printf("#ifdef creat\n");
|
||||
printf("#undef creat\n");
|
||||
printf("extern int creat(const char*, _AST_mode_t);\n");
|
||||
printf("#endif \n");
|
||||
printf("#ifdef fcntl\n");
|
||||
printf("#undef fcntl\n");
|
||||
printf("extern int fcntl(int, int, ...);\n");
|
||||
printf("#endif \n");
|
||||
printf("#ifdef open\n");
|
||||
printf("#undef open\n");
|
||||
printf("extern int open(const char*, int, ...);\n");
|
||||
printf("#endif \n");
|
||||
printf("\n");
|
||||
printf("#undef _AST_mode_t\n");
|
||||
printf("#undef chmod\n");
|
||||
printf("#undef mkdir\n");
|
||||
printf("#undef mkfifo\n");
|
||||
printf("#undef mknod\n");
|
||||
printf("#undef umask\n");
|
||||
printf("#endif \n");
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
#ifndef FD_CLOEXEC
|
||||
printf("#define FD_CLOEXEC 1\n");
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
#ifndef F_DUPFD
|
||||
#define NEED_F 1
|
||||
#else
|
||||
if (F_DUPFD > f_local) f_local = F_DUPFD;
|
||||
#endif
|
||||
#ifndef F_GETFD
|
||||
#define NEED_F 1
|
||||
#else
|
||||
if (F_GETFD > f_local) f_local = F_GETFD;
|
||||
#endif
|
||||
#ifndef F_GETFL
|
||||
#define NEED_F 1
|
||||
#else
|
||||
if (F_GETFL > f_local) f_local = F_GETFL;
|
||||
#endif
|
||||
#ifndef F_GETLK
|
||||
#define NEED_F 1
|
||||
f_lk++;
|
||||
#else
|
||||
if (F_GETLK > f_local) f_local = F_GETLK;
|
||||
#endif
|
||||
#ifndef F_RDLCK
|
||||
#define NEED_F 1
|
||||
#define NEED_LCK 1
|
||||
#else
|
||||
if (F_RDLCK > f_lck) f_lck = F_RDLCK;
|
||||
#endif
|
||||
#ifndef F_SETFD
|
||||
#define NEED_F 1
|
||||
#else
|
||||
if (F_SETFD > f_local) f_local = F_SETFD;
|
||||
#endif
|
||||
#ifndef F_SETFL
|
||||
#define NEED_F 1
|
||||
#else
|
||||
if (F_SETFL > f_local) f_local = F_SETFL;
|
||||
#endif
|
||||
#ifndef F_SETLK
|
||||
#define NEED_F 1
|
||||
f_lk++;
|
||||
#else
|
||||
if (F_SETLK > f_local) f_local = F_SETLK;
|
||||
#endif
|
||||
#ifndef F_SETLKW
|
||||
#define NEED_F 1
|
||||
f_lk++;
|
||||
#else
|
||||
if (F_SETLKW > f_local) f_local = F_SETLKW;
|
||||
#endif
|
||||
#ifndef F_UNLCK
|
||||
#define NEED_F 1
|
||||
#define NEED_LCK 1
|
||||
#else
|
||||
if (F_UNLCK > f_lck) f_lck = F_UNLCK;
|
||||
#endif
|
||||
#ifndef F_WRLCK
|
||||
#define NEED_F 1
|
||||
#define NEED_LCK 1
|
||||
#else
|
||||
if (F_WRLCK > f_lck) f_lck = F_WRLCK;
|
||||
#endif
|
||||
|
||||
#if NEED_F
|
||||
printf("#define fcntl _ast_fcntl\n");
|
||||
#if _lib_fcntl
|
||||
printf("#define _lib_fcntl 1\n");
|
||||
#endif
|
||||
printf("#define _ast_F_LOCAL %d\n", f_local + 1);
|
||||
#ifndef F_DUPFD
|
||||
printf("#define F_DUPFD %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_GETFD
|
||||
printf("#define F_GETFD %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_GETFL
|
||||
printf("#define F_GETFL %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_GETLK
|
||||
printf("#define F_GETLK %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_SETFD
|
||||
printf("#define F_SETFD %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_SETFL
|
||||
printf("#define F_SETFL %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_SETLK
|
||||
printf("#define F_SETLK %d\n", ++f_local);
|
||||
#endif
|
||||
#ifndef F_SETLKW
|
||||
printf("#define F_SETLKW %d\n", ++f_local);
|
||||
#endif
|
||||
#if NEED_LCK
|
||||
printf("\n");
|
||||
#ifndef F_RDLCK
|
||||
printf("#define F_RDLCK %d\n", f_lck++);
|
||||
#endif
|
||||
#ifndef F_WRLCK
|
||||
printf("#define F_WRLCK %d\n", f_lck++);
|
||||
#endif
|
||||
#ifndef F_UNLCK
|
||||
printf("#define F_UNLCK %d\n", f_lck++);
|
||||
#endif
|
||||
#endif
|
||||
printf("\n");
|
||||
if (f_lck == 3)
|
||||
{
|
||||
printf("struct flock\n");
|
||||
printf("{\n");
|
||||
printf(" short l_type;\n");
|
||||
printf(" short l_whence;\n");
|
||||
printf(" off_t l_start;\n");
|
||||
printf(" off_t l_len;\n");
|
||||
printf(" short l_pid;\n");
|
||||
printf("};\n");
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
#ifndef O_APPEND
|
||||
#define NEED_O 1
|
||||
#else
|
||||
if (O_APPEND > o_local) o_local = O_APPEND;
|
||||
#endif
|
||||
#ifndef O_CREAT
|
||||
#define NEED_O 1
|
||||
#else
|
||||
if (O_CREAT > o_local) o_local = O_CREAT;
|
||||
#endif
|
||||
#ifndef O_EXCL
|
||||
#define NEED_O 1
|
||||
#else
|
||||
if (O_EXCL > o_local) o_local = O_EXCL;
|
||||
#endif
|
||||
#ifndef O_NOCTTY
|
||||
#ifdef TIOCNOTTY
|
||||
#define NEED_O 1
|
||||
#endif
|
||||
#else
|
||||
if (O_NOCTTY > o_local) o_local = O_NOCTTY;
|
||||
#endif
|
||||
#ifndef O_NONBLOCK
|
||||
#ifndef O_NDELAY
|
||||
#define NEED_O 1
|
||||
#endif
|
||||
#else
|
||||
if (O_NONBLOCK > o_local) o_local = O_NONBLOCK;
|
||||
#endif
|
||||
#ifndef O_RDONLY
|
||||
#define NEED_O 1
|
||||
#endif
|
||||
#ifndef O_RDWR
|
||||
#define NEED_O 1
|
||||
#endif
|
||||
#ifndef O_TRUNC
|
||||
#define NEED_O 1
|
||||
#else
|
||||
if (O_TRUNC > o_local) o_local = O_TRUNC;
|
||||
#endif
|
||||
#ifndef O_WRONLY
|
||||
#define NEED_O 1
|
||||
#endif
|
||||
|
||||
#if NEED_O
|
||||
printf("#define open _ast_open\n");
|
||||
printf("#define _ast_O_LOCAL 0%o\n", o_local<<1);
|
||||
#ifndef O_RDONLY
|
||||
printf("#define O_RDONLY 0\n");
|
||||
#endif
|
||||
#ifndef O_WRONLY
|
||||
printf("#define O_WRONLY 1\n");
|
||||
#endif
|
||||
#ifndef O_RDWR
|
||||
printf("#define O_RDWR 2\n");
|
||||
#endif
|
||||
#ifndef O_APPEND
|
||||
printf("#define O_APPEND 0%o\n", o_local <<= 1);
|
||||
#endif
|
||||
#ifndef O_CREAT
|
||||
printf("#define O_CREAT 0%o\n", o_local <<= 1);
|
||||
#endif
|
||||
#ifndef O_EXCL
|
||||
printf("#define O_EXCL 0%o\n", o_local <<= 1);
|
||||
#endif
|
||||
#ifndef O_NOCTTY
|
||||
#ifdef TIOCNOTTY
|
||||
printf("#define O_NOCTTY 0%o\n", o_local <<= 1);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef O_NONBLOCK
|
||||
#ifndef O_NDELAY
|
||||
printf("#define O_NONBLOCK 0%o\n", o_local <<= 1);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef O_TRUNC
|
||||
printf("#define O_TRUNC 0%o\n", o_local <<= 1);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef O_ACCMODE
|
||||
printf("#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)\n");
|
||||
#endif
|
||||
#ifndef O_NOCTTY
|
||||
#ifndef TIOCNOTTY
|
||||
printf("#define O_NOCTTY 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifndef O_NONBLOCK
|
||||
#ifdef O_NDELAY
|
||||
printf("#define O_NONBLOCK O_NDELAY\n");
|
||||
#endif
|
||||
#endif
|
||||
#if NEED_F || NEED_O
|
||||
printf("\n");
|
||||
#if NEED_F
|
||||
printf("extern int fcntl(int, int, ...);\n");
|
||||
#endif
|
||||
#if NEED_O
|
||||
printf("extern int open(const char*, int, ...);\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return(0);
|
||||
}
|
||||
175
cde/programs/dtksh/ksh93/src/lib/libast/features/fs
Normal file
175
cde/programs/dtksh/ksh93/src/lib/libast/features/fs
Normal file
@@ -0,0 +1,175 @@
|
||||
mac _STAT_VER,fstat,lstat,stat,_MKNOD_VER,mknod sys/types.h sys/stat.h
|
||||
cat{
|
||||
#if defined(__uxp__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/mkdev.h>
|
||||
#endif
|
||||
#ifndef _def_param_lcl
|
||||
#ifndef S_ISUID
|
||||
#if !defined(_AST_H) && !defined(_TM_H)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
#if !_mac__MKNOD_VER && !_mac_mknod
|
||||
__STDPP__directive pragma pp:hide mknod
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_fstat
|
||||
__STDPP__directive pragma pp:hide fstat
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_lstat
|
||||
__STDPP__directive pragma pp:hide lstat
|
||||
#endif
|
||||
__STDPP__directive pragma pp:hide chmod mkdir mkfifo umask SF_APPEND
|
||||
#else
|
||||
#if !_mac__MKNOD_VER && !_mac_mknod
|
||||
#define mknod ______mknod
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_fstat
|
||||
#define fstat ______fstat
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_lstat
|
||||
#define lstat ______lstat
|
||||
#endif
|
||||
#define chmod ______chmod
|
||||
#define mkdir ______mkdir
|
||||
#define mkfifo ______mkfifo
|
||||
#define umask ______umask
|
||||
#undef SF_APPEND
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
#if !_mac__MKNOD_VER && !_mac_mknod
|
||||
__STDPP__directive pragma pp:nohide mknod
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_fstat
|
||||
__STDPP__directive pragma pp:nohide fstat
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_lstat
|
||||
__STDPP__directive pragma pp:nohide lstat
|
||||
#endif
|
||||
__STDPP__directive pragma pp:nohide chmod mkdir mkfifo umask SF_APPEND
|
||||
#else
|
||||
#if !_mac__MKNOD_VER && !_mac_mknod
|
||||
#undef mknod
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_fstat
|
||||
#undef fstat
|
||||
#endif
|
||||
#if !_mac__STAT_VER && !_mac_lstat
|
||||
#undef lstat
|
||||
#endif
|
||||
#undef chmod
|
||||
#undef mkdir
|
||||
#undef mkfifo
|
||||
#undef umask
|
||||
#undef SF_APPEND
|
||||
#define SF_APPEND _SF_APPEND
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#define FS_default "ufs"
|
||||
}end
|
||||
macro{
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(__uxp__)
|
||||
#include <sys/mkdev.h>
|
||||
#endif
|
||||
#ifndef major
|
||||
#include <sys/param.h>
|
||||
#ifndef major
|
||||
#include <sys/sysmacros.h>
|
||||
#endif
|
||||
<<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
|
||||
<<"__STDPP__directive pragma pp:initial">>
|
||||
<<"#endif">>
|
||||
<<"#ifndef major">>
|
||||
#ifdef major
|
||||
<<"#define major(x)">> major((x))
|
||||
#else
|
||||
<<"#define major(x)">> ((int)(((unsigned)(x)>>8)&0377))
|
||||
#endif
|
||||
<<"#endif">>
|
||||
<<"#ifndef minor">>
|
||||
#ifdef minor
|
||||
<<"#define minor(x)">> minor((x))
|
||||
#else
|
||||
<<"#define minor(x)">> ((int)((x)&0377))
|
||||
#endif
|
||||
<<"#endif">>
|
||||
<<"#ifndef makedev">>
|
||||
#ifdef makedev
|
||||
<<"#define makedev(x,y)">> makedev((x),(y))
|
||||
#else
|
||||
<<"#define makedev(x,y)">> ((dev_t)((((x)&0377)<<8)|((y)&0377)))
|
||||
#endif
|
||||
<<"#endif">>
|
||||
#endif
|
||||
<<"#if defined(__STDPP__directive) && defined(__STDPP__initial)">>
|
||||
<<"__STDPP__directive pragma pp:noinitial">>
|
||||
<<"#endif">>
|
||||
}end fail{
|
||||
cat <<!
|
||||
#ifndef major
|
||||
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
|
||||
#endif
|
||||
#ifndef minor
|
||||
#define minor(x) ((int)((x)&0377))
|
||||
#endif
|
||||
#ifndef makedev
|
||||
#define makedev(x,y) ((dev_t)((((x)&0377)<<8)|((y)&0377)))
|
||||
#endif
|
||||
!
|
||||
}end
|
||||
mem stat.st_blocks,stat.st_blksize,stat.st_rdev sys/types.h sys/stat.h
|
||||
mem statfs.f_files,statfs.f_bavail sys/types.h - sys/statfs.h - sys/vfs.h - sys/mount.h
|
||||
hdr mntent,mnttab
|
||||
lib getmntent,statfs,statvfs
|
||||
sys mount,statfs,statvfs,vfs
|
||||
lib statfs4 sys/types.h - sys/statfs.h - sys/vfs.h - sys/mount.h compile{
|
||||
int f()
|
||||
{
|
||||
struct statfs fs;
|
||||
return statfs("/",&fs,sizeof(fs),0);
|
||||
}
|
||||
}end
|
||||
cat{
|
||||
#if _sys_statvfs
|
||||
#include <sys/statvfs.h>
|
||||
#else
|
||||
struct statvfs
|
||||
{
|
||||
unsigned long f_bsize; /* fundamental file system block size */
|
||||
unsigned long f_frsize; /* fragment size */
|
||||
unsigned long f_blocks; /* total # of blocks of f_frsize on fs */
|
||||
unsigned long f_bfree; /* total # of free blocks of f_frsize */
|
||||
unsigned long f_bavail; /* # of free blocks avail to non-superuser */
|
||||
unsigned long f_files; /* total # of file nodes (inodes) */
|
||||
unsigned long f_ffree; /* total # of free file nodes */
|
||||
unsigned long f_favail; /* # of free nodes avail to non-superuser */
|
||||
unsigned long f_fsid; /* file system id (dev for now) */
|
||||
char f_basetype[16]; /* target fs type name, null-terminated */
|
||||
unsigned long f_flag; /* bit-mask of flags */
|
||||
unsigned long f_namemax; /* maximum file name length */
|
||||
char f_fstr[32]; /* filesystem-specific string */
|
||||
unsigned long f_filler[16]; /* reserved for future expansion */
|
||||
};
|
||||
extern int fstatvfs(int, struct statvfs*);
|
||||
extern int statvfs(const char*, struct statvfs*);
|
||||
#endif
|
||||
}end
|
||||
str st_fstype sys/types.h sys/stat.h note{ stat.st_fstype is a string }end compile{
|
||||
int f(st){struct stat* st;return st->st_fstype[0];}
|
||||
}end
|
||||
int st_fstype sys/types.h sys/stat.h note{ stat.st_fstype is an int }end compile{
|
||||
int f(st){struct stat* st;return st->st_fstype = 1;}
|
||||
}end
|
||||
int st_spare1 sys/types.h sys/stat.h note{ stat.st_spare1 is an int }end compile{
|
||||
int f(st){struct stat* st;return st->st_spare1 = 1;}
|
||||
}end
|
||||
ary st_spare4 sys/types.h sys/stat.h note{ stat.st_spare4 is an array }end compile{
|
||||
int f(st){struct stat* st;return st->st_spare4[0] = 1;}
|
||||
}end
|
||||
ary st_pad4 sys/types.h sys/stat.h note{ stat.st_pad4 is an array }end compile{
|
||||
int f(st){struct stat* st;return st->st_pad4[0] = 1;}
|
||||
}end
|
||||
46
cde/programs/dtksh/ksh93/src/lib/libast/features/hdr
Normal file
46
cde/programs/dtksh/ksh93/src/lib/libast/features/hdr
Normal file
@@ -0,0 +1,46 @@
|
||||
tst std_stddef note{ <stddef.h> looks ok }end compile{
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
ptrdiff_t i;
|
||||
size_t j;
|
||||
wchar_t k;
|
||||
}end
|
||||
tst std_stdlib note{ <stdlib.h> looks ok }end compile{
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
div_t i;
|
||||
ldiv_t j;
|
||||
}end
|
||||
tst std_def_calloc note{ <std*.h> defines calloc macro }end compile{
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef calloc
|
||||
(
|
||||
#endif
|
||||
}end
|
||||
tst std_def_free note{ <std*.h> defines free macro }end compile{
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef free
|
||||
(
|
||||
#endif
|
||||
}end
|
||||
tst std_def_malloc note{ <std*.h> defines malloc macro }end compile{
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef malloc
|
||||
(
|
||||
#endif
|
||||
}end
|
||||
tst std_def_realloc note{ <std*.h> defines realloc macro }end compile{
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef realloc
|
||||
(
|
||||
#endif
|
||||
}end
|
||||
128
cde/programs/dtksh/ksh93/src/lib/libast/features/int.c
Normal file
128
cde/programs/dtksh/ksh93/src/lib/libast/features/int.c
Normal file
@@ -0,0 +1,128 @@
|
||||
/* $XConsortium: int.c /main/2 1996/05/08 19:41:58 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 "FEATURE/types"
|
||||
|
||||
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
|
||||
static char i_char = 1;
|
||||
static short i_short = 1;
|
||||
static int i_int = 1;
|
||||
static long i_long = 1;
|
||||
#if _typ_long_long
|
||||
static long long i_long_long = 1;
|
||||
#endif
|
||||
|
||||
static struct
|
||||
{
|
||||
char* name;
|
||||
int size;
|
||||
char* swap;
|
||||
} type[] =
|
||||
{
|
||||
"char", sizeof(char), (char*)&i_char,
|
||||
"short", sizeof(short), (char*)&i_short,
|
||||
"int", sizeof(int), (char*)&i_int,
|
||||
"long", sizeof(long), (char*)&i_long,
|
||||
#if _typ_long_long
|
||||
"long long", sizeof(long long), (char*)&i_long_long,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int size[] = { 1, 2, 4, 8 };
|
||||
|
||||
main()
|
||||
{
|
||||
register int t;
|
||||
register int s;
|
||||
register int m = 1;
|
||||
|
||||
for (s = 0; s < elementsof(size); s++)
|
||||
{
|
||||
for (t = 0; t < elementsof(type) && type[t].size < size[s]; t++);
|
||||
if (t < elementsof(type))
|
||||
{
|
||||
m = size[s];
|
||||
printf("#ifndef int_%d\n", m);
|
||||
printf("#define int_%d %s\n", m, type[t].name);
|
||||
printf("#endif\n");
|
||||
}
|
||||
}
|
||||
printf("#ifndef int_max\n");
|
||||
printf("#define int_max int_%d\n", m);
|
||||
printf("#endif\n");
|
||||
for (t = 0; t < elementsof(type) - 1 && *type[t + 1].swap; t++);
|
||||
printf("#ifndef int_swap\n");
|
||||
printf("#define int_swap %d\n", t ? type[t].size : 0);
|
||||
printf("#endif\n");
|
||||
return(0);
|
||||
}
|
||||
313
cde/programs/dtksh/ksh93/src/lib/libast/features/lib
Normal file
313
cde/programs/dtksh/ksh93/src/lib/libast/features/lib
Normal file
@@ -0,0 +1,313 @@
|
||||
cmd universe
|
||||
hdr dirent,filio,jioctl,locale,mman,ndir,utime,vfork,wchar
|
||||
dat _tzname,tzname
|
||||
lib _cleanup,BSDsetpgrp,atexit,bcopy,bzero,confstr,dirread,dup2,fchmod
|
||||
lib fcntl,fnmatch,fork,fsync,getconf,getdents,getdirentries,getdtablesize
|
||||
lib getgroups,getpagesize,getrlimit,getuniverse,index,killpg,link
|
||||
lib localeconv,lstat,mbtowc,memccpy
|
||||
lib memchr,memcmp,memcpy,memdup,memmove,memset,mkdir,mkfifo,mknod,mktemp
|
||||
lib mount,on_exit,onexit,opendir,pathconf,readlink,remove,rename,rindex
|
||||
lib rmdir,rewinddir,setlocale,setpgid,setpgrp,setpgrp2,setreuid,setsid
|
||||
lib setuid,sigaction,sigprocmask,sigsetmask,sigunblock,sigvec
|
||||
lib socketpair,spawnve,spawnveg,strchr,strcoll,strdup,strerror,strrchr
|
||||
lib strtod,strtol,strtoul,strxfrm,symlink,sysconf
|
||||
lib telldir,tmpnam,tzset,universe,unlink,utime,vfork
|
||||
lib wctype,iswblank,iswctype
|
||||
lib execve,pcreateve,NutForkExecve
|
||||
mem direct.d_reclen sys/types.h sys/dir.h
|
||||
mem dirent.d_fileno,dirent.d_ino,dirent.d_namlen,dirent.d_off,dirent.d_reclen sys/types.h dirent.h
|
||||
mem DIR.dd_fd sys/types.h - dirent.h - sys/dir.h
|
||||
sys dir,filio,jioctl,localedef,mman,ptem,resource,socket,stream,universe
|
||||
sys vfork
|
||||
|
||||
tst tst_errno note{ errno can be assigned }end link{
|
||||
_BEGIN_EXTERNS_
|
||||
extern int errno;
|
||||
error() { }
|
||||
strerror() { }
|
||||
_END_EXTERNS_
|
||||
main() { errno = 0; error(); strerror(); }
|
||||
}end
|
||||
|
||||
tst lib_poll_fd_1 note{ fd is first arg to poll() }end execute{
|
||||
#include <poll.h>
|
||||
_BEGIN_EXTERNS_
|
||||
extern int pipe _ARG_((int*));
|
||||
_END_EXTERNS_
|
||||
main()
|
||||
{ int rw[2];
|
||||
struct pollfd fd;
|
||||
if (pipe(rw) < 0) return 1;
|
||||
fd.fd = rw[0];
|
||||
fd.events = POLLIN;
|
||||
fd.revents = 0;
|
||||
return poll(&fd, 1, 0) < 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst lib_poll_fd_2 note{ fd is second arg to poll() }end execute{
|
||||
#include <poll.h>
|
||||
_BEGIN_EXTERNS_
|
||||
extern int pipe _ARG_((int*));
|
||||
_END_EXTERNS_
|
||||
main()
|
||||
{ int rw[2];
|
||||
struct pollfd fd;
|
||||
if (pipe(rw) < 0) return 1;
|
||||
fd.fd = rw[0];
|
||||
fd.events = POLLIN;
|
||||
fd.revents = 0;
|
||||
return poll(1, &fd, 0) < 0;
|
||||
}
|
||||
}end
|
||||
|
||||
cat{
|
||||
#if _lib_poll_fd_1 || _lib_poll_fd_2
|
||||
#define _lib_poll 1
|
||||
#endif
|
||||
#if _lib_NutForkExecve
|
||||
#define _map_spawnve NutForkExecve
|
||||
#else
|
||||
#if _lib_pcreateve
|
||||
#define _map_spawnve pcreateve
|
||||
#endif
|
||||
#endif
|
||||
}end
|
||||
|
||||
tst lib_poll_notimer note{ poll with no fds ignores timeout }end execute{
|
||||
#include <sys/types.h>
|
||||
#include <poll.h>
|
||||
_BEGIN_EXTERNS_
|
||||
extern time_t time _ARG_((time_t*));
|
||||
_END_EXTERNS_
|
||||
#define TIMEOUT 4
|
||||
main()
|
||||
{
|
||||
unsigned long start;
|
||||
unsigned long finish;
|
||||
struct pollfd fd;
|
||||
start = time((time_t*)0);
|
||||
if (poll(&fd, 0, TIMEOUT * 1000) < 0)
|
||||
return 0;
|
||||
finish = time((time_t*)0);
|
||||
return (finish - start) > (TIMEOUT / 2);
|
||||
}
|
||||
}end
|
||||
|
||||
tst lib_select note{ select() has standard 5 arg interface }end link{
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
main()
|
||||
{ struct timeval tmb;
|
||||
fd_set rd;
|
||||
FD_ZERO(&rd);
|
||||
FD_SET(0,&rd);
|
||||
tmb.tv_sec = 0;
|
||||
tmb.tv_usec = 0;
|
||||
select(1,&rd,(fd_set*)0,(fd_set*)0,&tmb);
|
||||
return 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst pipe_rw note{ full duplex pipes }end execute{
|
||||
_BEGIN_EXTERNS_
|
||||
extern int pipe _ARG_((int*));
|
||||
extern int read _ARG_((int, void*, int));
|
||||
extern int strcmp _ARG_((const char*, const char*));
|
||||
extern int write _ARG_((int, void*, int));
|
||||
_END_EXTERNS_
|
||||
main()
|
||||
{
|
||||
static char test[] = "test\n";
|
||||
int io[2];
|
||||
char buf[sizeof(test)];
|
||||
if (pipe(io)) return 1;
|
||||
if (write(io[1], test, sizeof(test)) != sizeof(test)) return 1;
|
||||
if (read(io[0], buf, sizeof(test)) != sizeof(test)) return 1;
|
||||
if (strcmp(test, buf)) return 1;
|
||||
if (write(io[0], test, sizeof(test)) != sizeof(test)) return 1;
|
||||
if (read(io[1], buf, sizeof(test)) != sizeof(test)) return 1;
|
||||
if (strcmp(test, buf)) return 1;
|
||||
return 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst real_vfork note{ vfork child shares data with parent }end execute{
|
||||
_BEGIN_EXTERNS_
|
||||
extern int vfork();
|
||||
_END_EXTERNS_
|
||||
int code;
|
||||
main()
|
||||
{
|
||||
code = 1;
|
||||
if (!vfork()) code = 0;
|
||||
return code;
|
||||
}
|
||||
}end
|
||||
|
||||
tst stream_peek note{ ioctl(I_PEEK) works }end link{
|
||||
#include <sys/types.h>
|
||||
#include <stropts.h>
|
||||
main()
|
||||
{ struct strpeek pbuf;
|
||||
pbuf.flags = 0;
|
||||
pbuf.ctlbuf.maxlen = pbuf.databuf.maxlen =
|
||||
pbuf.ctlbuf.len = pbuf.databuf.len = 0;
|
||||
pbuf.ctlbuf.buf = pbuf.databuf.buf = 0;
|
||||
ioctl(0,I_PEEK,&pbuf);
|
||||
return 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst socket_peek note{ recv(MSG_PEEK) works }end link{
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
main()
|
||||
{ char buf[128];
|
||||
recv(0,buf,sizeof(buf),MSG_PEEK);
|
||||
return 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst lib_mmap sys/types.h sys/stat.h unistd.h fcntl.h mman.h sys/mman.h sys/times.h note{ standard mmap interface that works }end execute{
|
||||
#define BUFSIZE (16*1024)
|
||||
#define MAPSIZE (16*1024)
|
||||
#define WRITE (64)
|
||||
#if _STD_
|
||||
main(int argc, char** argv)
|
||||
#else
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char** argv;
|
||||
#endif
|
||||
{
|
||||
caddr_t mm;
|
||||
char* t;
|
||||
char* f;
|
||||
int i;
|
||||
int fd;
|
||||
char file[1024];
|
||||
char buf[BUFSIZE];
|
||||
struct tms brdtm, erdtm, bmmtm, emmtm;
|
||||
|
||||
f = argv[0];
|
||||
t = file;
|
||||
while (*t = *f++) t++;
|
||||
*t++ = '.';
|
||||
*t++ = 'D';
|
||||
*t = 0;
|
||||
/* create data file */
|
||||
if ((fd = creat(file,0666)) < 0)
|
||||
return(1);
|
||||
for (i = 0; i < sizeof(buf); ++i)
|
||||
buf[i] = '0' + (i%10);
|
||||
for (i = 0; i < WRITE; ++i)
|
||||
if (write(fd,buf,sizeof(buf)) != sizeof(buf))
|
||||
return(1);
|
||||
close(fd);
|
||||
/* read time */
|
||||
if ((fd = open(file, 0)) < 0)
|
||||
return(1);
|
||||
times(&brdtm);
|
||||
for (i = 0; i < WRITE; ++i)
|
||||
if (read(fd,buf,sizeof(buf)) != sizeof(buf))
|
||||
return(1);
|
||||
times(&erdtm);
|
||||
close(fd);
|
||||
/* memory map time */
|
||||
if ((fd = open(file,0)) < 0)
|
||||
return(1);
|
||||
times(&bmmtm);
|
||||
mm = 0;
|
||||
for (i = 0; i < (WRITE/(MAPSIZE/BUFSIZE)); ++i)
|
||||
{ mm = (caddr_t)mmap(mm, MAPSIZE, (PROT_READ|PROT_WRITE),
|
||||
(MAP_PRIVATE | (mm ? MAP_FIXED : 0)),
|
||||
fd, i*MAPSIZE );
|
||||
if(mm == (caddr_t)(-1) || mm == (caddr_t)0)
|
||||
return(1);
|
||||
}
|
||||
times(&emmtm);
|
||||
close(fd);
|
||||
unlink(file);
|
||||
if(((erdtm.tms_utime-brdtm.tms_utime)+(erdtm.tms_stime-brdtm.tms_stime)) <=
|
||||
((emmtm.tms_utime-bmmtm.tms_utime)+(emmtm.tms_stime-bmmtm.tms_stime)) )
|
||||
return(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
}end
|
||||
|
||||
tst ptr_dd_buf sys/types.h - dirent.h - ndir.h - sys/dir.h note{ DIR.dd_buf is a pointer }end compile{
|
||||
main()
|
||||
{
|
||||
DIR* dirp;
|
||||
dirp->dd_buf = 0;
|
||||
return 0;
|
||||
}
|
||||
}end
|
||||
|
||||
tst lib_utime_now note{ utime works with 0 time vector }end execute{
|
||||
#include <sys/types.h>
|
||||
_BEGIN_EXTERNS_
|
||||
extern int utime _ARG_((const char*, void*));
|
||||
_END_EXTERNS_
|
||||
main()
|
||||
{
|
||||
return utime(".", (void*)0) == -1;
|
||||
}
|
||||
}end
|
||||
|
||||
tst run{
|
||||
u=att
|
||||
case `/bin/cat -s /dev/null/foo 2>&1` in
|
||||
'') ;;
|
||||
*) case `/bin/echo '\\\\t'` in
|
||||
'\\t') u=ucb ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
echo "#define _UNIV_DEFAULT \\"$u\\" /* default universe name */"
|
||||
}end
|
||||
|
||||
std cleanup note{ stuck with standard _cleanup }end noexecute{
|
||||
#include <stdio.h>
|
||||
_BEGIN_EXTERNS_
|
||||
extern void exit _ARG_((int));
|
||||
extern void _exit _ARG_((int));
|
||||
extern void _cleanup();
|
||||
void _cleanup() { _exit(0); }
|
||||
_END_EXTERNS_
|
||||
main() { printf("cleanup\n"); exit(1); }
|
||||
}end
|
||||
|
||||
std malloc note{ stuck with standard malloc }end noexecute{
|
||||
_BEGIN_EXTERNS_
|
||||
extern char* strdup _ARG_((const char*));
|
||||
#if _STD_
|
||||
char* malloc(unsigned n) { return 0; }
|
||||
#else
|
||||
char* malloc(n) unsigned n; { return 0; }
|
||||
#endif
|
||||
_END_EXTERNS_
|
||||
main() { return strdup("yo") != 0; }
|
||||
}end
|
||||
|
||||
std signal note{ stuck with standard signal }end nolink{
|
||||
_BEGIN_EXTERNS_
|
||||
extern int abort();
|
||||
int signal() { return 0; }
|
||||
_END_EXTERNS_
|
||||
main() { signal(); abort(); return 0; }
|
||||
}end
|
||||
|
||||
std strcoll note{ standard strcoll works }end execute{
|
||||
#include <string.h>
|
||||
#define S "hello world"
|
||||
main()
|
||||
{
|
||||
char s[] = S;
|
||||
char t[] = S;
|
||||
return strcoll(s, t) || strcmp(s, t);
|
||||
}
|
||||
}end
|
||||
418
cde/programs/dtksh/ksh93/src/lib/libast/features/limits.c
Normal file
418
cde/programs/dtksh/ksh93/src/lib/libast/features/limits.c
Normal file
@@ -0,0 +1,418 @@
|
||||
/* $XConsortium: limits.c /main/2 1996/05/08 19:42:11 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
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:hide printf
|
||||
#else
|
||||
#define printf ______printf
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "FEATURE/lib"
|
||||
#include "FEATURE/limits.lcl"
|
||||
#include "FEATURE/unistd.lcl"
|
||||
#include "FEATURE/param"
|
||||
#include "FEATURE/types"
|
||||
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:nohide printf
|
||||
#endif
|
||||
|
||||
#if defined(__STDPP__hide) || defined(printf)
|
||||
#undef printf
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
#endif
|
||||
|
||||
#include "conflib.h"
|
||||
|
||||
main()
|
||||
{
|
||||
register int i;
|
||||
register int n;
|
||||
|
||||
char c;
|
||||
unsigned char uc;
|
||||
unsigned short us;
|
||||
unsigned int ui;
|
||||
unsigned long ul;
|
||||
unsigned long val;
|
||||
|
||||
/*
|
||||
* <limits.h> with *constant* valued macros
|
||||
*/
|
||||
|
||||
printf("\n");
|
||||
#ifdef CHAR_BIT
|
||||
val = CHAR_BIT;
|
||||
printf("#undef CHAR_BIT\n");
|
||||
#else
|
||||
uc = 0;
|
||||
uc = ~uc;
|
||||
val = 1;
|
||||
while (uc >>= 1) val++;
|
||||
#endif
|
||||
printf("#define CHAR_BIT %lu\n", val);
|
||||
#ifdef MB_LEN_MAX
|
||||
val = MB_LEN_MAX;
|
||||
printf("#undef MB_LEN_MAX\n");
|
||||
#else
|
||||
val = 1;
|
||||
#endif
|
||||
printf("#define MB_LEN_MAX %lu\n", val);
|
||||
|
||||
c = 0;
|
||||
c = ~c;
|
||||
uc = 0;
|
||||
uc = ~uc;
|
||||
us = 0;
|
||||
us = ~us;
|
||||
ui = 0;
|
||||
ui = ~ui;
|
||||
ul = 0;
|
||||
ul = ~ul;
|
||||
|
||||
#ifdef UCHAR_MAX
|
||||
val = UCHAR_MAX;
|
||||
printf("#undef UCHAR_MAX\n");
|
||||
#else
|
||||
val = uc;
|
||||
#endif
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define UCHAR_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define UCHAR_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
|
||||
#ifdef SCHAR_MIN
|
||||
val = -(SCHAR_MIN);
|
||||
printf("#undef SCHAR_MIN\n");
|
||||
#else
|
||||
val = (unsigned char)(uc >> 1) + 1;
|
||||
#endif
|
||||
printf("#define SCHAR_MIN -%lu\n", val);
|
||||
|
||||
#ifdef SCHAR_MAX
|
||||
val = SCHAR_MAX;
|
||||
printf("#undef SCHAR_MAX\n");
|
||||
#else
|
||||
val = (unsigned char)(uc >> 1);
|
||||
#endif
|
||||
printf("#define SCHAR_MAX %lu\n", val);
|
||||
|
||||
if (c < 0)
|
||||
{
|
||||
#ifdef CHAR_MIN
|
||||
printf("#undef CHAR_MIN\n");
|
||||
#endif
|
||||
printf("#define CHAR_MIN SCHAR_MIN\n");
|
||||
|
||||
#ifdef CHAR_MAX
|
||||
printf("#undef CHAR_MAX\n");
|
||||
#endif
|
||||
printf("#define CHAR_MAX SCHAR_MAX\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef CHAR_MIN
|
||||
printf("#undef CHAR_MIN\n");
|
||||
#endif
|
||||
printf("#define CHAR_MIN 0\n");
|
||||
|
||||
#ifdef CHAR_MAX
|
||||
printf("#undef CHAR_MAX\n");
|
||||
#endif
|
||||
printf("#define CHAR_MAX UCHAR_MAX\n");
|
||||
}
|
||||
|
||||
#ifdef USHRT_MAX
|
||||
val = USHRT_MAX;
|
||||
printf("#undef USHRT_MAX\n");
|
||||
#else
|
||||
val = us;
|
||||
#endif
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define USHRT_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define USHRT_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
|
||||
#ifdef SHRT_MIN
|
||||
val = -(SHRT_MIN);
|
||||
printf("#undef SHRT_MIN\n");
|
||||
#else
|
||||
val = (unsigned short)(us >> 1) + 1;
|
||||
#endif
|
||||
printf("#define SHRT_MIN -%lu\n", val);
|
||||
|
||||
#ifdef SHRT_MAX
|
||||
val = SHRT_MAX;
|
||||
printf("#undef SHRT_MAX\n");
|
||||
#else
|
||||
val = (unsigned short)(us >> 1);
|
||||
#endif
|
||||
printf("#define SHRT_MAX %lu\n", val);
|
||||
|
||||
if (ui == us)
|
||||
{
|
||||
#ifdef UINT_MAX
|
||||
printf("#undef UINT_MAX\n");
|
||||
#endif
|
||||
printf("#define UINT_MAX USHRT_MAX\n");
|
||||
|
||||
#ifdef INT_MIN
|
||||
printf("#undef INT_MIN\n");
|
||||
#endif
|
||||
printf("#define INT_MIN SHRT_MIN\n");
|
||||
|
||||
#ifdef INT_MAX
|
||||
printf("#undef INT_MAX\n");
|
||||
#endif
|
||||
printf("#define INT_MAX SHRT_MAX\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef UINT_MAX
|
||||
val = UINT_MAX;
|
||||
printf("#undef UINT_MAX\n");
|
||||
#else
|
||||
val = ui;
|
||||
#endif
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define UINT_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define UINT_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
|
||||
#ifdef INT_MIN
|
||||
val = -(INT_MIN);
|
||||
printf("#undef INT_MIN\n");
|
||||
#else
|
||||
val = (unsigned int)(ui >> 1) + 1;
|
||||
#endif
|
||||
if (ui == ul) printf("#define INT_MIN (-%lu-1)\n", val - 1);
|
||||
else printf("#define INT_MIN -%lu\n", val);
|
||||
|
||||
#ifdef INT_MAX
|
||||
val = INT_MAX;
|
||||
printf("#undef INT_MAX\n");
|
||||
#else
|
||||
val = (unsigned int)(ui >> 1);
|
||||
#endif
|
||||
printf("#define INT_MAX %lu\n", val);
|
||||
}
|
||||
|
||||
if (ul == ui)
|
||||
{
|
||||
#ifdef ULONG_MAX
|
||||
printf("#undef ULONG_MAX\n");
|
||||
#endif
|
||||
printf("#define ULONG_MAX UINT_MAX\n");
|
||||
|
||||
#ifdef LONG_MIN
|
||||
printf("#undef LONG_MIN\n");
|
||||
#endif
|
||||
printf("#define LONG_MIN INT_MIN\n");
|
||||
|
||||
#ifdef LONG_MAX
|
||||
printf("#undef LONG_MAX\n");
|
||||
#endif
|
||||
printf("#define LONG_MAX INT_MAX\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ULONG_MAX
|
||||
val = ULONG_MAX;
|
||||
printf("#undef ULONG_MAX\n");
|
||||
#else
|
||||
val = ui;
|
||||
#endif
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define ULONG_MAX %luU\n", val);
|
||||
printf("#else\n");
|
||||
printf("#define ULONG_MAX %lu\n", val);
|
||||
printf("#endif\n");
|
||||
|
||||
#ifdef LONG_MIN
|
||||
val = -(LONG_MIN);
|
||||
printf("#undef LONG_MIN\n");
|
||||
#else
|
||||
val = (unsigned long)(ul >> 1) + 1;
|
||||
#endif
|
||||
printf("#define LONG_MIN (-%lu-1)\n", val - 1);
|
||||
|
||||
#ifdef LONG_MAX
|
||||
val = LONG_MAX;
|
||||
printf("#undef LONG_MAX\n");
|
||||
#else
|
||||
val = (unsigned long)(ul >> 1);
|
||||
#endif
|
||||
printf("#define LONG_MAX %lu\n", val);
|
||||
}
|
||||
|
||||
#ifdef ULONGLONG_MAX
|
||||
printf("#undef ULONGLONG_MAX\n");
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define ULONGLONG_MAX %lluLLU\n", ULONGLONG_MAX);
|
||||
printf("#else\n");
|
||||
printf("#define ULONGLONG_MAX %llu\n", ULONGLONG_MAX);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
#ifdef LONGLONG_MIN
|
||||
printf("#undef LONGLONG_MIN\n");
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define LONGLONG_MIN %lldLL\n", LONGLONG_MIN);
|
||||
printf("#else\n");
|
||||
printf("#define LONGLONG_MIN %lld\n", LONGLONG_MIN);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
#ifdef LONGLONG_MAX
|
||||
printf("#undef LONGLONG_MAX\n");
|
||||
printf("#if defined(__STDC__)\n");
|
||||
printf("#define LONGLONG_MAX %lldLL\n", LONGLONG_MAX);
|
||||
printf("#else\n");
|
||||
printf("#define LONGLONG_MAX %lld\n", LONGLONG_MAX);
|
||||
printf("#endif\n");
|
||||
#endif
|
||||
|
||||
printf("\n");
|
||||
#include "conflim.h"
|
||||
printf("\n");
|
||||
|
||||
/*
|
||||
* pollution control
|
||||
*/
|
||||
|
||||
printf("/*\n");
|
||||
printf(" * pollution control\n");
|
||||
printf(" */\n");
|
||||
printf("\n");
|
||||
printf("#if defined(__STDPP__directive) && defined(__STDPP__ignore)\n");
|
||||
printf("__STDPP__directive pragma pp:ignore \"limits.h\"\n");
|
||||
printf("#else\n");
|
||||
#ifdef _limits_h
|
||||
printf("#define _limits_h\n");
|
||||
#endif
|
||||
#ifdef __limits_h
|
||||
printf("#define __limits_h\n");
|
||||
#endif
|
||||
#ifdef _sys_limits_h
|
||||
printf("#define _sys_limits_h\n");
|
||||
#endif
|
||||
#ifdef __sys_limits_h
|
||||
printf("#define __sys_limits_h\n");
|
||||
#endif
|
||||
#ifdef _LIMITS_H_
|
||||
printf("#define _LIMITS_H_\n");
|
||||
#endif
|
||||
#ifdef __LIMITS_H
|
||||
printf("#define __LIMITS_H\n");
|
||||
#endif
|
||||
#ifdef __LIMITS_INCLUDED
|
||||
printf("#define __LIMITS_INCLUDED\n");
|
||||
#endif
|
||||
#ifdef _MACH_MACHLIMITS_H_
|
||||
printf("#define _MACH_MACHLIMITS_H_\n");
|
||||
#endif
|
||||
#ifdef _SYS_LIMITS_H_
|
||||
printf("#define _SYS_LIMITS_H_\n");
|
||||
#endif
|
||||
#ifdef __SYS_LIMITS_H
|
||||
printf("#define __SYS_LIMITS_H\n");
|
||||
#endif
|
||||
#ifdef __SYS_LIMITS_INCLUDED
|
||||
printf("#define __SYS_LIMITS_INCLUDED\n");
|
||||
#endif
|
||||
#ifdef _SYS_SYSLIMITS_H_
|
||||
printf("#define _SYS_SYSLIMITS_H_\n");
|
||||
#endif
|
||||
#ifdef _H_LIMITS
|
||||
printf("#define _H_LIMITS\n");
|
||||
#endif
|
||||
#ifdef __H_LIMITS
|
||||
printf("#define __H_LIMITS\n");
|
||||
#endif
|
||||
#ifdef _H_SYS_LIMITS
|
||||
printf("#define _H_SYS_LIMITS\n");
|
||||
#endif
|
||||
#ifdef __H_SYS_LIMITS
|
||||
printf("#define __H_SYS_LIMITS\n");
|
||||
#endif
|
||||
printf("#endif\n");
|
||||
printf("\n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
259
cde/programs/dtksh/ksh93/src/lib/libast/features/mode.c
Normal file
259
cde/programs/dtksh/ksh93/src/lib/libast/features/mode.c
Normal file
@@ -0,0 +1,259 @@
|
||||
/* $XConsortium: mode.c /main/2 1996/05/08 19:42:25 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 "FEATURE/limits.lcl"
|
||||
#include "FEATURE/param"
|
||||
|
||||
#include <modecanon.h>
|
||||
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
|
||||
main()
|
||||
{
|
||||
int n;
|
||||
int idperm;
|
||||
int idtype;
|
||||
|
||||
idperm = idtype = 1;
|
||||
#ifndef S_ITYPE
|
||||
#ifdef S_IFMT
|
||||
printf("#define S_ITYPE(m) ((m)&S_IFMT)\n");
|
||||
#else
|
||||
printf("#define S_ITYPE(m) ((m)&~S_IPERM)\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISBLK
|
||||
if (!S_ISBLK(X_IFBLK)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFBLK
|
||||
printf("#define S_ISBLK(m) (S_ITYPE(m)==S_IFBLK)\n");
|
||||
#else
|
||||
printf("#define S_ISBLK(m) 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISCHR
|
||||
if (!S_ISCHR(X_IFCHR)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFCHR
|
||||
printf("#define S_ISCHR(m) (S_ITYPE(m)==S_IFCHR)\n");
|
||||
#else
|
||||
printf("#define S_ISCHR(m) 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISCTG
|
||||
if (!S_ISCTG(X_IFCTG)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFCTG
|
||||
printf("#define S_ISCTG(m) (S_ITYPE(m)==S_IFCTG)\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISDIR
|
||||
if (!S_ISDIR(X_IFDIR)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFDIR
|
||||
printf("#define S_ISDIR(m) (S_ITYPE(m)==S_IFDIR)\n");
|
||||
#else
|
||||
printf("#define S_ISDIR(m) 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISFIFO
|
||||
if (!S_ISFIFO(X_IFIFO)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFIFO
|
||||
printf("#define S_ISFIFO(m) (S_ITYPE(m)==S_IFIFO)\n");
|
||||
#else
|
||||
printf("#define S_ISFIFO(m) 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISLNK
|
||||
if (!S_ISLNK(X_IFLNK)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFLNK
|
||||
printf("#define S_ISLNK(m) (S_ITYPE(m)==S_IFLNK)\n");
|
||||
#else
|
||||
printf("#define S_ISLNK(m) 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISREG
|
||||
if (!S_ISREG(X_IFREG)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFREG
|
||||
printf("#define S_ISREG(m) (S_ITYPE(m)==S_IFREG)\n");
|
||||
#else
|
||||
printf("#define S_ISREG(m) 0\n");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef S_ISSOCK
|
||||
if (!S_ISSOCK(X_IFSOCK)) idtype = 0;
|
||||
#else
|
||||
#ifdef S_IFSOCK
|
||||
printf("#define S_ISSOCK(m) (S_ITYPE(m)==S_IFSOCK)\n");
|
||||
#endif
|
||||
#endif
|
||||
printf("\n");
|
||||
#ifndef S_IPERM
|
||||
printf("#define S_IPERM (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)\n");
|
||||
#endif
|
||||
#ifndef S_ISUID
|
||||
printf("#define S_ISUID 0%04o\n", X_ISUID);
|
||||
#else
|
||||
if (S_ISUID != X_ISUID) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_ISGID
|
||||
printf("#define S_ISGID 0%04o\n", X_ISGID);
|
||||
#else
|
||||
if (S_ISGID != X_ISGID) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_ISVTX
|
||||
printf("#define S_ISVTX 0%04o\n", X_ISVTX);
|
||||
#else
|
||||
if (S_ISVTX != X_ISVTX) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IRUSR
|
||||
printf("#define S_IRUSR 0%04o\n", X_IRUSR);
|
||||
#else
|
||||
if (S_IRUSR != X_IRUSR) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IWUSR
|
||||
printf("#define S_IWUSR 0%04o\n", X_IWUSR);
|
||||
#else
|
||||
if (S_IWUSR != X_IWUSR) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IXUSR
|
||||
printf("#define S_IXUSR 0%04o\n", X_IXUSR);
|
||||
#else
|
||||
if (S_IXUSR != X_IXUSR) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IRGRP
|
||||
printf("#define S_IRGRP 0%04o\n", X_IRGRP);
|
||||
#else
|
||||
if (S_IRGRP != X_IRGRP) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IWGRP
|
||||
printf("#define S_IWGRP 0%04o\n", X_IWGRP);
|
||||
#else
|
||||
if (S_IWGRP != X_IWGRP) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IXGRP
|
||||
printf("#define S_IXGRP 0%04o\n", X_IXGRP);
|
||||
#else
|
||||
if (S_IXGRP != X_IXGRP) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IROTH
|
||||
printf("#define S_IROTH 0%04o\n", X_IROTH);
|
||||
#else
|
||||
if (S_IROTH != X_IROTH) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IWOTH
|
||||
printf("#define S_IWOTH 0%04o\n", X_IWOTH);
|
||||
#else
|
||||
if (S_IWOTH != X_IWOTH) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IXOTH
|
||||
printf("#define S_IXOTH 0%04o\n", X_IXOTH);
|
||||
#else
|
||||
if (S_IXOTH != X_IXOTH) idperm = 0;
|
||||
#endif
|
||||
#ifndef S_IRWXU
|
||||
printf("#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)\n");
|
||||
#endif
|
||||
#ifndef S_IRWXG
|
||||
printf("#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)\n");
|
||||
#endif
|
||||
#ifndef S_IRWXO
|
||||
printf("#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)\n");
|
||||
#endif
|
||||
printf("\n");
|
||||
if (idperm) printf("#define _S_IDPERM 1\n");
|
||||
if (idtype) printf("#define _S_IDTYPE 1\n");
|
||||
printf("\n");
|
||||
#ifdef BUFFERSIZE
|
||||
n = BUFFERSIZE;
|
||||
#else
|
||||
#ifdef MAXBSIZE
|
||||
n = MAXBSIZE;
|
||||
#else
|
||||
#ifdef SBUFSIZE
|
||||
n = SBUFSIZE;
|
||||
#else
|
||||
#ifdef BUFSIZ
|
||||
n = BUFSIZ;
|
||||
#else
|
||||
if (sizeof(char*) > 4) n = 8192;
|
||||
else if (sizeof(char*) < 4) n = 512;
|
||||
else n = 4096;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
printf("#define BUFFERSIZE %u\n", n);
|
||||
printf("\n");
|
||||
return(0);
|
||||
}
|
||||
23
cde/programs/dtksh/ksh93/src/lib/libast/features/param.sh
Normal file
23
cde/programs/dtksh/ksh93/src/lib/libast/features/param.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
: $XConsortium: param.sh /main/2 1996/05/10 16:43:26 drk $
|
||||
: generate "<sys/param.h> + <sys/types.h> + <sys/stat.h>" include sequence
|
||||
eval $1
|
||||
shift
|
||||
for i in "#include <sys/param.h>" "#include <sys/param.h>
|
||||
#ifndef S_IFDIR
|
||||
#include <sys/stat.h>
|
||||
#endif" "#include <sys/param.h>
|
||||
#ifndef S_IFDIR
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif" "#ifndef S_IFDIR
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#endif"
|
||||
do echo "$i
|
||||
struct stat V_stat_V;
|
||||
F_stat_F() { V_stat_V.st_mode = 0; }" > $tmp.c
|
||||
if $cc -c $tmp.c >/dev/null
|
||||
then echo "$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
22
cde/programs/dtksh/ksh93/src/lib/libast/features/preroot.sh
Normal file
22
cde/programs/dtksh/ksh93/src/lib/libast/features/preroot.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
: $XConsortium: preroot.sh /main/2 1996/05/10 16:43:41 drk $
|
||||
: generate preroot features
|
||||
eval $1
|
||||
shift
|
||||
if /etc/preroot / /bin/echo >/dev/null
|
||||
then cat <<!
|
||||
#pragma prototyped
|
||||
|
||||
#define FS_PREROOT 1 /* preroot enabled */
|
||||
#define PR_BASE "CCS" /* preroot base env var */
|
||||
#define PR_COMMAND "/etc/preroot" /* the preroot command */
|
||||
#define PR_REAL "/dev/.." /* real root pathname */
|
||||
#define PR_SILENT "CCSQUIET" /* no command trace */
|
||||
|
||||
extern char* getpreroot(char*, const char*);
|
||||
extern int ispreroot(const char*);
|
||||
extern int realopen(const char*, int, int);
|
||||
extern void setpreroot(char**, const char*);
|
||||
|
||||
!
|
||||
else echo "/* preroot not enabled */"
|
||||
fi
|
||||
36
cde/programs/dtksh/ksh93/src/lib/libast/features/sfio
Normal file
36
cde/programs/dtksh/ksh93/src/lib/libast/features/sfio
Normal file
@@ -0,0 +1,36 @@
|
||||
sys filio,ioctl
|
||||
|
||||
vax asm note{ register layout ok for vax string operations }end execute{
|
||||
main()
|
||||
{
|
||||
#ifndef vax
|
||||
return absurd = -1;
|
||||
#else
|
||||
register int r11, r10, r9, r8, r7, r6;
|
||||
r11 = r10 = r9 = r8 = r7 = r6 = -1;
|
||||
asm("clrw r11");
|
||||
asm("clrw r10");
|
||||
asm("clrw r9");
|
||||
asm("clrw r8");
|
||||
asm("clrw r7");
|
||||
asm("clrw r6");
|
||||
if(sizeof(int) != sizeof(char*) || r11 || r10 || r9 || r8 || r7 || r6 )
|
||||
return -1;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}end
|
||||
|
||||
i386 cvt note{ 386 native floating point conversions better than C }end link{
|
||||
main()
|
||||
{
|
||||
#ifndef i386
|
||||
return absurd = -1;
|
||||
#else
|
||||
ecvt();
|
||||
fcvt();
|
||||
strtod();
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
}end
|
||||
70
cde/programs/dtksh/ksh93/src/lib/libast/features/sig.sh
Normal file
70
cde/programs/dtksh/ksh93/src/lib/libast/features/sig.sh
Normal file
@@ -0,0 +1,70 @@
|
||||
: $XConsortium: sig.sh /main/2 1996/05/10 16:43:58 drk $
|
||||
: generate sig features
|
||||
eval $1
|
||||
shift
|
||||
echo "#include <signal.h>
|
||||
int xxx;" > $tmp.c
|
||||
$cc -c $tmp.c >/dev/null 2>$tmp.e
|
||||
echo "#pragma prototyped
|
||||
#if _DLL_INDIRECT_DATA && !_DLL
|
||||
#define sig_info (*_sig_info_)
|
||||
#else
|
||||
#define sig_info _sig_info_
|
||||
#endif
|
||||
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:hide kill killpg
|
||||
#else
|
||||
#define kill ______kill
|
||||
#define killpg ______killpg
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:nohide kill killpg
|
||||
#else
|
||||
#undef kill
|
||||
#undef killpg
|
||||
#endif
|
||||
#ifndef sigmask
|
||||
#define sigmask(s) (1<<((s)-1))
|
||||
#endif"
|
||||
echo "#include <signal.h>
|
||||
#ifdef TYPE
|
||||
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
|
||||
typedef TYPE (*Handler_t)(ARG);
|
||||
#else
|
||||
typedef TYPE (*Handler_t)();
|
||||
#endif
|
||||
#endif
|
||||
Handler_t f()
|
||||
{
|
||||
Handler_t handler;
|
||||
handler = signal(1, SIG_IGN);
|
||||
return(handler);
|
||||
}" > $tmp.c
|
||||
if $cc -c $tmp.c >/dev/null
|
||||
then :
|
||||
else e=`wc -l $tmp.e`
|
||||
for i in void int
|
||||
do for j in int,... ... int
|
||||
do $cc -c -DTYPE=$i -DARG=$j $tmp.c >/dev/null 2>$tmp.e || continue
|
||||
case `wc -l $tmp.e` in
|
||||
$e) break 2 ;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
echo "typedef $i (*Handler_t)($j);"
|
||||
fi
|
||||
echo '
|
||||
typedef struct
|
||||
{
|
||||
char** name;
|
||||
char** text;
|
||||
int sigmax;
|
||||
} Sig_info_t;
|
||||
|
||||
extern Sig_info_t sig_info;
|
||||
|
||||
extern int kill(pid_t, int);
|
||||
extern int killpg(pid_t, int);
|
||||
extern int sigunblock(int);'
|
||||
320
cde/programs/dtksh/ksh93/src/lib/libast/features/signal.c
Normal file
320
cde/programs/dtksh/ksh93/src/lib/libast/features/signal.c
Normal file
@@ -0,0 +1,320 @@
|
||||
/* $XConsortium: signal.c /main/2 1996/05/08 19:42:38 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 <signal.h>
|
||||
|
||||
struct _m_
|
||||
{
|
||||
char* text;
|
||||
char* name;
|
||||
int value;
|
||||
};
|
||||
|
||||
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
static struct _m_ map[] =
|
||||
{
|
||||
#ifdef SIGABRT
|
||||
"Abort", "ABRT", SIGABRT,
|
||||
#endif
|
||||
#ifdef SIGAIO
|
||||
"Asynchronous I/O", "AIO", SIGAIO,
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
"Alarm call", "ALRM", SIGALRM,
|
||||
#endif
|
||||
#ifdef SIGAPOLLO
|
||||
"Apollo", "APOLLO", SIGAPOLLO,
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
"Bus error", "BUS", SIGBUS,
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
"Child status change", "CHLD", SIGCHLD,
|
||||
#endif
|
||||
#ifdef SIGCLD
|
||||
"Death of child", "CLD", SIGCLD,
|
||||
#endif
|
||||
#ifdef SIGCONT
|
||||
"Stopped process continued", "CONT", SIGCONT,
|
||||
#endif
|
||||
#ifdef SIGDANGER
|
||||
"System crash soon", "DANGER", SIGDANGER,
|
||||
#endif
|
||||
#ifdef SIGDEBUG
|
||||
"Debug trap", "DEBUG", SIGDEBUG,
|
||||
#endif
|
||||
#ifdef SIGDIL
|
||||
"DIL trap", "DIL", SIGDIL,
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
"EMT trap", "EMT", SIGEMT,
|
||||
#endif
|
||||
#ifdef SIGERR
|
||||
"ERR trap", "ERR", SIGERR,
|
||||
#endif
|
||||
#ifdef SIGEXIT
|
||||
"Exit", "EXIT", SIGEXIT,
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
"Floating exception", "FPE", SIGFPE,
|
||||
#endif
|
||||
#ifdef SIGFREEZE
|
||||
"CPR freeze", "FREEZE", SIGFREEZE,
|
||||
#endif
|
||||
#ifdef SIGHUP
|
||||
"Hangup", "HUP", SIGHUP,
|
||||
#endif
|
||||
#ifdef SIGILL
|
||||
"Illegal instruction", "ILL", SIGILL,
|
||||
#endif
|
||||
#ifdef SIGINT
|
||||
"Interrupt", "INT", SIGINT,
|
||||
#endif
|
||||
#ifdef SIGIO
|
||||
"IO possible", "IO", SIGIO,
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
"IOT trap", "IOT", SIGIOT,
|
||||
#endif
|
||||
#ifdef SIGKILL
|
||||
"Killed", "KILL", SIGKILL,
|
||||
#endif
|
||||
#ifdef SIGLAB
|
||||
"Security label changed", "LAB", SIGLAB,
|
||||
#endif
|
||||
#ifdef SIGLOST
|
||||
"Resources lost", "LOST", SIGLOST,
|
||||
#endif
|
||||
#ifdef SIGLWP
|
||||
"Thread event", "LWP", SIGLWP,
|
||||
#endif
|
||||
#ifdef SIGMIGRATE
|
||||
"Migrate process", "MIGRATE", SIGMIGRATE,
|
||||
#endif
|
||||
#ifdef SIGPHONE
|
||||
"Phone status change", "PHONE", SIGPHONE,
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
"Broken pipe", "PIPE", SIGPIPE,
|
||||
#endif
|
||||
#ifdef SIGPOLL
|
||||
"Poll event", "POLL", SIGPOLL,
|
||||
#endif
|
||||
#ifdef SIGPROF
|
||||
"Profile timer alarm", "PROF", SIGPROF,
|
||||
#endif
|
||||
#ifdef SIGPWR
|
||||
"Power fail", "PWR", SIGPWR,
|
||||
#endif
|
||||
#ifdef SIGQUIT
|
||||
"Quit", "QUIT", SIGQUIT,
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
"Memory fault", "SEGV", SIGSEGV,
|
||||
#endif
|
||||
#ifdef SIGSOUND
|
||||
"Sound completed", "SOUND", SIGSOUND,
|
||||
#endif
|
||||
#ifdef SIGSSTOP
|
||||
"Sendable stop", "SSTOP", SIGSSTOP,
|
||||
#endif
|
||||
#ifdef gould
|
||||
"Stack overflow", "STKOV", 28,
|
||||
#endif
|
||||
#ifdef SIGSTOP
|
||||
"Stopped (signal)", "STOP", SIGSTOP,
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
"Bad system call", "SYS", SIGSYS,
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
"Terminated", "TERM", SIGTERM,
|
||||
#endif
|
||||
#ifdef SIGTHAW
|
||||
"CPR thaw", "THAW", SIGTHAW,
|
||||
#endif
|
||||
#ifdef SIGTINT
|
||||
"Interrupt (terminal)", "TINT", SIGTINT,
|
||||
#endif
|
||||
#ifdef SIGTRAP
|
||||
"Trace trap", "TRAP", SIGTRAP,
|
||||
#endif
|
||||
#ifdef SIGTSTP
|
||||
"Stopped", "TSTP", SIGTSTP,
|
||||
#endif
|
||||
#ifdef SIGTTIN
|
||||
"Stopped (tty input)", "TTIN", SIGTTIN,
|
||||
#endif
|
||||
#ifdef SIGTTOU
|
||||
"Stopped (tty output)", "TTOU", SIGTTOU,
|
||||
#endif
|
||||
#ifdef SIGURG
|
||||
"Urgent IO", "URG", SIGURG,
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
"User signal 1", "USR1", SIGUSR1,
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
"User signal 2", "USR2", SIGUSR2,
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
"Virtual timer alarm", "VTALRM", SIGVTALRM,
|
||||
#endif
|
||||
#ifdef SIGWAITING
|
||||
"All threads blocked", "WAITING", SIGWAITING,
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
"Window change", "WINCH", SIGWINCH,
|
||||
#endif
|
||||
#ifdef SIGWIND
|
||||
"Window change", "WIND", SIGWIND,
|
||||
#endif
|
||||
#ifdef SIGWINDOW
|
||||
"Window change", "WINDOW", SIGWINDOW,
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
"CPU time limit", "XCPU", SIGXCPU,
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
"File size limit", "XFSZ", SIGXFSZ,
|
||||
#endif
|
||||
0
|
||||
};
|
||||
|
||||
#define RANGE_MIN (1<<14)
|
||||
#define RANGE_MAX (1<<13)
|
||||
#define RANGE_RT (1<<12)
|
||||
|
||||
#define RANGE_SIG (~(RANGE_MIN|RANGE_MAX|RANGE_RT))
|
||||
|
||||
static int index[64];
|
||||
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
|
||||
main()
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
int n;
|
||||
|
||||
k = 0;
|
||||
for (i = 0; map[i].name; i++)
|
||||
if ((j = map[i].value) > 0 && j < elementsof(index) && !index[j])
|
||||
{
|
||||
if (j > k) k = j;
|
||||
index[j] = i;
|
||||
}
|
||||
#ifdef SIGRTMIN
|
||||
i = SIGRTMIN;
|
||||
#ifdef SIGRTMAX
|
||||
j = SIGRTMAX;
|
||||
#else
|
||||
j = i;
|
||||
#endif
|
||||
if (j >= elementsof(index)) j = elementsof(index) - 1;
|
||||
if (i <= j && i > 0 && i < elementsof(index) && j > 0 && j < elementsof(index))
|
||||
{
|
||||
if (j > k) k = j;
|
||||
index[i] = RANGE_MIN | RANGE_RT;
|
||||
n = 1;
|
||||
while (++i < j)
|
||||
index[i] = RANGE_RT | n++;
|
||||
index[j] = RANGE_MAX | RANGE_RT | n;
|
||||
}
|
||||
#endif
|
||||
printf("#pragma prototyped\n");
|
||||
printf("#define SIG_MAX %d\n", k);
|
||||
printf("\n");
|
||||
printf("static const char* const sig_name[] =\n");
|
||||
printf("{\n");
|
||||
for (i = 0; i <= k; i++)
|
||||
if (!(j = index[i])) printf(" \"%d\",\n", i);
|
||||
else if (j & RANGE_RT)
|
||||
{
|
||||
if (j & RANGE_MIN) printf(" \"RTMIN\",\n");
|
||||
else if (j & RANGE_MAX) printf(" \"RTMAX\",\n");
|
||||
else printf(" \"RT%d\",\n", j & RANGE_SIG);
|
||||
}
|
||||
else printf(" \"%s\",\n", map[j].name);
|
||||
printf(" 0\n");
|
||||
printf("};\n");
|
||||
printf("\n");
|
||||
printf("static const char* const sig_text[] =\n");
|
||||
printf("{\n");
|
||||
for (i = 0; i <= k; i++)
|
||||
if (!(j = index[i])) printf(" \"Signal %d\",\n", i);
|
||||
else if (j & RANGE_RT) printf(" \"Realtime priority %d%s\",\n", j & RANGE_SIG, (j & RANGE_MIN) ? " (lo)" : (j & RANGE_MAX) ? " (hi)" : "");
|
||||
else printf(" \"%s\",\n", map[j].text);
|
||||
printf(" 0\n");
|
||||
printf("};\n");
|
||||
return(0);
|
||||
}
|
||||
39
cde/programs/dtksh/ksh93/src/lib/libast/features/time
Normal file
39
cde/programs/dtksh/ksh93/src/lib/libast/features/time
Normal file
@@ -0,0 +1,39 @@
|
||||
set prototyped
|
||||
hdr,sys time,times
|
||||
mem tm.tm_sec,timeval.tv_sec sys/time.h
|
||||
typ clock_t,time_t
|
||||
cat{
|
||||
#if !_typ_clock_t
|
||||
#define _typ_clock_t 1
|
||||
typedef unsigned long clock_t;
|
||||
#endif
|
||||
#if !_typ_time_t
|
||||
#define _typ_time_t 1
|
||||
typedef unsigned long time_t;
|
||||
#endif
|
||||
#if _sys_time
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if _hdr_time && !_mem_tm_sec_tm
|
||||
#include <time.h>
|
||||
#endif
|
||||
#if _sys_times
|
||||
#include <sys/times.h>
|
||||
#else
|
||||
struct tms
|
||||
{
|
||||
clock_t tms_utime;
|
||||
clock_t tms_stime;
|
||||
clock_t tms_cutime;
|
||||
clock_t tms_cstime;
|
||||
};
|
||||
extern clock_t times(struct tms*);
|
||||
#endif
|
||||
#if !_mem_tv_sec_timeval
|
||||
struct timeval
|
||||
{
|
||||
time_t tv_sec;
|
||||
time_t tv_usec;
|
||||
};
|
||||
#endif
|
||||
}end
|
||||
20
cde/programs/dtksh/ksh93/src/lib/libast/features/tty
Normal file
20
cde/programs/dtksh/ksh93/src/lib/libast/features/tty
Normal file
@@ -0,0 +1,20 @@
|
||||
set prototyped
|
||||
cat{
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:hide ioctl
|
||||
#else
|
||||
#define ioctl ______ioctl
|
||||
#endif
|
||||
}end
|
||||
one termio.h termios.h sys/termios.h sgtty.h sys/ttyio.h sys/ioctl.h
|
||||
cat{
|
||||
#if _sys_ioctl && !defined(_IOR)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:nohide ioctl
|
||||
#else
|
||||
#undef ioctl
|
||||
#endif
|
||||
extern int ioctl(int, int, ...);
|
||||
}end
|
||||
49
cde/programs/dtksh/ksh93/src/lib/libast/features/types
Normal file
49
cde/programs/dtksh/ksh93/src/lib/libast/features/types
Normal file
@@ -0,0 +1,49 @@
|
||||
typ dev_t,nlink_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef short $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ gid_t,mode_t,uid_t,wchar_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef unsigned short $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ pid_t,ssize_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef int $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ size_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef unsigned int $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ clock_t,ino_t,off_t,ptrdiff_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef long $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ time_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef unsigned long $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ div_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef struct { int quot; int rem; } $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ ldiv_t fail{
|
||||
echo "#ifndef $m"
|
||||
echo "#define $m 1"
|
||||
echo "typedef struct { long quot; long rem; } $v;"
|
||||
echo "#endif"
|
||||
}end
|
||||
typ long.double,long.long
|
||||
103
cde/programs/dtksh/ksh93/src/lib/libast/features/unistd.c
Normal file
103
cde/programs/dtksh/ksh93/src/lib/libast/features/unistd.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/* $XConsortium: unistd.c /main/2 1996/05/08 19:42:52 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
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:hide printf
|
||||
#else
|
||||
#define printf ______printf
|
||||
#endif
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
#define _POSIX_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "FEATURE/lib"
|
||||
#include "FEATURE/limits"
|
||||
#include "FEATURE/unistd.lcl"
|
||||
#include "FEATURE/types"
|
||||
|
||||
#if defined(__STDPP__directive) && defined(__STDPP__hide)
|
||||
__STDPP__directive pragma pp:nohide printf
|
||||
#endif
|
||||
|
||||
#if defined(__STDPP__hide) || defined(printf)
|
||||
#undef printf
|
||||
extern __MANGLE__ int printf __PROTO__((const char*, ...));
|
||||
#endif
|
||||
|
||||
#include "conflib.h"
|
||||
|
||||
main()
|
||||
{
|
||||
#include "confuni.h"
|
||||
return(0);
|
||||
}
|
||||
1
cde/programs/dtksh/ksh93/src/lib/libast/features/vmalloc
Normal file
1
cde/programs/dtksh/ksh93/src/lib/libast/features/vmalloc
Normal file
@@ -0,0 +1 @@
|
||||
lib vmalloc
|
||||
9
cde/programs/dtksh/ksh93/src/lib/libast/features/wait
Normal file
9
cde/programs/dtksh/ksh93/src/lib/libast/features/wait
Normal file
@@ -0,0 +1,9 @@
|
||||
lib wait,wait2,wait3,wait4,waitpid
|
||||
tst ok_wif sys/types.h sys/wait.h note{ posix wait macros ok }end compile{
|
||||
int ifexited = WIFEXITED(0);
|
||||
int exitstatus = WEXITSTATUS(0);
|
||||
int ifsignaled = WIFSIGNALED(0);
|
||||
int termsig = WTERMSIG(0);
|
||||
int ifstopped = WIFSTOPPED(0);
|
||||
int stopsig = WSTOPSIG(0);
|
||||
}end
|
||||
Reference in New Issue
Block a user