11e72d8d2Sderaadt /* stripslash.c -- remove trailing slashes from a string 21e72d8d2Sderaadt Copyright (C) 1990 Free Software Foundation, Inc. 31e72d8d2Sderaadt 41e72d8d2Sderaadt This program is free software; you can redistribute it and/or modify 51e72d8d2Sderaadt it under the terms of the GNU General Public License as published by 61e72d8d2Sderaadt the Free Software Foundation; either version 2, or (at your option) 71e72d8d2Sderaadt any later version. 81e72d8d2Sderaadt 91e72d8d2Sderaadt This program is distributed in the hope that it will be useful, 101e72d8d2Sderaadt but WITHOUT ANY WARRANTY; without even the implied warranty of 111e72d8d2Sderaadt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12*461cc63eStholo GNU General Public License for more details. */ 131e72d8d2Sderaadt 141e72d8d2Sderaadt #ifdef HAVE_CONFIG_H 151e72d8d2Sderaadt #include "config.h" 161e72d8d2Sderaadt #endif 171e72d8d2Sderaadt 181e72d8d2Sderaadt #if STDC_HEADERS || HAVE_STRING_H 191e72d8d2Sderaadt #include <string.h> 201e72d8d2Sderaadt /* An ANSI string.h and pre-ANSI memory.h might conflict. */ 211e72d8d2Sderaadt #if !STDC_HEADERS && HAVE_MEMORY_H 221e72d8d2Sderaadt #include <memory.h> 231e72d8d2Sderaadt #endif /* not STDC_HEADERS and HAVE_MEMORY_H */ 241e72d8d2Sderaadt #else /* not STDC_HJEADERS and not HAVE_STRING_H */ 251e72d8d2Sderaadt #include <strings.h> 261e72d8d2Sderaadt /* memory.h and strings.h conflict on some systems. */ 271e72d8d2Sderaadt #endif /* not STDC_HEADERS and not HAVE_STRING_H */ 281e72d8d2Sderaadt 291e72d8d2Sderaadt /* Remove trailing slashes from PATH. */ 301e72d8d2Sderaadt 311e72d8d2Sderaadt void strip_trailing_slashes(path)321e72d8d2Sderaadtstrip_trailing_slashes (path) 331e72d8d2Sderaadt char *path; 341e72d8d2Sderaadt { 351e72d8d2Sderaadt int last; 361e72d8d2Sderaadt 371e72d8d2Sderaadt last = strlen (path) - 1; 381e72d8d2Sderaadt while (last > 0 && path[last] == '/') 391e72d8d2Sderaadt path[last--] = '\0'; 401e72d8d2Sderaadt } 41