aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-02-21 23:02:08 -0800
committerMichael Forney <mforney@mforney.org>2019-02-21 23:02:08 -0800
commitab995bcc5c65393c7d59cebb794125db7f2a6fda (patch)
tree2136facbb72a9892856d719d765a69748a9fc996
parent9c80c96e84c398165df1cd304c32229acb8328dc (diff)
downloadcproc-ab995bcc5c65393c7d59cebb794125db7f2a6fda.tar.xz
driver: Create output files in current directory
-rw-r--r--driver.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/driver.c b/driver.c
index f30f413..cca2c65 100644
--- a/driver.c
+++ b/driver.c
@@ -100,9 +100,9 @@ changeext(const char *name, const char *ext)
size_t baselen;
slash = strrchr(name, '/');
- if (!slash)
- slash = name;
- dot = strrchr(slash, '.');
+ if (slash)
+ name = slash + 1;
+ dot = strrchr(name, '.');
baselen = dot ? (size_t)(--dot - name + 1) : strlen(name);
result = xmalloc(baselen + strlen(ext) + 2);
memcpy(result, name, baselen);