Technical notes on my code submission of 03 Nov 99 Kern Sibbald General: - This is a preliminary submission that has not been fully tested though I have been using the apcupsd generated by this submission as the changes are made. - LW LI and LD are gone. They are replaced by log_event() New features: - All logging except apcnet.c and the status file done through syslog(). - New cgi code with graphical display of UPS data. - Configuration file may be specified on the command line. - Status file location can be specified in the configuration. - Status file writes can also be logged. - Status file contains additional data. - The first record of the status file contains a version, the number of records (not including the first one), and the total bytes (not including the first record). New directory: - I added a new cgi directory. It contains the cgi code that interfaces to apcupsd through a web server. Follow the directions in the directory for compiling and installing it. - Note, we should probably automatically call the make in this directory from our make. Changes to code: general - I cleaned up the error_abort() and error_exit() code a bit to eliminate the varags #defines. It should now compile on compilers that do not support varags in defines. - There is now only a single syslog call in all of apcupsd. It is in subroutine log_event(), which is used to log all events. - I eliminated a lot of printfs (not all of them) and replaced them with log_event() calls or error_abort()s as appropriate. - I added additional log_event() calls in many places to enhance logging. - error_abort() now logs an event. - Cleaned up some of the error messages and messages that are logged. - Cleaned up some of the messages in the configuration section. - Changed the PROCFS configuration statement to STATTIME - Changed the LOGGING configuration statement to DATATIME - Added the STATFILE configuration statement - Added the LOGSTATS configuration statement - Changed the ACCESS configuration statement to NETACCESS - Removed the JUSTOSHUTUPCOMPILER configuration statement - added lpr, mail, news, and uucp to the FACILITY statement - added code to close and reopen the logging if the facility changes from the default. - added variables necessary for new format of UPS function codes. - allow the configuration file location to be specified on the command line. - tried to cleanup and simplify the killpwr code. I believe that I stumbled into a bug where non Smart UPS are not being correctly shutdown. See subroutine unknown() - LD LI and LD were eliminated in favor of log_event(). - Rewind the status file rather than reopening it for each write. - Handle the writing of the status file differently. - Status file contains additional data. - The first record of the status file contains a version, the number of records (not including the first one), and the total bytes (not including the first record). - added a maximum length to getline() to avoid buffer overflows Final comments: Work to complete: - Automatically call cgi make from our make. - Documentation. - Automatic conversion of old apcupsd.config files to the new format? - Eliminate the rest of the printfs(). - Examine all configuration messages, and eliminate all "Someone will have to explain this to me" messages. - Check and double check killpwr changes.