mirror of
https://github.com/rkd77/elinks.git
synced 2024-08-25 21:44:47 -04:00
Merge with master
This commit is contained in:
commit
3931db1d00
@ -60,13 +60,9 @@ quiet_cmd_ld_objs = " [$(LD_COLOR)LD$(END_COLOR)] $(RELPATH)$@"
|
||||
quiet_cmd_recmake = "[$(INFO_COLOR)MAKE $(3)$(END_COLOR)] $(RELPATH)$(2)"
|
||||
cmd_recmake = $(MAKE) -C $(2) $(3)
|
||||
|
||||
quiet_cmd_installdata = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(2) -> $(3)"
|
||||
quiet_cmd_installdata = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(patsubst $(srcdir)%,%,$(2)) -> $(3)"
|
||||
cmd_installdata = $(INSTALL_DATA) $(2) $(3)
|
||||
|
||||
# Install a data file from the source (not build) directory
|
||||
quiet_cmd_installsrcdata = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(2) -> $(3)"
|
||||
cmd_installsrcdata = $(INSTALL_DATA) $(srcdir)$(2) $(3)
|
||||
|
||||
quiet_cmd_installprog = " [$(INSTALL_COLOR)INSTALL$(END_COLOR)] $(RELPATH)$(2) -> $(3)"
|
||||
cmd_installprog = $(INSTALL_PROGRAM) $(2) $(3)
|
||||
|
||||
|
@ -88,7 +88,7 @@ install-doc: all-docs update-man install
|
||||
$(call ncmd,installdata,$(doc),$(PDF_DIR));)
|
||||
@$(foreach doc,$(TXT_DOCS_ASIS), \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(PACKAGE)/txt; \
|
||||
$(call ncmd,installsrcdata,$(doc),$(TXT_DIR));)
|
||||
$(call ncmd,installdata,$(srcdir)$(doc),$(TXT_DIR));)
|
||||
|
||||
update-man: man
|
||||
@$(if $(MAN_DOCS), \
|
||||
|
@ -1,6 +1,6 @@
|
||||
=head1 NAME
|
||||
|
||||
ELinks Perl Interface
|
||||
elinks-perl - ELinks Perl Interface
|
||||
|
||||
=head1 INTRODUCTION
|
||||
|
||||
|
@ -507,7 +507,6 @@ good_char:
|
||||
x++;
|
||||
part->spaces[x] = 0;
|
||||
part->char_width[x] = 0;
|
||||
data = utf8_to_unicode(&chars, end);
|
||||
}
|
||||
if (data == UCS_NO_CHAR) {
|
||||
/* this is at the end only */
|
||||
|
@ -53,6 +53,28 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LONG_LONG) && !defined(LLONG_MAX)
|
||||
#ifdef MAXLLONG
|
||||
#define LLONG_MAX MAXLLONG
|
||||
#elif SIZEOF_LONG_LONG == 8
|
||||
#define LLONG_MAX 9223372036854775807LL
|
||||
#elif SIZEOF_LONG_LONG == 4
|
||||
#define LLONG_MAX LONG_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef OFFT_MAX
|
||||
#if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T == SIZEOF_LONG_LONG
|
||||
#define OFFT_MAX LLONG_MAX
|
||||
#elif SIZEOF_OFF_T == SIZEOF_LONG
|
||||
#define OFFT_MAX LONG_MAX
|
||||
#elif SIZEOF_OFF_T == SIZEOF_INT
|
||||
#define OFFT_MAX INT_MAX
|
||||
#elif SIZEOF_OFF_T == SIZEOF_SHORT
|
||||
#define OFFT_MAX SHRT_MAX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_UINT16_T
|
||||
#if SIZEOF_CHAR == 2
|
||||
typedef unsigned char uint16_t;
|
||||
|
@ -1091,7 +1091,7 @@ display_dir_entry(struct cache_entry *cached, off_t *pos, int *tries,
|
||||
add_to_string(&string, " 1 ftp ftp ");
|
||||
|
||||
if (ftp_info->size != FTP_SIZE_UNKNOWN) {
|
||||
add_format_to_string(&string, "%12lu ", ftp_info->size);
|
||||
add_format_to_string(&string, "%12" OFF_T_FORMAT " ", ftp_info->size);
|
||||
} else {
|
||||
add_to_string(&string, " - ");
|
||||
}
|
||||
|
@ -41,10 +41,10 @@
|
||||
#define skip_nonspace_end(src, end) \
|
||||
do { while ((src) < (end) && *(src) != ' ') (src)++; } while (0)
|
||||
|
||||
static long
|
||||
parse_ftp_number(unsigned char **src, unsigned char *end, long from, long to)
|
||||
static off_t
|
||||
parse_ftp_number(unsigned char **src, unsigned char *end, off_t from, off_t to)
|
||||
{
|
||||
long number = 0;
|
||||
off_t number = 0;
|
||||
unsigned char *pos = *src;
|
||||
|
||||
for (; pos < end && isdigit(*pos); pos++)
|
||||
@ -104,7 +104,7 @@ parse_ftp_eplf_response(struct ftp_file_info *info, unsigned char *src, int len)
|
||||
|
||||
case FTP_EPLF_SIZE:
|
||||
if (src >= pos) break;
|
||||
info->size = parse_ftp_number(&src, pos, 0, LONG_MAX);
|
||||
info->size = parse_ftp_number(&src, pos, 0, OFFT_MAX);
|
||||
break;
|
||||
|
||||
case FTP_EPLF_MTIME:
|
||||
@ -278,7 +278,7 @@ parse_ftp_unix_response(struct ftp_file_info *info, unsigned char *src, int len)
|
||||
break;
|
||||
}
|
||||
|
||||
info->size = parse_ftp_number(&src, pos, 0, LONG_MAX);
|
||||
info->size = parse_ftp_number(&src, pos, 0, OFFT_MAX);
|
||||
break;
|
||||
|
||||
case FTP_UNIX_DAY:
|
||||
@ -543,7 +543,7 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len
|
||||
memset(&mtime, 0, sizeof(mtime));
|
||||
mtime.tm_isdst = -1;
|
||||
|
||||
mtime.tm_mon = parse_ftp_number(&src, end, 1, 12);
|
||||
mtime.tm_mon = (int) parse_ftp_number(&src, end, 1, 12);
|
||||
if (src + 2 >= end || *src != '-')
|
||||
return NULL;
|
||||
|
||||
@ -587,7 +587,7 @@ parse_ftp_winnt_response(struct ftp_file_info *info, unsigned char *src, int len
|
||||
|
||||
} else if (isdigit(*src)) {
|
||||
info->type = FTP_FILE_PLAINFILE;
|
||||
info->size = parse_ftp_number(&src, end, 0, LONG_MAX);
|
||||
info->size = parse_ftp_number(&src, end, 0, OFFT_MAX);
|
||||
info->permissions = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||
|
||||
} else {
|
||||
|
@ -19,7 +19,7 @@ struct ftp_file_info {
|
||||
enum ftp_file_type type; /* File type */
|
||||
struct string name; /* File name */
|
||||
struct string symlink; /* Link to which file points */
|
||||
long size; /* File size. -1 if unknown. */
|
||||
off_t size; /* File size. -1 if unknown. */
|
||||
time_t mtime; /* Modification time */
|
||||
unsigned int local_time_zone:1; /* What format the mtime is in */
|
||||
mode_t permissions; /* File permissions */
|
||||
|
@ -73,6 +73,11 @@ test_ftp_response_expect_success \
|
||||
-------r-- 326 1391972 1392298 Nov 22 1995 MegaPhone.sit\r\n
|
||||
drwxrwxr-x folder 2 May 10 1996 network\r\n"
|
||||
|
||||
test_ftp_response_expect_success \
|
||||
'Response from server mentioned in debian bug 403139' \
|
||||
"
|
||||
-rw-r--r-- 1 root root 1126400 Jul 28 2003 client.tar\r\n
|
||||
-rw-r--r-- 1 root root 3146776576 Dec 15 19:08 dontlook\r\n"
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
|
@ -121,6 +121,41 @@ end:
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Determine whether or not a user-supplied hooks module exists. */
|
||||
|
||||
static int
|
||||
hooks_module_exists(void)
|
||||
{
|
||||
PyObject *imp_module = NULL, *result = NULL;
|
||||
int found_hooks = 0;
|
||||
|
||||
/*
|
||||
* Use the find_module() function in Python's imp module to look for
|
||||
* the hooks module in Python's search path. An ImportError exception
|
||||
* indicates that no such module was found; any other exception will
|
||||
* be reported as an error.
|
||||
*/
|
||||
imp_module = PyImport_ImportModule("imp");
|
||||
if (!imp_module) goto python_error;
|
||||
|
||||
result = PyObject_CallMethod(imp_module, "find_module", "s", "hooks");
|
||||
if (result) {
|
||||
found_hooks = 1;
|
||||
goto end;
|
||||
} else if (PyErr_ExceptionMatches(PyExc_ImportError)) {
|
||||
PyErr_Clear();
|
||||
goto end;
|
||||
}
|
||||
|
||||
python_error:
|
||||
alert_python_error();
|
||||
|
||||
end:
|
||||
Py_XDECREF(imp_module);
|
||||
Py_XDECREF(result);
|
||||
return found_hooks;
|
||||
}
|
||||
|
||||
/* Module-level documentation for the Python interpreter's elinks module. */
|
||||
|
||||
static char module_doc[] =
|
||||
@ -169,6 +204,8 @@ init_python(struct module *module)
|
||||
|
||||
Py_Initialize();
|
||||
|
||||
if (!hooks_module_exists()) return;
|
||||
|
||||
elinks_module = Py_InitModule3("elinks", NULL, module_doc);
|
||||
if (!elinks_module) goto python_error;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user