htbuffer stuff

This commit is contained in:
whottgen
2005-03-07 14:11:29 +00:00
parent 5660da9844
commit 360dc19fb0
13 changed files with 514 additions and 73 deletions

View File

@ -22,13 +22,14 @@
#include <syslog.h>
#include "containers_public.h"
#include "htmalloc.h"
#include "htbuffer.h"
int test_worker1_init(cfgl_t *cfg, void **handle);
int test_worker1_setup(void *handle, void **work_handle);
int test_worker1_destroy(void *handle, void *work_handle);
int test_worker1_work(void *handle, void *work_handle, char *input, char *output);
int test_worker2_work(void *handle, void *work_handle, char *input, char *output);
int test_worker1_work(void *handle, void *work_handle, char *input, htbuffer_t *output);
int test_worker2_work(void *handle, void *work_handle, char *input, htbuffer_t *output);
class_descriptor_t test_worker1 = {
"test_worker1",
@ -76,14 +77,18 @@ int test_worker1_destroy(void *handle, void *work_handle) {
free(work_handle);
}
int test_worker1_work(void *handle, void *work_handle, char *input, char *output) {
sprintf(output, "Test-Worker 1 receives %s (handle %s) (called %d)\n",
int test_worker1_work(void *handle, void *work_handle, char *input, htbuffer_t *output) {
char o[1024];
sprintf(o, "Test-Worker 1 receives %s (handle %s) (called %d)\n",
input, (char*)handle, (((test_worker1_handle_t*)work_handle)->counter)++);
htbuffer_strcpy(output, o);
return 0;
}
int test_worker2_work(void *handle, void *work_handle, char *input, char *output) {
sprintf(output, "Test-Worker 2 receives %s\n", input);
int test_worker2_work(void *handle, void *work_handle, char *input, htbuffer_t *output) {
htbuffer_strcpy(output, "Test-Worker 2 receives");
htbuffer_strcat(output, input);
htbuffer_strcat(output, "\n");
return 0;
}