xref: /csrg-svn/bin/echo/echo.c (revision 42532)
138157Sbostic /*
238157Sbostic  * Copyright (c) 1989 The Regents of the University of California.
338157Sbostic  * All rights reserved.
438157Sbostic  *
5*42532Sbostic  * %sccs.include.redist.c%
638157Sbostic  */
738157Sbostic 
838157Sbostic #ifndef lint
938157Sbostic char copyright[] =
1038157Sbostic "@(#) Copyright (c) 1989 The Regents of the University of California.\n\
1138157Sbostic  All rights reserved.\n";
1238157Sbostic #endif /* not lint */
1338157Sbostic 
1438157Sbostic #ifndef lint
15*42532Sbostic static char sccsid[] = "@(#)echo.c	5.3 (Berkeley) 05/31/90";
1638157Sbostic #endif /* not lint */
1738157Sbostic 
181006Sbill #include <stdio.h>
191006Sbill 
2038501Sbostic /* ARGSUSED */
211006Sbill main(argc, argv)
2238157Sbostic 	int argc;
2338157Sbostic 	char **argv;
241006Sbill {
2538501Sbostic 	int nflag;
261006Sbill 
2738501Sbostic 	++argv;
2838501Sbostic 	if (!strcmp(*argv, "-n")) {
2938501Sbostic 		++argv;
3038501Sbostic 		nflag = 1;
3138501Sbostic 	}
3238501Sbostic 	else
3338501Sbostic 		nflag = 0;
3438157Sbostic 
3538157Sbostic 	while (*argv) {
3638157Sbostic 		(void)printf("%s", *argv);
3738157Sbostic 		if (*++argv)
381006Sbill 			putchar(' ');
391006Sbill 	}
4038157Sbostic 	if (!nflag)
411006Sbill 		putchar('\n');
421006Sbill 	exit(0);
431006Sbill }
44