Commit Graph

854 Commits

Author SHA1 Message Date
Kevin Easton
0905cf9528 Remove unused variable tcl_ret in do_hook()
Squashes a warning.
2017-11-29 23:50:32 +11:00
Kevin Easton
b458082800 Simplify putchar_x() definition
Introduce an inline helper xlate_char() to isolate the character translation code.

This halves the permutations of putchar_x() required.
2017-11-28 14:40:19 +11:00
Kevin Easton
863263aa07 Make inclusion of tcl_bx.h unconditional
There's no need for the conditional compilation - tcl_bx.h itself has the WANT_TCL guards
necessary.

This makes generating the Makefile target dependencies easier.
2017-11-27 23:15:06 +11:00
Kevin Easton
256b33747c Replace use of _inline and __inline with inline
AC_C_INLINE in configure.in defines inline as a macro where necessary.
2017-11-27 23:02:35 +11:00
Kevin Easton
a60937a8fd Move dll_commands and find_dll_command from commands.c to modules.c
Kind of where it belongs.
2017-11-27 20:07:28 +11:00
Kevin Easton
0ba25f02a5 Simplify and clean up find_dll_command()
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.
2017-11-27 17:18:15 +11:00
Kevin Easton
860e7e28fb Fix unsigned char / char mismatch warnings in encrypt plugin
There's no need to dynamically allocate encode_string, so just make it static.

It does need to be unsigned char though, for the loop that intialises it.  So cast it
when calling my_encrypt() / my_decrypt().
2017-11-25 01:37:11 +11:00
Kevin Easton
e63033e1d5 Include tcl.h via tcl_bx.h, not directly
This fixes 'const char **' vs 'char **' compiler warnings.

Additionally, tcl_bx.h always defines STDVAR and can be included without checking for WANT_TCL.
2017-11-25 01:18:13 +11:00
Kevin Easton
c719a0ecb3 Test pointer against NULL rather than casting to int 2017-11-25 01:09:11 +11:00
Kevin Easton
2b84718039 Remove unused have_head variable in possum.c 2017-11-25 01:02:47 +11:00
Kevin Easton
21ed1a01a3 Numerous minor fixes to nap plugin 2017-11-25 00:53:43 +11:00
Kevin Easton
862137d975 Remove redundant test in fserv.c 2017-11-24 23:47:37 +11:00
Kevin Easton
c426c0dcca Use correct *printf format specifiers in fserv.c
Format ints with %d, not %u.
2017-11-24 23:25:10 +11:00
Kevin Easton
f621f48a25 Fix some obvious errors in do_dccbomb() 2017-11-24 23:17:39 +11:00
Kevin Easton
70ce80dced Minor cleanups in wserv.c
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.
2017-11-24 17:29:51 +11:00
Kevin Easton
ba1b9742ec Simplify calling of rsindex() and strsearch()
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.
2017-11-23 17:22:38 +11:00
Kevin Easton
de303ba554 Change scr-bx to list the detached screens if more than one matches
This appears to be the original intention.  It's certainly more friendly, anyway.
2017-11-18 00:20:36 +11:00
Kevin Easton
a3e6f10be4 Simplify find_detach_socket() in scr-bx
This should cause no user-visible change.
2017-11-17 23:51:05 +11:00
Kevin Easton
0abfa67aa8 Don't pass -1 as the length to write() if read() fails 2017-11-17 23:06:46 +11:00
Kevin Easton
149b3206e0 Improve error handling around file descriptors in wserv 2017-11-17 22:55:06 +11:00
Kevin Easton
abfe84eb5c Use correct formats / types in snprintf() calls in tcl.c 2017-11-17 22:48:03 +11:00
Kevin Easton
1569d859af Clean up upper() and lower() 2017-11-17 17:43:22 +11:00
Kevin Easton
0d5698d41b Add inv_strpbrk() function and convert equivalent sindex() calls
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.
2017-11-17 17:19:07 +11:00
Kevin Easton
8c7d9334dd Replace uses of sindex() with constant accept strings with strpbrk() / strchr()
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().
2017-11-17 16:32:28 +11:00
Kevin Easton
eb6ffc7395 Convert strsearch() arguments to const char *
Also clean up the implementation a little.
2017-11-17 15:47:33 +11:00
Kevin Easton
e8ce5fb973 Convert sindex() and rsindex() to use const char * arguments
Also simply sindex() considerably using standard strspn() / strcspn() functions.
2017-11-17 12:21:12 +11:00
Kevin Easton
fea88185f8 Clean up function move_to_abs_word() and rename to move_to_word()
Remove the output argument, as it's the same as the function return value anyway, so
the callers should just use that.
2017-11-14 23:15:33 +11:00
Kevin Easton
5e40c1ac01 Don't move pointer before start of object in move_word_rel()
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.
2017-11-12 23:34:54 +11:00
Kevin Easton
a71ee883e1 Make "You can't hide an invisible window" message respect /SET WINDOW_QUIET
Also remove unnecessary NULL check, window->screen is already checked for NULL.
2017-11-10 17:16:58 +11:00
Kevin Easton
c6f420b53d Simplify get_window_by_desc()
The '#' case never worked anyway, so just remove it and simplify.
2017-11-10 17:12:09 +11:00
Kevin Easton
3ec950a7d7 Allow $mychannels() to query a window attached to a different server
Otherwise, there's really no point in passing this function a window refnum at all.
2017-11-10 16:57:26 +11:00
Kevin Easton
a028aebdb9 Fix crash when passing $mychannels() a non-existent window refnum 2017-11-10 16:53:32 +11:00
Kevin Easton
8a176c6950 Remove pointless check for unsigned number < 0 in get_window_by_refnum() 2017-11-09 23:50:13 +11:00
Kevin Easton
ce55f5eaa8 Move unsetting of UPDATE_STATUS flag into update_window_status()
Also remove a buggy attempt to unset the flag from set_hold_mode().
2017-11-09 23:45:09 +11:00
Kevin Easton
c881d1d20f Simplify condition in set_current_channel_by_refnum() 2017-11-09 23:35:28 +11:00
Kevin Easton
f81126186c Simplifications in window_query()
Should be no user-visible changes.
2017-11-09 23:32:56 +11:00
Kevin Easton
50999b3d5b Remove six dll_ variables from the module exports table
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.
2017-11-06 17:14:12 +11:00
Kevin Easton
a58078de7e Fix size argument in call to memset in MD5Final()
This function isn't used anyway, but the compiler was warning about the incorrect code.
2017-11-06 17:07:58 +11:00
Kevin Easton
fcda7a4d55 Switch cavlink and nap plugins to use save_dllvar() function for saving SETs
This removes the only module uses of dll_variable, allowing it to be removed from the module
exports.
2017-11-06 17:01:36 +11:00
Kevin Easton
3f047ab2a9 Add save_dllvar() function exported to modules
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.
2017-11-06 16:54:51 +11:00
Kevin Easton
4b8ffbc52a Improve error message on module version mismatch 2017-11-06 16:52:14 +11:00
Kevin Easton
ae4a45179e Remove unnecessary NULL check in whoreply()
new_w has already been checked for NULL further up the loop.
2017-11-03 16:32:33 +11:00
Kevin Easton
0703126773 Factor out common dll variable list lookup into lookup_dllvar() 2017-11-03 16:22:57 +11:00
Kevin Easton
3b2793877d Change set_var_value() argument from int to enum VAR_TYPES 2017-11-03 14:48:26 +11:00
Kevin Easton
59d237d819 Remove unused code branch in setcmd()
If cnt == 0, that implies that dll == NULL (if the list search returned an entry, it at least must match
the prefix we're looking for).
2017-11-03 01:18:04 +11:00
Kevin Easton
574053da52 Split out set_var_value_dll() from set_var_value()
Also remove external declaration of set_var_value() from vars.h, since it is only used in
vars.c.
2017-11-03 01:14:30 +11:00
Kevin Easton
1797858d0b Extract common core from set_var_value() into helper function 2017-11-02 23:57:15 +11:00
Kevin Easton
1cb3775ced Fix typo testing VIF_CHANGED
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.
2017-11-02 16:16:37 +11:00
Kevin Easton
a220b8aa7f Rename VIF_BITCHX to VF_BITCHX
This flag is part of ->flags, not ->int_flags, so name it appropriately.
2017-10-26 17:41:05 +11:00
Kevin Easton
571aafcb45 Add helper function save_vars_by_flags() for saving variables
The majority of save_variables() and savebitchx_variables() were common code, so pull it
out into a helper function.
2017-10-26 17:36:28 +11:00