Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,41 @@
|
|||
:- module stdin_to_stdout.
|
||||
:- interface.
|
||||
|
||||
:- import_module io.
|
||||
|
||||
:- pred main(io::di, io::uo) is det.
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
:- implementation.
|
||||
|
||||
:- import_module char.
|
||||
:- import_module list.
|
||||
:- import_module string.
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
|
||||
|
||||
|
||||
main(!IO) :-
|
||||
io.read_line_as_string(Result, !IO),
|
||||
(
|
||||
Result = ok(Line),
|
||||
io.write_string(Line, !IO),
|
||||
main(!IO)
|
||||
;
|
||||
Result = eof
|
||||
;
|
||||
Result = error(Error),
|
||||
io.error_message(Error, Message),
|
||||
io.input_stream_name(StreamName, !IO),
|
||||
io.progname("stdin_to_stdout", ProgName, !IO),
|
||||
io.write_strings([
|
||||
ProgName, ": ",
|
||||
"error reading from `", StreamName, "': \n\t",
|
||||
Message, "\n"
|
||||
], !IO)
|
||||
).
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
Loading…
Add table
Add a link
Reference in a new issue