(rep,in,out)
| 1009 | /* Global variable update is set if something was changed */ |
| 1010 | |
| 1011 | static int convert_pipe(rep,in,out) |
| 1012 | REPLACE *rep; |
| 1013 | FILE *in,*out; |
| 1014 | { |
| 1015 | int retain,error; |
| 1016 | uint length; |
| 1017 | char save_char,*end_of_line,*start_of_line; |
| 1018 | DBUG_ENTER("convert_pipe"); |
| 1019 | |
| 1020 | updated=retain=0; |
| 1021 | reset_buffer(); |
| 1022 | |
| 1023 | while ((error=fill_buffer_retaining(my_fileno(in),retain)) > 0) |
| 1024 | { |
| 1025 | end_of_line=buffer ; |
| 1026 | buffer[bufbytes]=0; /* Sentinel */ |
| 1027 | for (;;) |
| 1028 | { |
| 1029 | start_of_line=end_of_line; |
| 1030 | while (end_of_line[0] != '\n' && end_of_line[0]) |
| 1031 | end_of_line++; |
| 1032 | if (end_of_line == buffer+bufbytes) |
| 1033 | { |
| 1034 | retain= (int) (end_of_line - start_of_line); |
| 1035 | break; /* No end of line, read more */ |
| 1036 | } |
| 1037 | save_char=end_of_line[0]; |
| 1038 | end_of_line[0]=0; |
| 1039 | end_of_line++; |
| 1040 | if ((length=replace_strings(rep,&out_buff,&out_length,start_of_line)) == |
| 1041 | (uint) -1) |
| 1042 | return 1; |
| 1043 | if (!my_eof) |
| 1044 | out_buff[length++]=save_char; /* Don't write added newline */ |
| 1045 | if (my_fwrite(out, (uchar*) out_buff, length, MYF(MY_WME | MY_NABP))) |
| 1046 | DBUG_RETURN(1); |
| 1047 | } |
| 1048 | } |
| 1049 | DBUG_RETURN(error); |
| 1050 | } |
| 1051 | |
| 1052 | |
| 1053 | static int convert_file(REPLACE *rep, char * name) |
no test coverage detected