xref: /onnv-gate/usr/src/ucbcmd/echo/echo.c (revision 319:f5718580cc5e)
1216Sakaplan /*
2216Sakaplan  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3216Sakaplan  * Use is subject to license terms.
4216Sakaplan  */
5216Sakaplan 
60Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
70Sstevel@tonic-gate /*	  All Rights Reserved  	*/
80Sstevel@tonic-gate 
90Sstevel@tonic-gate 
100Sstevel@tonic-gate /*
110Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
120Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
130Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
140Sstevel@tonic-gate  */
150Sstevel@tonic-gate 
16216Sakaplan #pragma ident	"%Z%%M%	%I%	%E% SMI"
170Sstevel@tonic-gate 
180Sstevel@tonic-gate /*
190Sstevel@tonic-gate  * echo
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate #include <stdio.h>
220Sstevel@tonic-gate 
23216Sakaplan int
main(int argc,char * argv[])24216Sakaplan main(int argc, char *argv[])
250Sstevel@tonic-gate {
26216Sakaplan 	int i, nflg;
270Sstevel@tonic-gate 
280Sstevel@tonic-gate 	nflg = 0;
29*319Sgbrunett 	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && !argv[1][2]) {
300Sstevel@tonic-gate 		nflg++;
310Sstevel@tonic-gate 		argc--;
320Sstevel@tonic-gate 		argv++;
330Sstevel@tonic-gate 	}
34*319Sgbrunett 	for (i = 1; i < argc; i++) {
35*319Sgbrunett 		(void) fputs(argv[i], stdout);
360Sstevel@tonic-gate 		if (i < argc-1)
37*319Sgbrunett 			(void) putchar(' ');
380Sstevel@tonic-gate 	}
39*319Sgbrunett 
40*319Sgbrunett 	if (nflg == 0)
41*319Sgbrunett 		(void) putchar('\n');
42216Sakaplan 	return (0);
430Sstevel@tonic-gate }
44