On 18 Mar 2001, David N. Welton wrote:
> [EMAIL PROTECTED] (David N. Welton) writes:
>
> > I haven't looked at it in detail yet, and haven't tried running
> > things, either, but could you explain a bit about your thoughts
> > behind the execution model? It runs a file in a namespace using the
> > filename itself for the namespace name?
>
> I've been looking over the "<Tcl> ... </Tcl>" code, and it isn't
> entirely clear.
>
> I think mixing malloc + apache memory stuff is probably not a good
> idea. It's segfaulting on me...
I do this all the time, as long as you clean it up everything is
fine. Otherwise apache can bloat to a large footprint size. I'm getting
a segfault in ap_cfg_getline(), not sure why yet.
>
> static const char *tcl_raw_args(cmd_parms *parms, void *mconfig, char *arg)
> {
> tcl_config_rec *tclr = (tcl_config_rec*) mconfig;
> char l[MAX_STRING_LEN];
> char *script = NULL, **xx;
>
> tclr->raw_list = apr_array_make(parms->pool, 0, sizeof(char *));
>
> while (!(ap_cfg_getline(l, MAX_STRING_LEN, parms->config_file))) {
> if (!strncasecmp(l, "</Tcl>", 6)) {
> goto cleanup;
> }
> script = apr_pstrcat(parms->pool, script, "\n", l, NULL);
> }
>
> cleanup:
>
> xx = (char **)apr_array_push(tclr->raw_list);
> *xx = script;
> return NULL;
> }
>
> Would something like this be simpler? The first array_make shouldn't
> be there, but without it, I seem to be getting the raw_list
> uninitialized, probably because I also switched the command to:
>
> AP_INIT_RAW_ARGS("<Tcl>", (fz_t) tcl_raw_args, NULL,
> RSRC_CONF|EXEC_ON_READ, "add raw tcl to the interpreter." ),
> AP_INIT_NO_ARGS("</Tcl>", (fz_t) tcl_no_args, NULL, RSRC_CONF, "end of
> tcl section." ),
>
> But I'm out of time for now to track this down...
>
> --
> David N. Welton
> Free Software: http://people.debian.org/~davidw/
> Apache Tcl: http://tcl.apache.org/
> Personal: http://www.efn.org/~davidw/
> Work: http://www.innominate.com/
>