feat: also modularizing main
This commit is contained in:
parent
345ea44fb3
commit
ec3fc81544
1 changed files with 16 additions and 1 deletions
17
src/main.c
17
src/main.c
|
@ -1,15 +1,29 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "reader.h"
|
||||
|
||||
int main() {
|
||||
/*
|
||||
size_t buffer_size;
|
||||
size_t initial_buffer_size = 64;
|
||||
char *input_buffer;
|
||||
char *initial_buffer_position;
|
||||
unsigned int how_many_characters_to_read;
|
||||
*/
|
||||
char *input_line;
|
||||
|
||||
while (1) {
|
||||
printf("$ ");
|
||||
input_line = read_a_line(stdin);
|
||||
if (input_line == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("command: '%s'\n", input_line);
|
||||
|
||||
free(input_line);
|
||||
/*
|
||||
buffer_size = initial_buffer_size;
|
||||
how_many_characters_to_read = buffer_size + 1;
|
||||
input_buffer = malloc(how_many_characters_to_read);
|
||||
|
@ -32,5 +46,6 @@ int main() {
|
|||
printf("%s", input_buffer);
|
||||
|
||||
free(input_buffer);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue