httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikael Vidstedt <mik...@stacken.kth.se>
Subject Escaping arguments and ap_call_exec
Date Wed, 23 Jun 1999 08:45:34 GMT

Hello!

I'm writing a module for apache under windows. The module should start a
program and I use ap_bspawn_child to do that. My function (the second
argument to ap_bspawn_child) calls ap_call_exec. r->filename is set to the
name of the program I want to run, and r->args is a string containing the
argument to that program. Now, the trouble is that my argument string is
escaped when I receive it in the program, and spaces in the original
argument string are treated as argument separators.

E.g:

An argument string sent as:

r->args = ap_pstrcat(r->pool,
                     r->args,
                     "d:\\program files\\my_program.exe");
Arrives as:
argv[1] == d:\\program
argv[2] == files\\my_program.exe

If I use slashes I still have trouble with the space.
If I choose to double-quote the string I end up with:
argv[1] == "d:\\program
argv[2] == files\\my_program.exe\"

So, how am I supposed to format that string before sending it to
ap_call_exec?

Thanks,
Mikael


Mime
View raw message