#!/bin/sh
if [ $# -lt 1 ]; then
- echo "usage: sztest [-H HEADER] TYPE [CCFLAGS...]" >&2
+ echo "usage: sztest [-H SYS-HEADER] [-L LOCAL-HEADER] TYPE [CCFLAGS...]" >&2
exit 1
fi
-headers=
+sheaders=
+lheaders=
while [ "${1:0:1}" = "-" ]; do
opt="$1"
shift
case "$opt" in
"-H")
- headers="$headers $1"
+ sheaders="$sheaders $1"
+ shift
+ ;;
+ "-L")
+ lheaders="$lheaders $1"
shift
;;
esac
#include <unistd.h>
#include <sys/stat.h>
EOF
-for header in $headers; do
+for header in $sheaders; do
echo "#include <$header>" >>"$file.c"
done
+for header in $lheaders; do
+ echo "#include \"$header\"" >>"$file.c"
+done
cat >>"$file.c" <<EOF
int main(int argc, char **argv)
{
}
EOF
-if ! gcc "$@" -g -Wall -o "$file" "$file.c"; then
+if ! gcc "$@" -iquote. -g -Wall -o "$file" "$file.c"; then
rm -f "$file" "$file.c"
exit 1
fi