summaryrefslogtreecommitdiff
path: root/src/callproc.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-04-29 16:47:57 +0000
committerRichard M. Stallman <rms@gnu.org>1995-04-29 16:47:57 +0000
commit6e3bfbb2589adea4af09c6acac0db344cfe114b8 (patch)
tree4cc716e4c0246363a52344edb6ab05fee5ea368c /src/callproc.c
parent5d5ab7ac5064ff21f648e9fc260e9fc90e9e92d8 (diff)
downloademacs-6e3bfbb2589adea4af09c6acac0db344cfe114b8.tar.gz
(Fcall_process): Extend BUFFER arg so it can specify
a separate output file for stderr output. (Fcall_process_region): Doc fix.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/callproc.c b/src/callproc.c
index b308644e7a3..5b321f1821f 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -200,7 +200,9 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
int fd[2];
int filefd;
register int pid;
- char buf[1024];
+ char buf[16384];
+ char *bufptr = buf;
+ int bufsize = 16384;
int count = specpdl_ptr - specpdl;
register unsigned char **new_argv
= (unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
@@ -493,8 +495,9 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
{
register int nread;
int first = 1;
+ int total_read = 0;
- while ((nread = read (fd[0], buf, sizeof buf)) != 0)
+ while ((nread = read (fd[0], bufptr, bufsize)) != 0)
{
if (nread < 0)
{
@@ -505,8 +508,19 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
#endif
}
immediate_quit = 0;
+ total_read += nread;
+
if (!NILP (buffer))
- insert (buf, nread);
+ insert (bufptr, nread);
+
+ /* Make the buffer bigger as we continue to read more data,
+ but not past 64k. */
+ if (bufsize < 64 * 1024 && total_read > 32 * bufsize)
+ {
+ bufsize *= 2;
+ bufptr = (char *) alloca (bufsize);
+ }
+
if (!NILP (display) && INTERACTIVE)
{
if (first)