1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-28 01:28:30 +00:00

hide smapi internal functions and cleanup header

This commit is contained in:
Phil Sutter 2009-12-17 22:11:42 +01:00
parent 861988be24
commit 9b66a4715b
5 changed files with 22 additions and 38 deletions

View File

@ -116,11 +116,6 @@ struct text_object;
#include "xmms2.h" #include "xmms2.h"
#endif #endif
#ifdef IBM
#include "ibm.h"
#include "smapi.h"
#endif
#ifdef APCUPSD #ifdef APCUPSD
#include "apcupsd.h" #include "apcupsd.h"
#endif #endif

View File

@ -46,6 +46,10 @@
#include "fonts.h" #include "fonts.h"
#endif #endif
#include "fs.h" #include "fs.h"
#ifdef IBM
#include "ibm.h"
#include "smapi.h"
#endif
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
#include "iconv_tools.h" #include "iconv_tools.h"
#endif #endif

View File

@ -3,8 +3,6 @@
#ifndef _IBM_H #ifndef _IBM_H
#define _IBM_H #define _IBM_H
#include <sys/types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -22,7 +22,6 @@
* *
*/ */
#include "conky.h" /* text_buffer_size, PACKAGE_NAME, maybe more */ #include "conky.h" /* text_buffer_size, PACKAGE_NAME, maybe more */
#include "smapi.h"
#include "temphelper.h" #include "temphelper.h"
#include "logging.h" #include "logging.h"
#include <stdio.h> #include <stdio.h>
@ -33,7 +32,18 @@
#define SYS_SMAPI_PATH "/sys/devices/platform/smapi" #define SYS_SMAPI_PATH "/sys/devices/platform/smapi"
int smapi_bat_installed_internal(int idx) static int smapi_read_int(const char *path)
{
FILE *fp;
int i = 0;
if ((fp = fopen(path, "r")) != NULL) {
fscanf(fp, "%i\n", &i);
fclose(fp);
}
return i;
}
static int smapi_bat_installed_internal(int idx)
{ {
char path[128]; char path[128];
struct stat sb; struct stat sb;
@ -48,7 +58,7 @@ int smapi_bat_installed_internal(int idx)
} }
char *smapi_read_str(const char *path) static char *smapi_read_str(const char *path)
{ {
FILE *fp; FILE *fp;
char str[256] = "failed"; char str[256] = "failed";
@ -59,18 +69,7 @@ char *smapi_read_str(const char *path)
return strndup(str, text_buffer_size); return strndup(str, text_buffer_size);
} }
int smapi_read_int(const char *path) static char *smapi_get_str(const char *fname)
{
FILE *fp;
int i = 0;
if ((fp = fopen(path, "r")) != NULL) {
fscanf(fp, "%i\n", &i);
fclose(fp);
}
return i;
}
char *smapi_get_str(const char *fname)
{ {
char path[128]; char path[128];
if(snprintf(path, 127, SYS_SMAPI_PATH "/%s", fname) < 0) if(snprintf(path, 127, SYS_SMAPI_PATH "/%s", fname) < 0)
@ -79,7 +78,7 @@ char *smapi_get_str(const char *fname)
return smapi_read_str(path); return smapi_read_str(path);
} }
char *smapi_get_bat_str(int idx, const char *fname) static char *smapi_get_bat_str(int idx, const char *fname)
{ {
char path[128]; char path[128];
if(snprintf(path, 127, SYS_SMAPI_PATH "/BAT%i/%s", idx, fname) < 0) if(snprintf(path, 127, SYS_SMAPI_PATH "/BAT%i/%s", idx, fname) < 0)
@ -87,7 +86,7 @@ char *smapi_get_bat_str(int idx, const char *fname)
return smapi_read_str(path); return smapi_read_str(path);
} }
int smapi_get_bat_int(int idx, const char *fname) static int smapi_get_bat_int(int idx, const char *fname)
{ {
char path[128]; char path[128];
if(snprintf(path, 127, SYS_SMAPI_PATH "/BAT%i/%s", idx, fname) < 0) if(snprintf(path, 127, SYS_SMAPI_PATH "/BAT%i/%s", idx, fname) < 0)
@ -95,7 +94,7 @@ int smapi_get_bat_int(int idx, const char *fname)
return smapi_read_int(path); return smapi_read_int(path);
} }
char *smapi_get_bat_val(const char *args) static char *smapi_get_bat_val(const char *args)
{ {
char fname[128]; char fname[128];
int idx, cnt; int idx, cnt;
@ -112,7 +111,7 @@ char *smapi_get_bat_val(const char *args)
return smapi_get_bat_str(idx, fname); return smapi_get_bat_str(idx, fname);
} }
char *smapi_get_val(const char *args) static char *smapi_get_val(const char *args)
{ {
char str[128]; char str[128];

View File

@ -28,18 +28,6 @@
extern "C" { extern "C" {
#endif #endif
int smapi_bat_installed_internal(int);
char *smapi_read_str(const char *);
int smapi_read_int(const char *);
char *smapi_get_str(const char *);
char *smapi_get_val(const char *);
char *smapi_get_bat_str(int, const char *);
int smapi_get_bat_int(int, const char *);
char *smapi_get_bat_val(const char *);
void print_smapi(struct text_object *, char *, int); void print_smapi(struct text_object *, char *, int);
uint8_t smapi_bat_percentage(struct text_object *); uint8_t smapi_bat_percentage(struct text_object *);
void print_smapi_bat_temp(struct text_object *, char *, int); void print_smapi_bat_temp(struct text_object *, char *, int);