aboutsummaryrefslogtreecommitdiff
path: root/src/eclat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eclat.c')
-rw-r--r--src/eclat.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/src/eclat.c b/src/eclat.c
index ab3375a..64119fd 100644
--- a/src/eclat.c
+++ b/src/eclat.c
@@ -527,46 +527,39 @@ read_format(struct command *cmd)
env = forlan_parse_buffer(cmd->fmt, strlen(cmd->fmt),
&cmd->locus.beg);
else if (format_file) {
- struct wordsplit ws;
- const char *kve[5];
+ const char *kwe[5];
struct grecs_locus_point pt;
FILE *fp;
+ char *filename;
- kve[0] = "command";
- kve[1] = cmd->ident;
- kve[2] = "action";
- kve[3] = cmd->tag;
- kve[4] = NULL;
-
- ws.ws_env = kve;
- if (wordsplit(format_file, &ws,
- WRDSF_NOSPLIT | WRDSF_NOCMD |
- WRDSF_ENV | WRDSF_ENV_KV))
- die(EX_SOFTWARE,
- "error expanding format-file: %s",
- wordsplit_strerror(&ws));
-
- fp = fopen(ws.ws_wordv[0], "r");
+ kwe[0] = "command";
+ kwe[1] = cmd->ident;
+ kwe[2] = "action";
+ kwe[3] = cmd->tag;
+ kwe[4] = NULL;
+
+ filename = eclat_expand_kw(format_file, kwe);
+ fp = fopen(filename, "r");
if (!fp) {
if (errno == ENOENT) {
debug(ECLAT_DEBCAT_MAIN, 1,
("cannot open format source \"%s\": %s",
- ws.ws_wordv[0], strerror(errno)));
- wordsplit_free(&ws);
+ filename, strerror(errno)));
+ free(filename);
return NULL;
}
die(EX_UNAVAILABLE,
"cannot open format file %s: %s",
- ws.ws_wordv[0], strerror(errno));
+ filename, strerror(errno));
}
- pt.file = ws.ws_wordv[0];
+ pt.file = filename;
pt.line = 1;
pt.col = 0;
env = forlan_parse_file(fp, &pt);
fclose(fp);
- wordsplit_free(&ws);
+ free(filename);
} else
return NULL;

Return to:

Send suggestions and report system problems to the System administrator.