#include #include #include "echo.h" #include int main(int argc, char** argv) { char* path; if (argc > 0) { path = argv[1]; } else { exit(0); } char* content = read_file(path); parse(content); } char* read_file(char* path) { FILE* file = fopen(path, "r"); if (file == NULL) { printf("file%s does not exist\n", path); } fseek(file, 0, SEEK_END); unsigned long int length = ftell(file); fseek(file, 0, SEEK_SET); char* out = malloc((length + 1) * sizeof(char)); fread(out, length, 1, file); fclose(file); out[length] = '\0'; return out }