diff options
author | Ron Yorston <rmy@pobox.com> | 2013-03-19 11:18:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2013-03-19 11:18:39 +0000 |
commit | 63d2c5fead323df5f4250ed544d0bc03527c8936 (patch) | |
tree | 660979b139a4bc4b143c08843cb7efbc69bdcb4d /editors | |
parent | 27fc2d535588728ac3ca69337271471fb6fe3ee9 (diff) | |
parent | a42f530e034b673726a91ea5d8202254e677f066 (diff) | |
download | busybox-w32-63d2c5fead323df5f4250ed544d0bc03527c8936.tar.gz busybox-w32-63d2c5fead323df5f4250ed544d0bc03527c8936.tar.bz2 busybox-w32-63d2c5fead323df5f4250ed544d0bc03527c8936.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'editors')
-rw-r--r-- | editors/awk.c | 3 | ||||
-rw-r--r-- | editors/vi.c | 16 |
2 files changed, 13 insertions, 6 deletions
diff --git a/editors/awk.c b/editors/awk.c index 3224788c0..0b573a065 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -2661,7 +2661,8 @@ static var *evaluate(node *op, var *res) | |||
2661 | var *vbeg, *v; | 2661 | var *vbeg, *v; |
2662 | const char *sv_progname; | 2662 | const char *sv_progname; |
2663 | 2663 | ||
2664 | if (!op->r.f->body.first) | 2664 | /* The body might be empty, still has to eval the args */ |
2665 | if (!op->r.n->info) | ||
2665 | syntax_error(EMSG_UNDEF_FUNC); | 2666 | syntax_error(EMSG_UNDEF_FUNC); |
2666 | 2667 | ||
2667 | vbeg = v = nvalloc(op->r.f->nargs + 1); | 2668 | vbeg = v = nvalloc(op->r.f->nargs + 1); |
diff --git a/editors/vi.c b/editors/vi.c index 1fc66b931..63b984ea6 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -478,6 +478,7 @@ static void flash(int); // flash the terminal screen | |||
478 | static void show_status_line(void); // put a message on the bottom line | 478 | static void show_status_line(void); // put a message on the bottom line |
479 | static void status_line(const char *, ...); // print to status buf | 479 | static void status_line(const char *, ...); // print to status buf |
480 | static void status_line_bold(const char *, ...); | 480 | static void status_line_bold(const char *, ...); |
481 | static void status_line_bold_errno(const char *fn); | ||
481 | static void not_implemented(const char *); // display "Not implemented" message | 482 | static void not_implemented(const char *); // display "Not implemented" message |
482 | static int format_edit_status(void); // format file status on status line | 483 | static int format_edit_status(void); // format file status on status line |
483 | static void redraw(int); // force a full screen refresh | 484 | static void redraw(int); // force a full screen refresh |
@@ -1321,7 +1322,7 @@ static void colon(char *buf) | |||
1321 | } | 1322 | } |
1322 | if (l < 0) { | 1323 | if (l < 0) { |
1323 | if (l == -1) | 1324 | if (l == -1) |
1324 | status_line_bold("'%s' %s", fn, strerror(errno)); | 1325 | status_line_bold_errno(fn); |
1325 | } else { | 1326 | } else { |
1326 | status_line("'%s' %dL, %dC", fn, li, l); | 1327 | status_line("'%s' %dL, %dC", fn, li, l); |
1327 | if (q == text && r == end - 1 && l == ch) { | 1328 | if (q == text && r == end - 1 && l == ch) { |
@@ -2512,7 +2513,7 @@ static int file_insert(const char *fn, char *p, int update_ro_status) | |||
2512 | 2513 | ||
2513 | /* Validate file */ | 2514 | /* Validate file */ |
2514 | if (stat(fn, &statbuf) < 0) { | 2515 | if (stat(fn, &statbuf) < 0) { |
2515 | status_line_bold("'%s' %s", fn, strerror(errno)); | 2516 | status_line_bold_errno(fn); |
2516 | goto fi0; | 2517 | goto fi0; |
2517 | } | 2518 | } |
2518 | if (!S_ISREG(statbuf.st_mode)) { | 2519 | if (!S_ISREG(statbuf.st_mode)) { |
@@ -2528,18 +2529,18 @@ static int file_insert(const char *fn, char *p, int update_ro_status) | |||
2528 | // read file to buffer | 2529 | // read file to buffer |
2529 | fd = open(fn, O_RDONLY); | 2530 | fd = open(fn, O_RDONLY); |
2530 | if (fd < 0) { | 2531 | if (fd < 0) { |
2531 | status_line_bold("'%s' %s", fn, strerror(errno)); | 2532 | status_line_bold_errno(fn); |
2532 | goto fi0; | 2533 | goto fi0; |
2533 | } | 2534 | } |
2534 | size = (statbuf.st_size < INT_MAX ? (int)statbuf.st_size : INT_MAX); | 2535 | size = (statbuf.st_size < INT_MAX ? (int)statbuf.st_size : INT_MAX); |
2535 | p += text_hole_make(p, size); | 2536 | p += text_hole_make(p, size); |
2536 | cnt = safe_read(fd, p, size); | 2537 | cnt = safe_read(fd, p, size); |
2537 | if (cnt < 0) { | 2538 | if (cnt < 0) { |
2538 | status_line_bold("'%s' %s", fn, strerror(errno)); | 2539 | status_line_bold_errno(fn); |
2539 | p = text_hole_delete(p, p + size - 1); // un-do buffer insert | 2540 | p = text_hole_delete(p, p + size - 1); // un-do buffer insert |
2540 | } else if (cnt < size) { | 2541 | } else if (cnt < size) { |
2541 | // There was a partial read, shrink unused space text[] | 2542 | // There was a partial read, shrink unused space text[] |
2542 | p = text_hole_delete(p + cnt, p + (size - cnt) - 1); // un-do buffer insert | 2543 | p = text_hole_delete(p + cnt, p + size - 1); // un-do buffer insert |
2543 | status_line_bold("can't read '%s'", fn); | 2544 | status_line_bold("can't read '%s'", fn); |
2544 | } | 2545 | } |
2545 | if (cnt >= size) | 2546 | if (cnt >= size) |
@@ -2726,6 +2727,11 @@ static void status_line_bold(const char *format, ...) | |||
2726 | have_status_msg = 1 + sizeof(ESC_BOLD_TEXT) + sizeof(ESC_NORM_TEXT) - 2; | 2727 | have_status_msg = 1 + sizeof(ESC_BOLD_TEXT) + sizeof(ESC_NORM_TEXT) - 2; |
2727 | } | 2728 | } |
2728 | 2729 | ||
2730 | static void status_line_bold_errno(const char *fn) | ||
2731 | { | ||
2732 | status_line_bold("'%s' %s", fn, strerror(errno)); | ||
2733 | } | ||
2734 | |||
2729 | // format status buffer | 2735 | // format status buffer |
2730 | static void status_line(const char *format, ...) | 2736 | static void status_line(const char *format, ...) |
2731 | { | 2737 | { |