home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- * libraries.c
- * print the names of resident libraries, along with their vital statistics.
- * Author: SDB
- ************************************************************************/
-
- #include <exec/types.h>
- #include <exec/exec.h>
- #include <exec/execbase.h>
-
- #define MAXLIBS 100
- #define MAXSTR 100
-
- IMPORT struct ExecBase *SysBase;
-
- struct LibInfo {
- UWORD li_VecSize;
- UWORD li_DataSize;
- UWORD li_Version;
- UWORD li_Revision;
- UWORD li_Opens;
- BYTE li_Name[MAXSTR];
- BYTE li_ID[MAXSTR];
- };
-
- struct LibInfo li[MAXLIBS];
- UWORD lib_count = 0;
-
- char *format_string = "%-17s %4ld %4d %4d %4d %4d\n";
-
- main()
- {
- struct Library *lib;
- REGISTER UWORD i;
- REGISTER struct LibInfo *info = &li[0];
-
- Forbid();
- lib = (struct Library *)SysBase->LibList.lh_Head;
- for ( ; lib->lib_Node.ln_Succ && lib_count < MAXLIBS;
- lib = (struct Library *)lib->lib_Node.ln_Succ, lib_count++, info++)
- {
- strncpy(info->li_Name, lib->lib_Node.ln_Name, MAXSTR);
- strncpy(info->li_ID, (char *)lib->lib_IdString, MAXSTR);
- info->li_VecSize = lib->lib_NegSize;
- info->li_DataSize = lib->lib_PosSize;
- info->li_Version = lib->lib_Version;
- info->li_Revision = lib->lib_Revision;
- info->li_Opens = lib->lib_OpenCnt;
- }
- Permit();
- printf(
- "Name #Vectors Data Version Revison Opens\n");
- printf(
- "=====================================================\n");
- info = &li[0];
- for (i = 0; i < lib_count; i++, info++)
- printf(format_string, info->li_Name,
- (info->li_VecSize / LIB_VECTSIZE),
- info->li_DataSize,
- info->li_Version,
- info->li_Revision,
- info->li_Opens );
- printf("\nLibraries with ID strings:\n");
- info = &li[0];
- for (i = 0; i < lib_count; i++, info++)
- if (info->li_ID[0])
- printf("%-17s ID = %s", info->li_Name, info->li_ID);
-
- }
-