-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat_appts
More file actions
executable file
·43 lines (42 loc) · 904 Bytes
/
Copy pathformat_appts
File metadata and controls
executable file
·43 lines (42 loc) · 904 Bytes
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
#!/usr/local/bin/perl
$file=shift;
if (length($file)==0){
open(FL,"</users/red/.appts") || die "Cannot open the .appts file\n";
}
else {
open(FL,"<$file") || die "Cannot open the $file file\n";
}
$state=0;
undef($major_class);
while (<FL>){
chop;
#print "Line: $_\n";
s/^==// && do {$major_class=$_;next;};
++$state;
if ($state == 1){
s/\n/ /;
tr/"/'/;
$title.=$_;
$endchar=substr($title,-1,1);
if ($endchar ne "'"){ $title.=" ";--$state; }
#print "$state,'$endchar':$title\n";
}
if ($state == 2){
s/^=//;
$class=$_ unless(defined($major_class));
if(defined($major_class)){
$class=$major_class;
++$state;
}
}
if ($state == 3){
$time=$_;
}
if ($state == 4){
print "$title:$class:$time\n";
$state=0;
$title="";
$class="";
$time="";
}
}