dish/loop.c

29 lines
535 B
C
Raw Normal View History

2022-09-18 06:46:23 +00:00
/*
* @Author: 1ridic
* @Date: 2022-09-18 14:13:53
* @Last Modified by: 1ridic
* @Last Modified time: 2022-09-18 23:32:02
2022-09-18 06:46:23 +00:00
*/
2022-09-18 05:14:30 +00:00
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
2022-09-18 05:14:30 +00:00
#include <stdlib.h>
#include <string.h>
#include "loop.h"
#include "exec.h"
#include "line.h"
int status;
2022-09-18 05:14:30 +00:00
int loop() {
2022-09-18 05:14:30 +00:00
char *line;
char **args;
line = readline(ANSI_COLOR_GREEN"> "ANSI_COLOR_RESET);
add_history(line);
2022-09-18 05:14:30 +00:00
args = splitLine(line);
status = commandExec(args);
2022-09-18 05:14:30 +00:00
free(line);
free(args);
return 0;
}