[svn] Commit really old change.

This commit is contained in:
hniksic 2000-03-31 06:04:54 -08:00
parent 6b0aaebf33
commit 0d42b49e30
2 changed files with 29 additions and 12 deletions

View File

@ -1,3 +1,17 @@
1998-12-01 Hrvoje Niksic <hniksic@srce.hr>
* url.c (UNSAFE_CHAR): New macro.
(contains_unsafe): Use it.
(encode_string): Ditto.
1998-12-01 Hrvoje Niksic <hniksic@srce.hr>
* main.c (i18n_initialize): Use LC_MESSAGES only if available.
2000-03-31 Hrvoje Niksic <hniksic@srce.hr>
* Use TOUPPER/TOLOWER.
1998-12-22 Alexander V. Lukyanov <lav@yars.free.net>
* ftp-opie.c (btoe): Zero-terminate OSTORE.

View File

@ -53,14 +53,17 @@ extern int errno;
/* A list of unsafe characters for encoding, as per RFC1738. '@' and
':' (not listed in RFC) were added because of user/password
encoding, and \033 for safe printing. */
encoding. */
#ifndef WINDOWS
# define URL_UNSAFE " <>\"#%{}|\\^~[]`@:\033"
# define URL_UNSAFE_CHARS "<>\"#%{}|\\^~[]`@:"
#else /* WINDOWS */
# define URL_UNSAFE " <>\"%{}|\\^[]`\033"
# define URL_UNSAFE_CHARS "<>\"%{}|\\^[]`"
#endif /* WINDOWS */
#define UNSAFE_CHAR(c) (((c) >= 0 && (c) <= 32) \
|| strchr (URL_UNSAFE_CHARS, c))
/* If S contains unsafe characters, free it and replace it with a
version that doesn't. */
#define URL_CLEANSE(s) do \
@ -154,9 +157,9 @@ skip_url (const char *url)
{
int i;
if (toupper (url[0]) == 'U'
&& toupper (url[1]) == 'R'
&& toupper (url[2]) == 'L'
if (TOUPPER (url[0]) == 'U'
&& TOUPPER (url[1]) == 'R'
&& TOUPPER (url[2]) == 'L'
&& url[3] == ':')
{
/* Skip blanks. */
@ -172,7 +175,7 @@ int
contains_unsafe (const char *s)
{
for (; *s; s++)
if (strchr (URL_UNSAFE, *s))
if (UNSAFE_CHAR (*s))
return 1;
return 0;
}
@ -209,8 +212,8 @@ decode_string (char *s)
*p = '\0';
}
/* Encodes the unsafe characters (listed in URL_UNSAFE) in a given
string, returning a malloc-ed %XX encoded string. */
/* Encodes the unsafe characters (listed in URL_UNSAFE_CHARS) in a
given string, returning a malloc-ed %XX encoded string. */
char *
encode_string (const char *s)
{
@ -220,12 +223,12 @@ encode_string (const char *s)
b = s;
for (i = 0; *s; s++, i++)
if (strchr (URL_UNSAFE, *s))
if (UNSAFE_CHAR (*s))
i += 2; /* Two more characters (hex digits) */
res = (char *)xmalloc (i + 1);
s = b;
for (p = res; *s; s++)
if (strchr (URL_UNSAFE, *s))
if (UNSAFE_CHAR (*s))
{
const unsigned char c = *s;
*p++ = '%';
@ -464,7 +467,7 @@ parseurl (const char *url, struct urlinfo *u, int strict)
{
u->ftp_type = process_ftp_type (u->path);
/* #### We don't handle type `d' correctly yet. */
if (!u->ftp_type || toupper (u->ftp_type) == 'D')
if (!u->ftp_type || TOUPPER (u->ftp_type) == 'D')
u->ftp_type = 'I';
}
DEBUGP (("opath %s -> ", u->path));