aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/sed.c3
-rw-r--r--sed.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 22d642ee9..bf8ca1b29 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -188,11 +188,9 @@ static int get_address(const char *str, int *line, regex_t **regex)
188 } while (isdigit(my_str[idx])); 188 } while (isdigit(my_str[idx]));
189 my_str[idx] = 0; 189 my_str[idx] = 0;
190 *line = atoi(my_str); 190 *line = atoi(my_str);
191 *regex = NULL;
192 } 191 }
193 else if (my_str[idx] == '$') { 192 else if (my_str[idx] == '$') {
194 *line = -1; 193 *line = -1;
195 *regex = NULL;
196 idx++; 194 idx++;
197 } 195 }
198 else if (my_str[idx] == '/') { 196 else if (my_str[idx] == '/') {
@@ -202,6 +200,7 @@ static int get_address(const char *str, int *line, regex_t **regex)
202 my_str[idx] = '\0'; 200 my_str[idx] = '\0';
203 *regex = (regex_t *)xmalloc(sizeof(regex_t)); 201 *regex = (regex_t *)xmalloc(sizeof(regex_t));
204 xregcomp(*regex, my_str+1, REG_NEWLINE); 202 xregcomp(*regex, my_str+1, REG_NEWLINE);
203 idx++; /* so it points to the next character after the last '/' */
205 } 204 }
206 else { 205 else {
207 fprintf(stderr, "sed.c:get_address: no address found in string\n"); 206 fprintf(stderr, "sed.c:get_address: no address found in string\n");
diff --git a/sed.c b/sed.c
index 22d642ee9..bf8ca1b29 100644
--- a/sed.c
+++ b/sed.c
@@ -188,11 +188,9 @@ static int get_address(const char *str, int *line, regex_t **regex)
188 } while (isdigit(my_str[idx])); 188 } while (isdigit(my_str[idx]));
189 my_str[idx] = 0; 189 my_str[idx] = 0;
190 *line = atoi(my_str); 190 *line = atoi(my_str);
191 *regex = NULL;
192 } 191 }
193 else if (my_str[idx] == '$') { 192 else if (my_str[idx] == '$') {
194 *line = -1; 193 *line = -1;
195 *regex = NULL;
196 idx++; 194 idx++;
197 } 195 }
198 else if (my_str[idx] == '/') { 196 else if (my_str[idx] == '/') {
@@ -202,6 +200,7 @@ static int get_address(const char *str, int *line, regex_t **regex)
202 my_str[idx] = '\0'; 200 my_str[idx] = '\0';
203 *regex = (regex_t *)xmalloc(sizeof(regex_t)); 201 *regex = (regex_t *)xmalloc(sizeof(regex_t));
204 xregcomp(*regex, my_str+1, REG_NEWLINE); 202 xregcomp(*regex, my_str+1, REG_NEWLINE);
203 idx++; /* so it points to the next character after the last '/' */
205 } 204 }
206 else { 205 else {
207 fprintf(stderr, "sed.c:get_address: no address found in string\n"); 206 fprintf(stderr, "sed.c:get_address: no address found in string\n");