[svn] Doc fix.

This commit is contained in:
hniksic 2001-12-04 15:42:18 -08:00
parent c9dbaba251
commit eef4527c24
4 changed files with 51 additions and 3 deletions

View File

@ -1,3 +1,13 @@
2001-12-05 Hrvoje Niksic <hniksic@arsdigita.com>
* utils.c (path_simplify): Document with test cases.
2001-12-04 Hrvoje Niksic <hniksic@arsdigita.com>
* gen_sslfunc.c: Ditto.
* rbuf.c: Include <string.h>.
2001-12-04 Hrvoje Niksic <hniksic@arsdigita.com>
* recur.c (retrieve_tree): Check whether the URL was already

View File

@ -27,6 +27,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#include <openssl/bio.h>
#include <openssl/crypto.h>

View File

@ -22,6 +22,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include <stdio.h>
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#include "wget.h"
#include "rbuf.h"

View File

@ -487,15 +487,21 @@ ps (char *orig)
Non-leading `../'s and trailing `..'s are handled by removing
portions of the path.
E.g. "a/b/c/./../d/.." will yield "a/b". This function originates
from GNU Bash.
E.g. "a/b/c/./../d/.." will yield "a/b/". This function originates
from GNU Bash and has been mutilated to unrecognition for use in
Wget.
Changes for Wget:
Always use '/' as stub_char.
Don't check for local things using canon_stat.
Change the original string instead of strdup-ing.
React correctly when beginning with `./' and `../'.
Don't zip out trailing slashes. */
Don't zip out trailing slashes.
Return a value indicating whether any modifications took place.
If you dare change this function, take a careful look at the test
cases below, and make sure that they pass. */
int
path_simplify (char *path)
{
@ -600,6 +606,28 @@ path_simplify (char *path)
return changes;
}
/* Test cases:
ps("") -> ""
ps("/") -> "/"
ps(".") -> ""
ps("..") -> ""
ps("/.") -> "/"
ps("/..") -> "/"
ps("foo") -> "foo"
ps("foo/bar") -> "foo/bar"
ps("foo//bar") -> "foo/bar" (possibly a bug)
ps("foo/../bar") -> "bar"
ps("foo/bar/..") -> "foo/"
ps("foo/bar/../x") -> "foo/x"
ps("foo/bar/../x/") -> "foo/x/"
ps("foo/..") -> ""
ps("/foo/..") -> "/"
ps("a/b/../../c") -> "c"
ps("/a/b/../../c") -> "/c"
ps("./a/../b") -> "b"
ps("/./a/../b") -> "/b"
*/
/* "Touch" FILE, i.e. make its atime and mtime equal to the time
specified with TM. */