xref: /titanic_51/usr/src/ucbcmd/echo/echo.c (revision 1a7c1b724419d3cb5fa6eea75123c6b2060ba31b)
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 		fputs(argv[i], stdout);
36 		if (i < argc-1)
37 			putchar(' ');
38 	}
39 	if(nflg == 0)
40 		putchar('\n');
41 	return (0);
42 }
43