1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 11:05:18 +00:00
conky/src/conf_cookie.c

34 lines
550 B
C
Raw Normal View History

#define _GNU_SOURCE
#include <stdio.h>
#include <sys/types.h>
#include "defconfig.h"
ssize_t conf_read(void *cookie, char *buf, size_t size)
{
static int col = 0, row = 0;
size_t i = 0;
const char *conf[] = defconfig;
(void)cookie;
while (i < size) {
if (!(conf[row])) /* end of rows */
break;
if (!(conf[row][col])) { /* end of line */
row++;
col = 0;
continue;
}
buf[i++] = conf[row][col++];
}
return i;
}
cookie_io_functions_t conf_cookie = {
.read = &conf_read,
.write = NULL,
.seek = NULL,
.close = NULL,
};