Re: [PATCH/RFC 3/4] grep: introduce pattern which matches at line number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 2, 2011 at 15:33, Thiago Farina <tfransosi@xxxxxxxxx> wrote:
> On Mon, May 2, 2011 at 8:39 AM, Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> wrote:
>> Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>
>> ---
>> Âgrep.c | Â 33 +++++++++++++++++++++++++++++++++
>> Âgrep.h | Â Â7 +++++--
>> Â2 files changed, 38 insertions(+), 2 deletions(-)
>>
>> diff --git a/grep.c b/grep.c
>> index f21b022..cbb3757 100644
>> --- a/grep.c
>> +++ b/grep.c
>> @@ -87,6 +87,15 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
>> Â Â Â Â}
>> Â}
>>
>> +static void parse_lno(struct grep_pat *p, struct grep_opt *opt)
> Maybe parse_line_number?
>
>> +{
>> + Â Â Â char *eon;
>> +
>> + Â Â Â p->u.lno = strtoul(p->pattern, &eon, 10);
>> + Â Â Â if (*eon || p->u.lno == 0)
>> + Â Â Â Â Â Â Â die("'%s': Invalid number for line match", p->pattern);
>> +}
>> +
>> Âstatic struct grep_expr *compile_pattern_or(struct grep_pat **);
>> Âstatic struct grep_expr *compile_pattern_atom(struct grep_pat **list)
>> Â{
>> diff --git a/grep.h b/grep.h
>> index 9912c11..41821f3 100644
>> --- a/grep.h
>> +++ b/grep.h
>> @@ -10,7 +10,8 @@ enum grep_pat_token {
>> Â Â Â ÂGREP_OPEN_PAREN,
>> Â Â Â ÂGREP_CLOSE_PAREN,
>> Â Â Â ÂGREP_NOT,
>> - Â Â Â GREP_OR
>> + Â Â Â GREP_OR,
>> + Â Â Â GREP_LNO
>
> Maybe GREP_LINE_NR?
>
>
>> Â};
>>
>> Âenum grep_context {

Yeah, I must admit that these symbols should probably get a more
descriptive name.

Bert
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]