home *** CD-ROM | disk | FTP | other *** search
-
- char *Titolo = "$VER: SetConfig v1.1 (07-05-1996) © di Claudio Buraglio";
-
- #include <stdio.h>
- #include <string.h>
-
- char destdir [80]; // Configuration data
- char clha [80];
- char ctext [80];
- char cpic [80];
- char cmod [80];
- char cdms [80];
- char destdms [80];
- char csample [80];
-
- char path[128];
- char line[128];
- char comm[128];
- char buf[225];
-
- char *ptr;
- FILE *fp;
-
- char *Config = "S:EARSAN.configurazione";
-
- main(int argc, char **argv)
- {
- printf("\n%s\n\n",Titolo+6);
- strcpy(line, argv[1]);
- LoadConfiguration();
-
- if (strstr(line, "destdir") != 0)
- {
- strcpy(buf, destdir);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Directory destinazione...\" %s\n", path);
- }
- if (strstr(line, "clha") != 0)
- {
- strcpy(buf, clha);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Percorso comando LHA...\" DRAWER %s FILE %s\n", path, comm);
- LoadSelected();
- strcpy(clha, buf);
- }
- if (strstr(line, "ctext") != 0)
- {
- strcpy(buf, ctext);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Visualizzatore di testi...\" DRAWER %s FILE %s\n", path, comm);
- }
- if (strstr(line, "cpic") != 0)
- {
- strcpy(buf, cpic);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Visualizzatore grafica...\" DRAWER %s FILE %s\n", path, comm);
- }
- if (strstr(line, "cmod") != 0)
- {
- strcpy(buf, cmod);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Player moduli audio...\" DRAWER %s FILE %s\n", path, comm);
- }
- if (strstr(line, "cdms") != 0)
- {
- strcpy(buf, cdms);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Percorso e comando DMS...\" DRAWER %s FILE %s\n", path, comm);
- }
- if (strstr(line, "destdms") != 0)
- {
- strcpy(buf, destdir);
- SplittaCampo();
- sprintf(line, "c:RequestFile >T:File.temp TITLE \"Disco destinazione DMS...\" %s\n", path);
- }
-
- system(line);
-
- return(0);
- }
-
- SplittaCampo()
- {
- strcpy(path, buf);
- strcpy(comm, buf);
- if((ptr = strrchr(path, '/')) != NULL || (ptr = strrchr(path, ':')) != NULL)
- {
- *ptr++;
- strcpy(comm, ptr);
- *ptr = 0;
- }
- }
-
- LoadSelected()
- {
- if (fp = fopen("T:File.temp", "r"))
- {
- fgets(buf, sizeof(buf)-1, fp);
- fclose(fp);
- }
- }
-
-
- LoadConfiguration()
- {
- char *coda;
-
- strcpy(destdir, "RAM:");
- strcpy( clha, "LHA");
- strcpy( ctext, "MultiView");
- strcpy( cpic, "VT");
- strcpy( cmod, "HIP");
- strcpy( cdms, "DMS");
- strcpy(destdms, "DF0:");
-
- if (fp = fopen(Config, "r"))
- {
- while (fgets(buf, sizeof(buf)-1, fp))
- {
- if ((ptr = strstr(buf, "destdir=")) != NULL)
- {
- ptr = strchr(buf, '=');
- ptr++;
- coda = stpcpy(destdir, ptr);
- *--coda = 0;
- }
- if ((ptr = strstr(buf, "lha=")) != NULL)
- {
- ptr = strchr(buf, '=');
- ptr++;
- coda = stpcpy(clha, ptr);
- *--coda = 0;
- }
- if ((ptr = strstr(buf, "text=")) != NULL)
- {
- ptr = strchr(buf, '=');
- ptr++;
- coda = stpcpy(ctext, ptr);
- *--coda = 0;
- }
- if ((ptr = strstr(buf, "pic=")) != NULL)
- {
- ptr = strchr(buf, '=');
- ptr++;
- coda = stpcpy(cpic, ptr);
- *--coda = 0;
- }
- if ((ptr = strstr(buf, "mod=")) != NULL)
- {
- ptr = strchr(buf, '=');
- ptr++;
- coda = stpcpy(cmod, ptr);
- *--coda = 0;
- }
- if ((ptr = strstr(buf, "sample=")) != NULL)
- {
- ptr = strchr(buf, '=');
- ptr++;
- coda = stpcpy(csample, ptr);
- *--coda = 0;
- }
- }
- fclose(fp);
-
- int i = 0; // cmod in Uppercase
- while (cmod[i] != 0)
- {
- if ((cmod[i] >= 0x61 && path[i] <= 0x7A) != NULL )
- {
- cmod[i] = toupper(cmod[i]);
- }
- i++;
- }
- }
- }
-
-