Skip to content

ArgCount

Description

Register a repeat counter. No value consumed; the target is incremented per occurrence. -vvv counts as three. Target must be one of the unsigned integer pointer types.

Usage example (from documentation)

  u32 verbose = 0;
  ArgCount(&p, "-v", "--verbose", &verbose, "verbose logging (repeatable)");

Usage example (Cross-references)

Usage examples (Cross-references)
    
        u32 verbose = 0;
        ArgCount(&p, "-v", "--verbose", &verbose, "v");
    
        char  *argv[] = {(char *)"prog", (char *)"-v", (char *)"-v", (char *)"-v"};
    
        u32 verbose = 0;
        ArgCount(&p, "-v", "--verbose", &verbose, "v");
    
        char  *argv[] = {(char *)"prog", (char *)"-vvv"};
        if (role == ARG_ROLE_COUNT && target.kind != ARG_KIND_U8 && target.kind != ARG_KIND_U16 &&
            target.kind != ARG_KIND_U32 && target.kind != ARG_KIND_U64) {
            LOG_FATAL("arg_register: ArgCount '{}' requires an unsigned-int* target", long_name ? long_name : short_name);
        }
        if (role == ARG_ROLE_POSITIONAL && !long_name) {
Last updated on