summaryrefslogtreecommitdiff
path: root/util/sbase/echo.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/sbase/echo.c')
-rw-r--r--util/sbase/echo.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/util/sbase/echo.c b/util/sbase/echo.c
new file mode 100644
index 00000000..a5526311
--- /dev/null
+++ b/util/sbase/echo.c
@@ -0,0 +1,24 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
+#include <string.h>
+#include "util.h"
+
+int
+main(int argc, char *argv[])
+{
+ int nflag = 0;
+
+ argv0 = *argv, argv0 ? (argc--, argv++) : (void *)0;
+
+ if (*argv && !strcmp(*argv, "-n")) {
+ nflag = 1;
+ argc--, argv++;
+ }
+
+ for (; *argv; argc--, argv++)
+ putword(stdout, *argv);
+ if (!nflag)
+ putchar('\n');
+
+ return fshut(stdout, "<stdout>");
+}