aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c12
-rw-r--r--editors/diff.c2
-rw-r--r--editors/ed.c1
-rw-r--r--editors/vi.c15
4 files changed, 8 insertions, 22 deletions
diff --git a/editors/awk.c b/editors/awk.c
index 5b8e484a7..b4b6c5f78 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -1064,12 +1064,10 @@ static uint32_t next_token(uint32_t expected)
1064 1064
1065 if (t_rollback) { 1065 if (t_rollback) {
1066 t_rollback = FALSE; 1066 t_rollback = FALSE;
1067
1068 } else if (concat_inserted) { 1067 } else if (concat_inserted) {
1069 concat_inserted = FALSE; 1068 concat_inserted = FALSE;
1070 t_tclass = save_tclass; 1069 t_tclass = save_tclass;
1071 t_info = save_info; 1070 t_info = save_info;
1072
1073 } else { 1071 } else {
1074 p = g_pos; 1072 p = g_pos;
1075 readnext: 1073 readnext:
@@ -1085,7 +1083,6 @@ static uint32_t next_token(uint32_t expected)
1085 if (*p == '\0') { 1083 if (*p == '\0') {
1086 tc = TC_EOF; 1084 tc = TC_EOF;
1087 debug_printf_parse("%s: token found: TC_EOF\n", __func__); 1085 debug_printf_parse("%s: token found: TC_EOF\n", __func__);
1088
1089 } else if (*p == '\"') { 1086 } else if (*p == '\"') {
1090 /* it's a string */ 1087 /* it's a string */
1091 t_string = s = ++p; 1088 t_string = s = ++p;
@@ -1101,7 +1098,6 @@ static uint32_t next_token(uint32_t expected)
1101 *s = '\0'; 1098 *s = '\0';
1102 tc = TC_STRING; 1099 tc = TC_STRING;
1103 debug_printf_parse("%s: token found:'%s' TC_STRING\n", __func__, t_string); 1100 debug_printf_parse("%s: token found:'%s' TC_STRING\n", __func__, t_string);
1104
1105 } else if ((expected & TC_REGEXP) && *p == '/') { 1101 } else if ((expected & TC_REGEXP) && *p == '/') {
1106 /* it's regexp */ 1102 /* it's regexp */
1107 t_string = s = ++p; 1103 t_string = s = ++p;
@@ -1134,7 +1130,6 @@ static uint32_t next_token(uint32_t expected)
1134 syntax_error(EMSG_UNEXP_TOKEN); 1130 syntax_error(EMSG_UNEXP_TOKEN);
1135 tc = TC_NUMBER; 1131 tc = TC_NUMBER;
1136 debug_printf_parse("%s: token found:%f TC_NUMBER\n", __func__, t_double); 1132 debug_printf_parse("%s: token found:%f TC_NUMBER\n", __func__, t_double);
1137
1138 } else { 1133 } else {
1139 /* search for something known */ 1134 /* search for something known */
1140 tl = tokenlist; 1135 tl = tokenlist;
@@ -1584,12 +1579,10 @@ static void parse_program(char *p)
1584 debug_printf_parse("%s: TC_BEGIN\n", __func__); 1579 debug_printf_parse("%s: TC_BEGIN\n", __func__);
1585 seq = &beginseq; 1580 seq = &beginseq;
1586 chain_group(); 1581 chain_group();
1587
1588 } else if (tclass & TC_END) { 1582 } else if (tclass & TC_END) {
1589 debug_printf_parse("%s: TC_END\n", __func__); 1583 debug_printf_parse("%s: TC_END\n", __func__);
1590 seq = &endseq; 1584 seq = &endseq;
1591 chain_group(); 1585 chain_group();
1592
1593 } else if (tclass & TC_FUNCDECL) { 1586 } else if (tclass & TC_FUNCDECL) {
1594 debug_printf_parse("%s: TC_FUNCDECL\n", __func__); 1587 debug_printf_parse("%s: TC_FUNCDECL\n", __func__);
1595 next_token(TC_FUNCTION); 1588 next_token(TC_FUNCTION);
@@ -1607,7 +1600,6 @@ static void parse_program(char *p)
1607 seq = &f->body; 1600 seq = &f->body;
1608 chain_group(); 1601 chain_group();
1609 clear_array(ahash); 1602 clear_array(ahash);
1610
1611 } else if (tclass & TC_OPSEQ) { 1603 } else if (tclass & TC_OPSEQ) {
1612 debug_printf_parse("%s: TC_OPSEQ\n", __func__); 1604 debug_printf_parse("%s: TC_OPSEQ\n", __func__);
1613 rollback_token(); 1605 rollback_token();
@@ -1622,7 +1614,6 @@ static void parse_program(char *p)
1622 chain_node(OC_PRINT); 1614 chain_node(OC_PRINT);
1623 } 1615 }
1624 cn->r.n = mainseq.last; 1616 cn->r.n = mainseq.last;
1625
1626 } else /* if (tclass & TC_GRPSTART) */ { 1617 } else /* if (tclass & TC_GRPSTART) */ {
1627 debug_printf_parse("%s: TC_GRPSTART(?)\n", __func__); 1618 debug_printf_parse("%s: TC_GRPSTART(?)\n", __func__);
1628 rollback_token(); 1619 rollback_token();
@@ -1883,13 +1874,10 @@ static void handle_special(var *v)
1883 split_f0(); 1874 split_f0();
1884 1875
1885 mk_splitter(getvar_s(v), &fsplitter); 1876 mk_splitter(getvar_s(v), &fsplitter);
1886
1887 } else if (v == intvar[RS]) { 1877 } else if (v == intvar[RS]) {
1888 mk_splitter(getvar_s(v), &rsplitter); 1878 mk_splitter(getvar_s(v), &rsplitter);
1889
1890 } else if (v == intvar[IGNORECASE]) { 1879 } else if (v == intvar[IGNORECASE]) {
1891 icase = istrue(v); 1880 icase = istrue(v);
1892
1893 } else { /* $n */ 1881 } else { /* $n */
1894 n = getvar_i(intvar[NF]); 1882 n = getvar_i(intvar[NF]);
1895 setvar_i(intvar[NF], n > v-Fields ? n : v-Fields+1); 1883 setvar_i(intvar[NF], n > v-Fields ? n : v-Fields+1);
diff --git a/editors/diff.c b/editors/diff.c
index c3ad31bf3..cf14b1d03 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -363,7 +363,7 @@ static void stone(const int *a, int n, const int *b, int *J, int pref)
363} 363}
364 364
365struct line { 365struct line {
366 /* 'serial' is not used in the begining, so we reuse it 366 /* 'serial' is not used in the beginning, so we reuse it
367 * to store line offsets, thus reducing memory pressure 367 * to store line offsets, thus reducing memory pressure
368 */ 368 */
369 union { 369 union {
diff --git a/editors/ed.c b/editors/ed.c
index 3087fb0b9..f0e5e4d5d 100644
--- a/editors/ed.c
+++ b/editors/ed.c
@@ -732,7 +732,6 @@ static int readLines(const char *file, int num)
732 cc = safe_read(fd, bufPtr, bufSize - bufUsed); 732 cc = safe_read(fd, bufPtr, bufSize - bufUsed);
733 bufUsed += cc; 733 bufUsed += cc;
734 bufPtr = bufBase; 734 bufPtr = bufBase;
735
736 } while (cc > 0); 735 } while (cc > 0);
737 736
738 if (cc < 0) { 737 if (cc < 0) {
diff --git a/editors/vi.c b/editors/vi.c
index 3eed279e7..075f714cf 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -411,7 +411,6 @@ struct globals {
411 char undo_text[1]; // text that was deleted (if deletion) 411 char undo_text[1]; // text that was deleted (if deletion)
412 } *undo_stack_tail; 412 } *undo_stack_tail;
413#endif /* ENABLE_FEATURE_VI_UNDO */ 413#endif /* ENABLE_FEATURE_VI_UNDO */
414
415}; 414};
416#define G (*ptr_to_globals) 415#define G (*ptr_to_globals)
417#define text (G.text ) 416#define text (G.text )
@@ -501,7 +500,7 @@ static char *prev_line(char *); // return pointer to prev line B-o-l
501static char *next_line(char *); // return pointer to next line B-o-l 500static char *next_line(char *); // return pointer to next line B-o-l
502static char *end_screen(void); // get pointer to last char on screen 501static char *end_screen(void); // get pointer to last char on screen
503static int count_lines(char *, char *); // count line from start to stop 502static int count_lines(char *, char *); // count line from start to stop
504static char *find_line(int); // find begining of line #li 503static char *find_line(int); // find beginning of line #li
505static char *move_to_col(char *, int); // move "p" to column l 504static char *move_to_col(char *, int); // move "p" to column l
506static void dot_left(void); // move dot left- dont leave line 505static void dot_left(void); // move dot left- dont leave line
507static void dot_right(void); // move dot right- dont leave line 506static void dot_right(void); // move dot right- dont leave line
@@ -1684,10 +1683,10 @@ static char *dollar_line(char *p) // return pointer to just before NL line
1684 1683
1685static char *prev_line(char *p) // return pointer first char prev line 1684static char *prev_line(char *p) // return pointer first char prev line
1686{ 1685{
1687 p = begin_line(p); // goto begining of cur line 1686 p = begin_line(p); // goto beginning of cur line
1688 if (p > text && p[-1] == '\n') 1687 if (p > text && p[-1] == '\n')
1689 p--; // step to prev line 1688 p--; // step to prev line
1690 p = begin_line(p); // goto begining of prev line 1689 p = begin_line(p); // goto beginning of prev line
1691 return p; 1690 return p;
1692} 1691}
1693 1692
@@ -1735,7 +1734,7 @@ static int count_lines(char *start, char *stop)
1735 return cnt; 1734 return cnt;
1736} 1735}
1737 1736
1738static char *find_line(int li) // find begining of line #li 1737static char *find_line(int li) // find beginning of line #li
1739{ 1738{
1740 char *q; 1739 char *q;
1741 1740
@@ -3404,7 +3403,7 @@ static void refresh(int full_screen)
3404 tp = t + 1; 3403 tp = t + 1;
3405 } 3404 }
3406 3405
3407 // see if there are any changes between vitual screen and out_buf 3406 // see if there are any changes between virtual screen and out_buf
3408 changed = FALSE; // assume no change 3407 changed = FALSE; // assume no change
3409 cs = 0; 3408 cs = 0;
3410 ce = columns - 1; 3409 ce = columns - 1;
@@ -3441,7 +3440,7 @@ static void refresh(int full_screen)
3441 if (cs < 0) cs = 0; 3440 if (cs < 0) cs = 0;
3442 if (ce > columns - 1) ce = columns - 1; 3441 if (ce > columns - 1) ce = columns - 1;
3443 if (cs > ce) { cs = 0; ce = columns - 1; } 3442 if (cs > ce) { cs = 0; ce = columns - 1; }
3444 // is there a change between vitual screen and out_buf 3443 // is there a change between virtual screen and out_buf
3445 if (changed) { 3444 if (changed) {
3446 // copy changed part of buffer to virtual screen 3445 // copy changed part of buffer to virtual screen
3447 memcpy(sp+cs, out_buf+cs, ce-cs+1); 3446 memcpy(sp+cs, out_buf+cs, ce-cs+1);
@@ -3891,7 +3890,7 @@ static void do_cmd(int c)
3891 } 3890 }
3892 break; 3891 break;
3893#endif /* FEATURE_VI_SEARCH */ 3892#endif /* FEATURE_VI_SEARCH */
3894 case '0': // 0- goto begining of line 3893 case '0': // 0- goto beginning of line
3895 case '1': // 1- 3894 case '1': // 1-
3896 case '2': // 2- 3895 case '2': // 2-
3897 case '3': // 3- 3896 case '3': // 3-