home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / unix / grep1_5.zoo / msdosmac.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-21  |  704 b   |  31 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. #include <string.h>
  6. #define EXTRACT_PROGRAM_NAME(p)        \
  7.     {                    \
  8.         char    *q;            \
  9.     if (q = strrchr(p, '\\'))    \
  10.         p = q + 1;            \
  11.     if (q = strchr(p, '.'))        \
  12.         *q = '\0';            \
  13.     strlwr(p);            \
  14.     }
  15.  
  16.  
  17.  
  18. /*
  19.  * The macro CONVERT_TO_SLASHES(p) converts all backslashes in a pathname
  20.  * to forward slashes.  As a nice extra effect, it converts upper case to
  21.  * lower case.
  22.  */
  23. #define CONVERT_TO_SLASHES(p)        \
  24.     {                    \
  25.     char    *q;            \
  26.     for (q = p; *q; ++q)        \
  27.         if (*q == '\\')        \
  28.         *q = '/';        \
  29.     strlwr(p);            \
  30.     }
  31.