xref: /openbsd-src/gnu/usr.bin/cvs/os2/stripslash.c (revision 13571821e83933f3c1d7fd1ab5ff9cd54f0eea7f)
1*13571821Stholo /* stripslash.c -- remove trailing slashes from a string
2*13571821Stholo    Copyright (C) 1990 Free Software Foundation, Inc.
3*13571821Stholo 
4*13571821Stholo    This program is free software; you can redistribute it and/or modify
5*13571821Stholo    it under the terms of the GNU General Public License as published by
6*13571821Stholo    the Free Software Foundation; either version 2, or (at your option)
7*13571821Stholo    any later version.
8*13571821Stholo 
9*13571821Stholo    This program is distributed in the hope that it will be useful,
10*13571821Stholo    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*13571821Stholo    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*13571821Stholo    GNU General Public License for more details.
13*13571821Stholo 
14*13571821Stholo    You should have received a copy of the GNU General Public License
15*13571821Stholo    along with this program; if not, write to the Free Software
16*13571821Stholo    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17*13571821Stholo 
18*13571821Stholo #include <string.h>
19*13571821Stholo 
20*13571821Stholo /* Remove trailing slashes from PATH. */
21*13571821Stholo 
22*13571821Stholo void
23*13571821Stholo strip_trailing_slashes (path)
24*13571821Stholo      char *path;
25*13571821Stholo {
26*13571821Stholo   int last;
27*13571821Stholo 
28*13571821Stholo   last = strlen (path) - 1;
29*13571821Stholo   while (last > 0 && (path[last] == '/' || path[last] == '\\'))
30*13571821Stholo     path[last--] = '\0';
31*13571821Stholo }
32