117721Speter/* stripslash.c -- remove trailing slashes from a string
217721Speter   Copyright (C) 1990 Free Software Foundation, Inc.
317721Speter
417721Speter   This program is free software; you can redistribute it and/or modify
517721Speter   it under the terms of the GNU General Public License as published by
617721Speter   the Free Software Foundation; either version 2, or (at your option)
717721Speter   any later version.
817721Speter
917721Speter   This program is distributed in the hope that it will be useful,
1017721Speter   but WITHOUT ANY WARRANTY; without even the implied warranty of
1117721Speter   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1225839Speter   GNU General Public License for more details.  */
1317721Speter
1417721Speter#ifdef HAVE_CONFIG_H
1517721Speter#include "config.h"
1617721Speter#endif
1717721Speter
1817721Speter#if STDC_HEADERS || HAVE_STRING_H
1917721Speter#include <string.h>
2017721Speter/* An ANSI string.h and pre-ANSI memory.h might conflict. */
2117721Speter#if !STDC_HEADERS && HAVE_MEMORY_H
2217721Speter#include <memory.h>
2317721Speter#endif /* not STDC_HEADERS and HAVE_MEMORY_H */
2417721Speter#else /* not STDC_HJEADERS and not HAVE_STRING_H */
2517721Speter#include <strings.h>
2617721Speter/* memory.h and strings.h conflict on some systems. */
2717721Speter#endif /* not STDC_HEADERS and not HAVE_STRING_H */
2817721Speter
2917721Speter/* Remove trailing slashes from PATH. */
3017721Speter
3117721Spetervoid
3217721Speterstrip_trailing_slashes (path)
3317721Speter     char *path;
3417721Speter{
3517721Speter  int last;
3617721Speter
3717721Speter  last = strlen (path) - 1;
3817721Speter  while (last > 0 && path[last] == '/')
3917721Speter    path[last--] = '\0';
4017721Speter}
41