summaryrefslogtreecommitdiffstats
path: root/src/shell.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 05:48:51 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 05:48:51 +0200
commite03ec948967225c8162ffecf37b59bbfc338a83a (patch)
tree6c53c822063d32edb1f387fbf8879155626aafd8 /src/shell.h
parent9b5e5f7883ef59201d17343680d109c1f9d5ae9b (diff)
downloadfastd-e03ec948967225c8162ffecf37b59bbfc338a83a.tar
fastd-e03ec948967225c8162ffecf37b59bbfc338a83a.zip
Lots and lots of documentation
Diffstat (limited to 'src/shell.h')
-rw-r--r--src/shell.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/shell.h b/src/shell.h
index 9b66477..9c2b8ab 100644
--- a/src/shell.h
+++ b/src/shell.h
@@ -23,6 +23,12 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/**
+ \file shell.h
+
+ Execution of shell commands and management of environment variables
+*/
+
#pragma once
@@ -32,13 +38,15 @@
#include <string.h>
+/** A shell command */
struct fastd_shell_command {
- char *command;
- char *dir;
- bool sync;
+ char *command; /**< The command as given to \em /bin/sh */
+ char *dir; /**< The working directory for the command */
+ bool sync; /**< If false, the command will be executed in the background by default */
};
+/** Frees the resources used by a shell command */
static inline void fastd_shell_command_unset(fastd_shell_command_t *command) {
free(command->command);
command->command = NULL;
@@ -47,6 +55,7 @@ static inline void fastd_shell_command_unset(fastd_shell_command_t *command) {
command->dir = NULL;
}
+/** Sets a shell command */
static inline void fastd_shell_command_set(fastd_shell_command_t *command, const char *val, bool sync) {
fastd_shell_command_unset(command);
@@ -55,6 +64,7 @@ static inline void fastd_shell_command_set(fastd_shell_command_t *command, const
command->sync = sync;
}
+/** Checks if a shell command is set */
static inline bool fastd_shell_command_isset(const fastd_shell_command_t *command) {
return command->command;
}