summaryrefslogtreecommitdiff
path: root/tnslc/copy.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-06-29 20:15:46 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-06-29 20:15:46 -0400
commitfc5a382661262b4dac085d75739c4ac0601574a7 (patch)
treea705dcb7387e316a05c5162c0351488bd664e55a /tnslc/copy.tnsl
parent2572cd049ee5e1e2685b1abe6bfcfbb8aa988a71 (diff)
[TNSLC] General updates
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
+;/