aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-12-01 00:21:37 -0600
committerRob Landley <rob@landley.net>2012-12-01 00:21:37 -0600
commitf6379761b605a606764bc139c5b64c75c45e0559 (patch)
tree37745b8213a8f5e63156c2caf21d5037a73912d3 /toys
parent3cbe8d52155ff4dfb6b3184ed5cdb66688de9753 (diff)
downloadtoybox-f6379761b605a606764bc139c5b64c75c45e0559.tar.gz
Re-add backspace support to expand (oops) and fix test to expect data plus backspace characters rather than the chracters cancelling each other out before output.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/expand.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/toys/posix/expand.c b/toys/posix/expand.c
index b29a98f4..922f5e67 100644
--- a/toys/posix/expand.c
+++ b/toys/posix/expand.c
@@ -45,9 +45,13 @@ static void expand_file(int fd, char *name)
if (!len) break;
for (i=0; i<len; i++) {
int len = 1;
- if (toybuf[i] != '\t') {
- if (EOF == putc(toybuf[i], stdout)) perror_exit(0);
- if (toybuf[i] == '\n') {
+ char c = toybuf[i];
+
+ if (c != '\t') {
+ if (EOF == putc(c, stdout)) perror_exit(0);
+
+ if (c == '\b' && x) len = -1;
+ if (c == '\n') {
x = stop = 0;
continue;
}