diff options
Diffstat (limited to 'tools-util.h')
-rw-r--r-- | tools-util.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools-util.h b/tools-util.h index dcca376b..dca9be29 100644 --- a/tools-util.h +++ b/tools-util.h @@ -47,6 +47,8 @@ struct stat xfstat(int); _ret; \ }) +int printf_pad(unsigned pad, const char * fmt, ...); + enum units { BYTES, SECTORS, @@ -151,4 +153,18 @@ char *dev_to_name(dev_t); char *dev_to_path(dev_t); char *dev_to_mount(char *); +#define args_shift(_nr) \ +do { \ + argc -= (_nr); \ + argv += (_nr); \ +} while (0) + +#define arg_pop() \ +({ \ + char *_ret = argc ? argv[0] : NULL; \ + if (_ret) \ + args_shift(1); \ + _ret; \ +}) + #endif /* _TOOLS_UTIL_H */ |