mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-10 20:12:35 +01:00
35 lines
635 B
Perl
35 lines
635 B
Perl
|
#!/usr/bin/perl -w
|
||
|
|
||
|
# quick and dirty by :pragma
|
||
|
|
||
|
|
||
|
if ($#ARGV < 0) {
|
||
|
print "For help with cdecl, see http://linux.die.net/man/1/cdecl\n";
|
||
|
die;
|
||
|
}
|
||
|
|
||
|
my $command = join(' ', @ARGV);
|
||
|
|
||
|
$command =~ s/-[^ ]+//g;
|
||
|
$command =~ s/\\//g;
|
||
|
$command =~ s/;/\\;/g;
|
||
|
$command =~ s/\(/\\(/g;
|
||
|
$command =~ s/\)/\\)/g;
|
||
|
$command =~ s/\$/\\\$/g;
|
||
|
$command =~ s/\[/\\[/g;
|
||
|
$command =~ s/\]/\\]/g;
|
||
|
$command =~ s/\|/\\|/g;
|
||
|
$command =~ s/'/\\'/g;
|
||
|
$command =~ s/`/\\`/g;
|
||
|
$command =~ s/,/\\,/g;
|
||
|
$command =~ s/\*/\\*/g;
|
||
|
$command =~ s/\?/\\?/g;
|
||
|
|
||
|
#print "[$command]\n";
|
||
|
my $result = `/usr/bin/cdecl -c $command`;
|
||
|
|
||
|
chomp $result;
|
||
|
$result =~ s/\n/, /g;
|
||
|
|
||
|
print $result;
|