summaryrefslogtreecommitdiffstats
path: root/podboat.cpp
blob: 2fbff24e87aa3c170c84d05da3d7574ef1f4066b (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
#include <cstring>
#include <errno.h>
#include <iostream>

#include "config.h"
#include "exception.h"
#include "pbcontroller.h"
#include "pbview.h"
#include "utils.h"

extern "C" {
	void rs_setup_human_panic(void);
}

using namespace podboat;

int main(int argc, char* argv[])
{
	rs_setup_human_panic();
	utils::initialize_ssl_implementation();

	setlocale(LC_CTYPE, "");
	setlocale(LC_MESSAGES, "");

	textdomain(PACKAGE);
	bindtextdomain(PACKAGE, LOCALEDIR);
	// Internally, Newsboat stores all strings in UTF-8, so we require gettext
	// to return messages in that encoding.
	bind_textdomain_codeset(PACKAGE, "UTF-8");

	PbController c;

	try {
		c.initialize(argc, argv);

		podboat::PbView v(&c);

		return c.run(v);
	} catch (const newsboat::Exception& e) {
		Stfl::reset();
		std::cerr << strprintf::fmt(_("Caught newsboat::Exception with "
					"message: %s"),
				e.what())
			<< std::endl;
		::exit(EXIT_FAILURE);
	}
}