diff options
author | Nathan Angelacos <nangel@alpinelinux.org> | 2007-11-22 11:24:01 +0000 |
---|---|---|
committer | Nathan Angelacos <nangel@alpinelinux.org> | 2007-11-22 11:24:01 +0000 |
commit | 4c80d5d0a9059b10c46d0c9211bdd58a3eca0c64 (patch) | |
tree | 2047b66b6ea7db938a8d2beefaab6c15bcf18c1c /src | |
parent | 57e6cb4e5295c30270bbe813317f0f5d4b55dc60 (diff) | |
download | haserl-4c80d5d0a9059b10c46d0c9211bdd58a3eca0c64.tar.bz2 haserl-4c80d5d0a9059b10c46d0c9211bdd58a3eca0c64.tar.xz |
0.9.21 version
Diffstat (limited to 'src')
-rw-r--r-- | src/h_bash.c | 31 | ||||
-rw-r--r-- | src/h_bash.h | 1 | ||||
-rw-r--r-- | src/h_lua.h | 1 | ||||
-rw-r--r-- | src/haserl.c | 1 | ||||
-rw-r--r-- | src/sliding_buffer.c | 14 | ||||
-rw-r--r-- | src/sliding_buffer.h | 2 |
6 files changed, 13 insertions, 37 deletions
diff --git a/src/h_bash.c b/src/h_bash.c index 80494e8..dbbdbc3 100644 --- a/src/h_bash.c +++ b/src/h_bash.c @@ -49,12 +49,13 @@ static int subshell_pid; void -bash_open (char *shell) +bash_setup (char *shell, list_t * env) { int retcode = 0; int count; argv_t *argv; char *av[20]; + list_t *next; if (shell == NULL) return; @@ -85,6 +86,16 @@ bash_open (char *shell) av[count] = argv[count].string; count--; } + + + /* populate the environment */ + while (env) + { + next = env->next; + putenv (env->buf); + env = next; + } + execv (argv[0].string, av); free (argv); @@ -168,24 +179,6 @@ bash_eval (buffer_t * buf, char *str, size_t len) void -bash_setup (char *shell, list_t * env) -{ - list_t *next; - - /* populate the environment */ - while (env) - { - next = env->next; - putenv (env->buf); - env = next; - } - - /* start the subshell */ - bash_open (shell); -} - - -void bash_doscript (buffer_t * script, char *name) { static char postfix[] = "\nexit\n"; diff --git a/src/h_bash.h b/src/h_bash.h index d92a493..7d7e7a6 100644 --- a/src/h_bash.h +++ b/src/h_bash.h @@ -9,7 +9,6 @@ enum pipe_t { PARENT_IN, PARENT_OUT }; /* h_bash.c */ -void bash_open(char *shell); void bash_destroy(void); void bash_exec(buffer_t *buf, char *str); void bash_wait(buffer_t *buf, char *str); diff --git a/src/h_lua.h b/src/h_lua.h index c0eeb20..1b1e8af 100644 --- a/src/h_lua.h +++ b/src/h_lua.h @@ -2,7 +2,6 @@ #define H_LUA_H 1 -void bash_open(char *shell); void lua_exec(buffer_t *buf, char *str); void lua_echo(buffer_t *buf, char *str, size_t len); void lua_eval(buffer_t *buf, char *str, size_t len); diff --git a/src/haserl.c b/src/haserl.c index 4419ad4..ee95889 100644 --- a/src/haserl.c +++ b/src/haserl.c @@ -432,7 +432,6 @@ ReadCGIPOSTValues (list_t * env) s_buffer_init (&sbuf, 32768); sbuf.fh = STDIN; - sbuf.extent = atol(getenv("CONTENT_LENGTH")); buffer_init (&token); diff --git a/src/sliding_buffer.c b/src/sliding_buffer.c index 177d0d8..9883b78 100644 --- a/src/sliding_buffer.c +++ b/src/sliding_buffer.c @@ -43,8 +43,6 @@ s_buffer_init (sliding_buffer_t * sbuf, int size) sbuf->len = 0; sbuf->ptr = sbuf->buf; sbuf->bufsize = 0; - sbuf->extent = 0; - sbuf->extent_used = 0; return (sbuf->buf != NULL); /* return true if the alloc succeeded */ } @@ -100,17 +98,7 @@ s_buffer_read (sliding_buffer_t * sbuf, char *matchstr) } else { - - /* if we have an extent, read the smaller of remaining - * extent or bufsize - */ - max = sbuf->maxsize - len; - if ((sbuf->extent > 0) && (sbuf->maxsize - len) < max) - { - max = sbuf->extent - sbuf->extent_used; - } - r = read (sbuf->fh, sbuf->buf + len, max); - sbuf->extent_used += r; + r = read (sbuf->fh, sbuf->buf + len, sbuf->maxsize - len); } /* * only report eof when we've done a read of 0. diff --git a/src/sliding_buffer.h b/src/sliding_buffer.h index 148b369..83c7919 100644 --- a/src/sliding_buffer.h +++ b/src/sliding_buffer.h @@ -12,8 +12,6 @@ typedef struct { size_t maxsize; /* max size of buffer */ size_t bufsize; /* current size of buffer */ int eof; /* true if there is no more to read */ - size_t extent; /* if non-zero, max number of bytes to read */ - size_t extent_used; /* how much we have already read */ } sliding_buffer_t; |