File: tit2phone.perl

package info (click to toggle)
chdrv 1.0.13-0.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,204 kB
  • ctags: 1,069
  • sloc: ansic: 8,972; perl: 412; asm: 234; makefile: 195; sh: 36
file content (78 lines) | stat: -rwxr-xr-x 996 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/perl
# -*- perl -*-

$stage = 1;	
		       
while(<>)			
{				
    if (/^#/){
	next;
    }
    if ($stage == 2)
    {
	if (/[ \t]*([^ \t]*)[ \t]*([^ \n\t]*)/)
	{
	    $arr1 = " ";
	    $arr2 = " ";
	    $arr3 = " ";
	    $arr4 = " ";
	    for($i=0;$i<length($1);$i++)
	    {
		$cc = substr($1,$i,1);
		if ($cc eq '\\')
		{
		    $cc = sprintf("%c",substr($1,$i+1,3));
		    $i +=3;
		}
		if (index("1qaz2wsxedcrfv5tgbyhn",$cc)>=0)
		{		 
		    $arr1=$cc;
		}
		elsif (index("ujm",$cc)>=0)
		{
		    $arr2=$cc;
		}
		elsif (index("8ik,9ol.0p;/-" , $cc)>=0)
		{
		    $arr3=$cc;
		}
		elsif(index("7 634",$cc)>=0)
		{
		    $arr4=$cc;
		}
	    }
	    if ($arr4 eq " ")
	    {			 
		$arr4 = ' ';
	    }
	    for($i=0;$i < length($2);$i+=2)
	    {
		if ($i +1 >= length($2))
		{
		    last;
		}
		$tt = $arr1.$arr2.$arr3.$arr4."|".substr($2,$i,2);	
		print "$tt\n";
	    }
	    next;
	}
    }
	
    if (/BEGINDICTIONARY/)
    {
	$stage = 2;
    }
}