[w3m-dev 03616] Re: data: URL scheme
* file.c (loadGeneralFile): check SCM_DATA (loadImageBuffer): newBuffer() * html.h (SCM_DATA): added * indep.c (url_unquote): deleted (Str_url_unquote): renamed from Str_form_unquote + is decoded is_form only * indep.h (url_unquote): deleted (Str_url_unquote): added (Str_form_unquote): define by Str_url_unquote * main.c (followA): file_unquote (cmd_loadURL): file_unquote * url.c (DefaultPort): add for data: (schemetable): add "data" (DefaultFile): SCM_FTPDIR (parseURL): scheme copied from current (parseURL2): SCM_DATA check SCM_FTP, SCM_FTPDIR (_parsedURL2Str): add data in scheme_str handle SCM_DATA SCM_FTPDIR (openURL): file_unquote handle SCM_DATA From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
35
indep.c
35
indep.c
@@ -1,4 +1,4 @@
|
||||
/* $Id: indep.c,v 1.27 2002/12/24 17:20:47 ukai Exp $ */
|
||||
/* $Id: indep.c,v 1.28 2003/01/08 17:24:12 ukai Exp $ */
|
||||
#include "fm.h"
|
||||
#include <stdio.h>
|
||||
#include <pwd.h>
|
||||
@@ -534,34 +534,6 @@ url_quote(char *str)
|
||||
return str;
|
||||
}
|
||||
|
||||
char *
|
||||
url_unquote(char *str)
|
||||
{
|
||||
Str tmp = NULL;
|
||||
char *p, *q;
|
||||
int c;
|
||||
|
||||
for (p = str; *p;) {
|
||||
if (*p == '%') {
|
||||
q = p;
|
||||
c = url_unquote_char(&q);
|
||||
if (c >= 0 && c != '\0' && c != '\n' && c != '\r') {
|
||||
if (tmp == NULL)
|
||||
tmp = Strnew_charp_n(str, (int)(p - str));
|
||||
Strcat_char(tmp, (char)c);
|
||||
p = q;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (tmp)
|
||||
Strcat_char(tmp, *p);
|
||||
p++;
|
||||
}
|
||||
if (tmp)
|
||||
return tmp->ptr;
|
||||
return str;
|
||||
}
|
||||
|
||||
char *
|
||||
file_quote(char *str)
|
||||
{
|
||||
@@ -661,15 +633,16 @@ Str_form_quote(Str x)
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
Str
|
||||
Str_form_unquote(Str x)
|
||||
Str_url_unquote(Str x, int is_form)
|
||||
{
|
||||
Str tmp = NULL;
|
||||
char *p = x->ptr, *ep = x->ptr + x->length, *q;
|
||||
int c;
|
||||
|
||||
for (; p < ep;) {
|
||||
if (*p == '+') {
|
||||
if (is_form && *p == '+') {
|
||||
if (tmp == NULL)
|
||||
tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
|
||||
Strcat_char(tmp, ' ');
|
||||
|
Reference in New Issue
Block a user