home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / MNLDOS.ZIP / src / osgenrms.c < prev    next >
C/C++ Source or Header  |  2004-07-11  |  495b  |  23 lines

  1. /* $Id: osgenrms.c,v 1.2 2004/07/11 09:29:14 ozzmosis Exp $ */
  2.  
  3. /* remove slash/backslash from last part of path name, if present */
  4. char *os_remove_slash(char *path1)
  5. {
  6.     char *p;
  7.     char *path = path1;
  8.  
  9.     if (!path)
  10.         return NULL;
  11.  
  12.     if (*path && path[1] == ':')
  13.         path += 2;              /* skip drive letter */
  14.  
  15.     if ((p = strchr(path, '\0')) > path)
  16.     {
  17.         p--;
  18.         if (p > path && (*p == '\\' || *p == '/'))
  19.             *p = '\0';
  20.     }
  21.     return path1;
  22. }
  23.