Not yet working stack checking (symbol STACKCHECK)
[gnokii.git] / gnokii / gnokii.c
index 82b2b8b..df3ce22 100644 (file)
@@ -97,9 +97,9 @@ char *SynchronizeTime; /* If we set date and time from computer to phone (from .
 #endif /* UCLINUX */
 static char *BinDir;          /* Binaries directory from .gnokiirc file - not used here yet */
 
-#ifdef DEBUG
+#ifndef UCLINUX
 static GSM_SMSMessage SMS[4];
-#endif
+#endif /* UCLINUX */
   
 #ifndef UCLINUX
 
@@ -560,8 +560,6 @@ int GSM_SendMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int
   return 0;
 }
 
-#endif /* UCLINUX */
-
 static int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[],
                                   bool inter, bool unicode, bool profile, bool scale) {
 
@@ -688,8 +686,6 @@ static int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argn
   return 0;
 }
 
-#ifndef UCLINUX
-
 void GSM_PlayRingtoneOnConsole(GSM_Ringtone *ringtone)
 {
   int i;
@@ -737,8 +733,17 @@ static int usage(void)
   ));
 #endif /* UCLINUX */
 
+#ifndef UCLINUX
   fprintf(stdout, _(
 "          gnokii --getmemory memory_type [start [end]] [-short|-v30|-v21|-v]\n"
+  ));
+#else /* UCLINUX */
+  fprintf(stdout, _(
+"          gnokii --getmemory memory_type [start [end]] [-short]\n"
+  ));
+#endif /* UCLINUX */
+
+  fprintf(stdout, _(
 "          gnokii --writephonebook [-i]\n"
   ));
 
@@ -747,17 +752,9 @@ static int usage(void)
 "          gnokii --sendphonebookentry destination memory_type location\n"
 "                 [--smsc message_center_number] [--smscno message_center_index]\n"
 "                 [-s] [-v n] [-d]\n"
-  ));
-#endif /* UCLINUX */
-
-  fprintf(stdout, _(
 "          gnokii --savephonebookentry memory_type location\n"
 "                 [--smsc message_center_number] [--smscno message_center_index]\n"
 "                 [-r] [-i] [-s] [-a] [--name name]\n"
-  ));
-
-#ifndef UCLINUX
-  fprintf(stdout, _(
 "          gnokii --getvoicemailbox\n"
   ));
 #endif /* UCLINUX */
@@ -1085,9 +1082,7 @@ int main(int argc, char *argv[])
     { "sendcalendarnote",   required_argument, NULL, OPT_SENDCALENDARNOTE },
     { "savecalendarnote",   required_argument, NULL, OPT_SAVECALENDARNOTE },
     { "sendphonebookentry", required_argument, NULL, OPT_SENDPHONEBOOKENTRY},
-#endif /* UCLINUX */
     { "savephonebookentry", required_argument, NULL, OPT_SAVEPHONEBOOKENTRY},
-#ifndef UCLINUX
     { "deletecalendarnote", required_argument, NULL, OPT_DELCALENDARNOTE  },// Delete calendar note mode    
 #endif /* UCLINUX */
     { "getmemory",          required_argument, NULL, OPT_GETMEMORY        },// Get memory mode
@@ -1243,6 +1238,8 @@ int main(int argc, char *argv[])
     { 0, 0, 0, 0 },
   };
 
+  LIVE;
+
   opterr = 0;
 
   /* For GNU gettext */
@@ -1346,9 +1343,7 @@ int main(int argc, char *argv[])
     case OPT_DELCALENDARNOTE:       rc = deletecalendarnote(optarg);break;
     case OPT_SAVECALENDARNOTE:      rc = savecalendarnote(nargc, nargv);break;
     case OPT_SENDCALENDARNOTE:      rc = sendcalendarnote(nargc, nargv);break;
-#endif /* UCLINUX */
     case OPT_SAVEPHONEBOOKENTRY:    rc = savephonebookentry(nargc, nargv);break;
-#ifndef UCLINUX
     case OPT_SENDPHONEBOOKENTRY:    rc = sendphonebookentry(nargc, nargv);break;
     case OPT_WRITECALENDARNOTE:     rc = writecalendarnote(nargv);  break;
 #endif /* UCLINUX */
@@ -4679,6 +4674,7 @@ static int getmemory(int argc, char *argv[])
     fprintf(stderr, _("Unknown memory type %s!\n"), argv[0]);
     return (-1);
   }
+
   GetMemoryTypeString(memory_type_string, &entry.MemoryType);
 
   if (argv[argc-1][0] == '-')
@@ -4726,6 +4722,7 @@ static int getmemory(int argc, char *argv[])
        i_used++;
       else if (do_all)
        break;
+#ifndef UCLINUX
       if (output_opt && !strcmp( output_opt,"-v30")) {
        semicolon_pipe_substitution( &entry, 0 );
         fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,30));
@@ -4741,6 +4738,7 @@ static int getmemory(int argc, char *argv[])
         fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,10));
        formatdone=true;
       } 
+#endif /* UCLINUX */
       if (output_opt && !strcmp(output_opt,"-short")) {
         semicolon_pipe_substitution( &entry, 0 );
         fprintf(stdout, "%s;%s;%s;%d;%d;", entry.Name, entry.Number, memory_type_string, entry.Location, entry.Group);
@@ -5236,20 +5234,29 @@ static int identify( void )
   /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */
   char imei[64], model[64], rev[64], manufacturer[64];
 
+  LIVE;
   fbusinit(NULL);
 
+  LIVE;
   while (GSM->GetIMEI(imei)    != GE_NONE) sleep(1);
+  LIVE;
   while (GSM->GetRevision(rev) != GE_NONE) sleep(1);
+  LIVE;
   while (GSM->GetModel(model)  != GE_NONE) sleep(1);
+  LIVE;
 
   strcpy(manufacturer, "(unknown)");
+  LIVE;
   GSM->GetManufacturer(manufacturer);
+  LIVE;
 
   fprintf(stdout, _("IMEI:     %s\n"), imei);
   fprintf(stdout, _("Model:    %s %s (%s)\n"), manufacturer, GetModelName (model), model);
   fprintf(stdout, _("Revision: %s\n"), rev);
 
+  LIVE;
   GSM->Terminate();
+  LIVE;
 
   return 0;
 }
@@ -8859,9 +8866,7 @@ int divert(int argc, char *argv[])
        return 0;
 }
 
-#endif /* UCLINUX */
-
-static int savephonebookentry(int argc, char *argv[])
+int savephonebookentry(int argc, char *argv[])
 {
   GSM_MultiSMSMessage MultiSMS;
   GSM_PhonebookEntry entry;
@@ -8909,8 +8914,6 @@ static int savephonebookentry(int argc, char *argv[])
   return 0;
 }
 
-#ifndef UCLINUX
-
 int sendphonebookentry(int argc, char *argv[])
 {
   GSM_MultiSMSMessage MultiSMS;