aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElie De Brauwer <eliedebrauwer@gmail.com>2012-12-22 11:50:11 +0100
committerElie De Brauwer <eliedebrauwer@gmail.com>2012-12-22 11:50:11 +0100
commitde08aef53c4611de5b64b332ac6c1b9c920b7d0b (patch)
tree2810a4a0b7368bf4276ad0cf70f9af8bdd3908ca /toys
parent7a78d92da70d24947fa9e828a960658ea32b74e7 (diff)
downloadtoybox-de08aef53c4611de5b64b332ac6c1b9c920b7d0b.tar.gz
Fix tac to handle the "abc\ndef" case properly
Diffstat (limited to 'toys')
-rw-r--r--toys/other/tac.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/other/tac.c b/toys/other/tac.c
index 9ebc7f69..538d1b0b 100644
--- a/toys/other/tac.c
+++ b/toys/other/tac.c
@@ -23,8 +23,9 @@ void do_tac(int fd, char *name)
// Read in lines
for (;;) {
struct arg_list *temp;
+ long len;
- if (!(c = get_line(fd))) break;
+ if (!(c = get_rawline(fd, &len, '\n'))) break;
temp = xmalloc(sizeof(struct arg_list));
temp->next = list;
@@ -35,7 +36,7 @@ void do_tac(int fd, char *name)
// Play them back.
while (list) {
struct arg_list *temp = list->next;
- xputs(list->arg);
+ xprintf("%s", list->arg);
free(list->arg);
free(list);
list = temp;