1*2286d8edStholo /* stripslash.c -- remove trailing slashes from a string 2*2286d8edStholo Copyright (C) 1990 Free Software Foundation, Inc. 3*2286d8edStholo 4*2286d8edStholo This program is free software; you can redistribute it and/or modify 5*2286d8edStholo it under the terms of the GNU General Public License as published by 6*2286d8edStholo the Free Software Foundation; either version 2, or (at your option) 7*2286d8edStholo any later version. 8*2286d8edStholo 9*2286d8edStholo This program is distributed in the hope that it will be useful, 10*2286d8edStholo but WITHOUT ANY WARRANTY; without even the implied warranty of 11*2286d8edStholo MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*2286d8edStholo GNU General Public License for more details. */ 13*2286d8edStholo 14*2286d8edStholo #include <string.h> 15*2286d8edStholo 16*2286d8edStholo /* Remove trailing slashes from PATH. */ 17*2286d8edStholo 18*2286d8edStholo void strip_trailing_slashes(path)19*2286d8edStholostrip_trailing_slashes (path) 20*2286d8edStholo char *path; 21*2286d8edStholo { 22*2286d8edStholo int last; 23*2286d8edStholo 24*2286d8edStholo last = strlen (path) - 1; 25*2286d8edStholo while (last > 0 && (path[last] == '/' || path[last] == '\\')) 26*2286d8edStholo path[last--] = '\0'; 27*2286d8edStholo } 28