1
0
forked from aniani/vim

patch 8.1.0927: USE_CR is never defined

Problem:    USE_CR is never defined.
Solution:   Remove usage of USE_CR. (Ken Takata, closes #3958)
This commit is contained in:
Bram Moolenaar
2019-02-15 21:06:09 +01:00
parent e93e5a504f
commit 0059074008
12 changed files with 29 additions and 224 deletions

View File

@@ -5216,14 +5216,12 @@ msg_add_fileformat(int eol_type)
return TRUE;
}
#endif
#ifndef USE_CR
if (eol_type == EOL_MAC)
{
STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[mac]") : _("[mac format]"));
return TRUE;
}
#endif
#if defined(USE_CRNL) || defined(USE_CR)
#ifdef USE_CRNL
if (eol_type == EOL_UNIX)
{
STRCAT(IObuff, shortmess(SHM_TEXT) ? _("[unix]") : _("[unix format]"));
@@ -6359,11 +6357,7 @@ vim_fgets(char_u *buf, int size, FILE *fp)
char tbuf[FGETS_SIZE];
buf[size - 2] = NUL;
#ifdef USE_CR
eof = fgets_cr((char *)buf, size, fp);
#else
eof = fgets((char *)buf, size, fp);
#endif
if (buf[size - 2] != NUL && buf[size - 2] != '\n')
{
buf[size - 1] = NUL; /* Truncate the line */
@@ -6372,57 +6366,12 @@ vim_fgets(char_u *buf, int size, FILE *fp)
do
{
tbuf[FGETS_SIZE - 2] = NUL;
#ifdef USE_CR
vim_ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
#else
vim_ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
#endif
} while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
}
return (eof == NULL);
}
#if defined(USE_CR) || defined(PROTO)
/*
* Like vim_fgets(), but accept any line terminator: CR, CR-LF or LF.
* Returns TRUE for end-of-file.
* Only used for the Mac, because it's much slower than vim_fgets().
*/
int
tag_fgets(char_u *buf, int size, FILE *fp)
{
int i = 0;
int c;
int eof = FALSE;
for (;;)
{
c = fgetc(fp);
if (c == EOF)
{
eof = TRUE;
break;
}
if (c == '\r')
{
/* Always store a NL for end-of-line. */
if (i < size - 1)
buf[i++] = '\n';
c = fgetc(fp);
if (c != '\n') /* Macintosh format: single CR. */
ungetc(c, fp);
break;
}
if (i < size - 1)
buf[i++] = c;
if (c == '\n')
break;
}
buf[i] = NUL;
return eof;
}
#endif
/*
* rename() only works if both files are on the same file system, this
* function will (attempts to?) copy the file across if rename fails -- webb