mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 04:17:33 +00:00
hide smapi internal functions and cleanup header
This commit is contained in:
parent
861988be24
commit
9b66a4715b
@ -116,11 +116,6 @@ struct text_object;
|
||||
#include "xmms2.h"
|
||||
#endif
|
||||
|
||||
#ifdef IBM
|
||||
#include "ibm.h"
|
||||
#include "smapi.h"
|
||||
#endif
|
||||
|
||||
#ifdef APCUPSD
|
||||
#include "apcupsd.h"
|
||||
#endif
|
||||
|
@ -46,6 +46,10 @@
|
||||
#include "fonts.h"
|
||||
#endif
|
||||
#include "fs.h"
|
||||
#ifdef IBM
|
||||
#include "ibm.h"
|
||||
#include "smapi.h"
|
||||
#endif
|
||||
#ifdef HAVE_ICONV
|
||||
#include "iconv_tools.h"
|
||||
#endif
|
||||
|
@ -3,8 +3,6 @@
|
||||
#ifndef _IBM_H
|
||||
#define _IBM_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
37
src/smapi.c
37
src/smapi.c
@ -22,7 +22,6 @@
|
||||
*
|
||||
*/
|
||||
#include "conky.h" /* text_buffer_size, PACKAGE_NAME, maybe more */
|
||||
#include "smapi.h"
|
||||
#include "temphelper.h"
|
||||
#include "logging.h"
|
||||
#include <stdio.h>
|
||||
@ -33,7 +32,18 @@
|
||||
|
||||
#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];
|
||||
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;
|
||||
char str[256] = "failed";
|
||||
@ -59,18 +69,7 @@ char *smapi_read_str(const char *path)
|
||||
return strndup(str, text_buffer_size);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
char *smapi_get_str(const char *fname)
|
||||
static char *smapi_get_str(const char *fname)
|
||||
{
|
||||
char path[128];
|
||||
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);
|
||||
}
|
||||
|
||||
char *smapi_get_bat_str(int idx, const char *fname)
|
||||
static char *smapi_get_bat_str(int idx, const char *fname)
|
||||
{
|
||||
char path[128];
|
||||
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);
|
||||
}
|
||||
|
||||
int smapi_get_bat_int(int idx, const char *fname)
|
||||
static int smapi_get_bat_int(int idx, const char *fname)
|
||||
{
|
||||
char path[128];
|
||||
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);
|
||||
}
|
||||
|
||||
char *smapi_get_bat_val(const char *args)
|
||||
static char *smapi_get_bat_val(const char *args)
|
||||
{
|
||||
char fname[128];
|
||||
int idx, cnt;
|
||||
@ -112,7 +111,7 @@ char *smapi_get_bat_val(const char *args)
|
||||
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];
|
||||
|
||||
|
12
src/smapi.h
12
src/smapi.h
@ -28,18 +28,6 @@
|
||||
extern "C" {
|
||||
#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);
|
||||
uint8_t smapi_bat_percentage(struct text_object *);
|
||||
void print_smapi_bat_temp(struct text_object *, char *, int);
|
||||
|
Loading…
Reference in New Issue
Block a user