CVS log for epic5/source/if.c |
![]() |
Request diff between arbitrary revisions
* Roll in a bunch of changes from larne to make epic5 more vms-friendly * Rename if.h -> ifcmd.h (larne) -- Make sure you rerun configure! * Run make depend to pick up name change of if.h * Check for <sys/param.h> in configure (larne) * Extern funcs are case insensitive in strict c90, fix (larne) * Rename options -> options.h since vms requires a dot in filename (larne) * Change "readonly" -> "rdonly" since "readonly" is a symbol in vms. (larne) * Pull in "compat.h" for gailib.c and glob.c (larne) * Set stdout to be explciitly line buffered at startup (larne) * Returning a value from void functino forbidden by strict c90. fix (larne) * Fix some compiler warnings that were lying around. * There are more changes forthcoming, these were the easy ones.
* Fix new math parser comparison operators to work properly with numbers. * Add function $check_code(), looks for unmatched parens or braces in string.
This is the start of a major project to normalize the behavior of word handling in built in functions. The project involves stipulating that every place that handles a "word list" define what a "word" is and use it consistenly, and to output the same type of "words" that it accepts as input. This leverages /xdebug dword to control optional support for dwords in many built in functions.
* Desupport dwords in a lot of builtin functions (see updates) [nullie] * Make /window foo kill fail for want of 'foo' (see updates)
* Eliminate the third argument to expand_alias(), the statement spanner. * Rename parse_line() to parse_block() to better reflect its duties. * Make parse_block() static. Everything needs to call runcmds() now. * Eliminate the local-stack-creating feature of parse_block(), callers do this. * Rename 'line' to 'stmt' in parse_statement(). * Sort of forget to re-implement /set cmdchars. The / is the cmdchar. * Try to optimize parse_statement() and next_statement() some.
Attempt to give some trailing context for unmatched (s and {s and [s
for jm, because I can't give him the line number, even at load time...
* Don't do LOCAL_COPY within an infinite loop, leads to stack exahustion. * Support new signal, SIGUSR2 which throws "system_exception". * Teach the block commands about "system_exception" so they can be stopped. * Whack a bunch of unused timers from vars.c. (see UPDATES) * Sync up config.h, vars.h, and vars.c with each other. * Add "domains" to timers, server timers, window timer, general timers * When timers go off, latch back to their domain * Allow timers to self-cancel if their latched item has gone away * Add /timer -general to set a general timer. * Make /timer -win or /timer -serv set a window or serv timer especially.
* Change "ERROR --" to "INFO --" to not alarm people as much. * Change a few other warnings to not be so alarming. * Change new_realloc() to not move ptr if it is big enough to hold new size. * Fix all the status_* sub-formats to not have any hardcoded size limits.
* Begin massive refactorization of alias.c, redefining "Alias" as "Symbol" * Refactor parse_line() with a bunch of front end call_* functions. * And a general parse_line() front end, "runcmds()". * Roll builtin expandos in with the user variables * Roll variables and commands together into one name space. HUZZAH! * Nix the caches for the global name space, for now. * I definitely broke /stack alias|assign here. I'll fix it later. * Inline expandos are now officially strings instead of a single char. * Fix bug with $unshift() that popped up. * Move after_expando() to ircaux.c. I think it belongs there more.
* Move some defines from comands.h to where they belong * Add and remove func decls in header files as necessary. * Add /wait =<fd> which returns when a nonblocking dcc connection finishes * Make all keybinding funcs/decls use the BUILT_IN_KEYBINDING macro. * Make the BUILT_IN_KEYBINDING macro use unsigned chars. * Hide (struct Key) inside keys.c, and use (void *) to hold state. * Make the input line use (unsigned char), not (char), huzzah! * Make the "othername" ($3 in /on dcc_raw "E") the port number. * Avoid a NULL deref with "parse_command" keybinding.
GC a bunch of useless cruft and stuff.
Make 'empty_string' (const char []). Now we're cooking with gas!
EPIC5-0.0.1! Huzzah!
Make message_from() work off of a stack; use panics to guard against unmatched message_from()s, and other wackiness.
* Nix auto-append-of-$* feature (args_flag to expand_alias/parse_inline) * Fix provided scripts to add $* when necessary. * Fix up Makefile, configure, et al, to use epic5/ directories.
It is improer for /fe's variable-rewriting stuff to retain double quotes. Noted by CE.
* Add /set wserv_type, either "xterm" or "screen". * Add malloc_strcat_word_c, add a single word to word list, with "" support * Convert a bunch of stuff to use malloc_strcat_word_c to honor ""s right. * GC a bunch of unused code.
Implement "privleged yells" which allow syou to do /set debug 7 at the same time as /set output_rewrite. Yea~!
Overhaul of malloced string handling functions: * Convert m_[s]c3cat[_s]() to malloc_strcat_wordlist_c() * Nix m_e3cat(), m_s3cat(), m_s3cat_s(), m_3cat() * Nix m_ec3cat(), m_sc3cat(), m_sc3cat_s(), m_c3cat(). * Convert m_dupchar() to malloc_dupchar(). * Convert m_strndup() to malloc_strndup(). * Make malloc_strcpy/malloc_strcat/malloc_strcat2/malloc_strcat_wordlist macros * Convert m_2dup() to malloc_strdup2(). * Convert m_3cat() to malloc_strcat2[_c](). * Convert m_3dup() to malloc_strdup3(). * Convert m_ec3cat() to malloc_strcat2_c() * Use strlcat_c() in $repeat() instead of strlcpy(). whee! * Sanity check first arg to $regcomp(), to avoid crashes. * Don't pass NULL to bsearch(), even if 'nmem' is 0 [$remws()] * Nix the original malloc_strcpy (supplanted by malloc_strcpy_c) * Comment out all the deprecated functions
Commit 548 * Nix channel_window, duplicate of get_winref_by_channame() * Make arglist processor panic if it sees an argtype that doesn't exist. * Fix bug with * operator in exprs like (a ? b : *c) in new expression parser. * Fix theoretical crash with deleting hooks from /on window. Bleh. * General cleanups in if.c. * Fix /timer -list acting all wacky. * Fix compilation warnings, you know the deal...
* Rename 'dcc()' to 'dcc_cmd()' so we can use dcc as variable
* Garbage collect unused 'irc_path' global variable.
* Add --with-warns to configure to do FreeBSD "WARNS" like compiler checks
* Many hundreds of changes to improve the "quality of code" in epic, including:
* - Treat all literal strings as (const char *) and fix const correctness.
* - Mopping up all remaining const-correctness issues
* - Do not "launder" a (const char *) to a (char *) in string searches, (ala
strchr) but rather return a ssize_t offset value.
* - Particular, MatchingBracket() returns (ssize_t) and not (char *).
* - Eliminate all "shadow" variable names by changing them to something else.
* - Eliminate most function decls that do not include a prototype list.
* - Add prototypes for all extern functions that are missing them.
* - Ensure most function pointers include a prototype list.
* - In term.c, most of those (char *)'s are really (const char *)'s.
* - Explicitly specify 'static' functions as 'static'
* - Ensure every function is either 'static' or has a prototype.
* - Eliminate (unsigned) < (signed) type comparisons.
* Hopefully you should not notice any changes!
Nominally remove all uses of "unsafe" functions: (Commit 506)
* Convert all uses of strcpy() to strlcpy()
* Convert all uses of strcat() to strlcat()
* Convert all uses of strmcpy() to strlcpy()
* Convert all uses of strmcat() to strlcat()
* Convert all uses of sprintf() to snprintf()
* As much as possible, use 'sizeof var' in snprintf/strlcpy/strlcat.
* Qualify the size of some global vars so we can sizeof() them.
* Nuke strmcpy(), strmcat(), strmcat_ue(), strmccat(),
* Change strmopencat() to strlopencat().
* Change strmpcat() to strlpcat().
* Fix switch_hostname so it doesn't return a (const) string.
* Fix TimerTimeout so it doesn't return a (const) Timeval.
* Change things like (ret) to do ret while (0); for when "ret" is "{}".
* Fix initialization for load_level
* Stop passing in static strings into io(), so we can modify them.
* Make messages passed to io() more informative to the user.
* Fix CTCP FINGER handler not to assume (struct pw) strings can be overwritten.
* Use (socklen_t) and not an (int) for socket sizes.
* Don't return a value in a void function...
* Don't use return value of process_dcc_chat_ctcps() for assignment.
* Don't put semicolons after function bodies
* Fix $getopt() to save 'input_size' so we can use it with strl*().
* Convert all uses of stpcpy() to strlcat() and strlopencat().
* Nix checks for stpcpy() in configure -- regen configure.
A lot more cleanup. Namespace scope changing within aliases now works. -wd
Fix a niggling little bug in ifcmd where parse_line was being called with nothing in it. :) -wd
Okay. User input is now handled specially, and parse_command() will not accept incomplete command names anymore. -wd
Another merge.
Yikes. Merged to become consistent with HEAD. Sorry for all the commits, I'll be quiet again soon. :) -wd
Whee. Preliminary work is done. I've converted things to use hash tables instead of alists (if this doesn't work out, I'll go back to alists). Namespaces exist, but are not yet addable. That will come. I'm very sure things are still a bit unstable, but the absolute basics of adding variables/functions and executing/retrieving them works. That was my first milestone. -wd
* "Word Philosophy" alterations, /alias leak, flood checking, $glob(),
tabkey.ce, regression tests, autoget, /fe, /fec, safe_new_next_arg, as
per KNOWNBUGS.
* $findws(), functions (script), ${i}finditems(), $dccctl(), as per
UPDATES.
* Use server_list_size() and not number_of_servers outside of server.c * Use NOSERV and not -1 for "no server" * Use (Timeval) and not (struct timeval) * Fix (get|set)_server_sent_*() et al to take server refnum. * Use parse_server_index() and not my_atol() to parse server refnums * re-indent quotecmd * Rename is_server_connected() to is_server_registered * Make /quote work as long as server is open (not registered) * Use send_to_aserver() when it can avoid setting from_server unecessarily * Change sent_to_server and clear_sent_to_server to (set|get)server_sent(). * Change doing_* to get_server_doing_*. * Use (unsigned short) and not (u_short) * Use (unsigned long) and not (u_long) * Make output_reject_ctcp() take a refnum * Lock a dcc while we are connecting it, just in case. ;-) * Fix /dcc send -p <port> * Store protocol enforcements as (get|set)_server_protocol_state(). * Use (Stat) and not (struct stat) * Rewrite $timerctl() so it works like $logctl() * Rename is_server_connected() to is_server_registered() * Fix an off-by-one error with /FOR ... IN ... * Keep track of both readable and writable fd's with newio stuff. * Convert server_list to an array of pointers * When user /server -delete's, leave a gap, don't change refnums around. * Nix code that handles deleting server refnums. * New function, new_open_for_writing(), for when we do nonblocking connects. * Change new_open() to deregister fd as "writable" * Renovate the notify stuff to take refnums and not just use from_server. * Renovate /WHO, /ISON, /USERHOST to take refnums and not just use from_server. * Make everything that uses server_list[] use get_server() instead. * Make everything capable of dealing with "gaps" in server_list[]. * Use a bunch of macros, to handle with getting and setting server attrs. * Make as much as possible use refnums as params and not from_server. * And a lot of other stuff...
* Added functions $asciiq() $chrq() $exec() $timerctl() $tcl() $winline() and $floodinfo(). * Altered the two argument version of $read() to ctcp quote the strings it returns. * Added sets FLOOD_RATE_PER and FLOOD_MASKUSER. * Altered the "accept" mode of the dcc_raw and dcc_connect hooks to refer to the local port instead of the remote port. * Added a "-closein %proc" switch to /exec. * Altered the arg list mode of /alias to use extractw instead of next_arg. * Added the documented "words" argument to the above. * Tuned autoget, mudirc, tabkey.ce and commandqueues. * Altered /pretend to not chop the string. * Set about rewriting the flood detection and then decided that it's better off being a script. * Moved the function macros to their own file (functions.h) and replaced all the copies that are strewn throughout the source with an #include. The exception is array.c which broke when I tried it. * Moved the ctcp enquoting/dequoting functions to ircaux.c. * Added some command/function ordering checks to funcs/regress, and a check for all the functions that are undocumented. * Rewrote function chanmodetype() so that it doesn't have all those flakey buffering things. Hopefully it's readable now. The significant change is that if a mode character appears twice in CHANMODES, the first one is returned instead of the last. * Added EPIC::call() in the perl routines and an equivalent under tcl. this is designed to call a $function() directly, but it isn't really that fast, so I might rip them out again. * The /wait internals used to store a few other settings, which were taken out, so I put them back. * Fixed a few problems with normalize_filename() around the place. * Fixed a bug with /timer in which it would never show the timers after a callback.
* /exec leak fix for -line, -part, etc.
* /for var from x to y step z will work for negative z now, but for bug
compatibility, you must use a negative step to actually make this work.
* Local variable tweaks.
* Fixed $word() to not discard words after a "".
* /userip now uses the internal queue, if the server supports it via the
USERIP 005. Otherwise, it will send the command directly to the server.
The problem with this is that to avoid the internal cache returning the
users address, you must use -direct. This needs to be fixed.
* Karll Array overhaul. Removed certain performance traps for very large
arrays, which have very large numbers of like items, and made it such
that arrays can be in an unsorted internaly until the time that they
need to be sorted, when a quicksort is called on them.
* Added two new functions to deal with this: $usetitem() and
$delitems(). These work like their similarly named counterparts, but
leave the array unsorted, and generally perform better.
* Any function which uses indexes or performs a binary search on an
array will cause the array to be sorted.
* For the most part, extended functions to allow for additional
item/index args. $getitem(array $getmatches(array *cat*)) will
return the contents of all items that have the character sequence
"cat" in them. $getitem(array2 $getmatches(array1 *cat*)) will
act much like $copattern().
* Added support for CHANMODES, PREFIX and CHANTYPES in the processing of modes. If the server doesn't support these, then hopefuly sane default strings are chosen, and these _don't_ include the wacky extensions that have been added over the years, so conceivably, this could break things like halfops and ban/invite exemptions. * Stored the UMODES field from the 004 numeric in the server data. Can be retrieved with $serverctl(get x umodes). * Altered "/msg @$fd" so that $fd must be a number, otherwise, it will be treated as a privmsg. * Added $xdebug() which returns all single bit flags with + or - added as appropriate. /xdebug $xdebug() is a no-op. * Fixed an /xdebug bug in which - would cause all subsequent flags to be switched off. For bug compatibility, it still works this way, but you can specify + to turn all subsequent values on. * Altered m_sc3cat_s() to call m_sc3cat rather than m_c3cat, which results in a cleaner string. Examination of the uses of this function showed that they all dealt with this bug in some way. * Altered $which() to call path_search() directly, rather than uzfopen(). It may be useful to add a flag to path_search indicating which attributes we are searching for. This could cause problems since the old method would skip over a file if it wasn't readable. * Added clue variables for $unsplit().
Update copyright notices and copyright dates.
* Merged in another /fe fix I was brewing.
* Altered new_next_arg to not truncate the arguments list if the argument
taken happened to be empty. This fixes bugs with /fe and $shift() where
the list has "" arguments.
* Gave malloc_strcat and m_strcat_ues a clue variable and used it within
the variable expansion routines so that expanding works in liner time.
* I am a little bothered by this. The _correct_ thing to do is to put
the clue variables into the malloc data for the strings themselves
like perl does.
* Moved the base structure for 1cmd in command queues from last.qcmd. to
1cmd.
* Added command completion to tabkey.ce.
Fixed NULL deref if you do /FE without any arguments.
* Fixed $numsort() to be case insensitive. Since the effort was made to get it to cope with text, this kinda makes sense, however, it may not exactly be consistant with my_stricmp since it uses libc's tolower(). I guess the correct way to do this is to add my_tolower() which taps the same structures. I'll do this if it's necessary. * Removed the var array initialisation code in /fe since the code doesn't rely on it being initialised. * Made the /fe code calculate the size of said array directly. As far back as I can remember, compilers have been doing math with constants at compile time, so this shouldn't effect performance at all, although, it's probably better being a macro. * Changed the "Invalid user mode referenced" panic into a warning, and enhanced its readability. Trying to find which server did what invalid mode when you're connected to many of them is a little difficult.
* Applied patch from Kurt Roeckx which does better SSL detection.
* New /fe and /fec functionality which allows it to work much like perls
map command. The form is "fe var tmpvar ... {code}".
The difference between it and the "fe (list) tmpvar {code}" form is that the value of var is taken for the list, and more importantly, the value of tmpvar is retrieved after each iteration and string appended to
a new value for var. This is subject to the following caveats:
* The new value of var is written back only after the fe/fec exits.
* /break will cut the variable short _after_ the current value.
This was designed at least in part to make it possible for scripts to
make use of the extended strcat functionality and indeed, this works in
linear time which makes it useful for very large strings/values.
* Fixed the default bailout return value in get_server_port() to return
the value from server_list.
* Applied Ay-Ars SSL patch:
* Copyright notices added to ssl code files.
* --ssl-ver switch removed (configure script hasn't been rebuilt).
* Code changes/cleanups which I haven't checked, but which seem to work
well.
* Documentation changes.
* Fix for a memory leak in foreach when continue or break are used.
* Moved the server_established hook into register_server so that it is not
triggered when an unsuccessful attempt to connect is made.
* Feeble stab at fixing an intermittent server related coredump.
* Cleaned commandqueues script up a bit.
Support if (...) {....} else if (....) {....}
Support if (...) {....} elif (....) {....}
Why? Why not?
* Miscelaneous 3cat updates.
* History expansion copies the history buffer verbatim now.
* Bugfix: /!0 would not retrieve the first command entered.
* Bugfix: Negative numbers not found would be display the
incorrect number in the error message. eg: /!-4444
* Alterations to remove_trailing_spaces interface.
* $igetrmatches() was defined, but inaccessible.
There are two fixes here: 1) An obscure bug in COMMAND_COMPLETION if the input line has only space characters in it would walk off the end of the string (no crash) 2) /FOR I IN would crash.
Commit #47
* /window server resets the "reconnect attempt" counter ala /server
* /for i in <pattern> {...} now reserved, and emits an error.
* "make depend" done again.
* "my_next_expr" revamped, extra argument added
* "next_expr_with_type" like "next_expr" but first char is "type".
* The /for i in (list) and /for i from x to y commands now use the
above cruft.
* This is epic4-0.9.16-10
* "break_args" now uses "next_expr_with_type"
* "do_log" should use localtime(3) and not gmtime(3), duh.
* "clear_reconnect_counts" is now an extern function from server.c
Add the /for <var> in (<list>) {<commands>} command
Add the /for <var> from <min> to <max> {<commands>} command
Implement "break_args" that breaks argument lists to commands to an array.
Implement "skip_spaces" which skips leading spaces in a string.
This is commit #46, isn't it?
Initial import into CVS
Initial revision
| CVS Admin |
Powered by ViewCVS 0.9.2 |