From f67f2c3d5b67f54dae2c2c2754f43b4351445c80 Mon Sep 17 00:00:00 2001 From: Anastasis Grammenos Date: Sun, 7 Oct 2018 20:00:43 +0300 Subject: add list_exists fucntion --- src/cklist.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/cklist.c') diff --git a/src/cklist.c b/src/cklist.c index 14d5d82..e142feb 100644 --- a/src/cklist.c +++ b/src/cklist.c @@ -186,6 +186,18 @@ void list_print_concat(cklist *ckl) { } } +int list_exists(cklist *ckl, char *str) { + if (ckl->size > 0) { + list_rewind(ckl); + do { + if (strcmp(list_get(ckl), str) == 0) { + return 1; + } + } while (list_next(ckl)); + } + return 0; +} + int list_size(cklist *ckl) { return ckl->size; } -- cgit v1.2.3