getline -> get_line, regen plist while there

This commit is contained in:
sthen 2012-03-17 10:35:10 +00:00
parent 8798621f94
commit 7316ef1a51
3 changed files with 79 additions and 4 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.20 2010/11/20 17:22:40 espie Exp $
# $OpenBSD: Makefile,v 1.21 2012/03/17 10:35:10 sthen Exp $
COMMENT= UPS software for APC UPS models
DISTNAME= apc-upsd
PKGNAME= ${DISTNAME}-19991128
REVISION = 0
REVISION= 1
CATEGORIES= sysutils
MASTER_SITES= http://www.knienieder.com/software/
@ -13,6 +13,7 @@ PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
WANTLIB= c
EXTRACT_SUFX= .tgz

View File

@ -0,0 +1,74 @@
$OpenBSD: patch-apc_smart_c,v 1.1 2012/03/17 10:35:10 sthen Exp $
--- apc_smart.c.orig Sat Mar 17 10:33:05 2012
+++ apc_smart.c Sat Mar 17 10:33:19 2012
@@ -93,7 +93,7 @@ int apc_smart_open ()
/* ------------------------------------------------------------------ */
-int getline(int fd, char *s)
+int get_line(int fd, char *s)
{
int i = 0;
int ending = 0;
@@ -158,8 +158,8 @@ static void apc_smart_test()
{
char answer[MAXLINE];
- apc_send_ups( 'Y' );getline( ups->pd, answer );
- apc_send_ups( 'A' );getline( ups->pd, answer );
+ apc_send_ups( 'Y' );get_line( ups->pd, answer );
+ apc_send_ups( 'A' );get_line( ups->pd, answer );
syslog( LOG_INFO, "test started.");
}
@@ -170,39 +170,39 @@ static int apc_ask_smart()
{
char answer[MAXLINE];
- apc_send_ups( 'Y' );getline( ups->pd, answer );
+ apc_send_ups( 'Y' );get_line( ups->pd, answer );
if ( ups->extended )
{
- apc_send_ups( 'f' ); getline( ups->pd, answer );
+ apc_send_ups( 'f' ); get_line( ups->pd, answer );
ups->BatLoad = atof(answer);
- apc_send_ups( 'N' ); getline( ups->pd, answer );
+ apc_send_ups( 'N' ); get_line( ups->pd, answer );
ups->LineMin = atof(answer);
- apc_send_ups( 'M' ); getline( ups->pd, answer );
+ apc_send_ups( 'M' ); get_line( ups->pd, answer );
ups->LineMax = atof(answer);
- apc_send_ups( 'P'); getline( ups->pd, answer );
+ apc_send_ups( 'P'); get_line( ups->pd, answer );
ups->UPSLoad = atof(answer);
- apc_send_ups('F'); getline( ups->pd, answer );
+ apc_send_ups('F'); get_line( ups->pd, answer );
ups->LineFreq = atof(answer);
- apc_send_ups( 'L'); getline( ups->pd, answer );
+ apc_send_ups( 'L'); get_line( ups->pd, answer );
ups->LineVoltage = atof(answer);
- apc_send_ups( 'O'); getline( ups->pd, answer );
+ apc_send_ups( 'O'); get_line( ups->pd, answer );
ups->OutputVoltage = atof(answer);
- apc_send_ups( 'C' ); getline( ups->pd, answer );
+ apc_send_ups( 'C' ); get_line( ups->pd, answer );
ups->UPSTemp = atof(answer);
- apc_send_ups('B'); getline( ups->pd, answer );
+ apc_send_ups('B'); get_line( ups->pd, answer );
ups->BattVoltage = atof(answer);
}
- apc_send_ups('Q'); getline( ups->pd, answer );
+ apc_send_ups('Q'); get_line( ups->pd, answer );
ups->Status = atoi(answer);
/* write info to syslog */

View File

@ -1,7 +1,7 @@
@comment $OpenBSD: PLIST,v 1.6 2004/09/15 18:39:32 espie Exp $
@comment $OpenBSD: PLIST,v 1.7 2012/03/17 10:35:10 sthen Exp $
lib/apc-upsd/
lib/apc-upsd/apc-upsd.conf
@sample ${SYSCONFDIR}/apc-upsd.conf
sbin/apc-upsd
@bin sbin/apc-upsd
share/doc/apc-upsd/
share/doc/apc-upsd/smart-protocol