diff options
author | phk <phk@FreeBSD.org> | 2003-10-30 10:40:49 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-10-30 10:40:49 +0000 |
commit | eae6949d99a11d72cef4ef9015743ae44c91c6d1 (patch) | |
tree | b475e5fcaa9bc6f1821bb3284b36570c3410a4fd /lib/libc/gen/vis.c | |
parent | bbdba26328b9b5d6bc1b53351610790f6dc448c6 (diff) | |
download | FreeBSD-src-eae6949d99a11d72cef4ef9015743ae44c91c6d1.zip FreeBSD-src-eae6949d99a11d72cef4ef9015743ae44c91c6d1.tar.gz |
Add a new flag to vis(3): VIS_GLOB which encodes the glob(3) magic
characters '*', '?' and '['.
Diffstat (limited to 'lib/libc/gen/vis.c')
-rw-r--r-- | lib/libc/gen/vis.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index 8868a70..4f594eb 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -71,7 +71,9 @@ vis(dst, c, flag, nextc) } } - if (isgraph(c) || + if ((flag & VIS_GLOB) && (c == '*' || c == '?' || c == '[')) + ; + else if (isgraph(c) || ((flag & VIS_SP) == 0 && c == ' ') || ((flag & VIS_TAB) == 0 && c == '\t') || ((flag & VIS_NL) == 0 && c == '\n') || @@ -127,7 +129,7 @@ vis(dst, c, flag, nextc) goto done; } } - if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) { + if (((c & 0177) == ' ') || isgraph(c) || (flag & VIS_OCTAL)) { *dst++ = '\\'; *dst++ = ((u_char)c >> 6 & 07) + '0'; *dst++ = ((u_char)c >> 3 & 07) + '0'; |