20 #include <fcgi_stdio.h>
24 main (
int argc,
char *argv[])
26 int err, fake_argc = 1;
27 char * fake_argv[] = {
"hello", 0};
39 rc = gnc_book_begin (book,
"file:/tmp/demo.gnucash", FALSE);
40 if (!rc)
goto bookerrexit;
42 rc = gnc_book_load (book);
43 if (!rc)
goto bookerrexit;
46 root = gnc_book_get_root_account (book);
51 while (FCGI_Accept() >= 0)
59 request_method = getenv (
"REQUEST_METHOD");
64 if (!strcmp (
"GET", request_method))
66 gncxml_write_account_tree_to_buf(root, &bufp, &sz);
69 printf(
"Content-type: text/gnc-xml\r\n"
70 "Content-Length: %d\r\n"
82 if (!strcmp (
"POST", request_method))
84 char * content_length = getenv(
"CONTENT_LENGTH");
85 read_len = atoi (content_length);
88 bufp = (
char *) malloc (read_len);
89 fread (bufp, read_len, 1, stdin);
92 q = gncxml_read_query (bufp, read_len);
93 xaccQuerySetGroup (q, root);
106 printf(
"Content-type: text/plain\r\n"
108 "unknown request type \n");
115 err = gnc_book_get_error (book);
118 FCGI_SetExitStatus (500);
120 printf(
"Content-type: text/plain\r\n\r\n"
121 "error was %s\n", strerror (err));
void gnc_engine_shutdown(void)
QofBook * qof_book_new(void)
api for Version 1 XML-based file format
void qof_query_set_max_results(QofQuery *q, int n)
void qof_query_destroy(QofQuery *q)
void gnc_engine_init(int argc, char **argv)
All type declarations for the whole Gnucash engine.
GList * qof_query_run(QofQuery *query)
void qof_book_destroy(QofBook *book)