Dolda2000 GitWeb
/
utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1c2fdcc
)
sztest: Added local headers option.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 20 Apr 2010 02:08:54 +0000
(
04:08
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Tue, 20 Apr 2010 02:08:54 +0000
(
04:08
+0200)
sztest
patch
|
blob
|
blame
|
history
diff --git
a/sztest
b/sztest
index
fd7505c
..
2393971
100755
(executable)
--- a/
sztest
+++ b/
sztest
@@
-1,17
+1,22
@@
#!/bin/sh
if [ $# -lt 1 ]; then
#!/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
exit 1
fi
-headers=
+sheaders=
+lheaders=
while [ "${1:0:1}" = "-" ]; do
opt="$1"
shift
case "$opt" in
"-H")
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
shift
;;
esac
@@
-26,9
+31,12
@@
cat >"$file.c" <<EOF
#include <unistd.h>
#include <sys/stat.h>
EOF
#include <unistd.h>
#include <sys/stat.h>
EOF
-for header in $headers; do
+for header in $
s
headers; do
echo "#include <$header>" >>"$file.c"
done
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)
{
cat >>"$file.c" <<EOF
int main(int argc, char **argv)
{
@@
-37,7
+45,7
@@
int main(int argc, char **argv)
}
EOF
}
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
rm -f "$file" "$file.c"
exit 1
fi