mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Explode exec_on_terminal() to new exec_on_master_terminal() and
exec_on_slave_terminal().
This commit is contained in:
parent
450e44a598
commit
a2b9d8bb78
@ -197,27 +197,13 @@ unblock_terminal(struct terminal *term)
|
|||||||
textarea_edit(1, NULL, NULL, NULL, NULL);
|
textarea_edit(1, NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
exec_on_terminal(struct terminal *term, unsigned char *path,
|
static void
|
||||||
unsigned char *delete, int fg)
|
exec_on_master_terminal(struct terminal *term,
|
||||||
|
unsigned char *path, int plen,
|
||||||
|
unsigned char *delete, int dlen,
|
||||||
|
int fg)
|
||||||
{
|
{
|
||||||
int plen, dlen;
|
|
||||||
|
|
||||||
if (path) {
|
|
||||||
if (!*path) return;
|
|
||||||
} else {
|
|
||||||
path = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
plen = strlen(path);
|
|
||||||
dlen = strlen(delete);
|
|
||||||
|
|
||||||
#ifdef NO_FG_EXEC
|
|
||||||
fg = 0;
|
|
||||||
#endif
|
|
||||||
if (term->master) {
|
|
||||||
if (!*path) dispatch_special(delete);
|
|
||||||
else {
|
|
||||||
int blockh;
|
int blockh;
|
||||||
unsigned char *param;
|
unsigned char *param;
|
||||||
int param_size;
|
int param_size;
|
||||||
@ -261,8 +247,14 @@ exec_on_terminal(struct terminal *term, unsigned char *path,
|
|||||||
set_handlers(blockh, close_handle, NULL,
|
set_handlers(blockh, close_handle, NULL,
|
||||||
close_handle, (void *) (long) blockh);
|
close_handle, (void *) (long) blockh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
static void
|
||||||
|
exec_on_slave_terminal( struct terminal *term,
|
||||||
|
unsigned char *path, int plen,
|
||||||
|
unsigned char *delete, int dlen,
|
||||||
|
int fg)
|
||||||
|
{
|
||||||
int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */;
|
int data_size = plen + dlen + 1 /* 0 */ + 1 /* fg */ + 2 /* 2 null char */;
|
||||||
unsigned char *data = mem_alloc(data_size);
|
unsigned char *data = mem_alloc(data_size);
|
||||||
|
|
||||||
@ -274,14 +266,37 @@ exec_on_terminal(struct terminal *term, unsigned char *path,
|
|||||||
hard_write(term->fdout, data, data_size);
|
hard_write(term->fdout, data, data_size);
|
||||||
mem_free(data);
|
mem_free(data);
|
||||||
}
|
}
|
||||||
#if 0
|
}
|
||||||
char x = 0;
|
|
||||||
hard_write(term->fdout, &x, 1);
|
void
|
||||||
x = fg;
|
exec_on_terminal(struct terminal *term, unsigned char *path,
|
||||||
hard_write(term->fdout, &x, 1);
|
unsigned char *delete, int fg)
|
||||||
hard_write(term->fdout, path, strlen(path) + 1);
|
{
|
||||||
hard_write(term->fdout, delete, strlen(delete) + 1);
|
if (path) {
|
||||||
|
if (!*path) return;
|
||||||
|
} else {
|
||||||
|
path = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef NO_FG_EXEC
|
||||||
|
fg = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (term->master) {
|
||||||
|
if (!*path) {
|
||||||
|
dispatch_special(delete);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
exec_on_master_terminal(term,
|
||||||
|
path, strlen(path),
|
||||||
|
delete, strlen(delete),
|
||||||
|
fg);
|
||||||
|
} else {
|
||||||
|
exec_on_slave_terminal( term,
|
||||||
|
path, strlen(path),
|
||||||
|
delete, strlen(delete),
|
||||||
|
fg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user