home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 595.lha / MountStuff / ReMount.c < prev    next >
C/C++ Source or Header  |  1990-10-17  |  1KB  |  52 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) 16-08-'88                    */
  9. /*                 ReMount.c                                 */
  10. /*************************************************************/
  11.  
  12. TEXT *dv;
  13.  
  14. TEMPLATE Template[] = {
  15.    { A_FLAG, "DEV", &dv },
  16.    { EOTP }
  17. };
  18.  
  19. extern struct DosLibrary *DOSBase;
  20.  
  21.  
  22.  VOID
  23. program()
  24. {
  25.  struct RootNode   *rn;
  26.  struct DosInfo    *di;
  27.  struct DeviceList *dl;
  28.  
  29.  rn = DOSBase->dl_Root;
  30.  di = BADDR(rn->rn_Info);
  31.  
  32.  if (!(dl=FindDevice(di->di_Devices,dv))) {
  33.     if (dl=FindDevice(di->di_DevInfo,dv)) {
  34.        if (((struct DeviceList *)BADDR(dl))->dl_Type!=DLT_DEVICE) {
  35.           printf("Error, %ls not a device!\n",dv);
  36.           quit(RETURN_ERROR);
  37.        } else {
  38.           printf("Error, %ls already mounted!\n",dv);
  39.           quit(RETURN_WARN);
  40.        }
  41.     } else {
  42.        printf("Error, %ls not found!\n",dv);
  43.        quit(RETURN_FAIL);
  44.     }
  45.  }
  46.  
  47.  InsertDevice(&di->di_DevInfo,RemoveDevice(&di->di_Devices,dl));
  48.  
  49.  quit(RETURN_OK);
  50. }
  51.  
  52.