75 lines
2.8 KiB
Plaintext
75 lines
2.8 KiB
Plaintext
$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 */
|