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.
This commit is contained in:
parent
b694827bcb
commit
faadb774b4
|
|
@ -31,7 +31,7 @@ Exit magic
|
|||
|
||||
<H3>Usage:</H3>
|
||||
<BLOCKQUOTE>
|
||||
<B>quit</B> <BR><BR>
|
||||
<B>quit</B> [<B>-noprompt</B>]<BR><BR>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3>Summary:</H3>
|
||||
|
|
@ -45,6 +45,9 @@ Exit magic
|
|||
and the Tcl <B>exit</B> command is required to quit the program.
|
||||
The Tcl <B>exit</B> command will <I>always</I> exit <B>magic</B>
|
||||
immediately, without prompting or cleanup or any other niceties. <P>
|
||||
|
||||
With the <B>-noprompt</B> option, the interactive confirm prompt
|
||||
does not occur so any changes will be discarded.
|
||||
</BLOCKQUOTE>
|
||||
|
||||
<H3>Implementation Notes:</H3>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue