home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / sound / paula22a / utils / mp.c < prev    next >
C/C++ Source or Header  |  1992-08-12  |  2KB  |  78 lines

  1. /*
  2.  * Mini-Interface: MP.TTP
  3.  * ----------------------
  4.  * -> Paula Access from command shells:
  5.  * Gemini - MUPFEL
  6.  * Desktop - install application (!)
  7.  * MultiTOS - MiNTShell
  8.  *
  9.  * !! Achtung: bei MultiTOS darauf achten, daß MP's Speicher als
  10.  * !! 'readable' deklariert wird (shared memory!)
  11.  */
  12.  
  13. #include <stdio.h>
  14. #include <aes.h>
  15. #include <tos.h>
  16. #include <string.h>
  17.  
  18.  
  19. /* VA_START: Accessory wird aktiviert. Word 3 + 4 enthalten einen
  20.  * Pointer auf eine Kommandozeile, der auch NULL sein kann.
  21.  * In der Kommandozeile stehen Pfade oder Dateinamen.
  22.  */
  23. #define VA_START            0x4711
  24.  
  25. int     msgbuf[8];
  26. char    tmpstr[256];
  27. char    ownpath[128];
  28. char    va_string[4096];
  29.  
  30. int main(int argc, char *argv[])
  31. {
  32.     int     i, gl_apid, paula_id;
  33.  
  34.     gl_apid=appl_init();
  35.     
  36.     ownpath[0]=Dgetdrv()+'A';        /* our own path... */
  37.     ownpath[1]=':';
  38.     Dgetpath(&ownpath[2], 0);
  39.     strcat(ownpath, "\\");
  40.     
  41.     if ((paula_id=appl_find("PAULA   "))>=0 && argc>1)
  42.     {
  43.         va_string[0]=0;
  44.         for(i=1; i<argc; i++)
  45.         {
  46.             strcpy(tmpstr, argv[i]);        /* copy... */
  47.             shel_find(tmpstr);                /* Suchen! */
  48.             if (strchr(tmpstr,'\\')==NULL)    /* pfad angegeben? */
  49.             {                                /* nein. */
  50.                 strcat(va_string, ownpath);
  51.             }
  52.             strcat(va_string, tmpstr);
  53.             strcat(va_string, ";");         /* separator */
  54.         }
  55.  
  56.         Cconws("Paula plays: ");
  57.         Cconws(va_string); Cconws("\n\r");    /* to Console */
  58.         wind_update(BEG_UPDATE);
  59.         msgbuf[0]=VA_START;                 /* prepare MSG */
  60.         msgbuf[1]=gl_apid;
  61.         *(char **)&msgbuf[3] = va_string;
  62.         msgbuf[6]=1;
  63.         msgbuf[7]=0;
  64.         appl_write(paula_id,16,msgbuf);     /* send MSG */
  65.         wind_update(END_UPDATE);
  66.         
  67.         /* Vorsicht MTOS: Dem Empfänger Zeit lassen, den String
  68.          * zu kopieren. Sonst Memory Protection Violation!
  69.          */
  70.         evnt_timer(1000,0);                    /* wait 1 sec */
  71.     }
  72.     appl_exit();
  73.     return(argc-1);
  74. }
  75.  
  76.  
  77. /* eof. */
  78.