summaryrefslogtreecommitdiff
path: root/packages/gsm/files/024_sms-text-in-bracket.patch
diff options
context:
space:
mode:
authorOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2007-10-07 00:34:07 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2007-10-07 00:34:07 +0000
commit2f8521c6d1173dd650d9ae2bba8c18e690fa3b1f (patch)
tree06bc2b997b60797bc42f696f3427f92890089d2b /packages/gsm/files/024_sms-text-in-bracket.patch
parent0d0bf315513039bd8560ac91865c7174e789d675 (diff)
parent6e90aae26efa66553063b74b9afa9563b70fb982 (diff)
merge of '603b2d0c7e4ad80e5779bd3bbdb822331cc0ea2b'
and '6ab53da82d157971966f5a17d0c29d54df22cac9'
Diffstat (limited to 'packages/gsm/files/024_sms-text-in-bracket.patch')
-rw-r--r--packages/gsm/files/024_sms-text-in-bracket.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/packages/gsm/files/024_sms-text-in-bracket.patch b/packages/gsm/files/024_sms-text-in-bracket.patch
new file mode 100644
index 0000000000..32a1ca33ff
--- /dev/null
+++ b/packages/gsm/files/024_sms-text-in-bracket.patch
@@ -0,0 +1,70 @@
+http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=834
+
+From: Kristian Mueller <kristian@mput.de>
+Subject: [PATCH] libgsmd-tool does not allow sms with more than one word
+
+libgsmd-tool only allows for command strings without spaces.
+SMS messages with more than one word will be parsed as multible commands.
+The patch introduces SMS message text in bracket and fixes a NULL pointer
+reference on mailformed "ss" commands.
+
+Signed-off-by: Jim Huang <jserv@openmoko.org>
+---
+ src/util/shell.c | 32 ++++++++++++++++++++++++++------
+ 1 file changed, 26 insertions(+), 6 deletions(-)
+
+Index: gsm/src/util/shell.c
+===================================================================
+--- gsm.orig/src/util/shell.c 2007-08-31 16:15:30.000000000 +0800
++++ gsm/src/util/shell.c 2007-09-17 23:35:31.000000000 +0800
+@@ -389,7 +389,7 @@
+ "\tsd\tSMS Delete (sd=index,delflg)\n"
+ "\tsl\tSMS List (sl=stat)\n"
+ "\tsr\tSMS Read (sr=index)\n"
+- "\tss\tSMS Send (ss=number,text)\n"
++ "\tss\tSMS Send (ss=number,text|[\"text\"])\n"
+ "\tsw\tSMS Write (sw=stat,number,text)\n"
+ "\tsm\tSMS Storage stats\n"
+ "\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n"
+@@ -612,16 +612,36 @@
+
+ lgsm_sms_read(lgsmh, atoi(ptr+1));
+ } else if ( !strncmp(buf, "ss", 2)) {
+- printf("Send SMS\n");
+ struct lgsm_sms sms;
+
+ ptr = strchr(buf, '=');
+ fcomma = strchr(buf, ',');
+- strncpy(sms.addr, ptr+1, fcomma-ptr-1);
+- sms.addr[fcomma-ptr-1] = '\0';
+- packing_7bit_character(fcomma+1, &sms);
++ if (!ptr || !fcomma) {
++ printf("Wrong command format\n");
++ } else {
++ strncpy(sms.addr, ptr+1, fcomma-ptr-1);
++ sms.addr[fcomma-ptr-1] = '\0';
++
++ /* todo define \" to allow " in text */
++ if (fcomma[1] == '"' &&
++ !strchr(fcomma+2, '"')) {
++ /* read until closing '"' */
++ rc = fscanf(stdin, "%[^\"]\"",
++ fcomma+strlen(fcomma));
++ if (rc == EOF) {
++ printf("EOF\n");
++ return -1;
++ }
++ /* remove brackets */
++ fcomma++;
++ fcomma[strlen(fcomma)] = '\0';
++ }
++
++ printf("Send SMS\n");
++ packing_7bit_character(fcomma+1, &sms);
+
+- lgsm_sms_send(lgsmh, &sms);
++ lgsm_sms_send(lgsmh, &sms);
++ }
+ } else if ( !strncmp(buf, "sw", 2)) {
+ printf("Write SMS\n");
+ struct lgsm_sms_write sms_write;