builtins #6
@ -16,6 +16,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
|
#include "builtins.h"
|
||||||
|
|
||||||
bool is_builtin(char *command) {
|
bool is_builtin(char *command) {
|
||||||
if (strcmp(command, "exit") == 0) {
|
if (strcmp(command, "exit") == 0) {
|
||||||
@ -31,11 +32,11 @@ bool is_builtin(char *command) {
|
|||||||
|
|
||||||
void run_builtin(StringArray *string_array) {
|
void run_builtin(StringArray *string_array) {
|
||||||
if (strcmp(string_array->array[0], "exit") == 0) {
|
if (strcmp(string_array->array[0], "exit") == 0) {
|
||||||
|
exit_shell(string_array);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void exit_shell(StringArray *string_array) {
|
||||||
free_string_array(string_array);
|
free_string_array(string_array);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void exit_shell() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -20,5 +20,5 @@
|
|||||||
#define _MYSHELLIN_BUILTINS
|
#define _MYSHELLIN_BUILTINS
|
||||||
bool is_builtin(char *command);
|
bool is_builtin(char *command);
|
||||||
void run_builtin(StringArray *string_array);
|
void run_builtin(StringArray *string_array);
|
||||||
void exit_shell();
|
void exit_shell(StringArray *string_array);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user