summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmaan Bhojwani <me@armaanb.net>2021-05-09 20:58:40 -0400
committerArmaan Bhojwani <me@armaanb.net>2021-05-09 20:58:40 -0400
commit1659d14ac2cb8b66174a0238e432dbf6bd7db41b (patch)
tree409518720a3e11f131e08343dde9baa8497cbf8d
parentcfe6868b9e273efbe1cf9c783c00d72d48d0bff9 (diff)
downloadmmenu-1659d14ac2cb8b66174a0238e432dbf6bd7db41b.tar.gz
Accidentally reinvented the wheel...
-rw-r--r--mmenu.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/mmenu.c b/mmenu.c
index d14f4a3..a21ba80 100644
--- a/mmenu.c
+++ b/mmenu.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
-#include <ctype.h>
+#include <strings.h>
#include <Xm/Xm.h>
#include <Xm/Text.h>
@@ -155,17 +155,6 @@ ArgvToXmStringTable (int argc, char **argv)
return new;
}
-char *
-strLower(char *inp)
-{
- char *tmp = calloc(strlen(inp), sizeof(char));
- strcpy(tmp, inp);
- for (int i = 0; tmp[i]; i++){
- tmp[i] = tolower(tmp[i]);
- }
- return tmp;
-}
-
int
main(int argc, char *argv[])
{
@@ -173,19 +162,12 @@ main(int argc, char *argv[])
bool showUsage = false;
if (argc == 2) {
showUsage = true;
- char *arg = strLower(argv[1]);
-
for (int i = 0; i < 5; i++) {
- char *day = strLower(days[i]);
-
- if (strcmp(day, arg) == 0) {
+ if (strcasecmp(argv[1], days[i]) == 0) {
showUsage = false;
break;
}
-
- free(day);
}
- free(arg);
}
if (argc > 2 || showUsage) {