diff toys/yes.c @ 74:dfe99495acbc

Add "yes" command.
author Rob Landley <rob@landley.net>
date Sat, 20 Jan 2007 23:41:49 -0500
parents
children bb6048c923ec
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toys/yes.c	Sat Jan 20 23:41:49 2007 -0500
@@ -0,0 +1,21 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * hello.c - A hello world program.
+ */
+
+#include "toys.h"
+
+int yes_main(void)
+{
+	for (;;) {
+		int i;
+		for (i=0; toys.optargs[i]; i++) {
+			if (i) xputc(' ');
+			xprintf("%s", toys.optargs[i]);
+		}
+		if (!i) xputc('y');
+		xputc('\n');
+	}
+
+	return 0;
+}