summaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/exec.c b/exec.c
index 288aac4..3a88901 100644
--- a/exec.c
+++ b/exec.c
@@ -10,49 +10,6 @@
#include <signal.h>
-
-void set_map_pair(KeyValMap* map, char* key, char* val) {
-for (int i = 0; i < map->count; i++) {
- char* key_i = get_from_KeyValMap(map, i)->key;
- if (key_i == NULL) continue;
- if (strcmp(key_i, key) == 0) {
- // TODO: maybe copy instead
- strcpy(
- map->blocks[i / map->block_size][i % map->block_size].val,
- val
- );
- break;
- }
- }
-}
-
-MaybeStr get_map_value(KeyValMap* map, char* key) {
- for (int i = 0; i < map->count; i++) {
- char* key_i = get_from_KeyValMap(map, i)->key;
- if (key_i == NULL) continue;
- if (strcmp(key_i, key) == 0) {
- return (MaybeStr){
- .some = true,
- .value = get_from_KeyValMap(map, i)->val
- };
- }
- }
- return (MaybeStr){.some = false};
-}
-
-void unset_map_key(KeyValMap* map, char* key) {
- for (int i = 0; i < map->count; i++) {
- char* key_i = get_from_KeyValMap(map, i)->key;
- if (key_i == NULL) continue;
- if (strcmp(key_i, key) == 0) {
- map->blocks[i / map->block_size][i % map->block_size].key = NULL;
- break;
- }
- }
-}
-
-
-
char* get_var(char* varname, ShellState* shstate) {
MaybeStr maybe_varval = get_map_value(&shstate->shell_vars, varname);
if (maybe_varval.some == true) return maybe_varval.value;
@@ -78,8 +35,6 @@ ExpandedChunk expand_chunk(Chunk chunk, ShellState* shstate) {
return (ExpandedChunk){.qmode = chunk.qmode, .content = content};
}
-DECLARE_VEC(char*, StrVec)
-
typedef struct {
StrVec complete_strs;
@@ -119,14 +74,6 @@ StrVec expand_word(Word word, ShellState* state) {
}
return curr_res.complete_strs;
-
- /*
- char** res_ptr = malloc(sizeof(char*) * curr_res.complete_strs.count);
- for (int j = 0; j < curr_res.complete_strs.count; j++) {
- res_ptr[j] = curr_res.complete_strs.blocks[j / curr_res.complete_strs.block_size][j % curr_res.complete_strs.block_size];
- }
- return res_ptr;
- */
}
@@ -137,8 +84,6 @@ void merge_strvecs(StrVec* target, StrVec* source) {
}
-
-
char** make_cmd_args(Command command, ShellState* shstate) {
StrVec arg_str_vec = make_StrVec(256);
for (int i = 0; i < command.args.count; i++) {
@@ -163,10 +108,6 @@ char** make_cmd_args(Command command, ShellState* shstate) {
}
-
-
-DECLARE_VEC(int, IntVec)
-
typedef struct {
char** args;
int stdin_fd;