From c2c115537d35c6d1e4a0890d32a31329850baecc Mon Sep 17 00:00:00 2001 From: Trent Huber Date: Tue, 11 Feb 2025 09:28:37 -0500 Subject: [PATCH] Update README.md and simplify addext() --- README.md | 4 +++- cbs.c | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6f4362a..939a523 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,9 @@ These are macros used by the library and it expects them to exist. Any flags you #define LDFLAGS "-lm", "-Llib/" ``` -These will be automatically used in all compilations and linkages performed by the build file they're defined in. +If you ever want to convert a comma separated list of strings to an array of C strings, the simple `CARRAY` macro does so. + +The `CFLAGS` and `LDFLAGS` macros will automatically be used in all compilations and linkages performed by the build file they're defined in. ### Compiling: `cc()` diff --git a/cbs.c b/cbs.c index aeab82a..92f1a3f 100644 --- a/cbs.c +++ b/cbs.c @@ -31,8 +31,7 @@ char *addext(char *pp, char *ext) { bp = rindex(pp, '/'); bp = bp ? bp + 1 : pp; d = bp - pp; - ep = rindex(pp, '.'); - if (ep < bp) ep = NULL; + ep = rindex(bp, '.'); b = ep ? ep - bp : strlen(bp); ep = ep ? ep + 1 : ext; l = strncmp(bp, "lib", 3) != 0 -- 2.51.0