diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/patch.c | 8 | ||||
-rw-r--r-- | editors/vi.c | 50 |
2 files changed, 29 insertions, 29 deletions
diff --git a/editors/patch.c b/editors/patch.c index 4ddcd004d..f11f8a1a2 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -43,7 +43,7 @@ static unsigned int copy_lines(FILE *src_stream, FILE *dest_stream, const unsign | |||
43 | 43 | ||
44 | i++; | 44 | i++; |
45 | } | 45 | } |
46 | return(i); | 46 | return i; |
47 | } | 47 | } |
48 | 48 | ||
49 | /* If patch_level is -1 it will remove all directory names | 49 | /* If patch_level is -1 it will remove all directory names |
@@ -67,13 +67,13 @@ static char *extract_filename(char *line, int patch_level) | |||
67 | filename_start_ptr = temp + 1; | 67 | filename_start_ptr = temp + 1; |
68 | } | 68 | } |
69 | 69 | ||
70 | return(xstrdup(filename_start_ptr)); | 70 | return xstrdup(filename_start_ptr); |
71 | } | 71 | } |
72 | 72 | ||
73 | static int file_doesnt_exist(const char *filename) | 73 | static int file_doesnt_exist(const char *filename) |
74 | { | 74 | { |
75 | struct stat statbuf; | 75 | struct stat statbuf; |
76 | return(stat(filename, &statbuf)); | 76 | return stat(filename, &statbuf); |
77 | } | 77 | } |
78 | 78 | ||
79 | int patch_main(int argc, char **argv) | 79 | int patch_main(int argc, char **argv) |
@@ -269,5 +269,5 @@ int patch_main(int argc, char **argv) | |||
269 | * 1 = Some hunks failed | 269 | * 1 = Some hunks failed |
270 | * 2 = More serious problems | 270 | * 2 = More serious problems |
271 | */ | 271 | */ |
272 | return(ret); | 272 | return ret; |
273 | } | 273 | } |
diff --git a/editors/vi.c b/editors/vi.c index f1c79895e..3f9ba4698 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -343,7 +343,7 @@ int vi_main(int argc, char **argv) | |||
343 | } | 343 | } |
344 | //----------------------------------------------------------- | 344 | //----------------------------------------------------------- |
345 | 345 | ||
346 | return (0); | 346 | return 0; |
347 | } | 347 | } |
348 | 348 | ||
349 | static void edit_file(Byte * fn) | 349 | static void edit_file(Byte * fn) |
@@ -530,7 +530,7 @@ static Byte *get_one_address(Byte * p, int *addr) // get colon addr, if present | |||
530 | // unrecognised address- assume -1 | 530 | // unrecognised address- assume -1 |
531 | *addr = -1; | 531 | *addr = -1; |
532 | } | 532 | } |
533 | return (p); | 533 | return p; |
534 | } | 534 | } |
535 | 535 | ||
536 | static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if present | 536 | static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if present |
@@ -558,7 +558,7 @@ static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if pre | |||
558 | ga0: | 558 | ga0: |
559 | while (isblnk(*p)) | 559 | while (isblnk(*p)) |
560 | p++; // skip over trailing spaces | 560 | p++; // skip over trailing spaces |
561 | return (p); | 561 | return p; |
562 | } | 562 | } |
563 | 563 | ||
564 | #ifdef CONFIG_FEATURE_VI_SETOPTS | 564 | #ifdef CONFIG_FEATURE_VI_SETOPTS |
@@ -1166,14 +1166,14 @@ static Byte *begin_line(Byte * p) // return pointer to first char cur line | |||
1166 | { | 1166 | { |
1167 | while (p > text && p[-1] != '\n') | 1167 | while (p > text && p[-1] != '\n') |
1168 | p--; // go to cur line B-o-l | 1168 | p--; // go to cur line B-o-l |
1169 | return (p); | 1169 | return p; |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | static Byte *end_line(Byte * p) // return pointer to NL of cur line line | 1172 | static Byte *end_line(Byte * p) // return pointer to NL of cur line line |
1173 | { | 1173 | { |
1174 | while (p < end - 1 && *p != '\n') | 1174 | while (p < end - 1 && *p != '\n') |
1175 | p++; // go to cur line E-o-l | 1175 | p++; // go to cur line E-o-l |
1176 | return (p); | 1176 | return p; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | static inline Byte *dollar_line(Byte * p) // return pointer to just before NL line | 1179 | static inline Byte *dollar_line(Byte * p) // return pointer to just before NL line |
@@ -1183,7 +1183,7 @@ static inline Byte *dollar_line(Byte * p) // return pointer to just before NL li | |||
1183 | // Try to stay off of the Newline | 1183 | // Try to stay off of the Newline |
1184 | if (*p == '\n' && (p - begin_line(p)) > 0) | 1184 | if (*p == '\n' && (p - begin_line(p)) > 0) |
1185 | p--; | 1185 | p--; |
1186 | return (p); | 1186 | return p; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | static Byte *prev_line(Byte * p) // return pointer first char prev line | 1189 | static Byte *prev_line(Byte * p) // return pointer first char prev line |
@@ -1192,7 +1192,7 @@ static Byte *prev_line(Byte * p) // return pointer first char prev line | |||
1192 | if (p[-1] == '\n' && p > text) | 1192 | if (p[-1] == '\n' && p > text) |
1193 | p--; // step to prev line | 1193 | p--; // step to prev line |
1194 | p = begin_line(p); // goto begining of prev line | 1194 | p = begin_line(p); // goto begining of prev line |
1195 | return (p); | 1195 | return p; |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | static Byte *next_line(Byte * p) // return pointer first char next line | 1198 | static Byte *next_line(Byte * p) // return pointer first char next line |
@@ -1200,7 +1200,7 @@ static Byte *next_line(Byte * p) // return pointer first char next line | |||
1200 | p = end_line(p); | 1200 | p = end_line(p); |
1201 | if (*p == '\n' && p < end - 1) | 1201 | if (*p == '\n' && p < end - 1) |
1202 | p++; // step to next line | 1202 | p++; // step to next line |
1203 | return (p); | 1203 | return p; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | //----- Text Information Routines ------------------------------ | 1206 | //----- Text Information Routines ------------------------------ |
@@ -1214,7 +1214,7 @@ static Byte *end_screen(void) | |||
1214 | for (cnt = 0; cnt < rows - 2; cnt++) | 1214 | for (cnt = 0; cnt < rows - 2; cnt++) |
1215 | q = next_line(q); | 1215 | q = next_line(q); |
1216 | q = end_line(q); | 1216 | q = end_line(q); |
1217 | return (q); | 1217 | return q; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | static int count_lines(Byte * start, Byte * stop) // count line from start to stop | 1220 | static int count_lines(Byte * start, Byte * stop) // count line from start to stop |
@@ -1243,7 +1243,7 @@ static Byte *find_line(int li) // find begining of line #li | |||
1243 | for (q = text; li > 1; li--) { | 1243 | for (q = text; li > 1; li--) { |
1244 | q = next_line(q); | 1244 | q = next_line(q); |
1245 | } | 1245 | } |
1246 | return (q); | 1246 | return q; |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | //----- Dot Movement Routines ---------------------------------- | 1249 | //----- Dot Movement Routines ---------------------------------- |
@@ -1285,7 +1285,7 @@ static Byte *move_to_col(Byte * p, int l) | |||
1285 | co++; // display as ^X, use 2 columns | 1285 | co++; // display as ^X, use 2 columns |
1286 | } | 1286 | } |
1287 | } while (++co <= l && p++ < end); | 1287 | } while (++co <= l && p++ < end); |
1288 | return (p); | 1288 | return p; |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | static void dot_next(void) | 1291 | static void dot_next(void) |
@@ -1344,7 +1344,7 @@ static Byte *bound_dot(Byte * p) // make sure text[0] <= P < "end" | |||
1344 | p = text; | 1344 | p = text; |
1345 | indicate_error('2'); | 1345 | indicate_error('2'); |
1346 | } | 1346 | } |
1347 | return (p); | 1347 | return p; |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | //----- Helper Utility Routines -------------------------------- | 1350 | //----- Helper Utility Routines -------------------------------- |
@@ -1489,7 +1489,7 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for | |||
1489 | } else { | 1489 | } else { |
1490 | p = p - i; | 1490 | p = p - i; |
1491 | } | 1491 | } |
1492 | return (p); | 1492 | return p; |
1493 | #endif /*REGEX_SEARCH */ | 1493 | #endif /*REGEX_SEARCH */ |
1494 | } | 1494 | } |
1495 | #endif /* CONFIG_FEATURE_VI_SEARCH */ | 1495 | #endif /* CONFIG_FEATURE_VI_SEARCH */ |
@@ -1540,7 +1540,7 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p' | |||
1540 | } | 1540 | } |
1541 | #endif /* CONFIG_FEATURE_VI_SETOPTS */ | 1541 | #endif /* CONFIG_FEATURE_VI_SETOPTS */ |
1542 | } | 1542 | } |
1543 | return (p); | 1543 | return p; |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p' | 1546 | static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p' |
@@ -1551,7 +1551,7 @@ static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p | |||
1551 | file_modified++; // has the file been modified | 1551 | file_modified++; // has the file been modified |
1552 | p++; | 1552 | p++; |
1553 | } | 1553 | } |
1554 | return (p); | 1554 | return p; |
1555 | } | 1555 | } |
1556 | 1556 | ||
1557 | static Byte find_range(Byte ** start, Byte ** stop, Byte c) | 1557 | static Byte find_range(Byte ** start, Byte ** stop, Byte c) |
@@ -1659,7 +1659,7 @@ static Byte *skip_thing(Byte * p, int linecnt, int dir, int type) | |||
1659 | break; | 1659 | break; |
1660 | p += dir; // move to next char | 1660 | p += dir; // move to next char |
1661 | } | 1661 | } |
1662 | return (p); | 1662 | return p; |
1663 | } | 1663 | } |
1664 | 1664 | ||
1665 | // find matching char of pair () [] {} | 1665 | // find matching char of pair () [] {} |
@@ -1705,7 +1705,7 @@ static Byte *find_pair(Byte * p, Byte c) | |||
1705 | } | 1705 | } |
1706 | if (level != 0) | 1706 | if (level != 0) |
1707 | q = NULL; // indicate no match | 1707 | q = NULL; // indicate no match |
1708 | return (q); | 1708 | return q; |
1709 | } | 1709 | } |
1710 | 1710 | ||
1711 | #ifdef CONFIG_FEATURE_VI_SETOPTS | 1711 | #ifdef CONFIG_FEATURE_VI_SETOPTS |
@@ -1748,7 +1748,7 @@ static Byte *text_hole_make(Byte * p, int size) // at "p", make a 'size' byte ho | |||
1748 | end = end + size; // adjust the new END | 1748 | end = end + size; // adjust the new END |
1749 | file_modified++; // has the file been modified | 1749 | file_modified++; // has the file been modified |
1750 | thm0: | 1750 | thm0: |
1751 | return (p); | 1751 | return p; |
1752 | } | 1752 | } |
1753 | 1753 | ||
1754 | // close a hole in text[] | 1754 | // close a hole in text[] |
@@ -1805,7 +1805,7 @@ static Byte *yank_delete(Byte * start, Byte * stop, int dist, int yf) | |||
1805 | // we cannot cross NL boundaries | 1805 | // we cannot cross NL boundaries |
1806 | p = start; | 1806 | p = start; |
1807 | if (*p == '\n') | 1807 | if (*p == '\n') |
1808 | return (p); | 1808 | return p; |
1809 | // dont go past a NewLine | 1809 | // dont go past a NewLine |
1810 | for (; p + 1 <= stop; p++) { | 1810 | for (; p + 1 <= stop; p++) { |
1811 | if (p[1] == '\n') { | 1811 | if (p[1] == '\n') { |
@@ -1821,7 +1821,7 @@ static Byte *yank_delete(Byte * start, Byte * stop, int dist, int yf) | |||
1821 | if (yf == YANKDEL) { | 1821 | if (yf == YANKDEL) { |
1822 | p = text_hole_delete(start, stop); | 1822 | p = text_hole_delete(start, stop); |
1823 | } // delete lines | 1823 | } // delete lines |
1824 | return (p); | 1824 | return p; |
1825 | } | 1825 | } |
1826 | 1826 | ||
1827 | static void show_help(void) | 1827 | static void show_help(void) |
@@ -1932,7 +1932,7 @@ static Byte *string_insert(Byte * p, Byte * s) // insert the string at 'p' | |||
1932 | #ifdef CONFIG_FEATURE_VI_YANKMARK | 1932 | #ifdef CONFIG_FEATURE_VI_YANKMARK |
1933 | psb("Put %d lines (%d chars) from [%c]", cnt, i, what_reg()); | 1933 | psb("Put %d lines (%d chars) from [%c]", cnt, i, what_reg()); |
1934 | #endif /* CONFIG_FEATURE_VI_YANKMARK */ | 1934 | #endif /* CONFIG_FEATURE_VI_YANKMARK */ |
1935 | return (p); | 1935 | return p; |
1936 | } | 1936 | } |
1937 | #endif /* CONFIG_FEATURE_VI_YANKMARK || CONFIG_FEATURE_VI_COLON || CONFIG_FEATURE_VI_CRASHME */ | 1937 | #endif /* CONFIG_FEATURE_VI_YANKMARK || CONFIG_FEATURE_VI_COLON || CONFIG_FEATURE_VI_CRASHME */ |
1938 | 1938 | ||
@@ -1954,7 +1954,7 @@ static Byte *text_yank(Byte * p, Byte * q, int dest) // copy text into a registe | |||
1954 | memset(t, '\0', cnt + 1); // clear new text[] | 1954 | memset(t, '\0', cnt + 1); // clear new text[] |
1955 | strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer | 1955 | strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer |
1956 | reg[dest] = t; | 1956 | reg[dest] = t; |
1957 | return (p); | 1957 | return p; |
1958 | } | 1958 | } |
1959 | 1959 | ||
1960 | static Byte what_reg(void) | 1960 | static Byte what_reg(void) |
@@ -2004,7 +2004,7 @@ static inline Byte *swap_context(Byte * p) // goto new context for '' command ma | |||
2004 | context_start = prev_line(prev_line(prev_line(p))); | 2004 | context_start = prev_line(prev_line(prev_line(p))); |
2005 | context_end = next_line(next_line(next_line(p))); | 2005 | context_end = next_line(next_line(next_line(p))); |
2006 | } | 2006 | } |
2007 | return (p); | 2007 | return p; |
2008 | } | 2008 | } |
2009 | #endif /* CONFIG_FEATURE_VI_YANKMARK */ | 2009 | #endif /* CONFIG_FEATURE_VI_YANKMARK */ |
2010 | 2010 | ||
@@ -2306,7 +2306,7 @@ static int file_size(const Byte * fn) // what is the byte size of "fn" | |||
2306 | int cnt, sr; | 2306 | int cnt, sr; |
2307 | 2307 | ||
2308 | if (fn == 0 || strlen((char *)fn) <= 0) | 2308 | if (fn == 0 || strlen((char *)fn) <= 0) |
2309 | return (-1); | 2309 | return -1; |
2310 | cnt = -1; | 2310 | cnt = -1; |
2311 | sr = stat((char *) fn, &st_buf); // see if file exists | 2311 | sr = stat((char *) fn, &st_buf); // see if file exists |
2312 | if (sr >= 0) { | 2312 | if (sr >= 0) { |
@@ -2391,7 +2391,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) | |||
2391 | // FIXIT- use the correct umask() | 2391 | // FIXIT- use the correct umask() |
2392 | fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664); | 2392 | fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664); |
2393 | if (fd < 0) | 2393 | if (fd < 0) |
2394 | return (-1); | 2394 | return -1; |
2395 | cnt = last - first + 1; | 2395 | cnt = last - first + 1; |
2396 | charcnt = write(fd, first, cnt); | 2396 | charcnt = write(fd, first, cnt); |
2397 | if (charcnt == cnt) { | 2397 | if (charcnt == cnt) { |