quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] Re: ftw removed; emacs mode; translations; ready for 0.4


From: Andreas Gruenbacher
Subject: Re: [Quilt-dev] Re: ftw removed; emacs mode; translations; ready for 0.43?
Date: Fri, 3 Feb 2006 10:45:58 +0100
User-agent: KMail/1.8.2

On Friday 03 February 2006 09:54, Jean Delvare wrote:
> While checking the original code and John's replacement proposal, I
> found that the original code doesn't seem to work for me:
>
>       /^$/    { exit (!mh || not_mh) }
>       END     { exit (!mh || not_mh) }
>       { if ($0 ~ /^[a-z]+:[ \t]/i)
>           mh = 1
>         else
>           not_mh = 1
>       }
>
> The "i" modifier after the regular expression doesn't work as expected,
> and seems to confuse gawk (3.1.5). In fact there is no way I could get
> the code snippet above to exit with success (0). Replacing
> /^[a-z]+:[ \t]/i with /^[A-Za-z]+:[ \t]/ made it work somewhat. But
> even then I'm not sure it does what we want it to do. Isn't a line like:
> Reply-To: address@hidden
> supposed to match the regular expression? It doesn't at the moment,
> because we don't allow dashes.
>
> So now I wonder, does the original code actually work for anyone?

Hm... correct. The i flag doesn't exist, and my stupid awk doesn't complain:

        $ echo x | awk '/a/i { print }'
        > x

The check obviously never did what it was meant to do. Unfortunately after 
fixing it recognizes `Aw: [patch] Fwd: Re: [patch 5/7] Fw: Subject of 5.diff' 
as a header line, and this causes the test to fail.

Let's remove this check, and see if the subjects generated will work well 
enough for us. It's only a simply heuristic after all...

> John, are you sure that the ~ construct, and not that trailing i, was
> confusing Sun's awk? According to my awk reference, ~ is a pretty
> standard construct.
>
> Anyway, this code seems to be overly complicated in the first place.
> What about this instead:
>
>       /^$/    { exit }
>       END     { exit (not_mh) }
>       !/^[A-Za-z-]+:[ \t]/    { not_mh=1 ; exit }

Almost...

Thanks,
Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]