xref: /titanic_50/usr/src/ucbcmd/echo/echo.c (revision 965005c81e0f731867d47892b9fb677030b102df)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
17 
18 /*
19  * echo
20  */
21 #include <stdio.h>
22 
23 int
24 main(int argc, char *argv[])
25 {
26 	int i, nflg;
27 
28 	nflg = 0;
29 	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && !argv[1][2]) {
30 		nflg++;
31 		argc--;
32 		argv++;
33 	}
34 	for (i = 1; i < argc; i++) {
35 		(void) fputs(argv[i], stdout);
36 		if (i < argc-1)
37 			(void) putchar(' ');
38 	}
39 
40 	if (nflg == 0)
41 		(void) putchar('\n');
42 	return (0);
43 }
44