diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/vi.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/editors/vi.c b/editors/vi.c index 3f9ba4698..eef895c53 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1233,7 +1233,7 @@ static int count_lines(Byte * start, Byte * stop) // count line from start to st | |||
1233 | if (*q == '\n') | 1233 | if (*q == '\n') |
1234 | cnt++; | 1234 | cnt++; |
1235 | } | 1235 | } |
1236 | return (cnt); | 1236 | return cnt; |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | static Byte *find_line(int li) // find begining of line #li | 1239 | static Byte *find_line(int li) // find begining of line #li |
@@ -1373,7 +1373,7 @@ static Byte *new_screen(int ro, int co) | |||
1373 | for (li = 1; li < ro - 1; li++) { | 1373 | for (li = 1; li < ro - 1; li++) { |
1374 | screen[(li * co) + 0] = '~'; | 1374 | screen[(li * co) + 0] = '~'; |
1375 | } | 1375 | } |
1376 | return (screen); | 1376 | return screen; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | static Byte *new_text(int size) | 1379 | static Byte *new_text(int size) |
@@ -1384,7 +1384,7 @@ static Byte *new_text(int size) | |||
1384 | text = (Byte *) xmalloc(size + 8); | 1384 | text = (Byte *) xmalloc(size + 8); |
1385 | memset(text, '\0', size); // clear new text[] | 1385 | memset(text, '\0', size); // clear new text[] |
1386 | //text += 4; // leave some room for "oops" | 1386 | //text += 4; // leave some room for "oops" |
1387 | return (text); | 1387 | return text; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | #ifdef CONFIG_FEATURE_VI_SEARCH | 1390 | #ifdef CONFIG_FEATURE_VI_SEARCH |
@@ -1398,7 +1398,7 @@ static int mycmp(Byte * s1, Byte * s2, int len) | |||
1398 | i = strncasecmp((char *) s1, (char *) s2, len); | 1398 | i = strncasecmp((char *) s1, (char *) s2, len); |
1399 | } | 1399 | } |
1400 | #endif /* CONFIG_FEATURE_VI_SETOPTS */ | 1400 | #endif /* CONFIG_FEATURE_VI_SETOPTS */ |
1401 | return (i); | 1401 | return i; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for pattern starting at p | 1404 | static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for pattern starting at p |
@@ -1414,7 +1414,7 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for | |||
1414 | stop = next_line(p); // range is to next line | 1414 | stop = next_line(p); // range is to next line |
1415 | for (start = p; start < stop; start++) { | 1415 | for (start = p; start < stop; start++) { |
1416 | if (mycmp(start, pat, len) == 0) { | 1416 | if (mycmp(start, pat, len) == 0) { |
1417 | return (start); | 1417 | return start; |
1418 | } | 1418 | } |
1419 | } | 1419 | } |
1420 | } else if (dir == BACK) { | 1420 | } else if (dir == BACK) { |
@@ -1423,12 +1423,12 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for | |||
1423 | stop = prev_line(p); // range is to prev line | 1423 | stop = prev_line(p); // range is to prev line |
1424 | for (start = p - len; start >= stop; start--) { | 1424 | for (start = p - len; start >= stop; start--) { |
1425 | if (mycmp(start, pat, len) == 0) { | 1425 | if (mycmp(start, pat, len) == 0) { |
1426 | return (start); | 1426 | return start; |
1427 | } | 1427 | } |
1428 | } | 1428 | } |
1429 | } | 1429 | } |
1430 | // pattern not found | 1430 | // pattern not found |
1431 | return (NULL); | 1431 | return NULL; |
1432 | #else /*REGEX_SEARCH */ | 1432 | #else /*REGEX_SEARCH */ |
1433 | char *q; | 1433 | char *q; |
1434 | struct re_pattern_buffer preg; | 1434 | struct re_pattern_buffer preg; |
@@ -1608,7 +1608,7 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c) | |||
1608 | *stop = p; | 1608 | *stop = p; |
1609 | } | 1609 | } |
1610 | dot = save_dot; | 1610 | dot = save_dot; |
1611 | return (c); | 1611 | return c; |
1612 | } | 1612 | } |
1613 | 1613 | ||
1614 | static int st_test(Byte * p, int type, int dir, Byte * tested) | 1614 | static int st_test(Byte * p, int type, int dir, Byte * tested) |
@@ -1642,7 +1642,7 @@ static int st_test(Byte * p, int type, int dir, Byte * tested) | |||
1642 | test = ((isalnum(c)) || c == '_'); | 1642 | test = ((isalnum(c)) || c == '_'); |
1643 | } | 1643 | } |
1644 | *tested = c; | 1644 | *tested = c; |
1645 | return (test); | 1645 | return test; |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | static Byte *skip_thing(Byte * p, int linecnt, int dir, int type) | 1648 | static Byte *skip_thing(Byte * p, int linecnt, int dir, int type) |
@@ -1784,7 +1784,7 @@ static Byte *text_hole_delete(Byte * p, Byte * q) // delete "p" thru "q", inclus | |||
1784 | dest = end = text; // keep pointers valid | 1784 | dest = end = text; // keep pointers valid |
1785 | file_modified++; // has the file been modified | 1785 | file_modified++; // has the file been modified |
1786 | thd0: | 1786 | thd0: |
1787 | return (dest); | 1787 | return dest; |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | // copy text into register, then delete text. | 1790 | // copy text into register, then delete text. |
@@ -1968,7 +1968,7 @@ static Byte what_reg(void) | |||
1968 | c = 'D'; | 1968 | c = 'D'; |
1969 | if (YDreg == 27) | 1969 | if (YDreg == 27) |
1970 | c = 'U'; | 1970 | c = 'U'; |
1971 | return (c); | 1971 | return c; |
1972 | } | 1972 | } |
1973 | 1973 | ||
1974 | static void check_context(Byte cmd) | 1974 | static void check_context(Byte cmd) |
@@ -2086,7 +2086,7 @@ static int mysleep(int hund) // sleep for 'h' 1/100 seconds | |||
2086 | tv.tv_sec = 0; | 2086 | tv.tv_sec = 0; |
2087 | tv.tv_usec = hund * 10000; | 2087 | tv.tv_usec = hund * 10000; |
2088 | select(1, &rfds, NULL, NULL, &tv); | 2088 | select(1, &rfds, NULL, NULL, &tv); |
2089 | return (FD_ISSET(0, &rfds)); | 2089 | return FD_ISSET(0, &rfds); |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | #define readbuffer bb_common_bufsiz1 | 2092 | #define readbuffer bb_common_bufsiz1 |
@@ -2214,7 +2214,7 @@ static Byte readit(void) // read (maybe cursor) key from stdin | |||
2214 | readed_for_parse -= n; | 2214 | readed_for_parse -= n; |
2215 | memmove(readbuffer, readbuffer + n, BUFSIZ - n); | 2215 | memmove(readbuffer, readbuffer + n, BUFSIZ - n); |
2216 | (void) alarm(3); // we are done waiting for input, turn alarm ON | 2216 | (void) alarm(3); // we are done waiting for input, turn alarm ON |
2217 | return (c); | 2217 | return c; |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | //----- IO Routines -------------------------------------------- | 2220 | //----- IO Routines -------------------------------------------- |
@@ -2258,7 +2258,7 @@ static Byte get_one_char(void) | |||
2258 | #else /* CONFIG_FEATURE_VI_DOT_CMD */ | 2258 | #else /* CONFIG_FEATURE_VI_DOT_CMD */ |
2259 | c = readit(); // get the users input | 2259 | c = readit(); // get the users input |
2260 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ | 2260 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ |
2261 | return (c); // return the char, where ever it came from | 2261 | return c; // return the char, where ever it came from |
2262 | } | 2262 | } |
2263 | 2263 | ||
2264 | static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | 2264 | static Byte *get_input_line(Byte * prompt) // get input line- use "status line" |
@@ -2297,7 +2297,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | |||
2297 | refresh(FALSE); | 2297 | refresh(FALSE); |
2298 | free(obufp); | 2298 | free(obufp); |
2299 | obufp = (Byte *) xstrdup((char *) buf); | 2299 | obufp = (Byte *) xstrdup((char *) buf); |
2300 | return (obufp); | 2300 | return obufp; |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | static int file_size(const Byte * fn) // what is the byte size of "fn" | 2303 | static int file_size(const Byte * fn) // what is the byte size of "fn" |
@@ -2312,7 +2312,7 @@ static int file_size(const Byte * fn) // what is the byte size of "fn" | |||
2312 | if (sr >= 0) { | 2312 | if (sr >= 0) { |
2313 | cnt = (int) st_buf.st_size; | 2313 | cnt = (int) st_buf.st_size; |
2314 | } | 2314 | } |
2315 | return (cnt); | 2315 | return cnt; |
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | static int file_insert(Byte * fn, Byte * p, int size) | 2318 | static int file_insert(Byte * fn, Byte * p, int size) |
@@ -2376,7 +2376,7 @@ static int file_insert(Byte * fn, Byte * p, int size) | |||
2376 | if (cnt >= size) | 2376 | if (cnt >= size) |
2377 | file_modified++; | 2377 | file_modified++; |
2378 | fi0: | 2378 | fi0: |
2379 | return (cnt); | 2379 | return cnt; |
2380 | } | 2380 | } |
2381 | 2381 | ||
2382 | static int file_write(Byte * fn, Byte * first, Byte * last) | 2382 | static int file_write(Byte * fn, Byte * first, Byte * last) |
@@ -2385,7 +2385,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) | |||
2385 | 2385 | ||
2386 | if (fn == 0) { | 2386 | if (fn == 0) { |
2387 | psbs("No current filename"); | 2387 | psbs("No current filename"); |
2388 | return (-2); | 2388 | return -2; |
2389 | } | 2389 | } |
2390 | charcnt = 0; | 2390 | charcnt = 0; |
2391 | // FIXIT- use the correct umask() | 2391 | // FIXIT- use the correct umask() |
@@ -2401,7 +2401,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) | |||
2401 | charcnt = 0; | 2401 | charcnt = 0; |
2402 | } | 2402 | } |
2403 | close(fd); | 2403 | close(fd); |
2404 | return (charcnt); | 2404 | return charcnt; |
2405 | } | 2405 | } |
2406 | 2406 | ||
2407 | //----- Terminal Drawing --------------------------------------- | 2407 | //----- Terminal Drawing --------------------------------------- |