Permalink
Browse files

bcc: simplify exit trap, include stdint.h

  • Loading branch information...
1 parent 45fb997 commit 10fc95d304f3503f9ba4a5161cb241c2d5f4b35d @falconindy committed Sep 2, 2012
Showing with 9 additions and 13 deletions.
  1. +9 −13 bcc
View
22 bcc
@@ -1,33 +1,29 @@
#!/bin/sh
-CC="gcc -std=c99 -pipe -Wall -pedantic"
-CFLAGS="-O2"
-SRC=/tmp/tmp$$.c
-OUT=/tmp/tmp$$
+CC="gcc -std=c99"
+CFLAGS="-O2 -pipe -Wall -Wextra -pedantic"
+src=/tmp/tmp$$.c
+out=/tmp/tmp$$
-trap_exit() {
- [ -f "$OUT" ] && rm -f "$OUT"
- [ -f "$SRC" ] && rm -f "$SRC"
-}
-
-trap 'trap_exit' 0 TERM HUP QUIT INT
+trap 'rm -f "$out" "$src"' EXIT
-cat > "$SRC" <<HEREDOCTHEREDOCEVERYWHEREADOCDOC
+cat > "$src" <<HEREDOCTHEREDOCEVERYWHEREADOCDOC
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
#include <sys/stat.h>
#include <unistd.h>
-int main(int argc, char *argv[]) {
+int main(void) {
$@
return 0;
}
HEREDOCTHEREDOCEVERYWHEREADOCDOC
-$CC $CFLAGS $SRC -o "$OUT" && "$OUT"
+$CC $CFLAGS $src -o "$out" && "$out"

0 comments on commit 10fc95d

Please sign in to comment.