diff --git a/src2/server.c b/src2/server.c index c26ec71..c1a1680 100644 --- a/src2/server.c +++ b/src2/server.c @@ -41,6 +41,7 @@ int runMarker2 = 0; //save file stuff char *default_file_name = "untitled.quest"; +int run_count = 0; int files = 0; char **filePaths = NULL; char **names, **values; @@ -294,6 +295,7 @@ void appendRunToFile() fprintf(fp, "\n"); fclose(fp); + run_count++; runUnsaved = false; } @@ -319,10 +321,14 @@ void loadFiles() while(1) { if (!fgets(buff, 255, fp)) break; - if (buff[0] == '/' && buff[1] == '/' || buff[0] == '\n') + if (buff[0] == '/' && buff[1] == '/' || buff[0] == '\n' || buff[0] == '\t') continue; if (!strcmp(buff, "Segment\n") || !strcmp(buff, "Route\n")) - break; + continue; + if (!strcmp(buff, "Run\n")) { + run_count++; + continue; + } if (!fgets(buff2, 255, fp)) break; if (buff2[0] == '\t') { @@ -347,6 +353,7 @@ void loadFiles() for (int i = 0; i < valuecount; i++) { printf("%s | %s", names[i], values[i]); } + printf("%d\n", run_count); } //TODO: eventually file loading should support loading multiple files diff --git a/src2/tui.c b/src2/tui.c index 4f41cf1..4a86830 100644 --- a/src2/tui.c +++ b/src2/tui.c @@ -64,7 +64,7 @@ int timestringDigits(int ms) void printbig(int x, int y, int ms) { char small[13]; - timestring(&small, ms); + timestring(small, ms); if (w < strlen(small)) { printf("2smol\n"); return; @@ -194,18 +194,20 @@ int main (int argc, char *argv[]) //Request foreground color from config file fp = popen("./result/bin/quest-log foreground", "r"); - fgets(path, sizeof(path), fp); - if (strcmp(path, "DATA NOT PRESENT")) - processColorString(&f, path); - printf("\033[38;2;%d;%d;%dm", f.r, f.g, f.b); + if (fgets(path, sizeof(path), fp)) { + if (strcmp(path, "DATA NOT PRESENT")) + processColorString(&f, path); + printf("\033[38;2;%d;%d;%dm", f.r, f.g, f.b); + } pclose(fp); //Request background color from config file fp = popen("./result/bin/quest-log background", "r"); - fgets(path, sizeof(path), fp); - if (strcmp(path, "DATA NOT PRESENT")) - processColorString(&b, path); - printf("\033[48;2;%d;%d;%dm", b.r, b.g, b.b); + if (fgets(path, sizeof(path), fp)) { + if (strcmp(path, "DATA NOT PRESENT")) + processColorString(&b, path); + printf("\033[48;2;%d;%d;%dm", b.r, b.g, b.b); + } pclose(fp); //Set fps from command line argument