140 lines
3.3 KiB
C
140 lines
3.3 KiB
C
/*
|
|
* CDE - Common Desktop Environment
|
|
*
|
|
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
|
|
*
|
|
* These libraries and programs are free software; you can
|
|
* redistribute them and/or modify them under the terms of the GNU
|
|
* Lesser General Public License as published by the Free Software
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
* any later version.
|
|
*
|
|
* These libraries and programs are distributed in the hope that
|
|
* they will be useful, but WITHOUT ANY WARRANTY; without even the
|
|
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
* PURPOSE. See the GNU Lesser General Public License for more
|
|
* details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with these librararies and programs; if not, write
|
|
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
|
* Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
/* $XConsortium: std.h /main/3 1996/06/19 17:18:34 drk $ */
|
|
/* std.h -
|
|
Include standard header files.
|
|
*/
|
|
|
|
#ifndef STD_H
|
|
#define STD_H 1
|
|
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
#include <errno.h>
|
|
#include <assert.h>
|
|
#ifdef SUPPORT_SUBDOC
|
|
#include <signal.h>
|
|
#endif /* SUPPORT_SUBDOC */
|
|
|
|
#ifndef STDDEF_H_MISSING
|
|
#include <stddef.h>
|
|
#endif /* not STDDEF_H_MISSING */
|
|
|
|
#ifndef LIMITS_H_MISSING
|
|
#include <limits.h>
|
|
#endif /* not LIMITS_H_MISSING */
|
|
|
|
#ifndef UINT_MAX
|
|
#define UINT_MAX (sizeof(unsigned int) == 2 ? 0x7fff : \
|
|
(sizeof(unsigned int) == 4 ? 0x7fffffff : cant_guess_UINT_MAX))
|
|
#endif
|
|
|
|
#ifdef VARARGS
|
|
#include <varargs.h>
|
|
#else
|
|
#include <stdarg.h>
|
|
#endif
|
|
|
|
#ifdef BSD_STRINGS
|
|
#include <strings.h>
|
|
#define memcpy(to, from, n) bcopy(from, to, n)
|
|
#define memcmp(p, q, n) bcmp(p, q, n)
|
|
#define strchr(s, c) index(s, c)
|
|
#define strrchr(s, c) rindex(s, c)
|
|
#else /* not BSD_STRINGS */
|
|
#include <string.h>
|
|
#endif /* not BSD_STRINGS */
|
|
|
|
#ifdef STRERROR_MISSING
|
|
#ifdef USE_PROTOTYPES
|
|
extern char *strerror(int);
|
|
#else
|
|
extern char *strerror();
|
|
#endif
|
|
#endif /* STRERROR_MISSING */
|
|
|
|
#ifdef STDLIB_H_MISSING
|
|
UNIV malloc();
|
|
UNIV calloc();
|
|
UNIV realloc();
|
|
char *getenv();
|
|
long atol();
|
|
#else /* not STDLIB_H_MISSING */
|
|
#include <stdlib.h>
|
|
#endif /* not STDLIB_H_MISSING */
|
|
|
|
#ifdef REMOVE_MISSING
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif /* HAVE_UNISTD_H */
|
|
#define remove unlink
|
|
#endif /* REMOVE_MISSING */
|
|
|
|
#ifdef RAISE_MISSING
|
|
#ifdef HAVE_UNISTD_H
|
|
#include <unistd.h>
|
|
#endif /* HAVE_UNISTD_H */
|
|
#define raise(sig) kill(getpid(), sig)
|
|
#endif /* RAISE_MISSING */
|
|
|
|
#ifndef offsetof
|
|
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
|
#endif
|
|
|
|
#ifndef EXIT_FAILURE
|
|
#define EXIT_FAILURE 1
|
|
#endif
|
|
#ifndef EXIT_SUCCESS
|
|
#define EXIT_SUCCESS 0
|
|
#endif
|
|
|
|
#ifndef SEEK_SET
|
|
#define SEEK_SET 0
|
|
#define SEEK_CUR 1
|
|
#define SEEK_END 2
|
|
#endif
|
|
|
|
#ifdef FPOS_MISSING
|
|
typedef long fpos_t;
|
|
#define fsetpos(stream, pos) fseek(stream, *(pos), SEEK_SET)
|
|
#define fgetpos(stream, pos) ((*(pos) = ftell(stream)) == -1L)
|
|
#endif /* FPOS_MISSING */
|
|
|
|
/* Old BSD systems lack L_tmpnam and tmpnam(). This is a partial
|
|
emulation using mktemp(). It requires that the argument to tmpnam()
|
|
be non-NULL. */
|
|
|
|
#ifndef L_tmpnam
|
|
#define tmpnam_template "/tmp/sgmlsXXXXXX"
|
|
#define L_tmpnam (sizeof(tmpnam_template))
|
|
#undef tmpnam
|
|
#define tmpnam(buf) \
|
|
(mktemp(strcpy(buf, tmpnam_template)) == 0 || (buf)[0] == '\0' ? 0 : (buf))
|
|
#endif /* not L_tmpnam */
|
|
|
|
#ifndef errno
|
|
extern int errno;
|
|
#endif
|
|
|
|
#endif /* not STD_H */
|