diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-06-04 05:05:32 +0000 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-06-06 18:04:37 -0400 |
commit | 01ca4600bae9cd1aa5f0cfe4fc4294e7da0b4ee3 (patch) | |
tree | 2b1b77d574347919e38e6876db49e0559fb0d5a9 /src/nvim/ex_cmds2.c | |
parent | 1e54b04bc0f68d65f8b751cb07aeb959258751f0 (diff) | |
download | rneovim-01ca4600bae9cd1aa5f0cfe4fc4294e7da0b4ee3.tar.gz rneovim-01ca4600bae9cd1aa5f0cfe4fc4294e7da0b4ee3.tar.bz2 rneovim-01ca4600bae9cd1aa5f0cfe4fc4294e7da0b4ee3.zip |
Remove USE_CR and tag_fgets. #808
These features are only used by legacy Mac OS.
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 80 |
1 files changed, 1 insertions, 79 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 02d8f6f9af..b2b37d9c01 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -94,7 +94,7 @@ struct source_cookie { FILE *fp; /* opened file for sourcing */ char_u *nextline; /* if not NULL: line that was read ahead */ int finished; /* ":finish" used */ -#if defined(USE_CRNL) || defined(USE_CR) +#if defined(USE_CRNL) int fileformat; /* EOL_UNKNOWN, EOL_UNIX or EOL_DOS */ int error; /* TRUE if LF found after CR-LF */ #endif @@ -2520,15 +2520,6 @@ do_source ( cookie.error = FALSE; #endif -#ifdef USE_CR - /* If no automatic file format: Set default to CR. */ - if (*p_ffs == NUL) - cookie.fileformat = EOL_MAC; - else - cookie.fileformat = EOL_UNKNOWN; - cookie.error = FALSE; -#endif - cookie.nextline = NULL; cookie.finished = FALSE; @@ -2755,41 +2746,6 @@ void free_scriptnames(void) # endif -#if defined(USE_CR) || defined(PROTO) -/* - * Version of fgets() which also works for lines ending in a <CR> only - * (Macintosh format). - * For older versions of the Metrowerks library. - * At least CodeWarrior 9 needed this code. - */ -char *fgets_cr(char *s, int n, FILE *stream) -{ - int c = 0; - int char_read = 0; - - while (!feof(stream) && c != '\r' && c != '\n' && char_read < n - 1) { - c = fgetc(stream); - s[char_read++] = c; - /* If the file is in DOS format, we need to skip a NL after a CR. I - * thought it was the other way around, but this appears to work... */ - if (c == '\n') { - c = fgetc(stream); - if (c != '\r') - ungetc(c, stream); - } - } - - s[char_read] = 0; - if (char_read == 0) - return NULL; - - if (feof(stream) && char_read == 1) - return NULL; - - return s; -} -#endif - /* * Get one full line from a sourced file. * Called by do_cmdline() when it's called from do_source(). @@ -2897,9 +2853,6 @@ static char_u *get_one_sourceline(struct source_cookie *sp) #ifdef USE_CRNL int has_cr; /* CR-LF found */ #endif -#ifdef USE_CR - char_u *scan; -#endif int have_read = FALSE; /* use a growarray to store the sourced line */ @@ -2914,13 +2867,6 @@ static char_u *get_one_sourceline(struct source_cookie *sp) ga_grow(&ga, 120); buf = (char_u *)ga.ga_data; -#ifdef USE_CR - if (sp->fileformat == EOL_MAC) { - if (fgets_cr((char *)buf + ga.ga_len, ga.ga_maxlen - ga.ga_len, - sp->fp) == NULL) - break; - } else -#endif if (fgets((char *)buf + ga.ga_len, ga.ga_maxlen - ga.ga_len, sp->fp) == NULL) break; @@ -2936,30 +2882,6 @@ static char_u *get_one_sourceline(struct source_cookie *sp) } #endif -#ifdef USE_CR - /* If the read doesn't stop on a new line, and there's - * some CR then we assume a Mac format */ - if (sp->fileformat == EOL_UNKNOWN) { - if (buf[len - 1] != '\n' && vim_strchr(buf, '\r') != NULL) - sp->fileformat = EOL_MAC; - else - sp->fileformat = EOL_UNIX; - } - - if (sp->fileformat == EOL_MAC) { - scan = vim_strchr(buf, '\r'); - - if (scan != NULL) { - *scan = '\n'; - if (*(scan + 1) != 0) { - *(scan + 1) = 0; - fseek(sp->fp, (long)(scan - buf - len + 1), SEEK_CUR); - } - } - len = STRLEN(buf); - } -#endif - have_read = TRUE; ga.ga_len = len; |