diff --git a/README.md b/README.md index 782314b..52004e8 100644 --- a/README.md +++ b/README.md @@ -366,6 +366,9 @@ tek4010 has the following options: -hidecursor hides the cursor. Do not set while using GIN mode. + -wait n Close window n seconds after completion of "command". + It does not make sense to use -noexit together with -wait. + **APL mode** If tek4010 is called with the -APL argument, a Tektronix 4013 and Tektronix 4015 is emulated diff --git a/tek4010 b/tek4010 index d9c6dde..d906abc 100755 Binary files a/tek4010 and b/tek4010 differ diff --git a/tube.c b/tube.c index 3230379..dc9fdce 100755 --- a/tube.c +++ b/tube.c @@ -82,6 +82,7 @@ int argAPL = 0; int argAutoClear = 0; int argKeepSize = 0; int argHideCursor = 0; +int argWait = 0; int refresh_interval; // after this time in msec next refresh is done @@ -119,6 +120,7 @@ static int currentFontSize = 18; static int currentCharacterOffset = 0; long startPaintTime; +long firstWait; int leftmargin; @@ -288,7 +290,7 @@ void tube_init(int argc, char* argv[]) char *argv2[20]; size_t bufsize = 127; int firstArg = 1; - printf("tek4010 version 1.6\n"); + printf("tek4010 version 1.7\n"); windowName = "Tektronix 4010/4014 emulator"; if ((argc<2) || (argc>19)) { printf("Error:number of arguments\n"); @@ -301,7 +303,7 @@ void tube_init(int argc, char* argv[]) argc--; } - while ((argv[firstArg][0] == '-') && firstArg < argc-1) { + while ((argv[firstArg][0] == '-') && (firstArg < argc-1)) { if (strcmp(argv[firstArg],"-raw") == 0) argRaw = 1; else if (strcmp(argv[firstArg],"-noexit") == 0) @@ -346,6 +348,17 @@ void tube_init(int argc, char* argv[]) argARDS = 1; windowName = "ARDS emulator"; } + else if (strcmp(argv[firstArg],"-wait") == 0) { + argWait = 3; + if (firstArg < argc-2) { + if ((argv[firstArg+1][0] >= '0') && + (argv[firstArg+1][0] <= '9')) { + firstArg++; + argWait = atoi(argv[firstArg]); + } + } + // printf("Waiting %d seconds after end of plot\n", argWait); + } else { printf("tek4010: unknown argument %s\n", argv[firstArg]); exit(1); @@ -486,7 +499,19 @@ int tube_on_timer_event() // is child process still running? int status; - if ((!argNoexit) && (tube_isInput() == 0) && (waitpid(-1, &status, WNOHANG))) { + if (argWait) { + if (firstWait == 0) + firstWait = tube_mSeconds(); + else { + if ((int)((tube_mSeconds() - firstWait) / 1000) > argWait) { + tube_quit(); + gtk_main_quit(); + printf("Process has been terminated after %d seconds\n", argWait); + exit(0); + } + } + } + else if ((!argNoexit) && (tube_isInput() == 0) && (waitpid(-1, &status, WNOHANG))) { long t = tube_mSeconds(); // printf("Execution time: %0.3f sec\n", (double)t/1000.0); // if (t > 0) { diff --git a/tube.h b/tube.h index b39e06c..6f83fa8 100755 --- a/tube.h +++ b/tube.h @@ -20,6 +20,7 @@ extern int argAPL; extern int argAutoClear; extern int argKeepSize; extern int argHideCursor; +extern int argWait; extern int hDotsPerChar; extern int vDotsPerChar; diff --git a/versions.txt b/versions.txt index 031491f..634e434 100644 --- a/versions.txt +++ b/versions.txt @@ -168,3 +168,9 @@ New features: - Added versions.txt Bug fixes: - fixed demo.sh to display dodekagon.plt instead of captured_data + +Version 1.7 October 18, 2023 +============================ +Added -wait n seconds as argument, staying alive n seconds after +completion. +