aboutsummaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
Diffstat (limited to 'editors/sed.c')
-rw-r--r--editors/sed.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/editors/sed.c b/editors/sed.c
index f26e6e304..812f62145 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -215,14 +215,14 @@ static int get_address(const char *str, int *line, regex_t **regex)
else if (my_str[idx] == '/') {
idx = index_of_next_unescaped_slash(my_str, ++idx);
if (idx == -1)
- fatalError("unterminated match expression\n");
+ error_msg_and_die("unterminated match expression\n");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
xregcomp(*regex, my_str+1, 0);
idx++; /* so it points to the next character after the last '/' */
}
else {
- errorMsg("get_address: no address found in string\n"
+ error_msg("get_address: no address found in string\n"
"\t(you probably didn't check the string you passed me)\n");
idx = -1;
}
@@ -258,13 +258,13 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
/* verify that the 's' is followed by a 'slash' */
if (substr[++idx] != '/')
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
/* save the match string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(substr, ++idx);
if (idx == -1)
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
match = strdup_substr(substr, oldidx, idx);
/* determine the number of back references in the match string */
@@ -283,7 +283,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
oldidx = idx+1;
idx = index_of_next_unescaped_slash(substr, ++idx);
if (idx == -1)
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
sed_cmd->replace = strdup_substr(substr, oldidx, idx);
/* process the flags */
@@ -303,7 +303,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
if (strchr("; \t\v\n\r", substr[idx]))
goto out;
/* else */
- fatalError("bad option in substitution expression\n");
+ error_msg_and_die("bad option in substitution expression\n");
}
}
@@ -345,7 +345,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
*/
if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r'))
- fatalError("bad format in edit expression\n");
+ error_msg_and_die("bad format in edit expression\n");
/* store the edit line text */
/* make editline big enough to accomodate the extra '\n' we will tack on
@@ -409,9 +409,9 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
- fatalError("missing command\n");
+ error_msg_and_die("missing command\n");
if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */
- fatalError("invalid command\n");
+ error_msg_and_die("invalid command\n");
sed_cmd->cmd = cmdstr[idx];
/* special-case handling for (s)ubstitution */
@@ -421,7 +421,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
/* special-case handling for (a)ppend, (i)nsert, and (c)hange */
else if (strchr("aic", cmdstr[idx])) {
if (sed_cmd->end_line || sed_cmd->end_match)
- fatalError("only a beginning address can be specified for edit commands\n");
+ error_msg_and_die("only a beginning address can be specified for edit commands\n");
idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]);
}
/* if it was a single-letter command (such as 'p' or 'd') we need to
@@ -757,7 +757,7 @@ extern int sed_main(int argc, char **argv)
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- errorMsg("%s: %s\n", argv[i], strerror(errno));
+ error_msg("%s: %s\n", argv[i], strerror(errno));
} else {
process_file(file);
fclose(file);