/* smapi.c: conky support for IBM Thinkpad smapi
*
* Copyright (C) 2007 Phil Sutter <Phil@nwl.cc>
- *
+ *
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA.
*
- * $Id$
- *
*/
-#include "conky.h"
+#define _GNU_SOURCE
+#include "conky.h" /* text_buffer_size, PACKAGE_NAME, maybe more */
+#include "smapi.h"
+#include "logging.h"
#include <stdio.h>
-#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <sys/stat.h>
+#include <sys/types.h>
#define SYS_SMAPI_PATH "/sys/devices/platform/smapi"
fscanf(fp, "%255s\n", str);
fclose(fp);
}
- return strdup(str);
+ return strndup(str, text_buffer_size);
}
int smapi_read_int(const char *path)