home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / pas_sdk1 / pas-sdk1.arj / PAS / CDROMAPP / CDRESET.C < prev    next >
C/C++ Source or Header  |  1992-10-02  |  1KB  |  72 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dos.h>
  4.  
  5. #define OKAY 0
  6.  
  7. #include "cdmaster.h"
  8.  
  9. char *syntax= "Syntax: cdreset [drive #].\n";
  10. char *nodrives= "No CDROM drives attached.\n";
  11. char *nomscdex= "MSCDEX is not installed.\n";
  12.  
  13. main(int argc, char **argv)
  14. {
  15.     int numcdroms= 0;
  16.     int ourdrive= 0;
  17.     struct cdtable *cdt;
  18.  
  19.     if (!ismscdex())
  20.         {
  21.         fprintf(stderr, nomscdex);
  22.         return(1);
  23.         }
  24.  
  25.     if (!(numcdroms= getnumcdroms()))
  26.         {
  27.         fprintf(stderr, nodrives);
  28.         return(2);
  29.         }
  30.  
  31.     switch (argc)
  32.         {
  33.         case 2:
  34.             if (argv[1][0] != '.')
  35.                 {
  36.                 if (!(ourdrive= atoi(argv[1])))
  37.                     {
  38.                     fprintf(stderr, syntax);
  39.                     return(3);
  40.                     }
  41.                 break;
  42.                 }
  43.  
  44.         case 1:
  45.             if (!(ourdrive= getfirstcdrom()))
  46.                 {
  47.                 fprintf(stderr, nodrives);
  48.                 return(4);
  49.                 }
  50.             break;
  51.  
  52.         default:
  53.             fprintf(stderr, syntax);
  54.             return(5);
  55.         }
  56.  
  57.     printf("reset drive: %2d ", ourdrive);
  58.  
  59.     if (cdt= createaudiotoc(ourdrive))
  60.         {
  61.         int status= cdreset(ourdrive);
  62.         printf("= %X.\n", status);
  63.         destroyaudiotoc(ourdrive);
  64.         }
  65.     else
  66.         printf("failed, no initialization.\n");
  67.  
  68.     return(OKAY);
  69. }
  70.  
  71.  
  72.