From ddcf611815c145b1fadca042e65648a7a81cc497 Mon Sep 17 00:00:00 2001 From: "Douglas B. Rumbaugh" Date: Sat, 1 Nov 2025 14:53:14 -0400 Subject: Added variable support --- include/command.h | 8 ++++---- include/variables.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 include/variables.h (limited to 'include') diff --git a/include/command.h b/include/command.h index f44c103..2948aca 100644 --- a/include/command.h +++ b/include/command.h @@ -11,16 +11,16 @@ #include "config.h" typedef struct command { - char *command; - char *infile; - char *outfile; + const char *command; + const char *infile; + const char *outfile; struct command *next; struct command *prev; pid_t pid; int pipe[2]; - char *args[MAX_ARGUMENT_CNT + 2]; + const char *args[MAX_ARGUMENT_CNT + 2]; } command; diff --git a/include/variables.h b/include/variables.h new file mode 100644 index 0000000..7511690 --- /dev/null +++ b/include/variables.h @@ -0,0 +1,29 @@ +/* + * + */ +#ifndef H_HUSH_VARIABLES +#define H_HUSH_VARIABLES + +#include +#include +#include + +#include "strmap.h" +#include "hashfuncs.h" + +static inline bool is_variable(const char *token) { + return (token) ? token[0] == '$' : false; +} + +bool init_variable_store(void); + +bool add_variable(const char *key, const char *val); + +const char *get_variable(const char *key); + +bool promote_variable_to_env(const char *key); + +void destroy_variable_store(); + + +#endif -- cgit v1.2.3