summaryrefslogtreecommitdiff
path: root/tnslc/copy.tnsl
diff options
context:
space:
mode:
Diffstat (limited to 'tnslc/copy.tnsl')
-rw-r--r--tnslc/copy.tnsl30
1 files changed, 30 insertions, 0 deletions
diff --git a/tnslc/copy.tnsl b/tnslc/copy.tnsl
new file mode 100644
index 0000000..953a7c8
--- /dev/null
+++ b/tnslc/copy.tnsl
@@ -0,0 +1,30 @@
+/#
+ Proof of concept that the language can copy any file.
+
+ For testing with executibles to make sure that the language's current state
+ would be able to produce one from data alone.
+
+ Seems to work.
+#/
+
+/; main ({}{}charp args) [int]
+ /; if (len args < 2)
+ ;tnsl.io.println("Usage: copy [file to copy] [path to copy to]")
+ ;return 1
+ ;/
+
+ ;tnsl.io.File in = tnsl.io.readFile(args{0})
+ ;tnsl.io.File out = tnsl.io.writeFile(args{1})
+
+ /; loop (int chk = in.read(); chk !< 0) [chk = in.read()]
+ ;uint8 write = chk
+ ;out.write(write)
+ ;/
+
+ ;tnsl.io.println("Copy complete.")
+
+ ;in.close()
+ ;out.close()
+
+ ;return 0
+;/