summaryrefslogtreecommitdiff
path: root/desktop/netsurf.c
blob: 61b4568a988f945a3e2ddb3234fb7036d561a6b6 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * This file is part of NetSurf, http://netsurf.sourceforge.net/
 * Licensed under the GNU General Public License,
 *                http://www.opensource.org/licenses/gpl-license
 * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
 * Copyright 2003 James Bursa <bursa@users.sourceforge.net>
 */

#include <stdbool.h>
#include <stdlib.h>
#include "netsurf/desktop/options.h"
#include "netsurf/desktop/netsurf.h"
#include "netsurf/desktop/browser.h"
#include "netsurf/desktop/gui.h"
#include "netsurf/content/cache.h"
#include "netsurf/content/fetch.h"
#include "netsurf/utils/log.h"

bool netsurf_quit = false;

static void netsurf_init(int argc, char** argv);
static void netsurf_poll(void);
static void netsurf_exit(void);


/**
 * Gui NetSurf main().
 */

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

  while (!netsurf_quit)
    netsurf_poll();

  netsurf_exit();

  return EXIT_SUCCESS;
}


/**
 * Initialise components used by gui NetSurf.
 */

void netsurf_init(int argc, char** argv)
{
  stdout = stderr;
  options_init(&OPTIONS);
  options_read(&OPTIONS, NULL);
  gui_init(argc, argv);
  fetch_init();
  cache_init();
  nspng_init();
  nsgif_init();
}


/**
 * Poll components which require it.
 */

void netsurf_poll(void)
{
  gui_poll(fetch_active);
  fetch_poll();
}


/**
 * Clean up components used by gui NetSurf.
 */

void netsurf_exit(void)
{
  cache_quit();
  fetch_quit();
  gui_quit();
}