summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authormsvensson@pilot.blaudden <>2007-02-20 14:21:11 +0100
committermsvensson@pilot.blaudden <>2007-02-20 14:21:11 +0100
commitc7d138cfa3a138df468c6b3b42d0f0ef973f3aa6 (patch)
tree8f92d0d31d227e25e1e78789ecdc05ae53e264eb /client
parenta799f2b6379d4772a8189e9fb19a564d56ebc3f2 (diff)
parent26432d16e8f3b4fbe343fcfdd441efa2770f36e0 (diff)
downloadmariadb-git-c7d138cfa3a138df468c6b3b42d0f0ef973f3aa6.tar.gz
Merge pilot.blaudden:/home/msvensson/mysql/mysql-4.1-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index 4cb7aaf66d1..919f0f90e44 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -2197,7 +2197,7 @@ void do_cat_file(struct st_command *command)
{
int fd;
uint len;
- byte buff[512];
+ char buff[512];
static DYNAMIC_STRING ds_filename;
const struct command_arg cat_file_args[] = {
"filename", ARG_STRING, TRUE, &ds_filename, "File to read from"
@@ -2214,10 +2214,27 @@ void do_cat_file(struct st_command *command)
if ((fd= my_open(ds_filename.str, O_RDONLY, MYF(0))) < 0)
die("Failed to open file %s", ds_filename.str);
- while((len= my_read(fd, &buff,
+ while((len= my_read(fd, (byte*)&buff,
sizeof(buff), MYF(0))) > 0)
{
- dynstr_append_mem(&ds_res, buff, len);
+ char *p= buff, *start= buff;
+ while (p < buff+len)
+ {
+ /* Convert cr/lf to lf */
+ if (*p == '\r' && *(p+1) && *(p+1)== '\n')
+ {
+ /* Add fake newline instead of cr and output the line */
+ *p= '\n';
+ p++; /* Step past the "fake" newline */
+ dynstr_append_mem(&ds_res, start, p-start);
+ p++; /* Step past the "fake" newline */
+ start= p;
+ }
+ else
+ p++;
+ }
+ /* Output any chars that migh be left */
+ dynstr_append_mem(&ds_res, start, p-start);
}
my_close(fd, MYF(0));
dynstr_free(&ds_filename);