home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d7xx / d761 / remlib.lha / RemLib / RemLib.c < prev    next >
C/C++ Source or Header  |  1992-11-21  |  2KB  |  68 lines

  1.  
  2. #include <exec/types.h>
  3. #include <exec/libraries.h>
  4. #include <exec/execbase.h>
  5. #include <dos/dosasl.h>
  6. #include <functions.h>
  7. #include <macros/macros.h>
  8.  
  9. char *VERSION="$VER: RemLib 1.20 (2.8.92) written by H.P.G 1992";
  10.  
  11. char *Template = "LibName/M/A";
  12. char **array = NULL;
  13. struct RDArgs *CArgs;
  14. void _main(void);
  15. char *HelpText="Usage: RemLib LibName/M/A\n";
  16.  
  17. extern struct ExecBase *SysBase;
  18.  
  19. void _main(void)
  20.     {
  21.     struct Library *found=0L;
  22.     LONG index=0L;
  23.  
  24.     if (!(CArgs=(struct RDArgs *)ReadArgs(Template,(LONG *)&array,NULL) ))
  25.         {
  26.         PUTS(HelpText);
  27.         exit(10);
  28.         }
  29.  
  30.     LoopStart:
  31.  
  32.     while (array[index])
  33.         {
  34.         Forbid();
  35.         if (found = (struct Library *)
  36.         FindName((struct List *)&SysBase->LibList , array[index] )) RemLibrary(found);
  37.  
  38.         if (!found)
  39.             {
  40.             Permit();
  41.             PUTS("Library \033[32m");
  42.             PUTS(array[index]);
  43.             PUTS(" \033[31mnot found\n");
  44.             index++;
  45.             goto LoopStart;
  46.             }
  47.  
  48.         if (found = (struct Library *)FindName((struct List *)&SysBase->LibList , array[index] ))
  49.             {
  50.             PUTS("Library \033[32m");
  51.             PUTS(array[index]);
  52.             PUTS(" \033[31mcould not be removed\n");
  53.             }
  54.         else{
  55.             PUTS("Library \033[32m");
  56.             PUTS(array[index]);
  57.             PUTS(" \033[31mremoved\n");
  58.             }
  59.  
  60.         Permit();
  61.         index++;
  62.         } /* while array[index] */
  63.  
  64.         if (CArgs) FreeArgs(CArgs);
  65.         exit(0);
  66.     }
  67.  
  68.