1*1e72d8d2Sderaadt /* stripslash.c -- remove trailing slashes from a string 2*1e72d8d2Sderaadt Copyright (C) 1990 Free Software Foundation, Inc. 3*1e72d8d2Sderaadt 4*1e72d8d2Sderaadt This program is free software; you can redistribute it and/or modify 5*1e72d8d2Sderaadt it under the terms of the GNU General Public License as published by 6*1e72d8d2Sderaadt the Free Software Foundation; either version 2, or (at your option) 7*1e72d8d2Sderaadt any later version. 8*1e72d8d2Sderaadt 9*1e72d8d2Sderaadt This program is distributed in the hope that it will be useful, 10*1e72d8d2Sderaadt but WITHOUT ANY WARRANTY; without even the implied warranty of 11*1e72d8d2Sderaadt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*1e72d8d2Sderaadt GNU General Public License for more details. 13*1e72d8d2Sderaadt 14*1e72d8d2Sderaadt You should have received a copy of the GNU General Public License 15*1e72d8d2Sderaadt along with this program; if not, write to the Free Software 16*1e72d8d2Sderaadt Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 17*1e72d8d2Sderaadt 18*1e72d8d2Sderaadt #ifdef HAVE_CONFIG_H 19*1e72d8d2Sderaadt #include "config.h" 20*1e72d8d2Sderaadt #endif 21*1e72d8d2Sderaadt 22*1e72d8d2Sderaadt #if STDC_HEADERS || HAVE_STRING_H 23*1e72d8d2Sderaadt #include <string.h> 24*1e72d8d2Sderaadt /* An ANSI string.h and pre-ANSI memory.h might conflict. */ 25*1e72d8d2Sderaadt #if !STDC_HEADERS && HAVE_MEMORY_H 26*1e72d8d2Sderaadt #include <memory.h> 27*1e72d8d2Sderaadt #endif /* not STDC_HEADERS and HAVE_MEMORY_H */ 28*1e72d8d2Sderaadt #else /* not STDC_HJEADERS and not HAVE_STRING_H */ 29*1e72d8d2Sderaadt #include <strings.h> 30*1e72d8d2Sderaadt /* memory.h and strings.h conflict on some systems. */ 31*1e72d8d2Sderaadt #endif /* not STDC_HEADERS and not HAVE_STRING_H */ 32*1e72d8d2Sderaadt 33*1e72d8d2Sderaadt /* Remove trailing slashes from PATH. */ 34*1e72d8d2Sderaadt 35*1e72d8d2Sderaadt void 36*1e72d8d2Sderaadt strip_trailing_slashes (path) 37*1e72d8d2Sderaadt char *path; 38*1e72d8d2Sderaadt { 39*1e72d8d2Sderaadt int last; 40*1e72d8d2Sderaadt 41*1e72d8d2Sderaadt last = strlen (path) - 1; 42*1e72d8d2Sderaadt while (last > 0 && path[last] == '/') 43*1e72d8d2Sderaadt path[last--] = '\0'; 44*1e72d8d2Sderaadt } 45