diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-26 13:32:30 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-26 13:32:30 +0000 |
commit | 08ec67bc62242503f77d9503fdbf820c9c12d856 (patch) | |
tree | 101a86c0fe86a07f786670ceca36bfcbdc2794ed /libbb/lineedit.c | |
parent | cc2965fd236a85e5cac4fffa1c34057997780385 (diff) | |
download | busybox-w32-08ec67bc62242503f77d9503fdbf820c9c12d856.tar.gz busybox-w32-08ec67bc62242503f77d9503fdbf820c9c12d856.tar.bz2 busybox-w32-08ec67bc62242503f77d9503fdbf820c9c12d856.zip |
patch: add support for -R. ~ +110 byte. By Pascal Bellard <pascal.bellard AT ads-lu.com>
fbsplash: new applet by Michele Sanges <michele.sanges AT otomelara.it
function old new delta
fbsplash_main - 1525 +1525
fb_drawfullrectangle - 118 +118
static.param_value - 100 +100
packed_usage 23776 23872 +96
applet_names 1843 1852 +9
applet_main 1120 1124 +4
read_line_input 3156 3158 +2
applet_nameofs 560 562 +2
applet_install_loc 140 141 +1
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 6/0 up/down: 1857/0) Total: 1857 bytes
text data bss dec hex filename
799233 641 7380 807254 c5156 busybox_old
801202 641 7380 809223 c5907 busybox_unstripped
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index b25386bc0..5d65665d3 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -958,14 +958,16 @@ static void load_history(const char *fromfile) | |||
958 | FILE *fp; | 958 | FILE *fp; |
959 | int hi; | 959 | int hi; |
960 | 960 | ||
961 | /* cleanup old */ | 961 | /* NB: do not trash old history if file can't be opened */ |
962 | for (hi = state->cnt_history; hi > 0;) { | ||
963 | hi--; | ||
964 | free(state->history[hi]); | ||
965 | } | ||
966 | 962 | ||
967 | fp = fopen(fromfile, "r"); | 963 | fp = fopen(fromfile, "r"); |
968 | if (fp) { | 964 | if (fp) { |
965 | /* clean up old history */ | ||
966 | for (hi = state->cnt_history; hi > 0;) { | ||
967 | hi--; | ||
968 | free(state->history[hi]); | ||
969 | } | ||
970 | |||
969 | for (hi = 0; hi < MAX_HISTORY;) { | 971 | for (hi = 0; hi < MAX_HISTORY;) { |
970 | char *hl = xmalloc_getline(fp); | 972 | char *hl = xmalloc_getline(fp); |
971 | int l; | 973 | int l; |
@@ -982,8 +984,8 @@ static void load_history(const char *fromfile) | |||
982 | state->history[hi++] = hl; | 984 | state->history[hi++] = hl; |
983 | } | 985 | } |
984 | fclose(fp); | 986 | fclose(fp); |
987 | state->cur_history = state->cnt_history = hi; | ||
985 | } | 988 | } |
986 | state->cur_history = state->cnt_history = hi; | ||
987 | } | 989 | } |
988 | 990 | ||
989 | /* state->flags is already checked to be nonzero */ | 991 | /* state->flags is already checked to be nonzero */ |