home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / RDQWKSRC.ZIP / READ.C < prev    next >
C/C++ Source or Header  |  1991-01-15  |  33KB  |  1,455 lines

  1.  
  2. /*
  3. ╔══════════════════════════════════════════════════════════════════════════╗
  4. ║                                                                          ║
  5. ║         Test routines to read, in Qmail Format - R.Cougnenc 90 -         ║
  6. ║                                                                          ║
  7. ║                            Public Domain                                 ║
  8. ║                                                                          ║
  9. ╟──────────────────────────────────────────────────────────────────────────╢
  10. ║                                                                          ║
  11. ║       These modules correspond to different tests at reading in          ║
  12. ║       Qmail Format. They were never planned to be released as a          ║
  13. ║       package.                                                           ║
  14. ║                                                                          ║
  15. ║       Source code is not beautified or optimised as they are work        ║
  16. ║       files and are distributed as is.                                   ║
  17. ║                                                                          ║
  18. ║       The program, even at it's rustic stage is fully fonctional,        ║
  19. ║       as I use it regularly...                                           ║
  20. ║                                                                          ║
  21. ║       Feel free to use any or all of these modules, if you can sort      ║
  22. ║       it out! :-)                                                        ║
  23. ║                                                                          ║
  24. ╚══════════════════════════════════════════════════════════════════════════╝
  25. */
  26. /*
  27.                       Small Reader for Qmail format.
  28.  
  29.          Using only tty mode and printf, this program should be compiled
  30.          on many systems with minor modifications.
  31.  
  32.                           Rene Cougnenc  1990
  33. */
  34.  
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include <string.h>
  38. #include <time.h>
  39. #include <sys/types.h>
  40. #include <sys/stat.h>
  41. #ifdef __TURBOC__
  42. #include <alloc.h>
  43. #else
  44. #include <malloc.h>
  45. #endif
  46. #include "reader.h"
  47. #include "qmail.h"
  48. #include "ansi.h"
  49.  
  50. #include "read.h"
  51. #include "readlib.h"
  52. #include "makemail.h"
  53.  
  54. #define NEXT 1
  55. #define AGAIN 0
  56. #define PREVIOUS 2
  57.  
  58. char *TagLine = "\n---\n ■ AzerTyuioP 0.2 ■\n\n";  /* Reader Signature */
  59. char CurTag[256]; /* Tag line chosen... */
  60.  
  61. char HomePath  [MAXPATHS];  /* Home directory for exe file & root of msg dirs*/
  62. char MailPath  [MAXPATHS];  /* Where to look for new mail                    */
  63. char ReplyPath [MAXPATHS];  /* Where to put replies                          */
  64. char WorkPath  [MAXPATHS];  /* Where to archive/unarchive mail .             */
  65.  
  66. char CurBoard  [50 ];     /* Name of the current board...                  */
  67. int  CurConf ;            /* Name of the current Conference...             */
  68. int  TotMsg  ;            /* Number of messages in conf                    */
  69.  
  70. int ReplyExist = 0 ;      /* Flag 1 if there are replies to pack           */
  71. int ansi       = 0 ;      /* Flag 1 if ansi output is on                   */
  72. int IsEmpty    = 1 ;      /* Flag 0 if a BBS is loaded                     */
  73. int HeadLetter = 1 ;      /* Flag 1 if automatic header is active          */
  74.  
  75. char Editor    [50 ];      /* Name of the standard text editor            */
  76. char Archiver  [50 ];
  77. char UnArchiver[50] ;
  78.  
  79. struct MyIndex Index ;
  80.  
  81. FILE *fidx,*fmsg ;       /* Index File and msg file, globals */
  82. int  FilesOpen = 0 ;     /* Flag if these files are open     */
  83. byte *rbuf ;
  84.  
  85.  
  86. /* DOS internal commands. Will be called by system directly from shell. */
  87. #define MAXCMDS  14
  88. static char *cmds[MAXCMDS] = {"cd","chdir","copy","dir","del","era","md",
  89.                               "mkdir","more","print","rd","rmdir","set",
  90.                               "type"};
  91.  
  92. /*----------------------------------------------------------------------*/
  93.  
  94.  
  95. main(argc,argv)
  96. int argc;
  97. char *argv[];
  98. {
  99.     MakeHomePath(argv[0]);
  100.     if( ReadConfig() )
  101.         return (0xFF) ;
  102.  
  103.     Clean();
  104.  
  105.     clear(); 
  106.     bblack() ;
  107.     Title();
  108.  
  109. #if !__DISTRIB__
  110.     red();
  111.     printf("Perso !  Ne pas distribuer !\n\n");
  112.     /*      ^^^^^^ = ? ^^^^^^^^^^^^^^^ = Do not distribute */
  113. #endif
  114.     cyan();
  115.  
  116.     strcpy(CurBoard,txt [ 10 ]);       /* First default prompt.... */
  117.     strcpy(ConfName[0],txt[ 9 ]);      /* "empty" */
  118.     strcpy(CurTag, TagLine ) ;         /* default TagLine */
  119.  
  120.     if( ( rbuf = (char *) malloc( MYBUF )) == NULL )
  121.     {
  122.         printf("%s\n",txt[ 1 ]);  /* Not enough memory */
  123.         return (0xFF);
  124.     }
  125.  
  126.     if( argc == 2 )
  127.         GetBbs( argv[1] );
  128.  
  129.     ReadShell();
  130.     free( rbuf );
  131.     return( 0 );
  132. }
  133.  
  134.  
  135.  
  136. /*
  137.                                  Main Shell
  138. */
  139.  
  140. void ReadShell()
  141. {
  142.   char tmp[256];
  143.   char *ptr;
  144.   int i;
  145.  
  146.  
  147.  
  148. loop :
  149.  
  150.   while( 1 )
  151.   {
  152.     if( ansi)
  153.        printf("%c[1;32m",27);
  154.     printf("%s [ %s ] > ",CurBoard,ConfName[CurConf]);
  155.     if( ansi)
  156.        printf("%c[0m",27);
  157.     gets(tmp);
  158.  
  159.     for( i = 0 ; i < MAXCMDS; i++)  /* Internal shell commands */
  160.     {
  161.       if( ! strnicmp(tmp,cmds[i],strlen(cmds[i] )  ) )
  162.       {
  163.          system( &tmp[0] );
  164.          goto loop ;
  165.       }
  166.     }
  167.  
  168.     if( Numeric( tmp ) )               GoToNum( tmp );
  169.     else
  170.     if( ! strnicmp (tmp,"aide",4) )    help();
  171.     else
  172.     if( ! strnicmp (tmp,"cls",3) )    cls();
  173.     else
  174.     if( ! strnicmp (tmp,"clean",5) )   Purge();
  175.     else
  176.     if( ! strnicmp (tmp,"conf",4) )    ListConf();
  177.     else
  178.     if( ! strnicmp (tmp,"date",4) )    Date();
  179.     else
  180.     if( ! strnicmp (tmp,"help",4) )    help();
  181.     else
  182.     if( ! strnicmp (tmp,"head",4) )
  183.     {
  184. #if __DISTRIB__
  185.         magenta(); high();
  186.         printf("%s",txt[ 95 ] );  /* "Unauthorized command" */
  187. #else
  188.         blue(); high();
  189.         HeadLetter = HeadLetter ?  0 : 1 ;
  190.         printf("%s ",txt[101] );                         /* "Automatic H." */
  191.         printf("%s\n", HeadLetter ? txt[85] : txt[86] ); /* "on" / "off"   */
  192. #endif
  193.     }
  194.     else
  195.     if( ! strnicmp (tmp,"news",4) )
  196.     {
  197.         if( ansi )
  198.         {
  199.             sprintf(tmp,"%s%s/%s",HomePath,CurBoard,NEWSG);
  200.             if(! access(tmp,0 ) )
  201.             {
  202.                 sprintf(tmp,"%s%s",HomePath,CurBoard);
  203.                 view(tmp,NEWSG);
  204.                 continue ;
  205.             }
  206.         }
  207.         sprintf(tmp,"%s%s",HomePath,CurBoard);
  208.         view(tmp,NEWS);
  209.     }
  210.     else
  211.     if( ! strnicmp (tmp,"time",4) )    Date();
  212.     else
  213.     if( ! strnicmp (tmp,"welcome",4) )    Welcome();
  214.     else
  215.     if( ! strnicmp (tmp,"file",4) )
  216.       {
  217.          if( IsEmpty )
  218.          {
  219.             EmptyMsg();
  220.             continue ;
  221.          }
  222.          sprintf(tmp,"%s%s",HomePath,CurBoard);
  223.                  view(tmp,NEWFILES);
  224.       }
  225.     else
  226.     if( ! strnicmp (tmp,"load",4) )    load(tmp);  /* Load new mail      */
  227.     else
  228.     if( ! strnicmp (tmp,"merde",5) )    merde();   /* Load new mail      */
  229.     else
  230.     if( ! strnicmp (tmp,"read",4) )    Read(tmp);  /* read existing mail */
  231.     else
  232.     if( ! strnicmp (tmp,"tag",3) )     Tag(tmp);  /* read existing mail */
  233.     else
  234.  
  235.     switch( (int) tmp[0] )
  236.     {
  237.       case '?' :
  238.            help();
  239.       break;
  240.  
  241.       case '!' :
  242.            if( tmp[1] )
  243.            {
  244.               system(&tmp[1]);
  245.            }
  246.            else
  247.            {
  248.              ptr = getenv("COMSPEC");
  249.              system(ptr);
  250.            }
  251.       break;
  252.  
  253.       case 'a' :
  254.       case 'A' :
  255.          Display();
  256.       break;
  257.  
  258.       case 'e' :
  259.       case 'E' :
  260.        reply(ENTER);
  261.       break;
  262.  
  263.       case 'j' :
  264.       case 'J' :
  265.         chconf(tmp);
  266.       break ;
  267.  
  268.       case 'm' :
  269.       case 'M' :
  270.        ansi = ansi ?  0 : 1;
  271.        yellow(); high();
  272.        printf("%s %s .\n",txt[84], ansi ? txt[85] : txt[86]);
  273.        /* Mode ansi on / off */
  274.       break ;
  275.  
  276.       case 'q' :
  277.       case 'Q' :
  278.       case 'g' :
  279.       case 'G' :
  280.       UpdateConf(); /* Save current conf pointer */
  281.         if( ReplyExist)
  282.         {
  283.            red(); high();
  284.            printf("%s\n%s %s.\n",txt[2],txt[3],CurBoard); /* Warning, you have  */
  285.            printf("%s",txt[4]);                           /* Replies,pack them ?*/
  286.            if( YesNo(YES))
  287.            PackReply();
  288.         }
  289.         clear();
  290.         return ;
  291.  
  292.       case 'n' :
  293.       case 'N' :
  294.        AutoJoin();
  295.       break;
  296.  
  297.       case 'r' :
  298.       case 'R' :
  299.        reply(REPLY);
  300.       break;
  301.  
  302.       case 's' :
  303.       case 'S' :
  304.        SaveMsg(tmp);
  305.       break;
  306.  
  307.       case '+' :
  308.       case  0  :
  309.            ReadNext( NEXT );
  310.       break ;
  311.  
  312.       case '-' :
  313.            ReadNext( PREVIOUS );
  314.       break ;
  315.     }
  316.   }
  317. }
  318.  
  319.  
  320.  
  321.  
  322. void load(name)
  323. char *name ;
  324. {
  325.     char BoardName[50];
  326.     char tmp2   [MAXPATHS];
  327.     char tmp    [MAXPATHS];
  328.     char OldDat [MAXPATHS];
  329.     char NewDat [MAXPATHS];
  330.     struct stat Oldst;
  331.     struct stat Newst;
  332.  
  333.  
  334.     if( ReplyExist)
  335.     {
  336.         red(); 
  337.         high();
  338.         printf("%s\n%s %s.\n",txt[2],txt[3],CurBoard); /* Warning, you have  */
  339.         printf("%s",txt[4]);                           /* Replies,pack them ?*/
  340.         if( YesNo(YES))
  341.             PackReply();
  342.     }
  343.  
  344.     BoardName[0] =  0;
  345.     sscanf(name,"%s %s",tmp,BoardName);
  346.     if( ! BoardName[0] )
  347.     {
  348.         red();
  349.         printf("%s  %s\n",txt[ 87 ], txt [ 88 ]); /* "usage" " load.." */
  350.         return;
  351.     }
  352.  
  353.     printf("%s %s\n",txt[5],BoardName);
  354.  
  355.     sprintf(tmp,"%s%s.qwk",MailPath,BoardName);
  356.     if( access(tmp,0 ) )
  357.     {
  358.         red();
  359.         printf ("%s : %s\n",txt[ 6 ],tmp);  /* No mail found        */
  360.         printf ("%s\n",txt[7]);             /* Try the read command */
  361.         return ;
  362.     }
  363.  
  364.     Clean(); /* Don't forget to clean work directory ! */
  365.     sprintf(tmp2,"%s %s  %s %s %s %s? %s?  %s ",
  366.             UnArchiver,tmp,CNTRL_FILE,MSG_FILE,NEWFILES,NEWS,WELCOME,WorkPath);
  367.     yellow(); 
  368.     high();
  369.     printf("%s\n",txt[8]);   /* " Extracting Messages..." */
  370.     green();
  371.     system(tmp2);
  372.     yellow();
  373.  
  374.     sprintf(tmp2,"%s%s",HomePath,BoardName);   /* Access to a board subdir */
  375.     if( access(tmp2,0) )
  376.         mkdir(tmp2);
  377.  
  378.     sprintf(OldDat,"%s%s/%s",HomePath,BoardName,CNTRL_FILE);
  379.     sprintf(NewDat,"%s/%s",  WorkPath,CNTRL_FILE);
  380.     if(stat( OldDat,&Oldst) != -1 )    /* If exists an old control.dat */
  381.     {
  382.         stat( NewDat,&Newst );
  383.         if( Newst.st_mtime <= Oldst.st_mtime )
  384.         {
  385.             red();
  386.             high();
  387.             printf("%s\n%s.\n",txt[ 2 ], txt[ 11 ] ); /*"New packet older..."*/
  388.             printf("%s...",txt[ 12 ]);                /*" Do you  want to.." */
  389.             if( ! YesNo( NO ) )
  390.                 return ;
  391.         }
  392.     }
  393.     strcpy(CurBoard,BoardName);
  394.     MkIndex(WorkPath,tmp2 );                /* Create Index Files */
  395.     IsEmpty = 0 ;
  396.     GetConf(0);                             /* load  main board.  */
  397. }
  398.  
  399.  
  400.  
  401. /*
  402.              Join a BBS without extracting new mail.
  403. */
  404. void Read(name)
  405. char *name ;
  406. {
  407.     char BoardName[50];
  408.     char tmp    [MAXPATHS];
  409.  
  410.     if( ReplyExist)
  411.     {
  412.         red();
  413.         printf("%s\n%s %s.\n",txt[2],txt[3],CurBoard); /* Warning, you have  */
  414.         printf("%s",txt[4]);                           /* Replies,pack them ?*/
  415.         if( YesNo(YES))
  416.             PackReply();
  417.     }
  418.  
  419.     BoardName[0] =  0;
  420.     sscanf(name,"%s %s",tmp,BoardName);
  421.     if( ! BoardName[0] )
  422.     {
  423.         red();
  424.         printf("%s %s\n",txt[ 87 ], txt [ 89 ]); /* "usage " "read..." */
  425.         return;
  426.     }
  427.  
  428.     printf("%s %s\n",txt[ 5 ], BoardName);  /* "Loading" */
  429.  
  430.     sprintf(tmp,"%s%s",HomePath,BoardName);
  431.     if( access(tmp,0 ) )
  432.     {
  433.         printf ("%s : %s\n",txt[ 13 ] ,tmp); /* "No bbs found " */
  434.         return ;
  435.     }
  436.  
  437.     if( ReadControl(tmp) )
  438.     {
  439.         printf("%s\n",txt[ 14 ] );     /* "Error in CONTROL.DAT." */
  440.         return ;
  441.     }
  442.  
  443.     strcpy(CurBoard,BoardName);
  444.     IsEmpty = 0;
  445.     GetConf(0);
  446. }
  447.  
  448.  
  449.  
  450.  
  451. /*
  452.         CHCONF : Change active conference.
  453. */
  454. void chconf(buf)
  455. char *buf;
  456. {
  457.     char Name[50];
  458.     char tmp [MAXPATHS];
  459.     int i ;
  460.  
  461.     if( IsEmpty )
  462.     {
  463.         EmptyMsg();
  464.         return ;
  465.     }
  466.  
  467.     Name[0] =  0;
  468.     sscanf(buf,"%s %s",tmp,Name);
  469.     if( ! Name[0] )
  470.     {
  471.         red();
  472.         printf("%s\n",txt[ 87]);  /* "Usage" */
  473.         printf("\tj %s\n\t\t%s\n",txt[90],txt[91]); /*"Conf #" "or" */
  474.         printf("\tj %s\n",txt[92]);                 /*"conf name" */
  475.         printf("%s\n",txt[93]);                     /*"type conf to list..."*/
  476.         return;
  477.     }
  478.  
  479.  
  480.     if( Numeric( Name ) )                /* a number is given */
  481.     {
  482.         i = atoi(Name) ;
  483.         strcpy( Name,ConfName[i] );
  484.     }
  485.     else                                 /* a name is given   */
  486.     {
  487.         for( i = 0 ; i < MAXCONF ; i++ )
  488.             if( !stricmp(Name,ConfName[i] ))
  489.                 break;
  490.     }
  491.  
  492.     if( ! strnicmp(Name,"MAIN",4)) i = 0 ; /* Special case for "main board" */
  493.  
  494.     if( i == MAXCONF )
  495.     {
  496.         red();
  497.         printf("%s\n",txt[ 28 ]);    /* "Unknown conference" */
  498.         return ;
  499.     }
  500.  
  501.     sprintf(tmp,"%s%s/%d.cnf",HomePath,CurBoard,i);
  502.     if( access(tmp,0 ) )
  503.     {
  504.         red();
  505.         printf ("%s : %s\n",txt[ 6 ],tmp);  /* "No mail found" */
  506.         return ;
  507.     }
  508.  
  509.     UpdateConf(); /* Save current conf pointer */
  510.     GetConf(i);
  511.     blue(); 
  512.     high();
  513.     printf("\n *  %s %s %s. *\n\n",txt[29], ConfName[CurConf],txt[ 30 ]);
  514.     /* "Conference " "joined" */
  515. }
  516.  
  517.  
  518.  
  519.  
  520. /*
  521.                        Loads next valid conferences.
  522. */
  523. void AutoJoin()
  524. {
  525.     static char *Default = "j 0\n";
  526.     char tmp[MAXPATHS];
  527.     int i;
  528.  
  529.     if( IsEmpty )
  530.     {
  531.         EmptyMsg();
  532.         return ;
  533.     }
  534.  
  535.     i = CurConf ;
  536.     while( i < MAXCONF )
  537.     {
  538.         i++ ;
  539.         sprintf(tmp,"%s%s/%d.cnf",HomePath,CurBoard,i);
  540.         if(! access (tmp,0 ) )
  541.         {
  542.             sprintf(tmp,"j %d\n",i );
  543.             chconf(tmp);
  544.             if( Index.LastRead == (TotMsg - 1)  )
  545.             {
  546.                 printf("\t%s.\n",txt[ 31 ]);    /* "No new mail" */
  547.                 continue;
  548.             }
  549.             return ;
  550.         }
  551.     }
  552.     chconf(Default); /* Default to Main Board. */
  553. }
  554.  
  555.  
  556. /*
  557.          Save current message in text file ( append mode ).
  558. */
  559.  
  560. void SaveMsg(str)
  561. char *str;
  562. {
  563.     char dummy [50];
  564.     char fname [MAXPATHS];
  565.     char *ptr ;
  566.     FILE *fp ;
  567.     int i,apflag ;
  568.  
  569.     if( IsEmpty )
  570.     {
  571.         EmptyMsg();
  572.         return ;
  573.     }
  574.  
  575.     fname[0] =  0 ;
  576.     sscanf(str,"%s %s",dummy,fname );
  577.     if( ! fname[0] )
  578.     {
  579.         high(); 
  580.         yellow();
  581.         printf("%s : ",txt[ 39 ]);  /* "save message in file" */
  582.         clear();
  583.         fget(fname,12,stdin);
  584.         if( ! fname[0] )
  585.         {
  586.             printf("%s.\n",txt[ 40 ] ); /* "Aborted" */
  587.             return ;
  588.         }
  589.     }
  590.  
  591.     apflag = access(fname,0) ? 1 : 0 ;
  592.  
  593.     if( ( fp = fopen(fname,"a")) == NULL )
  594.     {
  595.         red();
  596.         high();
  597.         printf("%s %s\n",txt[ 51 ],fname );  /* "unable to open file" */
  598.         return ;
  599.     }
  600.     if( setvbuf(fp,NULL,_IOFBF,VBUF) )
  601.         printf("%sSavemsg()\n",txt[ 94 ]);  /* "Setvbuf failed..." */
  602.  
  603.     PrintHeader(fp);
  604.  
  605.     ptr = (char *) (rbuf + sizeof(struct MsgHeaderType ) );
  606.     i = 0 ;
  607.     while (i < Index.Size)
  608.     {
  609.         if( *ptr != 0)
  610.             fputc( *ptr , fp ) ;
  611.         i++;
  612.         ptr++ ;
  613.     }
  614.  
  615.     fprintf(fp,"\n");
  616.  
  617.     blue(); 
  618.     high();
  619.     /*printf("Message %s",apflag ? "Saved in" : "Appended to");*/
  620.     printf("%s %s",txt[ 41], apflag ? txt[ 42 ] : txt[ 43 ]);
  621.     clear(); 
  622.     cyan();
  623.     printf(" %s\n",fname  );
  624.     fclose(fp);
  625. }
  626.  
  627.  
  628.  
  629.  
  630. /*
  631.                                 Help message.
  632. */
  633.  
  634. void help()
  635. {
  636.     int i;
  637.  
  638.     white(); 
  639.     high();
  640.     printf("\n%s",   hlp[1] );
  641.     clear();
  642.     printf("\n");
  643.     for( i = 0 ; i < strlen(hlp[1]) ; i++ )
  644.         putchar('-');
  645.     printf("\n");
  646.     high();
  647.     printf("\r\t q,g\t%s\n", hlp[  2 ]);
  648.     printf("\t ?\t%s\n"    , hlp[  3 ]);
  649.     printf("\t !\t%s\n"    , hlp[  4 ]);
  650.     printf("\t +\t%s\n"    , hlp[  5 ]);
  651.     printf("\t -\t%s\n"    , hlp[  6 ]);
  652.     printf("\t a\t%s\n"    , hlp[  7 ]);
  653.     printf("\t e\t%s\n"    , hlp[  8 ]);
  654.     printf("\t j\t%s\n"    , hlp[  9 ]);
  655.     printf("\t m\t%s\n"    , hlp[ 10 ]);
  656.     printf("\t n\t%s\n"    , hlp[ 11 ]);
  657.     printf("\t r\t%s\n"    , hlp[ 12 ]);
  658.     printf("\t s\t%s\n"    , hlp[ 13 ]);
  659.     printf("\t conf\t%s\n" , hlp[ 14 ]);
  660.     printf("\t clean\t%s\n", hlp[ 15 ]);
  661.     printf("\t load\t%s\n" , hlp[ 16 ]);
  662.     printf("\t read\t%s\n" , hlp[ 17 ]);
  663.     printf("\t files\t%s\n", hlp[ 18 ]);
  664.     printf("\t tag\t%s\n"  , hlp[ 19 ]);
  665.     printf("\t head\t%s\n" , hlp[ 22 ]);
  666.     printf("\t news\t%s\n" , hlp[ 20 ]);
  667.     printf("\t welcome\t%s\n" , hlp[ 21 ]);
  668.     printf("\n");
  669. }
  670.  
  671.  
  672.  
  673. /*
  674.                      Change Reader Signature :-)
  675. */
  676. void Tag(line)
  677. char *line ;
  678. {
  679.   byte dummy[50];
  680.   byte tmp    [256];
  681.   byte *ptr;
  682.  
  683. #if __DISTRIB__
  684.  
  685.     magenta(); high();
  686.     printf("%s",txt[ 95 ] );  /* "Unauthorized command" */
  687.     return ;
  688.  
  689. #else
  690.  
  691.   tmp[0] = 0 ;
  692.   sscanf(line,"%s %s",dummy,tmp);
  693.   if( ! tmp[0] )         /* restore standard tag */
  694.   {
  695.     clear();red();
  696.     strcpy(CurTag,TagLine);
  697.     printf("%s\n",txt[ 87 ]);  /* "usage:" */
  698.     printf("\tTag < New Tag Line >.\n");
  699.     green();
  700.     printf("\r\tOriginal tag restored:");
  701.     cyan(); high();
  702.     printf("%s",CurTag);
  703.     return;
  704.   }
  705.  
  706.   if( tmp[0] == '?' )    /* Print current tag */
  707.   {
  708.      ptr = CurTag ;
  709.      while( *ptr )       /* printable form... */
  710.      {
  711.        if (*ptr == 227 )
  712.         *ptr = '\n';
  713.        ptr++;
  714.      }
  715.      green();
  716.      printf("Current TagLine is :");
  717.      cyan(); high();
  718.      printf("%s",CurTag);
  719.      return ;
  720.   }
  721.                               /* Change Tag */
  722.   strcpy(CurTag,"\n---\n");
  723.   strcat(CurTag,line + 4 );
  724.   strcat(CurTag,"\n\n");
  725.  
  726.   ptr = CurTag ;
  727.      while( *ptr )       /* printable form... */
  728.      {
  729.        if (*ptr == 227 )
  730.         *ptr = '\n';
  731.        ptr++;
  732.      }
  733.  
  734.   green();
  735.   printf("Tag is now set to :");
  736.   cyan(); high();
  737.   printf("%s",CurTag);
  738.  
  739. #endif
  740. }
  741.  
  742.  
  743.  
  744.  
  745.  
  746. /*
  747.                       Print Next,previous or current message.
  748. */
  749.  
  750. void ReadNext(mode)
  751. int mode ;
  752. {
  753.   int Head  = sizeof( struct MsgHeaderType );
  754.   long here;
  755.  
  756.  if( IsEmpty )
  757.  {
  758.     EmptyMsg();
  759.     return ;
  760.  }
  761.  
  762.  if( mode == PREVIOUS )
  763.  {
  764.    here = ftell( fidx ) - (long )( 2 * sizeof(struct MyIndex) );
  765.    if( here < 0L )
  766.    {
  767.      printf("%s\n",txt[ 15 ]);   /* "First message !" */
  768.      return ;
  769.    }
  770.   if( fseek( fidx, here , SEEK_SET ) )
  771.   {
  772.     printf("%s.\n",txt[16]);    /* "Seek error" */
  773.     return ;
  774.   }
  775.  }
  776.  
  777.    if( fread(&Index.LastRead,1,sizeof(struct MyIndex),fidx)
  778.       !=  sizeof( struct MyIndex ) )
  779.    {
  780.      printf("%s\n",txt[ 17 ]);  /* "End of messages." */
  781.      AutoJoin();
  782.      return ;
  783.    }
  784.  
  785.  
  786.    if( fseek(fmsg, Index.Offset, SEEK_SET ) )
  787.    {
  788.       printf("%s!\n",txt[ 16 ]);  /* "Seek Error" */
  789.       return ;
  790.    }
  791.  
  792.   if( (fread((char *)rbuf,1,Index.Size + Head,fmsg)) != Index.Size + Head )
  793.   {
  794.     printf("%s? \n",txt[ 18 ]); /* "Read error" */
  795.     return ;
  796.   }
  797.  
  798.   Display();
  799. }
  800.  
  801.  
  802.  
  803.  
  804. /*
  805.            Prints the Qmail message header pointed by buf .
  806. */
  807.  
  808. void PutHeader()
  809. {
  810.  struct MsgHeaderType *Header ;
  811.  static byte  *Space = "\t\t\t";
  812.  
  813.  Header = ( struct MsgHeaderType *) rbuf ;
  814.  
  815.  
  816. /*  printf("\nConf. : %d  Read: %d  Delete: %d",
  817.          Header->Conference,Header->Read,Header->Delete);*/
  818.  
  819.                     /* First line */
  820.   high();
  821.   green();
  822.   printf("\n%s",txt[ 19 ]);  /* " From :" */
  823.   yellow();
  824.   nprint(Header->Author,  25); printf(Space);
  825.   green();
  826.   printf(  "%s",txt[ 23]);  /* "Number" */
  827.   yellow();
  828.   nprint(Header->NumMsg,   7);
  829.  
  830.                                  /* Second line */
  831.   green();
  832.   printf("\n%s",txt[ 20 ]);    /* "To:" */
  833.   red();
  834.   if( ! strnicmp(UserName, Header->ForWho,strlen(UserName ) )  )
  835.     blink();
  836.   nprint(Header->ForWho,  25); printf(Space);
  837.  
  838.   clear(); green(); high();
  839.   printf(  "%s",txt[24]);   /* " Ref # " */
  840.   red();
  841.   nprint(Header->RefMsg,   7);
  842.  
  843.   green();
  844.   printf("\n%s",txt[ 21 ]);  /* "Subject" */
  845.   cyan();
  846.   nprint(Header->Subject, 25); printf(Space);
  847.   green();
  848.   printf(  "%s",txt[ 25 ]);  /* "Conf : " */
  849.   magenta();
  850.  /* printf("%d",Header->Conference);*/
  851.   printf("%s",ConfName[ Header->Conference ] );
  852.   green();
  853.   printf("\n%s",txt[ 22 ]);  /* "date:" */
  854.   red();
  855.   nprint(Header->MsgDate,  8);
  856.   green();
  857.   printf(  "%s",txt[ 26 ]);  /* "time:" */
  858.   red();
  859.   nprint(Header->MsgTime,  5);
  860.   clear(); blue();
  861.   printf("\t[%d/%d]",Index.MsgNum +1 ,TotMsg); /* 0 based, print 1 based. */
  862.   if(Header->Status == '+' || Header->Status == '*')
  863.   {
  864.      printf("\t\t");
  865.      red(); high();
  866.      printf(" %s%c\n",txt[ 27 ],7);  /* "PRIVATE MESSAGE" */
  867.   }
  868.  
  869.   printf("\n\n");
  870.   clear();
  871.   cyan();
  872. }
  873.  
  874.  
  875. /*
  876.            Prints the Qmail message header in file fp.
  877. */
  878.  
  879. void PrintHeader(fp)
  880. FILE *fp;
  881. {
  882.  struct MsgHeaderType *Header ;
  883.  static byte  *Space = "\t\t\t";
  884.  
  885.  Header = ( struct MsgHeaderType *) rbuf ;
  886.  
  887.  
  888. /*  printf("\nConf. : %d  Read: %d  Delete: %d",
  889.          Header->Conference,Header->Read,Header->Delete);*/
  890.  
  891.                     /* First line */
  892.   fprintf(fp,"\n%s",txt[19]);  /* "from:" */
  893.   nfprint(fp,Header->Author,  25); fprintf(fp,Space);
  894.   fprintf(fp,  "%s",txt[23]);  /* "number:" */
  895.   nfprint(fp,Header->NumMsg,   7);
  896.  
  897.                                  /* Second line */
  898.   fprintf(fp,"\n%s",txt[ 20 ]);  /* "to :" */
  899.   nfprint(fp,Header->ForWho,  25); fprintf(fp,Space);
  900.   fprintf(fp,  "%s",txt[24]);    /* "ref#" */
  901.   nfprint(fp,Header->RefMsg,   7);
  902.  
  903.   fprintf(fp,"\n%s",txt[ 21 ] ); /* "subj." */
  904.   nfprint(fp,Header->Subject, 25); fprintf(fp,Space);
  905.   fprintf(fp,  "%s",txt[ 25 ]);  /* "Conf : " */
  906.  /* printf("%d",Header->Conference);*/
  907.   fprintf(fp,"%s",ConfName[ Header->Conference ] );
  908.   fprintf(fp,"\n%s",txt[ 22 ] );   /* "date :" */
  909.   nfprint(fp,Header->MsgDate,  8);
  910.   fprintf(fp,  "%s",txt[ 26 ] );   /* "time:" */
  911.   nfprint(fp,Header->MsgTime,  5);
  912.   fprintf(fp,"\t[%d/%d]",Index.MsgNum +1, TotMsg ); /* 0 based, print 1 based. */
  913.   if(Header->Status == '+' || Header->Status == '*')
  914.   {
  915.      fprintf(fp,"\t\t");
  916.      fprintf(fp,"  %s\n",txt[ 27 ]);  /* "PRIVATE MESSAGE" */
  917.   }
  918.  
  919.   fprintf(fp,"\n\n");
  920. }
  921.  
  922.  
  923.  
  924.  
  925.  
  926. /*
  927.              Reply to current message or enter a message
  928.              -------------------------------------------
  929. */
  930. void reply(mode)
  931. int mode ;
  932. {
  933.  char fname [MAXPATHS];
  934.  char cmd   [MAXPATHS];
  935.  char tmp   [MAXPATHS];
  936.  char dummy [MAXPATHS];
  937.  struct MsgHeaderType *Header ;
  938.  struct QmailRepType  Qmail   ;
  939.  
  940.    if( IsEmpty )
  941.    {
  942.      EmptyMsg();
  943.      return ;
  944.    }
  945.  
  946.  Header = ( struct MsgHeaderType *) rbuf ;
  947.  
  948.  sprintf(fname,"%s/$tmp.$$$"  , WorkPath);      /* Temporary file */
  949.  sprintf(cmd , "%s %s",Editor , fname   );      /* Editor command */
  950.  
  951.  ResetHeader( &Qmail );
  952.  
  953.  blue();
  954.  high();
  955.  printf("\n%s\n\n",txt[ 32 ]);  /* "Enter 'n' to abort entry..." */
  956.  
  957. moreto:
  958.    green();
  959.    scpy( dummy, Header->Author , 25 );
  960.    printf("       To [ %25s ] : ",(mode == REPLY ) ? dummy : "ALL");
  961.    white();
  962.    fget(tmp,50,stdin);
  963.    if( tmp[0] )
  964.    {
  965.      strupr(tmp);
  966.      if( ! strcmp(tmp,"N") )
  967.      {
  968.        blue();
  969.        printf("%s.\n",txt[ 33 ] );  /*  "message aborted" */
  970.        return ;
  971.      }
  972.      if(strlen(tmp) > 25 )
  973.      {
  974.        red();
  975.        printf("%s\n",txt[ 34 ]);  /* "Entry too long ! 25 chars max" */
  976.        goto moreto ;
  977.      }
  978.      str2mem( Qmail.ForWho,tmp );
  979.    }
  980.    else
  981.      str2mem( Qmail.ForWho,(mode == REPLY ) ? dummy : "ALL");
  982.  
  983.  
  984. moresub:
  985.  
  986.    green();
  987.    scpy( dummy, Header->Subject , 25 );
  988.    printf("  Subject [ %25s ] : ",(mode == REPLY ) ? dummy : "");
  989.    white();
  990.    fget(tmp,50,stdin);
  991.      if( ! strcmp(tmp,"N") || ! strcmp(tmp,"n") )
  992.      {
  993.        blue();
  994.        printf("%s.\n",txt[ 33 ] );  /*  "message aborted" */
  995.        return ;
  996.      }
  997.    if( tmp[0] )
  998.    {
  999.      if(strlen(tmp) > 25 )
  1000.      {
  1001.        red();
  1002.        printf("%s\n",txt[ 34 ]);  /* "Entry too long ! 25 chars max" */
  1003.        goto moresub ;
  1004.      }
  1005.      str2mem(Qmail.Subject,tmp );
  1006.    }
  1007.    else
  1008.      str2mem(Qmail.Subject,(mode == REPLY ) ? dummy : "*" );
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014. moresec:
  1015.    green();
  1016.    if( mode == REPLY )
  1017.       printf(" Security [ %25s ] : ",
  1018.       (Header->Status == '+') ? "R (private)" : "N (public )");
  1019.    else
  1020.       printf(" Security [ %25s ] : ", "N (public )");
  1021.    white();
  1022.    fget(tmp,50,stdin);
  1023.    if( tmp[0] )
  1024.    {
  1025.      strupr(tmp);
  1026.      if(strlen(tmp) > 2 )
  1027.      {
  1028.        red();
  1029.        printf("%s\n",txt[ 35 ]);  /* "Too long! R=...etc..." */
  1030.        goto moresec ;
  1031.      }
  1032.      if( tmp[0] == 'R' )
  1033.      {
  1034.        Qmail.Status   = 0x2A ;
  1035.        Qmail.Unknown2 = 0x04 ;
  1036.        green();
  1037.        printf("%s.\n",txt[ 36 ]);   /* "Receiver only" */
  1038.      }
  1039.  
  1040.    }
  1041.    else   /* Default selection  */
  1042.    if( Header->Status == '+' || Header->Status == '*')
  1043.    {
  1044.       Qmail.Status   = 0x2A ;
  1045.       Qmail.Unknown2 = 0x04 ;
  1046.        green();
  1047.        printf("%s.\n",txt[ 36 ]);   /* "Receiver only" */
  1048.    }
  1049.  
  1050.    str2mem(Qmail.Author,UserName);   /* Right name in the from field...    */
  1051.    sprintf (dummy,"%2d",CurConf );
  1052.    str2mem(Qmail.ConfNum,dummy );    /* Msg goes to the current conference */
  1053.  
  1054.    scpy( dummy, Header->NumMsg ,7);
  1055.    str2mem(Qmail.RefMsg,(mode == REPLY ) ? dummy : "" );
  1056.  
  1057.  
  1058.   if( mode == REPLY )
  1059.      QuoteMsg(fname);              /* Quote original message... */
  1060.      printf("%s\n",txt[ 38 ]);     /* "calling editor" */
  1061.   system(cmd);                     /* Edit message....          */
  1062.   AddReply(fname,(struct QmailRepType *) &Qmail.Status);
  1063. }
  1064.  
  1065.  
  1066.  
  1067.  
  1068. /*
  1069.                  Add the reply to a Qmail reply.msg file.
  1070. */
  1071. void AddReply(fname,Qmail)
  1072. char *fname;
  1073. struct QmailRepType *Qmail;
  1074. {
  1075.   OpenRepFile();
  1076.   if( CodeMessage(fname,Qmail) )
  1077.      return ;
  1078.   ReplyExist = 1 ;
  1079. }
  1080.  
  1081.  
  1082.  
  1083.  
  1084. /*
  1085.         LIST CONF : Prints conferences numbers,names, and status.
  1086. */
  1087.  
  1088. void ListConf()
  1089. {
  1090.  int i,line ;
  1091.  char tmp[MAXPATHS];
  1092.  
  1093.    if( IsEmpty )
  1094.    {
  1095.      EmptyMsg();
  1096.      return ;
  1097.    }
  1098.  
  1099.  cls();
  1100.  magenta(); high();
  1101.  printf("\r\t\t\t%s %s\n",txt[78],BoardName); /* "Liste des conf. sur" */
  1102.  clear(); red();
  1103.  printf("\r\t\t\t");
  1104.  for( i = 0 ; i < (strlen(txt[78]) + strlen(BoardName) + 1 ); i++)
  1105.    putchar('-');
  1106.  putchar('\n');
  1107.  
  1108.  
  1109.  for( i = 0, line = 0 ; i <= LastConf ; i++ )
  1110.  {
  1111.    line++;
  1112.    if( line > SCREENLINES - 5 )
  1113.    {
  1114.         line = 0 ;
  1115.         printf("\n");
  1116.         if( ! more(YES) )
  1117.           break ;
  1118.         cyan();
  1119.    }
  1120.    sprintf(tmp,"%s%s/%d.cnf",HomePath,CurBoard,i);
  1121.    red(); high();
  1122.    printf("\n\t\t%3d ",i);
  1123.    clear(); blue();
  1124.    printf("......... ");
  1125.    magenta(); high();
  1126.    printf("%10s ",ConfName[i] );
  1127.    clear(); blue();
  1128.    printf("......... ");
  1129.    high();
  1130.    if( access(tmp,0) )
  1131.    {
  1132.        printf("%s",txt[79]); /* "Inactive" */
  1133.    }
  1134.    else
  1135.    {
  1136.        magenta();
  1137.        printf("%s",txt[80]); /* "active" */
  1138.    }
  1139.  }
  1140.  clear();
  1141.  printf("\n");
  1142. }
  1143.  
  1144.  
  1145. /*
  1146.        Goes to the msg number represented by the string. and print it.
  1147.        ( Internal count, not BBS numbers ! )
  1148. */
  1149. void GoToNum( str )
  1150. char *str ;
  1151. {
  1152.  int nb ;
  1153.  int Head  = sizeof( struct MsgHeaderType );
  1154.  
  1155.    if( IsEmpty )
  1156.    {
  1157.      EmptyMsg();
  1158.      return ;
  1159.    }
  1160.  
  1161.  nb = atoi( str );
  1162.  nb -- ;
  1163.  if( nb < 0 || nb > TotMsg )
  1164.  {
  1165.    red();high();
  1166.    printf("%s\n",txt[ 81 ]);       /* "Number out of range ! " */
  1167.    printf("%s " ,txt[ 82 ]);       /* "Valid msgs are" */
  1168.    magenta();
  1169.    printf("1 ");
  1170.    red();
  1171.    printf("%s ",txt[ 83 ]);        /* "to" */
  1172.    magenta();
  1173.    printf("%d\n",TotMsg);
  1174.    return;
  1175.  }
  1176.    if( fseek( fidx,(long) nb * (long) sizeof(struct MyIndex ) , SEEK_SET ) )
  1177.    {
  1178.        printf("%s !\n",txt[ 16]);   /* "seek error" */
  1179.        return ;
  1180.    }
  1181.  
  1182.    if( fread(&Index.LastRead,1,sizeof(struct MyIndex),fidx)
  1183.       !=  sizeof( struct MyIndex ) )
  1184.    {
  1185.      printf("%s\n",txt[ 17 ]);  /* "End of messages " */
  1186.    }
  1187.  
  1188.    if( fseek(fmsg, Index.Offset, SEEK_SET ) )
  1189.    {
  1190.       printf("%s !\n",txt[ 16 ]);
  1191.       return ;
  1192.    }
  1193.  
  1194.   if( (fread((char *)rbuf,1,Index.Size + Head,fmsg)) != Index.Size + Head )
  1195.   {
  1196.     printf("%s ? \n",txt[ 18 ]);  /* "read error" */
  1197.     return ;
  1198.   }
  1199.  
  1200.   Display();
  1201.  
  1202. }
  1203.  
  1204.  
  1205.  
  1206. /*
  1207.       DISPLAY : Prints the current message,stored in memory.
  1208. */
  1209. void Display()
  1210. {
  1211.     int line;
  1212.     unsigned i;
  1213.     register int count ;
  1214.     int QuotedColor ;
  1215.     char *ptr,*pt;
  1216.     char tmp[MAXPATHS];
  1217.  
  1218.     if( IsEmpty )
  1219.     {
  1220.         EmptyMsg();
  1221.         return ;
  1222.     }
  1223.  
  1224.     cls();
  1225.     PutHeader();
  1226.     cyan();
  1227.     line = 0;
  1228.     i = 0 ;
  1229.     count = 0;
  1230.  
  1231.     ptr = (char *) (rbuf + sizeof(struct MsgHeaderType ) );
  1232.     i = 0 ;
  1233.     line = 0 ;
  1234.     QuotedColor =  0 ;
  1235.     pt = tmp ;
  1236.     *pt = 0  ;
  1237.  
  1238.     while (i < Index.Size)
  1239.     {
  1240.         if( count > MAXPATHS -1 )      /* Security for long lines       */
  1241.            *ptr = '\n' ;
  1242.  
  1243.         if( *ptr == '\n' )              /* Display a total line          */
  1244.         {
  1245.             count = 0 ;
  1246.             *pt = 0   ;
  1247.             line ++   ;
  1248.             pt = tmp  ;
  1249.             if ( IsQuoted( '>',pt ) )  /* Process colors on quoted line */
  1250.             {
  1251.                 while( *pt != '>' )
  1252.                     putchar(*pt++ );
  1253.                 QuotedColor = 1 ;
  1254.                 red();                   /* Quote char in red... */
  1255.                 putchar(*pt++ );
  1256.                 green();                 /* Quoted line in green.. */
  1257.                 puts(pt);
  1258.                 cyan();
  1259.                 pt = tmp ;
  1260.             }
  1261.             else
  1262.             {
  1263.                 if( QuotedColor)
  1264.                 {
  1265.                     cyan();
  1266.                     QuotedColor = 0 ;
  1267.                 }
  1268.                 puts(tmp);
  1269.             }
  1270.         }
  1271.         else
  1272.         {
  1273.             if( *ptr )  /* Non 0 chars */
  1274.             {
  1275.                 *pt = *ptr ;
  1276.                 pt ++ ;
  1277.                 count ++ ; /* Security for line length ... */
  1278.             }
  1279.         }
  1280.  
  1281.         i++;
  1282.         ptr++ ;
  1283.  
  1284.         if( line > SCREENLINES - 8 )
  1285.         {
  1286.             line = 0 ;
  1287.             if( ! more(YES) )
  1288.                 break ;
  1289.             cyan();
  1290.         }
  1291.     }
  1292.     printf("\n");
  1293. }
  1294.  
  1295.  
  1296.  
  1297. /*
  1298.             Welcome : Displays the welcome file.
  1299. */
  1300. void Welcome(void)
  1301. {
  1302.  char tmp[MAXPATHS];
  1303.  
  1304.       if( ansi )
  1305.         {
  1306.             sprintf(tmp,"%s%s/%s",HomePath,CurBoard,WELCOMEG);
  1307.             if(! access(tmp,0 ) )
  1308.             {
  1309.                 sprintf(tmp,"%s%s",HomePath,CurBoard);
  1310.                 view(tmp,WELCOMEG);
  1311.                 return ;
  1312.             }
  1313.         }
  1314.  
  1315.        sprintf(tmp,"%s%s/%s",HomePath,CurBoard,WELCOME);
  1316.        if(! access(tmp,0 ) )
  1317.        sprintf(tmp,"%s%s",HomePath,CurBoard);
  1318.        view(tmp,WELCOME);
  1319. }
  1320.  
  1321. /*
  1322.  GETBBS :
  1323.           Called by main() with argv[1].
  1324.           Looks for a new QWK packet, if older than message base,
  1325.           just  loads the base.
  1326. */
  1327.  
  1328. void GetBbs( name )
  1329. char *name;
  1330. {
  1331.   char tmp    [MAXPATHS];
  1332.   char packet [MAXPATHS];
  1333.   char base   [MAXPATHS];
  1334.   struct stat Oldst;
  1335.   struct stat Newst;
  1336.  
  1337.   strcpy(tmp,name);
  1338.   strcat(tmp,".qwk");
  1339.  
  1340.   sprintf(packet,"%s%s",MailPath,tmp);
  1341.   if( access(packet,0) ) /* No new mail found */
  1342.   {
  1343.     printf("%s\n",txt[31]);  /* "no new mail" */
  1344.     Read( name );
  1345.     return ;
  1346.   }
  1347.  
  1348.   sprintf(base,"%s%s/%s",HomePath,name,CNTRL_FILE);
  1349.   if( access(base,0 ) )
  1350.   {
  1351.     printf("%s. ",txt[45] );           /* New BBS in this base. */
  1352.     sprintf(tmp,"load %s",name);
  1353.     load(tmp);
  1354.     return ;
  1355.   }
  1356.  
  1357.   stat( packet,&Newst);
  1358.   stat( base  ,&Oldst);
  1359.  
  1360.   if( Newst.st_mtime <= Oldst.st_mtime )
  1361.   {
  1362.     blue(); high();
  1363.     printf("%s. %s.\n",txt[ 46] , txt[ 47 ]);
  1364.     sprintf(tmp,"read %s",name);
  1365.     Read(tmp);
  1366.     return ;
  1367.   }
  1368.   sprintf(tmp,"load %s",name);
  1369.   load(tmp);
  1370. }
  1371.  
  1372.  
  1373. void Purge()
  1374. {
  1375.  int i;
  1376.  char tmp[80];
  1377.  char cnf[MAXPATHS];
  1378.  char idx[MAXPATHS];
  1379.  struct stat st ;
  1380.  
  1381.    if( IsEmpty )
  1382.    {
  1383.      EmptyMsg();
  1384.      return ;
  1385.    }
  1386.  
  1387.  magenta();high();
  1388.  printf("Effacement  sélectif des conférences.\n");
  1389.  /* Selective deleting of areas */
  1390.  clear();
  1391.  red();
  1392.  printf("-------------------------------------\n\n");
  1393.  
  1394.  for( i = 0 ; i < LastConf ; i++ )
  1395.  {
  1396.    sprintf(cnf,"%s%s/%d.cnf",HomePath,CurBoard,i);
  1397.    sprintf(idx,"%s%s/%d.idx",HomePath,CurBoard,i);
  1398.  
  1399.    if( stat(cnf,&st) == -1 )
  1400.      continue;         /* No such file */
  1401.  
  1402. onemore :
  1403.  
  1404.    green();high();
  1405.    printf("Conf. %d [ ",i);
  1406.    yellow();
  1407.    printf("%s",ConfName[i] );
  1408.    green();
  1409.    printf(" ] takes ");
  1410.    yellow();
  1411.    printf("%ld",st.st_size);
  1412.    green();
  1413.    printf(" bytes. Delete it (Y)es (N)o (S)top ? : ");
  1414.  
  1415.    fget(tmp,5,stdin);
  1416.    strupr(tmp);
  1417.  
  1418.    switch( (int) tmp[0] )
  1419.    {
  1420.        case 'N' :
  1421.        break ;
  1422.  
  1423.        case 'S' :
  1424.        return ;
  1425.  
  1426.        case 'Y' :
  1427.        case 'O' :
  1428.        case 'J' :
  1429.         if( unlink(cnf ) == - 1 )
  1430.           printf("Unable to remove file %s\n",cnf);
  1431.         if( unlink(idx ) == - 1 )
  1432.           printf("Unable to remove file %s\n",idx);
  1433.         blue();
  1434.         if( i == CurConf )
  1435.         {
  1436.           Index.LastRead = 0 ;
  1437.           Index.MsgNum   = 0 ;
  1438.           TotMsg = 0 ;
  1439.         }
  1440.         printf("Conference %d is now empty.\n\n",i);
  1441.         if( i == CurConf )
  1442.          {
  1443.            Index.LastRead = 0 ;
  1444.            Index.MsgNum   = 0 ;
  1445.            TotMsg = 0 ;
  1446.            AutoJoin();
  1447.          }
  1448.        break ;
  1449.  
  1450.        default:
  1451.         goto onemore ;
  1452.    }
  1453.  }
  1454. }
  1455.