mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +01:00
Allow #including <headers>
This commit is contained in:
parent
c93174ac15
commit
aaa6b2782d
@ -41,11 +41,15 @@ my $ua = LWP::UserAgent->new();
|
|||||||
$ua->agent("Mozilla/5.0");
|
$ua->agent("Mozilla/5.0");
|
||||||
push @{ $ua->requests_redirectable }, 'POST';
|
push @{ $ua->requests_redirectable }, 'POST';
|
||||||
|
|
||||||
if(($lang eq "C" or $lang eq "C++") and not $code =~ m/\w+ main\s?\([^)]+\)\s?{/) {
|
$code =~ s/#include <([^>]+)>/#include <$1>\n/g;
|
||||||
$code = "int main(void) { $code ; return 0; }";
|
|
||||||
|
if(($lang eq "C" or $lang eq "C++") and not $code =~ m/\w+ main\s?\([^)]*\)\s?{/) {
|
||||||
|
my $includes = '';
|
||||||
|
$includes = $1 if $code =~ s/^(#include.*>)//;
|
||||||
|
$code = "$includes\n int main(int argc, char **argv) { $code ; return 0; }";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $escaped_code = uri_escape($code, "\0-\377");
|
# my $escaped_code = uri_escape($code, "\0-\377");
|
||||||
|
|
||||||
my %post = ( 'lang' => $lang, 'code' => $code, 'private' => 'True', 'run' => 'True', 'submit' => 'Submit' );
|
my %post = ( 'lang' => $lang, 'code' => $code, 'private' => 'True', 'run' => 'True', 'submit' => 'Submit' );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user