Blame


1 35e1f40a 2021-03-14 op /*
2 35e1f40a 2021-03-14 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 35e1f40a 2021-03-14 op *
4 35e1f40a 2021-03-14 op * Permission to use, copy, modify, and distribute this software for any
5 35e1f40a 2021-03-14 op * purpose with or without fee is hereby granted, provided that the above
6 35e1f40a 2021-03-14 op * copyright notice and this permission notice appear in all copies.
7 35e1f40a 2021-03-14 op *
8 35e1f40a 2021-03-14 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 35e1f40a 2021-03-14 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 35e1f40a 2021-03-14 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 35e1f40a 2021-03-14 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 35e1f40a 2021-03-14 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 35e1f40a 2021-03-14 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 35e1f40a 2021-03-14 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 35e1f40a 2021-03-14 op */
16 35e1f40a 2021-03-14 op
17 740f578b 2021-03-15 op /*
18 eb2ed626 2021-10-07 op * Handles config and runtime files
19 740f578b 2021-03-15 op */
20 786e6deb 2021-07-21 op
21 786e6deb 2021-07-21 op #include "compat.h"
22 35e1f40a 2021-03-14 op
23 6cd6a9e1 2021-03-20 op #include <sys/stat.h>
24 65124267 2021-08-13 op #include <sys/types.h>
25 6cd6a9e1 2021-03-20 op
26 65124267 2021-08-13 op #include <dirent.h>
27 35e1f40a 2021-03-14 op #include <errno.h>
28 35e1f40a 2021-03-14 op #include <limits.h>
29 eb2ed626 2021-10-07 op #include <libgen.h>
30 35e1f40a 2021-03-14 op #include <stdio.h>
31 35e1f40a 2021-03-14 op #include <stdlib.h>
32 35e1f40a 2021-03-14 op #include <string.h>
33 35e1f40a 2021-03-14 op #include <unistd.h>
34 4913b479 2021-07-12 op
35 5a824be4 2021-07-13 op #include "pages.h"
36 f63b8f73 2022-04-24 op #include "parser.h"
37 eb9cbcba 2022-01-03 op #include "session.h"
38 f63b8f73 2022-04-24 op #include "telescope.h"
39 9d65b1d9 2022-01-11 op #include "utils.h"
40 35e1f40a 2021-03-14 op
41 f63b8f73 2022-04-24 op #include "fs.h"
42 f63b8f73 2022-04-24 op
43 f63b8f73 2022-04-24 op #ifndef nitems
44 f63b8f73 2022-04-24 op #define nitems(x) (sizeof(x) / sizeof(x[0]))
45 f63b8f73 2022-04-24 op #endif
46 f63b8f73 2022-04-24 op
47 5cbe1763 2021-08-13 op static int select_non_dot(const struct dirent *);
48 5cbe1763 2021-08-13 op static int select_non_dotdot(const struct dirent *);
49 eb2ed626 2021-10-07 op static size_t join_path(char*, const char*, const char*, size_t);
50 eb2ed626 2021-10-07 op static void getenv_default(char*, const char*, const char*, size_t);
51 eb2ed626 2021-10-07 op static void mkdirs(const char*, mode_t);
52 6c8ddace 2022-01-03 op static void init_paths(void);
53 35e1f40a 2021-03-14 op
54 f88fbabc 2021-11-27 op /*
55 f88fbabc 2021-11-27 op * Where to store user data. These are all equal to ~/.telescope if
56 f88fbabc 2021-11-27 op * it exists.
57 f88fbabc 2021-11-27 op */
58 fb3d08c1 2021-10-07 op char config_path_base[PATH_MAX];
59 fb3d08c1 2021-10-07 op char data_path_base[PATH_MAX];
60 fb3d08c1 2021-10-07 op char cache_path_base[PATH_MAX];
61 eb2ed626 2021-10-07 op
62 4cf6ba13 2022-02-11 op char ctlsock_path[PATH_MAX];
63 eb2ed626 2021-10-07 op char config_path[PATH_MAX];
64 fb3d08c1 2021-10-07 op char lockfile_path[PATH_MAX];
65 fb3d08c1 2021-10-07 op char bookmark_file[PATH_MAX];
66 fb3d08c1 2021-10-07 op char known_hosts_file[PATH_MAX], known_hosts_tmp[PATH_MAX];
67 fb3d08c1 2021-10-07 op char crashed_file[PATH_MAX];
68 de6a6a40 2022-04-24 op char session_file[PATH_MAX], session_file_tmp[PATH_MAX];
69 de6a6a40 2022-04-24 op char history_file[PATH_MAX], history_file_tmp[PATH_MAX];
70 740f578b 2021-03-15 op
71 f63b8f73 2022-04-24 op static int
72 f63b8f73 2022-04-24 op select_non_dot(const struct dirent *d)
73 fb4dc49f 2021-08-13 op {
74 f63b8f73 2022-04-24 op return strcmp(d->d_name, ".");
75 f63b8f73 2022-04-24 op }
76 fb4dc49f 2021-08-13 op
77 f63b8f73 2022-04-24 op static int
78 f63b8f73 2022-04-24 op select_non_dotdot(const struct dirent *d)
79 f63b8f73 2022-04-24 op {
80 f63b8f73 2022-04-24 op return strcmp(d->d_name, ".") && strcmp(d->d_name, "..");
81 fb4dc49f 2021-08-13 op }
82 fb4dc49f 2021-08-13 op
83 fb4dc49f 2021-08-13 op static void
84 f63b8f73 2022-04-24 op send_dir(struct tab *tab, const char *path)
85 35e1f40a 2021-03-14 op {
86 f63b8f73 2022-04-24 op struct dirent **names;
87 f63b8f73 2022-04-24 op int (*selector)(const struct dirent *) = select_non_dot;
88 f63b8f73 2022-04-24 op int i, len;
89 35e1f40a 2021-03-14 op
90 f63b8f73 2022-04-24 op #if notyet
91 f63b8f73 2022-04-24 op /*
92 f63b8f73 2022-04-24 op * need something to fake a redirect
93 f63b8f73 2022-04-24 op */
94 35e1f40a 2021-03-14 op
95 f63b8f73 2022-04-24 op if (!has_suffix(path, "/")) {
96 f63b8f73 2022-04-24 op if (asprintf(&s, "%s/", path) == -1)
97 f63b8f73 2022-04-24 op die();
98 f63b8f73 2022-04-24 op send_hdr(peerid, 30, s);
99 f63b8f73 2022-04-24 op free(s);
100 f63b8f73 2022-04-24 op return;
101 56e7efb4 2021-07-21 op }
102 f63b8f73 2022-04-24 op #endif
103 56e7efb4 2021-07-21 op
104 f63b8f73 2022-04-24 op if (!strcmp(path, "/"))
105 f63b8f73 2022-04-24 op selector = select_non_dotdot;
106 f63b8f73 2022-04-24 op
107 f63b8f73 2022-04-24 op if ((len = scandir(path, &names, selector, alphasort)) == -1) {
108 f63b8f73 2022-04-24 op load_page_from_str(tab, "# failure reading the directory\n");
109 a2728733 2021-07-18 op return;
110 35e1f40a 2021-03-14 op }
111 a2728733 2021-07-18 op
112 f63b8f73 2022-04-24 op parser_init(tab, gemtext_initparser);
113 f63b8f73 2022-04-24 op parser_parsef(tab, "# Index of %s\n\n", path);
114 56e7efb4 2021-07-21 op
115 f63b8f73 2022-04-24 op for (i = 0; i < len; ++i) {
116 f63b8f73 2022-04-24 op const char *sufx = "";
117 fb4dc49f 2021-08-13 op
118 f63b8f73 2022-04-24 op if (names[i]->d_type == DT_DIR)
119 f63b8f73 2022-04-24 op sufx = "/";
120 f63b8f73 2022-04-24 op
121 f63b8f73 2022-04-24 op parser_parsef(tab, "=> %s%s\n", names[i]->d_name, sufx);
122 f63b8f73 2022-04-24 op }
123 f63b8f73 2022-04-24 op
124 f63b8f73 2022-04-24 op parser_free(tab);
125 f63b8f73 2022-04-24 op free(names);
126 fb4dc49f 2021-08-13 op }
127 fb4dc49f 2021-08-13 op
128 f63b8f73 2022-04-24 op static int
129 f63b8f73 2022-04-24 op is_dir(FILE *fp)
130 24a68158 2021-08-13 op {
131 f63b8f73 2022-04-24 op struct stat sb;
132 24a68158 2021-08-13 op
133 f63b8f73 2022-04-24 op if (fstat(fileno(fp), &sb) == -1)
134 f63b8f73 2022-04-24 op return 0;
135 24a68158 2021-08-13 op
136 f63b8f73 2022-04-24 op return S_ISDIR(sb.st_mode);
137 24a68158 2021-08-13 op }
138 24a68158 2021-08-13 op
139 f63b8f73 2022-04-24 op static parserinit
140 65124267 2021-08-13 op file_type(const char *path)
141 fb4dc49f 2021-08-13 op {
142 21268f10 2022-04-24 op const struct mapping {
143 fb4dc49f 2021-08-13 op const char *ext;
144 f63b8f73 2022-04-24 op parserinit fn;
145 fb4dc49f 2021-08-13 op } ms[] = {
146 f63b8f73 2022-04-24 op {"diff", textpatch_initparser},
147 f63b8f73 2022-04-24 op {"gemini", gemtext_initparser},
148 f63b8f73 2022-04-24 op {"gmi", gemtext_initparser},
149 f63b8f73 2022-04-24 op {"markdown", textplain_initparser},
150 f63b8f73 2022-04-24 op {"md", textplain_initparser},
151 f63b8f73 2022-04-24 op {"patch", gemtext_initparser},
152 fb4dc49f 2021-08-13 op {NULL, NULL},
153 65124267 2021-08-13 op }, *m;
154 21268f10 2022-04-24 op const char *dot;
155 65124267 2021-08-13 op
156 65124267 2021-08-13 op if ((dot = strrchr(path, '.')) == NULL)
157 f63b8f73 2022-04-24 op return textplain_initparser;
158 65124267 2021-08-13 op
159 65124267 2021-08-13 op dot++;
160 65124267 2021-08-13 op
161 65124267 2021-08-13 op for (m = ms; m->ext != NULL; ++m)
162 65124267 2021-08-13 op if (!strcmp(m->ext, dot))
163 f63b8f73 2022-04-24 op return m->fn;
164 65124267 2021-08-13 op
165 f63b8f73 2022-04-24 op return textplain_initparser;
166 5cbe1763 2021-08-13 op }
167 5cbe1763 2021-08-13 op
168 f63b8f73 2022-04-24 op void
169 f63b8f73 2022-04-24 op fs_load_url(struct tab *tab, const char *url)
170 5cbe1763 2021-08-13 op {
171 f63b8f73 2022-04-24 op const char *bpath = "bookmarks.gmi", *fallback = "# Not found\n";
172 f63b8f73 2022-04-24 op parserinit initfn = gemtext_initparser;
173 f63b8f73 2022-04-24 op char path[PATH_MAX];
174 f63b8f73 2022-04-24 op FILE *fp = NULL;
175 f63b8f73 2022-04-24 op size_t i;
176 f63b8f73 2022-04-24 op char buf[BUFSIZ];
177 f63b8f73 2022-04-24 op struct page {
178 f63b8f73 2022-04-24 op const char *name;
179 f63b8f73 2022-04-24 op const char *path;
180 f63b8f73 2022-04-24 op const uint8_t *data;
181 f63b8f73 2022-04-24 op size_t len;
182 f63b8f73 2022-04-24 op } pages[] = {
183 f63b8f73 2022-04-24 op {"about", NULL, about_about, about_about_len},
184 f63b8f73 2022-04-24 op {"blank", NULL, about_blank, about_blank_len},
185 f63b8f73 2022-04-24 op {"bookmarks", bpath, bookmarks, bookmarks_len},
186 f63b8f73 2022-04-24 op {"crash", NULL, about_crash, about_crash_len},
187 f63b8f73 2022-04-24 op {"help", NULL, about_help, about_help_len},
188 f63b8f73 2022-04-24 op {"license", NULL, about_license, about_license_len},
189 f63b8f73 2022-04-24 op {"new", NULL, about_new, about_new_len},
190 f63b8f73 2022-04-24 op }, *page = NULL;
191 65124267 2021-08-13 op
192 f63b8f73 2022-04-24 op if (!strncmp(url, "about:", 6)) {
193 f63b8f73 2022-04-24 op url += 6;
194 65124267 2021-08-13 op
195 f63b8f73 2022-04-24 op for (i = 0; page == NULL && i < nitems(pages); ++i) {
196 f63b8f73 2022-04-24 op if (!strcmp(url, pages[i].name))
197 f63b8f73 2022-04-24 op page = &pages[i];
198 f63b8f73 2022-04-24 op }
199 5d43215b 2021-08-13 op
200 f63b8f73 2022-04-24 op if (page == NULL)
201 f63b8f73 2022-04-24 op goto done;
202 5cbe1763 2021-08-13 op
203 f63b8f73 2022-04-24 op strlcpy(path, data_path_base, sizeof(path));
204 f63b8f73 2022-04-24 op strlcat(path, "/", sizeof(path));
205 f63b8f73 2022-04-24 op if (page->path != NULL)
206 f63b8f73 2022-04-24 op strlcat(path, page->path, sizeof(path));
207 f63b8f73 2022-04-24 op else {
208 f63b8f73 2022-04-24 op strlcat(path, "page/about_", sizeof(path));
209 f63b8f73 2022-04-24 op strlcat(path, page->name, sizeof(path));
210 f63b8f73 2022-04-24 op strlcat(path, ".gmi", sizeof(path));
211 f63b8f73 2022-04-24 op }
212 65124267 2021-08-13 op
213 f63b8f73 2022-04-24 op fallback = page->data;
214 f63b8f73 2022-04-24 op } else if (!strncmp(url, "file://", 7)) {
215 f63b8f73 2022-04-24 op url += 7;
216 f63b8f73 2022-04-24 op strlcpy(path, url, sizeof(path));
217 f63b8f73 2022-04-24 op initfn = file_type(url);
218 f63b8f73 2022-04-24 op } else
219 f63b8f73 2022-04-24 op goto done;
220 65124267 2021-08-13 op
221 f63b8f73 2022-04-24 op if ((fp = fopen(path, "r")) == NULL)
222 f63b8f73 2022-04-24 op goto done;
223 65124267 2021-08-13 op
224 f63b8f73 2022-04-24 op if (is_dir(fp)) {
225 f63b8f73 2022-04-24 op fclose(fp);
226 f63b8f73 2022-04-24 op send_dir(tab, path);
227 f63b8f73 2022-04-24 op goto done;
228 fb4dc49f 2021-08-13 op }
229 fb4dc49f 2021-08-13 op
230 f63b8f73 2022-04-24 op parser_init(tab, initfn);
231 f63b8f73 2022-04-24 op for (;;) {
232 f63b8f73 2022-04-24 op size_t r;
233 fb4dc49f 2021-08-13 op
234 f63b8f73 2022-04-24 op r = fread(buf, 1, sizeof(buf), fp);
235 f63b8f73 2022-04-24 op if (!parser_parse(tab, buf, r))
236 f63b8f73 2022-04-24 op break;
237 f63b8f73 2022-04-24 op if (r != sizeof(buf))
238 f63b8f73 2022-04-24 op break;
239 fb4dc49f 2021-08-13 op }
240 f63b8f73 2022-04-24 op parser_free(tab);
241 fb4dc49f 2021-08-13 op
242 f63b8f73 2022-04-24 op done:
243 f63b8f73 2022-04-24 op if (fp != NULL)
244 f63b8f73 2022-04-24 op fclose(fp);
245 f63b8f73 2022-04-24 op else
246 f63b8f73 2022-04-24 op load_page_from_str(tab, fallback);
247 740f578b 2021-03-15 op }
248 288fd238 2021-04-25 op
249 eb2ed626 2021-10-07 op static size_t
250 eb2ed626 2021-10-07 op join_path(char *buf, const char *lhs, const char *rhs, size_t buflen)
251 35e1f40a 2021-03-14 op {
252 eb2ed626 2021-10-07 op strlcpy(buf, lhs, buflen);
253 eb2ed626 2021-10-07 op return strlcat(buf, rhs, buflen);
254 eb2ed626 2021-10-07 op }
255 d0fd368a 2021-07-15 op
256 eb2ed626 2021-10-07 op static void
257 eb2ed626 2021-10-07 op getenv_default(char *buf, const char *name, const char *def, size_t buflen)
258 eb2ed626 2021-10-07 op {
259 eb2ed626 2021-10-07 op size_t ret;
260 eb2ed626 2021-10-07 op char *home, *env;
261 740f578b 2021-03-15 op
262 eb2ed626 2021-10-07 op if ((home = getenv("HOME")) == NULL)
263 eb2ed626 2021-10-07 op errx(1, "HOME is not defined");
264 3a227e9a 2021-03-18 op
265 eb2ed626 2021-10-07 op if ((env = getenv(name)) != NULL)
266 eb2ed626 2021-10-07 op ret = strlcpy(buf, env, buflen);
267 eb2ed626 2021-10-07 op else
268 eb2ed626 2021-10-07 op ret = join_path(buf, home, def, buflen);
269 288fd238 2021-04-25 op
270 eb2ed626 2021-10-07 op if (ret >= buflen)
271 eb2ed626 2021-10-07 op errx(1, "buffer too small for %s", name);
272 eb2ed626 2021-10-07 op }
273 c7107cec 2021-04-01 op
274 eb2ed626 2021-10-07 op static void
275 eb2ed626 2021-10-07 op mkdirs(const char *path, mode_t mode)
276 eb2ed626 2021-10-07 op {
277 444dad86 2021-10-07 op char copy[PATH_MAX+1], orig[PATH_MAX+1], *parent;
278 ea080950 2021-07-20 op
279 eb2ed626 2021-10-07 op strlcpy(copy, path, sizeof(copy));
280 444dad86 2021-10-07 op strlcpy(orig, path, sizeof(orig));
281 eb2ed626 2021-10-07 op parent = dirname(copy);
282 eb2ed626 2021-10-07 op if (!strcmp(parent, "/"))
283 eb2ed626 2021-10-07 op return;
284 eb2ed626 2021-10-07 op mkdirs(parent, mode);
285 eb2ed626 2021-10-07 op
286 444dad86 2021-10-07 op if (mkdir(orig, mode) != 0) {
287 eb2ed626 2021-10-07 op if (errno == EEXIST)
288 eb2ed626 2021-10-07 op return;
289 444dad86 2021-10-07 op err(1, "can't mkdir %s", orig);
290 eb2ed626 2021-10-07 op }
291 eb2ed626 2021-10-07 op }
292 eb2ed626 2021-10-07 op
293 eb2ed626 2021-10-07 op static void
294 6c8ddace 2022-01-03 op init_paths(void)
295 eb2ed626 2021-10-07 op {
296 7e60a21a 2022-01-03 op char xdg_config_base[PATH_MAX];
297 7e60a21a 2022-01-03 op char xdg_data_base[PATH_MAX];
298 7e60a21a 2022-01-03 op char xdg_cache_base[PATH_MAX];
299 7e60a21a 2022-01-03 op char old_path[PATH_MAX];
300 7e60a21a 2022-01-03 op char *home;
301 7e60a21a 2022-01-03 op struct stat info;
302 eb2ed626 2021-10-07 op
303 eb2ed626 2021-10-07 op /* old path */
304 eb2ed626 2021-10-07 op if ((home = getenv("HOME")) == NULL)
305 eb2ed626 2021-10-07 op errx(1, "HOME is not defined");
306 eb2ed626 2021-10-07 op join_path(old_path, home, "/.telescope", sizeof(old_path));
307 eb2ed626 2021-10-07 op
308 eb2ed626 2021-10-07 op /* if ~/.telescope exists, use that instead of xdg dirs */
309 eb2ed626 2021-10-07 op if (stat(old_path, &info) == 0 && S_ISDIR(info.st_mode)) {
310 eb2ed626 2021-10-07 op join_path(config_path_base, home, "/.telescope",
311 eb2ed626 2021-10-07 op sizeof(config_path_base));
312 eb2ed626 2021-10-07 op join_path(data_path_base, home, "/.telescope",
313 eb2ed626 2021-10-07 op sizeof(data_path_base));
314 eb2ed626 2021-10-07 op join_path(cache_path_base, home, "/.telescope",
315 eb2ed626 2021-10-07 op sizeof(cache_path_base));
316 eb2ed626 2021-10-07 op return;
317 eb2ed626 2021-10-07 op }
318 eb2ed626 2021-10-07 op
319 eb2ed626 2021-10-07 op /* xdg paths */
320 eb2ed626 2021-10-07 op getenv_default(xdg_config_base, "XDG_CONFIG_HOME", "/.config",
321 eb2ed626 2021-10-07 op sizeof(xdg_config_base));
322 eb2ed626 2021-10-07 op getenv_default(xdg_data_base, "XDG_DATA_HOME", "/.local/share",
323 eb2ed626 2021-10-07 op sizeof(xdg_data_base));
324 eb2ed626 2021-10-07 op getenv_default(xdg_cache_base, "XDG_CACHE_HOME", "/.cache",
325 eb2ed626 2021-10-07 op sizeof(xdg_cache_base));
326 eb2ed626 2021-10-07 op
327 eb2ed626 2021-10-07 op join_path(config_path_base, xdg_config_base, "/telescope",
328 eb2ed626 2021-10-07 op sizeof(config_path_base));
329 eb2ed626 2021-10-07 op join_path(data_path_base, xdg_data_base, "/telescope",
330 eb2ed626 2021-10-07 op sizeof(data_path_base));
331 eb2ed626 2021-10-07 op join_path(cache_path_base, xdg_cache_base, "/telescope",
332 eb2ed626 2021-10-07 op sizeof(cache_path_base));
333 eb2ed626 2021-10-07 op
334 eb2ed626 2021-10-07 op mkdirs(xdg_config_base, S_IRWXU);
335 eb2ed626 2021-10-07 op mkdirs(xdg_data_base, S_IRWXU);
336 eb2ed626 2021-10-07 op mkdirs(xdg_cache_base, S_IRWXU);
337 eb2ed626 2021-10-07 op
338 eb2ed626 2021-10-07 op mkdirs(config_path_base, S_IRWXU);
339 eb2ed626 2021-10-07 op mkdirs(data_path_base, S_IRWXU);
340 eb2ed626 2021-10-07 op mkdirs(cache_path_base, S_IRWXU);
341 eb2ed626 2021-10-07 op }
342 eb2ed626 2021-10-07 op
343 eb2ed626 2021-10-07 op int
344 eb2ed626 2021-10-07 op fs_init(void)
345 eb2ed626 2021-10-07 op {
346 6c8ddace 2022-01-03 op init_paths();
347 eb2ed626 2021-10-07 op
348 4cf6ba13 2022-02-11 op join_path(ctlsock_path, cache_path_base, "/ctl",
349 4cf6ba13 2022-02-11 op sizeof(ctlsock_path));
350 eb2ed626 2021-10-07 op join_path(config_path, config_path_base, "/config",
351 eb2ed626 2021-10-07 op sizeof(config_path));
352 eb2ed626 2021-10-07 op join_path(lockfile_path, cache_path_base, "/lock",
353 eb2ed626 2021-10-07 op sizeof(lockfile_path));
354 eb2ed626 2021-10-07 op join_path(bookmark_file, data_path_base, "/bookmarks.gmi",
355 eb2ed626 2021-10-07 op sizeof(bookmark_file));
356 eb2ed626 2021-10-07 op join_path(known_hosts_file, data_path_base, "/known_hosts",
357 eb2ed626 2021-10-07 op sizeof(known_hosts_file));
358 eb2ed626 2021-10-07 op join_path(known_hosts_tmp, cache_path_base,
359 eb2ed626 2021-10-07 op "/known_hosts.tmp.XXXXXXXXXX", sizeof(known_hosts_tmp));
360 eb2ed626 2021-10-07 op join_path(session_file, cache_path_base, "/session",
361 de6a6a40 2022-04-24 op sizeof(session_file));
362 de6a6a40 2022-04-24 op join_path(session_file_tmp, cache_path_base, "/session.XXXXXXXXXX",
363 eb2ed626 2021-10-07 op sizeof(session_file));
364 9e97090d 2022-02-26 op join_path(history_file, cache_path_base, "/history",
365 de6a6a40 2022-04-24 op sizeof(history_file));
366 de6a6a40 2022-04-24 op join_path(history_file_tmp, cache_path_base, "/history.XXXXXXXXXX",
367 9e97090d 2022-02-26 op sizeof(history_file));
368 eb2ed626 2021-10-07 op join_path(crashed_file, cache_path_base, "/crashed",
369 eb2ed626 2021-10-07 op sizeof(crashed_file));
370 eb2ed626 2021-10-07 op
371 3a227e9a 2021-03-18 op return 1;
372 9e97090d 2022-02-26 op }