# HG changeset patch # User HackBot # Date 1365897591 0 # Node ID a52927edc8becae44cc5ef870a957edc82247ca4 # Parent 7d8769931924e8b339faa96240223db383d4445e mv gccrun bin/ && chmod +x bin/gccrun diff -r 7d8769931924 -r a52927edc8be bin/gccrun --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/gccrun Sat Apr 13 23:59:51 2013 +0000 @@ -0,0 +1,48 @@ +#!/bin/sh + +if [ "$#" = 0 ]; then + echo "usage: $0 [-w wrapper] " >&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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +main(int argc, char *argv[], char *envp[]) +{ + $1; + return 0; +} +EOF +shift +if ! gcc -o "$f/command" "$f/command.c" $@; then + exit 1 +fi +if [ -n "$wrapper" ]; then + $wrapper "$f/command" +else + "$f/command" +fi +r=$? +rm -r "$f" +exit $r \ No newline at end of file diff -r 7d8769931924 -r a52927edc8be gccrun --- a/gccrun Sat Apr 13 23:59:36 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -#!/bin/sh - -if [ "$#" = 0 ]; then - echo "usage: $0 [-w wrapper] " >&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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int -main(int argc, char *argv[], char *envp[]) -{ - $1; - return 0; -} -EOF -shift -if ! gcc -o "$f/command" "$f/command.c" $@; then - exit 1 -fi -if [ -n "$wrapper" ]; then - $wrapper "$f/command" -else - "$f/command" -fi -r=$? -rm -r "$f" -exit $r \ No newline at end of file