home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 595.lha / MountStuff / IsMount.c < prev    next >
C/C++ Source or Header  |  1990-10-17  |  1KB  |  49 lines

  1.  
  2. #include <exec/types.h>
  3. #include <libraries/dosextens.h>
  4. #include "hh:moredos.h"
  5. #include "hh:template.h"
  6.  
  7. /*************************************************************/
  8. /*                 NeonSoft (C) 06-04-'88                    */
  9. /*                 IsMount.c                                 */
  10. /*                                                           */
  11. /* CAL IsMount LN:MoreDos.o                                  */
  12. /*************************************************************/
  13.  
  14. TEXT *dv;
  15.  
  16. TEMPLATE Template[] = {
  17.    { A_FLAG, "DEV", &dv },
  18.    { EOTP }
  19. };
  20.  
  21. extern struct DosLibrary *DOSBase;
  22.  
  23.  VOID
  24. program()
  25. {
  26.  struct RootNode   *rn;
  27.  struct DosInfo    *di;
  28.  struct DeviceList *dl;
  29.  
  30.  rn = DOSBase->dl_Root;
  31.  di = BADDR(rn->rn_Info);
  32.  
  33.  if (!(dl=FindDevice(di->di_DevInfo,dv))) {
  34.     if (FindDevice(di->di_Devices,dv)) {
  35.        printf("Warning, %ls is unmounted!\n",dv);
  36.        quit(RETURN_WARN);
  37.     } else {
  38.        printf("Error, %ls not found!\n",dv);
  39.        quit(RETURN_FAIL);
  40.     }
  41.  } else if (((struct DeviceList *)BADDR(dl))->dl_Type!=DLT_DEVICE) {
  42.     printf("Warning, %ls not a device!\n",dv);
  43.     quit(RETURN_ERROR);
  44.  }
  45.  
  46.  quit(RETURN_OK);
  47. }
  48.  
  49.