File: seg_list.pl

package info (click to toggle)
rccp 0.9-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 244 kB
  • ctags: 44
  • sloc: ansic: 830; sh: 256; perl: 134; makefile: 71
file content (39 lines) | stat: -rwxr-xr-x 756 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w
use Term::ANSIColor;
#qw(:constants);

open(DCTC, "cccp -gl|")
	or die "Can't open cccp: $!";


while(<DCTC>){

	@list = split(/\|/, $_);

	print color 'green'; #, "fuckit\n";
	print "GDLID: ", shift @list , "\n"; 
	print "Local Filename: ",  shift @list , "\n"; 
	print "File size: ", shift @list, "\n";
	print "Byte offset: ",  shift @list, "\n";
	print "Bytes recieved: ", shift @list, "\n";
	print "Start time: ", scalar(gmtime(shift(@list))), "\n";

	foreach $element (@list){	
		chomp $element;
		if($element){
			if($element =~ /T$/){
				print color 'blue';
			}
			elsif($element =~ /W$/){
				print color 'yellow';
			}
			else {
				print color 'red' ;
			}
        	print $element , "\n" ;
			print color 'reset';
		}
	}
}