Update util.c

This commit is contained in:
vx_clutch
2025-09-29 11:40:17 -04:00
committed by GitHub
parent 819b95b112
commit e618f6c656

View File

@@ -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,