From owner-p4-projects@FreeBSD.ORG Fri Jun 6 12:31:23 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B91461065672; Fri, 6 Jun 2008 12:31:23 +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 7A73D106564A for ; Fri, 6 Jun 2008 12:31:23 +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 622B68FC20 for ; Fri, 6 Jun 2008 12:31:23 +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 m56CVNk8018897 for ; Fri, 6 Jun 2008 12:31:23 GMT (envelope-from gabor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m56CVNMb018895 for perforce@freebsd.org; Fri, 6 Jun 2008 12:31:23 GMT (envelope-from gabor@freebsd.org) Date: Fri, 6 Jun 2008 12:31:23 GMT Message-Id: <200806061231.m56CVNMb018895@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 143024 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: Fri, 06 Jun 2008 12:31:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=143024 Change 143024 by gabor@gabor_server on 2008/06/06 12:30:52 - Implement -d / --directories Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/grep.1#8 edit .. //depot/projects/soc2008/gabor_textproc/grep/grep.c#14 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/grep.1#8 (text+ko) ==== @@ -39,7 +39,7 @@ .Sh SYNOPSIS .Nm grep .Bk -words -.Op Fl abcDEFGHhIiLlnOoPqRSsUVvwxZ +.Op Fl abcdDEFGHhIiLlnOoPqRSsUVvwxZ .Op Fl A Ar num .Op Fl B Ar num .Op Fl C Ns Op Ar num @@ -158,8 +158,17 @@ The default action is `read', which means, that they are read as if they were normal files. If the action is set to `skip', devices will be silently skipped. -.\".It Fl d Ar action , Fl Fl directories Ns = Ns Ar action -.\"XXX: Unimplemented. +.It Fl d Ar action , Fl Fl directories Ns = Ns Ar action +Specify the demanded action for directories. +It is `read' by default, which means that the directories +are read in the same manner as normal files. +Other possible values are `skip' to silently ignore the +directories, and `recurse' to read them recursively, which +has the same effect as the +.Fl R +and +.Fl r +option. .It Fl E , Fl Fl extended-regexp Interpret .Ar pattern ==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#14 (text+ko) ==== @@ -124,13 +124,14 @@ { fprintf(stderr, "usage: %s [-abcDEFGHhIiLlnOoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n" - "\t[--color=when] [-e pattern] [-f file] [--binary-files=value] [--context[=num]]\n" - "\t[--label] [--line-buffered] [--null] [pattern] [file ...]\n" + "\t[-e pattern] [-f file] [--binary-files=value] [--color=when]\n" + "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n" + "\t[--null] [pattern] [file ...]\n" , __progname); exit(2); } -static char *optstr = "0123456789A:B:CD:EFGHILOPSRUVZabce:f:hilnoqrsuvwxy"; +static char *optstr = "0123456789A:B:CD:EFGHILOPSRUVZabcd:e:f:hilnoqrsuvwxy"; struct option long_options[] = { @@ -149,8 +150,7 @@ {"context", optional_argument, NULL, 'C'}, {"count", no_argument, NULL, 'c'}, {"devices", required_argument, NULL, 'D'}, -/* XXX: UNIMPLEMENTED - {"directories", required_argument, NULL, 'd'}, */ + {"directories", required_argument, NULL, 'd'}, {"extended-regexp", no_argument, NULL, 'E'}, {"regexp", required_argument, NULL, 'e'}, {"fixed-strings", no_argument, NULL, 'F'}, @@ -334,6 +334,10 @@ if (strcmp(optarg, "skip") == 0) Dflag = 1; break; + case 'd': + if (strcmp("recurse", optarg) == 0) + Rflag++; + break; case 'E': Fflag = Gflag = 0; Eflag++;