/* SpartaDOS library, for Deep Blue C runtime *ONLY* *//* Ace C uses a different syntax for ml subroutines *//* whatdos() returns A for Atari DOS,S for SpartaDOS*//* sparta() returns 1 if using SpartaDOS*//* comtab() returns index to SpartaDOS COMTAB*//* xcecho returns 1 if output redirected *//* xcbatch returns 1 if input redirected *//* crunch() calls the SpartaDOS filename cruncher *//* fchname() fetches the next crunched filename on the command line *//* fchparm() fetches the next parm on the command line. (no Dn:) *//*rdfname(array,string) reads the filename on the command line into 'array'.*//*If none is supplied, input is prompted with 'string'*//*rdparm(array,string) same as rdfname, except the drive number is ignored.*//*date(string) reads formatted date into string *//*time(string) reads formatted time into string *//*udate(string) unformatted date *//* utime(string) unformatted time */whatdos() /*Atari or Sparta?*/{          if(dpeek(10)==0x179f)           return('A');     else return('S');}sparta() /*using SpartaDOS?*/{     if(whatdos()=='S')           return(1);     else return(0);}comtab() /*get index to COMTAB*/{     return(dpeek(10));}crunch(){          int crad;          char mlstr[4];          mlstr[0]='h';          mlstr[1]='L';          crad=(comtab()+3);/* crunch a filename on the command line*/           dpoke(mlstr+2,crad);           usr(mlstr);           return 1;}fchname(file)/*read the crunched filename into array */char *file; {     int comfnam;     int ptr;     crunch();     comfnam=comtab()+33;     for(ptr=0;peek(comfnam+ptr)!='\n';ptr++)         file[ptr]=peek(comfnam+ptr);     file[ptr]='\n';     file[ptr+1]='\0';     return ptr-3;}fchparm(parm)/*read the next parm on the command line into array */char *parm;{     int comfnam;     int ptr;     crunch();     comfnam=comtab()+33;     for(ptr=3;peek(comfnam+ptr)!='\n';ptr++)          parm[ptr-3]=peek(comfnam+ptr);     parm[ptr-3]='\n';     parm[ptr-2]='\0';     return ptr-3;}rdfname(array,prompt)char *array;char *prompt;{     int clarg;     if(sparta())           {                  clarg=fchname(array);                  if(clarg)                      return 1;           }     printf("%s",prompt);     gets(array);     return 1;}rdparm(array,prompt)char *array;char *prompt;{          int clarg;          if(sparta())               {                      clarg=fchparm(array);                    if(clarg)                         return 1;               }          printf("%s",prompt);          gets(array);          return 1;}/* SpartaDOS date/time utilities. Z: handler must be installed */date(string)/* formatted date*/char *string;{     int iocb,byte,ptr;     if(sparta())           {               iocb=copen("Z:",'r');               ciov(iocb,34,-1,-1,0,0);               ptr=0;               while((byte=cgetc(iocb))>0)                    {                        string[ptr]=byte;                        ptr++;                    }              ptr++;              string[ptr]='\0';              cclose(iocb);              return 1;           }      strcpy(string,"N/A"); /* not using SpartaDOS */      return 0;}udate(string)/* unformatted date */char *string;{     int iocb,byte,ptr;     if(sparta())          {               iocb=copen("Z:",'r');               ciov(iocb,35,-1,-1,0,0);               ptr=0;               for(ptr=0;ptr<3;ptr++)                    string[ptr]=cgetc(iocb);                ptr++;               string[ptr]='\0';               cclose(iocb);               return 1;           }      strcpy(string,"N/A");      return 0;}time(string)/* formatted time */char *string;{     int iocb,byte,ptr;     if(sparta())          {               iocb=copen("Z:",'r');               ciov(iocb,32,-1,-1,0,0);               ptr=0;               while((byte=cgetc(iocb))>0)                    {                        string[ptr]=byte;                        ptr++;                    }               ptr++;               string[ptr]='\0';               cclose(iocb);               return 1;           }     strcpy(string,"N/A");     return 0;}utime(string)/* unformatted time */char *string;{     int iocb,byte,ptr;     if(sparta())       {           iocb=copen("Z:",'r');           ciov(iocb,33,-1,-1,0,0);           ptr=0;           for(ptr=0;ptr<3;ptr++)               string[ptr]=cgetc(iocb) ;            ptr++;           string[ptr]='\0';           cclose(iocb);           return 1;       }           strcpy(string,"N/A");           return 0;}