summaryrefslogtreecommitdiff
path: root/udev.h
diff options
context:
space:
mode:
Diffstat (limited to 'udev.h')
-rw-r--r--udev.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/udev.h b/udev.h
index 5737c84c9d..9327e90913 100644
--- a/udev.h
+++ b/udev.h
@@ -97,6 +97,12 @@ do { \
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;