aboutsummaryrefslogtreecommitdiffstats
path: root/tools/fileop.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/fileop.c')
-rw-r--r--tools/fileop.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/fileop.c b/tools/fileop.c
index 9237c49..a9a49a5 100644
--- a/tools/fileop.c
+++ b/tools/fileop.c
@@ -261,7 +261,7 @@ static void do_input(int fd, uint16_t ix)
struct file_data *fm = filemap[ix];
int err;
char data[BUF_SIZE], data1[2*BUF_SIZE];
- char *p, *q;
+ char *p, *q, c;
int dlen;
if (!fm) {
@@ -288,20 +288,19 @@ static void do_input(int fd, uint16_t ix)
err = 128+34; /* Slut på filen */
}
send_reply(fd, err);
- free(data);
return;
}
/* Strip CR and change LF -> CR LF */
- for (p = data, q = data1+2 ; *p ; p++) {
- switch (*p) {
+ for (p = data, q = data1+2 ; (c = *p) ; p++) {
+ switch (c) {
case '\r':
break;
case '\n':
*q++ = '\r';
/* fall through */
default:
- *q++ = *p;
+ *q++ = c;
break;
}
}
@@ -309,6 +308,7 @@ static void do_input(int fd, uint16_t ix)
data1[0] = dlen;
data1[1] = dlen >> 8;
send_reply(fd, 0);
+ fprintf(stderr, "input: sending %d bytes\n", dlen);
xwrite(fd, data1, dlen+2);
}