diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-09-23 11:29:22 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-09-23 11:41:02 +0200 |
commit | c77a1e252be396d8f47d80608dc0123cb370ed9e (patch) | |
tree | c5b1897bfa0d08ba7280634495b2dfd765a4e609 /arg.h | |
parent | 24a662087135196fe58ac85265c5d1b9840c5a3b (diff) | |
download | mkinitfs-c77a1e252be396d8f47d80608dc0123cb370ed9e.tar.bz2 mkinitfs-c77a1e252be396d8f47d80608dc0123cb370ed9e.tar.xz |
add new tool nlplug-findfs
nlplug-findfs is a tool that will help us to find a given filesystem
using coldplug. The only reason that initramfs exist in first place is
to set up a rootfs and switch to it. The nlplug-findfs will handle
coldplug events til a given filesystem/device is found and then mount
it.
Diffstat (limited to 'arg.h')
-rw-r--r-- | arg.h | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -0,0 +1,39 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef __ARG_H__ +#define __ARG_H__ + +#define USED(x) ((void)(x)) + +#define ARGBEGIN for (argv++, argc--;\ + argv[0] && argv[0][1]\ + && argv[0][0] == '-';\ + argc--, argv++) {\ + char _argc;\ + char **_argv;\ + if (argv[0][1] == '-' && argv[0][2] == '\0') {\ + argv++;\ + argc--;\ + break;\ + }\ + for (argv[0]++, _argv = argv; argv[0][0];\ + argv[0]++) {\ + if (_argv != argv)\ + break;\ + _argc = argv[0][0];\ + switch (_argc) + +#define ARGEND }\ + USED(_argc);\ + }\ + USED(argv);\ + USED(argc); + +#define EARGF(x) ((argv[1] == NULL)? ((x), abort(), (char *)0) :\ + (argc--, argv++, argv[0])) + +#endif + |