From 4735be6287b72ba397775cf0c7cf4c539d2273fd Mon Sep 17 00:00:00 2001 From: mickey Date: Fri, 23 Nov 2007 20:30:33 +0000 Subject: gsmd: fix typos and indentation git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3498 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/util/event.c | 2 +- src/util/libgsmd-tool.c | 2 +- src/util/shell.c | 60 ++++++++++++++++++++++++------------------------- 3 files changed, 31 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/util/event.c b/src/util/event.c index acbd24a..24a8924 100644 --- a/src/util/event.c +++ b/src/util/event.c @@ -238,7 +238,7 @@ static int error_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdat if(aux->u.cme_err.number) printf("cme error: %u\n", aux->u.cme_err.number); else if(aux->u.cms_err.number) - printf("cme error: %u\n", aux->u.cms_err.number); + printf("cms error: %u\n", aux->u.cms_err.number); return 0; } diff --git a/src/util/libgsmd-tool.c b/src/util/libgsmd-tool.c index d29dfdc..5a7bdda 100644 --- a/src/util/libgsmd-tool.c +++ b/src/util/libgsmd-tool.c @@ -94,7 +94,7 @@ int main(int argc, char **argv) char *pin = NULL; int rc, i, mode, shellwait = 0; - printf("libgsm-tool - (C) 2006 by Harald Welte\n" + printf("libgsm-tool - (C) 2006-2007 by Harald Welte and OpenMoko, Inc.\n" "This program is Free Software and has ABSOLUTELY NO WARRANTY\n\n"); while (1) { diff --git a/src/util/shell.c b/src/util/shell.c index 5c57598..40dddaf 100644 --- a/src/util/shell.c +++ b/src/util/shell.c @@ -354,17 +354,17 @@ static int shell_help(void) printf( "\tA\tAnswer incoming call\n" "\tD\tDial outgoing number\n" "\tH\tHangup call\n" - "\tO\tPower On\n" - "\to\tPower Off\n" + "\tO\tAntenna Power On\n" + "\to\tAntenna Power Off\n" "\tM\tModem Power On\n" "\tm\tModem Power Off\n" "\tr\tRegister to network\n" "\tR\tRegister to given operator (R=number)\n" "\tU\tUnregister from netowrk\n" "\tP\tPrint current operator\n" - "\tL\tDetect available operators\n" + "\tL\tList available operators\n" "\tQ\tRead signal quality\n" - "\tS\tSleep (S[=second], default 5)\n" + "\tS\tSleep (S[=second], default 5)\n" "\tT\tSend DTMF Tone\n" "\tn\tPrint subscriber numbers\n" "\tpd\tPB Delete (pb=index)\n" @@ -426,7 +426,7 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) * on to the library */ rc = read(gsm_fd, buf, sizeof(buf)); if (rc <= 0) { - printf("ERROR reding from gsm_fd\n"); + printf("ERROR reading from gsm_fd\n"); break; } rc = lgsm_handle_packet(lgsmh, buf, rc); @@ -495,14 +495,14 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) pending_responses ++; } else if (!strcmp(buf, "q")) { exit(0); - } else if (buf[0] == 'S' ) { - if(!strchr(buf,'=') || atoi((strchr(buf,'=')+1)) < 0) { - printf("Sleep 5 secs\n"); - sleep(5); - }else { - printf("Sleep %d secs\n",atoi(strchr(buf,'=')+1)); - sleep(atoi(strchr(buf,'=')+1)); - } + } else if (buf[0] == 'S' ) { + if(!strchr(buf,'=') || atoi((strchr(buf,'=')+1)) < 0) { + printf("Sleep 5 secs\n"); + sleep(5); + }else { + printf("Sleep %d secs\n",atoi(strchr(buf,'=')+1)); + sleep(atoi(strchr(buf,'=')+1)); + } } else if (buf[0] == 'T') { if (strlen(buf) < 2) continue; @@ -610,18 +610,16 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) strncpy(sms.addr, fcomma+1, lcomma-fcomma-1); sms.addr[lcomma-fcomma-1] = '\0'; /* todo define \" to allow " in text */ - if (lcomma[1]=='"' && - !strchr(lcomma+2, '"')) { - /* read until closing '"' */ - rc = fscanf(stdin, "%[^\"]\"", - lcomma+strlen(lcomma)); - if (rc == EOF) { - printf("EOF\n"); - return -1; - } - /* remove brackets */ - lcomma++; - lcomma[strlen(lcomma)] = '\0'; + if (lcomma[1]=='"' && !strchr(lcomma+2, '"')) { + /* read until closing '"' */ + rc = fscanf(stdin, "%[^\"]\"", lcomma+strlen(lcomma)); + if (rc == EOF) { + printf("EOF\n"); + return -1; + } + /* remove brackets */ + lcomma++; + lcomma[strlen(lcomma)] = '\0'; } printf("Send SMS\n"); packing_7bit_character(lcomma+1, &sms); @@ -677,12 +675,12 @@ int shell_main(struct lgsm_handle *lgsmh, int sync) printf("Get imsi\n"); lgsm_get_imsi(lgsmh); pending_responses ++; - } else if (!strncmp(buf, "M", 1)) { - printf("Modem Power On\n"); - lgsm_modem_power(lgsmh, 1); - } else if (!strncmp(buf, "m", 1)) { - printf("Modem Power Off\n"); - lgsm_modem_power(lgsmh, 0); + } else if (!strncmp(buf, "M", 1)) { + printf("Modem Power On\n"); + lgsm_modem_power(lgsmh, 1); + } else if (!strncmp(buf, "m", 1)) { + printf("Modem Power Off\n"); + lgsm_modem_power(lgsmh, 0); } else { printf("Unknown command `%s'\n", buf); } -- cgit v1.2.3