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
/
streamer.icn
< prev
next >
Wrap
Text File
|
2000-07-29
|
1KB
|
53 lines
############################################################################
#
# File: streamer.icn
#
# Subject: Program to append lines of file into one long line
#
# Author: Ralph E. Griswold
#
# Date: June 12, 1995
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program outputs one long line obtained by concatenating the
# lines of the input file.
#
# The supported options are:
#
# -l i stop when line reaches or exceeds i; default no limit
# -s s insert s after each line; default no separator
#
# Separators are counted in the length limit.
#
############################################################################
#
# Links: options
#
############################################################################
link options
procedure main(args)
local opts, length, line, limit, sep, ssize
opts := options(args, "l+s:")
limit := opts["l"]
sep := \opts["s"] | ""
ssize := *sep
length := 0
while line := writes(read(), sep) do {
length +:= *line + ssize
if length >= \limit then break
}
write()
end