home *** CD-ROM | disk | FTP | other *** search
/ PC Loisirs 18 / cd.iso / sharewar / mikm202 / source / mikdesc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-18  |  2.0 KB  |  112 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dir.h>
  4. #include <string.h>
  5. #include <process.h>
  6.  
  7. #include "mtypes.h"
  8. #include "wildfile.h"
  9.  
  10. #include "mloader.h"
  11. #include "munitrk.h"
  12.  
  13.  
  14. /*
  15.     Declare external loaders:
  16. */
  17.  
  18. extern LOADER mtmload,s3mload,ultload,modload,dsmload,medload,
  19.               farload,s69load,uniload,xmload,stmload,m15load;
  20.  
  21.  
  22.  
  23. WORD MD_SampleLoad(FILE *fp,ULONG length,ULONG loopstart,ULONG loopend,UWORD flags)
  24. {
  25.     return 1;
  26. }
  27.  
  28.  
  29. void MD_SampleUnLoad(WORD handle)
  30. {
  31. }
  32.  
  33.  
  34. char buffer[256];
  35.  
  36.  
  37. int main(int argc,char *argv[])
  38. {
  39.     FILE *fpi;
  40.     int t,v,w;
  41.  
  42.     puts(mikbanner);
  43.  
  44.     //     Expand wildcards on commandline (only neccesary for MSDOS):
  45.  
  46.     MyGlob(&argc,&argv,0);
  47.  
  48.     /*
  49.         Register the loaders we want to use..
  50.     */
  51.  
  52.     ML_RegisterLoader(&m15load);
  53.     ML_RegisterLoader(&modload);
  54.     ML_RegisterLoader(&mtmload);
  55.     ML_RegisterLoader(&farload);
  56.     ML_RegisterLoader(&s69load);
  57.     ML_RegisterLoader(&s3mload);
  58.     ML_RegisterLoader(&stmload);
  59.     ML_RegisterLoader(&dsmload);
  60.     ML_RegisterLoader(&medload);
  61.     ML_RegisterLoader(&ultload);
  62.     ML_RegisterLoader(&uniload);
  63.     ML_RegisterLoader(&xmload);
  64.  
  65.     if(argc==1 || argv[1][0]=='/'){
  66.  
  67.         // display a usage message
  68.  
  69.         puts("Usage: MIKDESC <fletch.mod> ...");
  70.         puts("Adds 4Dos descriptions to your music modules\n");
  71.         exit(-1);
  72.     }
  73.  
  74.     for(t=1; t<argc; t++){
  75.  
  76.         UNIMOD *mf;
  77.  
  78.         printf("Adding description to : %s\n",argv[t]);
  79.  
  80.         if((fpi=fopen(argv[t],"rb"))==NULL){
  81.             printf("MikDesc Error: Error opening input file\n");
  82.             continue;
  83.         }
  84.  
  85.         mf=ML_LoadFP(fpi);
  86.  
  87.         //    didn't work -> exit with error
  88.  
  89.         if(mf==NULL){
  90.             printf("MikDesc Error: %s\n",myerr);
  91.             fclose(fpi);
  92.             continue;
  93.         }
  94.  
  95.         printf( "Songname: %s\n"
  96.                 "Modtype : %s\n",
  97.                 mf->songname,
  98.                 mf->modtype);
  99.  
  100.         if(mf->songname!=NULL){
  101.             sprintf(buffer,"describe %s \"%s\"",argv[t],mf->songname);
  102.             spawnlp(P_WAIT,getenv("COMSPEC"),getenv("COMSPEC"),"/C",buffer,NULL);
  103.         }
  104.  
  105.         // and clean up
  106.  
  107.         fclose(fpi);
  108.         ML_Free(mf);
  109.     }
  110.     return 0;
  111. }
  112.