micro-utils/coreutils/echo.c

16 lines
357 B
C
Raw Normal View History

#include <stdio.h>
int main(const int argc, const char **argv) {
if (argc > 1) {
for (int i = 1; i < argc; i++) {
fputs(argv[i], stdout);
if (i < argc - 1)
putchar(' ');
}
}
// https://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html
// This version does not support -n option and escape-sequences
putchar('\n');
return 0;
}