aboutsummaryrefslogtreecommitdiff
path: root/toys/yes.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-01-20 23:41:49 -0500
committerRob Landley <rob@landley.net>2007-01-20 23:41:49 -0500
commitb882f1e237a68c3d1074cbf63bda0207afb989b9 (patch)
tree92333d17d627b4d2d1a83f7fa2d8a410ce823ba7 /toys/yes.c
parenta4f79880620862949fabea684fe010f6e3cedb19 (diff)
downloadtoybox-b882f1e237a68c3d1074cbf63bda0207afb989b9.tar.gz
Add "yes" command.
Diffstat (limited to 'toys/yes.c')
-rw-r--r--toys/yes.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/toys/yes.c b/toys/yes.c
new file mode 100644
index 00000000..860c331c
--- /dev/null
+++ b/toys/yes.c
@@ -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;
+}