summaryrefslogtreecommitdiff
path: root/cpp.sh
diff options
context:
space:
mode:
authorRobert de Bath <rdebath@poboxes.com>2002-06-08 09:02:15 +0200
committerLubomir Rintel <lkundrak@v3.sk>2013-10-23 23:37:27 +0200
commit9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6 (patch)
tree11028ecb8d89780260c4d0e5f6879f84ffac0b90 /cpp.sh
downloaddev86-9696d7b0e1f3a1b0f5fd4a0428eb75afe8ad4ed6.tar.gz
Import orig/unproto
Diffstat (limited to 'cpp.sh')
-rw-r--r--cpp.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/cpp.sh b/cpp.sh
new file mode 100644
index 0000000..a039146
--- /dev/null
+++ b/cpp.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# @(#) cpp.sh 1.3 92/01/15 21:53:22
+
+# Unprototypeing preprocessor for pre-ANSI C compilers. On some systems,
+# this script can be as simple as:
+#
+# /lib/cpp "$@" | unproto
+#
+# However, some cc(1) drivers specify output file names on the
+# preprocessor command line, so this shell script must be prepared to
+# intercept them. Depending on the driver program, the cpp options may
+# even go before or after the file name argument(s). The script below
+# tries to tackle all these cases.
+#
+# You may want to add -Ipath_to_stdarg.h_file, -Dvoid=, -Dvolatile=,
+# and even -D__STDC__.
+
+cpp_args=""
+
+while :
+do
+ case $1 in
+ "") break;;
+ -*) cpp_args="$cpp_args $1";;
+ *) cpp_args="$cpp_args $1"
+ case $2 in
+ ""|-*) ;;
+ *) exec 1> $2 || exit 1; shift;;
+ esac;;
+ esac
+ shift
+done
+
+/lib/cpp $cpp_args | unproto