xref: /openbsd-src/gnu/usr.bin/cvs/os2/stripslash.c (revision 461cc63e7458ce60db55037c1a7656349538b52f)
113571821Stholo /* stripslash.c -- remove trailing slashes from a string
213571821Stholo    Copyright (C) 1990 Free Software Foundation, Inc.
313571821Stholo 
413571821Stholo    This program is free software; you can redistribute it and/or modify
513571821Stholo    it under the terms of the GNU General Public License as published by
613571821Stholo    the Free Software Foundation; either version 2, or (at your option)
713571821Stholo    any later version.
813571821Stholo 
913571821Stholo    This program is distributed in the hope that it will be useful,
1013571821Stholo    but WITHOUT ANY WARRANTY; without even the implied warranty of
1113571821Stholo    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*461cc63eStholo    GNU General Public License for more details.  */
1313571821Stholo 
1413571821Stholo #include <string.h>
1513571821Stholo 
1613571821Stholo /* Remove trailing slashes from PATH. */
1713571821Stholo 
1813571821Stholo void
strip_trailing_slashes(path)1913571821Stholo strip_trailing_slashes (path)
2013571821Stholo      char *path;
2113571821Stholo {
2213571821Stholo   int last;
2313571821Stholo 
2413571821Stholo   last = strlen (path) - 1;
2513571821Stholo   while (last > 0 && (path[last] == '/' || path[last] == '\\'))
2613571821Stholo     path[last--] = '\0';
2713571821Stholo }
28