home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 216.lha / PdMake / maksys.c < prev    next >
C/C++ Source or Header  |  1996-02-15  |  1KB  |  84 lines

  1. /* System dependant stuff */
  2.  
  3. #include <stdio.h>
  4. #include <ctype.h>
  5. extern int _oserr;
  6.  
  7. #include "libraries/dos.h"
  8. #include "libraries/dosextens.h"
  9.  
  10. xsystem(s)
  11. char *s;
  12. {
  13.     char cmd[256];
  14.     char *c;
  15.     int i;
  16.     int success;
  17.  
  18. #ifdef MCH_AMIGA
  19.     long _oserr;
  20.     void *Output();
  21.     struct Process *FindTask(), *myproc = FindTask(0L);
  22.     struct CommandLineInterface *cli;
  23. #endif
  24.  
  25.     for(c=s;isspace(*c);c++);    /* isolate first word bounded by white space */
  26.     for(i=0;!isspace(*c);i++) cmd[i] = *c++;
  27.     cmd[i] = '\0';
  28.     while(isspace(*c)) c++;
  29.  
  30.     success = Execute(s,NULL,Output());
  31.  
  32.     if(!success)
  33.     {    _oserr = IoErr();
  34.  
  35.         if (_oserr)
  36.             fprintf(stderr,"\nMAKE:Unable to invoke [%s] ERROR=%d\n",cmd,_oserr);
  37. /*
  38.         else
  39.             fprintf(stderr,"\nMAKE:Invalid parm to [%s] parm=[%s]\n",cmd,args[1]);
  40. */
  41.         return(-1);
  42.     }
  43.     else
  44.     {    cli = (struct CommandLineInterface *)( ((LONG)(myproc->pr_CLI)) <<2);
  45.         if (cli) return cli->cli_FailLevel;
  46.         return 0;
  47.     }
  48. }
  49.  
  50. match(a,b)
  51. char *a,*b;
  52. {    while(*a++ == *b++) if(*a=='\0' && *b=='\0') return 1;
  53.     return 0;
  54. }
  55.  
  56. /* set the macros $(@D) $(@F)... */
  57.  
  58. setname(m1,m2,m3,n)
  59. char *m1,*m2,*m3;
  60. char *n;
  61. {
  62. #if LATTICE
  63.     char drive[3];
  64.     static char path[FMSIZE];
  65.     static char node[FNSIZE];
  66.     static char ext[FESIZE];
  67.  
  68.     static char dpart[FMSIZE+3];
  69.     static char fpart[FNSIZE+FESIZE];
  70.  
  71.     strsfn(n,drive,path,node,ext);
  72.     strcpy(dpart,drive);
  73.     strcat(dpart,path);
  74.     strcpy(fpart,node);
  75.     strcat(fpart,".");
  76.     strcat(fpart,ext);
  77.  
  78.     setmacro(m1,dpart);
  79.     setmacro(m2,fpart);
  80.     setmacro(m3,node);
  81. #endif
  82. }
  83.  
  84.