dpkg 1.22.7-3-g89f48
Loading...
Searching...
No Matches
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
26#include <stdarg.h>
27#include <stdbool.h>
28
30
40struct command {
42 const char *name;
44 const char *filename;
45 int argc;
47 const char **argv;
48};
49
50void command_init(struct command *cmd, const char *filename, const char *name);
51void command_destroy(struct command *cmd);
52
53void command_add_arg(struct command *cmd, const char *arg);
54void command_add_argl(struct command *cmd, const char **argv);
55void command_add_argv(struct command *cmd, va_list args);
56void command_add_args(struct command *cmd, ...) DPKG_ATTR_SENTINEL;
57
58void command_exec(struct command *cmd) DPKG_ATTR_NORET;
59
60void command_shell(const char *cmd, const char *name) DPKG_ATTR_NORET;
61
62bool command_in_path(const char *cmd);
63
67
68#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:162
void command_init(struct command *cmd, const char *filename, const char *name)
Initialize a command structure.
Definition command.c:47
bool command_in_path(const char *cmd)
Check whether a command can be found in PATH.
Definition command.c:227
void command_add_arg(struct command *cmd, const char *arg)
Append an argument to the command's argv.
Definition command.c:100
void command_exec(struct command *cmd) DPKG_ATTR_NORET
Execute the command specified.
Definition command.c:181
void command_add_argv(struct command *cmd, va_list args)
Append a va_list of argument to the command's argv.
Definition command.c:137
void command_destroy(struct command *cmd)
Destroy a command structure.
Definition command.c:69
void command_shell(const char *cmd, const char *name) DPKG_ATTR_NORET
Execute a shell with a possible command.
Definition command.c:195
void command_add_argl(struct command *cmd, const char **argv)
Append an argument array to the command's argv.
Definition command.c:115
#define DPKG_BEGIN_DECLS
Definition macros.h:164
#define DPKG_END_DECLS
Definition macros.h:165
#define DPKG_ATTR_SENTINEL
Definition macros.h:136
#define DPKG_ATTR_NORET
Definition macros.h:108
Describe a command to execute.
Definition command.h:40
int argc
Definition command.h:45
const char ** argv
Definition command.h:47
const char * name
Descriptive name of the command, used when printing.
Definition command.h:42
int argv_size
Definition command.h:46
const char * filename
Filename to execute; either a path or the progname.
Definition command.h:44