3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-18 01:49:53 +01:00
pbot/modules/cdecl.pl

22 lines
441 B
Perl
Raw Normal View History

#!/usr/bin/perl -w
# quick and dirty by :pragma
2014-06-05 23:45:25 +02:00
my $command = join(' ', @ARGV);
2014-06-05 23:45:25 +02:00
my @args = split(' ', $command); # because @ARGV may be one quoted argument
if (@args < 2) {
print "Usage: cdecl <explain|declare|cast|set|...> <code>, see http://linux.die.net/man/1/cdecl\n";
die;
}
$command = quotemeta($command);
$command =~ s/\\ / /g;
2014-06-05 23:45:25 +02:00
my $result = `/usr/bin/cdecl -c $command`;
chomp $result;
$result =~ s/\n/, /g;
print $result;