add: app=0; { int pId;  char lf[80]; sprintf (lf, "/tmp/.kmail%d.lck", getuid()); if (access (lf, F_OK) != 0) writePid(true); else { FILE *lock, *msg; lock = fopen (lf, "r"); fscanf (lock, "%d", &pId); fclose (lock); sprintf (lf, "/tmp/.kmail%d.msg", getuid()); msg = fopen (lf, "w"); int i; app = new KApplication(argc, argv, "kmail"); argc--; argv++;   QString to, cc, bcc, subj;  for (i=0; i<argc; i++) { if (strcmp(argv[i],"-s")==0) { if (i<argc-1) subj = argv[++i]; mailto = TRUE; } else if (strcmp(argv[i],"-c")==0) { if (i<argc-1) cc = argv[++i]; mailto = TRUE; } else if (strcmp(argv[i],"-b")==0) { if (i<argc-1) bcc = argv[++i]; mailto = TRUE; } else if (strcmp(argv[i],"-check")==0) checkNewMail = TRUE; else if (argv[i][0]=='-') { warning(i18n("Unknown command line option: %s"), argv[i]);  } else { if (!to.isEmpty()) to += ", "; if (strncasecmp(argv[i],"mailto:",7)==0) to += argv[i]+7; else to += argv[i]; mailto = TRUE; } }  if (checkNewMail) fprintf (msg, "check"); else if (mailto) { if (!to.isEmpty()) fprintf (msg, "To: %s\n", to.data()); if (!cc.isEmpty()) fprintf (msg, "Cc: %s\n", cc.data()); if (!bcc.isEmpty()) fprintf (msg, "Bcc: %s\n", bcc.data()); if (!subj.isEmpty()) fprintf (msg, "Subject: %s\n",subj.data()); } else fprintf (msg, "show"); fclose (msg);   if (pId < 0) { if (kill(0-pId, 0) != 0) { printf ("Server died whyle busy\n"); writePid(true); } else { printf ("Server is busy - message pending\n"); exit (0); } } else { if (kill (pId, SIGUSR1) != 0) { printf ("Server died whyle ready\n"); writePid(true); } else { printf ("Server is ready - message sent\n"); exit (0); } } } printf ("We are starting normaly\n"); sprintf(lf, "rm -rf /tmp/.kmail%d.msg", getuid()); system (lf); }
context: main(int argc, char *argv[]){  KMMainWin* mainWin;  init(argc, argv);  // filterMgr->dump();  if (argc > 1)    processArgs(argc-1, argv+1);  if (!mailto)  {      if (kapp->isRestored()){	  int n = 1;	  while (KTMainWindow::canBeRestored(n)){	      //only restore main windows! (Matthias);	      if (KTMainWindow::classNameOfToplevel(n) == "KMMainWin")		  (new KMMainWin)->restore(n);	      n++;	  }      } else { 	  mainWin = new KMMainWin; 	  assert( mainWin != NULL); 	  mainWin->show();      }  }//   if(kapp->isRestored())//       RESTORE(KMMainWin)// 	else// 	  {// 	  mainWin = new KMMainWin;// 	  assert( mainWin != NULL);// 	  mainWin->show();// 	  }//   }  if (checkNewMail) acctMgr->checkMail();  recoverDeadLetters();  if (firstStart)  {    KMSettings* dlg = new KMSettings;    assert(dlg != NULL);    dlg->show();  }  app->exec();  cleanup();}