forked from Lainports/freebsd-ports
Notable changes are:
- it now builds using gmake
- NLS and POWERFLUTE are removed
- POLLTIME directive to control UPS polling interval. This directive
specifies the number of seconds to delay between polling the UPS for
status. Previously, NETTIME allowed this to be adjusted for network
connections only (snmp, pcnet, nis-net). POLLTIME configures the delay
for all connection types. NETTIME is accepted as a synonym for
compatibility with old config files.
- you can now use the graphical client via GAPCMON OPTION
- it won't build on anything pre 6.3R
Tested by: Stefan Lambrev <stefan.lambrev@moneybookers.com>
54 lines
1.1 KiB
C
54 lines
1.1 KiB
C
--- ./src/apcaccess.c.orig 2008-01-27 18:22:58.000000000 +0200
|
|
+++ ./src/apcaccess.c 2008-06-29 14:17:12.000000000 +0300
|
|
@@ -68,11 +68,19 @@
|
|
int main(int argc, char **argv)
|
|
{
|
|
int mode = 0;
|
|
+ UPSINFO *ups = NULL;
|
|
+
|
|
+ char *cfgfile = APCCONF;
|
|
+ struct stat cfgstat;
|
|
|
|
#ifdef HAVE_MINGW
|
|
WSA_Init(); /* init MS networking */
|
|
#endif
|
|
|
|
+ ups = attach_ups(ups);
|
|
+ if (!ups)
|
|
+ Error_abort0(_("Cannot attach SYSV IPC.\n"));
|
|
+
|
|
if (argc < 2) {
|
|
/* Assume user wants "status" */
|
|
mode = 2;
|
|
@@ -94,8 +102,23 @@
|
|
*p++ = 0;
|
|
port = atoi(p);
|
|
}
|
|
+ } else {
|
|
+ /* check configuration so local NISIP and NISPORT variables can be used as
|
|
+ defaults */
|
|
+ if (!stat(cfgfile, &cfgstat)) {
|
|
+ check_for_config(ups, cfgfile);
|
|
+
|
|
+ if (ups) {
|
|
+ if (ups->nisip && ups->nisip[0])
|
|
+ host = ups->nisip;
|
|
+
|
|
+ if (ups->statusport)
|
|
+ port = ups->statusport;
|
|
+ }
|
|
+ }
|
|
}
|
|
|
|
+
|
|
if (!*host || strcmp(host, "0.0.0.0") == 0)
|
|
host = "localhost";
|
|
|
|
@@ -108,5 +131,7 @@
|
|
return 1;
|
|
}
|
|
|
|
+ detach_ups(ups);
|
|
+
|
|
return 0;
|
|
}
|