From c77a1e252be396d8f47d80608dc0123cb370ed9e Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Wed, 23 Sep 2015 11:29:22 +0200 Subject: 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. --- arg.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 arg.h (limited to 'arg.h') diff --git a/arg.h b/arg.h new file mode 100644 index 0000000..92a313f --- /dev/null +++ b/arg.h @@ -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 + -- cgit v1.2.3