// CopyQuote.bcpl
// Last modified November 28, 1981  1:39 PM by Taft

// Bldr CopyQuote GP

external
[
// incoming procedures
SetupReadParam; ReadParam
Gets; Puts; Endofs; Closes; Ws; TruncateDiskStream

// incoming statics
ReadParamStream
]

let CopyQuote() be
[
SetupReadParam()
let s = ReadParam($O, -1)
if s eq -1 then CmdError()
let v = vec 127
if ReadParam($P, -1, v) eq -1 % v!0 ne "←"!0 then CmdError()
until Endofs(ReadParamStream) do
   [
   let c = Gets(ReadParamStream)
   unless c eq $*n & Endofs(ReadParamStream) do Puts(s, c)
   ]
TruncateDiskStream(s)
Closes(ReadParamStream); Closes(s)
]

and CmdError() be
[
Ws("Syntax is:*n")
Ws("*t>CopyQuote outputFile ← text to be put into outputFile*n")
abort
]