10 |
#include <stdio.h> |
#include <stdio.h> |
11 |
#include <string.h> |
#include <string.h> |
12 |
#include <sys/stat.h> |
#include <sys/stat.h> |
13 |
|
#include <sys/types.h> |
14 |
#include <oslib/colourtrans.h> |
#include <oslib/colourtrans.h> |
15 |
#include <oslib/osfile.h> |
#include <oslib/osfile.h> |
16 |
#include <oslib/uri.h> |
#include <oslib/uri.h> |
18 |
#include <oslib/wimpspriteop.h> |
#include <oslib/wimpspriteop.h> |
19 |
#include <rufl.h> |
#include <rufl.h> |
20 |
#include "feed.h" |
#include "feed.h" |
|
#include "netsurf/utils/log.h" |
|
21 |
|
|
22 |
|
|
23 |
#define MAX_LINES 20 |
#define MAX_LINES 20 |
26 |
#define FEEDS_WRITE "<Choices$Write>.Sargasso.Feeds" |
#define FEEDS_WRITE "<Choices$Write>.Sargasso.Feeds" |
27 |
#define CHOICES_READ "Choices:Sargasso.Choices" |
#define CHOICES_READ "Choices:Sargasso.Choices" |
28 |
#define CHOICES_WRITE "<Choices$Write>.Sargasso.Choices" |
#define CHOICES_WRITE "<Choices$Write>.Sargasso.Choices" |
29 |
|
#define WRITE_DIR "<Choices$Write>.Sargasso" |
30 |
|
|
31 |
|
#define LOG(x) (printf(__FILE__ " %s %i: ", __PRETTY_FUNCTION__, __LINE__), printf x, fputc('\n', stdout)); |
32 |
|
|
33 |
typedef void (*click_callback)(unsigned int i); |
typedef void (*click_callback)(unsigned int i); |
34 |
|
|
143 |
if (stat(FEEDS_READ, &s)) { |
if (stat(FEEDS_READ, &s)) { |
144 |
warn("Welcome to Sargasso! A selection of feeds have been " |
warn("Welcome to Sargasso! A selection of feeds have been " |
145 |
"added. To add more feeds, use the main menu."); |
"added. To add more feeds, use the main menu."); |
146 |
|
mkdir(WRITE_DIR, S_IRWXU); |
147 |
for (unsigned int i = 0; i != sizeof default_feeds / |
for (unsigned int i = 0; i != sizeof default_feeds / |
148 |
sizeof default_feeds[0]; i++) |
sizeof default_feeds[0]; i++) |
149 |
feed_add(default_feeds[i]); |
feed_add(default_feeds[i]); |
183 |
{ "!sargasso" } } }; |
{ "!sargasso" } } }; |
184 |
os_error *error; |
os_error *error; |
185 |
|
|
|
code = rufl_init(); |
|
|
if (code != rufl_OK) { |
|
|
LOG(("rufl_init: %i", code)); |
|
|
die("Failed to initialise Unicode font library"); |
|
|
} |
|
|
|
|
186 |
error = xwimp_initialise(wimp_VERSION_RO3, "Sargasso", |
error = xwimp_initialise(wimp_VERSION_RO3, "Sargasso", |
187 |
(const wimp_message_list *) &messages, 0, &task); |
(const wimp_message_list *) &messages, 0, &task); |
188 |
if (error) { |
if (error) { |
191 |
die(error->errmess); |
die(error->errmess); |
192 |
} |
} |
193 |
|
|
194 |
|
code = rufl_init(); |
195 |
|
if (code != rufl_OK) { |
196 |
|
LOG(("rufl_init: %i", code)); |
197 |
|
die("Failed to initialise Unicode font library"); |
198 |
|
} |
199 |
|
|
200 |
error = xosfile_read_stamped_no_path("<Sargasso$Dir>.Sprites", |
error = xosfile_read_stamped_no_path("<Sargasso$Dir>.Sprites", |
201 |
&obj_type, 0, 0, &size, 0, 0); |
&obj_type, 0, 0, &size, 0, 0); |
202 |
if (error) { |
if (error) { |