home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
ipl
/
progs
/
what.icn
< prev
next >
Wrap
Text File
|
2001-05-02
|
2KB
|
70 lines
############################################################################
#
# 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