home *** CD-ROM | disk | FTP | other *** search
/ ANews 1 / AnewsCD01.iso / Indispensables / Compression / xad / Developer / Sources / tools / xadLibInfo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-09  |  3.7 KB  |  138 lines

  1. #define NAME         "xadLibInfo"
  2. #define DISTRIBUTION "(Freeware) "
  3. #define REVISION     "1"
  4.  
  5. /* Programmheader
  6.  
  7.     Name:        xadLibInfo
  8.     Author:        SDI
  9.     Distribution:    Freeware
  10.     Description:    show informations about xad Clients
  11.     Compileropts:    -
  12.     Linkeropts:    -gsi -l amiga
  13.  
  14.  1.0   18.11.98 : first version
  15.  1.1   30.06.99 : added XADCF_FREE flags
  16. */
  17.  
  18. #include <proto/xadmaster.h>
  19. #include <proto/exec.h>
  20. #include <proto/dos.h>
  21. #include <dos/dosasl.h>
  22. #include "SDI_defines.h"
  23.  
  24. #ifdef __SASC
  25.   #define dosbase     DOSBase 
  26.   #define xadmasterbase     xadMasterBase 
  27.   #define ASSIGN_DOS
  28.   #define ASSIGN_XAD
  29.   #define ASSIGN_SYS     struct ExecBase * SysBase; \
  30.              SysBase = (*((struct ExecBase **) 4));
  31. #else
  32.   struct DosLibrary *     DOSBase = 0;
  33.   struct ExecBase *     SysBase  = 0;
  34.   struct xadMasterBase * xadMasterBase = 0;
  35.  
  36.   #define ASSIGN_DOS     DOSBase = dosbase;
  37.   #define ASSIGN_XAD     xadMasterBase = xadmasterbase;
  38.   #define ASSIGN_SYS     SysBase = (*((struct ExecBase **) 4));
  39. #endif
  40.  
  41. ULONG start(void)
  42. {
  43.   ULONG ret = RETURN_FAIL;
  44.   struct DosLibrary *dosbase;
  45.  
  46.   ASSIGN_SYS
  47.   { /* test for WB and reply startup-message */
  48.     struct Process *task;
  49.     if(!(task = (struct Process *) FindTask(0))->pr_CLI)
  50.     {
  51.       WaitPort(&task->pr_MsgPort);
  52.       Forbid();
  53.       ReplyMsg(GetMsg(&task->pr_MsgPort));
  54.       return RETURN_FAIL;
  55.     }
  56.   }
  57.  
  58.   if((dosbase = (struct DosLibrary *) OpenLibrary("dos.library", 37)))
  59.   {
  60.     struct xadMasterBase *xadmasterbase;
  61.     ASSIGN_DOS
  62.     if((xadmasterbase = (struct xadMasterBase *) 
  63.     OpenLibrary("xadmaster.library", 1)))
  64.     {
  65.       ULONG fl;
  66.       struct xadClient *xc;
  67.  
  68.       ASSIGN_XAD
  69.       ret = 0;
  70.       if((xc = xadGetClientInfo()))
  71.         Printf("\033[4mClients of xadmaster.library %ld.%ld\033[0m\n\n"
  72.     "Name                                    |  ID  | MV |  VER  | Flags\n"
  73.     "----------------------------------------+------+----+-------+---------------\n",
  74.     xadmasterbase->xmb_LibNode.lib_Version,
  75.     xadmasterbase->xmb_LibNode.lib_Revision);
  76.       
  77.       while(xc && !CTRL_C)
  78.       {
  79.         fl = xc->xc_Flags;
  80.  
  81.         Printf("%-40s| ", xc->xc_ArchiverName);
  82.         Printf(xc->xc_Identifier ? "%04ld" : "----", xc->xc_Identifier);
  83.         Printf(" | %2ld |%3ld.%ld%s| ", xc->xc_MasterVersion,
  84.         xc->xc_ClientVersion, xc->xc_ClientRevision, xc->xc_ClientRevision
  85.         >= 100 ? "" : xc->xc_ClientRevision >= 10 ? " " : "  ");
  86.         if(fl & XADCF_FILEARCHIVER)
  87.         {
  88.           fl &= ~XADCF_FILEARCHIVER;
  89.           Printf("FILEARCHIVER%s", fl ? "," : "");
  90.         }
  91.         if(fl & XADCF_DISKARCHIVER)
  92.         {
  93.           fl &= ~XADCF_DISKARCHIVER;
  94.           Printf("DISKARCHIVER%s", fl ? "," : "");
  95.         }
  96.         if(fl & XADCF_EXTERN)
  97.         {
  98.           fl &= ~XADCF_EXTERN;
  99.           Printf("EXTERN%s", fl ? "," : "");
  100.         }
  101.         fl &= XADCF_FREEFILEINFO|XADCF_FREEDISKINFO|XADCF_FREETEXTINFO|XADCF_FREETEXTINFOTEXT;
  102.         if(fl)
  103.         {
  104.           Printf("FREE(");
  105.           if(fl & XADCF_FREEFILEINFO)
  106.           {
  107.             fl &= ~XADCF_FREEFILEINFO;
  108.             Printf("FI%s", fl ? "," : ")");
  109.           }
  110.           if(fl & XADCF_FREEDISKINFO)
  111.           {
  112.             fl &= ~XADCF_FREEDISKINFO;
  113.             Printf("DI%s", fl ? "," : ")");
  114.           }
  115.           if(fl & XADCF_FREETEXTINFO)
  116.           {
  117.             fl &= ~XADCF_FREETEXTINFO;
  118.             Printf("TI%s", fl ? "," : ")");
  119.           }
  120.           if(fl & XADCF_FREETEXTINFOTEXT)
  121.             Printf("TEXT)");
  122.         }
  123.  
  124.         Printf("\n");
  125.     xc = xc->xc_Next;
  126.       }
  127.       if(CTRL_C)
  128.         PrintFault(ERROR_BREAK,0 );
  129.  
  130.       CloseLibrary((struct Library *) xadmasterbase);
  131.     }
  132.     else
  133.       Printf("Could not open xadmaster.library\n");
  134.     CloseLibrary((struct Library *) dosbase);
  135.   }
  136.   return ret;
  137. }
  138.