38 lines
591 B
C
38 lines
591 B
C
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <assert.h>
|
||
|
|
||
|
#include "../include/plug.h"
|
||
|
|
||
|
PLUG_NAME("Example plugin")
|
||
|
PLUG_VERSION("0.0.0")
|
||
|
PLUG_LICENSE("GPLv3")
|
||
|
|
||
|
typedef struct plug_t {
|
||
|
char* some_data;
|
||
|
} plug_t;
|
||
|
|
||
|
static plug_t* p = {0};
|
||
|
|
||
|
void plug_init() {
|
||
|
p = malloc(sizeof(plug_t));
|
||
|
assert(p != NULL && "Buy more ram KEKW");
|
||
|
p->some_data = "hi :3";
|
||
|
}
|
||
|
|
||
|
void* plug_pre_reload() {
|
||
|
return p;
|
||
|
}
|
||
|
|
||
|
void plug_post_reload(void *state) {
|
||
|
p = state;
|
||
|
}
|
||
|
|
||
|
void plug_poll(char *buf, size_t len) {
|
||
|
snprintf(buf, len, "%s", p->some_data);
|
||
|
}
|
||
|
|
||
|
void plug_free() {
|
||
|
free(p);
|
||
|
}
|