From owner-p4-projects@FreeBSD.ORG Sat Jun 21 00:33:54 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2BF2A1065678; Sat, 21 Jun 2008 00:33:54 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E20351065677 for ; Sat, 21 Jun 2008 00:33:53 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B9FDE8FC0C for ; Sat, 21 Jun 2008 00:33:53 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m5L0Xr81020836 for ; Sat, 21 Jun 2008 00:33:53 GMT (envelope-from gabor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m5L0Xr5k020834 for perforce@freebsd.org; Sat, 21 Jun 2008 00:33:53 GMT (envelope-from gabor@freebsd.org) Date: Sat, 21 Jun 2008 00:33:53 GMT Message-Id: <200806210033.m5L0Xr5k020834@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gabor@freebsd.org using -f From: Gabor Kovesdan To: Perforce Change Reviews Cc: Subject: PERFORCE change 143851 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jun 2008 00:33:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=143851 Change 143851 by gabor@gabor_server on 2008/06/21 00:33:00 - GNU compatibility: better -d behaviour Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/grep.c#32 edit .. //depot/projects/soc2008/gabor_textproc/grep/grep.h#17 edit .. //depot/projects/soc2008/gabor_textproc/grep/util.c#31 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#32 (text+ko) ==== @@ -80,6 +80,7 @@ int Zflag; /* -Z: grep in gzipped file */ int bflag; /* -b: show block numbers for each match */ int cflag; /* -c: only show a count of matching lines */ +int dflag; /* -d: skip reading of directories */ int hflag; /* -h: don't print filename headers */ int iflag; /* -i: ignore case */ int lflag; /* -l: only show names of files with matches */ @@ -422,7 +423,10 @@ if (strcmp("recurse", optarg) == 0) { Hflag++; Rflag++; - } + } else if (strcmp("skip", optarg) == 0) + dflag++; + else if (strcmp("read", optarg) != 0) + usage(); break; case 'E': Fflag = Gflag = 0; ==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#17 (text+ko) ==== @@ -62,7 +62,7 @@ /* Command line flags */ extern int Aflag, Bflag, Dflag, Eflag, Fflag, Gflag, Hflag, Jflag, Lflag, Oflag, Pflag, Rflag, Zflag, - bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag, + bflag, cflag, dflag, hflag, iflag, lflag, mflag, nflag, oflag, qflag, sflag, vflag, wflag, xflag, nullflag; extern long long mcount; extern char *color, *label; ==== //depot/projects/soc2008/gabor_textproc/grep/util.c#31 (text+ko) ==== @@ -90,7 +90,7 @@ case FTS_DP: break; default: - if (Dflag || Rflag) { + if (Dflag || Rflag || dflag) { struct stat *finfo; if (!(finfo = malloc(sizeof(struct stat)))) @@ -105,7 +105,7 @@ free(finfo); break; } - if (Rflag && S_ISDIR(finfo->st_mode)) { + if ((Rflag || dflag) && S_ISDIR(finfo->st_mode)) { free(finfo); break; }