annotate src/dillo.cc @ 2048:5060d415a85a

clickable menu items (even those introducing submenus) MUST have callbacks I clicked on the "Panel size" item itself instead of any of the options in its submenu, and: Segfault!
author corvid <corvid@lavabit.com>
date Thu, 26 May 2011 02:51:18 +0000
parents 679657a0e2be
children 9657be74b813
rev   line source
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
1 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
2 * Dillo web browser
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
3 *
35
d9e7b35430de Updated copyright lines
jcid
parents: 0
diff changeset
4 * Copyright 1999-2007 Jorge Arellano Cid <jcid@dillo.org>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
5 *
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
8 * the Free Software Foundation; either version 3 of the License, or
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
9 * (at your option) any later version.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
10 *
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
14 * GNU General Public License for more details.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
15 *
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
972
d7dbd3dcfa38 Updated the GPL copyright note in the source files
Detlef Riekenberg <wine.dev@web.de>
parents: 928
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
18 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
19
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
20 #include <stdio.h>
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
21 #include <unistd.h>
127
63878d92f35b - Some fixes to multipart/form-data encoding
jcid
parents: 92
diff changeset
22 #include <stdlib.h>
63878d92f35b - Some fixes to multipart/form-data encoding
jcid
parents: 92
diff changeset
23 #include <time.h>
200
a53374d75277 - Restored the ignore SIGPIPE directive.
jcid
parents: 127
diff changeset
24 #include <signal.h>
1713
4d87e55c0bbb Add utf8 uppercasing to small-caps
Jorge Arellano Cid <jcid@dillo.org>
parents: 1452
diff changeset
25 #include <locale.h>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
26
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
27 #include <FL/Fl.H>
1798
a30a6ad210a9 some dillo.cc
corvid <corvid@lavabit.com>
parents: 1715
diff changeset
28 #include <FL/Fl_Window.H>
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
29 #include <FL/fl_draw.H>
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
30
201
5f66eb0ae1f8 - Added creation of ~/.dillo directory in main().
jcid
parents: 200
diff changeset
31 #include "msg.h"
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
32 #include "paths.hh"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
33 #include "uicmd.hh"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
34
84
03f9a7877a2e Implemented the SELECT element in FORMS!
jcid
parents: 72
diff changeset
35 #include "prefs.h"
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
36 #include "prefsparser.hh"
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
37 #include "keys.hh"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
38 #include "bw.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
39 #include "misc.h"
1151
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
40 #include "history.h"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
41
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
42 #include "dns.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
43 #include "web.hh"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
44 #include "IO/Url.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
45 #include "IO/mime.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
46 #include "capi.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
47 #include "dicache.h"
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
48 #include "cookies.h"
470
b01e80ee7c88 Added basic authentication!
Jorge Arellano Cid <jcid@dillo.org>
parents: 448
diff changeset
49 #include "auth.h"
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
50
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
51 /*
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
52 * Command line options structure
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
53 */
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
54 typedef enum {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
55 DILLO_CLI_NONE = 0,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
56 DILLO_CLI_XID = 1 << 0,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
57 DILLO_CLI_FULLWINDOW = 1 << 1,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
58 DILLO_CLI_HELP = 1 << 2,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
59 DILLO_CLI_VERSION = 1 << 3,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
60 DILLO_CLI_LOCAL = 1 << 4,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
61 DILLO_CLI_GEOMETRY = 1 << 5,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
62 DILLO_CLI_ERROR = 1 << 15,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
63 } OptID;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
64
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
65 typedef struct {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
66 const char *shortopt;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
67 const char *longopt;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
68 int opt_argc; /* positive: mandatory, negative: optional */
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
69 OptID id;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
70 const char *help;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
71 } CLI_options;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
72
476
97e5244798b7 Added const to CLI_options variable.
corvid <corvid@lavabit.com>
parents: 475
diff changeset
73 static const CLI_options Options[] = {
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
74 {"-f", "--fullwindow", 0, DILLO_CLI_FULLWINDOW,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
75 " -f, --fullwindow Start in full window mode: hide address bar,\n"
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
76 " navigation buttons, menu, and status bar."},
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
77 {"-g", "-geometry", 1, DILLO_CLI_GEOMETRY,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
78 " -g, -geometry GEO Set initial window position where GEO is\n"
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
79 " WxH[{+-}X{+-}Y]"},
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
80 {"-h", "--help", 0, DILLO_CLI_HELP,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
81 " -h, --help Display this help text and exit."},
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
82 {"-l", "--local", 0, DILLO_CLI_LOCAL,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
83 " -l, --local Don't load images for these URL(s)."},
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
84 {"-v", "--version", 0, DILLO_CLI_VERSION,
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
85 " -v, --version Display version info and exit."},
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
86 {"-x", "--xid", 1, DILLO_CLI_XID,
1112
2676e58c225f update documentation on xid
corvid <corvid@lavabit.com>
parents: 1109
diff changeset
87 " -x, --xid XID Open first Dillo window in an existing\n"
1136
6707fde200f7 allow hexadecimal --xid argument
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1112
diff changeset
88 " window whose window ID is XID."},
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
89 {NULL, NULL, 0, DILLO_CLI_NONE, NULL}
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
90 };
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
91
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
92 /*
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
93 * Print help text generated from the options structure
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
94 */
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
95 static void printHelp(const char *cmdname, const CLI_options *options)
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
96 {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
97 printf("Usage: %s [OPTION]... [--] [URL|FILE]...\n"
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
98 "Options:\n", cmdname);
928
7771cf243ca6 's/if(/if (/g' 's/for(/for (/g' 's/while(/while (/g', and indentation.
Jorge Arellano Cid <jcid@dillo.org>
parents: 847
diff changeset
99 while (options && options->help) {
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
100 printf("%s\n", options->help);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
101 options++;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
102 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
103 printf(" URL URL to browse.\n"
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
104 " FILE Local FILE to view.\n"
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
105 "\n");
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
106 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
107
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
108 /*
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
109 * Return the maximum number of option arguments
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
110 */
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
111 static int numOptions(const CLI_options *options)
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
112 {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
113 int i, max;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
114
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
115 for (i = 0, max = 0; options[i].shortopt; i++)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
116 if (abs(options[i].opt_argc) > max)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
117 max = abs(options[i].opt_argc);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
118 return max;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
119 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
120
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
121 /*
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
122 * Get next command line option.
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
123 */
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
124 static OptID getCmdOption(const CLI_options *options, int argc, char **argv,
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
125 char **opt_argv, int *idx)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
126 {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
127 typedef enum { O_SEARCH, O_FOUND, O_NOTFOUND, O_DONE } State;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
128 OptID opt_id = DILLO_CLI_NONE;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
129 int i = 0;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
130 State state = O_SEARCH;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
131
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
132 if (*idx >= argc) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
133 state = O_DONE;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
134 } else {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
135 state = O_NOTFOUND;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
136 for (i = 0; options[i].shortopt; i++) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
137 if (strcmp(options[i].shortopt, argv[*idx]) == 0 ||
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
138 strcmp(options[i].longopt, argv[*idx]) == 0) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
139 state = O_FOUND;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
140 ++*idx;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
141 break;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
142 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
143 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
144 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
145 if (state == O_FOUND) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
146 int n_arg = options[i].opt_argc;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
147 opt_id = options[i].id;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
148 /* Find the required/optional arguments of the option */
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
149 for (i = 0; *idx < argc && i < abs(n_arg) && argv[*idx][0] != '-'; i++)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
150 opt_argv[i] = argv[(*idx)++];
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
151 opt_argv[i] = NULL;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
152
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
153 /* Optional arguments have opt_argc < 0 */
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
154 if (i < n_arg) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
155 fprintf(stderr, "Option %s requires %d argument%s\n",
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
156 argv[*idx-i-1], n_arg, (n_arg == 1) ? "" : "s");
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
157 opt_id = DILLO_CLI_ERROR;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
158 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
159 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
160 if (state == O_NOTFOUND) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
161 if (strcmp(argv[*idx], "--") == 0)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
162 (*idx)++;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
163 else if (argv[*idx][0] == '-') {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
164 fprintf(stderr, "Command line option \"%s\" not recognized.\n",
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
165 argv[*idx]);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
166 opt_id = DILLO_CLI_ERROR;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
167 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
168 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
169 return opt_id;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
170 }
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
171
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
172 /*
1973
679657a0e2be symbol/shortcut interpretation, comments
corvid <corvid@lavabit.com>
parents: 1970
diff changeset
173 * Set FL_NORMAL_LABEL to interpret neither symbols (@) nor shortcuts (&),
679657a0e2be symbol/shortcut interpretation, comments
corvid <corvid@lavabit.com>
parents: 1970
diff changeset
174 * and FL_FREE_LABELTYPE to interpret shortcuts.
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
175 */
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
176 static void custLabelDraw(const Fl_Label* o, int X, int Y, int W, int H,
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
177 Fl_Align align)
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
178 {
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
179 const int interpret_symbols = 0;
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
180
1921
eca772fd4540 disable shortcut drawing in labels
corvid <corvid@lavabit.com>
parents: 1904
diff changeset
181 fl_draw_shortcut = 0;
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
182 fl_font(o->font, o->size);
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
183 fl_color((Fl_Color)o->color);
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
184 fl_draw(o->value, X, Y, W, H, align, o->image, interpret_symbols);
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
185 }
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
186
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
187 static void custLabelMeasure(const Fl_Label* o, int& W, int& H)
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
188 {
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
189 const int interpret_symbols = 0;
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
190
1921
eca772fd4540 disable shortcut drawing in labels
corvid <corvid@lavabit.com>
parents: 1904
diff changeset
191 fl_draw_shortcut = 0;
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
192 fl_font(o->font, o->size);
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
193 fl_measure(o->value, W, H, interpret_symbols);
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
194 }
1921
eca772fd4540 disable shortcut drawing in labels
corvid <corvid@lavabit.com>
parents: 1904
diff changeset
195
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
196 static void custMenuLabelDraw(const Fl_Label* o, int X, int Y, int W, int H,
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
197 Fl_Align align)
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
198 {
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
199 const int interpret_symbols = 0;
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
200
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
201 fl_draw_shortcut = 1;
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
202 fl_font(o->font, o->size);
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
203 fl_color((Fl_Color)o->color);
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
204 fl_draw(o->value, X, Y, W, H, align, o->image, interpret_symbols);
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
205 }
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
206
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
207 static void custMenuLabelMeasure(const Fl_Label* o, int& W, int& H)
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
208 {
1973
679657a0e2be symbol/shortcut interpretation, comments
corvid <corvid@lavabit.com>
parents: 1970
diff changeset
209 const int interpret_symbols = 0;
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
210
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
211 fl_draw_shortcut = 1;
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
212 fl_font(o->font, o->size);
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
213 fl_measure(o->value, W, H, interpret_symbols);
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
214 }
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
215
1836
879c110ecb57 some general commenting-out for src/
corvid <corvid@lavabit.com>
parents: 1798
diff changeset
216 #if 0
879c110ecb57 some general commenting-out for src/
corvid <corvid@lavabit.com>
parents: 1798
diff changeset
217 PORT1.3
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
218 /*
1444
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
219 * Tell the user if default/pref fonts can't be found.
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
220 */
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
221 static void checkFont(const char *name, const char *type)
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
222 {
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
223 if (::fltk::font(name) == NULL)
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
224 MSG_WARN("preferred %s font \"%s\" not found.\n", type, name);
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
225 }
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
226
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
227 static void checkPreferredFonts()
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
228 {
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
229 checkFont(prefs.font_sans_serif, "sans-serif");
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
230 checkFont(prefs.font_serif, "serif");
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
231 checkFont(prefs.font_monospace, "monospace");
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
232 checkFont(prefs.font_cursive, "cursive");
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
233 checkFont(prefs.font_fantasy, "fantasy");
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
234 }
1836
879c110ecb57 some general commenting-out for src/
corvid <corvid@lavabit.com>
parents: 1798
diff changeset
235 #endif
1444
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
236 /*
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
237 * Given a command line argument, build a DilloUrl for it.
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
238 */
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
239 static DilloUrl *makeStartUrl(char *str, bool local)
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
240 {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
241 char *url_str, *p;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
242 DilloUrl *start_url;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
243
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
244 /* Relative path to a local file? */
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
245 p = (*str == '/') ? dStrdup(str) :
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
246 dStrconcat(Paths::getOldWorkingDir(), "/", str, NULL);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
247
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
248 if (access(p, F_OK) == 0) {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
249 /* absolute path may have non-URL characters */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
250 url_str = a_Misc_escape_chars(p, "% ");
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
251 start_url = a_Url_new(url_str + 1, "file:/");
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
252 } else {
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
253 /* Not a file, filter URL string */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
254 url_str = a_Url_string_strip_delimiters(str);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
255 start_url = a_Url_new(url_str, NULL);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
256 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
257 dFree(p);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
258 dFree(url_str);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
259
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
260 if (local)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
261 a_Url_set_flags(start_url, URL_FLAGS(start_url) | URL_SpamSafe);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
262
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
263 return start_url;
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
264 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
265
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
266 /*
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
267 * MAIN
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
268 */
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
269 int main(int argc, char **argv)
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
270 {
1232
d598ecc970c6 Minor cleanups
Jorge Arellano Cid <jcid@dillo.org>
parents: 1196
diff changeset
271 uint_t opt_id;
d598ecc970c6 Minor cleanups
Jorge Arellano Cid <jcid@dillo.org>
parents: 1196
diff changeset
272 uint_t options_got = 0;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
273 uint32_t xid = 0;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
274 int idx = 1;
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
275 int xpos = PREFS_GEOMETRY_DEFAULT_XPOS, ypos = PREFS_GEOMETRY_DEFAULT_YPOS,
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
276 width = PREFS_GEOMETRY_DEFAULT_WIDTH,
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
277 height = PREFS_GEOMETRY_DEFAULT_HEIGHT;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
278 char **opt_argv;
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
279 FILE *fp;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
280
127
63878d92f35b - Some fixes to multipart/form-data encoding
jcid
parents: 92
diff changeset
281 srand((uint_t)(time(0) ^ getpid()));
63878d92f35b - Some fixes to multipart/form-data encoding
jcid
parents: 92
diff changeset
282
200
a53374d75277 - Restored the ignore SIGPIPE directive.
jcid
parents: 127
diff changeset
283 // Some OSes exit dillo without this (not GNU/Linux).
a53374d75277 - Restored the ignore SIGPIPE directive.
jcid
parents: 127
diff changeset
284 signal(SIGPIPE, SIG_IGN);
a53374d75277 - Restored the ignore SIGPIPE directive.
jcid
parents: 127
diff changeset
285
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
286 /* Handle command line options */
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
287 opt_argv = dNew0(char*, numOptions(Options) + 1);
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
288 while ((opt_id = getCmdOption(Options, argc, argv, opt_argv, &idx))) {
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
289 options_got |= opt_id;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
290 switch (opt_id) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
291 case DILLO_CLI_FULLWINDOW:
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
292 case DILLO_CLI_LOCAL:
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
293 break;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
294 case DILLO_CLI_XID:
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
295 {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
296 char *end;
1136
6707fde200f7 allow hexadecimal --xid argument
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1112
diff changeset
297 xid = strtol(opt_argv[0], &end, 0);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
298 if (*end) {
1136
6707fde200f7 allow hexadecimal --xid argument
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1112
diff changeset
299 fprintf(stderr, "XID argument \"%s\" not valid.\n",opt_argv[0]);
1276
27d5ce598493 return 2 for bad cmdline arg
corvid <corvid@lavabit.com>
parents: 1232
diff changeset
300 return 2;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
301 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
302 break;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
303 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
304 case DILLO_CLI_GEOMETRY:
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
305 if (!a_Misc_parse_geometry(opt_argv[0],&xpos,&ypos,&width,&height)){
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
306 fprintf(stderr, "geometry argument \"%s\" not valid. Must be of "
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
307 "the form WxH[{+-}X{+-}Y].\n", opt_argv[0]);
1276
27d5ce598493 return 2 for bad cmdline arg
corvid <corvid@lavabit.com>
parents: 1232
diff changeset
308 return 2;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
309 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
310 break;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
311 case DILLO_CLI_VERSION:
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
312 puts("Dillo version " VERSION);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
313 return 0;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
314 case DILLO_CLI_HELP:
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
315 printHelp(argv[0], Options);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
316 return 0;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
317 default:
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
318 printHelp(argv[0], Options);
1276
27d5ce598493 return 2 for bad cmdline arg
corvid <corvid@lavabit.com>
parents: 1232
diff changeset
319 return 2;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
320 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
321 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
322 dFree(opt_argv);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
323
1196
97f3d9265b00 Check chdir() return code in Paths::init
Michal Nowak newman.x@gmail.com
parents: 1155
diff changeset
324 // set the default values for the preferences
97f3d9265b00 Check chdir() return code in Paths::init
Michal Nowak newman.x@gmail.com
parents: 1155
diff changeset
325 a_Prefs_init();
97f3d9265b00 Check chdir() return code in Paths::init
Michal Nowak newman.x@gmail.com
parents: 1155
diff changeset
326
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
327 // create ~/.dillo if not present
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
328 Paths::init();
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
329
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
330 // initialize default key bindings
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
331 Keys::init();
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
332
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
333 // parse dillorc
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
334 if ((fp = Paths::getPrefsFP(PATHS_RC_PREFS))) {
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
335 PrefsParser::parse(fp);
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
336 }
1064
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
337 // parse keysrc
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
338 if ((fp = Paths::getPrefsFP(PATHS_RC_KEYS))) {
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
339 Keys::parse(fp);
485acc9e60e2 Added configurable keybindings! (in ~/.dillo/keysrc) # part1
Jorge Arellano Cid <jcid@dillo.org>
parents: 1053
diff changeset
340 }
1104
a450688d276e Added DLIB_MSG() macro for dlib's messages
corvid <corvid@lavabit.com>
parents: 1064
diff changeset
341 dLib_show_messages(prefs.show_msg);
1053
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
342
64e078b7a711 Refactor the preferences parser
Tim Nieradzik, Jorge Arellano Cid
parents: 1040
diff changeset
343 // initialize internal modules
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
344 a_Dpi_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
345 a_Dns_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
346 a_Web_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
347 a_Http_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
348 a_Mime_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
349 a_Capi_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
350 a_Dicache_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
351 a_Bw_init();
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
352 a_Cookies_init();
470
b01e80ee7c88 Added basic authentication!
Jorge Arellano Cid <jcid@dillo.org>
parents: 448
diff changeset
353 a_Auth_init();
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
354
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
355 /* command line options override preferences */
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
356 if (options_got & DILLO_CLI_FULLWINDOW)
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
357 prefs.fullwindow_start = TRUE;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
358 if (options_got & DILLO_CLI_GEOMETRY) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
359 prefs.width = width;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
360 prefs.height = height;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
361 prefs.xpos = xpos;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
362 prefs.ypos = ypos;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
363 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
364
355
a51f2a345f4f - Set WM_CLASS="dillo" for X11
jcid
parents: 334
diff changeset
365 // Sets WM_CLASS hint on X11
1798
a30a6ad210a9 some dillo.cc
corvid <corvid@lavabit.com>
parents: 1715
diff changeset
366 Fl_Window::default_xclass("dillo");
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
367
1973
679657a0e2be symbol/shortcut interpretation, comments
corvid <corvid@lavabit.com>
parents: 1970
diff changeset
368 // Disable '@' and '&' interpretation in normal labels.
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
369 Fl::set_labeltype(FL_NORMAL_LABEL, custLabelDraw, custLabelMeasure);
1973
679657a0e2be symbol/shortcut interpretation, comments
corvid <corvid@lavabit.com>
parents: 1970
diff changeset
370
679657a0e2be symbol/shortcut interpretation, comments
corvid <corvid@lavabit.com>
parents: 1970
diff changeset
371 // Use to permit '&' interpretation.
1970
7bfc11c78869 Set FL_FREE_LABELTYPE to interpret symbols and draw shortcut (for "File" menu)
Jorge Arellano Cid <jcid@dillo.org>
parents: 1957
diff changeset
372 Fl::set_labeltype(FL_FREE_LABELTYPE,custMenuLabelDraw,custMenuLabelMeasure);
1902
06fb15f69228 disable symbol-interpretation in labels
corvid <corvid@lavabit.com>
parents: 1836
diff changeset
373
1836
879c110ecb57 some general commenting-out for src/
corvid <corvid@lavabit.com>
parents: 1798
diff changeset
374 #if 0
879c110ecb57 some general commenting-out for src/
corvid <corvid@lavabit.com>
parents: 1798
diff changeset
375 PORT1.3
1444
18354f36b06b warn when preferred font(s) not found
corvid <corvid@lavabit.com>
parents: 1382
diff changeset
376 checkPreferredFonts();
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
377 /* use preferred font for UI */
824
556b5972dd18 adapt font-family preferences to match CSS
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 476
diff changeset
378 fltk::Font *dfont = fltk::font(prefs.font_sans_serif, 0);
448
cea1e7304278 - Set prefs.vw_fontname as deafult font for the UI.
jcid
parents: 404
diff changeset
379 if (dfont) {
cea1e7304278 - Set prefs.vw_fontname as deafult font for the UI.
jcid
parents: 404
diff changeset
380 fltk::Widget::default_style->textfont(dfont);
cea1e7304278 - Set prefs.vw_fontname as deafult font for the UI.
jcid
parents: 404
diff changeset
381 fltk::Widget::default_style->labelfont(dfont);
cea1e7304278 - Set prefs.vw_fontname as deafult font for the UI.
jcid
parents: 404
diff changeset
382 }
1836
879c110ecb57 some general commenting-out for src/
corvid <corvid@lavabit.com>
parents: 1798
diff changeset
383 #endif
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
384 // Create a new UI/bw pair
1109
39febe63d2c9 add support for --xid command line option
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1104
diff changeset
385 BrowserWindow *bw = a_UIcmd_browser_window_new(0, 0, xid, NULL);
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
386
1904
a629521ec82a make_current()
corvid <corvid@lavabit.com>
parents: 1902
diff changeset
387 /* We need this so that fl_text_extents() in dw/fltkplatform.cc can
a629521ec82a make_current()
corvid <corvid@lavabit.com>
parents: 1902
diff changeset
388 * work when FLTK is configured without XFT and Dillo is opening
a629521ec82a make_current()
corvid <corvid@lavabit.com>
parents: 1902
diff changeset
389 * immediately-available URLs from the cmdline (e.g. about:splash).
a629521ec82a make_current()
corvid <corvid@lavabit.com>
parents: 1902
diff changeset
390 */
a629521ec82a make_current()
corvid <corvid@lavabit.com>
parents: 1902
diff changeset
391 ((Fl_Widget *)bw->ui)->window()->make_current();
a629521ec82a make_current()
corvid <corvid@lavabit.com>
parents: 1902
diff changeset
392
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
393 /* Proxy authentication */
241
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
394 if (prefs.http_proxyuser && !a_Http_proxy_auth()) {
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
395 const char *passwd = a_UIcmd_get_passwd(prefs.http_proxyuser);
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
396 if (passwd) {
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
397 a_Http_set_proxy_passwd(passwd);
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
398 } else {
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
399 MSG_WARN("Not using proxy authentication.\n");
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
400 }
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
401 }
78fa66a3ba64 - Enabled proxy_user in preferences.
jcid
parents: 204
diff changeset
402
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
403 /* Open URLs/files */
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
404 const bool local = options_got & DILLO_CLI_LOCAL;
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
405
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
406 if (idx == argc) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
407 /* No URLs/files on cmdline. Send startup screen */
1957
2ac2b0e6aced Fixed button sensitivity when starting with an empty page
Jorge Arellano Cid <jcid@dillo.org>
parents: 1921
diff changeset
408 if (strcmp(URL_STR(prefs.start_page), "about:blank") == 0)
2ac2b0e6aced Fixed button sensitivity when starting with an empty page
Jorge Arellano Cid <jcid@dillo.org>
parents: 1921
diff changeset
409 a_UIcmd_open_url(bw, NULL);
2ac2b0e6aced Fixed button sensitivity when starting with an empty page
Jorge Arellano Cid <jcid@dillo.org>
parents: 1921
diff changeset
410 else
2ac2b0e6aced Fixed button sensitivity when starting with an empty page
Jorge Arellano Cid <jcid@dillo.org>
parents: 1921
diff changeset
411 a_UIcmd_open_url(bw, prefs.start_page);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
412 } else {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
413 for (int i = idx; i < argc; i++) {
1040
52e3049ba0fc Camel case in src/dillo.cc
Tim Nieradzik <tim.nieradzik@gmx.de>
parents: 972
diff changeset
414 DilloUrl *start_url = makeStartUrl(argv[i], local);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
415
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
416 if (i > idx) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
417 if (prefs.middle_click_opens_new_tab) {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
418 /* user must prefer tabs */
847
760f1826c67c Made Shift+{Left,Right} work after openning multiple URLs from CLI
Jorge Arellano Cid <jcid@dillo.org>
parents: 824
diff changeset
419 const int focus = 1;
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
420 a_UIcmd_open_url_nt(bw, start_url, focus);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
421 } else {
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
422 a_UIcmd_open_url_nw(bw, start_url);
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
423 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
424 } else {
1452
3f94a991d848 use a_UIcmd_open_url() instead of a_Nav_push() in dillo.cc
Johannes Hofmann <Johannes.Hofmann@gmx.de>
parents: 1444
diff changeset
425 a_UIcmd_open_url(bw, start_url);
472
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
426 }
155bb3508127 Ported the command line interface from dillo1 (XID not working yet)
Jorge Arellano Cid <jcid@dillo.org>
parents: 470
diff changeset
427 a_Url_free(start_url);
404
c530a4bbf070 - WORKAROUND to display HTML for sylpheed.
jcid
parents: 380
diff changeset
428 }
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
429 }
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
430
1798
a30a6ad210a9 some dillo.cc
corvid <corvid@lavabit.com>
parents: 1715
diff changeset
431 Fl::run();
1151
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
432
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
433 /*
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
434 * Memory deallocating routines
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
435 * (This can be left to the OS, but we'll do it, with a view to test
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
436 * and fix our memory management)
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
437 */
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
438 a_Cookies_freeall();
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
439 a_Cache_freeall();
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
440 a_Dicache_freeall();
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
441 a_Http_freeall();
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
442 a_Dns_freeall();
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
443 a_History_freeall();
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
444 a_Prefs_freeall();
1154
97cac73b5c71 free Keys
corvid <corvid@lavabit.com>
parents: 1151
diff changeset
445 Keys::free();
1155
19e94f78cf85 free Paths
corvid <corvid@lavabit.com>
parents: 1154
diff changeset
446 Paths::free();
1151
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
447 /* TODO: auth, css */
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
448
1382
7faa2c7a544f Switch the DPI framework from Unix sockets to Internet sockets
Jorge Arellano Cid <jcid@dillo.org>
parents: 1276
diff changeset
449 //a_Dpi_dillo_exit();
1151
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
450 MSG("Dillo: normal exit!\n");
278bbfd85a02 Bound at-exit memory deallocation
corvid <corvid@lavabit.com>
parents: 1136
diff changeset
451 return 0;
0
6ee11bf9e3ea Initial revision
jcid
parents:
diff changeset
452 }