This page包括大量的使用示例....
编辑:从链接 从链路的代码段添加的代码片段上方
static void show_info_page(const char *git_cmd)
{
const char *page = cmd_to_page(git_cmd);
setenv("INFOPATH", system_path(GIT_INFO_PATH), 1);
execlp("info", "info", "gitman", page, (char *)NULL);
die(_("no info viewer handled the request"));
}
编辑:execlp的补充说明(3)来回MTHE手册页 FreeBSD的手册页说明)execlp的使用(如下
int
execlp(const char *file, const char *arg, ... /*, (char *)0 */);
The initial argument for these functions is the pathname of a file which
is to be executed.
The const char *arg and subsequent ellipses in the execl(), execlp(), and
execle() functions can be thought of as arg0, arg1, ..., argn. Together
they describe a list of one or more pointers to null-terminated strings
that represent the argument list available to the executed program. The
first argument, by convention, should point to the file name associated
with the file being executed. The list of arguments must be terminated
by a NULL pointer.
The functions execlp(), execvp(), and execvP() will duplicate the actions
of the shell in searching for an executable file if the specified file
name does not contain a slash ``/'' character. For execlp() and
execvp(), search path is the path specified in the environment by
``PATH'' variable. If this variable is not specified, the default path
is set according to the _PATH_DEFPATH definition in , which is
set to ``/usr/bin:/bin''
PS:一些信息,如默认的搜索路径,垫变化根据您的系统