xref: /original-bsd/bin/echo/echo.c (revision caa496f3)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 char copyright[] =
10 "@(#) Copyright (c) 1989 The Regents of the University of California.\n\
11  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)echo.c	5.3 (Berkeley) 05/31/90";
16 #endif /* not lint */
17 
18 #include <stdio.h>
19 
20 /* ARGSUSED */
21 main(argc, argv)
22 	int argc;
23 	char **argv;
24 {
25 	int nflag;
26 
27 	++argv;
28 	if (!strcmp(*argv, "-n")) {
29 		++argv;
30 		nflag = 1;
31 	}
32 	else
33 		nflag = 0;
34 
35 	while (*argv) {
36 		(void)printf("%s", *argv);
37 		if (*++argv)
38 			putchar(' ');
39 	}
40 	if (!nflag)
41 		putchar('\n');
42 	exit(0);
43 }
44