############################################################################ # # 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