#include #include #include #include void handle_request() { struct magi_request request; if (magi_cgi(&request, 0, 0)) { struct magi_field *a = magi_field_list_get(request.fields, "addon"); if (a && a->data) { FILE *file = fopen("file_to_append", "a"); fputs(a->data, file); fclose(file); } magi_request_destroy(&request); } } void print_preamble() { puts("Content-type: application/xhtml+xml\r\n\r\n"); } void print_webpage() { puts( "" "" "Append to File" "" "
" "" "" "
" "" "" ); } int main(int argc, char const *argv[]) { handle_request(); print_preamble(); print_webpage(); return 0; }