xref: /titanic_50/usr/src/ucbcmd/echo/echo.c (revision f22acdfff536d452df49dd85c5ecd42092b8fcad)
188f3d729Sakaplan /*
288f3d729Sakaplan  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
388f3d729Sakaplan  * Use is subject to license terms.
488f3d729Sakaplan  */
588f3d729Sakaplan 
67c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
77c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate /*
117c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
127c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
137c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
147c478bd9Sstevel@tonic-gate  */
157c478bd9Sstevel@tonic-gate 
1688f3d729Sakaplan #pragma ident	"%Z%%M%	%I%	%E% SMI"
177c478bd9Sstevel@tonic-gate 
187c478bd9Sstevel@tonic-gate /*
197c478bd9Sstevel@tonic-gate  * echo
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate #include <stdio.h>
227c478bd9Sstevel@tonic-gate 
2388f3d729Sakaplan int
main(int argc,char * argv[])2488f3d729Sakaplan main(int argc, char *argv[])
257c478bd9Sstevel@tonic-gate {
2688f3d729Sakaplan 	int i, nflg;
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate 	nflg = 0;
297c478bd9Sstevel@tonic-gate 	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && !argv[1][2]) {
307c478bd9Sstevel@tonic-gate 		nflg++;
317c478bd9Sstevel@tonic-gate 		argc--;
327c478bd9Sstevel@tonic-gate 		argv++;
337c478bd9Sstevel@tonic-gate 	}
347c478bd9Sstevel@tonic-gate 	for (i = 1; i < argc; i++) {
35*f22acdffSgbrunett 		(void) fputs(argv[i], stdout);
367c478bd9Sstevel@tonic-gate 		if (i < argc-1)
37*f22acdffSgbrunett 			(void) putchar(' ');
387c478bd9Sstevel@tonic-gate 	}
39*f22acdffSgbrunett 
407c478bd9Sstevel@tonic-gate 	if (nflg == 0)
41*f22acdffSgbrunett 		(void) putchar('\n');
4288f3d729Sakaplan 	return (0);
437c478bd9Sstevel@tonic-gate }
44