3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-17 17:39:43 +01:00
pbot/modules/cdecl.pl
2014-06-05 21:45:25 +00:00

22 lines
441 B
Perl
Executable File

#!/usr/bin/perl -w
# quick and dirty by :pragma
my $command = join(' ', @ARGV);
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;
my $result = `/usr/bin/cdecl -c $command`;
chomp $result;
$result =~ s/\n/, /g;
print $result;