* syntax.c (read_one_line): Undo last patch - errno is a
function on some systems. Check ferror() status before everithing else if fgetc returns EOF. Accept last line without trailing newline. (compare_word_to_right): Don't cast p and q to unsigned long. (apply_rules_going_right): Likewise.
Этот коммит содержится в:
родитель
9e23676939
Коммит
bd3bdac638
@ -1,3 +1,13 @@
|
|||||||
|
2001-12-22 Andrew V. Samoilov <kai@cmail.ru>
|
||||||
|
|
||||||
|
* syntax.c (read_one_line): Undo last patch - errno is a
|
||||||
|
function on some systems. Check ferror() status before
|
||||||
|
everithing else if fgetc returns EOF.
|
||||||
|
Accept last line without trailing newline.
|
||||||
|
|
||||||
|
(compare_word_to_right): Don't cast p and q to unsigned long.
|
||||||
|
(apply_rules_going_right): Likewise.
|
||||||
|
|
||||||
2001-12-21 Pavel Roskin <proski@gnu.org>
|
2001-12-21 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* edit.c (user_menu): Don't move the cursor before and after
|
* edit.c (user_menu): Don't move the cursor before and after
|
||||||
|
@ -82,7 +82,7 @@ static long compare_word_to_right (WEdit * edit, long i, char *text, char *whole
|
|||||||
if (whole_left)
|
if (whole_left)
|
||||||
if (strchr (whole_left, c))
|
if (strchr (whole_left, c))
|
||||||
return -1;
|
return -1;
|
||||||
for (p = (unsigned char *) text, q = p + strlen ((char *) p); (unsigned long) p < (unsigned long) q; p++, i++) {
|
for (p = (unsigned char *) text, q = p + strlen ((char *) p); p < q; p++, i++) {
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case '\001':
|
case '\001':
|
||||||
p++;
|
p++;
|
||||||
@ -243,7 +243,7 @@ static inline struct syntax_rule apply_rules_going_right (WEdit * edit, long i,
|
|||||||
struct key_word *k;
|
struct key_word *k;
|
||||||
int count;
|
int count;
|
||||||
long e;
|
long e;
|
||||||
count = (unsigned long) p - (unsigned long) r->keyword_first_chars;
|
count = p - r->keyword_first_chars;
|
||||||
k = r->keyword[count];
|
k = r->keyword[count];
|
||||||
e = compare_word_to_right (edit, i, k->keyword, k->whole_word_chars_left, k->whole_word_chars_right, k->line_start);
|
e = compare_word_to_right (edit, i, k->keyword, k->whole_word_chars_left, k->whole_word_chars_right, k->line_start);
|
||||||
if (e > 0) {
|
if (e > 0) {
|
||||||
@ -310,7 +310,7 @@ static inline struct syntax_rule apply_rules_going_right (WEdit * edit, long i,
|
|||||||
struct key_word *k;
|
struct key_word *k;
|
||||||
int count;
|
int count;
|
||||||
long e;
|
long e;
|
||||||
count = (unsigned long) p - (unsigned long) r->keyword_first_chars;
|
count = p - r->keyword_first_chars;
|
||||||
k = r->keyword[count];
|
k = r->keyword[count];
|
||||||
e = compare_word_to_right (edit, i, k->keyword, k->whole_word_chars_left, k->whole_word_chars_right, k->line_start);
|
e = compare_word_to_right (edit, i, k->keyword, k->whole_word_chars_left, k->whole_word_chars_right, k->line_start);
|
||||||
if (e > 0) {
|
if (e > 0) {
|
||||||
@ -401,13 +401,15 @@ static int read_one_line (char **line, FILE * f)
|
|||||||
#else
|
#else
|
||||||
p = syntax_malloc (len);
|
p = syntax_malloc (len);
|
||||||
#endif
|
#endif
|
||||||
errno = 0;
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
c = fgetc (f);
|
c = fgetc (f);
|
||||||
|
if (c == EOF) {
|
||||||
|
if (ferror (f)) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
if (c == EOF) {
|
|
||||||
r = 0;
|
r = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} else if (c == '\n') {
|
} else if (c == '\n') {
|
||||||
r = i + 1; /* extra 1 for the newline just read */
|
r = i + 1; /* extra 1 for the newline just read */
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user