From faadb774b434d7782f2217c263b4ff38068c6512 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Tue, 8 Oct 2024 08:51:28 +0100 Subject: [PATCH] docs: quit -noprompt Was looking to implement this feature and found it was already implemented but is a secret feature. Updated documentation and modified implementation so it is possible a user can discover the feature via usage such as "quit -help -invalid" like other commands. --- doc/html/quit.html | 5 ++++- windows/windCmdNR.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/html/quit.html b/doc/html/quit.html index 2bff2e41..e263a1a8 100644 --- a/doc/html/quit.html +++ b/doc/html/quit.html @@ -31,7 +31,7 @@ Exit magic

Usage:

- quit

+ quit [-noprompt]

Summary:

@@ -45,6 +45,9 @@ Exit magic and the Tcl exit command is required to quit the program. The Tcl exit command will always exit magic immediately, without prompting or cleanup or any other niceties.

+ + With the -noprompt option, the interactive confirm prompt + does not occur so any changes will be discarded.

Implementation Notes:

diff --git a/windows/windCmdNR.c b/windows/windCmdNR.c index a9a33cb0..7a780472 100644 --- a/windows/windCmdNR.c +++ b/windows/windCmdNR.c @@ -265,15 +265,28 @@ windQuitCmd(w, cmd) bool checkfirst = TRUE; if (cmd->tx_argc == 2) + { if (!strcmp(cmd->tx_argv[1], "-noprompt")) + { checkfirst = FALSE; + cmd->tx_argc--; + } + } + + if (cmd->tx_argc > 1) + { + TxError("Usage: quit [-noprompt]\n"); + return; + } if (checkfirst) + { for (cr = windFirstClientRec; cr != (clientRec *) NULL; cr = cr->w_nextClient) if (cr->w_exit != NULL) if (!(*(cr->w_exit))()) return; + } MainExit(0); }