]> git.ipfire.org Git - thirdparty/bash.git/blob - support/recho.c
Imported from ../bash-2.01.tar.gz.
[thirdparty/bash.git] / support / recho.c
1 #include <stdio.h>
2
3 void strprint();
4
5 int
6 main(argc, argv)
7 int argc;
8 char **argv;
9 {
10 register int i;
11
12 for (i = 1; i < argc; i++) {
13 printf("argv[%d] = <", i);
14 strprint(argv[i]);
15 printf(">\n");
16 }
17 exit(0);
18 }
19
20 void
21 strprint(str)
22 char *str;
23 {
24 register char *s;
25
26 for (s = str; s && *s; s++) {
27 if (*s < ' ') {
28 putchar('^');
29 putchar(*s+64);
30 } else if (*s == 127) {
31 putchar('^');
32 putchar('?');
33 } else
34 putchar(*s);
35 }
36 }