3 ###APPAUTHOR: xiaoranzzz
4 ###APPDATE: Fri Sep 21 22:33:33 2007
6 ###APPDESC: cat command source text
8 ###APPEXAMPLE: cmdcat cmdinfo
11 $ARGV[0]="--help" unless(@ARGV);
12 exit 0 unless(system("plhelp",$0,(@ARGV)));
14 my $support="application\/(x-awk|x-shellscript|text\/plain|x-perl)";
17 my $location=`which "$cmdname"`;
19 die("Command not found: $cmdname\n") unless($location);
20 my $info=`file -biL "$location"`;
24 my $format="%-15s%s\n";
25 printf STDERR
($format,"Name:",$cmdname);
26 printf STDERR
($format,"FileType:",$info);
27 printf STDERR
($format,"Location:",$location);
28 printf STDERR
($format,"LinkTo:",readlink($location)) if(-l
$location);
29 if ($info =~ m/^text\// or $info =~ m/$support/) {
30 system($editor,$location);
33 print STDERR
("Not supported type\n");
36 system($editor,$location) if (lc($answer) eq "y");