summaryrefslogtreecommitdiff
path: root/sfeed_html.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-04-10 14:36:16 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-04-10 14:36:16 +0200
commit8a3177f96dd4c3694242d0686762c455a9d010fd (patch)
treedc33f65dbb40abd8b9fae22833d52998b985bfad /sfeed_html.c
parentfe6bc99b1ed59c428ffe5da44eafcf3712d3d80d (diff)
remove basename, just use last part of the path...
... as a bonus it also saves an allocation.
Diffstat (limited to 'sfeed_html.c')
-rw-r--r--sfeed_html.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sfeed_html.c b/sfeed_html.c
index a98e64b..2e60ad3 100644
--- a/sfeed_html.c
+++ b/sfeed_html.c
@@ -81,6 +81,7 @@ int
main(int argc, char *argv[])
{
struct feed *f;
+ char *name;
FILE *fp;
int i;
@@ -119,8 +120,8 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (!(feeds[i - 1] = calloc(1, sizeof(struct feed))))
err(1, "calloc");
- feeds[i - 1]->name = xbasename(argv[i]);
-
+ name = ((name = strrchr(argv[i], '/'))) ? name + 1 : argv[i];
+ feeds[i - 1]->name = name;
if (!(fp = fopen(argv[i], "r")))
err(1, "fopen: %s", argv[i]);
printfeed(fp, feeds[i - 1]);