home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / dos / format.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-27  |  2.4 KB  |  109 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: format.c,v 1.5 1997/01/27 00:36:20 ldp Exp $
  4.     $Log: format.c,v $
  5.     Revision 1.5  1997/01/27 00:36:20  ldp
  6.     Polish
  7.  
  8.     Revision 1.4  1996/12/09 13:53:28  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.3  1996/10/24 15:50:29  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.2  1996/09/13 17:50:07  digulla
  17.     Use IPTR
  18.  
  19.     Revision 1.1  1996/09/11 12:54:45  digulla
  20.     A couple of new DOS functions from M. Fleischer
  21.  
  22.     Desc:
  23.     Lang: english
  24. */
  25. #include <proto/exec.h>
  26. #include <dos/dosextens.h>
  27. #include <dos/filesystem.h>
  28. #include "dos_intern.h"
  29.  
  30. /*****************************************************************************
  31.  
  32.     NAME */
  33. #include <proto/dos.h>
  34.  
  35.     AROS_LH3(BOOL, Format,
  36.  
  37. /*  SYNOPSIS */
  38.     AROS_LHA(STRPTR, devicename, D1),
  39.     AROS_LHA(STRPTR, volumename, D2),
  40.     AROS_LHA(ULONG,  dostype,    D3),
  41.  
  42. /*  LOCATION */
  43.     struct DosLibrary *, DOSBase, 119, Dos)
  44.  
  45. /*  FUNCTION
  46.  
  47.     INPUTS
  48.  
  49.     RESULT
  50.  
  51.     NOTES
  52.  
  53.     EXAMPLE
  54.  
  55.     BUGS
  56.  
  57.     SEE ALSO
  58.  
  59.     INTERNALS
  60.  
  61.     HISTORY
  62.     29-10-95    digulla automatically created from
  63.                 dos_lib.fd and clib/dos_protos.h
  64.  
  65. *****************************************************************************/
  66. {
  67.     AROS_LIBFUNC_INIT
  68.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  69.  
  70.     /* Get pointer to process structure */
  71.     struct Process *me=(struct Process *)FindTask(NULL);
  72.     struct DosList *dl;
  73.     BOOL success=0;
  74.  
  75.     dl=LockDosList(LDF_DEVICES|LDF_READ);
  76.     dl=FindDosEntry(dl,devicename,LDF_DEVICES);
  77.     if(dl!=NULL)
  78.     {
  79.  
  80.     /* Get pointer to I/O request. Use stackspace for now. */
  81.     struct IOFileSys io,*iofs=&io;
  82.  
  83.     /* Prepare I/O request. */
  84.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  85.     iofs->IOFS.io_Message.mn_ReplyPort   =&me->pr_MsgPort;
  86.     iofs->IOFS.io_Message.mn_Length      =sizeof(struct IOFileSys);
  87.     iofs->IOFS.io_Device =dl->dol_Device;
  88.     iofs->IOFS.io_Unit   =dl->dol_Unit;
  89.     iofs->IOFS.io_Command=FSA_FORMAT;
  90.     iofs->IOFS.io_Flags  =0;
  91.     iofs->io_Args[0]=(IPTR)volumename;
  92.     iofs->io_Args[1]=dostype;
  93.  
  94.     /* Send the request. */
  95.     DoIO(&iofs->IOFS);
  96.  
  97.     /* Set error code */
  98.     if(!iofs->io_DosError)
  99.         success=1;
  100.     else
  101.         me->pr_Result2=iofs->io_DosError;
  102.     }else
  103.     me->pr_Result2=ERROR_DEVICE_NOT_MOUNTED;
  104.     /* All Done. */
  105.     UnLockDosList(LDF_DEVICES|LDF_READ);
  106.     return success;
  107.     AROS_LIBFUNC_EXIT
  108. } /* Format */
  109.