Mercurial > repo
view bin/gccrun @ 5353:6b53d28db718
<oren> ` echo \'welcome | sed -e "s/th/\xce\xb8/g;s/ch/\xcf\x87/g;s/q/\xce\xba\xcf\x85/;s/w/\xce\xbf\xcf\x85/g;s/W/\xce\x9f\xcf\x85/g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/\xce\x91\xce\x92\xce\x9a\xce\x94\xce\x95\xce\xa6\xce\x93\xce\x97\xce\x99\xce\xaa\xce\x9a\xce\x9b\xce\x9c\xce\x9d\xce\x9f\xce\xa0\xce\xa8\xce\xa1\xce\xa3\xce\xa4\xce\xa5\xce\x92\xce\xa9\xce\x9e\xce\x97\xce\x96\xce\xb1\xce\xb2\xce\xba\xce\xb4\xce\xb5\xcf\x86\xce\xb3\xce\xb7\xce\xb9\xcf\x8a\xce\xba\xce\xbb\xce\xbc\xce\xbd\xce\xbf\xcf\x80\xcf\x88\xcf\x81\xcf\x83\xcf\x84\xcf\x85\xce\xb2\xcf\x89\xce\xbe\xce\xb7\xce\xb6/"\' >bin/\xce\xbf\xcf\x85\xce\xb5\xce\xbb\xce\xba\xce\xbf\xce\xbc\xce\xb5
author | HackBot |
---|---|
date | Mon, 04 May 2015 22:58:48 +0000 |
parents | 7f957c1f4661 |
children |
line wrap: on
line source
#!/bin/sh if [ "$#" = 0 ]; then echo "usage: $0 [-w wrapper] <C code...>" >&2 exit 1 fi if [ "$1" = -w ]; then wrapper="$2" shift 2 fi f=$(mktemp -d -t gccrun.XXXXXXXX) || exit 1 cat > "$f/command.c" << EOF #define _GNU_SOURCE #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <sys/ptrace.h> #include <sys/syscall.h> #include <arpa/inet.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <math.h> int main(int argc, char *argv[], char *envp[]) { $1; return 0; } EOF shift if ! gcc -o "$f/command" "$f/command.c" $@ -lm; then exit 1 fi if [ -n "$wrapper" ]; then $wrapper "$f/command" else "$f/command" fi r=$? rm -r "$f" exit $r