xref: /freebsd/contrib/one-true-awk/testdir/echo.c (revision 31ba4ce8898f9dfa5e7f054fdbc26e50a599a6e3)
1 #include <stdio.h>
2 #include <string.h>
3 
4 int main(int argc, char *argv[])
5 {
6 	int i, start, minusn;
7 
8 	start = 1;
9 	minusn = 0;
10 	if (argc > 1 && strcmp(argv[1], "-n") == 0) {
11 		start = 2;
12 		minusn = 1;
13 	}
14 
15 	for (i = start; i < argc; i++)
16 		printf("%s%s", argv[i], i==argc-1 ? "" : " ");
17 	if (minusn == 0)
18 		printf("\n");
19 }
20