Commit | Line | Data |
---|---|---|
bfe13c81 KB |
1 | /* |
2 | * Copyright (c) 1988 Mark Nudleman | |
3 | * Copyright (c) 1988 Regents of the University of California. | |
4 | * All rights reserved. | |
5 | * | |
bfe13c81 KB |
6 | * Redistribution and use in source and binary forms are permitted |
7 | * provided that the above copyright notice and this paragraph are | |
8 | * duplicated in all such forms and that any documentation, | |
9 | * advertising materials, and other materials related to such | |
10 | * distribution and use acknowledge that the software was developed | |
a942b40b KB |
11 | * by Mark Nudleman and the University of California, Berkeley. The |
12 | * name of Mark Nudleman or the | |
bfe13c81 KB |
13 | * University may not be used to endorse or promote products derived |
14 | * from this software without specific prior written permission. | |
15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
16 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
17 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
18 | */ | |
19 | ||
20 | #ifndef lint | |
21 | char copyright[] = | |
22 | "@(#) Copyright (c) 1988 Mark Nudleman.\n\ | |
a942b40b | 23 | @(#) Copyright (c) 1988 Regents of the University of California.\n\ |
bfe13c81 KB |
24 | All rights reserved.\n"; |
25 | #endif /* not lint */ | |
26 | ||
27 | #ifndef lint | |
a942b40b | 28 | static char sccsid[] = "@(#)vecho.c 5.2 (Berkeley) %G%"; |
bfe13c81 KB |
29 | #endif /* not lint */ |
30 | ||
31 | /* | |
32 | * This dumb little program emulates the System V "echo" command, | |
33 | * to accomodate BSD systems which don't understand the \c escape, | |
34 | * meaning don't echo a newline. BSD uses "echo -n". | |
35 | */ | |
36 | ||
37 | #include <stdio.h> | |
38 | ||
39 | int putnl; | |
40 | ||
41 | main(argc, argv) | |
42 | int argc; | |
43 | char *argv[]; | |
44 | { | |
45 | putnl = 1; | |
46 | while (--argc > 0) | |
47 | { | |
48 | vecho(*++argv); | |
49 | if (argc > 1) | |
50 | putchar(' '); | |
51 | } | |
52 | if (putnl) | |
53 | putchar('\n'); | |
54 | } | |
55 | ||
56 | vecho(str) | |
57 | char *str; | |
58 | { | |
59 | register char *s; | |
60 | ||
61 | for (s = str; *s != '\0'; s++) | |
62 | { | |
63 | if (*s == '\\' && s[1] == 'c') | |
64 | { | |
65 | putnl = 0; | |
66 | return; | |
67 | } | |
68 | putchar(*s); | |
69 | } | |
70 | } |