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