]> pd.if.org Git - pdutils/blobdiff - posix/echo/echo.c
rename utils to posix
[pdutils] / posix / echo / echo.c
diff --git a/posix/echo/echo.c b/posix/echo/echo.c
new file mode 100644 (file)
index 0000000..1c22080
--- /dev/null
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int ac, char *av[]) {
+       int nl = 1;
+       int as = 1;
+       int i;
+
+       if (ac && !strcmp(av[1], "-n")) {
+               as++;
+               nl=0;
+       }
+
+       for (i=as; i < ac; i++) {
+               printf("%s%s", i > as ? " " : "", av[i]);
+       }
+
+       if (nl) printf("\n");
+
+       exit(0);
+}