httpd-dev mailing list archives

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


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.


An argument string sent as:

r->args = ap_pstrcat(r->pool,
                     "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


View raw message