xref: /csrg-svn/bin/echo/echo.c (revision 38501)
138157Sbostic /*
238157Sbostic  * Copyright (c) 1989 The Regents of the University of California.
338157Sbostic  * All rights reserved.
438157Sbostic  *
538157Sbostic  * Redistribution and use in source and binary forms are permitted
638157Sbostic  * provided that the above copyright notice and this paragraph are
738157Sbostic  * duplicated in all such forms and that any documentation,
838157Sbostic  * advertising materials, and other materials related to such
938157Sbostic  * distribution and use acknowledge that the software was developed
1038157Sbostic  * by the University of California, Berkeley.  The name of the
1138157Sbostic  * University may not be used to endorse or promote products derived
1238157Sbostic  * from this software without specific prior written permission.
1338157Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1438157Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1538157Sbostic  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1638157Sbostic  */
1738157Sbostic 
1838157Sbostic #ifndef lint
1938157Sbostic char copyright[] =
2038157Sbostic "@(#) Copyright (c) 1989 The Regents of the University of California.\n\
2138157Sbostic  All rights reserved.\n";
2238157Sbostic #endif /* not lint */
2338157Sbostic 
2438157Sbostic #ifndef lint
25*38501Sbostic static char sccsid[] = "@(#)echo.c	5.2 (Berkeley) 07/30/89";
2638157Sbostic #endif /* not lint */
2738157Sbostic 
281006Sbill #include <stdio.h>
291006Sbill 
30*38501Sbostic /* ARGSUSED */
311006Sbill main(argc, argv)
3238157Sbostic 	int argc;
3338157Sbostic 	char **argv;
341006Sbill {
35*38501Sbostic 	int nflag;
361006Sbill 
37*38501Sbostic 	++argv;
38*38501Sbostic 	if (!strcmp(*argv, "-n")) {
39*38501Sbostic 		++argv;
40*38501Sbostic 		nflag = 1;
41*38501Sbostic 	}
42*38501Sbostic 	else
43*38501Sbostic 		nflag = 0;
4438157Sbostic 
4538157Sbostic 	while (*argv) {
4638157Sbostic 		(void)printf("%s", *argv);
4738157Sbostic 		if (*++argv)
481006Sbill 			putchar(' ');
491006Sbill 	}
5038157Sbostic 	if (!nflag)
511006Sbill 		putchar('\n');
521006Sbill 	exit(0);
531006Sbill }
54