diff options
-rw-r--r-- | blasms.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -40,6 +40,15 @@ void replacestr(char* source, int i, char* str) { strcat(source, strtmp + i + 2); } +/* Converts a string to lowercase */ +void strtolower(char* destination, char* source) { + int i; + + for (i = 0; i < strlen(source) + 1; i++) { + destination[i] = tolower(source[i]); + } +} + /* Set a sender's name as part of their number */ void setname(char* telnum) { FILE *fp; @@ -73,6 +82,7 @@ void settelnum(char* telnum, char* sms, int *offsetptr) { FILE *fp; char line[1024]; char name[1000]; + char namelower[1000]; char *strchrp; int offset = *offsetptr; @@ -94,7 +104,9 @@ void settelnum(char* telnum, char* sms, int *offsetptr) { remtrailn(line); if ((strchrp = strchr(line, ' ')) != NULL) { offset = strchrp - line; - if ((strlen(name) == strlen(line) - offset - 1) && !strncmp(name, line + offset + 1, strlen(name))) { + strtolower(namelower, name); + strtolower(line, line); + if ((strlen(name) == strlen(line) - offset - 1) && !strncmp(namelower, line + offset + 1, strlen(name))) { //printf("Name match: %s\n", line); strxfrm(telnum, line, offset); telnum[offset] = '\0'; |