[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5998] better support of Info files with CR-LF line endings
From: |
Gavin D. Smith |
Subject: |
[5998] better support of Info files with CR-LF line endings |
Date: |
Sat, 27 Dec 2014 22:23:47 +0000 |
Revision: 5998
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5998
Author: gavin
Date: 2014-12-27 22:23:46 +0000 (Sat, 27 Dec 2014)
Log Message:
-----------
better support of Info files with CR-LF line endings
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info-utils.c
trunk/info/info.h
trunk/info/nodes.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-12-27 21:53:22 UTC (rev 5997)
+++ trunk/ChangeLog 2014-12-27 22:23:46 UTC (rev 5998)
@@ -18,6 +18,15 @@
(get_nodes_of_tags_table): Assume we are passed the exact offset
of the separator preceding the tag table.
+ * info/info.h (whitespace_or_newline): Include '\r'.
+ * info/nodes.c (get_file_character_encoding): Stop reading name
+ of character encoding at an '\r' if one is seen.
+ * info/info-utils.c (avoid_see_see): Include '\r' as a
+ whitespace character.
+
+ All problems with reading files with CR-LF line endings reported
+ by Eli Zaretskii.
+
2014-12-26 Eli Zaretskii <address@hidden>
* info/info-utils.c (nl_langinfo) [__MINGW32__]: Redirect to
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-12-27 21:53:22 UTC (rev 5997)
+++ trunk/info/info-utils.c 2014-12-27 22:23:46 UTC (rev 5998)
@@ -1186,12 +1186,12 @@
/* Skip past whitespace, and then go to beginning of preceding word. */
ptr--;
- while (ptr > base && (*ptr == ' ' || *ptr == '\n' || *ptr == '\t'
- || *ptr == '('))
+ while (ptr > base && (*ptr == ' ' || *ptr == '\n' || *ptr == '\r'
+ || *ptr == '\t' || *ptr == '('))
ptr--;
- while (ptr > base && !(*ptr == ' ' || *ptr == '\n' || *ptr == '\t'
- || *ptr == '(' ))
+ while (ptr > base && !(*ptr == ' ' || *ptr == '\n' || *ptr == '\r'
+ || *ptr == '\t' || *ptr == '(' ))
{
ptr--;
word_len++;
Modified: trunk/info/info.h
===================================================================
--- trunk/info/info.h 2014-12-27 21:53:22 UTC (rev 5997)
+++ trunk/info/info.h 2014-12-27 22:23:46 UTC (rev 5998)
@@ -41,7 +41,8 @@
#endif /* !whitespace */
#if !defined (whitespace_or_newline)
-# define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
+# define whitespace_or_newline(c) (whitespace (c) \
+ || (c == '\n') || (c == '\r'))
#endif /* !whitespace_or_newline */
/* Add ELT to the list of elements found in ARRAY. SLOTS is the number
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2014-12-27 21:53:22 UTC (rev 5997)
+++ trunk/info/nodes.c 2014-12-27 22:23:46 UTC (rev 5998)
@@ -749,7 +749,7 @@
SEARCH_BINDING binding;
long position;
- long int enc_start, enc_end;
+ long int enc_start, enc_len;
char *enc_string;
/* See if there is a local variables section in this info file. */
@@ -776,13 +776,12 @@
enc_start += strlen(CHARACTER_ENCODING_LABEL); /* Skip to after "coding:" */
enc_start += skip_whitespace(fb->contents + enc_start);
- binding.start = enc_start;
- search_forward ("\n", &binding, &enc_end);
+ enc_len = strcspn (fb->contents + enc_start, "\r\n");
- enc_string = xmalloc (enc_end - enc_start + 1);
- strncpy (enc_string, fb->contents + enc_start, enc_end - enc_start);
- enc_string[enc_end - enc_start] = '\0';
+ enc_string = xmalloc (enc_len + 1);
+ strncpy (enc_string, fb->contents + enc_start, enc_len);
+ enc_string[enc_len] = '\0';
fb->encoding = enc_string;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5998] better support of Info files with CR-LF line endings,
Gavin D. Smith <=