From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Ren=E9?= Scharfe Subject: [PATCH 5/5] grep: use parseopt Date: Thu, 07 May 2009 21:46:48 +0200 Message-ID: <1241725608.4772.11.camel@ubuntu.ubuntu-domain> References: <1241725380.4772.6.camel@ubuntu.ubuntu-domain> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Pierre Habouzit , Junio C Hamano To: Git Mailing List X-From: git-owner@vger.kernel.org Thu May 07 21:47:19 2009 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1M29Yr-0003a2-On for gcvg-git-2@gmane.org; Thu, 07 May 2009 21:47:18 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754083AbZEGTqw (ORCPT ); Thu, 7 May 2009 15:46:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753399AbZEGTqv (ORCPT ); Thu, 7 May 2009 15:46:51 -0400 Received: from india601.server4you.de ([85.25.151.105]:37380 "EHLO india601.server4you.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751994AbZEGTqu (ORCPT ); Thu, 7 May 2009 15:46:50 -0400 Received: from [10.0.1.101] (p57B7C554.dip.t-dialin.net [87.183.197.84]) by india601.server4you.de (Postfix) with ESMTPSA id 930C72F8003; Thu, 7 May 2009 21:46:49 +0200 (CEST) In-Reply-To: <1241725380.4772.6.camel@ubuntu.ubuntu-domain> X-Mailer: Evolution 2.26.1 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 --- builtin-grep.c | 406 +++++++++++++++++++++++++------------------------------- grep.h | 28 ++-- 2 files changed, 194 insertions(+), 240 deletions(-) diff --git a/builtin-grep.c b/builtin-grep.c index 620399f..169a91c 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