strncat(to, from, maxsize - strlen(to)-1); \
} while (0)
+#define strintcat(to, i) \
+do { \
+ to[sizeof(to)-1] = '\0'; \
+ snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \
+} while (0)
+
+#define strnintcat(to, i, maxsize) \
+do { \
+ to[maxsize-1] = '\0'; \
+ snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \
+} while (0)
+
+#define foreach_strpart(str, separator, pos, len) \
+ for(pos = 0, len = strcspn(str, separator); \
+ (pos) < strlen(str); \
+ pos = pos + (len) + 1, len = strcspn((str) + pos, separator)) \
+ if (len > 0)
+
static inline char *get_action(void)
{
char *action;