summaryrefslogtreecommitdiff
path: root/desktop/netsurf.c
blob: e92dea01614922b8e192595a219edb752d4b124c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
 * $Id: netsurf.c,v 1.4 2002/11/03 09:39:53 bursa Exp $
 */

#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/fetch.h"
#include "netsurf/desktop/browser.h"
#include "netsurf/desktop/gui.h"
#include "netsurf/desktop/cache.h"
#include <stdlib.h>

int netsurf_quit = 0;
gui_window* netsurf_gui_windows = NULL;
struct fetch* netsurf_fetches = NULL;


void netsurf_poll(void)
{
  gui_poll();
  netsurf_fetches = fetch_poll(netsurf_fetches);
}


void netsurf_init(int argc, char** argv)
{
  stdout = stderr;
  gui_init(argc, argv);
  cache_init();
}


void netsurf_exit(void)
{
  cache_quit();
}


int main(int argc, char** argv)
{
  netsurf_init(argc, argv);

  while (netsurf_quit == 0)
    netsurf_poll();

  fprintf(stderr, "Netsurf quit!\n");
  netsurf_exit();

  return 0;
}


void Log(char* func, char* msg)
{
#ifdef NETSURF_DUMP
  FILE* logfile = NULL;
  logfile = fopen("logfile","a");
  if (logfile == NULL)
    die("can't open logfile");
  fprintf(logfile, "%s: %s\n", func, msg);
  fclose(logfile);
#endif
}