aboutsummaryrefslogtreecommitdiffstats
path: root/include/variables.h
blob: 0df2b653b3c456a9db743f9b57bf218fb125526f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * include/variables.h
 *
 * Local variable storage and access
 * CISC 301 -- Operating Systems, Project 2
 *
 * Copyright (C) 2025  Douglas B. Rumbaugh <dbrumbaugh@harrisburgu.edu>
 *
 * Distributed under the Modified BSD License
 *
 */
#ifndef H_HUSH_VARIABLES
#define H_HUSH_VARIABLES

#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>

#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