Apache APR函数APR\u procattr\u cmdtype\u集混淆

Apache APR函数APR\u procattr\u cmdtype\u集混淆,c,apache,C,Apache,我一直在关注关于C编码的在线教程,代码使用的是ApacheApr库。 它使用apr\u proc\t结构来执行外部应用程序。 我对这个函数感到困惑,有人能解释一下这个函数的含义吗: apr_status_t apr_procattr_cmdtype_set ( apr_procattr_t * attr, apr_cmdtype_e cmd ) Set what type of command the child process wil

我一直在关注关于C编码的在线教程,代码使用的是ApacheApr库。 它使用apr\u proc\t结构来执行外部应用程序。 我对这个函数感到困惑,有人能解释一下这个函数的含义吗:

apr_status_t apr_procattr_cmdtype_set   (   apr_procattr_t *    attr,
        apr_cmdtype_e   cmd 
    )       

Set what type of command the child process will call.

Parameters:
    attr    The procattr we care about.
    cmd The type of command. One of:

                APR_SHELLCMD     --  Anything that the shell can handle
                APR_PROGRAM      --  Executable program   (default) 
                APR_PROGRAM_ENV  --  Executable program, copy environment
                APR_PROGRAM_PATH --  Executable program on PATH, copy env

apr\u procattr\u cmdtype\u set
函数用于告诉apr您希望如何执行外部命令,它可能只是设置了一个内部标志并进行了一些簿记

让我们看一下:

APR\u SHELLCMD

使用shell调用程序

APR\u节目

直接调用程序,无需复制环境

APR\u PROGRAM\u ENV

调用程序,复制我们的环境

APR\u程序路径

在路径上查找程序,使用我们的环境

APR\u SHELLCMD\u ENV

使用shell调用程序,复制我们的环境

第一个和最后一个选项(
APR\u SHELLCMD
APR\u SHELLCMD\u ENV
)几乎都是说“使用的可移植版本”(有或没有将当前环境变量复制到新进程)。其他只是Unix/pair上的变体,带有选择要使用的
exec
函数系列的标志