From e618f6c6568954f2f60dde308d4b57914d0038ba Mon Sep 17 00:00:00 2001 From: vx_clutch <98831688+vx-clutch@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:40:17 -0400 Subject: [PATCH] Update util.c --- src/util.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/util.c b/src/util.c index ed2808d..5f11ad6 100644 --- a/src/util.c +++ b/src/util.c @@ -18,6 +18,17 @@ int fno = 1; bool flast = false; +char *tostrupr(const char *s) +{ + char *new = malloc(strlen(s) + 1); + if (!new) + return NULL; + strcpy(new, s); + for (int i = 0; new[i] != '\0'; ++i) + new[i] = toupper((unsigned char)new[i]); + return new; +} + licence_t TOlicence(char *src) { char *s = tostrupr(src); @@ -31,26 +42,6 @@ licence_t TOlicence(char *src) return BSD; } -char *str_dup(const char *s) -{ - char *new = malloc(strlen(s) + 1); - if (!new) - return NULL; - strcpy(new, s); - return new; -} - -char *tostrupr(const char *s) -{ - char *new = malloc(strlen(s) + 1); - if (!new) - return NULL; - strcpy(new, s); - for (int i = 0; new[i] != '\0'; ++i) - new[i] = toupper((unsigned char)new[i]); - return new; -} - static char *nextchar; int getopt_long(int argc, char *const argv[], const char *optstring,