#define WORD(n) (((unsigned char)buf[(n)])|(((unsigned char)buf[(n)+1])<<8))
- if (!(f=fopen(logoname,"rb")))
- error(_("^!Cannot open ring file \"%s\" for r/o"),logoname);
- if ((size=getfilesize(f,logoname))==-1)
+ if (!(f=fopen(ringname,"rb")))
+ error(_("^!Cannot open ring file \"%s\" for r/o"),ringname);
+ if ((size=getfilesize(f,ringname))==-1)
error(_("!File size determination is essential to continue operation"));
if (size<0x103)
error(_("!File \"%s\" size %ld too small (must >=0x103)! Is it .000 file?"),
- logoname,size);
+ ringname,size);
if (fseek(f,0x100,SEEK_SET))
- error(_("^Seeking error on \"%s\", ignoring"),logoname);
+ error(_("^Seeking error on \"%s\", ignoring"),ringname);
size-=0x100;
if (size<=BIN1_PAYLOAD) {
if ((got=fread(bin1+7,1,size,f))!=size)
- error(_("^Read error on \"%s\", wanted %ld, got %d"),logoname,size,got);
+ error(_("^Read error on \"%s\", wanted %ld, got %d"),ringname,size,got);
error(_("\nSending ring tone \"%s\" as single SMS (size %ld, max %d)"),
ringname,size,BIN1_PAYLOAD);
nokiaprep(bin1,7+size);
binn[11]=fragn;
want=MIN(size,BINN_PAYLOAD);
if ((got=fread(binn+12,1,want,f))!=want)
- error(_("^Read error on \"%s\", wanted %d, got %d"),logoname,want,got);
+ error(_("^Read error on \"%s\", wanted %d, got %d"),ringname,want,got);
nokiaprep(binn,12+want);
size-=want;
}
}
- chkfclose(f,logoname);
+ chkfclose(f,ringname);
#undef WORD
}
unsigned fatal=0;
speed_t portbaud=0 /* GCC happiness */;
enum modenum argsmode;
+unsigned parts=0;
if ((s=strrchr((pname=*argv),'/'))) pname=s+1;
restore="\r\nAT+CSMP=17,,0,0";
devcmd(NULL,NULL,"\r\nAT+CSMP=81,,0,245");
- devcmd("\n> ",NULL,"\r\nAT+CMGS=\"%s\"",phone);
while ((hd=hexdata)) {
+ devcmd("\n> ",NULL,"\r\nAT+CMGS=\"%s\"",phone);
if (!(s=devcmd(NULL,"\n+CMGS:","!~%s\032",hd->data))) break;
- hexdata=hd->next;
+ if ((hexdata=hd->next)) pushargstack_one(s,0);
free(hd);
+ parts++;
}
} break;
case MODE_RECEIVE:
}
if (!s) { retrying(); goto retryall; }
- while (isspace(*s)) s++;
- if (verbose>=1) error(_("\nMessage successfuly sent with MR (Message Reference): %s"),s);
+ pushargstack_one(s,0); s=NULL;
+ if (verbose>=1) while ((s=nextargstack())) {
+ while (isspace(*s)) s++;
+ error(_("\nMessage successfuly sent with MR (Message Reference): %s"),s);
+ }
devcmd(NULL,NULL,"\r\nAT");
- logmsg(_("SMS sent (after %d retries), message reference: %s"),retrycnt,s);
+ logmsg(_("SMS sent (after %d retries), %d part(s)"),retrycnt,parts);
return(EXIT_SUCCESS);
}