test_utils: Indent and prefix test topics
[nagios-reports-module.git] / ndbneb.h
blob63bb95b61afc5973b2bd28e1ffc364576b6e0c2f
1 /*
2 * globally useful cruft goes here
3 */
5 #ifndef _NDBNEB_H_
6 #define _NDBNEB_H_
8 #define _GNU_SOURCE 1
10 #include <stdio.h>
12 #ifndef __GNUC__
13 # define __attribute__(x)
14 #endif
16 #define prefixcmp(a, b) strncmp(a, b, strlen(b))
17 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
18 #define ISSPACE(c) (c == ' ' || c == '\t')
21 * finds the next word in a comma-separated list.
22 * if there are multiple commas between each word,
23 * it will return a pointer to the second one
25 static inline char *next_word(char *str)
27 while (*str && *str != ',' && !ISSPACE(*str))
28 str++;
30 if (!*str)
31 return NULL;
33 do {
34 while (ISSPACE(*str))
35 str++;
37 if (*str == ',') {
38 str++;
39 while (ISSPACE(*str))
40 str++;
41 break;
43 } while (*str++);
45 if (*str)
46 return str;
48 return NULL;
50 #endif