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:
nhmall
2022-10-29 10:54:25 -04:00
parent 943c1bc3c3
commit 99a93fe50b
99 changed files with 463 additions and 460 deletions

View File

@@ -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 *.