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

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: makedosentry.c,v 1.7 1997/01/27 00:36:25 ldp Exp $
  4.     $Log: makedosentry.c,v $
  5.     Revision 1.7  1997/01/27 00:36:25  ldp
  6.     Polish
  7.  
  8.     Revision 1.6  1996/12/09 13:53:33  aros
  9.     Added empty templates for all missing functions
  10.  
  11.     Moved #include's into first column
  12.  
  13.     Revision 1.5  1996/10/24 15:50:32  aros
  14.     Use the official AROS macros over the __AROS versions.
  15.  
  16.     Revision 1.4  1996/10/10 13:20:50  digulla
  17.     Use dol_DevName(STRPTR) instead of dol_Name(BSTR) (Fleischer)
  18.  
  19.     Revision 1.3  1996/08/13 13:52:49  digulla
  20.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  21.     Replaced AROS_LA by AROS_LHA
  22.  
  23.     Revision 1.2  1996/08/01 17:40:54  digulla
  24.     Added standard header for all files
  25.  
  26.     Desc:
  27.     Lang: english
  28. */
  29. #include <exec/memory.h>
  30. #include <proto/exec.h>
  31. #include "dos_intern.h"
  32.  
  33. /*****************************************************************************
  34.  
  35.     NAME */
  36. #include <proto/dos.h>
  37.  
  38.     AROS_LH2(struct DosList *, MakeDosEntry,
  39.  
  40. /*  SYNOPSIS */
  41.     AROS_LHA(STRPTR, name, D1),
  42.     AROS_LHA(LONG,   type, D2),
  43.  
  44. /*  LOCATION */
  45.     struct DosLibrary *, DOSBase, 116, Dos)
  46.  
  47. /*  FUNCTION
  48.     Create an entry for the dos list. Depending on the type this may
  49.     be a device a volume or an assign node.
  50.  
  51.     INPUTS
  52.     name - pointer to name
  53.     type - type of list entry to create
  54.  
  55.     RESULT
  56.  
  57.     NOTES
  58.  
  59.     EXAMPLE
  60.  
  61.     BUGS
  62.  
  63.     SEE ALSO
  64.  
  65.     INTERNALS
  66.  
  67.     HISTORY
  68.     29-10-95    digulla automatically created from
  69.                 dos_lib.fd and clib/dos_protos.h
  70.  
  71. *****************************************************************************/
  72. {
  73.     AROS_LIBFUNC_INIT
  74.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  75.  
  76.     STRPTR s2, s3;
  77.     struct DosList *dl;
  78.  
  79.     dl=(struct DosList *)AllocMem(sizeof(struct DosList),MEMF_PUBLIC|MEMF_CLEAR);
  80.     if(dl!=NULL)
  81.     {
  82.     s2=name;
  83.     while(*s2++)
  84.         ;
  85.     s3=(STRPTR)AllocMem(s2-name+1,MEMF_PUBLIC);
  86.     if(s3!=NULL)
  87.     {
  88.         /* Compatibility */
  89.         dl->dol_OldName=MKBADDR(s3);
  90.         *s3++=s2-name>256?255:s2-name-1;
  91.  
  92.         CopyMem(name,s3,s2-name);
  93.         dl->dol_DevName=s3;
  94.         dl->dol_Type=type;
  95.         return dl;
  96.     }
  97.     FreeMem(dl,sizeof(struct DosList));
  98.     }
  99.     return NULL;
  100.     AROS_LIBFUNC_EXIT
  101. } /* MakeDosEntry */
  102.