neocities.h

a C library for interacting with Neocities' API
git clone https://github.com/tanguyandreani/neocities.h
Log | Files | Refs | README | LICENSE

commit b9349fa1020f320022cb7711950c6ed565a16c6f
parent 893a39d881136157082c7faa673baea3000b2403
Author: Tanguy Andreani <dev@tanguy.space>
Date:   Fri,  1 Mar 2019 04:36:47 +0100

adds single quotes when filename has blanks

Diffstat:
Mlist.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/list.c b/list.c @@ -39,13 +39,21 @@ int main(int argc, char *argv[]) return err; } +#define has_blanks(s) \ + strchr(s, ' ') != NULL + for (i = 0; i < res.data.list.length; i++) { - printf("%s", res.data.list.files[i].path); + if (has_blanks(res.data.list.files[i].path)) + printf("'%s'", res.data.list.files[i].path); + else + printf("%s", res.data.list.files[i].path); if (res.data.list.files[i].is_directory == 1) putchar('/'); putchar('\n'); } +#undef has_blanks + neocities_destroy(&res); curl_global_cleanup();