Remove unecessary files

This commit is contained in:
stitchy 2023-11-16 07:14:36 +00:00
parent d8d82cf3c0
commit be9d0a90fa
Signed by: stitchy
SSH key fingerprint: SHA256:yz2SoxdnY67tfY5Jzb0f2v8f5W3o/IF359kbcquWip8
3 changed files with 13 additions and 86 deletions

View file

@ -2,6 +2,7 @@
volatile sig_atomic_t stop_flag = 0; volatile sig_atomic_t stop_flag = 0;
int stop_msg = 0; int stop_msg = 0;
int at_prompt = 0;
int main() { int main() {
@ -31,10 +32,12 @@ int main() {
// Shell Value Grabbing // Shell Value Grabbing
at_prompt = 1;
printf(": "); printf(": ");
fflush(stdout); fflush(stdout);
getline_len = getline(&input, &input_size, stdin); getline_len = getline(&input, &input_size, stdin);
input[getline_len - 1] = '\0'; input[getline_len - 1] = '\0';
at_prompt = 0;
// Fill in PID for '$$' // Fill in PID for '$$'
expand_dollar(input, input_size); expand_dollar(input, input_size);
@ -159,6 +162,7 @@ int run_command(char*** array, int num_array) {
int f = fork(); int f = fork();
pid_t pid; pid_t pid;
if(!f) { if(!f) {
signal(SIGTSTP, sigstop_handle);
// Handle Redirected output // Handle Redirected output
if(redirect_o) { if(redirect_o) {
int fd = open(redirect_o_str, O_WRONLY | O_CREAT, 0666); int fd = open(redirect_o_str, O_WRONLY | O_CREAT, 0666);
@ -262,6 +266,15 @@ void sigstop_handle() {
// Negate flags so that it handles both starting and stopping // Negate flags so that it handles both starting and stopping
stop_flag = !stop_flag; stop_flag = !stop_flag;
stop_msg = !stop_msg; stop_msg = !stop_msg;
if(at_prompt) {
if(stop_flag)
puts("\nEntering Stop Mode: Background Processes Do Not Work (&)\n:");
else
puts("\nExiting Stop Mode: Background Processes Now Work (&)\n:");
stop_msg = 0;
}
} }
void clean_children() { void clean_children() {

View file

@ -1,62 +0,0 @@
#include "node.h"
void append_node(struct node* head, struct node* node_app) {
if(!head) {
head = node_app;
return;
}
struct node* temp = head;
while(temp->node != NULL) {
temp = temp->node;
}
temp->node = node_app;
}
struct node* appendv_node(struct node* head, void* data) {
struct node* node = malloc(sizeof(struct node));
node->data = data;
node->node = NULL;
append_node(head, node);
return node;
}
int count_nodes(struct node* head) {
int num = 1;
if(!head)
return -1;
struct node* temp = head;
while(temp->node) {
temp = temp->node;
num++;
}
return num;
}
void iterate_nodes(struct node* head, void *func (void*, void*), void* val) {
if(!head)
return;
func(head->data, val);
struct node* temp = head;
while(temp->node) {
temp = temp->node;
func(temp->data, val);
}
}

View file

@ -1,24 +0,0 @@
#include "stdlib.h"
#ifndef NODES
#define NODES
struct node {
struct node* node;
void* data;
};
// Appends Node to list
void append_node(struct node*, struct node*);
// Creates node with value and appends
// Returns node that was created
struct node* appendv_node(struct node*, void*);
// Counts the number of nodes in a list
int count_nodes(struct node*);
// Iterates over every node in a list and runs the given function
void iterate_nodes(struct node*, void *func(void*, void*), void*);
#endif