[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs qe.h shell.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs qe.h shell.c |
Date: |
Thu, 20 Dec 2007 20:37:17 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 07/12/20 20:37:17
Modified files:
. : qe.h shell.c
Log message:
new_shell_buffer takes a optional buffer argument
comments, simplifications
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.30&r2=1.31
Patches:
Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- qe.h 20 Dec 2007 16:27:22 -0000 1.41
+++ qe.h 20 Dec 2007 20:37:16 -0000 1.42
@@ -1594,8 +1594,9 @@
int qe_bitmap_format_to_pix_fmt(int format);
/* shell.c */
-EditBuffer *new_shell_buffer(const char *name, const char *path,
- const char **argv, int is_shell);
+EditBuffer *new_shell_buffer(EditBuffer *b0, const char *name,
+ const char *path, const char **argv,
+ int is_shell);
#define QASSERT(e) do { if (!(e)) fprintf(stderr, "%s:%d: assertion
failed: %s\n", __FILE__, __LINE__, #e); } while (0)
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- shell.c 20 Dec 2007 16:27:22 -0000 1.30
+++ shell.c 20 Dec 2007 20:37:16 -0000 1.31
@@ -1056,12 +1056,15 @@
qe_free(&s);
}
-EditBuffer *new_shell_buffer(const char *name, const char *path,
- const char **argv, int is_shell)
+EditBuffer *new_shell_buffer(EditBuffer *b0, const char *name,
+ const char *path, const char **argv,
+ int is_shell)
{
ShellState *s;
EditBuffer *b, *b_color;
+ b = b0;
+ if (!b)
b = eb_new("", BF_SAVELOG);
if (!b)
return NULL;
@@ -1070,6 +1073,7 @@
s = qe_mallocz(ShellState);
if (!s) {
+ if (!b0)
eb_free(b);
return NULL;
}
@@ -1087,6 +1091,7 @@
if (is_shell) {
b_color = eb_new("*color*", BF_SYSTEM);
if (!b_color) {
+ if (!b0)
eb_free(b);
qe_free(&s);
return NULL;
@@ -1099,6 +1104,7 @@
/* launch shell */
if (run_process(path, argv, &s->pty_fd, &s->pid) < 0) {
+ if (!b0)
eb_free(b);
return NULL;
}
@@ -1140,7 +1146,7 @@
/* create new buffer */
argv[0] = shell_path;
argv[1] = NULL;
- b = new_shell_buffer("*shell*", shell_path, argv, 1);
+ b = new_shell_buffer(NULL, "*shell*", shell_path, argv, 1);
if (!b)
return;
@@ -1194,7 +1200,7 @@
{
if (e->interactive) {
ShellState *s = e->b->priv_data;
- tty_write(s, "\001", -1); /* Control-A */
+ tty_write(s, "\001", 1); /* Control-A */
} else {
text_move_bol(e);
}
@@ -1204,7 +1210,7 @@
{
if (e->interactive) {
ShellState *s = e->b->priv_data;
- tty_write(s, "\005", -1); /* Control-E */
+ tty_write(s, "\005", 1); /* Control-E */
} else {
text_move_eol(e);
}
@@ -1218,6 +1224,7 @@
ShellState *s = e->b->priv_data;
ch = c;
+ /* TODO: convert to tty escape sequences? */
tty_write(s, &ch, 1);
} else {
/* Should dispatch as in fundamental mode */
@@ -1287,7 +1294,7 @@
argv[1] = "-c";
argv[2] = (char *)cmd;
argv[3] = NULL;
- b = new_shell_buffer("*compilation*", "/bin/sh", argv, 0);
+ b = new_shell_buffer(NULL, "*compilation*", "/bin/sh", argv, 0);
if (!b)
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs qe.h shell.c,
Charlie Gordon <=