From 409a1d5aa81b9de3760e2918b0f8df52f067ae60 Mon Sep 17 00:00:00 2001 From: short <> Date: Wed, 8 Sep 1999 19:22:26 +0000 Subject: [PATCH] Empty SMSC checking for Nokia, +CMGS retrying fixed, missing logoname check. --- mdsms.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/mdsms.c b/mdsms.c index 69cc8c3..c9bf550 100644 --- a/mdsms.c +++ b/mdsms.c @@ -388,8 +388,8 @@ static const struct { const char *name; } nullcheck[]={ {&phone,"destination phone number"}, -#if 0 {&logoname,"logo filename"}, +#if 0 {&gsmnet,"GSM operator network code"}, {&device,"device for communication"}, #endif @@ -644,10 +644,12 @@ long l; s=devcmd(NULL,"\n+CSCA:","\r\nAT+CSCA?"); while (isspace(*s)) s++; if (!*s || !strcmp(s,"EMPTY")) - error("!No SMS set in Nokia found"); + error("!No SMS set in Nokia found, please use option \"-s\""); if (verbose>=1) error("\nFound default SMSC in Nokia: %s",s); if (*s!='"') error("!No left-quote found in: %s",s); if (!(t=strrchr(s+1,'"'))) error("!No right-quote found in: %s",s); + if (s+1==t) + error("!No SMS set in Nokia found, please use option \"-s\""); e=t++; while (isspace(*t)) t++; if (*t++!=',') error("!No comma found after quotes in: %s",s); @@ -703,11 +705,11 @@ int sizex,sizey,bit; logoname,WORD(4)); } else error("!Unknown file format of logo file \"%s\"",logoname); - if (!strcasecmp(gsmnet,WORD_NET)) { + if (gsmnet && !strcasecmp(gsmnet,WORD_NET)) { if (!*gsmnetf) error("!NOL network code detection requested but NOL file not loaded, please specify network code"); gsmnet=gsmnetf; } - if (!strcasecmp(gsmnet,WORD_GROUP) || !*gsmnet) { + if (!gsmnet || !strcasecmp(gsmnet,WORD_GROUP) || !*gsmnet) { error("\nSending logo as: group graphics"); gsmnet=NULL; } @@ -889,19 +891,21 @@ time_t start,end; error("^!Unable to set initial termios device settings"); setalarm(); - do { - devcmd("",NULL,"\r\nAT\033"); - devcmd(NULL,NULL,"\r\nAT"); - smscset(); - devcmd(NULL,NULL,"\r\nAT+CSMP=81,,0,245"); - devcmd("\n> ",NULL,"\r\nAT+CMGS=\"%s\"",phone); - if (!(s=devcmd(NULL,"\n+CMGS:","!%s\032",hexdata))) { - retrying(); - continue; - } - devcmd(NULL,NULL,"\r\nAT+CSMP=17,,0,0"); - devcmd(NULL,NULL,"\r\nAT"); - } while (0); + +retryall: + devcmd("",NULL,"\r\nAT\033"); + devcmd(NULL,NULL,"\r\nAT"); + + smscset(); + devcmd(NULL,NULL,"\r\nAT+CSMP=81,,0,245"); + devcmd("\n> ",NULL,"\r\nAT+CMGS=\"%s\"",phone); + if (!(s=devcmd(NULL,"\n+CMGS:","!%s\032",hexdata))) { + retrying(); + goto retryall; + } + devcmd(NULL,NULL,"\r\nAT+CSMP=17,,0,0"); + devcmd(NULL,NULL,"\r\nAT"); + while (isspace(*s)) s++; if (verbose>=1) error("\nMessage successfuly sent with MR: %s",s); devcmd(NULL,NULL,"\r\nAT"); -- 1.8.3.1