compat.h has a section 'extra headers', move inttypes.h there

This commit is contained in:
tg 2006-08-16 00:00:24 +00:00
parent 78cb0de69c
commit 11282be59d
2 changed files with 71 additions and 4 deletions

70
compat.h Normal file
View File

@ -0,0 +1,70 @@
/* $MirOS: src/bin/mksh/compat.h,v 1.2 2006/08/16 00:00:24 tg Exp $ */
/* Part I: extra headers */
#if defined(__sun__) || defined(__INTERIX)
#include <sys/mkdev.h>
#endif
#if defined(__Plan9__)
#include <inttypes.h>
#endif
#if !defined(__OpenBSD__) && !defined(__CYGWIN__)
#include <ulimit.h>
#endif
#if defined(__sun__) || defined(__gnu_linux__)
#include <values.h>
#endif
/* Part II: extra macros */
#ifndef timeradd
#define timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#endif
#ifndef timersub
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
#endif
#ifndef S_ISTXT
#define S_ISTXT 0001000 /* sticky bit */
#endif
/* Part III: OS-dependent additions */
#if defined(__gnu_linux__)
size_t strlcat(char *, const char *, size_t);
size_t strlcpy(char *, const char *, size_t);
#endif
#if defined(__sun__)
size_t confstr(int, char *, size_t);
#endif
#if defined(__gnu_linux__) || defined(__sun__) || defined(__CYGWIN__)
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
mode_t getmode(const void *, mode_t);
void *setmode(const char *);
#endif
#if defined(__INTERIX)
#define makedev(x,y) mkdev((x),(y))
extern int __cdecl seteuid(uid_t);
extern int __cdecl setegid(gid_t);
#endif

5
sh.h
View File

@ -8,7 +8,7 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.34 2006/08/15 23:54:09 tg Exp $"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.35 2006/08/16 00:00:24 tg Exp $"
#include <sys/param.h>
@ -27,9 +27,6 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#if defined(__Plan9__)
#include <inttypes.h>
#endif
#include <libgen.h>
#include <limits.h>
#if !defined(__sun__)