about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-28 21:26:03 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-28 21:26:03 -0700
commitdb9932a9e2470732e4f61ad6b711e89a92ce65fa (patch)
treebee3b945bc1afa7b805d14c266e9637112bdfd56 /apps
parent16cf82732affd9fe7bfc34f354ee8675b0668265 (diff)
downloadmu-db9932a9e2470732e4f61ad6b711e89a92ce65fa.tar.gz
6418
Diffstat (limited to 'apps')
-rw-r--r--apps/cat.mu16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/cat.mu b/apps/cat.mu
index 0fb68653..13bf007c 100644
--- a/apps/cat.mu
+++ b/apps/cat.mu
@@ -3,6 +3,18 @@
 
 fn main _args: (addr array (addr array byte)) -> exit-status/ebx: int {
   var args/eax: (addr array (addr array byte)) <- copy _args
-  var n/eax: int <- length args
-  exit-status <- copy n
+$main-body: {
+    var n/eax: int <- length args
+    compare n, 1
+    {
+      break-if->
+      print-string "usage: cat <filename>\n"
+      break $main-body
+    }
+    {
+      break-if-<=
+      print-string "success\n"
+    }
+  }
+  exit-status <- copy 0
 }