1 #ifndef GIRSTRING_H_INCLUDED
2 #define GIRSTRING_H_INCLUDED
8 stripeq(const char * const comparand, const char * const comparator);
11 stripcaseeq(const char * const comparand, const char * const comparator);
14 stripcpy(char * dest, const char * source);
17 stripcasecpy(char * dest, const char * source);
20 stripdup(const char * const input);
23 strcasedup(const char input[]);
25 static __inline__ bool
26 streq(const char * const comparator,
27 const char * const comparand) {
29 return (strcmp(comparand, comparator) == 0);
32 static __inline__ const char *
33 sdup(const char * const input) {
34 return (const char *) strdup(input);
37 /* Copy string pointed by B to array A with size checking. */
38 #define SSTRCPY(A,B) \
39 (strncpy((A), (B), sizeof(A)), *((A)+sizeof(A)-1) = '\0')
40 #define SSTRCMP(A,B) \
41 (strncmp((A), (B), sizeof(A)))
43 /* Concatenate string B onto string in array A with size checking */
44 #define STRSCAT(A,B) \
45 (strncat((A), (B), sizeof(A)-strlen(A)), *((A)+sizeof(A)-1) = '\0')