home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377a.lha / libraries / exec / tasks / liblist.c next >
Encoding:
C/C++ Source or Header  |  1980-02-04  |  2.4 KB  |  64 lines

  1. ;/* liblist.c - Execute me to compile me with Lattice 5.04
  2. LC -b1 -cfistq -v -y -j73 liblist.c
  3. Blink FROM LIB:c.o,liblist.o TO liblist LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. */
  6.  
  7. /* LibList.c - lists libraries currently in system
  8.  *
  9.  * Copyright (c) 1990 Commodore-Amiga, Inc.
  10.  *
  11.  * This example is provided in electronic form by Commodore-Amiga, Inc. for
  12.  * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals. 
  13.  * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  14.  * information on the correct usage of the techniques and operating system
  15.  * functions presented in this example.  The source and executable code of
  16.  * this example may only be distributed in free electronic form, via bulletin
  17.  * board or as part of a fully non-commercial and freely redistributable
  18.  * diskette.  Both the source and executable code (including comments) must
  19.  * be included, without modification, in any copy.  This example may not be
  20.  * published in printed form or distributed with any commercial product.
  21.  * However, the programming techniques and support routines set forth in
  22.  * this example may be used in the development of original executable
  23.  * software products for Commodore Amiga computers.
  24.  * All other rights reserved.
  25.  * This example is provided "as-is" and is subject to change; no warranties
  26.  * are made.  All use is at your own risk.  No liability or responsibility
  27.  * is assumed.
  28.  */
  29.  
  30. #include <exec/types.h>
  31. #include <exec/execbase.h>
  32. #include <exec/libraries.h>
  33. #ifdef LATTICE
  34. #include <proto/all.h>
  35. #include <stdlib.h>
  36. #include <stdio.h>
  37. int CXBRK(void) { return(0); }        /* Disable Lattice CTRL/C handling */
  38. int chkabort(void) { return(0); }    /* really */
  39. #endif
  40.  
  41. #define ARRAYSIZE 64L
  42. extern struct ExecBase *SysBase;
  43.  
  44. void main(int argc,char **argv)
  45.     {
  46.     struct Library *lib;   
  47.     ULONG count = 0L, k;
  48.     char *names[ARRAYSIZE];
  49.  
  50.     Forbid();
  51.     /* Note - printing within Forbid() would break the forbidden state */
  52.     for ( lib = (struct Library *)SysBase->LibList.lh_Head;
  53.           NULL != lib->lib_Node.ln_Succ;
  54.           lib = (struct Library *)lib->lib_Node.ln_Succ)
  55.         {
  56.         if (count < ARRAYSIZE) names[count++] = lib->lib_Node.ln_Name;
  57.         }
  58.     Permit();
  59.  
  60.     printf("Libraries currently in system:\n");
  61.     for (k=0; k<count; k++) printf(" %s\n",names[k]);    
  62.     if (count == ARRAYSIZE) printf("Error: array overflow\n");
  63.     }
  64.