xref: /openbsd-src/gnu/usr.bin/cvs/windows-NT/stripslash.c (revision 461cc63e7458ce60db55037c1a7656349538b52f)
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 #include <string.h>
151e72d8d2Sderaadt 
161e72d8d2Sderaadt /* Remove trailing slashes from PATH. */
171e72d8d2Sderaadt 
181e72d8d2Sderaadt void
strip_trailing_slashes(path)191e72d8d2Sderaadt strip_trailing_slashes (path)
201e72d8d2Sderaadt      char *path;
211e72d8d2Sderaadt {
221e72d8d2Sderaadt   int last;
231e72d8d2Sderaadt 
241e72d8d2Sderaadt   last = strlen (path) - 1;
251e72d8d2Sderaadt   while (last > 0 && (path[last] == '/' || path[last] == '\\'))
261e72d8d2Sderaadt     path[last--] = '\0';
271e72d8d2Sderaadt }
28