diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-04-10 14:36:16 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2016-04-10 14:36:16 +0200 |
commit | 8a3177f96dd4c3694242d0686762c455a9d010fd (patch) | |
tree | dc33f65dbb40abd8b9fae22833d52998b985bfad /sfeed_frames.c | |
parent | fe6bc99b1ed59c428ffe5da44eafcf3712d3d80d (diff) |
remove basename, just use last part of the path...
... as a bonus it also saves an allocation.
Diffstat (limited to 'sfeed_frames.c')
-rw-r--r-- | sfeed_frames.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c index 64fbbc8..35fe07e 100644 --- a/sfeed_frames.c +++ b/sfeed_frames.c @@ -236,8 +236,8 @@ int main(int argc, char *argv[]) { FILE *fpindex, *fpitems, *fpmenu, *fp; - int showsidebar = (argc > 1); - int i; + char *name; + int i, showsidebar = (argc > 1); struct feed *f; if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) @@ -271,7 +271,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]); |