some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.
If you want to try building on a platform that doesn't offer those
two functions, these are available:
define NOT_C99 /* to make some non-C99 code available */
define NEED_INDEX /* to define a macro for index() */
define NEED_RINDX /* to define a macro for rindex() */
This commit is contained in:
@@ -226,13 +226,6 @@
|
||||
#define HLOCK "NHPERM"
|
||||
#endif
|
||||
|
||||
#ifndef index
|
||||
#define index strchr
|
||||
#endif
|
||||
#ifndef rindex
|
||||
#define rindex strrchr
|
||||
#endif
|
||||
|
||||
#ifndef AMIGA
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
@@ -6,6 +6,15 @@
|
||||
#ifndef SYSTEM_H
|
||||
#define SYSTEM_H
|
||||
|
||||
#ifdef NOT_C99
|
||||
#ifdef NEED_INDEX
|
||||
#define strchr index
|
||||
#endif
|
||||
#ifdef NEED_RINDX
|
||||
#define strrchr rindex
|
||||
#endif
|
||||
#endif /* NOT_C99 */
|
||||
|
||||
#if !defined(WIN32)
|
||||
#if !defined(__cplusplus) && !defined(__GO32__)
|
||||
#define E extern
|
||||
@@ -414,6 +423,7 @@ E char *strcat(char *, const char *);
|
||||
E char *strncat(char *, const char *, size_t);
|
||||
E char *strpbrk(const char *, const char *);
|
||||
|
||||
#ifdef NOT_C99
|
||||
#if defined(SYSV) || defined(MICRO) || defined(MAC) || defined(VMS) \
|
||||
|| defined(HPUX)
|
||||
E char *strchr(const char *, int);
|
||||
@@ -422,6 +432,7 @@ E char *strrchr(const char *, int);
|
||||
E char *index(const char *, int);
|
||||
E char *rindex(const char *, int);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
E int strcmp(const char *, const char *);
|
||||
E int strncmp(const char *, const char *, size_t);
|
||||
@@ -440,10 +451,12 @@ E int strlen(const char *);
|
||||
|
||||
#endif /* !_XtIntrinsic_h_ && !POSIX_TYPES */
|
||||
|
||||
#ifdef NOT_C99
|
||||
#if defined(ULTRIX) && defined(__GNUC__)
|
||||
E char *index(const char *, int);
|
||||
E char *rindex(const char *, int);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Old varieties of BSD have char *sprintf().
|
||||
* Newer varieties of BSD have int sprintf() but allow for the old char *.
|
||||
|
||||
@@ -335,13 +335,15 @@
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#else /* therefore SYSV */
|
||||
#ifdef NOT_C99
|
||||
#ifndef index /* some systems seem to do this for you */
|
||||
#define index strchr
|
||||
#endif
|
||||
#ifndef rindex
|
||||
#define rindex strrchr
|
||||
#endif
|
||||
#endif
|
||||
#endif /* NOT_C99 */
|
||||
#endif /* SYSV */
|
||||
|
||||
/* Use the high quality random number routines. */
|
||||
/* the high quality random number routines */
|
||||
|
||||
@@ -262,9 +262,6 @@ typedef __mode_t mode_t;
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#define index strchr
|
||||
#define rindex strrchr
|
||||
|
||||
/* Use the high quality random number routines. */
|
||||
#ifndef USE_ISAAC64
|
||||
# if defined(RANDOM)
|
||||
|
||||
@@ -185,8 +185,6 @@ typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
#define NO_SIGNAL
|
||||
#define index strchr
|
||||
#define rindex strrchr
|
||||
|
||||
/* Time stuff */
|
||||
#include <time.h>
|
||||
|
||||
Reference in New Issue
Block a user