lorid

convert chordpro to pdf
git clone git://git.relim.de/lorid.git
Log | Files | Refs | README | LICENSE

commit ff258b07f7513ea9edb6afec7c80116d01d3815d
parent ac6aa5ef429f432b0fe60276943a785d189d5224
Author: nibo <nibo@relim.de>
Date:   Sat, 11 Jan 2025 17:20:20 +0100

Make -o/--output argument take just a file

Previously it would only allow filepaths
containing a slash.

Diffstat:
Mutil.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/util.c b/util.c @@ -393,18 +393,21 @@ char * filepath_dirname(const char *path) { char *dirname; - int end = 0; - int i; + int i, end = 0; for (i = 0; path[i]; i++) { if (path[i] == '/') { end = i; } } + if (end == 0) { + dirname = emalloc(2 * sizeof(char)); + dirname[0] = '.'; + dirname[1] = 0; + return dirname; + } dirname = emalloc((end+1)* sizeof(char)); - i = 0; - while (i<end) { + for (i = 0; i < end; i++) { dirname[i] = path[i]; - i++; } dirname[i] = 0; return dirname;