Re: mcedit problem (2)
- From: "Andrew V. Samoilov" <kai cmail ru>
- To: Oskar Liljeblad <oskar osk mine nu>
- Cc: Pavel Roskin <proski gnu org>, Björn Eriksson <mdeans algonet se>, mc-devel gnome org
- Subject: Re: mcedit problem (2)
- Date: Sat, 22 Dec 2001 18:20:55 +0200
Hello Oskar, Pavel and Bjorn!
I hope all of us will be happy with next solution:
diff -u mc/edit/ChangeLog:1.33 mc/edit/ChangeLog:1.34
--- mc/edit/ChangeLog:1.33 Fri Dec 21 19:32:20 2001
+++ mc/edit/ChangeLog Sat Dec 22 11:00:30 2001
@@ -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>
* edit.c (user_menu): Don't move the cursor before and after
Index: mc/edit/syntax.c
diff -u mc/edit/syntax.c:1.19 mc/edit/syntax.c:1.20
--- mc/edit/syntax.c:1.19 Fri Dec 21 18:33:18 2001
+++ mc/edit/syntax.c Sat Dec 22 11:00:30 2001
@@ -82,7 +82,7 @@
if (whole_left)
if (strchr (whole_left, c))
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) {
case '\001':
p++;
@@ -243,7 +243,7 @@
struct key_word *k;
int count;
long e;
- count = (unsigned long) p - (unsigned long) r->keyword_first_chars;
+ count = p - r->keyword_first_chars;
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);
if (e > 0) {
@@ -310,7 +310,7 @@
struct key_word *k;
int count;
long e;
- count = (unsigned long) p - (unsigned long) r->keyword_first_chars;
+ count = p - r->keyword_first_chars;
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);
if (e > 0) {
@@ -401,13 +401,15 @@
#else
p = syntax_malloc (len);
#endif
- errno = 0;
+
for (;;) {
c = fgetc (f);
- if (errno == EINTR)
- continue;
if (c == EOF) {
- r = 0;
+ if (ferror (f)) {
+ if (errno == EINTR)
+ continue;
+ r = 0;
+ }
break;
} else if (c == '\n') {
r = i + 1; /* extra 1 for the newline just read */
Index: mc/edit/ChangeLog
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]