[w3m-dev 03459] background download when external viewer
* etc.c (myExec): added (mySystem): rewrite to use myExec() * file.c (doExternal): run background if BackgroundExtViewer * proto.h (myExec): added From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2002-11-23 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* [w3m-dev 03459] background download when external viewer
|
||||||
|
* etc.c (myExec): added
|
||||||
|
(mySystem): rewrite to use myExec()
|
||||||
|
* file.c (doExternal): run background if BackgroundExtViewer
|
||||||
|
* proto.h (myExec): added
|
||||||
|
|
||||||
2002-11-23 Fumitoshi UKAI <ukai@debian.or.jp>
|
2002-11-23 Fumitoshi UKAI <ukai@debian.or.jp>
|
||||||
|
|
||||||
* doc/README.mouse_menu: delete column 10 limit
|
* doc/README.mouse_menu: delete column 10 limit
|
||||||
@@ -5032,4 +5040,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-0.2.1
|
* import w3m-0.2.1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.547 2002/11/22 15:45:01 ukai Exp $
|
$Id: ChangeLog,v 1.548 2002/11/22 15:49:42 ukai Exp $
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: etc.c,v 1.37 2002/11/08 15:54:47 ukai Exp $ */
|
/* $Id: etc.c,v 1.38 2002/11/22 15:49:43 ukai Exp $ */
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
@@ -1294,6 +1294,27 @@ reset_signals(void)
|
|||||||
signal(SIGUSR1, SIG_IGN);
|
signal(SIGUSR1, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
myExec(char *command)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
reset_signals();
|
||||||
|
SETPGRP();
|
||||||
|
close_tty();
|
||||||
|
dup2(open("/dev/null", O_RDONLY), 0);
|
||||||
|
dup2(open("/dev/null", O_WRONLY), 1);
|
||||||
|
dup2(open("/dev/null", O_WRONLY), 2);
|
||||||
|
#ifndef FOPEN_MAX
|
||||||
|
#define FOPEN_MAX 1024 /* XXX */
|
||||||
|
#endif
|
||||||
|
/* close all other file descriptors (socket, ...) */
|
||||||
|
for (i = 3; i < FOPEN_MAX; i++)
|
||||||
|
close(i);
|
||||||
|
execl("/bin/sh", "sh", "-c", command, NULL);
|
||||||
|
exit(127);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mySystem(char *command, int background)
|
mySystem(char *command, int background)
|
||||||
{
|
{
|
||||||
@@ -1303,25 +1324,9 @@ mySystem(char *command, int background)
|
|||||||
Strcat_charp(cmd, command);
|
Strcat_charp(cmd, command);
|
||||||
system(cmd->ptr);
|
system(cmd->ptr);
|
||||||
#else
|
#else
|
||||||
int pid;
|
|
||||||
flush_tty();
|
flush_tty();
|
||||||
if ((pid = fork()) == 0) {
|
if (! fork())
|
||||||
int i;
|
myExec(command);
|
||||||
reset_signals();
|
|
||||||
SETPGRP();
|
|
||||||
close_tty();
|
|
||||||
dup2(open("/dev/null", O_RDONLY), 0);
|
|
||||||
dup2(open("/dev/null", O_WRONLY), 1);
|
|
||||||
dup2(open("/dev/null", O_WRONLY), 2);
|
|
||||||
#ifndef FOPEN_MAX
|
|
||||||
#define FOPEN_MAX 1024 /* XXX */
|
|
||||||
#endif
|
|
||||||
/* close all other file descriptors (socket, ...) */
|
|
||||||
for (i = 3; i < FOPEN_MAX; i++)
|
|
||||||
close(i);
|
|
||||||
execl("/bin/sh", "sh", "-c", command, NULL);
|
|
||||||
exit(127);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: file.c,v 1.123 2002/11/18 18:11:25 ukai Exp $ */
|
/* $Id: file.c,v 1.124 2002/11/22 15:49:43 ukai Exp $ */
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
@@ -7090,11 +7090,10 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
|
|||||||
if (uf.ext && *uf.ext) {
|
if (uf.ext && *uf.ext) {
|
||||||
Strcat_charp(tmpf, uf.ext);
|
Strcat_charp(tmpf, uf.ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
_save:
|
_save:
|
||||||
if (IStype(uf.stream) != IST_ENCODED)
|
if (IStype(uf.stream) != IST_ENCODED)
|
||||||
uf.stream = newEncodedStream(uf.stream, uf.encoding);
|
uf.stream = newEncodedStream(uf.stream, uf.encoding);
|
||||||
if (save2tmp(uf, tmpf->ptr) < 0)
|
|
||||||
return 0;
|
|
||||||
header = checkHeader(defaultbuf, "Content-Type:");
|
header = checkHeader(defaultbuf, "Content-Type:");
|
||||||
if (header)
|
if (header)
|
||||||
header = conv_to_system(header);
|
header = conv_to_system(header);
|
||||||
@@ -7105,6 +7104,31 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
|
|||||||
command = tmp;
|
command = tmp;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
pushText(fileToDelete, tmpf->ptr);
|
||||||
|
#ifdef HAVE_SETPGRP
|
||||||
|
if (! (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) &&
|
||||||
|
! (mcap->flags & MAILCAP_NEEDSTERMINAL) && BackgroundExtViewer) {
|
||||||
|
flush_tty();
|
||||||
|
if (! fork()) {
|
||||||
|
reset_signals();
|
||||||
|
signal(SIGINT, SIG_IGN);
|
||||||
|
close_tty();
|
||||||
|
QuietMessage = TRUE;
|
||||||
|
fmInitialized = FALSE;
|
||||||
|
if (save2tmp(uf, tmpf->ptr) < 0)
|
||||||
|
exit(1);
|
||||||
|
myExec(command->ptr);
|
||||||
|
}
|
||||||
|
*bufp = NO_BUFFER;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (save2tmp(uf, tmpf->ptr) < 0)
|
||||||
|
return 0; /* ??? */
|
||||||
|
}
|
||||||
if (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) {
|
if (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) {
|
||||||
if (defaultbuf == NULL)
|
if (defaultbuf == NULL)
|
||||||
defaultbuf = newBuffer(INIT_BUFFER_WIDTH);
|
defaultbuf = newBuffer(INIT_BUFFER_WIDTH);
|
||||||
@@ -7147,7 +7171,6 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
|
|||||||
buf->mailcap = mcap;
|
buf->mailcap = mcap;
|
||||||
}
|
}
|
||||||
*bufp = buf;
|
*bufp = buf;
|
||||||
pushText(fileToDelete, tmpf->ptr);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: proto.h,v 1.59 2002/11/22 15:43:14 ukai Exp $ */
|
/* $Id: proto.h,v 1.60 2002/11/22 15:49:44 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* This file was automatically generated by version 1.7 of cextract.
|
* This file was automatically generated by version 1.7 of cextract.
|
||||||
* Manual editing not recommended.
|
* Manual editing not recommended.
|
||||||
@@ -560,6 +560,7 @@ extern char *last_modified(Buffer *buf);
|
|||||||
extern Str romanNumeral(int n);
|
extern Str romanNumeral(int n);
|
||||||
extern Str romanAlphabet(int n);
|
extern Str romanAlphabet(int n);
|
||||||
extern void reset_signals(void);
|
extern void reset_signals(void);
|
||||||
|
extern void myExec(char *command);
|
||||||
extern void mySystem(char *command, int background);
|
extern void mySystem(char *command, int background);
|
||||||
extern Str myExtCommand(char *cmd, char *arg, int redirect);
|
extern Str myExtCommand(char *cmd, char *arg, int redirect);
|
||||||
extern Str myEditor(char *cmd, char *file, int line);
|
extern Str myEditor(char *cmd, char *file, int line);
|
||||||
|
|||||||
Reference in New Issue
Block a user