aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-09 02:44:49 +0000
committerbug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277>2003-03-09 02:44:49 +0000
commiteebcaa61ea3d02db3e43ae7c97644858451f4d9a (patch)
tree4267b8339105d9a9f609b5dc791e6d9717d4e06a
parenta69098b5643d2c902de05563918d810ef93a7d43 (diff)
downloadbusybox-w32-eebcaa61ea3d02db3e43ae7c97644858451f4d9a.tar.gz
busybox-w32-eebcaa61ea3d02db3e43ae7c97644858451f4d9a.tar.bz2
busybox-w32-eebcaa61ea3d02db3e43ae7c97644858451f4d9a.zip
Woops, remove the code i didnt mean to commit
git-svn-id: svn://busybox.net/trunk/busybox@6721 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--editors/sed.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/editors/sed.c b/editors/sed.c
index b17c8c794..e412cf919 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -442,36 +442,29 @@ static char *parse_cmd_str(struct sed_cmd * const sed_cmd, const char *const cmd
442 error_msg_and_die("missing command"); 442 error_msg_and_die("missing command");
443 sed_cmd->cmd = cmdstr[idx]; 443 sed_cmd->cmd = cmdstr[idx];
444 444
445 switch (sed_cmd->cmd) { 445 /* if it was a single-letter command that takes no arguments (such as 'p'
446 /* if it was a single-letter command that takes no arguments (such as 'p' 446 * or 'd') all we need to do is increment the index past that command */
447 * or 'd') all we need to do is increment the index past that command */ 447 if (strchr("pd=", sed_cmd->cmd)) {
448 case 'p': 448 idx++;
449 case 'd': 449 }
450 case '=': 450 /* handle (s)ubstitution command */
451 idx++; 451 else if (sed_cmd->cmd == 's') {
452 break; 452 idx += parse_subst_cmd(sed_cmd, &cmdstr[idx]);
453 /* handle (s)ubstitution command */ 453 }
454 case 's': 454 /* handle edit cmds: (a)ppend, (i)nsert, and (c)hange */
455 idx += parse_subst_cmd(sed_cmd, &cmdstr[idx]); 455 else if (strchr("aic", sed_cmd->cmd)) {
456 break; 456 if ((sed_cmd->end_line || sed_cmd->end_match) && sed_cmd->cmd != 'c')
457 /* handle edit cmds: (a)ppend, (i)nsert, and (c)hange */ 457 error_msg_and_die("only a beginning address can be specified for edit commands");
458 case 'a': 458 idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]);
459 case 'i': 459 }
460 case 'c': 460 /* handle file cmds: (r)ead */
461 if ((sed_cmd->end_line || sed_cmd->end_match) && sed_cmd->cmd != 'c') { 461 else if (sed_cmd->cmd == 'r') {
462 error_msg_and_die("only a beginning address can be specified for edit commands"); 462 if (sed_cmd->end_line || sed_cmd->end_match)
463 } 463 error_msg_and_die("Command only uses one address");
464 idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); 464 idx += parse_file_cmd(sed_cmd, &cmdstr[idx]);
465 break; 465 }
466 /* handle file cmds: (r)ead */ 466 else {
467 case 'r': 467 error_msg_and_die("Unsupported command %c", sed_cmd->cmd);
468 if (sed_cmd->end_line || sed_cmd->end_match) {
469 error_msg_and_die("Command only uses one address");
470 }
471 idx += parse_file_cmd(sed_cmd, &cmdstr[idx]);
472 break;
473 default:
474 error_msg_and_die("Unsupported command %c", sed_cmd->cmd);
475 } 468 }
476 469
477 /* give back whatever's left over */ 470 /* give back whatever's left over */