diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/diff.c | 9 | ||||
-rw-r--r-- | editors/sed.c | 8 |
2 files changed, 4 insertions, 13 deletions
diff --git a/editors/diff.c b/editors/diff.c index 4e51f6f76..26f352780 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -1289,14 +1289,9 @@ int diff_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
1289 | while (L_arg) { | 1289 | while (L_arg) { |
1290 | if (label1 && label2) | 1290 | if (label1 && label2) |
1291 | bb_show_usage(); | 1291 | bb_show_usage(); |
1292 | if (!label1) | 1292 | if (label1) /* then label2 is NULL */ |
1293 | label1 = L_arg->data; | ||
1294 | else { /* then label2 is NULL */ | ||
1295 | label2 = label1; | 1293 | label2 = label1; |
1296 | label1 = L_arg->data; | 1294 | label1 = llist_pop(&L_arg); |
1297 | } | ||
1298 | /* we leak L_arg here... */ | ||
1299 | L_arg = L_arg->link; | ||
1300 | } | 1295 | } |
1301 | 1296 | ||
1302 | /* | 1297 | /* |
diff --git a/editors/sed.c b/editors/sed.c index 817840dc0..bf01fc630 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1267,21 +1267,17 @@ int sed_main(int argc ATTRIBUTE_UNUSED, char **argv) | |||
1267 | if (opt & 0x2) G.regex_type |= REG_EXTENDED; // -r | 1267 | if (opt & 0x2) G.regex_type |= REG_EXTENDED; // -r |
1268 | //if (opt & 0x4) G.be_quiet++; // -n | 1268 | //if (opt & 0x4) G.be_quiet++; // -n |
1269 | while (opt_e) { // -e | 1269 | while (opt_e) { // -e |
1270 | add_cmd_block(opt_e->data); | 1270 | add_cmd_block(llist_pop(&opt_e)); |
1271 | opt_e = opt_e->link; | ||
1272 | /* we leak opt_e here... */ | ||
1273 | } | 1271 | } |
1274 | while (opt_f) { // -f | 1272 | while (opt_f) { // -f |
1275 | char *line; | 1273 | char *line; |
1276 | FILE *cmdfile; | 1274 | FILE *cmdfile; |
1277 | cmdfile = xfopen(opt_f->data, "r"); | 1275 | cmdfile = xfopen(llist_pop(&opt_f), "r"); |
1278 | while ((line = xmalloc_fgetline(cmdfile)) != NULL) { | 1276 | while ((line = xmalloc_fgetline(cmdfile)) != NULL) { |
1279 | add_cmd(line); | 1277 | add_cmd(line); |
1280 | free(line); | 1278 | free(line); |
1281 | } | 1279 | } |
1282 | fclose(cmdfile); | 1280 | fclose(cmdfile); |
1283 | opt_f = opt_f->link; | ||
1284 | /* we leak opt_f here... */ | ||
1285 | } | 1281 | } |
1286 | /* if we didn't get a pattern from -e or -f, use argv[0] */ | 1282 | /* if we didn't get a pattern from -e or -f, use argv[0] */ |
1287 | if (!(opt & 0x18)) { | 1283 | if (!(opt & 0x18)) { |