Gentoo Archives: gentoo-dev

From: Georgi Georgiev <chutz@×××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Modular X plans
Date: Fri, 12 Aug 2005 05:00:51
Message-Id: 20050812045757.GB140303@lion.gg3.net
In Reply to: Re: [gentoo-dev] Modular X plans by Donnie Berkholz
1 maillog: 11/08/2005-21:06:34(-0700): Donnie Berkholz types
2 > Georgi Georgiev wrote:
3 > | As you can see, it's the "static" in the end of the line. Maybe you
4 > | should grep for "-static" instead.
5 >
6 > | - To avoid eventual problems with similarly named libraries (libpam and
7 > | libpam_misc for example; grepping for -lpam would also match
8 > | -lpam_misc) you could grep for "\<-l${libname}\>" instead. This would
9 > | also solve the space-or-tab problem.
10 >
11 > Try this one. It should address both issues.
12
13 I should have tested a bit more.
14
15 chutz@lion ~ $ echo 'a -lbcd' | grep -- '-l'
16 a -lbcd
17 chutz@lion ~ $ echo 'a -lbcd' | grep -- '\b-l'
18 chutz@lion ~ $ echo 'a lbcd' | grep -- '\bl'
19 a lbcd
20
21 It's the "-" that is not a part of a word. Any ideas? I guess the "\b"
22 after ${libname} is fine, but the one before the "-" is not. It's down
23 to [[:space:]]-l${libname}\b it seems. And hopefully there won't be any
24 any lines starting with "-l", or any "-llib" being quoted which is legal
25 but unmatchable. Ah, cannot grep be told that "-" is a valid "word"
26 symbol.
27
28 The only reason the script currently works is because:
29
30 grep '\b-l[[:alnum:]].*\b' ${1}
31
32 matches the "-l" in x86_64-pc-linux-gnu-gcc
33
34 You also do not need the ".*\b" in the above. The ".*\b" would always
35 match until the last word on the line (grep doesn't do greedy wildcard
36 matching), and since it would *always* match, there is no need in
37 matching at all.
38
39 --
40 \ Georgi Georgiev \ Try the Moo Shu Pork. It is especially \
41 / chutz@×××.net / good today. /
42 \ +81(90)2877-8845 \ \