From: Chris Allegretta Date: Sun, 16 Feb 2003 03:13:47 +0000 (+0000) Subject: - files.c:read_file() - If the file we're loading has already been detected as a... X-Git-Tag: v1.2.0~5 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=33ac7b9181e2a75e79776d4d386b9baeb3ce9b88;p=nano.git - files.c:read_file() - If the file we're loading has already been detected as a DOS or Mac formatted file, don't turn on NOCONVERT if we find binary chars in it. This is because if it's detected as DOS/Mac format, at least one line has already been converted so setting NOCONVERT (which is supposed to signal that none of the file should be converted) makes no sense. (DLR) git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 13adb3e7..ec32a0fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ CVS code - General: - Translation updates (see po/ChangeLog for details). +- files.c: + read_file() + - If the file we're loading has already been detected as a DOS + or Mac formatted file, don't turn on NOCONVERT if we find + binary chars in it. This is because if it's detected as + DOS/Mac format, at least one line has already been converted, + so setting NOCONVERT (which is supposed to signal that none + of the file should be converted) makes no sense. (DLR) - nanorc.5: - Fix formatting error and update copyright year (Jordi). - Several enhancements (David Benbennick). diff --git a/files.c b/files.c index bce66810..12ae08ce 100644 --- a/files.c +++ b/files.c @@ -185,9 +185,11 @@ int read_file(FILE *f, const char *filename, int quiet) input = (char)input_int; #ifndef NANO_SMALL /* If the file has binary chars in it, don't stupidly - assume it's a DOS or Mac formatted file! */ - if (!ISSET(NO_CONVERT) && is_cntrl_char((int)input) != 0 - && input != '\t' && input != '\r' && input != '\n') + assume it's a DOS or Mac formatted file if it hasn't been + detected as one already! */ + if (fileformat == 0 && !ISSET(NO_CONVERT) + && is_cntrl_char((int)input) != 0 && input != '\t' + && input != '\r' && input != '\n') SET(NO_CONVERT); #endif