Skip argv 0 by default
This commit is contained in:
parent
4f2ec58b6e
commit
f6fba0ac6b
2 changed files with 9 additions and 2 deletions
|
@ -5,6 +5,8 @@
|
||||||
#include <gargoyle/sleuth.h>
|
#include <gargoyle/sleuth.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
uint8_t gargoyle_digest_args(uint16_t optc, struct gargoyle_opt *optv, int *argc, char ***argv);
|
const uint8_t GARGOYLE_DIGEST_ALL = 1 << 0;
|
||||||
|
|
||||||
|
uint8_t gargoyle_digest_args(uint16_t optc, struct gargoyle_opt *optv, int *argc, char ***argv, uint8_t flags);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
#include <gargoyle.h>
|
#include <gargoyle.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
uint8_t gargoyle_digest_args(uint16_t optc, struct gargoyle_opt *optv, int *argc, char ***argv) {
|
uint8_t gargoyle_digest_args(uint16_t optc, struct gargoyle_opt *optv, int *argc, char ***argv, uint8_t flags) {
|
||||||
|
if(!(flags & GARGOYLE_DIGEST_ALL)) {
|
||||||
|
*argc -= 1;
|
||||||
|
*argv += 1;
|
||||||
|
}
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
const char *arg = **argv;
|
const char *arg = **argv;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue