diff options
author | Michael Forney <mforney@mforney.org> | 2019-02-21 23:02:08 -0800 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2019-02-21 23:02:08 -0800 |
commit | ab995bcc5c65393c7d59cebb794125db7f2a6fda (patch) | |
tree | 2136facbb72a9892856d719d765a69748a9fc996 | |
parent | 9c80c96e84c398165df1cd304c32229acb8328dc (diff) | |
download | cproc-ab995bcc5c65393c7d59cebb794125db7f2a6fda.tar.xz |
driver: Create output files in current directory
-rw-r--r-- | driver.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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); |