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.4 (Berkeley) 04/03/91"; 16 #endif /* not lint */ 17 18 #include <stdio.h> 19 #include <stdlib.h> 20 #include <string.h> 21 22 /* ARGSUSED */ 23 main(argc, argv) 24 int argc; 25 char **argv; 26 { 27 int nflag; 28 29 /* This utility may NOT do getopt(3) option parsing. */ 30 if (*++argv && !strcmp(*argv, "-n")) { 31 ++argv; 32 nflag = 1; 33 } 34 else 35 nflag = 0; 36 37 while (*argv) { 38 (void)printf("%s", *argv); 39 if (*++argv) 40 putchar(' '); 41 } 42 if (!nflag) 43 putchar('\n'); 44 exit(0); 45 } 46