diff options
Diffstat (limited to 'editors/diff.c')
-rw-r--r-- | editors/diff.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/editors/diff.c b/editors/diff.c index b6716455f..b324feaa5 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -157,7 +157,7 @@ enum { /* Commandline flags */ | |||
157 | FLAG_p, /* not implemented */ | 157 | FLAG_p, /* not implemented */ |
158 | FLAG_B, | 158 | FLAG_B, |
159 | FLAG_E, /* not implemented */ | 159 | FLAG_E, /* not implemented */ |
160 | #if ENABLE_PLATFORM_MINGW32 | 160 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_DIFF_LONG_OPTIONS |
161 | FLAG_binary, | 161 | FLAG_binary, |
162 | #endif | 162 | #endif |
163 | }; | 163 | }; |
@@ -223,6 +223,9 @@ static int read_token(FILE_and_pos_t *ft, token_t tok) | |||
223 | int t; | 223 | int t; |
224 | 224 | ||
225 | t = fgetc(ft->ft_fp); | 225 | t = fgetc(ft->ft_fp); |
226 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_DIFF_LONG_OPTIONS | ||
227 | newline: | ||
228 | #endif | ||
226 | if (t != EOF) | 229 | if (t != EOF) |
227 | ft->ft_pos++; | 230 | ft->ft_pos++; |
228 | is_space = (t == EOF || isspace(t)); | 231 | is_space = (t == EOF || isspace(t)); |
@@ -238,6 +241,16 @@ static int read_token(FILE_and_pos_t *ft, token_t tok) | |||
238 | 241 | ||
239 | if ((option_mask32 & FLAG(w)) && is_space) | 242 | if ((option_mask32 & FLAG(w)) && is_space) |
240 | continue; | 243 | continue; |
244 | #if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_DIFF_LONG_OPTIONS | ||
245 | if (!(option_mask32 & FLAG(binary)) && t == '\r') { | ||
246 | int t2 = fgetc(ft->ft_fp); | ||
247 | if (t2 == '\n') { | ||
248 | t = t2; | ||
249 | goto newline; | ||
250 | } | ||
251 | ungetc(t2, ft->ft_fp); | ||
252 | } | ||
253 | #endif | ||
241 | 254 | ||
242 | /* Trim char value to low 9 bits */ | 255 | /* Trim char value to low 9 bits */ |
243 | t &= CHAR_MASK; | 256 | t &= CHAR_MASK; |
@@ -718,7 +731,6 @@ static int diffreg(char *file[2]) | |||
718 | #if ENABLE_PLATFORM_MINGW32 | 731 | #if ENABLE_PLATFORM_MINGW32 |
719 | char *tmpfile[2] = { NULL, NULL }; | 732 | char *tmpfile[2] = { NULL, NULL }; |
720 | char *tmpdir; | 733 | char *tmpdir; |
721 | const char *mode; | ||
722 | #endif | 734 | #endif |
723 | 735 | ||
724 | fp[0] = stdin; | 736 | fp[0] = stdin; |
@@ -761,16 +773,7 @@ static int diffreg(char *file[2]) | |||
761 | fd = fd_tmp; | 773 | fd = fd_tmp; |
762 | xlseek(fd, 0, SEEK_SET); | 774 | xlseek(fd, 0, SEEK_SET); |
763 | } | 775 | } |
764 | #if ENABLE_PLATFORM_MINGW32 | ||
765 | mode = "r"; | ||
766 | if (!(option_mask32 & FLAG(binary))) { | ||
767 | _setmode(fd, _O_TEXT); | ||
768 | mode = "rt"; | ||
769 | } | ||
770 | fp[i] = fdopen(fd, mode); | ||
771 | #else | ||
772 | fp[i] = fdopen(fd, "r"); | 776 | fp[i] = fdopen(fd, "r"); |
773 | #endif | ||
774 | } | 777 | } |
775 | 778 | ||
776 | setup_common_bufsiz(); | 779 | setup_common_bufsiz(); |