Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Copy-stdin-to-stdout/00-META.yaml
Normal file
2
Task/Copy-stdin-to-stdout/00-META.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
from: http://rosettacode.org/wiki/Copy_stdin_to_stdout
|
||||
2
Task/Copy-stdin-to-stdout/00-TASK.txt
Normal file
2
Task/Copy-stdin-to-stdout/00-TASK.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Create an executable file that copies stdin to stdout, or else a script that does so through the invocation of an interpreter at the command line.
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
READ: equ 3Fh ; MS-DOS syscalls
|
||||
WRITE: equ 40h
|
||||
BUFSZ: equ 4000h ; Buffer size
|
||||
cpu 8086
|
||||
bits 16
|
||||
org 100h
|
||||
section .text
|
||||
read: mov ah,READ ; Read into buffer
|
||||
xor bx,bx ; From STDIN (file 0)
|
||||
mov cx,BUFSZ
|
||||
mov dx,buffer
|
||||
int 21h
|
||||
test ax,ax ; Did we read anything?
|
||||
jz done ; If not, stop
|
||||
xchg ax,cx ; Write as many bytes as read
|
||||
mov ah,WRITE
|
||||
inc bx ; To STDOUT (file 1)
|
||||
int 21h
|
||||
jmp read ; Go get more
|
||||
done: ret
|
||||
section .bss
|
||||
buffer: resb BUFSZ
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
BEGIN
|
||||
BOOL at eof := FALSE;
|
||||
# set the EOF handler for stand in to a procedure that sets "at eof" to true #
|
||||
# and returns true so processing can continue #
|
||||
on logical file end( stand in, ( REF FILE f )BOOL: at eof := TRUE );
|
||||
# copy stand in to stand out #
|
||||
WHILE STRING line; read( ( line, newline ) ); NOT at eof DO write( ( line, newline ) ) OD
|
||||
END
|
||||
1
Task/Copy-stdin-to-stdout/AWK/copy-stdin-to-stdout.awk
Normal file
1
Task/Copy-stdin-to-stdout/AWK/copy-stdin-to-stdout.awk
Normal file
|
|
@ -0,0 +1 @@
|
|||
awk "//"
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
PROC Main()
|
||||
CHAR c
|
||||
|
||||
DO
|
||||
c=GetD(7)
|
||||
Put(c)
|
||||
UNTIL c=27 ;repeat until Esc key is pressed
|
||||
OD
|
||||
RETURN
|
||||
11
Task/Copy-stdin-to-stdout/Ada/copy-stdin-to-stdout.ada
Normal file
11
Task/Copy-stdin-to-stdout/Ada/copy-stdin-to-stdout.ada
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
with Ada.Text_IO;
|
||||
|
||||
procedure Copy_Stdin_To_Stdout is
|
||||
use Ada.Text_IO;
|
||||
C : Character;
|
||||
begin
|
||||
while not End_Of_File loop
|
||||
Get_Immediate (C);
|
||||
Put (C);
|
||||
end loop;
|
||||
end Copy_Stdin_To_Stdout;
|
||||
6
Task/Copy-stdin-to-stdout/Aime/copy-stdin-to-stdout.aime
Normal file
6
Task/Copy-stdin-to-stdout/Aime/copy-stdin-to-stdout.aime
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
file f;
|
||||
data b;
|
||||
f.stdin;
|
||||
while (f.b_line(b) ^ -1) {
|
||||
o_(b, "\n");
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
0 GET C$ : PRINT C$; : GOTO
|
||||
7
Task/Copy-stdin-to-stdout/BCPL/copy-stdin-to-stdout.bcpl
Normal file
7
Task/Copy-stdin-to-stdout/BCPL/copy-stdin-to-stdout.bcpl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
get "libhdr"
|
||||
|
||||
let start() be
|
||||
$( let c = rdch()
|
||||
if c = endstreamch then finish
|
||||
wrch(c)
|
||||
$) repeat
|
||||
|
|
@ -0,0 +1 @@
|
|||
,[.,]
|
||||
13
Task/Copy-stdin-to-stdout/C++/copy-stdin-to-stdout-1.cpp
Normal file
13
Task/Copy-stdin-to-stdout/C++/copy-stdin-to-stdout-1.cpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
int main() {
|
||||
using namespace std;
|
||||
noskipws(cin);
|
||||
copy(
|
||||
istream_iterator<char>(cin),
|
||||
istream_iterator<char>(),
|
||||
ostream_iterator<char>(cout)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
5
Task/Copy-stdin-to-stdout/C++/copy-stdin-to-stdout-2.cpp
Normal file
5
Task/Copy-stdin-to-stdout/C++/copy-stdin-to-stdout-2.cpp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << std::cin.rdbuf();
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.OpenStandardInput().CopyTo(Console.OpenStandardOutput());
|
||||
}
|
||||
}
|
||||
9
Task/Copy-stdin-to-stdout/C/copy-stdin-to-stdout.c
Normal file
9
Task/Copy-stdin-to-stdout/C/copy-stdin-to-stdout.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
char c;
|
||||
while ( (c=getchar()) != EOF ){
|
||||
putchar(c);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
10
Task/Copy-stdin-to-stdout/CLU/copy-stdin-to-stdout.clu
Normal file
10
Task/Copy-stdin-to-stdout/CLU/copy-stdin-to-stdout.clu
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
start_up = proc ()
|
||||
pi: stream := stream$primary_input()
|
||||
po: stream := stream$primary_output()
|
||||
|
||||
while true do
|
||||
stream$putc(po, stream$getc(pi))
|
||||
end except when end_of_file:
|
||||
return
|
||||
end
|
||||
end start_up
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
10 print chr$(147);chr$(14);
|
||||
11 print "0:Keyboard 1:Tape 2:RS-232 3:Screen"
|
||||
12 print "4-7:printers/plotters"
|
||||
13 print "8-11:Disk Drives":print
|
||||
14 input "Input device";d1
|
||||
15 if d1=1 or d1>=8 then input "Filename for INPUT";i$
|
||||
16 input "Output device";d2
|
||||
17 if d2=1 or d2>=8 then input "Filename for OUTPUT";o$
|
||||
18 print:if d1=0 then print "Begin typing. Press CTRL-Z to end.":print
|
||||
20 open 5,d1,5,"0:"+i$+",s,r"
|
||||
30 open 2,d2,2,"@0:"+o$+",s,w"
|
||||
40 get#5,a$
|
||||
50 if (d1=0 and a$=chr$(26)) or (d1>0 and st>0) then close 5:close 2:end
|
||||
60 print#2,a$;
|
||||
70 goto 40
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#|Loops while reading and collecting characters from STDIN until EOF (C-Z or C-D)
|
||||
Then concatenates the characters into a string|#
|
||||
(format t
|
||||
(concatenate 'string
|
||||
(loop for x = (read-char *query-io*) until (or (char= x #\Sub) (char= x #\Eot)) collecting x)))
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
STDIN.each_line do |line|
|
||||
puts line
|
||||
end
|
||||
7
Task/Copy-stdin-to-stdout/D/copy-stdin-to-stdout.d
Normal file
7
Task/Copy-stdin-to-stdout/D/copy-stdin-to-stdout.d
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import std.stdio;
|
||||
|
||||
void main() {
|
||||
foreach (line; stdin.byLine) {
|
||||
writeln(line);
|
||||
}
|
||||
}
|
||||
6
Task/Copy-stdin-to-stdout/Dart/copy-stdin-to-stdout.dart
Normal file
6
Task/Copy-stdin-to-stdout/Dart/copy-stdin-to-stdout.dart
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
void main() {
|
||||
var line = stdin.readLineSync();
|
||||
stdout.write(line);
|
||||
}
|
||||
22
Task/Copy-stdin-to-stdout/Draco/copy-stdin-to-stdout.draco
Normal file
22
Task/Copy-stdin-to-stdout/Draco/copy-stdin-to-stdout.draco
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
\util.g
|
||||
|
||||
proc nonrec main() void:
|
||||
char c;
|
||||
while
|
||||
/* I/O is line-oriented, so first read characters
|
||||
* from the current line while that is possible */
|
||||
while read(c) do write(c) od;
|
||||
case ioerror()
|
||||
/* Then once it fails, if the line is empty,
|
||||
* try to go to the next line. */
|
||||
incase CH_MISSING:
|
||||
readln();
|
||||
writeln();
|
||||
true
|
||||
/* If it failed for another reason (which will be
|
||||
* EOF here), stop. */
|
||||
default:
|
||||
false
|
||||
esac
|
||||
do od
|
||||
corp
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
let copy()=let n,g=stdin,stdout
|
||||
let rec fN()=match n.ReadLine() with "EOF"->g.Write "" |i->g.WriteLine i; fN()
|
||||
fN()
|
||||
copy()
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
USING: io kernel ;
|
||||
|
||||
[ read1 dup ] [ write1 ] while drop
|
||||
1
Task/Copy-stdin-to-stdout/Forth/copy-stdin-to-stdout.fth
Normal file
1
Task/Copy-stdin-to-stdout/Forth/copy-stdin-to-stdout.fth
Normal file
|
|
@ -0,0 +1 @@
|
|||
stdin slurp-fid type bye
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#define FIN 255 'eof is already a reserved word
|
||||
#include "crt/stdio.bi" 'provides the C functions getchar and putchar
|
||||
dim as ubyte char
|
||||
do
|
||||
char = getchar()
|
||||
if char = FIN then exit do else putchar(char)
|
||||
loop
|
||||
|
|
@ -0,0 +1 @@
|
|||
print[read["-"]]
|
||||
20
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-1.go
Normal file
20
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-1.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := bufio.NewReader(os.Stdin)
|
||||
w := bufio.NewWriter(os.Stdout)
|
||||
for {
|
||||
b, err := r.ReadByte()
|
||||
if err == io.EOF {
|
||||
return
|
||||
}
|
||||
w.WriteByte(b)
|
||||
w.Flush()
|
||||
}
|
||||
}
|
||||
10
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-2.go
Normal file
10
Task/Copy-stdin-to-stdout/Go/copy-stdin-to-stdout-2.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
io.Copy(os.Stdout, os.Stdin)
|
||||
}
|
||||
10
Task/Copy-stdin-to-stdout/Groovy/copy-stdin-to-stdout.groovy
Normal file
10
Task/Copy-stdin-to-stdout/Groovy/copy-stdin-to-stdout.groovy
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class StdInToStdOut {
|
||||
static void main(args) {
|
||||
try (def reader = System.in.newReader()) {
|
||||
def line
|
||||
while ((line = reader.readLine()) != null) {
|
||||
println line
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
main = interact id
|
||||
14
Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout.java
Normal file
14
Task/Copy-stdin-to-stdout/Java/copy-stdin-to-stdout.java
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import java.util.Scanner;
|
||||
|
||||
public class CopyStdinToStdout {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try (Scanner scanner = new Scanner(System.in);) {
|
||||
String s;
|
||||
while ( (s = scanner.nextLine()).compareTo("") != 0 ) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
process.stdin.resume();
|
||||
process.stdin.pipe(process.stdout);
|
||||
|
|
@ -0,0 +1 @@
|
|||
node index.js < index.js
|
||||
1
Task/Copy-stdin-to-stdout/Jq/copy-stdin-to-stdout.jq
Normal file
1
Task/Copy-stdin-to-stdout/Jq/copy-stdin-to-stdout.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
jq -Rr .
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
while !eof(stdin)
|
||||
write(stdout, read(stdin, UInt8))
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fun main() {
|
||||
var c: Int
|
||||
do {
|
||||
c = System.`in`.read()
|
||||
System.out.write(c)
|
||||
} while (c >= 0)
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
while { $stdin eof? not. } do {
|
||||
$stdout putln: $stdin readln.
|
||||
}.
|
||||
|
|
@ -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)
|
||||
).
|
||||
|
||||
%-----------------------------------------------------------------------------%
|
||||
1
Task/Copy-stdin-to-stdout/Nim/copy-stdin-to-stdout.nim
Normal file
1
Task/Copy-stdin-to-stdout/Nim/copy-stdin-to-stdout.nim
Normal file
|
|
@ -0,0 +1 @@
|
|||
stdout.write readAll(stdin)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
try
|
||||
while true do
|
||||
output_char stdout (input_char stdin)
|
||||
done
|
||||
with End_of_file -> ()
|
||||
1
Task/Copy-stdin-to-stdout/Ol/copy-stdin-to-stdout.ol
Normal file
1
Task/Copy-stdin-to-stdout/Ol/copy-stdin-to-stdout.ol
Normal file
|
|
@ -0,0 +1 @@
|
|||
(bytestream->port (port->bytestream stdin) stdout)
|
||||
10
Task/Copy-stdin-to-stdout/Pascal/copy-stdin-to-stdout.pas
Normal file
10
Task/Copy-stdin-to-stdout/Pascal/copy-stdin-to-stdout.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
program writeInput(input, output);
|
||||
var
|
||||
buffer: char;
|
||||
begin
|
||||
while not EOF() do
|
||||
begin
|
||||
read(buffer); // shorthand for read(input, buffer)
|
||||
write(buffer); // shorthand for write(output, buffer)
|
||||
end;
|
||||
end.
|
||||
1
Task/Copy-stdin-to-stdout/Perl/copy-stdin-to-stdout.pl
Normal file
1
Task/Copy-stdin-to-stdout/Perl/copy-stdin-to-stdout.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
perl -pe ''
|
||||
8
Task/Copy-stdin-to-stdout/Phix/copy-stdin-to-stdout.phix
Normal file
8
Task/Copy-stdin-to-stdout/Phix/copy-stdin-to-stdout.phix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(notonline)-->
|
||||
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
|
||||
<span style="color: #008080;">while</span> <span style="color: #004600;">true</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #004080;">integer</span> <span style="color: #000000;">ch</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">wait_key</span><span style="color: #0000FF;">()</span>
|
||||
<span style="color: #008080;">if</span> <span style="color: #000000;">ch</span><span style="color: #0000FF;">=</span><span style="color: #000000;">#1B</span> <span style="color: #008080;">then</span> <span style="color: #008080;">exit</span> <span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
|
||||
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">ch</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">while</span>
|
||||
<!--
|
||||
|
|
@ -0,0 +1 @@
|
|||
(in NIL (echo))
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
%File: stdin_to_stdout.pl
|
||||
:- initialization(main).
|
||||
|
||||
main :- repeat,
|
||||
get_char(X),
|
||||
put_char(X),
|
||||
X == end_of_file,
|
||||
fail.
|
||||
|
|
@ -0,0 +1 @@
|
|||
swipl stdin_to_stdout.pl
|
||||
6
Task/Copy-stdin-to-stdout/REXX/copy-stdin-to-stdout.rexx
Normal file
6
Task/Copy-stdin-to-stdout/REXX/copy-stdin-to-stdout.rexx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
/*REXX pgm copies data from STDIN──►STDOUT (default input stream──►default output stream*/
|
||||
|
||||
do while chars()\==0 /*repeat loop until no more characters.*/
|
||||
call charin , x /*read a char from the input stream. */
|
||||
call charout , x /*write " " " " output " */
|
||||
end /*while*/ /*stick a fork in it, we're all done. */
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#lang racket
|
||||
|
||||
(let loop ()
|
||||
(match (read-char)
|
||||
[(? eof-object?) (void)]
|
||||
[c (display c)
|
||||
(loop)]))
|
||||
|
|
@ -0,0 +1 @@
|
|||
raku -pe'.lines'
|
||||
|
|
@ -0,0 +1 @@
|
|||
.say for lines
|
||||
2
Task/Copy-stdin-to-stdout/Ring/copy-stdin-to-stdout.ring
Normal file
2
Task/Copy-stdin-to-stdout/Ring/copy-stdin-to-stdout.ring
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
? "give input: " give str
|
||||
? "output: " + str
|
||||
1
Task/Copy-stdin-to-stdout/Ruby/copy-stdin-to-stdout.rb
Normal file
1
Task/Copy-stdin-to-stdout/Ruby/copy-stdin-to-stdout.rb
Normal file
|
|
@ -0,0 +1 @@
|
|||
$stdout << $stdin.gets
|
||||
5
Task/Copy-stdin-to-stdout/Rust/copy-stdin-to-stdout.rust
Normal file
5
Task/Copy-stdin-to-stdout/Rust/copy-stdin-to-stdout.rust
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
use std::io;
|
||||
|
||||
fn main() {
|
||||
io::copy(&mut io::stdin().lock(), &mut io::stdout().lock());
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object CopyStdinToStdout extends App {
|
||||
io.Source.fromInputStream(System.in).getLines().foreach(println)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
scala -e "io.Source.fromInputStream(System.in).getLines().foreach(println)"
|
||||
3
Task/Copy-stdin-to-stdout/Scheme/copy-stdin-to-stdout.ss
Normal file
3
Task/Copy-stdin-to-stdout/Scheme/copy-stdin-to-stdout.ss
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(do ((c (read-char) (read-char)))
|
||||
((eof-object? c) 'done)
|
||||
(display c))
|
||||
1
Task/Copy-stdin-to-stdout/Sed/copy-stdin-to-stdout.sed
Normal file
1
Task/Copy-stdin-to-stdout/Sed/copy-stdin-to-stdout.sed
Normal file
|
|
@ -0,0 +1 @@
|
|||
sed -e ''
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
$ include "seed7_05.s7i";
|
||||
include "fileutil.s7i";
|
||||
|
||||
const proc: main is func
|
||||
begin
|
||||
copyFile(IN, OUT);
|
||||
end func;
|
||||
13
Task/Copy-stdin-to-stdout/Smalltalk/copy-stdin-to-stdout.st
Normal file
13
Task/Copy-stdin-to-stdout/Smalltalk/copy-stdin-to-stdout.st
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"using Stream class's bulk copy method:"
|
||||
Stdin copyToEndInto:Stdout.
|
||||
|
||||
"line wise"
|
||||
[Stdin atEnd] whileFalse:[ Stdout nextPutLine:(Stdin nextLine) ].
|
||||
|
||||
"character wise"
|
||||
[Stdin atEnd] whileFalse:[ Stdout nextPut:(Stdin next) ].
|
||||
|
||||
"no EOF test, but handle EOF Exception"
|
||||
[
|
||||
[ Stdout nextPut:(Stdin next) ] loop.
|
||||
] on: StreamError do:[]
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
fun copyLoop () =
|
||||
case TextIO.input TextIO.stdIn of
|
||||
"" => ()
|
||||
| tx => copyLoop (TextIO.output (TextIO.stdOut, tx))
|
||||
|
||||
val () = copyLoop ()
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Loop [] []
|
||||
go Loop
|
||||
4
Task/Copy-stdin-to-stdout/Tcl/copy-stdin-to-stdout.tcl
Normal file
4
Task/Copy-stdin-to-stdout/Tcl/copy-stdin-to-stdout.tcl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
package require Tcl 8.5
|
||||
|
||||
chan copy stdin stdout
|
||||
# fcopy stdin stdout for older versions
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
do
|
||||
s=wscript.stdin.readline
|
||||
wscript.stdout.writeline s
|
||||
loop until asc(left(s,1))=26
|
||||
11
Task/Copy-stdin-to-stdout/Wren/copy-stdin-to-stdout.wren
Normal file
11
Task/Copy-stdin-to-stdout/Wren/copy-stdin-to-stdout.wren
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import "io" for Stdin, Stdout
|
||||
|
||||
Stdin.isRaw = true // prevents echoing to the terminal
|
||||
while (true) {
|
||||
var byte = Stdin.readByte() // read a byte from stdin
|
||||
if (byte == 13) break // break when enter key pressed
|
||||
System.write(String.fromByte(byte)) // write the byte (in string form) to stdout
|
||||
Stdout.flush() // flush output
|
||||
}
|
||||
System.print()
|
||||
Stdin.isRaw = false
|
||||
5
Task/Copy-stdin-to-stdout/XPL0/copy-stdin-to-stdout.xpl0
Normal file
5
Task/Copy-stdin-to-stdout/XPL0/copy-stdin-to-stdout.xpl0
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
int C;
|
||||
loop [C:= ChIn(1);
|
||||
if C = $1A \EOF\ then quit;
|
||||
ChOut(0, C);
|
||||
]
|
||||
1
Task/Copy-stdin-to-stdout/Zkl/copy-stdin-to-stdout.zkl
Normal file
1
Task/Copy-stdin-to-stdout/Zkl/copy-stdin-to-stdout.zkl
Normal file
|
|
@ -0,0 +1 @@
|
|||
zkl --eval "File.stdout.write(File.stdin.read())"
|
||||
Loading…
Add table
Add a link
Reference in a new issue