From 33ac7b9181e2a75e79776d4d386b9baeb3ce9b88 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Sun, 16 Feb 2003 03:13:47 +0000 Subject: [PATCH] - 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 --- ChangeLog | 8 ++++++++ files.c | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) 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 -- 2.39.5