dpkg 1.21.11
Data Structures | Functions
Command execution
Collaboration diagram for Command execution:

Data Structures

struct  command
 Describe a command to execute. More...
 

Functions

void command_init (struct command *cmd, const char *filename, const char *name)
 Initialize a command structure. More...
 
void command_destroy (struct command *cmd)
 Destroy a command structure. More...
 
void command_add_arg (struct command *cmd, const char *arg)
 Append an argument to the command's argv. More...
 
void command_add_argl (struct command *cmd, const char **argv)
 Append an argument array to the command's argv. More...
 
void command_add_argv (struct command *cmd, va_list args)
 Append a va_list of argument to the command's argv. More...
 
void command_add_args (struct command *cmd,...) DPKG_ATTR_SENTINEL
 Append a variable list of argument to the command's argv. More...
 
void command_exec (struct command *cmd) DPKG_ATTR_NORET
 Execute the command specified. More...
 
void command_shell (const char *cmd, const char *name) DPKG_ATTR_NORET
 Execute a shell with a possible command. More...
 

Detailed Description

Function Documentation

◆ command_add_arg()

void command_add_arg ( struct command cmd,
const char *  arg 
)

Append an argument to the command's argv.

Parameters
cmdThe command structure to act on.
argThe argument to append to argv.

Referenced by execbackend(), and maintscript_new().

Here is the caller graph for this function:

◆ command_add_argl()

void command_add_argl ( struct command cmd,
const char **  argv 
)

Append an argument array to the command's argv.

Parameters
cmdThe command structure to act on.
argvThe NULL terminated argument array to append to argv.

Referenced by execbackend().

Here is the caller graph for this function:

◆ command_add_args()

void command_add_args ( struct command cmd,
  ... 
)

Append a variable list of argument to the command's argv.

Parameters
cmdThe command structure to act on.
...The NULL terminated variable list of argument to append to argv.

References args, and command_add_argv().

Referenced by maintscript_fallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_add_argv()

void command_add_argv ( struct command cmd,
va_list  args 
)

Append a va_list of argument to the command's argv.

Parameters
cmdThe command structure to act on.
argsThe NULL terminated va_list of argument array to append to argv.

References args.

Referenced by command_add_args(), and maintscript_new().

Here is the caller graph for this function:

◆ command_destroy()

void command_destroy ( struct command cmd)

Destroy a command structure.

Free the members managed by the command functions (i.e. the argv pointer array), and zero all members of a command structure.

Parameters
cmdThe command structure to free.

References argc, argv, argv_size, filename, and name.

Referenced by maintscript_fallback(), and maintscript_new().

Here is the caller graph for this function:

◆ command_exec()

void command_exec ( struct command cmd)

Execute the command specified.

The command is executed searching the PATH if the filename does not contain any slashes, or using the full path if it's either a relative or absolute pathname. This functions does not return.

Parameters
cmdThe command structure to act on.

References _, argv, filename, name, and ohshite().

Referenced by execbackend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_init()

void command_init ( struct command cmd,
const char *  filename,
const char *  name 
)

Initialize a command structure.

If name is NULL, then the last component of the filename path will be used to initialize the name member.

Parameters
cmdThe command structure to initialize.
filenameThe filename of the command to execute.
nameThe description of the command to execute.

References argc, argv, argv_size, filename, m_malloc(), name, and path_basename().

Referenced by execbackend(), maintscript_fallback(), and maintscript_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ command_shell()

void command_shell ( const char *  cmd,
const char *  name 
)

Execute a shell with a possible command.

Parameters
cmdThe command string to execute, if it's NULL an interactive shell will be executed instead.
nameThe description of the command to execute.