From 3e230fa1b2ba3aa1a207c4399a1b93e41b103dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 7 May 2009 21:46:48 +0200 Subject: grep: use parseopt Convert git-grep to parseopt. The bitfields in struct grep_opt are converted to full ints, increasing its size. This shouldn't be a problem as there is only a single instance in memory. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin-grep.c | 406 +++++++++++++++++++++++++-------------------------------- 1 file changed, 180 insertions(+), 226 deletions(-) (limited to 'builtin-grep.c') diff --git a/builtin-grep.c b/builtin-grep.c index 620399f9a..169a91c17 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -10,6 +10,7 @@ #include "tag.h" #include "tree-walk.h" #include "builtin.h" +#include "parse-options.h" #include "grep.h" #ifndef NO_EXTERNAL_GREP @@ -20,6 +21,11 @@ #endif #endif +static char const * const grep_usage[] = { + "git grep [options] [-e] [...] [[--] path...]", + NULL +}; + static int grep_config(const char *var, const char *value, void *cb) { struct grep_opt *opt = cb; @@ -559,15 +565,86 @@ static int grep_object(struct grep_opt *opt, const char **paths, die("unable to grep from object of type %s", typename(obj->type)); } -static const char builtin_grep_usage[] = -"git grep