home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 1 / Mecomp-CD.iso / amiga / tools / cd / indexcd / bin / sources.lha / sources / E.c < prev    next >
C/C++ Source or Header  |  1997-03-06  |  18KB  |  855 lines

  1. /* dcc HD1:IndexCD/Bin/E.c */
  2.  
  3. char *Titolo = "$VER: E v2.0 (06-03-1997) © by Claudio Buraglio";
  4.  
  5. #include <stdio.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8.  
  9. #include "libraries/dosextens.h"
  10. extern struct FileHandle *Open();
  11.  
  12. // (void) exit(code)
  13.  
  14. char destdir [80];    // Configuration data
  15. char clha    [80];
  16. char ctext   [80];
  17. char cpic    [80];
  18. char cjpeg   [80];
  19. char cmod    [80];
  20. char clzx    [80];
  21. char cdms    [80];
  22. char destdms [80];
  23.  
  24. char NomeArc [80];
  25.  
  26. char path[255];        // II parametro della linea di comando
  27. char opath[20];
  28.  
  29. char cli [255];        // Tutti i file di un'archivio
  30. char exe [255];        // Linea da eseguire
  31.  
  32. char buff[255];        // Buffer di fgets
  33. char final[255];        // Buffer di fgets
  34.  
  35. char *ConfigFile  =    "S:Aminet-Config";
  36. char *Etemp       =    "T:E.temp";
  37. char *Modtemp     =    "T:DelMod.temp";
  38. char *LHAtemp     =    "T:LHA.temp";
  39. char *EXtemp      =    "T:Delete.temp";
  40. char *ChoiceTemp  =    "T:Choice.temp";
  41. char *DesTemp      =    "T:DestDir.temp";
  42. char *run         =    "Run >NIL: <NIL: ";
  43. char *ptr;
  44.  
  45. strtoupper(char *p)
  46. {
  47.     while (*p != 0)
  48.     {
  49.      if ((*p > 'a'-1) && (*p < 'z'+1))
  50.         *p = (*p & 0xdf);
  51.     p++;
  52.     }
  53. }
  54.  
  55. main(int arglen, char **argptr)
  56. {
  57.     DeletePreviousFiles();
  58.     LoadConfiguration();
  59.  
  60.     strcpy(path, argptr[2]);
  61.  
  62.     int i = 0;                        // Copia la sola path in opath
  63.     while (path[i] != ' ' && path[i] != '/')    {    opath[i] = path[i];    i++;    }
  64.     opath[i] = 0;
  65.  
  66.     ptr = strrchr(path, '/');
  67.     if (ptr != NULL)
  68.     {
  69.         ptr++;
  70.         strcpy(NomeArc, ptr);
  71.     }
  72.  
  73.     strtoupper(path);
  74.     strtoupper(opath);
  75.  
  76.     if (strstr(path,":AMINET/") != NULL)
  77.         strcpy(cli, path);
  78.     else
  79.     {
  80.         if((strstr(argptr[1],"A") != 0) ||
  81.             (strstr(argptr[1],"B") != 0) ||
  82.             (strstr(argptr[1],"C") != 0) ||
  83.             (strstr(argptr[1],"D") != 0) )
  84.             sprintf(cli, "SET%s:Aminet/%s", argptr[1], path);
  85.         else
  86.             sprintf(cli, "AMINET%s:Aminet/%s", argptr[1], path);
  87.     }
  88.     exit;
  89.  
  90.     if (arglen < 3 || arglen > 4 )
  91.     {
  92.         printf("L'uso di E (Execute) e' :  %s <disco> <path+file> [C]\n\n",argptr[0]);
  93.  
  94.         printf("    <disco> is the number of Aminet with the file.\n");
  95.         printf("<path+file> is the path and the name of the file to match it.\n");
  96.         printf("        [C] is an optional switch to force the read of the comment.\n\n");
  97.  
  98.         printf("Example: E 2 UTIL/CAL20.LHA    Extract the file from the archive.\n");
  99.         printf("         E 2 UTIL/CAL20.LHA C  Read the comment file of the archive.\n\n");
  100.  
  101.         goto Esce;
  102.     }
  103.     if (arglen == 4)
  104.     {
  105.         if (*argptr[3] == 'C' || *argptr[3] == 'c')
  106.         {
  107.             ptr = strrchr(cli, '.');
  108.  
  109.             *ptr++= '.';
  110.             *ptr++= 'R';
  111.             *ptr++= 'E';
  112.             *ptr++= 'A';
  113.             *ptr  = 0x0;
  114.          if (access(cli, 0) == 0) {    ShowText(); goto Esce;}
  115.  
  116.             *ptr++= 'D';
  117.             *ptr++= 'M';
  118.             *ptr++= 'E';
  119.             *ptr  = 0x0;
  120.          if (access(cli, 0) == 0) {    ShowText(); goto Esce;}
  121.  
  122.             ptr = strrchr(cli, '.');
  123.             *ptr++= '.';
  124.             *ptr++= 'R';
  125.             *ptr++= 'D';
  126.             *ptr++= 'M';
  127.             *ptr  = 0x0;
  128.          if (access(cli, 0) == 0) {    ShowText(); goto Esce;}
  129.  
  130.             printf("Commento non trovato\n\n");
  131.             goto Esce;
  132.         }
  133.         else
  134.         {
  135.             printf("ERRORE! Il terzo argomento dev'essere lo switch C oppure c.\n\n");
  136.             goto Esce;
  137.         }
  138.     }
  139.  
  140.     if (strstr(cli,".TXT") ||
  141.          strstr(cli,".DOC") ||
  142.          strstr(cli,".C"  ) != NULL)
  143.     {
  144.         ShowText();
  145.         goto Esce;
  146.     }
  147.  
  148.     if (strstr(opath,"MODS") ||
  149.          strstr(cli,".MOD") ||
  150.          strstr(cli,".MED") ||
  151.          strstr(cli,".S3M") != NULL)
  152.     {
  153.         PlayMods();
  154.         goto Esce;
  155.     }
  156.  
  157.     if(strstr(opath,"PIX") ||
  158.         strstr(cli,  ".JPEG") ||
  159.         strstr(cli,  ".JPG")    ||
  160.         strstr(cli,  ".GIF") ||
  161.         strstr(cli,  ".IFF") ||
  162.         strstr(cli,  ".MPG") != NULL)
  163.     {
  164.         switch(RequesterPic())
  165.         {
  166.             case 1:                        // Visualizza i disegni
  167.                 ShowPic();
  168.                 goto Esce;
  169.                 break;
  170.             case 2:                        // scompatta l'archivio in destdir
  171.                 if(strstr(cli,".LHA") || strstr(cli,".LZH") != NULL)
  172.                 {
  173.                     sprintf(exe, "%s -x -m x %s %s",clha, cli, destdir);
  174.                     system(exe);
  175.                     goto Esce;
  176.                     break;
  177.                 }
  178.                 else
  179.                 {
  180.                     sprintf(exe, "c:Copy %s %s", cli, destdir);
  181.                     system(exe);
  182.                     goto Esce;
  183.                     break;
  184.                 }
  185.             default:                        // Cancella
  186.                 goto Esce;
  187.                 break;
  188.         }
  189.     }
  190.     else
  191.     {
  192.         if(strstr(path,".LHA") ||
  193.             strstr(path,".LZH") ||
  194.             strstr(path,".LZX") != NULL)
  195.         {
  196.             switch(RequesterLHA())
  197.             {
  198.                 case 2:                        // Change desstdir
  199.                     sprintf(exe, "c:RequestFile >%s TITLE \"New Destination Dir...\" DRAWER %s", DesTemp, destdir);
  200.                     system(exe);
  201.  
  202.                     FILE *fpr;
  203.                     if (fpr = fopen(DesTemp, "r"))
  204.                     {
  205.                         fgets(buff, sizeof(buff)-1, fpr);
  206.                         if ( strrchr(buff, '"') != NULL)
  207.                         {
  208.                             if((ptr = strrchr(buff, '/')) != 0)    {    *++ptr = 0;    }
  209.                             else    {    ptr = strrchr(buff, ':');    *++ptr = 0;    }
  210.  
  211.                             ptr = buff; *ptr++;
  212.                             strcpy(destdir, ptr);
  213.                             fclose(fpr);
  214.                             if (strstr(path,".LZX") == NULL)
  215.                                 sprintf(exe, "%s >NIL: -x -m x %s %s", clha, cli, destdir);
  216.                             else
  217.                                 sprintf(exe, "%s >NIL: -a x %s %s", clzx, cli, destdir);
  218.                             system(exe);
  219.                             goto Esce;
  220.                             break;
  221.                         }
  222.                         else
  223.                         {
  224.                             fclose(fpr);
  225.                             remove(DesTemp);
  226.                             goto Esce;
  227.                             break;
  228.                         }
  229.                         remove(DesTemp);
  230.                     }
  231.  
  232.                 case 1:                                    // Scompatta Archivio in destdir
  233.                     struct FileHandle *dos_fh;        // Apre la window
  234.                     dos_fh = Open("CON:100/100/440/74/IndexCD", MODE_NEWFILE);
  235.                     sprintf(final, "\n\tDearchive:  %s\n"
  236.                                         "\n\tto:         %s", NomeArc, destdir);
  237.                     Write(dos_fh, final, strlen(final));
  238.  
  239.                     if (strstr(path,".LZX") == NULL)
  240.                         sprintf(exe, "%s >NIL: -x -m x %s %s", clha, cli, destdir);
  241.                     else
  242.                         sprintf(exe, "%s >NIL: -a x %s %s", clzx, cli, destdir);
  243.                     system(exe);
  244.  
  245.                     sleep(1);
  246.                     Close(dos_fh);        // Chiude la window
  247.                     goto Esce;
  248.                     break;
  249.  
  250.                 default:                        // Cancella
  251.                     goto Esce;
  252.                     break;
  253.             }
  254.         }
  255.  
  256.         if (strstr(path,".DMS") != NULL)
  257.         {
  258.             if (RequesterDMS() == 1)
  259.             {
  260.                 sprintf(exe, "%s WRITE %s TO %s",cdms, cli, destdms);
  261.                 system(exe);
  262.             }
  263.         }
  264.     }
  265. Esce:
  266.    return(0);
  267. }
  268.  
  269.  
  270. RequesterPic()
  271. {
  272.     int r = 1;
  273. /*
  274.     sprintf(exe, "c:RequestChoice >%s IndexCD \"Dearchive  ''%s''  to  ''%s'' ?\" Show Dearchive Abort",ChoiceTemp, NomeArc, destdir);
  275.     system(exe);
  276.  
  277.     FILE *fpr;
  278.     if (fpr = fopen("T:Choice.temp", "r"))
  279.     {
  280.         fgets(buff, sizeof(buff)-1, fpr);
  281.         if ( strchr(buff, '1') != NULL)
  282.         {
  283.             r = 1;
  284.         }
  285.         if ( strchr(buff, '2') != NULL)
  286.         {
  287.             r = 2;
  288.         }
  289.         fclose(fpr);
  290.     }
  291.     remove("T:Choice.temp");
  292. */
  293.     return(r);
  294. }
  295.  
  296.  
  297. RequesterLHA()
  298. {
  299.     int r = 0;
  300.  
  301.     sprintf(exe, "c:RequestChoice >%s IndexCD \"Dearchive  ''%s''  to  ''%s'' ?\" Dearchive NewDestination Abort", ChoiceTemp, NomeArc, destdir);
  302.     system(exe);
  303.  
  304.     FILE *fpr;
  305.     if (fpr = fopen("T:Choice.temp", "r"))
  306.     {
  307.         fgets(buff, sizeof(buff)-1, fpr);
  308.         if ( strchr(buff, '1') != NULL)
  309.         {
  310.             r = 1;
  311.         }
  312.         if ( strchr(buff, '2') != NULL)
  313.         {
  314.             r = 2;
  315.         }
  316.         fclose(fpr);
  317.     }
  318.     remove("T:Choice.temp");
  319.     return(r);
  320. }
  321.  
  322.  
  323. RequesterDMS()
  324. {
  325.     int r = 0;
  326.  
  327.     sprintf(exe,"c:RequestChoice >%s IndexCD \"Write the archive  ''%s''  to  ''%s'' ?\" Yes No", ChoiceTemp, NomeArc, destdms);
  328.     system(exe);                                // Visualizza requester
  329.  
  330.     FILE *fpr;
  331.     if (fpr = fopen("T:Choice.temp", "r"))
  332.     {
  333.         fgets(buff, sizeof(buff)-1, fpr);
  334.         if ( strchr(buff, '1') != NULL)
  335.         {
  336.             r = 1;
  337.         }
  338.         fclose(fpr);
  339.     }
  340.     remove("T:Choice.temp");
  341.     return(r);
  342. }
  343.  
  344. ShowPic()
  345. {
  346.  
  347.     struct FileHandle *dos_fh;        // Apre la window
  348.     dos_fh = Open("CON:100/100/440/174/IndexCD", MODE_NEWFILE);
  349.  
  350.     sprintf(final, "\n Showing...\n\n  ");
  351.     Write(dos_fh, final, strlen(final));
  352.  
  353.     FILE *fpr;
  354.     if(strstr(path,".LHA") || strstr(path,".LZH") != NULL)
  355.     {
  356.         sprintf(exe, "%s >%s vq %s", clha, LHAtemp, cli);
  357.         system(exe);
  358.  
  359.         LHAtempToDeleteList();
  360.  
  361.         sprintf(exe,"%s >NIL: -x -m x %s %s",clha, cli, destdir);
  362.         system(exe);
  363.     }
  364.     else
  365.     {
  366.         sprintf(final, "%s\n  ", cli);
  367.         Write(dos_fh, final, strlen(final));
  368.  
  369.         sprintf(exe, "%s \"%s\"",cpic, cli);
  370.         system(exe);
  371.         goto Esce;
  372.     }
  373.  
  374.     if (fpr = fopen(LHAtemp, "r"))
  375.     {
  376.        while (fgets(buff, sizeof(buff)-1, fpr))
  377.         {
  378.             int poin;
  379.             int i = 0;
  380.             do
  381.             {
  382.                 poin = toupper(buff[i]);
  383.                 buff[i] = poin;
  384.                 i++;
  385.             }
  386.             while (buff[i] != 0);
  387.  
  388.             i = 0;
  389.             while(buff[i++] != 0)
  390.             {
  391.                 if (buff[i] == 0x0a)
  392.                 {
  393.                     buff[i] = '"';
  394.                 }
  395.             }
  396.  
  397.             if (
  398.             ((ptr = strstr(buff, "LHA EVALUATION ")) == NULL) &&
  399.             ((ptr = strstr(buff, "ALL RIGHTS ")) == NULL) &&
  400.             ((ptr = strstr(buff, "UNABLE TO OPEN ARCHIVE")) == NULL) &&
  401.             ((ptr = strstr(buff, "OPERATION FAILED")) == NULL) &&
  402.             ((ptr = strstr(buff, "README")) == NULL) &&
  403.             ((ptr = strstr(buff, ".REA")) == NULL) &&
  404.             ((ptr = strstr(buff, ".INFO")) == NULL) &&
  405.             ((ptr = strstr(buff, ".DIZ")) == NULL) &&
  406.             ((ptr = strstr(buff, ".TXT")) == NULL) &&
  407.             ((ptr = strstr(buff, ".TEXT")) == NULL) &&
  408.             ((ptr = strstr(buff, ".GUIDE")) == NULL) &&
  409.             (buff[0] != 0x0A)    )
  410.  
  411.             {
  412.                 sprintf(final, "\"%s\n  ", buff);
  413.                 Write(dos_fh, final, strlen(final));
  414.  
  415.                 sprintf(exe, "%s \"%s%s", cpic, destdir, buff);
  416.                 system(exe);
  417.             }
  418.         }
  419. /*
  420.         FILE *fpw;
  421.         if (fpw = fopen(EXtemp, "a"))
  422.         {
  423.             if ( (strlen(cpic)+4) <= (strlen(cli)) )
  424.                 fputs(cli, fpw);
  425.             fclose(fpw);
  426.         }
  427. */
  428.         fclose(fpr);
  429.     }
  430.  
  431.     sprintf(exe, "Execute >NIL: %s", EXtemp);
  432.     system(exe);
  433.  
  434.     DeletePreviousFiles();
  435. Esce:
  436.     sprintf(final, "\n Done.", cli);
  437.     Write(dos_fh, final, strlen(final));
  438. //    sleep(2);
  439.     Close(dos_fh);        // Chiude la window
  440. }
  441.  
  442.  
  443. PlayMods()
  444. {
  445.     int NrMods = 0;
  446.     FILE *fp;
  447.     unsigned char *add[255];
  448.  
  449.     DeletePreviousMods();
  450.  
  451.     if ((strstr(cmod, "HIP")) != NULL)
  452.     {
  453.         int r = system("sys:Rexxc/RX >NIL: ICD:ARexx/HiP_stop.rexx");
  454.         if (r > 9)    {    system(cmod);    }
  455.         system("sys:Rexxc/RX ICD:ARexx/HiP_clear.rexx");
  456.         strcpy(add, "sys:Rexxc/RX ICD:ARexx/HiP_add1.rexx ");
  457.         goto OK1;
  458.     }
  459.  
  460.     if ((strstr(cmod, "SOUNDSTUDIO")) != NULL)
  461.     {
  462.         int r = system("sys:Rexxc/RX >NIL: ICD:ARexx/SS_Clear.rexx");
  463.         if (r > 9)    {    system(cmod);    }
  464.         strcpy(add, "sys:Rexxc/RX ICD:ARexx/SS_Load.rexx ");
  465.         goto OK1;
  466.     }
  467.  
  468.     if ((strstr(cmod, "DELITRACKER")) != NULL)
  469.     {
  470.         int r = system("sys:Rexxc/RX >NIL: ICD:ARexx/dt_clearlist2.rexx");
  471.         if (r > 9)
  472.         {
  473.             unsigned char *com[255];    // Directory of the command in the string 'com'
  474.             strcpy(com, cmod);
  475.             char *ptr = strrchr(com, '/');
  476.             *ptr++;    *ptr=0;
  477.             chdir(com);
  478.  
  479.             sprintf(exe, "c:RUN >NIL <NIL: %s", cmod,);
  480.             system(exe);
  481.             sleep(4);
  482.             system("sys:Rexxc/RX ICD:ARexx/dt_appendon.rexx");
  483.         }
  484.         strcpy(add, "sys:Rexxc/RX ICD:ARexx/dt_makelist.rexx ");
  485.         system(exe);
  486.         goto OK1;
  487.     }
  488.  
  489.     if ((strstr(cmod, "PLAYER")) != NULL)
  490.     {
  491.         system("sys:Rexxc/RX >NIL: ICD:ARexx/MultiPlay_Quit.rexx");
  492.         sprintf(add, "%s DIR=%s PLAY", cmod, destdir);
  493.     }
  494.  
  495. OK1:
  496.  
  497.     if(strstr(cli, ".MOD") != NULL)
  498.     {
  499. // Copia il .mod in T:
  500.         char *ptr = strrchr(cli, '/');
  501.         ptr++;
  502.         sprintf(exe, "c:copy \"%s\" T:",cli);
  503.         strcat(exe, ptr);
  504.         system(exe);
  505.  
  506. // Suona il modulo dalla dir T:
  507.  
  508.         if ((strstr(cmod, "HIP")) != NULL)
  509.         {
  510.             sprintf(exe,"%s T:%s", add, ptr);
  511.             system(exe);
  512.             system("sys:Rexxc/RX ICD:ARexx/HiP_play2.rexx");
  513.             goto OK2;
  514.         }
  515.  
  516.         if ((strstr(cmod, "SOUNDSTUDIO")) != NULL)
  517.         {
  518. //            sprintf(exe,"%s T:%s", add, ptr);
  519. //            system(exe);
  520. //            system("sys:Rexxc/RX ICD:ARexx/HiP_play2.rexx");
  521. //            goto OK2;
  522.         }
  523.  
  524.         if ((strstr(cmod, "DELITRACKER")) != NULL)
  525.         {
  526.             sprintf(exe,"%s T:%s", add, ptr);
  527.             system(exe);
  528.             system("sys:Rexxc/RX ICD:ARexx/dt_playlist.rexx 1");
  529.             goto OK2;
  530.         }
  531.  
  532.         if ((strstr(cmod, "PLAYER")) != NULL)
  533.         {
  534.             sprintf(exe,"%s PLAY \"T:%s\"", cmod, ptr);
  535.             system(exe);
  536.         }
  537.  
  538. OK2:
  539.  
  540.  
  541. // Cancella il modulo dalla dir T:
  542.  
  543.         sleep(1);
  544.         sprintf(exe,"T:%s", ptr);
  545.         remove(exe);
  546.  
  547.         goto Esce;
  548.     }
  549.  
  550.     sprintf(exe, "%s >%s vq %s",clha, LHAtemp, cli);
  551.  
  552.     system(exe);
  553.     LHAtempToDeleteList();
  554.  
  555.     sprintf(exe, "%s >NIL: -x -m x %s %s",clha, cli, destdir);
  556.     system(exe);
  557.  
  558.     if (fp = fopen(LHAtemp, "r"))
  559.     {
  560.        while (fgets(buff, sizeof(buff)-1, fp))
  561.         {
  562.             int poin;
  563.             int i = 0;
  564.             do
  565.             {
  566.                 poin = toupper(buff[i]);
  567.                 buff[i] = poin;
  568.                 i++;
  569.             }
  570.             while (buff[i] != 0);
  571.  
  572.             i = 0;
  573.             while(buff[i++] != 0)
  574.             {
  575.                 if (buff[i] == 0x0a)
  576.                 {
  577.                     buff[i] = 0;
  578.                 }
  579.             }
  580.             if (
  581.             ((ptr = strstr(buff, "LHA EVALUATION ")) == NULL) &&
  582.             ((ptr = strstr(buff, "UNABLE TO OPEN ARCHIVE")) == NULL) &&
  583.             ((ptr = strstr(buff, "OPERATION FAILED")) == NULL) &&
  584.             ((ptr = strstr(buff, "SA7ISFAC7ION")) == NULL) &&
  585.             ((ptr = strstr(buff, "ALL RIGHTS ")) == NULL) &&
  586.             ((ptr = strstr(buff, "DISPLAYME")) == NULL) &&
  587.             ((ptr = strstr(buff, "README")) == NULL) &&
  588.             ((ptr = strstr(buff, ".GUIDE")) == NULL) &&
  589.             ((ptr = strstr(buff, ".INSTR")) == NULL) &&
  590.             ((ptr = strstr(buff, ".REA")) == NULL) &&
  591.             ((ptr = strstr(buff, ".INFO")) == NULL) &&
  592.             ((ptr = strstr(buff, ".ASCII")) == NULL) &&
  593.             ((ptr = strstr(buff, ".DIZ")) == NULL) &&
  594.             ((ptr = strstr(buff, ".TXT")) == NULL) &&
  595.             ((ptr = strstr(buff, ".TEXT")) == NULL) &&
  596.             ((ptr = strstr(buff, ".JPG")) == NULL) &&
  597.             ((ptr = strstr(buff, ".NFO")) == NULL) &&
  598.             ((ptr = strstr(buff, ".DOC")) == NULL) &&
  599.             ((ptr = strstr(buff, ".EXE")) == NULL) &&
  600.             ((ptr = strstr(buff, ".REL")) == NULL) &&
  601.             ((ptr = strstr(buff, ".SS")) == NULL) &&
  602.             ((ptr = strstr(buff, ".PP")) == NULL) &&
  603.             (buff[0] != 0x0A)    )
  604.  
  605.             {
  606.                 if ((strstr(cmod, "HIP")) != NULL)
  607.                 {
  608.                     sprintf(exe,"%s%s%s", add, destdir, buff);
  609.                     system(exe);
  610.                     goto OK3;
  611.                 }
  612.  
  613.                 if ((strstr(cmod, "SOUNDSTUDIO")) != NULL)
  614.                 {
  615.                     if (NrMods == 0)
  616.                     {
  617.                         sprintf(exe,"%s\"%s%s\"", add, destdir, buff);
  618.                         system(exe);
  619.                     }
  620.                     else
  621.                     {
  622.                         sprintf(exe,"sys:Rexxc/RX ICD:ARexx/SS_Append.rexx \"%s%s\"", destdir, buff);
  623.                         system(exe);
  624.                     }
  625.                     sprintf(exe,"c:delete \"%s%s\"", destdir, buff);
  626.                     system(exe);
  627.                     NrMods++;
  628.                     goto OK3;
  629.                 }
  630.  
  631.                 if ((strstr(cmod, "DELITRACKER")) != NULL)
  632.                 {
  633.                     sprintf(exe,"%s%s%s", add, destdir, buff);
  634.                     system(exe);
  635.                     goto OK3;
  636.                 }
  637.  
  638.                 if ((strstr(cmod, "PLAYER")) != NULL)
  639.                 {
  640.                     strcat(add, " \"");
  641.                     strcat(add, destdir);
  642.                     strcat(add, buff);
  643.                     strcat(add, "\"");
  644.                 }
  645. OK3:
  646.             }
  647.         }
  648.     fclose(fp);
  649.     }
  650.  
  651.     if ((ptr = strstr(cmod, "HIP")) != NULL)
  652.     {    system("sys:Rexxc/RX ICD:ARexx/HiP_play2.rexx");
  653.         goto Esce;
  654.     }
  655.  
  656.     if ((ptr = strstr(cmod, "SOUNDSTUDIO")) != NULL)
  657.     {    system("sys:Rexxc/RX ICD:ARexx/SS_Play.rexx");
  658.         DeletePreviousFiles();
  659.         goto Esce;
  660.     }
  661.  
  662.     if ((ptr = strstr(cmod, "DELITRACKER")) != NULL)
  663.     {    system("sys:Rexxc/RX ICD:ARexx/dt_playlist.rexx 1");
  664.         goto Esce;
  665.     }
  666.  
  667.     if ((ptr = strstr(cmod, "PLAYER")) != NULL)
  668.     {    system(add);}
  669.  
  670. Esce:
  671.     sprintf(exe,"c:Rename >NIL: %s %s", Etemp, Modtemp);
  672.     system(exe);
  673. }
  674.  
  675.  
  676. ShowText()
  677. {
  678.     sprintf(exe, "%s %s",ctext, cli);
  679.     system(exe);
  680. }
  681.  
  682.  
  683. DeletePreviousFiles()
  684. {
  685.     if (access(Etemp,0) == NULL)
  686.     {
  687.         sprintf(exe, "Execute %s", Etemp);
  688.         system(exe);
  689.  
  690.         sprintf(exe, "Delete >NIL: %s", Etemp);
  691.         system(exe);
  692.     }
  693.     remove(EXtemp);
  694.     remove(LHAtemp);
  695. }
  696.  
  697. DeletePreviousMods()
  698. {
  699.     if (access(Modtemp,0) == NULL)
  700.     {
  701.         sprintf(exe, "Execute %s", Modtemp);
  702.         system(exe);
  703.  
  704.         sprintf(exe, "Delete >NIL: %s", Modtemp);
  705.         system(exe);
  706.     }
  707.     remove(EXtemp);
  708.     remove(LHAtemp);
  709. }
  710.  
  711.  
  712. LoadConfiguration()
  713. {
  714.     FILE *fp;
  715.     char *coda;
  716.  
  717.     strcpy(destdir, "RAM:");
  718.     strcpy(   clha, "CD0:Tools/LHA");
  719.     strcpy(  ctext, "CD0:Tools/Guide");
  720.    strcpy(  cjpeg, "CD0:Tools/FJPEG_ECS");
  721.     strcpy(   cpic, "CD0:Tools/VT");
  722.     strcpy(   cmod, "CD0:Tools/DeliTracker2");
  723.     strcpy(   clzx, "C:LZX");
  724.     strcpy(   cdms, "CD0:Tools/DMS");
  725.     strcpy(destdms, "DF0:");
  726.  
  727.     if (fp = fopen(ConfigFile, "r"))
  728.     {
  729.        while (fgets(buff, sizeof(buff)-1, fp))
  730.         {
  731.             if ((ptr = strstr(buff, "destdir=")) != NULL)
  732.             {
  733.                 ptr = strchr(buff, '=');
  734.                 ptr++;
  735.                 coda = stpcpy(destdir, ptr);
  736.                 *--coda = 0;
  737.             }
  738.             if ((ptr = strstr(buff, "lha=")) != NULL)
  739.             {
  740.                 ptr = strchr(buff, '=');
  741.                 ptr++;
  742.                 coda = stpcpy(clha, ptr);
  743.                 *--coda = 0;
  744.             }
  745.             if ((ptr = strstr(buff, "lzx=")) != NULL)
  746.             {
  747.                 ptr = strchr(buff, '=');
  748.                 ptr++;
  749.                 coda = stpcpy(clzx, ptr);
  750.                 *--coda = 0;
  751.             }
  752.             if ((ptr = strstr(buff, "text=")) != NULL)
  753.             {
  754.                 ptr = strchr(buff, '=');
  755.                 ptr++;
  756.                 coda = stpcpy(ctext, ptr);
  757.                 *--coda = 0;
  758.             }
  759.             if ((ptr = strstr(buff, "jpeg=")) != NULL)
  760.             {
  761.                 ptr = strchr(buff, '=');
  762.                 ptr++;
  763.                 coda = stpcpy(cjpeg, ptr);
  764.                 *--coda = 0;
  765.             }
  766.             if ((ptr = strstr(buff, "pic=")) != NULL)
  767.             {
  768.                 ptr = strchr(buff, '=');
  769.                 ptr++;
  770.                 coda = stpcpy(cpic, ptr);
  771.                 *--coda = 0;
  772.             }
  773.             if ((ptr = strstr(buff, "mod=")) != NULL)
  774.             {
  775.                 ptr = strchr(buff, '=');
  776.                 ptr++;
  777.                 coda = stpcpy(cmod, ptr);
  778.                 *--coda = 0;
  779.             }
  780.             if ((ptr = strstr(buff, " dms=")) != NULL)
  781.             {
  782.                 ptr = strchr(buff, '=');
  783.                 ptr++;
  784.                 coda = stpcpy(cdms, ptr);
  785.                 *--coda = 0;
  786.             }
  787.             if ((ptr = strstr(buff, "destdms=")) != NULL)
  788.             {
  789.                 ptr = strchr(buff, '=');
  790.                 ptr++;
  791.                 coda = stpcpy(destdms, ptr);
  792.                 *--coda = 0;
  793.             }
  794.         }
  795.         fclose(fp);
  796.     }
  797.     strtoupper(cmod);            // cmod in Uppercase
  798. }
  799.  
  800.  
  801. LHAtempToDeleteList()
  802. {
  803.     char    line[255];
  804.     char    oldline[255];
  805.  
  806.     FILE *fpr;
  807.     FILE *fpw;
  808.     char *ptr;
  809.  
  810.     if (fpr = fopen(LHAtemp, "r"))
  811.     {
  812.         if (fpw = fopen(Etemp, "w"))
  813.         {
  814.            fgets(buff, sizeof(buff)-1, fpr);
  815.            fgets(buff, sizeof(buff)-1, fpr);
  816.            fgets(buff, sizeof(buff)-1, fpr);
  817.            while (fgets(buff, sizeof(buff)-1, fpr))
  818.             {
  819.                 char *ptr = strchr(buff, '\n');
  820.                 if (*ptr == '\n')
  821.                     *ptr = 0;
  822.                 sprintf(line, "Delete >NIL: \"%s%s\"\n", destdir, buff);
  823.                 fputs(line, fpw);
  824.             }
  825.         }
  826.           fclose(fpr);
  827. // Lista di delete per tutte le directory create dall'archivio
  828.         if (fpr = fopen(LHAtemp, "r"))
  829.         {
  830.            fgets(buff, sizeof(buff)-1, fpr);
  831.            fgets(buff, sizeof(buff)-1, fpr);
  832.            fgets(buff, sizeof(buff)-1, fpr);
  833.  
  834.            while (fgets(buff, sizeof(buff), fpr))
  835.             {
  836.                 ptr = strrchr(buff, '/');
  837.                 if (ptr != 0)
  838.                 {
  839.                     *ptr = 0;
  840.                     if (stricmp(oldline, buff) != 0)
  841.                     {
  842.                         strcpy(oldline, buff);
  843.                         sprintf(line, "Delete >NIL: \"%s%s\" ALL\n", destdir, buff);
  844.                         fputs(line, fpw);
  845.                     }
  846.                 }
  847.             }
  848.         }
  849.     fclose(fpr);
  850.     fclose(fpw);
  851.     }
  852.     return(0);
  853. }
  854.  
  855.