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