home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / unix / fgrep1_1.zoo / msdosmac.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-07  |  616 b   |  28 lines

  1. /*
  2.  * The macro EXTRACT_PROGRAM_NAME(p) converts an MSDOS style argument 0
  3.  * full path program name to a nice, Un*x style argument 0 program name.
  4.  */
  5. #define EXTRACT_PROGRAM_NAME(p)        \
  6.     {                    \
  7.     char *q, *strchr(), *strrchr();    \
  8.     if (q = strrchr(p, '\\'))    \
  9.         p = q + 1;            \
  10.     if (q = strchr(p, '.'))        \
  11.         *q = '\0';            \
  12.     strlwr(p);            \
  13.     }
  14.  
  15.  
  16.  
  17. /*
  18.  * The macro CONVERT_TO_SLASHES(p) converts all backslashes in a pathname
  19.  * to forward slashes.
  20.  */
  21. #define CONVERT_TO_SLASHES(p)        \
  22.     {                    \
  23.     char    *q;            \
  24.     for (q = p; *q; ++q)        \
  25.         if (*q == '\\')        \
  26.         *q = '/';        \
  27.     }
  28.