CHANGES file for libmlh.c/h (NOTE: libmh.[ch] is derived from libmlh.[ch]) 9/28/09: 3.2.2 {Relase} Added lib_getdelim() as a special version of lib_dfgets() and the GNU C version of getdelim(). 9/14/09: 3.2.1 {Release} Bumped version number. 9/10/09: 3.2.1b Cleaned up some documentation for lib_dfsplit(). 8/26/09: 3.2.1b Added missing function, lib_clear_hashtable(). Changed the "Proc" section to include Misc. functions. 2/8/09: 3.2 {Release} 2/5/09: 3.2b Added lib_tcp_ping() to provide ping-like functionality. 1/28/09: 3.2b Added lib_gen_tocidr() and lib_gen_fromcidr() to do CIDR conversions. 1/27/09: 3.2b Fixed a serious endianess bug in lib_check_cidr() that caused the function to fail on little endian machines. API: Added a new parameter to lib_dlist_readtxtfile() to force the stripping of newlines from each input line. Fixed some formatting in the libmlh.txt file. 9/10/08: 3.1 {Release} Added 7th checksum function to lib_checksum(). 9/8/08: 3.1b API: Modified lib_darray_blkdel() to take an extra parameter to free the pointer contents. 9/4/08: 3.1b Added new hash function for hash table operations. Modified dynamic list functions to grow list sizes exponentially rather than by small fixed increments. Added quick sort version for dynamic list sorting as lib_dlist_qsort(). 7/14/08: 3.0 {Release} Updated and cleaned up support files for release. Combined the headings templates for both libmlh and libmh so that they use the same template and header files. Adjusted the type parameter additions for qstack and hashtable functions to be an int instead of a short. 7/13/08: 3.0b Added lib_dlist_readtxtfile() to read a text file into a dynamic list. Added lib_dlist2hashtable() to add a dynamic list's contents as keys to a hash table. Removed obsolete functions: lib_init_dlist() and lib_free_dlist() 7/12/08: 3.0b API: Modified lib_qstack_push(), lib_qstack_press(), lib_qstack_pop(), lib_qstack_vpop(), lib_qstack_pull(), lib_qstack_vpull(), lib_qstack_getlistptrs(), lib_qstack_insert(), and lib_qstack_returnitem() to handle a user defined type parameter. 7/11/08: 3.0b API: Modified -lib_add_hashrecord(), lib_edit_hashrecord(), lib_get_hashrecord(), lib_get_hashlinear_rec(), lib_rehashtable() to take or handle a type parameter. 7/9/08: 3.0b Added lib_freeall_darray(), lib_freeall_qstack(), lib_freeall_aio(), and lib_freeall_timer() to allow for deleting of multiple objects in one call for each. Added lib_aio_getbufstat() to return the amount of free buffer space for both read and write operations. 7/8/08: 3.0b Added lib_freeall_Str() to enable deleting of multiple dynamic strings in one call. 7/7/08: 3.0b Added lib_freeall_hashtable() to delete multiple hashtable data structures in one call. 7/5/08: 3.0b Added lib_freeall_dlist() to delete multiple dynamic lists in one call. 7/3/08: 3.0b Modified lib_dlist_getdir() flag options to allow for exclusion of "." and "..". API: modified lib_prime() and lib_nextprime() to take unsigned long arguments. lib_nextprime() now returns 0 if an error occurs and returns an unsigned long. Modified lib_freall() to ignore pointers that already have a NULL value. 5/28/08: 2.10 {Release} Updated release files and fixed dstring.h typo. 5/27/08: 2.10b Fixed a bug in lib_nuparse() that could cause the loop to grow out of bounds. Added a number of new functions to the dynamic strings section: lib_resetStr(), lib_setStr(), lib_insertStr(), lib_replaceStr(), lib_sreplaceStr(), and lib_Strdup(). Added lib_freeall() as a multiple parameter version of lib_free(). 5/19/08: 2.10b Fixed a couple of documentation typos. 5/17/08: 2.9.1 {Release} API: Modified lib_get_match_str() to return a pointer for _lastpos_ rather than a relative offset position. Cleaned up the organization of files, moving the function documentation into corresponding lib*.txt files. 5/16/08: 2.9.1b Modified lib_strcap() to treat values of 0 and 1 the same for _which_. Modified lib_add_hashrecord() and lib_edit_hashrecord() to handle nonNULL pointers via a zero size specification. The old behavior will continue to work as well. Modified lib_nuparse() to fail if the string does not contain given pattern. Extra characters in the string are permitted as long as the requirements specified by the pattern are fulfilled. 5/13/08: 2.9 {Release} Fixed minor bug in lib_fstrcmp() for integrated space type mismatches. 5/12/08: 2.9b Added new function lib_fstrcmp() to do "fuzzy" string comparisons. More clean ups to shutup GCC warnings on Linux. 5/9/08: 2.9b Added missing prototype for lib_dlist_compare() and fixed a typo in its documentation. Cleaned up a ton of annoying 'signedness' issues that GCC now complains about. Added 3 new functions to the dynamic list section: lib_dlist_append(), lib_dlist_merge(), lib_dlist_copy(). 5/3/08: 2.9b Added new function, lib_get_match_str() to allow retrieving of substrings matching a given pattern. 5/1/08: 2.9b Added needed comments to lib_grep(). 4/25/08: 2.8.0.1 {Release} Minor documentation cleanup including copyright year update. Added additional header file to mh.h/mlh.h to make Linux compile again. Removed mh.h and mlh.h from distribution as they are just templates. 12/12/07: 2.8 {Release} Modified the timer data structure to handle time in microseconds rather than milliseconds. Change affects the internal functioning of lib_timer_create(), lib_timer_set(), and lib_timer_start(). API: lib_timer_set() now takes an extra argument for useconds. The original msecs argument now takes seconds instead. 12/8/07: 2.8b Fixed documentation for lib_grep() to reference the '%' marker. Added four new functions: lib_Strcasecmp(), lib_Strncasecmp(), lib_Strcmp(), and lib_Strncmp() to provide comparison operations directly for dynamic strings. 2/7/07: 2.7.2 {Release} Renamed replace_char() to lib_replace_char(). Made a couple of slight cleanups in the documentation sections of the header files. Fixed a bug in lib_nuparse() where multiple non-space whitespace would not get handled properly. Fix a minor pointer warning in lib_aio_getrdstat() at compile time. 1/2/07: 2.7.1 {Release} Added back lib_free_dlist() and lib_init_dlist() as depreciated functions to the dynamic list sections. This allows legacy applications to compile again for now. Modified N_strcharcmp() to recognize both '%' and '#' as valid numerical digits instead of just '#'. Updated dynamic list documentation to refer to lib_create_dlist() and lib_destroy_dlist() instead of lib_free_dlist() and lib_init_dlist(). Updates year dates to 2007. 12/4/06: 2.7 {Release} Updated release files and built tarball. 12/2/06: 2.7b Added lib_timer_setptrs() to the timers section to allow for the user data pointers to be changed. 11/26/06: 2.7b Added the timer functions: lib_timer_create(), lib_timer_destroy(), lib_timer_counter(), lib_timer_fillset(), lib_timer_getset(), lib_timer_getptrs(), lib_timer_set(), lib_timer_getstate(), lib_timer_start(), lib_timer_stop(), and lib_timer_check(). 11/18/06: 2.7b Added the asynchronous I/O emulation functions: lib_aio_discard(), lib_aio_resize(), lib_aio_read(), lib_aio_write(), lib_aio_rewrite(), lib_aio_reread(), lib_aio_readret(), lib_aio_readcancel(), lib_aio_writecancel(), lib_aio_getrdstat(), lib_aio_getwrstat(). Removed the struct list_type definition from mlh.h and mh.h as those associated functions have been removed. 11/1/06: 2.7b Modified lib_unscramble(), lib_scramble(), lib_pscramble(), lib_decode(), and lib_encode() to reset the state of the internal rand48 generator so as not to leak internal state information. 10/8/06: 2.6 {Release} Removed the type field from the dlist_type struct in the dyanmic list data type and functions. 10/7/06: 2.6b Removed lib_init_dlist() and lib_free_dlist() has their functionality is obsoleted by lib_create_dlist() and lib_destroy_dlist(). Modified lib_dlist_join() to allocate memory for the result if the string parameter is NULL. Added new function, lib_free() to cleanly free() memory pointers and reset the pointer values. Removed the entire non-dynamic list functions section as their functionality has long been superceded by the dynamic list functions. 8/22/06: 2.5 {Release} Fixed lib_random_float(), lib_pwd_encrypt(), and lib_nslookup() to all use the srand48/drand48/lrand48 functions instead of the rand() library calls. The newer calls support better variation. Added two new functions, lib_create_dlist() and lib_destroy_dlist() to create and free dynamic lists via malloc() instead allocating off of the stack. Added support for a maximum item count in the Qstack data type. Modified lib_qstack_push() and lib_qstack_press() to check for overflows and process an autodelete (at the other end). Added a new function, lib_qstack_setmaxsize(), to set this maximum item count. Added a new function, lib_qstack_returnitem() to return an item from a Qstack as if it were an array. The bottom of the stack (or front of the queue) is treated as item position 0. Added a new function, lib_nextpowerof2(), to return the value of the next power of 2 given an existing value. Made of few other format clean-ups in the source files. 5/4/06: 2.4 {Release} Added a new function, lib_dlist_compare(), to compare two dynamic lists. Added a new function, lib_move_hashrecord() to allow an item to be moved from one hashtable to another without disturbing the data. Modified the behavior of several hash table functions to insert new items at the beginning of the hash bucket chain instead of at the end. Also fixed the collision accounting if an item is deleted. 5/3/06: 2.4b Added two new functions: lib_dlist_uniq() and lib_dlist_sorted_uniq() for removing duplicate items from a dynamic list. 3/25/06: 2.3 {Release} Added several new functions, lib_reposition_item() to move an item to the beginning or end of a hash chain for optimization, lib_get_bucketcount() to return the number of items in the bucket that key maps to, and lib_rekey_hashitem() to change the unique key of an existing item. Added closing comments to the end of all functions. 3/24/06: 2.3b Added new function lib_nuparse() to add a more dynamic parsing function for dynamic lists that combines most of the powerful features of lib_dfsplit(). Added lib_getfilesize2() as a slight variant to lib_getfilesize(). Added lib_isfileopen() to determine if a file is open or not (Linux and Solaris only). 3/23/06: 2.3b Added missing documentation for lib_getfilesize(), lib_getfileguid(), and lib_getfileperms(). 7/2/05: 2.2 {Release} Added a new function replace_char() to replace all instances of a character in a string with another character. Added a new function lib_grep() to match strings using complex pattern matching format characters. Added new function lib_case_strstr() to provide a case-insensitive version of strstr(). Added two new internal functions, N_strmatch() and N_strcharcmp() to help support lib_grep(). 4/4/05: 2.1 {Release} API: lib_random_float(), lib_random_byte(), and lib_random_long() now take a parameter which is XOR'd with the internal seed. Added new function lib_egrep_dlist() to allow more diverse pattern matching. 2.0.1 changes are incorporated. 3/9/05: 2.1b (same as 2.0.1 release} Minor cleanups to the compile defines to allow OSF to build. 3/1/05: 2.1b Added another flag bit to the _icase_ parameter to lib_grep_dlist(). New value allows for exclude rather than default include. Programs using 0 or 1 previously as values to _icase_ will work the same as before. Others will have to be corrected. 2/25/05: 2.1b Made a few minor tweaks to lib_random_byte() and lib_random_long(). Fixed bug in lib_random_byte() where only values from 0-127 were returned instead of 0-255. 1/3/05: 2.0 {Release} API: Changed lib_sclear(), lib_screen_reset(), lib_shome(), and lib_beep() to take a value for STDOUT. Renamed lib_makeshash() to lib_makehash(). 12/30/04: 2.0b Fixed a couple of typos in the merging. Renumbered the library versions from 1.9b to 2.0b as the API changed. Made a few other minor cleanups and added comments. Also Updated and documented the GNU license information in all of the source files. 12/29/04: 2.0b Added two new functions, lib_2hex_transform() to convert unprintable characters to hex, and lib_quote_convert() to do conversions of specified quoted characters. Added lib_beep() to make a beep sound. 12/27/04: 2.0b Added new function, lib_screen_reset() to reset tty screens and put them into text mode. 12/22/04: 2.0b Added new function lib_makeshash() to create hex value hashes from a string of data. Added function lib_grep_dlist() to do grep-like searches through a dynamic list. 12/21/04: 2.0b Upped the size increaments for calls to N_grow_dlist() across most of the dlist functions. Added new function, lib_dlist_cgiparse() to the Dynamic lists section to enable parsing of CGI GET method inputs. Added a new function, lib_stringhex_conv() to convert embedded hex value pairs into equivalent ASCII. 12/19/04: 2.0b Added new function, lib_makepidfile() to create standard pid files. 10/30/04: 2.0b API: Swapped the functionality of lib_chop() and lib_chomp() to match Perl symantics. Removed old lib_dlist_ssort() function which was no longer referenced. This used to be the old lib_dlist_sort() function before it was replaced by a more optimized version. 10/27/04: 2.0b Fixed an obscure bug in lib_dsplit() where the wrong item count can be returned Added some comments to lib_dlist_sort() and lib_dlist_getdir(). Marked obsolete the old selection sort routine, lib_dlist_ssort(). 8/17/04: 1.8 {Release} Added a new function, lib_read_pidfile(), to retrieve PIDs from pid files. 8/16/04: 1.8b Added two new functions, lib_setbit() and lib_getbit(), to set/clear or check bit values in an integer (unsigned). Added a dummy header include to shutup complaints about 'struct stat' in lib_diffstat()'s parameter list. Added three new functions, lib_getfilesize() to get a file's size, lib_getfileguid() to get the owner/group settings for a file, and lib_getfileperms() to get the mode/perms of a file object. Renamed lib_random() to lib_random_float(). Added a new function, lib_random_long(), to return a random signed 32 bit value. Also made slight changes to the bits returned by lib_random_byte() and made its return value unsigned. 8/9/04: 1.8b Fixed file descriptor leaks in lib_hostlookup() and lib_rhostlookup(). Moved the two DNS related functions to new internal file for dev purposes. 8/6/04: 1.8b Added new function, lib_dns_query() to do low-level DNS queries of different types, against specified nameservers, and with given timeouts. Also integrated 2 helper functions N_parse_dn() and N_parse_drec() which are called internally by lib_dns_query(). 8/2/04: 1.8b Added two new DNS-related functions, lib_hostlookup() and lib_rhostlookup() to do DNS-like lookups using only flat files. Added a new function lib_diffstat() to compare the attributes of a file system object to detect changes. 3/25/04: 1.8b Fixed a couple of typos in time.d and one in crypt.c 3/9/04: 1.7 {Release} Fixed a couple of NULL pointer returns in lib_Sprintf() that should have returned -1. 3/8/04: 1.7b Added 17 new functions to do dynamic array operations: lib_darray_create(), lib_darray_discard(), lib_darray_clear(), lib_darray_free(), lib_darray_add(), lib_darray_insert(), lib_darray_delete(), lib_darray_fastdel(), lib_darray_get(), lib_darray_replace(), lib_darray_swap(), lib_darray_getsize(), lib_darray_blkdel(), lib_darray_blkpull(), lib_darray_blkinsert(), lib_darray_blkget(), lib_darray_dlisttrans(). 2/9/04: 1.7b Modified lib_daemonize() to close the 3 initial IO streams, stdin, stdout, stderr. Might reopen to /dev/null in the future. 1/13/04: 1.7b Added a trivial check to the relevant hash table functions to check for a NULL pointer for _key_. 1/1/04: 1.7b Renamed lib_djoin() to lib_dlist_join() to have consistant naming. Added a new dlist function, lib_dlist_reverse() to reverse the order of elements in a dlist. Added a new math function lib_round() to round doubles to the nearest integer value without the need of the math library. Function only deals with doubles in the range of a 31 bit non-negative integer. 12/31/03: 1.7b Added a new internal function N_strcmp() to do generic string comparisons. Added a new function, lib_dlist_swap() to the dynamic list section to swap to elements. Rewrote lib_dlist_sort() to be much more efficient than the previous selection sort based routine. The new one uses a modified insertion sort routine (with binary search added). Improvement varies on data set and size and can range from 2-3 times faster to more than 40 times faster. 12/26/03: 1.7b Added two new functions lib_check_ipblock() and lib_check_fqdn_match() to enable IP sub-block (classful) matching and domainname matches respectively. Added ten new functions to allow for the creation and manipulation of dynamic strings: lib_createStr(), lib_destroyStr(), lib_getStr(), lib_Strlen(), lib_Strtrunc(), lib_Strcpy(), lib_Strncpy(), lib_Strcat(), lib_Strncat(), lib_Sprintf(). 12/09/03: 1.7b Added a new function lib_getranbits() to provide an alternative random number generator (based on system clock). 12/01/03: 1.7b Fixed a bug in lib_insertfiller() where a negative size values caused malloc() to fail but wasn't detected. Added a new network function lib_init_tcp_connection() to begin a tcp connection asynchronously. Added a new function, lib_rwpoll() to return read/write/error status on a single socket/pipe descriptor. Added two new functions, lib_mknonblockfd() and lib_mkblockfd(), to make file descriptors nonblocking or blocking. Added a new function lib_fcat() to output the entire contents of a file. Added a new function lib_print_datetime() to return a string with the current date/time. Added a new function, lib_check_cidr(), to check an IP address against a network ID with a specified netmask in CIDR notation. 11/26/02: 1.6 {Release} Added a new function, lib_seconds2units() to tabulate various time units from a given number of seconds. 11/10/02: 1.6b Added two functions, lib_match_inode() and lib_match_fs() for comparing if two file system ojects are identical and checking if two file system objects reside on the same physical file system. Added a new functions: lib_getfiletype() to determine a file's type; lib_compare_filenodes() compares the main inode attributes of two file objects; lib_compare_filecontent() compares the contents of two regular files; lib_is_sparsefile() determines whether a file is a sparsefile or not. 10/30/02: 1.6b Renamed lib_strip_non_alpahnum() to lib_strip_nonalphanum(). Also rewrote the function to be more efficient. Added a new parameter to list additional characters (non-alphanumeric) that should NOT be stripped out. The function also now returns the new string length instead of the number of stripped characters. Renamed lib_cleanpath() to lib_condense_path(). 10/29/02: 1.6b Fixed a portability bug in lib_timer() where incorrect values could be returned if a system's default clock tick rate is not 100. Added a new function, lib_get_file_ext(), to return file name extensions. 10/21/02: 1.6b Added a new function lib_delimitint() to convert an integer to a comma delimited string. 10/01/02: 1.6b Added a new function lib_dlist_from_hashkeys() to take the keys from a hash table and put them in a dynamic list. 9/30/02: 1.6b Added three new functions for path name parsing: lib_last_path_element(), lib_getpathdir(), and lib_cleanpath(). 8/30/02: 1.5.2 {Release} Modified the va_args macros to use an int size for char. This is to shut some compilers up. Functions affected: lib_log(), lib_dsprinf(). 5/25/02: 1.5.2b Modified lib_encode() and lib_decode() to not except block sizes larger than 256 for security reasons. 4/19/02: 1.5.2b Seperated the versioning from the templates and put it into its own file, mlh.ver 4/16/02: 1.5.1 {Release} Modified nearly all of the networking functions to do more sanity checking. Also fixed a number of bugs in lib_nslookup() and lib_dnslookup() to handle IP addresses correctly. Modified the error return values of most of the network functions to relay more information about the failure. Modified lib_nslookup() and lib_dsnlookup() to return 0 if the given name exists, but does not have an IP address associated with it. 4/3/02: 1.5 {Release} Added a new function, lib_stripendchars(), to allow leading and trailing character types to be removed. 1/1/02: 1.5b Modified lib_readpoll(), lib_readpoll2(), and lib_acceptconnect() to return -2 if the call as interrupted by a signal (and not restarted). 10/28/01: 1.5b Rewrote lib_sflock(), lib_sfunlock(), and lib_getsflockinfo() to create a symlink semafore file rather than a regular file. The parameters to lib_getsflockinfo() were modified to return more than just the PID of the calling process that created the lock file. The new versions should be much more effective over shared filesystems such as NFS. 10/14/01: 1.5b Modified lib_strcap() to take an extra parameter specifying on which instance of a character the string is to be terminated on. Renamed lib_dlistdeletes() and lib_listdeletes() to lib_dlist_blkdelete() and lib_list_blkdelete() respectively. Also added a paramter to specify how many items to delete before and/or after a given item. 10/5/01: 1.5b Modified the _which_ parameter of lib_listdelete() and lib_listinsert() to be a short type instead of char. Added three new functions to the strings section: lib_strip_whitespace() to delete leading/trailing white space from a string, lib_strip_8bit() to strip 8 bit characters out of a string, and lib_strip_unprintable() to strip unprintable/uncertain characters from a string. Added a new function lib_listdeletes() to enable deleting multiple items before and/or after a specified item. Also added the dynamic list equivalent lib_dlistdeletes(). 7/12/01: 1.4 {Release} Cleaned up some documentation in the dynamic list section. Added two new functions to the dynamic list section: lib_getdir() to retrieve directory listings and lib_dlist_sort() to sort the contents of a dynamic list alphabetically. Fixed a bug in lib_strcap() where the function hung in an infinite loop. 7/10/01: 1.4b Renamed lib_openconnection() to lib_open_tcp_connection(). Renamed lib_makesocket() to lib_make_tcp_socket() and added an extra sanity check. Renamed lib_openusock() to lib_open_unix_socket(). Renamed lib_makeusock() to lib_make_unix_socket(). Added two new functions for UDP sockets: lib_make_udp_socket() and lib_make_udp_addr(). 5/29/01: 1.4b Added full sanity checking to all dynamic list functions. Also fixed a number of potential bugs in several functions. Finally made the list size fully dynamic by reallocating more space for additional items. Added a new internal function N_grow_dlist() to add space for more items in a dynamic list structure. Added byte accounting to the Qstack functions. Modified lib_qstack_size() to take an extra parameter for bytes size. Reorganized the build tree for both libraries for easier change propagation. Both are now sync'ed automatically. 4/29/01: 1.4b Modified lib_linebufferctl() to always set the terminal to line buffering mode and echo, no matter what state the terminal was in when it was first called. The read state of the terminal will also now always read at least 1 character. Added a parameter to lib_readpoll() to specify a wait time (in ms). Modified the last parameter of lib_readpoll2() to specify a wait time (in ms) instead of immediate or forever (0 vs 1). Also renamed the last parameter from _blockflag_ to _wait_. Fixed a trivial bug in lib_gethstr() where a '*' was printed for the newline. 4/21/01: 1.4b Modified lib_linebufferctl() to deactivate echo if _flag_ is negative, rather than 1. 4/20/01: 1.4b Moved lib_readpoll() and lib_readpoll2() from IPC/Networking section to the Input section. This allows it into libmh.[ch]. Made a minor optimization to lib_getastr(), lib_gethstr(), and lib_getvstr() in cases where there is no pre-text to print. Added a new function lib_linebufferctl() to allow for turning off line buffering on terminal input. Modified lib_echo() and lib_noecho() to return success or failure. 4/02/01: 1.4b Made a couple of slight adjustments to lib_readpoll() and lib_readpoll2(). Also added some comments. 3/31/01: 1.4b A couple of minor clean-ups in lib_encode() and lib_decode(). Added two new functions, lib_readpoll() and lib_readpoll2() to the Networking section. Renamed Networking heading to reflect IPC. 3/14/01: 1.4b Cleaned up documentation in libmlh.h file and added complete descriptions for the dynamic list functions. Also fixed a typo in the prototype naming for two dynamic list functions: lib_dlist_delete() and lib_dlist_insert() which were previously (mistakenly) named: lib_dlistdelete() and lib_dlistinsert(). 2/04/01: 1.4b Two correctional adjustments to lib_encode() and lib_decode(). The functions should be slightly faster in most cases. 1/08/01: 1.4b Final tweaks and modifications to lib_encode() and lib_decode(). The functions may be slightly slower but should be a little more secure. 12/22/00: 1.4b Renamed lib_make_hashval() back to lib_checksum(). 12/17/00: 1.4b Renamed lib_makehash() to lib_make_hashval(). Made some minor corrections to a couple of the hash functions. 12/14/00: 1.4b Modified lib_encode() and lib_decode() to make use of 5 different hash functions in a secure way. The improved hash functions and their arrangement should make the functions more effective. Renamed lib_checksum() to lib_makehash(). Also added the ability to use up to 6 hash functions instead of just 1. It has an extra parameter for the function type, a larger data type for _size_, and now returns an unsigned int. Added 4 new hash functions to the internal function N_hashfunction(). Also replaced 1 existing function and re-arranged the functions in a more preferred order with the generally better hash functions having lower values. 11/16/00: 1.4b Rewrote lib_encode() and lib_decode() to use 4 dkeys instead of 1. Also modified the scrambling algorithms to be seeded with several varations of the primary key. 10/17/00: 1.4b Modified lib_encode() and lib_decode() to improve their encryption further. The routines now work only on raw data rather than dealing with the hex values. An additional parameter was added to lib_decode() to accomodate the change. They are also about 25% faster. 9/21/00: 1.4b Modified lib_encode() and lib_decode() to produce significantly better encryption (hopefully). 9/14/00: 1.4b Changed lib_fcopy()'s byte count handling to long long to avoid roll over for files larger than what the long data type can handle. 8/15/00: 1.4b Renamed lib_rnd() to lib_random(). Added a new function, lib_random_byte() to return a random 8 bit value. 8/10/00: 1.4b Added an additional parameter to lib_invert() to specify which bits of each byte to invert. 8/04/00: 1.4b Modified lib_chop() to a return success status rather than a pointer to the string. Fixed a rare condition in lib_fcopy() where the inode checking could be the same, but actually be different files. 7/26/00: 1.4b Added a new function, lib_strcap(), to terminate a string on the first occurance of a certain character. Added two new functions to the dynamic list section, lib_getdlistcount() and lib_getdlistsize(), to return item and size counts about the dynamic list. Added a new function lib_getlistcount() to return the number of items on a list. Added a missing prototype for lib_dlist_exec() in libmlh.h and libmh.h 5/30/00: 1.4b Renamed library.c/h to libmlh.c/h. Separated out a smaller version of libmlh.c/h called libmh.c/h. Fixed a trivial bug in lib_getastr() where NULL was returned instead of -1. 5/18/00: 1.4b Added an extra parameter to lib_dfgets() to return the size of the collected string. Added 5 new functions: lib_value_to_month(), lib_month_to_value(), lib_value_to_dayofwk(), lib_dayofwk_to_value(), and lib_days_from_epoch() to the Date/Time functions section. 5/17/00: 1.4b Fixed numerous typecasts in various functions so that the Sun compiler could compile the library with no warnings or errors. 5/02/00: 1.4b Added a new function lib_nextprime() to derive the next prime number after some initial value. 4/30/00: 1.4b Added a new function lib_prime() to determine the primeness of an integer. 4/20/00: 1.4b Renamed lib_scramble() to lib_pscramble(). Also cleaned up the code in lib_pscramble(). Added two new functions, lib_scramble() and lib_unscramble(), to give the user more choice in string scrambling options as well as the ability to unscramble a string. 4/19/00: 1.4b Added a parameter to lib_encode() and lib_decode() to allow more than 2 iteration cycles of the algorithm, thus improving the effectiveness of those routines. 4/18/00: 1.4b Added two new functions lib_qstack_vpop() and lib_qstack_vpull() to allow items on the top/bottem of the Qstack to be examined without being removed. Cleaned up some documentation in library.h 4/17/00: 1.4b Removed N_get_bucketcount() and N_get_hashvalue() debugging functions. Added encoding functions lib_encode(), lib_decode(), lib_scramble(), lib_checksum(), lib_bitrotate(), lib_hextobin(), lib_bintohex(). Moved lib_encrypt() and lib_invert() to the encoding functions section. Renamed lib_encrypt() to lib_pwd_encrypt(). Renamed Misc section to Screen section. Renamed lib_opensocket() to lib_openconnection(). Converted all instances of alloca() to malloc()/free() pairs. alloca() is compiler and machine specific it seems. Modified lib_getastr() and lib_gethstr() to return the number of characters read rather than the pointer to the string. Modified lib_makesocket() to take an IP address parameter to allow the program to bind a socket to a single IP address/interface rather than to all interfaces and their associated IP addresses. 1/24/00: 1.3 {RELEASE} Modified lib_dlog() to take a file descriptor instead of a file name. Fixed lib_gethostinfo() to return 0 if _hostname_ is NULL. 1/23/00: 1.3b Added a new function lib_qstack_size() to return the number of entries on a QStack (note: lib_qstack_pointers() can also be used to pull that info). Removed an unused stub for lib_qstack_rotate(). 1/15/00: 1.3b Fixed a bug in lib_opensocket() where the network byte ordering could be reversed for little endian machines. Modified lib_gethostinfo() to accept a NULL pointer for _hostname_ thereby ignoring it. Also reversed the last two parameters so that _ipaddress_ is the second parameter and _hostname_ is last. Removed lib_sockclose() as it is obsolete. 1/5/00: 1.3b Added a new function lib_shome() to set the cursor in the home position. 11/23/99: 1.3b Fixed a minor bug in lib_gethstr(), lib_getvchar(), lib_getvstr(), lib_getvch() that caused an infinite loop if getchar(3s) returned an EOF. 11/10/99: 1.3b Fixed a bug in lib_opensocket(), lib_dnslookup(), and lib_nslookup() where valid IP addresses could be flagged as bad. 11/4/99: 1.3b Modified lib_rehashtable() to accept 0 as the new table size defaulting in that case to the old table size. Cleaned up the documentation of numerous functions in library.h 9/29/99: 1.3b Modified lib_insertfiller(), lib_insertstr(), lib_dlog(), lib_parse(), lib_getastr(), lib_log(), and parts of lib_sreplacestr() to use alloca(3) instead of malloc(3) to avoid possible memory leaks, simplify the code, and for speed. 9/9/99: 1.3b Modified lib_opensocket(), lib_nslookup(), lib_dnslookup() to be thread safe with IP addresses and added extra sanity checks. Made lib_makesocket() to be completely thread safe. Fixed a warning in lib_dlog(). Added sanity checks to lib_revnslookup(). General comments and sanity check cleanup of network functions. 6/30/99: 1.3b Minor cleanups to a few network functions. Also, added code to lib_dnslookup() to skip a lookup if already passed an IP address. Added a new function, lib_dlog() to partially combine lib_log and lib_timestamp(). The printf formatters are not implemented however. 5/5/99: 1.3b Added a new function lib_clearlist() to allow a standard list to be cleared with a single function call. Fixed a bug in lib_qstack_getlistptrs() where the wrong pointer values were being checked for NULL. 4/28/99: 1.3b Added a third possible hashing function to the hash table routines. 4/9/99: 1.3b Integrated QStack functions into the library. Functions are: lib_create_qstack(), lib_clear_qstack(), lib_qstack_push(), lib_delete_qstack(), lib_qstack_pop(), lib_qstack_pull(), lib_qstack_press(), lib_qstack_pointers(), lib_qstack_getlistptrs(), lib_qstack_insert(), lib_qstack_remove(). 3/30/99: 1.3b Added a new function, lib_dlist_exec(), to allow exec() to be called with a variable number of arguments stored in a dynamic list structure. 2/24/99: 1.3b Fixed a trivial bug in lib_add_hashrecord() where a pointer was not being updated. Fixed a minor bug in lib_rehashtable() where the collisions value was incorrect. Changed N_hashfunction() to take a function value. Merged both hash functions into a single function. lib_create_hashtable(), lib_rehashtable() modified to take new hash function value. lib_get_hashcount() modified to take a parameters for the total number of hash buckets in a hash table made and for the hash function value. 2/19/99: 1.3b Fixed a major bug in lib_dfgets() that could cause memory corruption Rewrote lib_replacestr() to use a much more efficient algorithm. Made a few minor code cleanups. 2/9/99: 1.3b Added some typecasts to lib_all_tolower(), lib_all_toupper(), lib_strip_non_alphanum() to shut gcc up on Digital Unix. 1/26/99: 1.3b Changed lib_timestamp() to use a standardized date format like that returned by ctime(2). Modified lib_daemonize to NOT chdir to /. 12/29/98: 1.3b Fixed a bug in lib_keypressed() where the function returned an error if the interval was more than 10. Made a trivial tweak to lib_readkey(). Added some comments to library.h for lib_strtoint() and lib_strtofloat(). Modified lib_daemonize() to chdir to root ("/"). 11/16/98: 1.3b Fixed a number typos in both library.c and library.h that prevented it from compiling. 11/11/98: 1.3b Modified all hash functions to allow empty data to be stored in a hash entry. lib_get_hashrecord() now returns an int and has one additional parameter for the data pointer (API change). 10/29/98: 1.3b Added new function lib_getfilename() to extract filenames from a full path. Changed the API for lib_fcopy() to not take a keepold flag. 10/14/98: 1.3b Tweaked a lot of routines for speed by rewriting loops. Fucntions affected: lib_strtoint(), lib_all_tolower(), lib_all_toupper(), lib_strip_non_alphanum(), lib_chop(), lib_insertstr(), lib_octaltodec(), lib_dsplit(), lib_dlist_insert(). 10/1/98: 1.2 {Release} Added a new function lib_daemonize() to portably create daemon processes. Modified lib_getsflockinfo() and lib_sflock() to handle/put a newline at the end of the PID in the lockfile. Rewrote internal hash function, N_hashfunction(), to significantly improve variance under some circumstances. 9/2/98: 1.2b Made minor tweaks to lib_replacestr() and added comments to its code. Modified lib_sflock() to retry five times a second instead of ten times a second. 8/26/98: 1.2b Fixed a serious bug in lib_replacestr() that could cause a segfault if the new string was larger than the old. lib_replacestr() now returns a pointer to a newly allocated string leaving the old intact. Added a note to lib_sreplacestr()'s documentation. 8/5/98: 1.2b Tweaked a few 'if' statements in lib_fcopy(). Also changed the lseek default to 512. Fixed a bug where a sparse file may not be copied correctly if the destination file already existed. 6/21/98: 1.2b Modified lib_fcopy() to handle sparse files correctly. 6/5/98: 1.2b Added an include file for ioctl() for Linux. Added a typecast in lib_sreplacestr() to quiet the compiler on Linux. 5/28/98: 1.2b Modified lib_fcopy() so that if the source file and destination file are the same (via hardlink or symlink) just return the size of the file and not actually copy it. 5/27/98: 1.2b Fixed a bug in lib_fcopy() where the byte counter was not initialized. Also fixed some file descriptor leaks that can happen when an error occurs and a return is made without closing the files. 5/19/98: 1.2b Modified lib_keypressed() to not read the keypress but only report when a printable key has been pressed. The _ch_ parameter was replaced by a new _interval_ timer that specifies the wait time that lib_keypressed() scans for a keypress. The function will now scan for at least 0.1 seconds. Added a new function lib_readkey() that returns the ascii values of pressed keys in a nonblocking manner. 5/13/98: 1.2b Fixed a bug in lib_fcopy() that caused the file to be truncated to zero size if an error occurred or the locking blocked. Also changed the function to return -2 if the locks failed instead of continuing. The function was also changed to return the number of bytes written to the file copy instead of 1. Also modified the copy buffer from 2048 to 4096. Fixed a race condition with unlink() if _keepold_ was zero. Modified lib_fdtrans() to not truncate the file to zero size before doing a transfer. Increased the copy buffer from 2048 to 4096. Also modified it to return the number of bytes transferred instead of 1. Modified lib_ftrans() to not truncate the file to zero size before doing a transfer. Also modified it to return the number of bytes transferred instead of 1. Increased lib_append() and lib_fappend() copy buffers from 2048 to 4096. 4/19/98: 1.2b Rewrote part of lib_nslookup() so that the random number calculation for the IP address selection is only done if there is more than 1 IP address for the given hostname. Cleaned up numerous trivial items in library.c as reported by lint. 4/11/98: 1.2b Corrected a trivial typo in the documentation in library.h. Cleaned up an entry in CHANGES file for clarification. 4/7/98: 1.2b Added a check in lib_dnslookup() to prevent more IPs from being added to _ip_ than what struct ip_type can hold (currently 24). 4/3/98: 1.2b Modified the return values of lib_revnslookup() to return 0 if the given IP address does not resolve instead of -1. -1 is still returned if the given IP address is not a valid IP address or if some other error occurred. It also still returns 1 if successful. Also Fixed a minor bug in lib_revnslookup() where the _hostname_ parameter was not being set to an empty string if the IP address did not resolve. Increased the ip_type definition in library.h to hold 24 IP addresses instead of 16. 4/2/98: 1.2b Added a parameter to lib_get_hashlinear_rec() to allow for a copy of the record's key to be returned. 4/1/98: 1.2b Added a few typecasts to all isspace() calls to shut up the new gcc 2.8.x compiler. Fixed a minor typo in the library.h documentation. 3/17/98: 1.2b Modified lib_fcopy() to explicitly unlock the files if an error occurs and locking was enabled. 3/13/98: 1.2b Fixed potential bug in lib_dgets() where return value from malloc() was not being checked. Fixed several places in lib_dparse() where _new_ wasn't being free()'d before a return when an error occurred. 3/6/98: 1.2b Replace variable string declarations with malloc()'s and free()'s. This should allow nonGCC ANSI compilers to compile the library, though it is a little slower. Fixed minor potential memory leak in lib_log() where _p_ was not free()'d before return when logfile could not be opened. Added a prototype for usleep() for OSF(DU 4.0) in library.c. 3/5/98: 1.2b Added a lot of comments to library.c. Added a couple of type casts to lib_invert(). 2/12/98: 1.2b Added some convenient #define's in library.h for TRUE, FALSE, YES, NO, ON, OFF. 2/7/98: 1.2b Added statistics variables to the hashing routines. Modified lib_get_hashcount() to accept variable pointers for in-bucket collisions and the number of hash buckets in use. Made the hash function used in the hashing routines to be a separate internal function N_hashfunction() and modified it to significantly improve its variance under some circumstances. 1/13/98: 1.2b Fixed a bug in lib_log where the log string was not terminated properly after the newline was added. 1/12/98: 1.2b Fixed minor bug in N_getformat() where 'd' was being returned for a long type instead of 'D'. Minor tweaks to lib_log() and lib_dsprintf() for speed. 1/9/98: 1.2b Modified the internal function N_getformat() to handle the long int type correctly. 1/6/98: 1.2b Fixed a bug in lib_log() where the malloc()'d string was not free()'d. 1/5/98: 1.2b Integrated dynamic list library functions. The following functions were added: lib_init_dlist(), lib_clear_dlist(), lib_free_dlist(), lib_dfsplit(), lib_dsplit(), lib_dlist_replace(), lib_dlist_add(), lib_djoin(), lib_dlistdelete(), lib_dlistinsert(), lib_dparse(). Minor cleanups to CHANGES file. 12/30/97: 1.1 {Release} Modified lib_fsplit() so that if the _end_ parameter is of 0 length, then the end of the string should be the terminating point. 12/8/97: 1.1b Fixed a potential bug in lib_log() and lib_dsprintf() where the return value of malloc() was not checked before using the pointer it returned. 12/5/97: 1.1b Modified N_lockf() to not use F_SETLKW because it can cause a process to hang on Solaris when locking over NFS (broken lockd?). It now retries the lock continuously every 1/4 of a second. It uses more CPU but will likely get the lock faster. lib_flock() still uses F_SETLKW. Fixed a trivial bug in lib_fcloselock() that tried to close the file twice. 12/4/97: 1.1b Fixed a problem in lib_timestamp() where the minutes and seconds don't have a leading zero when less than ten. Modified lib_strtofloat() to ignore leading white space. 12/2/97: 1.1b Added a new function lib_timestamp() for automatic building of time stamps used in log files. 11/26/97: 1.1b Tweaked lib_delete_hashtable() to be slightly more efficient. Moved hashentry struct definition into library.c from library.h. 11/25/97: 1.1b Modified the hashtable/hashentry structs to accomodate additional pointers to handle a linear list of the entries. Changes required to lib_create_hashtable(), lib_add_hashrecord(), and lib_delete_hashrecord() were made to implement the changes. Added two new functions, lib_get_hashlinear_rec() and lib_get_hashlinear_ptrs() to enable any and all records to be retrieved from a hash table in the order they were entered. Fixed a bug in lib_edit_hashrecord() that would prevent the changed data from being copied into the hash table record. 11/19/97: 1.1b Added a parameter to lib_dfgets() to allow it to allocate a larger memory block than what is just needed to hold the stored string. This is useful if we needed to change or insert characters into the string after it was read in without requiring it to be realloc()'ed. 11/18/97: 1.1b Modified lib_strtoint() to ignore ALL leading spaces. 11/13/97: 1.1b Fixed some typos in library.h for lib_dfgets(). 11/7/97: 1.1b Renamed lib_dgets() to lib_dfgets(), rewrote it to use realloc() instead of malloc() + free() and implemented more tweaks for speed. Added a new function lib_rehashtable() to rehash an existing hash table into a new hash table. Addition required an additional field to be added to struct hashentry and changes in lib_add_hashrecord(), lib_edit_hashrecord(), and lib_get_hashrecord() to use the new field. Fixed a potential bug in lib_add_hashrecord() that didn't check the return value from strdup(). Modified lib_get_hashrecord() to accept a parameter to store the size of the data in the returned hash record. Modified lib_edit_hashrecord() to use realloc() instead of malloc() + free() which is faster and simplifies the code. Removed sethostent(0) calls from network functions that used it since they do not use enumeration. Affected functions are lib_opensocket(), lib_makesocket(), lib_gethostinfo(), lib_nslookup(), lib_dnslookup(), lib_revnslookup(). Minor modifications to lib_rnd() and lib_timer(). 11/6/97: 1.1b Fixed a few typos in library.h documentation section. Tweaked lib_dgets() to improve its speed. 11/3/97: 1.1b Fixed a case in lib_timer() if the clock wraps. Modified lib_gettime() to ignore parameters for hours, minutes, or seconds if NULL. 11/2/97: 1.1b Added a new function lib_flock() for file locking. Moved two Solaris prototypes from library.h to library.c Modified documentation for lib_fopenlock() in library.h for new mode. Minor cleanups to CHANGES file. 10/31/97: 1.1b Modified parameters and functionality of the internal N_lockf() function, removing size and adding read locking. Modified lib_fopenlock() to now handle the "r" mode option. 10/24/97: 1.1b Improved some documentation in library.h on the hash functions. Minor changes to lib_ftrans(), lib_fdtrans(), lib_fcopy(). Fixed a trivial/rare potential problem in lib_add_hashrecord(), lib_edit_hashrecord(), lib_get_hashrecord(), lib_delete_hashrecord() that could result in a negative hash value if overflow occurred. 10/23/97: 1.1b Integrated the hashing library routines. The following functions were added: lib_create_hashtable(), lib_delete_hashtable(), lib_add_hashrecord(), lib_edit_hashrecord(), lib_get_hashrecord(), lib_delete_hashrecord(), lib_get_hashcount(). 10/14/97: 1.1b Made a few minor cleanups to library.h documentation and CHANGES file. 10/8/97: 1.1b Added locking and truncating capabilities to lib_append(). 10/7/97: 1.1b Fixed a few typos in the library.h documentation. Added a new parameter to lib_fcopy() so that it can lock files during a copy. 10/2/97: 1.1b Added a new function lib_dgets() to dynamically allocate space for an input string. Rewrote lib_log() to use a dynamic buffer so that it can log data of any size. Rewrote lib_dsprintf() to NOT use fprintf to /dev/null to determine allocation size but use it's own format and space calculations. lib_dsprintf() will also now ignore the _size_ parameter if it is NULL. 9/30/97: 1.1b Renamed lib_strip_nonalpha() to lib_strip_non_alphanum() and added a parameter to strip or not strip numerical characters as well as non- alphabetic characters. Modified lib_getdate() to ignore parameters that are NULL instead of returning an error. 9/26/97: 1.1b Fixed a bug in lib_split() where 0 was returned instead of 1 if the separator was not found in the string. The string also wasn't copied into the first position of the list under the same condition. 9/25/97: 1.1b Added an additional paramber to lib_getdate() to return the month name. Minor clean up to the library.h file. 9/23/97: 1.1b Renamed lib_getvchar() to lib_getvch(). Added a new function lib_getvchar(). Added two new file functions, lib_append() and lib_fappend() for file appends and open file appends respectively. Added two functions lib_strtofloat() and lib_floattostr() to convert strings to floats and vice-versa. 9/9/97: 1.0 {revised initial release} Modified library.h entry for lib_getvstr(). 9/6/97: 1.0b Fixed a bug in lib_getvchar() that cut off the last character. Also made it where chars entered beyond the number specified will not be valid, and thus, not echoed. 8/29/97: 1.0b Added a new parameter to lib_fsplit() to specify whether separators should be included in the parsed output strings. Also modified code to allow an empty starting separator to match any character. 8/26/97: 1.0b Added a new function lib_gethstr() to hide input, but display a character to show position. Fixed a bug in the new lib_die() that causes it not to print the error message. 8/25/97: 1.0b Changed the order of parameters in lib_inttostr() to make it consistant with lib_strtoint() and natural order of IN first then OUT second. Versioning added to file titles for initial version 1.0 release. library.h documentation cleaned up slightly in a few areas. Updated lib_strtoint() to accommodate a space at the beginning. 8/19/97: 1.0b Updated lib_strtoint() to accommodate a '+' sign in front of the number. Revamped CHANGES file. 8/14/97: 1.0b Changed lib_log() and lib_die() to except formatted arguments like printf(). programs that use lib_die() will need to be modified since the argument order changed. 8/13/97: 1.0b Added two new functions, lib_dsprintf() for a dynamic sprintf and lib_getvstr() to limit string input. 8/12/97: 1.0b Added a new function, lib_getvchar() to get only selected characters as input. 7/30/97: 1.0b Deleted lib_unparse() and cleaned up the documentation in the library.h file. 7/29/97: 1.0b Added two new functions lib_openusock() and lib_makeusock() to handle UNIX type sockets. Extended lib_octaltodec() and lib_dectoctal() from 12 bits to 15 (or 4 octal digits to 5). 7/18/97: 1.0b Added two new functions, lib_octaltodec() and lib_dectoctal() for decimal/octal conversions. Extended lib_encrypt to take a third parameter in which the number of days since Jan 1, 1970 is stored. 6/11/97: 1.0a Added two new functions lib_ftrans() and lib_fdtrans(). One uses FILE pointers, the other uses file descriptors. Each function allows data to be copied between two open files without disgarding the file locks on them by (f)open/(f)close. Modified lib_sflock() to retry the lock file creation every tenth of a second instead of once a second. Cleaned up lib_fopenlock() for "r" modes which should fail. 6/10/97: 1.0a Rewrote lib_acceptconnect() to add a nonblocking option parameter. The socket variable is now passed as a parameter and a status is returned by the function. 6/9/97: 1.0a Renamed lib_lockonfopen() to lib_fopenlock() to be consistant with lib_fcloselock() function naming convention. Fixed bug in lib_split() where the nul character wasn't put in correct position. 6/2/97: 1.0a Revamped networking code, cleaned up a number of potential bugs and made source compatible for freeBSD, Linux, Solaris. Updated Makefile. Added a new internal function N_lockf() to emulate lockf() for non-SVR4 OSes for porting purposes. PREVIOUS ENTRIES NOT RECORDED.