home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / comm / bbs / eazybbs / source / exist.c < prev    next >
C/C++ Source or Header  |  1994-03-12  |  536b  |  35 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dos/dos.h>
  4. #include <exec/memory.h>
  5. #include <proto/dos.h>
  6. #include <proto/exec.h>
  7.  
  8.  
  9.  
  10. int main (int argc, char *argv[])
  11. {
  12.     long howmany = 0;
  13.  
  14.     if (argc == 2) {
  15.         struct AnchorPath *ap;
  16.  
  17.         if (ap = AllocVec (sizeof (struct AnchorPath), MEMF_PUBLIC | MEMF_CLEAR)) {
  18.             long err;
  19.  
  20.             for (err = MatchFirst (argv[1], ap); err == 0; err = MatchNext (ap)) {
  21.                 ++howmany;
  22.             }
  23.  
  24.             if (err == ERROR_OBJECT_IN_USE)
  25.                 ++howmany;
  26.  
  27.             MatchEnd (ap);
  28.  
  29.             FreeVec (ap);
  30.         }
  31.     }
  32.  
  33.     exit (howmany);
  34. }
  35.