rem: static unsigned long added=0;
context: void addMessage(const char *string,int code){static FILE *f=NULL;static int status=-1;static float perc=0.0;static unsigned long added=0;  switch(code) {    case 1: // begin new message    {      if (status!=0 && status!=-1) { addMessage("",0); }      status=1;      {char s[1024];        sprintf(s,"/tmp/oe5_2mbox.%d",getpid());        f=fopen(s,"wb");        if (f==NULL) {QString msg;          msg.sprintf(" '%s'",s);          msg=i18n("FATAL: Cannot open TEMP file")+msg;          INFO->alert(CAP,msg);          status=-1;        }      }      if (status!=-1) {        fprintf(f,"%s",string);      }    }    break;    case 2: // continue message    {      if (status!=1 && status!=2 && status!=-1) {QString msg;        msg=i18n("FATAL: Cannot add to ended message,\n"                 "skipping until message start");        INFO->alert(CAP,msg);        status=-1;      }      else if (status!=-1) {        status=2;        fprintf(f,"%s",string);      }    }    break;    case 0: //end of message    {      if (status!=1 && status!=2 && status!=-1) {QString msg;        msg=i18n("FATAL: Cannot end an ended message,\n"                 "skipping until message start");        INFO->alert(CAP,msg);        status=-1;      }      else if (status!=-1) {        status=0;        perc+=2.0;        if (perc>100.0) {          perc=0.0;          INFO->current();        }        INFO->current(perc);        fprintf(f,"%s",string);        fclose(f);        {char s[1024];          sprintf(s,"/tmp/oe5_2mbox.%d",getpid());          f=fopen(s,"rb");          if (f==NULL) {QString msg;            msg.sprintf(" ('%s')",s);            msg=i18n("FATAL: Cannot open just made TEMP file for reading")+msg;            INFO->alert(CAP,msg);            status=-1;          }          else {            fclose(f);            F->kmailMessage(INFO,(char *) FOLDER,s,added);            unlink(s);            status=-1; // skip to next message.          }        }      }    }    break;  }}