mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Revert "copiousoutput: cleanup after copiousoutput handling. Temporary files should"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 4dc4ea47f2
.
Conflicts:
src/network/connection.h: After the original commit, the declaration
of copiousoutput_data had been changed to use the LIST_OF macro.
Also, connection.cgi had been added next to the connection.popen
member added by the original commit.
src/session/download.c: After the original commit, the definition of
copiousoutput_data had been changed to use the INIT_LIST_OF macro.
This commit is contained in:
parent
5ef6c9e395
commit
bfb034c953
@ -4,7 +4,6 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@ -384,25 +383,6 @@ shutdown_connection_stream(struct connection *conn)
|
||||
conn->stream_pipes[0] = conn->stream_pipes[1] = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
close_popen(int fd)
|
||||
{
|
||||
struct popen_data *pop;
|
||||
|
||||
foreach (pop, copiousoutput_data) {
|
||||
if (pop->fd == fd) {
|
||||
del_from_list(pop);
|
||||
pclose(pop->stream);
|
||||
if (pop->filename) {
|
||||
unlink(pop->filename);
|
||||
mem_free(pop->filename);
|
||||
}
|
||||
mem_free(pop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_connection_data(struct connection *conn)
|
||||
{
|
||||
@ -423,7 +403,6 @@ free_connection_data(struct connection *conn)
|
||||
if (conn->done)
|
||||
conn->done(conn);
|
||||
|
||||
if (conn->popen) close_popen(conn->socket->fd);
|
||||
done_socket(conn->socket);
|
||||
done_socket(conn->data_socket);
|
||||
|
||||
|
@ -57,7 +57,6 @@ struct connection {
|
||||
unsigned int running:1;
|
||||
unsigned int unrestartable:1;
|
||||
unsigned int detached:1;
|
||||
unsigned int popen:1;
|
||||
unsigned int cgi:1;
|
||||
|
||||
/* Each document is downloaded with some priority. When downloading a
|
||||
@ -75,16 +74,6 @@ struct connection {
|
||||
void *info;
|
||||
};
|
||||
|
||||
struct popen_data {
|
||||
LIST_HEAD(struct popen_data);
|
||||
|
||||
int fd;
|
||||
FILE *stream;
|
||||
unsigned char *filename;
|
||||
};
|
||||
|
||||
extern LIST_OF(struct popen_data) copiousoutput_data;
|
||||
|
||||
int register_check_queue(void);
|
||||
|
||||
int get_connections_count(void);
|
||||
|
@ -215,7 +215,6 @@ read_special(struct connection *conn, int fd)
|
||||
return;
|
||||
}
|
||||
conn->socket->fd = fd;
|
||||
conn->popen = 1;
|
||||
rb = alloc_read_buffer(conn->socket);
|
||||
if (!rb) {
|
||||
abort_connection(conn, S_OUT_OF_MEM);
|
||||
@ -225,7 +224,6 @@ read_special(struct connection *conn, int fd)
|
||||
rb->length = 45;
|
||||
rb->freespace -= 45;
|
||||
|
||||
conn->unrestartable = 1;
|
||||
conn->socket->state = SOCKET_END_ONCLOSE;
|
||||
read_from_socket(conn->socket, rb, S_SENT, http_got_header);
|
||||
}
|
||||
|
@ -65,8 +65,6 @@
|
||||
|
||||
INIT_LIST_OF(struct file_download, downloads);
|
||||
|
||||
INIT_LIST_OF(struct popen_data, copiousoutput_data);
|
||||
|
||||
int
|
||||
download_is_progressing(struct download *download)
|
||||
{
|
||||
@ -305,26 +303,16 @@ abort_download_and_beep(struct file_download *file_download, struct terminal *te
|
||||
}
|
||||
|
||||
static void
|
||||
read_from_popen(struct session *ses, unsigned char *handler, unsigned char *filename)
|
||||
read_from_popen(struct session *ses, unsigned char *handler)
|
||||
{
|
||||
FILE *stream = popen(handler, "r");
|
||||
FILE *pop = popen(handler, "r");
|
||||
|
||||
if (stream) {
|
||||
int fd = fileno(stream);
|
||||
if (pop) {
|
||||
int fd = fileno(pop);
|
||||
|
||||
if (fd > 0) {
|
||||
unsigned char buf[48];
|
||||
|
||||
struct popen_data *data = mem_calloc(1, sizeof(*data));
|
||||
|
||||
if (!data) {
|
||||
fclose(stream);
|
||||
return;
|
||||
}
|
||||
data->fd = fd;
|
||||
data->stream = stream;
|
||||
if (filename) data->filename = stracpy(filename);
|
||||
add_to_list(copiousoutput_data, data);
|
||||
snprintf(buf, 48, "file:///dev/fd/%d", fd);
|
||||
goto_url(ses, buf);
|
||||
}
|
||||
@ -370,10 +358,7 @@ download_data_store(struct download *download, struct file_download *file_downlo
|
||||
file_download->handle = -1;
|
||||
if (file_download->copiousoutput) {
|
||||
read_from_popen(file_download->ses,
|
||||
file_download->external_handler,
|
||||
file_download->file);
|
||||
file_download->delete = 0;
|
||||
abort_download_and_beep(file_download, term);
|
||||
file_download->external_handler);
|
||||
} else {
|
||||
exec_on_terminal(term, file_download->external_handler,
|
||||
file_download->file,
|
||||
@ -1101,7 +1086,7 @@ tp_open(struct type_query *type_query)
|
||||
|
||||
if (handler) {
|
||||
if (type_query->copiousoutput)
|
||||
read_from_popen(type_query->ses, handler, NULL);
|
||||
read_from_popen(type_query->ses, handler);
|
||||
else
|
||||
exec_on_terminal(type_query->ses->tab->term,
|
||||
handler, "",
|
||||
|
Loading…
Reference in New Issue
Block a user