summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2010-10-29 02:33:38 +0100
committerLuke Bratch <l_bratch@yahoo.co.uk>2010-10-29 02:33:38 +0100
commit6e7d4bc9040b619dd3271ba1d01f23c240b7c950 (patch)
treea401c37a974019654c375c3252dbc55486728fb3
parentfcfc709333fbf8ae6887d935927c388063c03813 (diff)
Make name to number lookups exit on failing
-rw-r--r--blasms.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/blasms.c b/blasms.c
index 578c803..641b651 100644
--- a/blasms.c
+++ b/blasms.c
@@ -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[]) {