The only external change here is that it now always sets *cnt to 0 when it returns NULL
Previously, it could set it to -1 in some cases, in particular when dll_commands is NULL.
This led to a bug where /HELP would show the wrong number of matching commands, because it
added the return value of find_dll_command() to the number of matching internal commands.
Also fixes a set-but-unused-variable warning.
Rename global variable 's' to a longer name. Rename function 'ignore' to a name that reflects what
it actually does.
Make sigint_handler() and my_exit() static, because they're only used in this file.
Remove the 'how' parameter to rsindex(), making it reverse-search for only the first matching character,
as sindex() already does. There are only two callers, and one already passed a hardcoded value of 1.
Also change rsindex() so that it starts searching at the character BEFORE the passed in position. This
makes it easier to repeatedly call rsindex() in a loop to search for the Nth matching character, and
also fixes a technical instance of undefined behaviour where a pointer is decremented to point before
the start of the string.
Remove the 'mark' parameter to strsearch(). Instead, always forward-search from the beginning of the
string and reverse-search from the end of the string, as this is what the two callers want anyway.
Bump the module ABI version because these functions are exported to modules.
inv_strpbrk() is the inverse of the standard function strpbrk().
Calls to sindex() where both strings are not NULL and the second string begins with ^ are equivalent
to calls to inv_strpbrk() (but without the ^). Convert those calls.
sindex(), where neither argument is NULL and the accept string does not start with ^, is exactly equivalent
to the standard function strpbrk().
Further, strpbrk() where the accept string is only one character long, is exactly equivalent to strchr().
The old code could move the variable 'pointer' backwards one character before the start
of the string (then incremented it again before returning). Formally this is undefined
behaviour, so fix it.
The removed variables are:
dll_functions
dll_numeric
dll_commands
dll_variable
dll_ctcp
dll_window
These are not actually directly used by any modules, and hiding them allows us to more easily
change their implementation later.
This helper function is for modules to save the contents of their module variables to a file
as SET commands.
It will remove the need to export the raw dll_variable list to modules.
This error seemed to be benign, because I don't think there was a way to get here with
int_flags non-zero without VIF_CHANGED already set.
Remove unnecessary tests for 'value' and '!value', because value is always non-NULL in that
code path.
As reported by Ancient, this is how it is documented to work. It's also how shitlist level 2 works, so
it's consistent this way.
Some other cleanups in check_auto() while we're here.
A fractional-second timeout was already supported for the initial timeout of a /TIMER, but
if the timer was recurring then the interval was rounded to a whole number of seconds for
the subsequent timeouts.
Change the type of interval from long to double to fix this.
These globals were used to store the original terminal dimesions from the terminal database (or
in the case of reattaching, supplied by scr-bx) to be applied if the current terminal dimensions
could not be determined.
Instead, we leave the original terminal dimensions in current_term->TI_lines and current_term->TI_cols,
and create current_term->li and current_term->co to store the current terminal dimensions (as eg.
supplied by scr-bx).