xref: /csrg-svn/bin/echo/echo.c (revision 60662)
138157Sbostic /*
2*60662Sbostic  * Copyright (c) 1989, 1993
3*60662Sbostic  *	The Regents of the University of California.  All rights reserved.
438157Sbostic  *
542532Sbostic  * %sccs.include.redist.c%
638157Sbostic  */
738157Sbostic 
838157Sbostic #ifndef lint
9*60662Sbostic static char copyright[] =
10*60662Sbostic "@(#) Copyright (c) 1989, 1993\n\
11*60662Sbostic 	The Regents of the University of California.  All rights reserved.\n";
1238157Sbostic #endif /* not lint */
1338157Sbostic 
1438157Sbostic #ifndef lint
15*60662Sbostic static char sccsid[] = "@(#)echo.c	8.1 (Berkeley) 05/31/93";
1638157Sbostic #endif /* not lint */
1738157Sbostic 
181006Sbill #include <stdio.h>
1947742Sbostic #include <stdlib.h>
2047742Sbostic #include <string.h>
211006Sbill 
2259471Sbostic int
main(argc,argv)231006Sbill main(argc, argv)
2438157Sbostic 	int argc;
2559471Sbostic 	char *argv[];
261006Sbill {
2738501Sbostic 	int nflag;
281006Sbill 
2947742Sbostic 	/* This utility may NOT do getopt(3) option parsing. */
3047742Sbostic 	if (*++argv && !strcmp(*argv, "-n")) {
3138501Sbostic 		++argv;
3238501Sbostic 		nflag = 1;
3338501Sbostic 	}
3438501Sbostic 	else
3538501Sbostic 		nflag = 0;
3638157Sbostic 
3738157Sbostic 	while (*argv) {
3838157Sbostic 		(void)printf("%s", *argv);
3938157Sbostic 		if (*++argv)
401006Sbill 			putchar(' ');
411006Sbill 	}
4238157Sbostic 	if (!nflag)
431006Sbill 		putchar('\n');
441006Sbill 	exit(0);
451006Sbill }
46