diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-10-29 02:33:38 +0100 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-10-29 02:33:38 +0100 |
commit | 6e7d4bc9040b619dd3271ba1d01f23c240b7c950 (patch) | |
tree | a401c37a974019654c375c3252dbc55486728fb3 | |
parent | fcfc709333fbf8ae6887d935927c388063c03813 (diff) |
Make name to number lookups exit on failing
-rw-r--r-- | blasms.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> /* Remove trailing \n */ @@ -97,12 +98,14 @@ void settelnum(char* telnum, char* sms, int *offsetptr) { //printf("Name match: %s\n", line); strxfrm(telnum, line, offset); telnum[offset] = '\0'; - break; + *offsetptr = *offsetptr + strlen(name) + 1; + return; } } } - *offsetptr = *offsetptr + strlen(name) + 1; + printf("Error: %s not found in phonebook.conf.\n", name); + exit(1); } int main(int argc, char *argv[]) { |