3
FWEB version 1.62 (September 25, 1998)
5
Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
7
@x-----------------------------------------------------------------------------
9
\Title{STRMAC.WEB} % Macros to help avoid spurious compiler warnings.
12
@* STRING MACROS. Here we define various macros that strictly speaking
13
shouldn't be necessary under a fully ANSI environment, but help in
14
preventing spurious compiler warnings about pointer conversions.
20
@ The make file produces \.{strmac.h} from this file.
25
@<String casting macros@>@;
27
#endif /* |_strmac_| */
30
@<String casting...@>=
32
#define ATOF(s) atof((CONST char *)(s))
33
#define ATOI(s) atoi((CONST char *)(s))
34
#define ATOL(s) atol((CONST char *)(s))
35
#define FGETS(s,n,stream) fgets((char *)(s),(int)(n),(FILE *)(stream))
36
#define FOPEN(name,iomode) fopen((char *)(name),(char *)(iomode))
37
#define GETENV(env) OC(getenv((char *)(env)))
38
#define MEMCMP(s1,s2,n) memcmp((CONST void *)(s1),(CONST void *)(s2),\
40
#define MEMSET(buffer,c,n) memset((void *)(buffer),(int)(c),(size_t)(n))
41
#define QSORT(array,number,size,comparison) qsort((void *)(array),\
42
(size_t)(number),(size_t)(size),\
43
(int (*)(CONST void *,CONST void *))(comparison))
44
#define STRCAT(dest,src) strcat((char *)(dest),(CONST char *)(src))
45
#define STRNCAT(dest,src,n) strncat((char *)(dest),(CONST char *)(src),\
47
#define STRPBRK(s1,s2) strpbrk((CONST char *)(s1),(CONST char *)(s2))
48
#define STRCHR(s,c) strchr((CONST char *)(s),(int)(c))
49
#define STRRCHR(s,c) strrchr((CONST char *)(s),(int)(c))
50
#define STRCMP(s1,s2) strcmp((CONST char *)(s1),(CONST char *)(s2))
51
#define STRNCMP(s1,s2,n) strncmp((CONST char *)(s1),(CONST char *)(s2),\
53
#define STRCPY(dest,src) strcpy((char *)(dest),(CONST char *)(src))
54
#define STRNCPY(dest,src,n) strncpy((char *)(dest),(CONST char *)(src),\
56
#define STRSPN(s1,s2) strspn((CONST char *)(s1),(CONST char *)(s2))
57
#define STRLEN(s) strlen((CONST char *)(s))
58
#define STRTOD(s,endptr) strtod((CONST char *)(s),(char **)(endptr))
59
#define STRTOL(s,endptr,radix) strtol((CONST char *)(s),\
60
(char **)(endptr),(int)(radix))