Dolda2000 GitWeb
/
utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a gitignore.
[utils.git]
/
tel2name
diff --git
a/tel2name
b/tel2name
index
562b133
..
1623d7c
100755
(executable)
--- a/
tel2name
+++ b/
tel2name
@@
-25,9
+25,7
@@
sub yplookup {
}
push @matches, $match;
}
}
push @matches, $match;
}
- for $match (@matches) {
- print "$match\n";
- }
+ return @matches;
}
sub wplookup {
}
sub wplookup {
@@
-49,9
+47,7
@@
sub wplookup {
}
push @matches, $match;
}
}
push @matches, $match;
}
- for $match (@matches) {
- print "$match\n";
- }
+ return @matches;
}
$tel = $ARGV[0];
}
$tel = $ARGV[0];
@@
-68,32
+64,47
@@
if(open NT, $ENV{"HOME"} . "/phone/nametab") {
$yppid = open YP, "-|";
if($yppid == 0) {
$yppid = open YP, "-|";
if($yppid == 0) {
- yplookup $tel;
+ $mod = 0;
+ bt: while(1) {
+ if(@matches = yplookup $tel) {
+ for $match (@matches) {
+ print $match;
+ print " ($tel)" if $mod;
+ print "\n";
+ }
+ last bt;
+ }
+ last bt if !($tel =~ /(.+)[^0](0*)$/);
+ $tel = $1 . "0" . $2;
+ $mod = 1;
+ }
exit 0;
}
$wppid = open WP, "-|";
if($wppid == 0) {
exit 0;
}
$wppid = open WP, "-|";
if($wppid == 0) {
- wplookup $tel;
+ for $match (wplookup $tel) {
+ print "$match\n";
+ }
exit 0;
}
binmode(YP, ":utf8");
binmode(WP, ":utf8");
exit 0;
}
binmode(YP, ":utf8");
binmode(WP, ":utf8");
-match: while(<
Y
P>) {
+match: while(<
W
P>) {
chomp;
for $prev (@matches) {
chomp;
for $prev (@matches) {
- next match if
$prev eq $_
;
+ next match if
(lc $prev) eq (lc $_)
;
}
}
+ print "$_\n";
+ flush;
push @matches, $_;
}
push @matches, $_;
}
-match: while(<
W
P>) {
+match: while(<
Y
P>) {
chomp;
for $prev (@matches) {
chomp;
for $prev (@matches) {
- next match if
$prev eq $_
;
+ next match if
(lc $prev) eq (lc $_)
;
}
}
+ print "$_\n";
+ flush;
push @matches, $_;
}
push @matches, $_;
}
-
-for $match (@matches) {
- print "$match\n";
-}