k9core/src/echo.c

18 lines
349 B
C
Raw Normal View History

2020-06-01 19:37:33 +00:00
#include <stdio.h>
2020-06-03 04:32:38 +00:00
#include <string.h>
2020-06-01 19:37:33 +00:00
int
main(int argc, char *argv[])
{
2020-06-03 04:32:38 +00:00
int nflag;
if(strcmp(argv[1], "-n") == 0)
nflag = 1;
2020-06-01 19:40:22 +00:00
++argv;
2020-06-01 19:37:33 +00:00
while(*argv) {
(void)fputs(*argv, stdout); // Print argv
if(*++argv) putchar(' '); // If multiple things in argv, print a space between them.
}
2020-06-03 04:32:38 +00:00
if(nflag) putchar('\n');
2020-06-01 19:37:33 +00:00
return 0;
}