darling/tools/valueof.sh

26 lines
240 B
Bash
Raw Normal View History

#!/bin/sh
set -e
cfile=/tmp/valueof.$$.c
include="$1"
var="$2"
cat > $cfile <<END
#include <stdio.h>
#include <$include>
int main()
{
printf("$var=%d\n", $var);
return 0;
}
END
2012-09-16 20:37:38 +00:00
gcc -w $3 $cfile -o $cfile.bin
$cfile.bin
rm $cfile*