Mercurial > hg > octave-kai > gnulib-hg
annotate lib/stripslash.c @ 10690:01f3623813da
Split winsock.c into many smaller files.
* lib/close.c: Add _gl_close_fd_maybe_socket from winsock.c.
* lib/accept.c: New file, based on winsock.c.
* lib/bind.c: New file, based on winsock.c.
* lib/connect.c: New file, based on winsock.c.
* lib/getpeername.c: New file, based on winsock.c.
* lib/getsockname.c: New file, based on winsock.c.
* lib/getsockopt.c: New file, based on winsock.c.
* lib/ioctl.c: New file, based on winsock.c.
* lib/listen.c: New file, based on winsock.c.
* lib/recv.c: New file, based on winsock.c.
* lib/recvfrom.c: New file, based on winsock.c.
* lib/send.c: New file, based on winsock.c.
* lib/sendto.c: New file, based on winsock.c.
* lib/setsockopt.c: New file, based on winsock.c.
* lib/shutdown.c: New file, based on winsock.c.
* lib/socket.c: New file, based on winsock.c.
* lib/w32sock.h: New file, based on winsock.c.
* lib/winsock.c: Remove file.
* modules/accept: Likewise.
* modules/bind: Likewise.
* modules/connect: Likewise.
* modules/getpeername: Likewise.
* modules/getsockname: Likewise.
* modules/getsockopt: Likewise.
* modules/ioctl: Likewise.
* modules/listen: Likewise.
* modules/recv: Likewise.
* modules/recvfrom: Likewise.
* modules/send: Likewise.
* modules/sendto: Likewise.
* modules/setsockopt: Likewise.
* modules/shutdown: Likewise.
* modules/socket: Use socket.c instead of winsock.c.
* modules/sys_socket: Remove (unneeded?) dependency on winsock.c.
* doc/posix-functions/accept.texi: Doc fix.
* doc/posix-functions/bind.texi: Doc fix.
* doc/posix-functions/close.texi: Doc fix.
* doc/posix-functions/connect.texi: Doc fix.
* doc/posix-functions/getpeername.texi: Doc fix.
* doc/posix-functions/getsockname.texi: Doc fix.
* doc/posix-functions/getsockopt.texi: Doc fix.
* doc/posix-functions/ioctl.texi: Doc fix.
* doc/posix-functions/listen.texi: Doc fix.
* doc/posix-functions/recv.texi: Doc fix.
* doc/posix-functions/recvfrom.texi: Doc fix.
* doc/posix-functions/send.texi: Doc fix.
* doc/posix-functions/sendto.texi: Doc fix.
* doc/posix-functions/setsockopt.texi: Doc fix.
* doc/posix-functions/shutdown.texi: Doc fix.
* doc/posix-functions/socket.texi: Doc fix.
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Tue, 21 Oct 2008 12:17:19 +0200 |
parents | bbbbbf4cd1c5 |
children | b5e42ef33b49 |
rev | line source |
---|---|
3248
173168ae5fb5
(ISSLASH): Remove; now in dirname.h.
Jim Meyering <jim@meyering.net>
parents:
3041
diff
changeset
|
1 /* stripslash.c -- remove redundant trailing slashes from a file name |
5907 | 2 |
6912 | 3 Copyright (C) 1990, 2001, 2003-2006 Free Software Foundation, Inc. |
5 | 4 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify |
5 | 6 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
7 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
8 (at your option) any later version. |
5 | 9 |
10 This program is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 GNU General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU General Public License | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
5 | 17 |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
6912
diff
changeset
|
18 #include <config.h> |
646 | 19 |
3248
173168ae5fb5
(ISSLASH): Remove; now in dirname.h.
Jim Meyering <jim@meyering.net>
parents:
3041
diff
changeset
|
20 #include "dirname.h" |
3040
c98368348dc3
convert a > expression to the equivalent < one
Jim Meyering <jim@meyering.net>
parents:
2807
diff
changeset
|
21 |
6912 | 22 /* Remove trailing slashes from FILE. Return true if a trailing slash |
23 was removed. This is useful when using file name completion from a | |
24 shell that adds a "/" after directory names (such as tcsh and | |
25 bash), because on symlinks to directories, several system calls | |
26 have different semantics according to whether a trailing slash is | |
27 present. */ | |
5 | 28 |
5121
50bb6f95c30a
(strip_trailing_slashes): Use bool for booleans.
Paul Eggert <eggert@cs.ucla.edu>
parents:
4633
diff
changeset
|
29 bool |
5907 | 30 strip_trailing_slashes (char *file) |
5 | 31 { |
6912 | 32 char *base = last_component (file); |
33 char *base_lim; | |
34 bool had_slash; | |
35 | |
36 /* last_component returns "" for file system roots, but we need to turn | |
37 `///' into `/'. */ | |
38 if (! *base) | |
39 base = file; | |
40 base_lim = base + base_len (base); | |
41 had_slash = (*base_lim != '\0'); | |
3248
173168ae5fb5
(ISSLASH): Remove; now in dirname.h.
Jim Meyering <jim@meyering.net>
parents:
3041
diff
changeset
|
42 *base_lim = '\0'; |
173168ae5fb5
(ISSLASH): Remove; now in dirname.h.
Jim Meyering <jim@meyering.net>
parents:
3041
diff
changeset
|
43 return had_slash; |
5 | 44 } |