summaryrefslogtreecommitdiff
path: root/ipl/progs/what.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/progs/what.icn')
-rw-r--r--ipl/progs/what.icn69
1 files changed, 69 insertions, 0 deletions
diff --git a/ipl/progs/what.icn b/ipl/progs/what.icn
new file mode 100644
index 0000000..9b0bbe9
--- /dev/null
+++ b/ipl/progs/what.icn
@@ -0,0 +1,69 @@
+############################################################################
+#
+# File: what.icn
+#
+# Subject: Program to identify source-code information
+#
+# Author: Phillip Lee Thomas
+#
+# Date: May 2, 2001
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# Writes all strings beginning with "@" followed by "(#)"
+# and ending with null, newline, quotes, greater-than
+# or backslash. Follows UNIX what conventions.
+#
+############################################################################
+#
+# Requires: Tested with DOS, AIX UNIX
+#
+############################################################################
+#
+# Links: basename
+#
+############################################################################
+
+link basename
+
+procedure main(args)
+ local ID, line, terminator, key, f, fin, here
+
+ ID := "@(#)what.icn (1.0) - plt - 2 May, 96"
+ ID := "@(#)-- Identify source code information."
+
+ line := ""
+ terminator := '\0\n\">\\' # ++ char(10)
+ key := "@" || "(#)"
+
+ if *args = 0 then {
+ write("Usage: ", basename(&progname, ".EXE"),
+ " file1 [file2 [file3]]")
+ exit(1)
+ }
+
+ while f := pop(args) do {
+ fin := open(f, "ru") | next
+ write(f, ":")
+
+ while line ||:= reads(fin, 32768) do {
+ line ? {
+ here := 1
+ every (tab(here := upto('@')) | next) do {
+ if match(key) then {
+ move(4)
+ write('\t', tab(here := upto(terminator)))
+ }
+ }
+ line := line[here:0]
+ } # line
+ } # while
+ close(fin)
+ } # while files
+ write("[Time: ", &time / 1000.0, " seconds.]")
+ exit(0)
+end