git://git.jankratochvil.net
/
mdsms.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ugly argument parsing bug fixed, courtesy of Bruno Ferri <bruno@eliocopy.com>.
[mdsms.git]
/
mdsms.c
diff --git
a/mdsms.c
b/mdsms.c
index
a630131
..
d3f7f74
100644
(file)
--- a/
mdsms.c
+++ b/
mdsms.c
@@
-316,7
+316,8
@@
static const struct option longopts[]={
{"file" ,0,0,'f'},
{"verbose" ,0,0,'v'},
{"help" ,0,0,'h'},
{"file" ,0,0,'f'},
{"verbose" ,0,0,'v'},
{"help" ,0,0,'h'},
-{"version" ,0,0,'V'}};
+{"version" ,0,0,'V'},
+{NULL ,0,0,0 }};
static void processargs(int argp,char **args,const char *from);
static void processargs(int argp,char **args,const char *from);
@@
-1256,19
+1257,19
@@
long size;
#define WORD(n) (((unsigned char)buf[(n)])|(((unsigned char)buf[(n)+1])<<8))
#define WORD(n) (((unsigned char)buf[(n)])|(((unsigned char)buf[(n)+1])<<8))
- if (!(f=fopen(
logo
name,"rb")))
- error(_("^!Cannot open ring file \"%s\" for r/o"),
logo
name);
- if ((size=getfilesize(f,
logo
name))==-1)
+ if (!(f=fopen(
ring
name,"rb")))
+ error(_("^!Cannot open ring file \"%s\" for r/o"),
ring
name);
+ if ((size=getfilesize(f,
ring
name))==-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?"),
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?"),
-
logo
name,size);
+
ring
name,size);
if (fseek(f,0x100,SEEK_SET))
if (fseek(f,0x100,SEEK_SET))
- error(_("^Seeking error on \"%s\", ignoring"),
logo
name);
+ error(_("^Seeking error on \"%s\", ignoring"),
ring
name);
size-=0x100;
if (size<=BIN1_PAYLOAD) {
if ((got=fread(bin1+7,1,size,f))!=size)
size-=0x100;
if (size<=BIN1_PAYLOAD) {
if ((got=fread(bin1+7,1,size,f))!=size)
- error(_("^Read error on \"%s\", wanted %ld, got %d"),
logo
name,size,got);
+ error(_("^Read error on \"%s\", wanted %ld, got %d"),
ring
name,size,got);
error(_("\nSending ring tone \"%s\" as single SMS (size %ld, max %d)"),
ringname,size,BIN1_PAYLOAD);
nokiaprep(bin1,7+size);
error(_("\nSending ring tone \"%s\" as single SMS (size %ld, max %d)"),
ringname,size,BIN1_PAYLOAD);
nokiaprep(bin1,7+size);
@@
-1289,12
+1290,12
@@
long size;
binn[11]=fragn;
want=MIN(size,BINN_PAYLOAD);
if ((got=fread(binn+12,1,want,f))!=want)
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"),
logo
name,want,got);
+ error(_("^Read error on \"%s\", wanted %d, got %d"),
ring
name,want,got);
nokiaprep(binn,12+want);
size-=want;
}
}
nokiaprep(binn,12+want);
size-=want;
}
}
- chkfclose(f,
logo
name);
+ chkfclose(f,
ring
name);
#undef WORD
}
#undef WORD
}
@@
-1808,6
+1809,7
@@
int i,cmgf=-1 /* GCC happiness */;
unsigned fatal=0;
speed_t portbaud=0 /* GCC happiness */;
enum modenum argsmode;
unsigned fatal=0;
speed_t portbaud=0 /* GCC happiness */;
enum modenum argsmode;
+unsigned parts=0;
if ((s=strrchr((pname=*argv),'/'))) pname=s+1;
if ((s=strrchr((pname=*argv),'/'))) pname=s+1;
@@
-2029,11
+2031,12
@@
struct hexdata *hd;
restore="\r\nAT+CSMP=17,,0,0";
devcmd(NULL,NULL,"\r\nAT+CSMP=81,,0,245");
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)) {
while ((hd=hexdata)) {
+ devcmd("\n> ",NULL,"\r\nAT+CMGS=\"%s\"",phone);
if (!(s=devcmd(NULL,"\n+CMGS:","!~%s\032",hd->data))) break;
if (!(s=devcmd(NULL,"\n+CMGS:","!~%s\032",hd->data))) break;
-
hexdata=hd->next
;
+
if ((hexdata=hd->next)) pushargstack_one(s,0)
;
free(hd);
free(hd);
+ parts++;
}
} break;
case MODE_RECEIVE:
}
} break;
case MODE_RECEIVE:
@@
-2079,10
+2082,13
@@
struct hexdata *hd;
}
if (!s) { retrying(); goto retryall; }
}
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");
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,part
s);
return(EXIT_SUCCESS);
}
return(EXIT_SUCCESS);
}