xref: /illumos-gate/usr/src/ucbcmd/echo/echo.c (revision 8c0b080c)
1 /*
2  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
7 /*	  All Rights Reserved  	*/
8 
9 
10 /*
11  * Copyright (c) 1980 Regents of the University of California.
12  * All rights reserved. The Berkeley software License Agreement
13  * specifies the terms and conditions for redistribution.
14  */
15 
16 /*
17  * echo
18  */
19 #include <stdio.h>
20 
21 int
main(int argc,char * argv[])22 main(int argc, char *argv[])
23 {
24 	int i, nflg;
25 
26 	nflg = 0;
27 	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && !argv[1][2]) {
28 		nflg++;
29 		argc--;
30 		argv++;
31 	}
32 	for (i = 1; i < argc; i++) {
33 		(void) fputs(argv[i], stdout);
34 		if (i < argc-1)
35 			(void) putchar(' ');
36 	}
37 
38 	if (nflg == 0)
39 		(void) putchar('\n');
40 	return (0);
41 }
42