home *** CD-ROM | disk | FTP | other *** search
/ YPA: Your Privacy Assured / YPA.ISO / other_goodies / utilities / amigaguid.lha / AmigaGuide / AG_V39 / Source / HyperBrowser / device.c < prev    next >
C/C++ Source or Header  |  1993-01-08  |  2KB  |  61 lines

  1. /* device.c
  2.  *
  3.  * (c) Copyright 1992 Commodore-Amiga, Inc.  All rights reserved.
  4.  *
  5.  * This software is provided as-is and is subject to change; no warranties
  6.  * are made.  All use is at your own risk.  No liability or responsibility
  7.  * is assumed.
  8.  *
  9.  */
  10.  
  11. #include "hyperbrowser.h"
  12.  
  13. /*****************************************************************************/
  14.  
  15. void showdevicelist (struct GlobalData * gd)
  16. {
  17.     struct ExecBase *SysBase = (*((struct ExecBase **) 4));
  18.     struct List *list = &SysBase->DeviceList;
  19.     struct Library *lib;
  20.     struct Node *node;
  21.  
  22.     /* Build the title */
  23.     strcpy (gd->gd_Node, "@{b}Device Name                      Address   Vers  Rev  Opens@{ub}\n");
  24.  
  25.     /* Build the device list */
  26.     Forbid ();
  27.     for (node = list->lh_Head; node->ln_Succ; node = node->ln_Succ)
  28.     {
  29.     lib = (struct Library *) node;
  30.     bprintf (gd, "@{\"%-30s\" link HYPERNOZY.DEVICE.(%08lx)} @{\"%08lx\" link HYPERNOZY.MEMORY.(%08lx)} %4ld %5ld %5ld\n",
  31.          lib->lib_Node.ln_Name, lib,
  32.          lib, lib, (void *) lib->lib_Version, (void *) lib->lib_Revision, (void *) lib->lib_OpenCnt);
  33.     }
  34.     Permit ();
  35. }
  36.  
  37. /*****************************************************************************/
  38.  
  39. void showdevice (struct GlobalData * gd, ULONG address)
  40. {
  41.     struct ExecBase *SysBase = (*((struct ExecBase **) 4));
  42.     struct List *list = &SysBase->DeviceList;
  43.     struct Node *node;
  44.  
  45.     /* Just in case we don't find the device */
  46.     strcpy (gd->gd_Node, "@{b}device gone@{ub}\n");
  47.  
  48.     /* Build the device list */
  49.     Forbid ();
  50.     for (node = list->lh_Head; node->ln_Succ; node = node->ln_Succ)
  51.     {
  52.     if (node == (struct Node *) address)
  53.     {
  54.         strcpy (gd->gd_Node, "@{b}Device Base@{ub}\n\n");
  55.         showlibrarybase (gd, (struct Library *) node);
  56.         break;
  57.     }
  58.     }
  59.     Permit ();
  60. }
  61.