Update util.c
This commit is contained in:
31
src/util.c
31
src/util.c
@@ -18,6 +18,17 @@
|
|||||||
int fno = 1;
|
int fno = 1;
|
||||||
bool flast = false;
|
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)
|
licence_t TOlicence(char *src)
|
||||||
{
|
{
|
||||||
char *s = tostrupr(src);
|
char *s = tostrupr(src);
|
||||||
@@ -31,26 +42,6 @@ licence_t TOlicence(char *src)
|
|||||||
return BSD;
|
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;
|
static char *nextchar;
|
||||||
|
|
||||||
int getopt_long(int argc, char *const argv[], const char *optstring,
|
int getopt_long(int argc, char *const argv[], const char *optstring,
|
||||||
|
|||||||
Reference in New Issue
Block a user