diff options
author | David A. Wheeler <dwheeler@dwheeler.com> | 2013-10-29 00:52:48 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-10-29 00:52:48 +0100 |
commit | af0cdeedc699da96e2f38c3f321150cdaa3bb7d6 (patch) | |
tree | 39b2fb4b8f8b10b122bde16514367909e183d22a | |
parent | 2d576e2a220e28fe815ea02c38c9bfe9195406c2 (diff) | |
download | busybox-w32-af0cdeedc699da96e2f38c3f321150cdaa3bb7d6.tar.gz busybox-w32-af0cdeedc699da96e2f38c3f321150cdaa3bb7d6.tar.bz2 busybox-w32-af0cdeedc699da96e2f38c3f321150cdaa3bb7d6.zip |
sed: accept -E as a synonym for -r
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/sed.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c index 3a0d917aa..ef462843b 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1435,15 +1435,21 @@ int sed_main(int argc UNUSED_PARAM, char **argv) | |||
1435 | IF_LONG_OPTS(applet_long_options = sed_longopts); | 1435 | IF_LONG_OPTS(applet_long_options = sed_longopts); |
1436 | 1436 | ||
1437 | /* -i must be first, to match OPT_in_place definition */ | 1437 | /* -i must be first, to match OPT_in_place definition */ |
1438 | opt = getopt32(argv, "i::rne:f:", &opt_i, &opt_e, &opt_f, | 1438 | /* -E is a synonym of -r: |
1439 | * GNU sed 4.2.1 mentions it in neither --help | ||
1440 | * nor manpage, but does recognize it. | ||
1441 | */ | ||
1442 | opt = getopt32(argv, "i::rEne:f:", &opt_i, &opt_e, &opt_f, | ||
1439 | &G.be_quiet); /* counter for -n */ | 1443 | &G.be_quiet); /* counter for -n */ |
1440 | //argc -= optind; | 1444 | //argc -= optind; |
1441 | argv += optind; | 1445 | argv += optind; |
1442 | if (opt & OPT_in_place) { // -i | 1446 | if (opt & OPT_in_place) { // -i |
1443 | atexit(cleanup_outname); | 1447 | atexit(cleanup_outname); |
1444 | } | 1448 | } |
1445 | if (opt & 0x2) G.regex_type |= REG_EXTENDED; // -r | 1449 | if (opt & (2|4)) |
1446 | //if (opt & 0x4) G.be_quiet++; // -n | 1450 | G.regex_type |= REG_EXTENDED; // -r or -E |
1451 | //if (opt & 8) | ||
1452 | // G.be_quiet++; // -n (implemented with a counter instead) | ||
1447 | while (opt_e) { // -e | 1453 | while (opt_e) { // -e |
1448 | add_cmd_block(llist_pop(&opt_e)); | 1454 | add_cmd_block(llist_pop(&opt_e)); |
1449 | } | 1455 | } |
@@ -1458,7 +1464,7 @@ int sed_main(int argc UNUSED_PARAM, char **argv) | |||
1458 | fclose(cmdfile); | 1464 | fclose(cmdfile); |
1459 | } | 1465 | } |
1460 | /* if we didn't get a pattern from -e or -f, use argv[0] */ | 1466 | /* if we didn't get a pattern from -e or -f, use argv[0] */ |
1461 | if (!(opt & 0x18)) { | 1467 | if (!(opt & 0x30)) { |
1462 | if (!*argv) | 1468 | if (!*argv) |
1463 | bb_show_usage(); | 1469 | bb_show_usage(); |
1464 | add_cmd_block(*argv++); | 1470 | add_cmd_block(*argv++); |