#include #include #include #include #include static const char K_MESSAGES[]="messages"; static void map_addmsg (const char *file, const char *msg) { glocal const char *msg = msg; (file,true); int ret = -1; struct timeval tv; if (gettimeofday(&tv,NULL)!=-1){ fprintf (fout,"%08lx.%08lx msg %s\n",tv.tv_sec,tv.tv_usec ,glocal.msg); ret = 0; } return ret; } static void map_addmsg (const char *file, const SSTRING &msg) { map_addmsg (file,msg.get()); } int main (int argc, char *argv[]) { int ret = -1; glocal const char *file = "mapmsg.log"; ret = (argc,argv); setproginfo ("mapmsg",PACKAGE_REV ,"Record message with time-stamp into a file\n"); setarg ('f',"file","Record the message in this file",glocal.file,false); DIALOG dia; SSTRING line; PRIVATE_MESSAGE msg; dia.newf_str ("Auto erased message",line); dia.set_helpdia (msg); const int NBRECMSG=10; SSTRING lines[NBRECMSG]; PRIVATE_MESSAGE msgs[NBRECMSG]; for (int i=0; i(glocal.file,false); return 0; }else if (code == MENU_MESSAGE){ dia.save(); if (dialog_testmessage(msg)){ map_addmsg (glocal.file,line); line.setempty(); dia.reload(); }else{ for (int i=0; i return ret; }