From 8b8020c3019c61af75dc97aed6725b2f6f187f51 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 10 Apr 2017 19:24:41 -0700 Subject: [PATCH] Update modules --- modules/cdecl.pl | 4 +++- modules/compiler_vm/compiler_watchdog.pl | 1 + modules/compiler_vm/languages/c11.pm | 2 ++ modules/compiler_vm/languages/c89.pm | 2 ++ modules/compiler_vm/languages/c99.pm | 2 ++ modules/compiler_vm/languages/clang11.pm | 2 +- modules/compiler_vm/languages/server/_default.pm | 4 +++- modules/fnord.txt | 5 ----- modules/get_title.pl | 11 +++++++++-- modules/insult.pl | 4 ++-- modules/math.pl | 4 ++-- modules/qalc.pl | 5 +++++ 12 files changed, 32 insertions(+), 14 deletions(-) diff --git a/modules/cdecl.pl b/modules/cdecl.pl index b93a4ec8..c5bcbf1c 100755 --- a/modules/cdecl.pl +++ b/modules/cdecl.pl @@ -10,7 +10,7 @@ my $command = join(' ', @ARGV); my @args = split(' ', $command); # because @ARGV may be one quoted argument if (@args < 2) { - print "Usage: cdecl , see http://linux.die.net/man/1/cdecl\n"; + print "Usage: cdecl , see http://linux.die.net/man/1/cdecl (Don't use this command. Use `english` instead.)\n"; die; } @@ -23,3 +23,5 @@ chomp $result; $result =~ s/\n/, /g; print $result; +print " (Don't use this command. It can only handle C90 declarations -- poorly. Use `english` instead, which can translate any complete C11 code.)" if $result =~ m/^declare/; +print "\n"; diff --git a/modules/compiler_vm/compiler_watchdog.pl b/modules/compiler_vm/compiler_watchdog.pl index e6cc51d7..96366ce3 100755 --- a/modules/compiler_vm/compiler_watchdog.pl +++ b/modules/compiler_vm/compiler_watchdog.pl @@ -131,6 +131,7 @@ sub execute { gdb $in, "break $main_end\n"; gdb $in, "set width 0\n"; gdb $in, "set height 0\n"; + gdb $in, "catch exec\n"; gdb $in, "run < .input\n"; next; } diff --git a/modules/compiler_vm/languages/c11.pm b/modules/compiler_vm/languages/c11.pm index d1bc014f..f122ec8b 100755 --- a/modules/compiler_vm/languages/c11.pm +++ b/modules/compiler_vm/languages/c11.pm @@ -20,6 +20,8 @@ sub initialize { $self->{options_nopaste} = '-fno-diagnostics-show-caret'; $self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile'; + $self->{default_options} .= ' -Werror' if defined $self->{nick} && $self->{nick} =~ m/marchelz/i; + $self->{prelude} = <<'END'; #define _XOPEN_SOURCE 9001 #define __USE_XOPEN diff --git a/modules/compiler_vm/languages/c89.pm b/modules/compiler_vm/languages/c89.pm index 7079494f..f6c895d7 100755 --- a/modules/compiler_vm/languages/c89.pm +++ b/modules/compiler_vm/languages/c89.pm @@ -20,6 +20,8 @@ sub initialize { $self->{options_nopaste} = '-fno-diagnostics-show-caret'; $self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile'; + $self->{default_options} .= ' -Werror' if defined $self->{nick} && $self->{nick} =~ m/marchelz/i; + $self->{prelude} = <<'END'; #define _XOPEN_SOURCE 9001 #define __USE_XOPEN diff --git a/modules/compiler_vm/languages/c99.pm b/modules/compiler_vm/languages/c99.pm index 3e01686c..c562f31a 100755 --- a/modules/compiler_vm/languages/c99.pm +++ b/modules/compiler_vm/languages/c99.pm @@ -20,6 +20,8 @@ sub initialize { $self->{options_nopaste} = '-fno-diagnostics-show-caret'; $self->{cmdline} = 'gcc -ggdb -g3 $sourcefile $options -o $execfile'; + $self->{default_options} .= ' -Werror' if defined $self->{nick} && $self->{nick} =~ m/marchelz/i; + $self->{prelude} = <<'END'; #define _XOPEN_SOURCE 9001 #define __USE_XOPEN diff --git a/modules/compiler_vm/languages/clang11.pm b/modules/compiler_vm/languages/clang11.pm index 4ffe5930..21521b4e 100755 --- a/modules/compiler_vm/languages/clang11.pm +++ b/modules/compiler_vm/languages/clang11.pm @@ -15,7 +15,7 @@ sub initialize { $self->{sourcefile} = 'prog.c'; $self->{execfile} = 'prog'; - $self->{default_options} = '-Wextra -Wall -Wno-unused -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=integer,undefined,address,alignment'; + $self->{default_options} = '-Wextra -Wall -Wno-unused -Wno-unused-parameter -pedantic -Wfloat-equal -Wshadow -std=c11 -lm -Wfatal-errors -fsanitize=integer,undefined,address,alignment'; $self->{options_paste} = '-fcaret-diagnostics'; $self->{options_nopaste} = '-fno-caret-diagnostics'; $self->{cmdline} = 'clang-3.7 -ggdb -g3 $sourcefile $options -o $execfile'; diff --git a/modules/compiler_vm/languages/server/_default.pm b/modules/compiler_vm/languages/server/_default.pm index 78b38c8f..fcbbffa9 100755 --- a/modules/compiler_vm/languages/server/_default.pm +++ b/modules/compiler_vm/languages/server/_default.pm @@ -77,11 +77,13 @@ sub postprocess { my $input = $self->{input}; + print "writing input [$input]\n"; + $input =~ s/(?', '.input'); diff --git a/modules/fnord.txt b/modules/fnord.txt index 4e00bc81..2f4e4a78 100644 --- a/modules/fnord.txt +++ b/modules/fnord.txt @@ -62,8 +62,3 @@ Fnord invented the green hubcap. Fnord is why doctors ask you to cough. Fnord is the "ooo" in varooom of race cars. Fnord uses two bathtubs at once. -I cannot escape them / No matter how I try / They wait for me everywhere / I cannot pass them by. -Driving down the street / I see "Jesus Is Lord" / And then immediately after / I hear the word "FNORD!" -Innocuous sayings and parables / And on the evening news / I hear the word "FNORD!" / And suddenly I'm confused -I sit alone in my room / And I'm feeling rather bored / I turn on the tube and guess what / I hear the word "FNORD!" -"Don't see the fnords and they won't eat you" / That's what I've heard the wisemen say / But I can't get away from those beasties / There's just no fucking way. diff --git a/modules/get_title.pl b/modules/get_title.pl index c54a9f79..e8813add 100755 --- a/modules/get_title.pl +++ b/modules/get_title.pl @@ -22,6 +22,11 @@ my $arguments = join("%20", @ARGV); $arguments =~ s/\W$//; +exit if $arguments =~ m{https?://www.irccloud.com/pastebin}i; +exit if $arguments =~ m{http://smuj.ca/cl/}i; +exit if $arguments =~ m{/man\d+/}i; +exit if $arguments =~ m{godbolt.org}i; +exit if $arguments =~ m{man\.cgi}i; exit if $arguments =~ m{wandbox}i; exit if $arguments =~ m{ebay.com/itm}i; exit if $arguments =~ m/prntscr.com/i; @@ -136,11 +141,13 @@ if($distance / $length < 0.75) { exit if $t !~ m/\s/; # exit if title is only one word -- this isn't usually interesting exit if $t =~ m/^Gerrit Code Review$/i; exit if $t =~ m/^Public Git Hosting -/i; +exit if $t =~ m/git\/blob/i; +exit if $t =~ m/\sdiff\s/i; exit if $t =~ m/- Google Search$/; exit if $t =~ m/linux cross reference/i; exit if $t =~ m/screenshot/i; exit if $t =~ m/pastebin/i; -exit if $t =~ m/paste/i; +exit if $t =~ m/past[ea]/i; exit if $t =~ m/^[0-9_-]+$/; exit if $t =~ m/^Index of \S+$/; exit if $t =~ m/(?:sign up|login)/i; @@ -151,7 +158,7 @@ if (open my $fh, "<", "last-title-$nick.dat") { close $fh; chomp $data[0]; - exit if $t eq $data[0] and scalar gettimeofday - $data[1] < 60; + exit if $t eq $data[0] and scalar gettimeofday - $data[1] < 1800; } open my $fh, ">", "last-title-$nick.dat"; diff --git a/modules/insult.pl b/modules/insult.pl index 38a5b8ac..900e3a45 100755 --- a/modules/insult.pl +++ b/modules/insult.pl @@ -8,9 +8,9 @@ use strict; use LWP::Simple; $_ = get("http://www.randominsults.net/"); -if (/(.*?)<\/i><\/strong>/) { +if (/(.*?)\s*<\/i><\/strong>/) { print @ARGV,': ' if @ARGV; - print $1; + print "$1\n"; } else { print "yo momma!"; diff --git a/modules/math.pl b/modules/math.pl index a25777f1..cbfd97d6 100755 --- a/modules/math.pl +++ b/modules/math.pl @@ -25,8 +25,8 @@ if ($#ARGV < 0) $arguments = join(' ', @ARGV); my $orig_arguments = $arguments; -$arguments =~ s/(the )*answer.*question of life(,? the universe and everything)?\s?/42/gi; -$arguments =~ s/meaning of (life|existence|everything)?/42/gi; +$arguments =~ s/(the )*answer.*question of life(,? the universe,? and everything)?\s?/42/gi; +$arguments =~ s/(the )*meaning of (life|existence|everything)?/42/gi; if ($arguments =~ s/([^ ]+)\s+to\s+([^ ]+)\s*$//) { @conversion = ($1, $2); diff --git a/modules/qalc.pl b/modules/qalc.pl index 8b1b8357..c772a1ef 100755 --- a/modules/qalc.pl +++ b/modules/qalc.pl @@ -11,6 +11,11 @@ my $args = join ' ', @ARGV; my $qargs = quotemeta $args; +if (not length $qargs) { + print "Usage: qalc \n"; + exit; +} + my $result = `qalc $qargs`; $result =~ s/^.*approx.\s+//;