about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
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
 }