summaryrefslogtreecommitdiffabout
path: root/gammu
authorzautrix <zautrix>2004-09-12 15:24:11 (UTC)
committer zautrix <zautrix>2004-09-12 15:24:11 (UTC)
commita222c2f7369eeefd19454c973c0cc48300f72bec (patch) (unidiff)
tree6f01a5922ea622add6960f3fad703e8e8f099caa /gammu
parentb2dede5d5735e2b4ab5afd51cf6a2c46d9be9b26 (diff)
downloadkdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.zip
kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.gz
kdepimpi-a222c2f7369eeefd19454c973c0cc48300f72bec.tar.bz2
many phone sync fixes
Diffstat (limited to 'gammu') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.c4
-rw-r--r--gammu/emb/gammu/gammu.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c
index ddf9790..0ea8e06 100644
--- a/gammu/emb/common/service/gsmcal.c
+++ b/gammu/emb/common/service/gsmcal.c
@@ -381,132 +381,132 @@ GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_Calenda
381 return ERR_NONE; 381 return ERR_NONE;
382 } 382 }
383 Calendar->Type = GSM_CAL_MEETING; 383 Calendar->Type = GSM_CAL_MEETING;
384 if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER; 384 if (strstr(Line,"CATEGORIES:Reminder")) Calendar->Type = GSM_CAL_REMINDER;
385 if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE 385 if (strstr(Line,"CATEGORIES:Date")) Calendar->Type = GSM_CAL_REMINDER;//SE
386 if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE 386 if (strstr(Line,"CATEGORIES:Travel")) Calendar->Type = GSM_CAL_TRAVEL; //SE
387 if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE 387 if (strstr(Line,"CATEGORIES:Vacation")) Calendar->Type = GSM_CAL_VACATION;//SE
388 if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO; 388 if (strstr(Line,"CATEGORIES:Miscellaneous")) Calendar->Type = GSM_CAL_MEMO;
389 if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL; 389 if (strstr(Line,"CATEGORIES:Phone Call")) Calendar->Type = GSM_CAL_CALL;
390 if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY; 390 if (strstr(Line,"CATEGORIES:Special Occasion")) Calendar->Type = GSM_CAL_BIRTHDAY;
391 if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY; 391 if (strstr(Line,"CATEGORIES:Anniversary")) Calendar->Type = GSM_CAL_BIRTHDAY;
392 if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING; 392 if (strstr(Line,"CATEGORIES:Meeting")) Calendar->Type = GSM_CAL_MEETING;
393 if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING; 393 if (strstr(Line,"CATEGORIES:Appointment")) Calendar->Type = GSM_CAL_MEETING;
394 if (strstr(Line,"RRULE:D1")) { 394 if (strstr(Line,"RRULE:D1")) {
395 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 395 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
396 Calendar->Entries[Calendar->EntriesNum].Number = 1*24; 396 Calendar->Entries[Calendar->EntriesNum].Number = 1*24;
397 Calendar->EntriesNum++; 397 Calendar->EntriesNum++;
398 } 398 }
399 if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) { 399 if ((strstr(Line,"RRULE:W1")) || (strstr(Line,"RRULE:D7"))) {
400 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 400 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
401 Calendar->Entries[Calendar->EntriesNum].Number = 7*24; 401 Calendar->Entries[Calendar->EntriesNum].Number = 7*24;
402 Calendar->EntriesNum++; 402 Calendar->EntriesNum++;
403 } 403 }
404 if (strstr(Line,"RRULE:W2")) { 404 if (strstr(Line,"RRULE:W2")) {
405 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 405 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
406 Calendar->Entries[Calendar->EntriesNum].Number = 14*24; 406 Calendar->Entries[Calendar->EntriesNum].Number = 14*24;
407 Calendar->EntriesNum++; 407 Calendar->EntriesNum++;
408 } 408 }
409 if (strstr(Line,"RRULE:MD1")) { 409 if (strstr(Line,"RRULE:MD1")) {
410 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 410 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
411 Calendar->Entries[Calendar->EntriesNum].Number = 30*24; 411 Calendar->Entries[Calendar->EntriesNum].Number = 30*24;
412 Calendar->EntriesNum++; 412 Calendar->EntriesNum++;
413 } 413 }
414 if (strstr(Line,"RRULE:YD1")) { 414 if (strstr(Line,"RRULE:YD1")) {
415 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE; 415 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_RECURRANCE;
416 Calendar->Entries[Calendar->EntriesNum].Number = 365*24; 416 Calendar->Entries[Calendar->EntriesNum].Number = 365*24;
417 Calendar->EntriesNum++; 417 Calendar->EntriesNum++;
418 } 418 }
419 if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) { 419 if ((ReadVCALText(Line, "SUMMARY", Buff)) || (ReadVCALText(Line, "DESCRIPTION", Buff))) {
420 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT; 420 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_TEXT;
421 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 421 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
422 Calendar->EntriesNum++; 422 Calendar->EntriesNum++;
423 } 423 }
424 if (ReadVCALText(Line, "LOCATION", Buff)) { 424 if (ReadVCALText(Line, "LOCATION", Buff)) {
425 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION; 425 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_LOCATION;
426 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff); 426 CopyUnicodeString(Calendar->Entries[Calendar->EntriesNum].Text,Buff);
427 Calendar->EntriesNum++; 427 Calendar->EntriesNum++;
428 } 428 }
429 if (ReadVCALText(Line, "DTSTART", Buff)) { 429 if (ReadVCALText(Line, "DTSTART", Buff)) {
430 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME; 430 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_START_DATETIME;
431 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 431 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
432 Calendar->EntriesNum++; 432 Calendar->EntriesNum++;
433 } 433 }
434 if (ReadVCALText(Line, "DTEND", Buff)) { 434 if (ReadVCALText(Line, "DTEND", Buff)) {
435 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME; 435 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_END_DATETIME;
436 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 436 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
437 Calendar->EntriesNum++; 437 Calendar->EntriesNum++;
438 } 438 }
439 if (ReadVCALText(Line, "DALARM", Buff)) { 439 if (ReadVCALText(Line, "DALARM", Buff)) {
440 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME; 440 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME;
441 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 441 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
442 Calendar->EntriesNum++; 442 Calendar->EntriesNum++;
443 } 443 }
444 if (ReadVCALText(Line, "AALARM", Buff)) { 444 if (ReadVCALText(Line, "AALARM", Buff)) {
445 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME; 445 Calendar->Entries[Calendar->EntriesNum].EntryType = CAL_ALARM_DATETIME;
446 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date); 446 ReadVCALDateTime(DecodeUnicodeString(Buff), &Calendar->Entries[Calendar->EntriesNum].Date);
447 Calendar->EntriesNum++; 447 Calendar->EntriesNum++;
448 } 448 }
449 break; 449 break;
450 case 2: /* ToDo note */ 450 case 2: /* ToDo note */
451 if (strstr(Line,"END:VTODO")) { 451 if (strstr(Line,"END:VTODO")) {
452 if (ToDo->EntriesNum == 0) return ERR_EMPTY; 452 if (ToDo->EntriesNum == 0) return ERR_EMPTY;
453 return ERR_NONE; 453 return ERR_NONE;
454 } 454 }
455 if (ReadVCALText(Line, "DUE", Buff)) { 455 if (ReadVCALText(Line, "DUE", Buff)) {
456 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME; 456 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_END_DATETIME;
457 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); 457 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
458 ToDo->EntriesNum++; 458 ToDo->EntriesNum++;
459 } 459 }
460 if (ReadVCALText(Line, "DALARM", Buff)) { 460 if (ReadVCALText(Line, "DALARM", Buff)) {
461 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME; 461 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME;
462 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); 462 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
463 ToDo->EntriesNum++; 463 ToDo->EntriesNum++;
464 } 464 }
465 if (ReadVCALText(Line, "AALARM", Buff)) { 465 if (ReadVCALText(Line, "AALARM", Buff)) {
466 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME; 466 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_ALARM_DATETIME;
467 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date); 467 ReadVCALDateTime(DecodeUnicodeString(Buff), &ToDo->Entries[ToDo->EntriesNum].Date);
468 ToDo->EntriesNum++; 468 ToDo->EntriesNum++;
469 } 469 }
470 if (ReadVCALText(Line, "SUMMARY", Buff)) { 470 if (ReadVCALText(Line, "SUMMARY", Buff)) {
471 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT; 471 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_TEXT;
472 CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff); 472 CopyUnicodeString(ToDo->Entries[ToDo->EntriesNum].Text,Buff);
473 ToDo->EntriesNum++; 473 ToDo->EntriesNum++;
474 } 474 }
475 if (ReadVCALText(Line, "PRIORITY", Buff)) { 475 if (ReadVCALText(Line, "PRIORITY", Buff)) {
476 if (ToDoVer == SonyEricsson_VToDo) { 476 if (ToDoVer == SonyEricsson_VToDo) {
477 ToDo->Priority = GSM_Priority_Low; 477 ToDo->Priority = GSM_Priority_Medium;
478 if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; 478 if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low;
479 if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; 479 if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High;
480 dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff)); 480 dbgprintf("atoi is %i %s\n",atoi(DecodeUnicodeString(Buff)),DecodeUnicodeString(Buff));
481 } else if (ToDoVer == Nokia_VToDo) { 481 } else if (ToDoVer == Nokia_VToDo) {
482 ToDo->Priority = GSM_Priority_Low; 482 ToDo->Priority = GSM_Priority_Medium;
483 if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low; 483 if (atoi(DecodeUnicodeString(Buff))>3) ToDo->Priority = GSM_Priority_Low;
484 if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High; 484 if (atoi(DecodeUnicodeString(Buff))<3) ToDo->Priority = GSM_Priority_High;
485 } 485 }
486 } 486 }
487 if (strstr(Line,"PERCENT-COMPLETE:100")) { 487 if (strstr(Line,"PERCENT-COMPLETE:100")) {
488 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED; 488 ToDo->Entries[ToDo->EntriesNum].EntryType = TODO_COMPLETED;
489 ToDo->Entries[ToDo->EntriesNum].Number = 1; 489 ToDo->Entries[ToDo->EntriesNum].Number = 1;
490 ToDo->EntriesNum++; 490 ToDo->EntriesNum++;
491 } 491 }
492 break; 492 break;
493 } 493 }
494 } 494 }
495 495
496 if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY; 496 if (Calendar->EntriesNum == 0 && ToDo->EntriesNum == 0) return ERR_EMPTY;
497 return ERR_NONE; 497 return ERR_NONE;
498} 498}
499 499
500GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note) 500GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note)
501{ 501{
502 *Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10); 502 *Length+=sprintf(Buffer+(*Length), "BEGIN:VNOTE%c%c",13,10);
503 *Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10); 503 *Length+=sprintf(Buffer+(*Length), "VERSION:1.1%c%c",13,10);
504 SaveVCALText(Buffer, Length, Note->Text, "BODY"); 504 SaveVCALText(Buffer, Length, Note->Text, "BODY");
505 *Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10); 505 *Length+=sprintf(Buffer+(*Length), "END:VNOTE%c%c",13,10);
506 506
507 return ERR_NONE; 507 return ERR_NONE;
508} 508}
509 509
510/* How should editor hadle tabs in this file? Add editor commands here. 510/* How should editor hadle tabs in this file? Add editor commands here.
511 * vim: noexpandtab sw=8 ts=8 sts=8: 511 * vim: noexpandtab sw=8 ts=8 sts=8:
512 */ 512 */
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c
index a3b93a8..997485a 100644
--- a/gammu/emb/gammu/gammu.c
+++ b/gammu/emb/gammu/gammu.c
@@ -4534,253 +4534,258 @@ static void Restore(int argc, char *argv[])
4534 } 4534 }
4535 if (DoRestore) { 4535 if (DoRestore) {
4536 used = 0; 4536 used = 0;
4537 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { 4537 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) {
4538 Pbk.MemoryType = MEM_ME; 4538 Pbk.MemoryType = MEM_ME;
4539 Pbk.Location= i + 1; 4539 Pbk.Location= i + 1;
4540 Pbk.EntriesNum= 0; 4540 Pbk.EntriesNum= 0;
4541 if (used<max) { 4541 if (used<max) {
4542 if (Backup.PhonePhonebook[used]->Location == Pbk.Location) { 4542 if (Backup.PhonePhonebook[used]->Location == Pbk.Location) {
4543 Pbk = *Backup.PhonePhonebook[used]; 4543 Pbk = *Backup.PhonePhonebook[used];
4544 used++; 4544 used++;
4545 dbgprintf("Location %i\n",Pbk.Location); 4545 dbgprintf("Location %i\n",Pbk.Location);
4546 if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); 4546 if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk);
4547 } 4547 }
4548 } 4548 }
4549 if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); 4549 if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk);
4550 Print_Error(error); 4550 Print_Error(error);
4551 printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); 4551 printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree));
4552 if (gshutdown) { 4552 if (gshutdown) {
4553 GSM_Terminate(); 4553 GSM_Terminate();
4554 exit(0); 4554 exit(0);
4555 } 4555 }
4556 } 4556 }
4557 printmsgerr("\n"); 4557 printmsgerr("\n");
4558 } 4558 }
4559 4559
4560 DoRestore = false; 4560 DoRestore = false;
4561 if (Backup.SIMPhonebook[0] != NULL) { 4561 if (Backup.SIMPhonebook[0] != NULL) {
4562 MemStatus.MemoryType = MEM_SM; 4562 MemStatus.MemoryType = MEM_SM;
4563 error=Phone->GetMemoryStatus(&s, &MemStatus); 4563 error=Phone->GetMemoryStatus(&s, &MemStatus);
4564 if (error==ERR_NONE) { 4564 if (error==ERR_NONE) {
4565 max = 0; 4565 max = 0;
4566 while (Backup.SIMPhonebook[max]!=NULL) max++; 4566 while (Backup.SIMPhonebook[max]!=NULL) max++;
4567 printmsgerr("%i entries in backup file\n",max); 4567 printmsgerr("%i entries in backup file\n",max);
4568 if (answer_yes("Restore SIM phonebook")) DoRestore = true; 4568 if (answer_yes("Restore SIM phonebook")) DoRestore = true;
4569 } 4569 }
4570 } 4570 }
4571 if (DoRestore) { 4571 if (DoRestore) {
4572 used = 0; 4572 used = 0;
4573 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { 4573 for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) {
4574 Pbk.MemoryType = MEM_SM; 4574 Pbk.MemoryType = MEM_SM;
4575 Pbk.Location= i + 1; 4575 Pbk.Location= i + 1;
4576 Pbk.EntriesNum= 0; 4576 Pbk.EntriesNum= 0;
4577 if (used<max) { 4577 if (used<max) {
4578 if (Backup.SIMPhonebook[used]->Location == Pbk.Location) { 4578 if (Backup.SIMPhonebook[used]->Location == Pbk.Location) {
4579 Pbk = *Backup.SIMPhonebook[used]; 4579 Pbk = *Backup.SIMPhonebook[used];
4580 used++; 4580 used++;
4581 dbgprintf("Location %i\n",Pbk.Location); 4581 dbgprintf("Location %i\n",Pbk.Location);
4582 if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); 4582 if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk);
4583 } 4583 }
4584 } 4584 }
4585 if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); 4585 if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk);
4586 Print_Error(error); 4586 Print_Error(error);
4587 printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); 4587 printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree));
4588 if (gshutdown) { 4588 if (gshutdown) {
4589 GSM_Terminate(); 4589 GSM_Terminate();
4590 exit(0); 4590 exit(0);
4591 } 4591 }
4592 } 4592 }
4593 printmsgerr("\n"); 4593 printmsgerr("\n");
4594 } 4594 }
4595 4595
4596 DoRestore = false; 4596 DoRestore = false;
4597 if (Backup.CallerLogos[0] != NULL) { 4597 if (Backup.CallerLogos[0] != NULL) {
4598 Bitmap.Type = GSM_CallerGroupLogo; 4598 Bitmap.Type = GSM_CallerGroupLogo;
4599 Bitmap.Location = 1; 4599 Bitmap.Location = 1;
4600 error=Phone->GetBitmap(&s,&Bitmap); 4600 error=Phone->GetBitmap(&s,&Bitmap);
4601 if (error == ERR_NONE) { 4601 if (error == ERR_NONE) {
4602 if (answer_yes("Restore caller groups and logos")) DoRestore = true; 4602 if (answer_yes("Restore caller groups and logos")) DoRestore = true;
4603 } 4603 }
4604 } 4604 }
4605 if (DoRestore) { 4605 if (DoRestore) {
4606 max = 0; 4606 max = 0;
4607 while (Backup.CallerLogos[max]!=NULL) max++; 4607 while (Backup.CallerLogos[max]!=NULL) max++;
4608 for (i=0;i<max;i++) { 4608 for (i=0;i<max;i++) {
4609 error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); 4609 error=Phone->SetBitmap(&s,Backup.CallerLogos[i]);
4610 Print_Error(error); 4610 Print_Error(error);
4611 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4611 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4612 if (gshutdown) { 4612 if (gshutdown) {
4613 GSM_Terminate(); 4613 GSM_Terminate();
4614 exit(0); 4614 exit(0);
4615 } 4615 }
4616 } 4616 }
4617 printmsgerr("\n"); 4617 printmsgerr("\n");
4618 } 4618 }
4619 4619
4620 if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { 4620 if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) {
4621 if (/*answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/ true ) { 4621 if (/*answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/ true ) {
4622 GSM_GetCurrentDateTime(&date_time); 4622 GSM_GetCurrentDateTime(&date_time);
4623 4623
4624 error=Phone->SetDateTime(&s, &date_time); 4624 error=Phone->SetDateTime(&s, &date_time);
4625 Print_Error(error); 4625 Print_Error(error);
4626 } 4626 }
4627 } 4627 }
4628 DoRestore = false; 4628 DoRestore = false;
4629 if (Backup.Calendar[0] != NULL) { 4629 if (Backup.Calendar[0] != NULL) {
4630 DoRestore = true;
4630 /* N6110 doesn't support getting calendar status */ 4631 /* N6110 doesn't support getting calendar status */
4631 error = Phone->GetNextCalendar(&s,&Calendar,true); 4632 error = Phone->GetNextCalendar(&s,&Calendar,true);
4632 if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { 4633 if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) {
4633 max = 0; 4634 max = 0;
4634 while (Backup.Calendar[max] != NULL) max++; 4635 while (Backup.Calendar[max] != NULL) max++;
4635 printmsgerr("%i entries in backup file\n",max); 4636 printmsgerr("%i entries in backup file\n",max);
4636 DoRestore = true; 4637 DoRestore = true;
4637 /* 4638 /*
4638 if (answer_yes("Restore calendar notes")) { 4639 if (answer_yes("Restore calendar notes")) {
4639 Past = answer_yes("Restore notes from the past"); 4640 Past = answer_yes("Restore notes from the past");
4640 DoRestore = true; 4641 DoRestore = true;
4641 } 4642 }
4642 */ 4643 */
4643 } 4644 }
4644 } 4645 }
4645 if (DoRestore) { 4646 if (DoRestore) {
4646 printmsgerr("Deleting old notes: "); 4647 printmsgerr("Deleting old notes: ");
4647 error = Phone->DeleteAllCalendar(&s); 4648 error = Phone->DeleteAllCalendar(&s);
4648 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { 4649 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
4649 while (1) { 4650 while (1) {
4650 error = Phone->GetNextCalendar(&s,&Calendar,true); 4651 error = Phone->GetNextCalendar(&s,&Calendar,true);
4651 if (error != ERR_NONE) break; 4652 if (error != ERR_NONE) break;
4652 error = Phone->DeleteCalendar(&s,&Calendar); 4653 error = Phone->DeleteCalendar(&s,&Calendar);
4653 Print_Error(error); 4654 Print_Error(error);
4654 printmsgerr("*"); 4655 printmsgerr("*");
4655 } 4656 }
4656 printmsgerr("\n"); 4657 printmsgerr("\n");
4657 } else { 4658 } else {
4658 printmsgerr("Done\n"); 4659 printmsgerr("Done\n");
4659 Print_Error(error); 4660 Print_Error(error);
4660 } 4661 }
4661 4662
4662 for (i=0;i<max;i++) { 4663 for (i=0;i<max;i++) {
4663 if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; 4664 if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue;
4664 4665
4665 Calendar = *Backup.Calendar[i]; 4666 Calendar = *Backup.Calendar[i];
4666 error=Phone->AddCalendar(&s,&Calendar); 4667 error=Phone->AddCalendar(&s,&Calendar);
4667 Print_Error(error); 4668 Print_Error(error);
4668 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4669 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4669 if (gshutdown) { 4670 if (gshutdown) {
4670 GSM_Terminate(); 4671 GSM_Terminate();
4671 exit(0); 4672 exit(0);
4672 } 4673 }
4673 } 4674 }
4674 printmsgerr("\n"); 4675 printmsgerr("\n");
4675 } 4676 }
4676 4677
4677 DoRestore = false; 4678 DoRestore = false;
4678 if (Backup.ToDo[0] != NULL) { 4679 if (Backup.ToDo[0] != NULL) {
4679 error = Phone->GetToDoStatus(&s,&ToDoStatus); 4680 error = Phone->GetToDoStatus(&s,&ToDoStatus);
4680 if (error == ERR_NONE) { 4681 if (error == ERR_NONE) {
4682 error == ERR_NOTSUPPORTED;
4683 DoRestore = true;
4681 max = 0; 4684 max = 0;
4682 while (Backup.ToDo[max]!=NULL) max++; 4685 while (Backup.ToDo[max]!=NULL) max++;
4683 printmsgerr("%i entries in backup file\n",max); 4686 printmsgerr("%i entries in backup file\n",max);
4684 4687
4685 /*if (answer_yes("Restore ToDo")) */DoRestore = true; 4688 /*if (answer_yes("Restore ToDo")) */DoRestore = true;
4686 } 4689 }
4687 } 4690 }
4688 if (DoRestore) { 4691 if (DoRestore) {
4692 if ( max > 0 ) {
4689 ToDo = *Backup.ToDo[0]; 4693 ToDo = *Backup.ToDo[0];
4690 error = Phone->SetToDo(&s,&ToDo); 4694 error = Phone->SetToDo(&s,&ToDo);
4695 }
4691 } 4696 }
4692 if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { 4697 if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) {
4693 printmsgerr("Deleting old ToDo: "); 4698 printmsgerr("Deleting old ToDo: ");
4694 error=Phone->DeleteAllToDo(&s); 4699 error=Phone->DeleteAllToDo(&s);
4695 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { 4700 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
4696 while (1) { 4701 while (1) {
4697 error = Phone->GetNextToDo(&s,&ToDo,true); 4702 error = Phone->GetNextToDo(&s,&ToDo,true);
4698 if (error != ERR_NONE) break; 4703 if (error != ERR_NONE) break;
4699 error = Phone->DeleteToDo(&s,&ToDo); 4704 error = Phone->DeleteToDo(&s,&ToDo);
4700 Print_Error(error); 4705 Print_Error(error);
4701 printmsgerr("*"); 4706 printmsgerr("*");
4702 } 4707 }
4703 printmsgerr("\n"); 4708 printmsgerr("\n");
4704 } else { 4709 } else {
4705 printmsgerr("Done\n"); 4710 printmsgerr("Done\n");
4706 Print_Error(error); 4711 Print_Error(error);
4707 } 4712 }
4708 4713
4709 for (i=0;i<max;i++) { 4714 for (i=0;i<max;i++) {
4710 ToDo = *Backup.ToDo[i]; 4715 ToDo = *Backup.ToDo[i];
4711 ToDo.Location = 0; 4716 ToDo.Location = 0;
4712 error=Phone->AddToDo(&s,&ToDo); 4717 error=Phone->AddToDo(&s,&ToDo);
4713 Print_Error(error); 4718 Print_Error(error);
4714 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4719 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4715 if (gshutdown) { 4720 if (gshutdown) {
4716 GSM_Terminate(); 4721 GSM_Terminate();
4717 exit(0); 4722 exit(0);
4718 } 4723 }
4719 } 4724 }
4720 printmsgerr("\n"); 4725 printmsgerr("\n");
4721 } else if (DoRestore) { 4726 } else if (DoRestore) {
4722 /* At first delete entries, that were deleted */ 4727 /* At first delete entries, that were deleted */
4723 used = 0; 4728 used = 0;
4724 error = Phone->GetNextToDo(&s,&ToDo,true); 4729 error = Phone->GetNextToDo(&s,&ToDo,true);
4725 while (error == ERR_NONE) { 4730 while (error == ERR_NONE) {
4726 used++; 4731 used++;
4727 Found = false; 4732 Found = false;
4728 for (i=0;i<max;i++) { 4733 for (i=0;i<max;i++) {
4729 if (Backup.ToDo[i]->Location == ToDo.Location) { 4734 if (Backup.ToDo[i]->Location == ToDo.Location) {
4730 Found = true; 4735 Found = true;
4731 break; 4736 break;
4732 } 4737 }
4733 } 4738 }
4734 if (!Found) { 4739 if (!Found) {
4735 error=Phone->DeleteToDo(&s,&ToDo); 4740 error=Phone->DeleteToDo(&s,&ToDo);
4736 Print_Error(error); 4741 Print_Error(error);
4737 } 4742 }
4738 error = Phone->GetNextToDo(&s,&ToDo,false); 4743 error = Phone->GetNextToDo(&s,&ToDo,false);
4739 printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used); 4744 printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used);
4740 if (gshutdown) { 4745 if (gshutdown) {
4741 GSM_Terminate(); 4746 GSM_Terminate();
4742 exit(0); 4747 exit(0);
4743 } 4748 }
4744 } 4749 }
4745 printmsgerr("\n"); 4750 printmsgerr("\n");
4746 4751
4747 /* Now write modified/new entries */ 4752 /* Now write modified/new entries */
4748 for (i=0;i<max;i++) { 4753 for (i=0;i<max;i++) {
4749 ToDo = *Backup.ToDo[i]; 4754 ToDo = *Backup.ToDo[i];
4750 error = Phone->SetToDo(&s,&ToDo); 4755 error = Phone->SetToDo(&s,&ToDo);
4751 Print_Error(error); 4756 Print_Error(error);
4752 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4757 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4753 if (gshutdown) { 4758 if (gshutdown) {
4754 GSM_Terminate(); 4759 GSM_Terminate();
4755 exit(0); 4760 exit(0);
4756 } 4761 }
4757 } 4762 }
4758 printmsgerr("\n"); 4763 printmsgerr("\n");
4759 } 4764 }
4760 4765
4761 if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) { 4766 if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) {
4762 max = 0; 4767 max = 0;
4763 while (Backup.SMSC[max]!=NULL) max++; 4768 while (Backup.SMSC[max]!=NULL) max++;
4764 for (i=0;i<max;i++) { 4769 for (i=0;i<max;i++) {
4765 error=Phone->SetSMSC(&s,Backup.SMSC[i]); 4770 error=Phone->SetSMSC(&s,Backup.SMSC[i]);
4766 Print_Error(error); 4771 Print_Error(error);
4767 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); 4772 printmsgerr("%cWriting: %i percent",13,(i+1)*100/max);
4768 if (gshutdown) { 4773 if (gshutdown) {
4769 GSM_Terminate(); 4774 GSM_Terminate();
4770 exit(0); 4775 exit(0);
4771 } 4776 }
4772 } 4777 }
4773 printmsgerr("\n"); 4778 printmsgerr("\n");
4774 } 4779 }
4775 if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) { 4780 if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) {
4776 error=Phone->SetBitmap(&s,Backup.StartupLogo); 4781 error=Phone->SetBitmap(&s,Backup.StartupLogo);
4777 Print_Error(error); 4782 Print_Error(error);
4778 } 4783 }
4779 if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) { 4784 if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) {
4780 error=Phone->SetBitmap(&s,Backup.OperatorLogo); 4785 error=Phone->SetBitmap(&s,Backup.OperatorLogo);
4781 Print_Error(error); 4786 Print_Error(error);
4782 } 4787 }
4783 DoRestore = false; 4788 DoRestore = false;
4784 if (Backup.WAPBookmark[0] != NULL) { 4789 if (Backup.WAPBookmark[0] != NULL) {
4785 Bookmark.Location = 1; 4790 Bookmark.Location = 1;
4786 error = Phone->GetWAPBookmark(&s,&Bookmark); 4791 error = Phone->GetWAPBookmark(&s,&Bookmark);
@@ -8281,148 +8286,147 @@ int main(int argc, char *argv[])
8281 cfg->Device = strdup(mDevice.latin1()); 8286 cfg->Device = strdup(mDevice.latin1());
8282 cfg->DefaultDevice = false; 8287 cfg->DefaultDevice = false;
8283 qDebug("Device set %s ", cfg->Device); 8288 qDebug("Device set %s ", cfg->Device);
8284 8289
8285 } 8290 }
8286 if ( ! mModel.isEmpty() ) { 8291 if ( ! mModel.isEmpty() ) {
8287 strcpy(cfg->Model,mModel.latin1() ); 8292 strcpy(cfg->Model,mModel.latin1() );
8288 cfg->DefaultModel = false; 8293 cfg->DefaultModel = false;
8289 qDebug("Model set %s ",cfg->Model ); 8294 qDebug("Model set %s ",cfg->Model );
8290 } 8295 }
8291 8296
8292#endif 8297#endif
8293 8298
8294 8299
8295 cfg=GSM_FindGammuRC(); 8300 cfg=GSM_FindGammuRC();
8296 for (i = 0; i <= MAX_CONFIG_NUM; i++) { 8301 for (i = 0; i <= MAX_CONFIG_NUM; i++) {
8297 if (cfg!=NULL) { 8302 if (cfg!=NULL) {
8298 cp = INI_GetValue(cfg, "gammu", "gammucoding", false); 8303 cp = INI_GetValue(cfg, "gammu", "gammucoding", false);
8299 if (cp) di.coding = cp; 8304 if (cp) di.coding = cp;
8300 8305
8301 s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); 8306 s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false);
8302 if (s.Config[i].Localize) { 8307 if (s.Config[i].Localize) {
8303 s.msg=INI_ReadFile(s.Config[i].Localize, true); 8308 s.msg=INI_ReadFile(s.Config[i].Localize, true);
8304 } else { 8309 } else {
8305#if !defined(WIN32) && defined(LOCALE_PATH) 8310#if !defined(WIN32) && defined(LOCALE_PATH)
8306 locale = setlocale(LC_MESSAGES, NULL); 8311 locale = setlocale(LC_MESSAGES, NULL);
8307 if (locale != NULL) { 8312 if (locale != NULL) {
8308 snprintf(locale_file, 200, "%s/gammu_%c%c.txt", 8313 snprintf(locale_file, 200, "%s/gammu_%c%c.txt",
8309 LOCALE_PATH, 8314 LOCALE_PATH,
8310 tolower(locale[0]), 8315 tolower(locale[0]),
8311 tolower(locale[1])); 8316 tolower(locale[1]));
8312 s.msg = INI_ReadFile(locale_file, true); 8317 s.msg = INI_ReadFile(locale_file, true);
8313 } 8318 }
8314#endif 8319#endif
8315 } 8320 }
8316 } 8321 }
8317 8322
8318 /* Wanted user specific configuration? */ 8323 /* Wanted user specific configuration? */
8319 8324
8320 if (only_config != -1) { 8325 if (only_config != -1) {
8321 /* Here we get only in first for loop */ 8326 /* Here we get only in first for loop */
8322 if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; 8327 if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break;
8323 } else { 8328 } else {
8324 if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; 8329 if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break;
8325 } 8330 }
8326 s.ConfigNum++; 8331 s.ConfigNum++;
8327 8332
8328 /* We want to use only one file descriptor for global and state machine debug output */ 8333 /* We want to use only one file descriptor for global and state machine debug output */
8329 s.Config[i].UseGlobalDebugFile = true; 8334 s.Config[i].UseGlobalDebugFile = true;
8330 8335
8331 /* It makes no sense to open several debug logs... */ 8336 /* It makes no sense to open several debug logs... */
8332 if (i != 0) { 8337 if (i != 0) {
8333 strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel); 8338 strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel);
8334 free(s.Config[i].DebugFile); 8339 free(s.Config[i].DebugFile);
8335 s.Config[i].DebugFile = strdup(s.Config[0].DebugFile); 8340 s.Config[i].DebugFile = strdup(s.Config[0].DebugFile);
8336 } else { 8341 } else {
8337 /* Just for first config */ 8342 /* Just for first config */
8338 /* When user gave debug level on command line */ 8343 /* When user gave debug level on command line */
8339 if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) { 8344 if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) {
8340 /* Debug level from command line will be used with phone too */ 8345 /* Debug level from command line will be used with phone too */
8341 strcpy(s.Config[i].DebugLevel,argv[1 + start]); 8346 strcpy(s.Config[i].DebugLevel,argv[1 + start]);
8342 start++; 8347 start++;
8343 } else { 8348 } else {
8344 /* Try to set debug level from config file */ 8349 /* Try to set debug level from config file */
8345 GSM_SetDebugLevel(s.Config[i].DebugLevel, &di); 8350 GSM_SetDebugLevel(s.Config[i].DebugLevel, &di);
8346 } 8351 }
8347 /* If user gave debug file in gammurc, we will use it */ 8352 /* If user gave debug file in gammurc, we will use it */
8348 error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); 8353 error=GSM_SetDebugFile(s.Config[i].DebugFile, &di);
8349 Print_Error(error); 8354 Print_Error(error);
8350 } 8355 }
8351 8356
8352 /* We wanted to read just user specified configuration. */ 8357 /* We wanted to read just user specified configuration. */
8353 if (only_config != -1) {break;} 8358 if (only_config != -1) {break;}
8354 } 8359 }
8355#if 0 8360#if 0
8356 GSM_Config *con = &s.Config[0]; 8361 GSM_Config *con = &s.Config[0];
8357 8362
8358 char* tempC; 8363 char* tempC;
8359 tempC = argv[argc-1]+2; 8364 tempC = argv[argc-1]+2;
8360 if ( *tempC != 0 ) { 8365 if ( *tempC != 0 ) {
8361 fprintf(stderr,"Using model %s \n",tempC); 8366 fprintf(stderr,"Using model %s \n",tempC);
8362 strcpy(con->Model,tempC ); 8367 strcpy(con->Model,tempC );
8363 } 8368 }
8364 tempC = argv[argc-2]+2; 8369 tempC = argv[argc-2]+2;
8365 if ( *tempC != 0 ) { 8370 if ( *tempC != 0 ) {
8366 fprintf(stderr,"Using device %s \n",tempC); 8371 fprintf(stderr,"Using device %s \n",tempC);
8367 con->Device = strdup(tempC); 8372 con->Device = strdup(tempC);
8368 con->DefaultDevice = false; 8373 con->DefaultDevice = false;
8369 } 8374 }
8370 tempC = argv[argc-3]+2; 8375 tempC = argv[argc-3]+2;
8371 if ( *tempC != 0 ) { 8376 if ( *tempC != 0 ) {
8372 fprintf(stderr,"Using connection %s \n",tempC); 8377 fprintf(stderr,"Using connection %s \n",tempC);
8373 con->Connection = strdup(tempC); 8378 con->Connection = strdup(tempC);
8374 con->DefaultConnection = false; 8379 con->DefaultConnection = false;
8375 } 8380 }
8376#endif 8381#endif
8377 argc = argc-3;
8378 8382
8379 8383
8380 /* Do we have enough parameters? */ 8384 /* Do we have enough parameters? */
8381 if (argc == 1 + start) { 8385 if (argc == 1 + start) {
8382 HelpGeneral(); 8386 HelpGeneral();
8383 printmsg("Too few parameters!\n"); 8387 printmsg("Too few parameters!\n");
8384 exit(-2); 8388 exit(-2);
8385 } 8389 }
8386 8390
8387 /* Check used version vs. compiled */ 8391 /* Check used version vs. compiled */
8388 if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { 8392 if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) {
8389 printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", 8393 printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n",
8390 GetGammuVersion(),VERSION); 8394 GetGammuVersion(),VERSION);
8391 exit(-1); 8395 exit(-1);
8392 } 8396 }
8393 8397
8394 /* Check parameters */ 8398 /* Check parameters */
8395 while (Parameters[z].Function != NULL) { 8399 while (Parameters[z].Function != NULL) {
8396 if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { 8400 if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) {
8397 if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { 8401 if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) {
8398 fprintf(stderr,"Executing \n"); 8402 fprintf(stderr,"Executing \n");
8399 Parameters[z].Function(argc - start, argv + start); 8403 Parameters[z].Function(argc - start, argv + start);
8400 break; 8404 break;
8401 } else { 8405 } else {
8402 count_failed = true; 8406 count_failed = true;
8403 } 8407 }
8404 } 8408 }
8405 z++; 8409 z++;
8406 } 8410 }
8407 8411
8408 /* Tell user when we did nothing */ 8412 /* Tell user when we did nothing */
8409 if (Parameters[z].Function == NULL) { 8413 if (Parameters[z].Function == NULL) {
8410 HelpGeneral(); 8414 HelpGeneral();
8411 if (count_failed) { 8415 if (count_failed) {
8412 printmsg("Bad parameter count!\n"); 8416 printmsg("Bad parameter count!\n");
8413 } else { 8417 } else {
8414 printmsg("Bad option!\n"); 8418 printmsg("Bad option!\n");
8415 } 8419 }
8416 } 8420 }
8417 8421
8418 /* Close debug output if opened */ 8422 /* Close debug output if opened */
8419 if (di.df!=stdout) fclose(di.df); 8423 if (di.df!=stdout) fclose(di.df);
8420 //#endif // 0 8424 //#endif // 0
8421 fprintf(stderr,"kammu: Success. End. \n"); 8425 fprintf(stderr,"kammu: Success. End. \n");
8422 exit(0); 8426 exit(0);
8423} 8427}
8424 8428
8425/* How should editor hadle tabs in this file? Add editor commands here. 8429/* How should editor hadle tabs in this file? Add editor commands here.
8426 * vim: noexpandtab sw=8 ts=8 sts=8: 8430 * vim: noexpandtab sw=8 ts=8 sts=8:
8427 */ 8431 */
8428 8432