xref: /onnv-gate/usr/src/ucbcmd/echo/echo.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2*0Sstevel@tonic-gate /*	  All Rights Reserved  	*/
3*0Sstevel@tonic-gate 
4*0Sstevel@tonic-gate 
5*0Sstevel@tonic-gate /*
6*0Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
7*0Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
8*0Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
9*0Sstevel@tonic-gate  */
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate /*
12*0Sstevel@tonic-gate  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13*0Sstevel@tonic-gate  * All Rights Reserved.
14*0Sstevel@tonic-gate  */
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17*0Sstevel@tonic-gate 
18*0Sstevel@tonic-gate /*
19*0Sstevel@tonic-gate  * echo
20*0Sstevel@tonic-gate  */
21*0Sstevel@tonic-gate #include <stdio.h>
22*0Sstevel@tonic-gate 
23*0Sstevel@tonic-gate main(argc, argv)
24*0Sstevel@tonic-gate int argc;
25*0Sstevel@tonic-gate char *argv[];
26*0Sstevel@tonic-gate {
27*0Sstevel@tonic-gate 	register int i, nflg;
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate 	nflg = 0;
30*0Sstevel@tonic-gate 	if(argc > 1 && argv[1][0] == '-' && argv[1][1] == 'n' && !argv[1][2]) {
31*0Sstevel@tonic-gate 		nflg++;
32*0Sstevel@tonic-gate 		argc--;
33*0Sstevel@tonic-gate 		argv++;
34*0Sstevel@tonic-gate 	}
35*0Sstevel@tonic-gate 	for(i=1; i<argc; i++) {
36*0Sstevel@tonic-gate 		fputs(argv[i], stdout);
37*0Sstevel@tonic-gate 		if (i < argc-1)
38*0Sstevel@tonic-gate 			putchar(' ');
39*0Sstevel@tonic-gate 	}
40*0Sstevel@tonic-gate 	if(nflg == 0)
41*0Sstevel@tonic-gate 		putchar('\n');
42*0Sstevel@tonic-gate 	exit(0);
43*0Sstevel@tonic-gate }
44