From 0072819204d1f6ed04fbeb102291c97f0ee9c650 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 01:50:44 +0100 Subject: Allowed longer simulation names --- tsalis/src/handler.c | 1 + tsalis/src/printer.c | 11 ++++++++++- tsalis/src/tsalis.c | 8 ++++---- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'tsalis/src') diff --git a/tsalis/src/handler.c b/tsalis/src/handler.c index 21aa706..ded2d9a 100644 --- a/tsalis/src/handler.c +++ b/tsalis/src/handler.c @@ -130,6 +130,7 @@ static void renameSim(const char *name) { if (strlen(name) <= NAME_MAX_SIZE) { + clear(); strncpy(g_simName, name, NAME_MAX_SIZE); } } diff --git a/tsalis/src/printer.c b/tsalis/src/printer.c index a3f60b6..469b803 100644 --- a/tsalis/src/printer.c +++ b/tsalis/src/printer.c @@ -1,4 +1,5 @@ #include +#include #include #include #include "printer.h" @@ -714,7 +715,15 @@ tsp_printData(void) int linev = 1; int *line = &linev; PHEADER("SALIS"); - PSIDGET("name", g_simName); + + if (strlen(g_simName) < 24) { + PHEADER(g_simName); + } else { + attron(COLOR_PAIR(PAIR_HEADER)); + printWidget((*line)++, "%.20s...", g_simName); + standend(); + } + PSIDGET("state", g_running ? "running" : "paused"); if (g_autoSaveInterval) { diff --git a/tsalis/src/tsalis.c b/tsalis/src/tsalis.c index ab24c61..81c9a3d 100644 --- a/tsalis/src/tsalis.c +++ b/tsalis/src/tsalis.c @@ -33,7 +33,7 @@ onLoad(const char *fileName) FILE *testFile; if (strlen(fileName) > NAME_MAX_SIZE) { - fputs("ERROR: File name too long", stderr); + fputs("ERROR: File name too long\n", stderr); exit(1); } @@ -44,7 +44,7 @@ onLoad(const char *fileName) fclose(testFile); s_load(g_simName); } else { - fputs("ERROR: File does not exist", stderr); + fputs("ERROR: File does not exist\n", stderr); exit(1); } } @@ -63,11 +63,11 @@ init(int argc, char **argv) } else if (cmd == 'l') { onLoad(val); } else { - fputs("ERROR: Incorrect arguments", stderr); + fputs("ERROR: Incorrect arguments\n", stderr); exit(1); } } else { - fputs("ERROR: Incorrect argument count", stderr); + fputs("ERROR: Incorrect argument count\n", stderr); exit(1); } -- cgit v1.2.1