[BusyBox-cvs] busybox/editors sed.c,1.93,1.94

Glenn McGrath bug1 at busybox.net
Mon Dec 23 10:16:16 UTC 2002


Update of /var/cvs/busybox/editors
In directory winder:/tmp/cvs-serv21502/editors

Modified Files:
	sed.c 
Log Message:
Support the '=' command


Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- sed.c	28 Nov 2002 11:27:23 -0000	1.93
+++ sed.c	23 Dec 2002 10:16:12 -0000	1.94
@@ -431,7 +431,7 @@
 
 	/* if it was a single-letter command that takes no arguments (such as 'p'
 	 * or 'd') all we need to do is increment the index past that command */
-	if (strchr("pd", sed_cmd->cmd)) {
+	if (strchr("pd=", sed_cmd->cmd)) {
 		idx++;
 	}
 	/* handle (s)ubstitution command */
@@ -451,7 +451,7 @@
 		idx += parse_file_cmd(sed_cmd, &cmdstr[idx]);
 	}
 	else {
-		error_msg_and_die("invalid command");
+		error_msg_and_die("Unsupported command %c", sed_cmd->cmd);
 	}
 
 	/* give back whatever's left over */
@@ -685,7 +685,9 @@
 				 * actual sedding
 				 */
 				switch (sed_cmd->cmd) {
-
+					case '=':
+						printf("%d\n", linenum);
+						break;
 					case 'p':
 						puts(line);
 						break;




More information about the busybox-cvs mailing list