On 02/03/2015 05:35 PM, Cyril Hrubis wrote: > Hi! >> +2.2.20 Executing a file >> +^^^^^^^^^^^^^^^^^^^^^^^ > > Maybe "Running executables" would be a bit better, as it is the title > looks strange to me.
I stole it from 'man 3 execvp' :) No problem:) > >> +[source,c] >> +------------------------------------------------------------------------------- >> +#include "test.h" >> + >> +int tst_run_cmd(void (cleanup_fn)(void), >> + const char *const argv[], >> + const char *stdout_path, >> + const char *stderr_path, >> + int pass_exit_val); >> +------------------------------------------------------------------------------- >> + >> +'tst_run_cmd' is a wrapper for 'vfork() + execvp()' which provides a way to >> execute >> +an external program. >> + >> +'argv[]' is a NULL-terminated list of pointers to the program name and its >> optional >> +arguments. > > Maybe it would be better: > > NULL-terminated array of strings starting with the program name which is > followed by optional arguments. ok. > > And maybe we can include an example to make it clear. > > What about: > > .Example > [source,c] > ------------------------------------------------------------------------------- > #include "test.h" > > const char *cmd[] = {"ls", "-l", NULL}; > > ... > /* Store output of 'ls -l' into a log.txt */ > tst_run_cmd(cleanup, cmd, "log.txt", NULL, 0); > ... > > ------------------------------------------------------------------------------- > ok. > >> + >> +A non-zero 'pass_exit_val' makes 'tst_run_cmd' return the program exit code >> to >> +the caller. A zero for 'pass_exit_val' makes 'tst_run_cmd' call 'cleanup_fn' > > Maybe better: > > makes 'tst_run_cmd' exit the tests on failure and call 'cleanup_fn' (if > not NULL) beforehand. > >> +in case the program exits with a non-zero code. >> + >> +'stdout_path' and 'stderr_path' detirmine where to redirect the program > ^ > determine >> +stdout and stderr I/O streams. >> + > ok. Thanks. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list