[opensuse] [OT] arguments for execl() function
I am trying to use execl() command in order to execute 'less' program. It seems however that I need to pass to execl() the full path to less, otherwise I get an error. The path to 'less' is in PATH env variable. Is this the normal behavior of execl() ? I have this problem because I get 'less' from another env variable PAGER, but I am wondering why I need to figure out the entire path to a program in order to be able to execute it with execl(). -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Bogdan Cristea
I am trying to use execl() command in order to execute 'less' program. It seems however that I need to pass to execl() the full path to less, otherwise I get an error. The path to 'less' is in PATH env variable. Is this the normal behavior of execl() ? I have this problem because I get 'less' from another env variable PAGER, but I am wondering why I need to figure out the entire path to a program in order to be able to execute it with execl().
Did you try $PAGER -- Patrick Shanahan Plainfield, Indiana, USA HOG # US1244711 http://wahoo.no-ip.org Photo Album: http://wahoo.no-ip.org/gallery2 Registered Linux User #207535 @ http://counter.li.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
El 07/11/10 14:59, Bogdan Cristea escribió:
I am trying to use execl() command in order to execute 'less' program. It seems however that I need to pass to execl() the full path to less, otherwise I get an error. The path to 'less' is in PATH env variable. Is this the normal behavior of execl() ?
"It takes the environment for the new process image from the external variable environ in the current process."
I have this problem because I get 'less' from another env variable PAGER, but I am wondering why I need to figure out the entire path to a program in order to be able to execute it with execl().
Dont, libc program execution functions are very hard to use correctly, and you will certainly shoot yourself in the foot. I recommend you to use jengelh's excellent "LibHX" (zypper install libHX-devel) and see the manual [1] section 26, for the HXproc_* functions. [1] http://jengelh.medozas.de/documents/libHX_Documentation.pdf -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Bogdan Cristea wrote:
I am trying to use execl() command in order to execute 'less' program. It seems however that I need to pass to execl() the full path to less, otherwise I get an error. The path to 'less' is in PATH env variable. Is this the normal behavior of execl() ?
Yes. If you wish to apply normal search paths, use execlp(). -- Per Jessen, Zürich (6.8°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (4)
-
Bogdan Cristea
-
Cristian Rodríguez
-
Patrick Shanahan
-
Per Jessen