dpkg 1.21.11
command.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * command.h - command execution support
4 *
5 * Copyright © 2010, 2012, 2015 Guillem Jover <guillem@debian.org>
6 *
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef LIBDPKG_COMMAND_H
22#define LIBDPKG_COMMAND_H
23
24#include <dpkg/macros.h>
25
27
37struct command {
39 const char *name;
41 const char *filename;
42 int argc;
44 const char **argv;
45};
46
47void command_init(struct command *cmd, const char *filename, const char *name);
48void command_destroy(struct command *cmd);
49
50void command_add_arg(struct command *cmd, const char *arg);
51void command_add_argl(struct command *cmd, const char **argv);
52void command_add_argv(struct command *cmd, va_list args);
53void command_add_args(struct command *cmd, ...) DPKG_ATTR_SENTINEL;
54
55void command_exec(struct command *cmd) DPKG_ATTR_NORET;
56
57void command_shell(const char *cmd, const char *name) DPKG_ATTR_NORET;
58
62
63#endif /* LIBDPKG_COMMAND_H */
void * args[20]
Definition: ehandle.c:89
void command_add_args(struct command *cmd,...) DPKG_ATTR_SENTINEL
Append a variable list of argument to the command's argv.
Definition: command.c:160
void command_init(struct command *cmd, const char *filename, const char *name)
Initialize a command structure.
Definition: command.c:45
void command_add_arg(struct command *cmd, const char *arg)
Append an argument to the command's argv.
Definition: command.c:98
void command_exec(struct command *cmd) DPKG_ATTR_NORET
Execute the command specified.
Definition: command.c:179
void command_add_argv(struct command *cmd, va_list args)
Append a va_list of argument to the command's argv.
Definition: command.c:135
void command_destroy(struct command *cmd)
Destroy a command structure.
Definition: command.c:67
void command_shell(const char *cmd, const char *name) DPKG_ATTR_NORET
Execute a shell with a possible command.
Definition: command.c:193
void command_add_argl(struct command *cmd, const char **argv)
Append an argument array to the command's argv.
Definition: command.c:113
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
#define DPKG_ATTR_SENTINEL
Definition: macros.h:71
#define DPKG_ATTR_NORET
Definition: macros.h:55
Describe a command to execute.
Definition: command.h:37
int argc
Definition: command.h:42
const char ** argv
Definition: command.h:44
const char * name
Descriptive name of the command, used when printing.
Definition: command.h:39
int argv_size
Definition: command.h:43
const char * filename
Filename to execute; either a path or the progname.
Definition: command.h:41