From 6e7d4bc9040b619dd3271ba1d01f23c240b7c950 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Fri, 29 Oct 2010 02:33:38 +0100 Subject: Make name to number lookups exit on failing --- blasms.c | 7 +++++-- 1 file 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 +#include #include /* 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[]) { -- cgit v1.2.3