diff options
| author | Timo Savinen <tjsa@iki.fi> | 2005-11-08 18:31:40 +0000 |
|---|---|---|
| committer | Hadrien Dorio <hadrien.dorio@gmail.com> | 2017-12-16 00:24:06 +0100 |
| commit | 63ae206f2970076a9d09e90d7fbcb17ec1fa26e4 (patch) | |
| tree | 4bd49dbd6b9fadd98716eb9c84107926886128e8 /src | |
| parent | 9ed0cccb2c28d503169afe15f123007526a50535 (diff) | |
| download | binary-block-editor-63ae206f2970076a9d09e90d7fbcb17ec1fa26e4.tar.gz binary-block-editor-63ae206f2970076a9d09e90d7fbcb17ec1fa26e4.zip | |
0.1.7
Diffstat (limited to 'src')
| -rw-r--r-- | src/bbe.c | 4 | ||||
| -rw-r--r-- | src/execute.c | 52 |
2 files changed, 46 insertions, 10 deletions
@@ -20,7 +20,7 @@ * */ -/* $Id: bbe.c,v 1.39 2005/10/20 08:02:56 timo Exp $ */ +/* $Id: bbe.c,v 1.40 2005/11/01 19:01:16 timo Exp $ */ #include "bbe.h" #ifdef HAVE_GETOPT_H @@ -43,7 +43,7 @@ static char *program = "bbe"; #ifdef VERSION static char *version = VERSION; #else -static char *version = "0.1.3"; +static char *version = "0.1.7"; #endif #ifdef PACKAGE_BUGREPORT diff --git a/src/execute.c b/src/execute.c index 008cad0..53ac02b 100644 --- a/src/execute.c +++ b/src/execute.c @@ -20,7 +20,7 @@ * */ -/* $Id: execute.c,v 1.32 2005/10/27 16:37:14 timo Exp $ */ +/* $Id: execute.c,v 1.33 2005/11/01 19:01:16 timo Exp $ */ #include "bbe.h" #include <stdlib.h> @@ -96,7 +96,7 @@ byte_to_string(unsigned char byte,char format) char * off_t_to_string(off_t number,char format) { - static char string[16]; + static char string[128]; switch(format) { @@ -142,7 +142,13 @@ execute_commands(struct command_list *c) { if(c->rpos < c->count) { - delete_this_byte = 1; + if(inserting) + { + inserting = 0; + } else + { + delete_this_byte = 1; + } c->rpos++; } else { @@ -165,7 +171,13 @@ execute_commands(struct command_list *c) if(c->rpos <= c->s1_len) { put_byte(c->s1[c->rpos - 1]); - if(c->rpos < c->s1_len) inserting = 1; + if(delete_this_byte) + { + delete_this_byte = 0; + } else + { + if(c->rpos < c->s1_len) inserting = 1; + } } c->rpos++; } @@ -185,7 +197,13 @@ execute_commands(struct command_list *c) put_byte(c->s2[c->rpos]); } else if (c->rpos < c->s1_len && c->rpos >= c->s2_len) { - delete_this_byte = 1; + if(inserting) + { + inserting = 0; + } else + { + delete_this_byte = 1; + } } else if(c->rpos >= c->s1_len && c->rpos < c->s2_len) { put_byte(c->s2[c->rpos]); @@ -193,7 +211,13 @@ execute_commands(struct command_list *c) if(c->rpos >= c->s1_len - 1 && c->rpos < c->s2_len - 1) { - inserting = 1; + if(delete_this_byte) + { + delete_this_byte = 0; + } else + { + inserting = 1; + } } c->rpos++; @@ -221,10 +245,22 @@ execute_commands(struct command_list *c) if(c->s2_len) { put_byte(c->s2[0]); - if(c->s1_len == 1 && c->s2_len > 1) inserting = 1; + if(delete_this_byte) + { + delete_this_byte = 0; + } else + { + if(c->s1_len == 1 && c->s2_len > 1) inserting = 1; + } } else { - delete_this_byte = 1; + if(inserting) + { + inserting = 0; + } else + { + delete_this_byte = 1; + } } } break; |

