home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / batch / dosreqtools / dosextensions / extsrc / filepart.c < prev    next >
C/C++ Source or Header  |  1994-11-26  |  535b  |  36 lines

  1. #include <dos/dos.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4.  
  5. main (int argc, char **argv)
  6. {
  7.   int retval = 0;
  8.  
  9.   if (argc == 2)
  10.     {
  11.       char buf[256], *bufptr;
  12.  
  13.       strcpy (buf, argv[1]);
  14.  
  15.       if (bufptr = strrchr (buf, '/'))
  16.     *bufptr++;
  17.       else if  (bufptr = strrchr (buf, ':'))
  18.     *bufptr++ = '\000';
  19.       else
  20.     bufptr = buf;
  21.  
  22.       fprintf (stdout, "%s\000", bufptr);
  23.  
  24.       retval = 0;
  25.     }
  26.   else
  27.     {
  28.       fprintf (stderr, "usage: %s path/filename\n", argv[0]);
  29.  
  30.       retval = 10;
  31.     }
  32.  
  33.   return (retval);
  34.      
  35. }
  36.