Enhance to allow for command line definitions. This makes it easier
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 15 Feb 1991 00:51:05 +0000 (00:51 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Fri, 15 Feb 1991 00:51:05 +0000 (00:51 +0000)
to share a source that works for pcc, gcc, and Vax-11 C (VMS).

v7/src/microcode/s/ultrix.m4

index 7e926e3b04d1c3e187ac9e5d99c157e18d7cf2ce..a7634fe873c73fbbdbcf9f3a760cd1b2679701dd 100755 (executable)
@@ -1,4 +1,27 @@
 #!/bin/csh -f
-# $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/ultrix.m4,v 1.3 1990/08/14 18:20:07 cph Rel $
-# Postprocessing to make m4 work correctly under Ultrix.
-cc -E $* | sed -e '/^#/D' | m4 | sed -e 's/@/$/g' -e 's/^\f$//'
+# $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/s/Attic/ultrix.m4,v 1.4 1991/02/15 00:51:05 jinx Exp $
+# Postprocessing to make m4 work correctly under Ultrix & BSD.
+
+if ($#argv == 0) then
+  sed -e '/^#/D' | m4 | sed -e 's/@/$/g' -e 's/^\f$//'
+else
+  set tmpfil = "m4.tmp"
+  set seen_input = 0
+  rm -f "$tmpfil"
+  
+  while ($#argv != 0)
+    if ("$argv[1]" == "-P") then
+      echo "$argv[2]" >> "$tmpfil"
+      shift
+    else
+      set seen_input = 1
+      sed -e '/^#/D' < "$argv[1]" >> "$tmpfil"
+    endif
+    shift
+  end
+  if ($seen_input == 0) then
+    sed -e '/^#/D' >> "$tmpfil"
+  endif
+  m4 < "$tmpfil" | sed -e 's/@/$/g' -e 's/^\f$//'
+  rm -f "$tmpfil"
+endif