diff options
Diffstat (limited to 'editors/sed.c')
-rw-r--r-- | editors/sed.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/editors/sed.c b/editors/sed.c index b6bfcdb68..9e4a002d8 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -196,7 +196,7 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
196 | else if (my_str[idx] == '/') { | 196 | else if (my_str[idx] == '/') { |
197 | idx = index_of_next_unescaped_slash(idx, my_str); | 197 | idx = index_of_next_unescaped_slash(idx, my_str); |
198 | if (idx == -1) | 198 | if (idx == -1) |
199 | fatalError("sed: unterminated match expression\n"); | 199 | fatalError("unterminated match expression\n"); |
200 | my_str[idx] = '\0'; | 200 | my_str[idx] = '\0'; |
201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); | 201 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); |
202 | if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) { | 202 | if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) { |
@@ -243,9 +243,9 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
243 | 243 | ||
244 | /* last part (mandatory) will be a command */ | 244 | /* last part (mandatory) will be a command */ |
245 | if (cmdstr[idx] == '\0') | 245 | if (cmdstr[idx] == '\0') |
246 | fatalError("sed: missing command\n"); | 246 | fatalError("missing command\n"); |
247 | if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */ | 247 | if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */ |
248 | fatalError("sed: invalid command\n"); | 248 | fatalError("invalid command\n"); |
249 | sed_cmd->cmd = cmdstr[idx]; | 249 | sed_cmd->cmd = cmdstr[idx]; |
250 | /* special-case handling for 's' */ | 250 | /* special-case handling for 's' */ |
251 | if (sed_cmd->cmd == 's') { | 251 | if (sed_cmd->cmd == 's') { |
@@ -259,20 +259,20 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
259 | 259 | ||
260 | /* verify that we have an 's' followed by a 'slash' */ | 260 | /* verify that we have an 's' followed by a 'slash' */ |
261 | if (cmdstr[++idx] != '/') | 261 | if (cmdstr[++idx] != '/') |
262 | fatalError("sed: bad format in substitution expression\n"); | 262 | fatalError("bad format in substitution expression\n"); |
263 | 263 | ||
264 | /* save the match string */ | 264 | /* save the match string */ |
265 | oldidx = idx+1; | 265 | oldidx = idx+1; |
266 | idx = index_of_next_unescaped_slash(idx, cmdstr); | 266 | idx = index_of_next_unescaped_slash(idx, cmdstr); |
267 | if (idx == -1) | 267 | if (idx == -1) |
268 | fatalError("sed: bad format in substitution expression\n"); | 268 | fatalError("bad format in substitution expression\n"); |
269 | match = strdup_substr(cmdstr, oldidx, idx); | 269 | match = strdup_substr(cmdstr, oldidx, idx); |
270 | 270 | ||
271 | /* save the replacement string */ | 271 | /* save the replacement string */ |
272 | oldidx = idx+1; | 272 | oldidx = idx+1; |
273 | idx = index_of_next_unescaped_slash(idx, cmdstr); | 273 | idx = index_of_next_unescaped_slash(idx, cmdstr); |
274 | if (idx == -1) | 274 | if (idx == -1) |
275 | fatalError("sed: bad format in substitution expression\n"); | 275 | fatalError("bad format in substitution expression\n"); |
276 | sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx); | 276 | sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx); |
277 | 277 | ||
278 | /* process the flags */ | 278 | /* process the flags */ |
@@ -285,7 +285,7 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
285 | cflags |= REG_ICASE; | 285 | cflags |= REG_ICASE; |
286 | break; | 286 | break; |
287 | default: | 287 | default: |
288 | fatalError("sed: bad option in substitution expression\n"); | 288 | fatalError("bad option in substitution expression\n"); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||