From 52e9f6f63b74db2a6a1d67524851649b18794950 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sat, 2 Jun 2018 02:32:25 +0200 Subject: able to print percentage its now possible to have percentage before and after a variable. except for the date. But percentage with dates does not make much sense to me, so i skipped it. --- src/print_path_exists.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/print_path_exists.c') diff --git a/src/print_path_exists.c b/src/print_path_exists.c index 65bc9c8..7bdbe30 100644 --- a/src/print_path_exists.c +++ b/src/print_path_exists.c @@ -25,15 +25,17 @@ void print_path_exists(yajl_gen json_gen, char *buffer, const char *title, const for (; *walk != '\0'; walk++) { if (*walk != '%') { *(outwalk++) = *walk; - continue; - } - if (BEGINS_WITH(walk + 1, "title")) { + } else if (BEGINS_WITH(walk + 1, "title")) { outwalk += sprintf(outwalk, "%s", title); walk += strlen("title"); + } else if (BEGINS_WITH(walk + 1, "status")) { outwalk += sprintf(outwalk, "%s", (exists ? "yes" : "no")); walk += strlen("status"); + + } else { + *(outwalk++) = '%'; } } -- cgit v1.2.3