home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / exec / findresident.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-22  |  1.4 KB  |  79 lines

  1. /*
  2.     (C) 1995 AROS - The Amiga Replacement OS
  3.     $Id: findresident.c,v 1.4 1997/01/22 02:27:48 ldp Exp $    $Log
  4.  
  5.     Desc:
  6.     Lang: english
  7. */
  8. #include "exec_intern.h"
  9. #include <exec/resident.h>
  10. #include <proto/exec.h>
  11.  
  12. /*****************************************************************************
  13.  
  14.     NAME */
  15.  
  16.     AROS_LH1(struct Resident *, FindResident,
  17.  
  18. /*  SYNOPSIS */
  19.     AROS_LHA(UBYTE *, name, A1),
  20.  
  21. /*  LOCATION */
  22.     struct ExecBase *, SysBase, 16, Exec)
  23.  
  24. /*  FUNCTION
  25.     Search for a Resident module in the system resident list.
  26.  
  27.     INPUTS
  28.     name - pointer to the name of a Resident module to find
  29.  
  30.     RESULT
  31.     pointer to the Resident module (struct Resident *), or null if
  32.     not found.
  33.  
  34.     NOTES
  35.  
  36.     EXAMPLE
  37.  
  38.     BUGS
  39.  
  40.     SEE ALSO
  41.  
  42.     INTERNALS
  43.  
  44.     HISTORY
  45.     29-10-95    digulla automatically created from
  46.                 exec_lib.fd and clib/exec_protos.h
  47.  
  48. *****************************************************************************/
  49. {
  50.     AROS_LIBFUNC_INIT
  51.     AROS_LIBBASE_EXT_DECL(struct ExecBase *,SysBase)
  52.  
  53.     ULONG *list;
  54.  
  55.     list = SysBase->ResModules;
  56.  
  57.     if(list)
  58.     {
  59.     while(*list)
  60.     {
  61.         /*
  62.         If bit 31 is set, this doesn't point to a Resident module, but
  63.         to another list of modules.
  64.         */
  65.         if(*list & 0x80000000) list = (ULONG *)(*list & 0x7fffffff);
  66.  
  67.         if(!(strcmp( ((struct Resident *)*list)->rt_Name, name)) )
  68.         {
  69.         return (struct Resident *)*list;
  70.         }
  71.  
  72.         list++;
  73.     }
  74.     }
  75.  
  76.     return NULL;
  77.     AROS_LIBFUNC_EXIT
  78. } /* FindResident */
  79.