added shell.c

This commit is contained in:
Rushil Umaretiya 2024-04-25 22:36:43 -04:00
parent 01aaa805d1
commit 7fbefbfefa
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959

18
shell.c
View File

@ -1,20 +1,26 @@
// PID: 9DigitPidNoSpacesOrDashes
// PID: 730677144
// I pledge the COMP 211 honor code.
// All necessary libraries are included in shell.h
#include "shell.h"
void alloc_mem_for_argv(command_t* p_cmd) {
// TODO:
p_cmd->argv = (char**)malloc((p_cmd->argc + 1) * sizeof(char*));
for (int i = 0; i < p_cmd->argc; i++) {
p_cmd->argv[i] = (char*)malloc(MAX_ARG_LEN * sizeof(char));
}
p_cmd->argv[p_cmd->argc] = NULL;
}
void cleanup(command_t* p_cmd) {
// TODO:
for (int i = 0; i < p_cmd->argc; i++) {
free(p_cmd->argv[i]);
p_cmd->argv[i] = NULL;
}
}
void parse(char* line, command_t* p_cmd) {
// TODO:
}
void parse(char* line, command_t* p_cmd) {}
bool find_full_path(command_t* p_cmd) {
// TODO: