diff --git a/parse-options.c b/parse-options.c
index 3b71fbb5410332a3f11ca0e450a614b3345a687b..d218122af5c2c0cddd857fce0ae5064bf32f6387 100644 (file)
--- a/parse-options.c
+++ b/parse-options.c
#include "cache.h"
#include "commit.h"
#include "cache.h"
#include "commit.h"
+static int parse_options_usage(const char * const *usagestr,
+ const struct option *opts);
+
#define OPT_SHORT 1
#define OPT_UNSET 2
#define OPT_SHORT 1
#define OPT_UNSET 2
abbrev_flags = flags;
continue;
}
abbrev_flags = flags;
continue;
}
+ /* negation allowed? */
+ if (options->flags & PARSE_OPT_NONEG)
+ continue;
/* negated and abbreviated very much? */
if (!prefixcmp("no-", arg)) {
flags |= OPT_UNSET;
/* negated and abbreviated very much? */
if (!prefixcmp("no-", arg)) {
flags |= OPT_UNSET;
exit(129);
}
exit(129);
}
-int parse_options_usage(const char * const *usagestr,
- const struct option *opts)
+void usage_msg_opt(const char *msg,
+ const char * const *usagestr,
+ const struct option *options)
+{
+ fprintf(stderr, "%s\n\n", msg);
+ usage_with_options(usagestr, options);
+}
+
+static int parse_options_usage(const char * const *usagestr,
+ const struct option *opts)
{
return usage_with_options_internal(usagestr, opts, 0);
}
{
return usage_with_options_internal(usagestr, opts, 0);
}
@@ -622,3 +636,10 @@ int parse_opt_with_commit(const struct option *opt, const char *arg, int unset)
commit_list_insert(commit, opt->value);
return 0;
}
commit_list_insert(commit, opt->value);
return 0;
}
+
+int parse_opt_tertiary(const struct option *opt, const char *arg, int unset)
+{
+ int *target = opt->value;
+ *target = unset ? 2 : 1;
+ return 0;
+}