X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev.h;h=9327e90913a9ca4d0355856528177ed3deca4b6b;hb=56c963dc4d8a65a8f2f23ae329f2088fabbf3303;hp=3b676acf40d99ab1a7a137dbbe49804b80f6ecde;hpb=3fe0734266becd2ebcb111b07c3e17b2a9780477;p=elogind.git diff --git a/udev.h b/udev.h index 3b676acf4..9327e9091 100644 --- a/udev.h +++ b/udev.h @@ -85,6 +85,24 @@ do { \ 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;