-rw-r--r-- | gammu/emb/gammu/gammu.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index 1d53fb0..5163d81 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c @@ -8243,12 +8243,57 @@ int main(int argc, char *argv[]) /* Is first parameter numeric? If so treat it as config that should be loaded. */ if (isdigit(argv[1][0])) { only_config = atoi(argv[1]); if (only_config >= 0) start++; else only_config = -1; } + GSM_ReadConfig(NULL, &s.Config[0], 0); + s.ConfigNum = 1; + GSM_Config *con = &s.Config[0]; + + char* tempC; + tempC = argv[argc-1]+2; + if ( *tempC != 0 ) { + fprintf(stderr,"Using model %s \n",tempC); + strcpy(con->Model,tempC ); + } + tempC = argv[argc-2]+2; + if ( *tempC != 0 ) { + fprintf(stderr,"Using device %s \n",tempC); + con->Device = strdup(tempC); + con->DefaultDevice = false; + } + tempC = argv[argc-3]+2; + if ( *tempC != 0 ) { + fprintf(stderr,"Using connection %s \n",tempC); + con->Connection = strdup(tempC); + con->DefaultConnection = false; + } + argc = argc-3; +#if 0 + if ( ! mConnection.isEmpty() ) { + cfg->Connection = strdup(mConnection.latin1()); + cfg->DefaultConnection = false; + qDebug("Connection set %s ", cfg->Connection ); + + } + if ( ! mDevice.isEmpty() ) { + cfg->Device = strdup(mDevice.latin1()); + cfg->DefaultDevice = false; + qDebug("Device set %s ", cfg->Device); + + } + if ( ! mModel.isEmpty() ) { + strcpy(cfg->Model,mModel.latin1() ); + cfg->DefaultModel = false; + qDebug("Model set %s ",cfg->Model ); + } + +#endif + +#if 0 cfg=GSM_FindGammuRC(); for (i = 0; i <= MAX_CONFIG_NUM; i++) { if (cfg!=NULL) { cp = INI_GetValue(cfg, "gammu", "gammucoding", false); if (cp) di.coding = cp; @@ -8302,13 +8347,13 @@ int main(int argc, char *argv[]) Print_Error(error); } /* We wanted to read just user specified configuration. */ if (only_config != -1) {break;} } - +#endif /* Do we have enough parameters? */ if (argc == 1 + start) { HelpGeneral(); printmsg("Too few parameters!\n"); exit(-2); } |