Skip argv 0 by default

This commit is contained in:
Nick Chambers 2022-06-19 04:02:11 -05:00
parent 4f2ec58b6e
commit f6fba0ac6b
2 changed files with 9 additions and 2 deletions

View File

@ -5,6 +5,8 @@
#include <gargoyle/sleuth.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

View File

@ -1,7 +1,12 @@
#include <gargoyle.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) {
const char *arg = **argv;