From a09e1cfb55d28b176f0f1703c4e8a9d1629f2d4b Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Mon, 1 Nov 2010 17:28:33 +0000 Subject: Make command matches be case insensitive --- blasms.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'blasms.c') diff --git a/blasms.c b/blasms.c index 05539f4..08abcac 100644 --- a/blasms.c +++ b/blasms.c @@ -214,6 +214,8 @@ int main(int argc, char *argv[]) { char sms[500]; /* SMS command */ char smscommand[11]; + /* SMS command in lowercase */ + char smscommandlower[11]; /* Command to execute */ char systemcmd[1000]; /* Dynamic systemcmd for wildcard matches */ @@ -230,6 +232,8 @@ int main(int argc, char *argv[]) { char line[1024]; /* Config file command */ char configcmd[11]; + /* Config file command in lowercase */ + char configcmdlower[11]; /* strchr pointer */ char *strchrp; /* Command match / telnum set */ @@ -341,8 +345,11 @@ int main(int argc, char *argv[]) { /* If it does end here, copy it to smscommand */ strxfrm(smscommand, sms, offset); smscommand[offset] = '\0'; + /* Convert commands to lowercase for comparison */ + strtolower(smscommandlower, smscommand); + strtolower(configcmdlower, configcmd); /* If the commands are the same, stop reading the file */ - if (!strcmp(smscommand, configcmd)) { + if (!strcmp(smscommandlower, configcmdlower)) { match = 1; break; } -- cgit v1.2.3