dillo
3.0.5
About: dillo is a small, fast, extensible Web browser particularly suitable for older or smaller computers and embedded systems (but only limited or no support for frames, CSS, JavaScript, Java). Fossies Dox: dillo-3.0.5.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 24 #include <sys/types.h> 31 #include <FL/Fl_Window.H> 32 #include <FL/fl_ask.H> 33 #include <FL/fl_draw.H> 85 " -f, --fullwindow Start in full window mode: hide address bar,\n" 86 " navigation buttons, menu, and status bar."},
88 " -g, -geometry GEO Set initial window position where GEO is\n" 91 " -h, --help Display this help text and exit."},
93 " -l, --local Don't load images or stylesheets, or follow\n" 94 " redirections, for these FILEs or URLs."},
96 " -v, --version Display version info and exit."},
98 " -x, --xid XID Open first Dillo window in an existing\n" 99 " window whose window ID is XID."},
122 pid = waitpid(-1, &status, WNOHANG);
124 if (WIFEXITED(status))
125 printf(
"[dpid]: terminated normally (%d)\n", WEXITSTATUS(status));
126 else if (WIFSIGNALED(status))
127 printf(
"[dpid]: terminated by signal %d\n", WTERMSIG(status));
128 }
else if (pid == 0 || errno == ECHILD) {
145 struct sigaction sigact;
148 (void) sigemptyset(&set);
150 sigact.sa_mask = set;
151 sigact.sa_flags = SA_NOCLDSTOP;
152 if (sigaction(SIGCHLD, &sigact, NULL) == -1) {
165 printf(
"Usage: %s [OPTION]... [--] [URL|FILE]...\n" 166 "Options:\n", cmdname);
167 while (options && options->
help) {
168 printf(
"%s\n", options->
help);
171 printf(
" URL URL to browse.\n" 172 " FILE Local FILE to view.\n" 184 if (abs(options[i].opt_argc) >
max)
185 max = abs(options[i].opt_argc);
193 char **opt_argv,
int *idx)
195 typedef enum { O_SEARCH, O_FOUND, O_NOTFOUND, O_DONE } State;
198 State state = O_SEARCH;
204 for (i = 0; options[i].
shortopt; i++) {
205 if (strcmp(options[i].shortopt, argv[*idx]) == 0 ||
206 strcmp(options[i].longopt, argv[*idx]) == 0) {
213 if (state == O_FOUND) {
215 opt_id = options[i].
id;
217 for (i = 0; *idx < argc && i < abs(n_arg) && argv[*idx][0] !=
'-'; i++)
218 opt_argv[i] = argv[(*idx)++];
223 fprintf(stderr,
"Option %s requires %d argument%s\n",
224 argv[*idx-i-1], n_arg, (n_arg == 1) ?
"" :
"s");
228 if (state == O_NOTFOUND) {
229 if (strcmp(argv[*idx],
"--") == 0)
231 else if (argv[*idx][0] ==
'-') {
232 fprintf(stderr,
"Command line option \"%s\" not recognized.\n",
247 const int interpret_symbols = 0;
249 fl_draw_shortcut = 0;
250 fl_font(o->font, o->size);
251 fl_color((Fl_Color)o->color);
252 fl_draw(o->value, X, Y, W,
H, align, o->image, interpret_symbols);
257 const int interpret_symbols = 0;
259 fl_draw_shortcut = 0;
260 fl_font(o->font, o->size);
261 fl_measure(o->value, W,
H, interpret_symbols);
267 const int interpret_symbols = 0;
269 fl_draw_shortcut = 1;
270 fl_font(o->font, o->size);
271 fl_color((Fl_Color)o->color);
272 fl_draw(o->value, X, Y, W,
H, align, o->image, interpret_symbols);
277 const int interpret_symbols = 0;
279 fl_draw_shortcut = 1;
280 fl_font(o->font, o->size);
281 fl_measure(o->value, W,
H, interpret_symbols);
287 static void checkFont(
const char *name,
const char *type)
290 MSG_WARN(
"preferred %s font \"%s\" not found.\n", type, name);
309 Fl::set_color(idx, color << 8);
310 else if (default_val != 0xFFFFFFFF)
311 Fl::set_color(idx, default_val);
325 Fl::background(r, g, b);
331 fl_contrast(FL_SELECTION_COLOR, FL_BACKGROUND2_COLOR));
334 fl_lighter(FL_BACKGROUND_COLOR));
336 Fl::get_color(FL_BACKGROUND2_COLOR));
338 Fl::get_color(FL_BACKGROUND_COLOR));
340 Fl::get_color(FL_FOREGROUND_COLOR));
342 Fl::get_color(FL_FOREGROUND_COLOR));
354 p = (*str ==
'/') ?
dStrdup(str) :
357 if (access(p, F_OK) == 0) {
360 start_url =
a_Url_new(url_str + 1,
"file:/");
378 int main(
int argc,
char **argv)
395 srand((
uint_t)(time(0) ^ getpid()));
398 signal(SIGPIPE, SIG_IGN);
405 options_got |= opt_id;
413 xid = strtol(opt_argv[0], &end, 0);
415 fprintf(stderr,
"XID argument \"%s\" not valid.\n",opt_argv[0]);
422 fprintf(stderr,
"geometry argument \"%s\" not valid. Must be of " 423 "the form WxH[{+-}X{+-}Y].\n", opt_argv[0]);
428 puts(
"Dillo version " VERSION);
451 PrefsParser::parse(fp);
496 Fl_Window::default_xclass(
"dillo");
506 Fl::option(Fl::OPTION_SHOW_TOOLTIPS,
false);
519 Fl::set_font(FL_HELVETICA, defaultFont);
523 fl_message_title_default(
"Dillo: Message");
532 ((Fl_Widget *)bw->
ui)->window()->make_current();
540 MSG_WARN(
"Not using proxy authentication.\n");
557 for (
int i = idx; i < argc; i++) {
598 MSG(
"Dillo: normal exit!\n");
static void setPenaltyEmDashRight2(int penaltyRightEmDash2)
static void custLabelMeasure(const Fl_Label *o, int &W, int &H)
static FILE * getPrefsFP(const char *rcFile)
static void parse(FILE *fp)
static void raw_sigchld2(int signum)
void a_Cookies_init(void)
#define PREFS_GEOMETRY_DEFAULT_XPOS
void a_Url_free(DilloUrl *url)
#define PREFS_UI_TAB_ACTIVE_FG_COLOR
#define PREFS_GEOMETRY_DEFAULT_YPOS
int32_t ui_selection_color
char * a_Url_string_strip_delimiters(const char *str)
#define PREFS_UI_TAB_BG_COLOR
char * dStrconcat(const char *s1,...)
void a_Prefs_freeall(void)
BrowserWindow * a_UIcmd_browser_window_new(int ww, int wh, uint32_t xid, const void *vbw)
int penalty_em_dash_right_2
static void custMenuLabelMeasure(const Fl_Label *o, int &W, int &H)
static void setPenaltyHyphen2(int penaltyHyphen2)
static void checkFont(const char *name, const char *type)
#define DBG_OBJ_COLOR(klass, color)
static Fl_Font get(const char *name, int attrs)
int32_t ui_button_highlight_color
void a_Domain_parse(FILE *fp)
static void est_sigchld(void)
#define PREFS_UI_TAB_FG_COLOR
static DilloUrl * makeStartUrl(char *str, bool local)
void a_Domain_freeall(void)
int dStrAsciiCasecmp(const char *s1, const char *s2)
void dLib_show_messages(bool_t show)
static bool fontExists(const char *name)
static void checkPreferredFonts()
static void setStretchabilityFactor(int stretchabilityFactor)
DilloUrl * a_Url_new(const char *url_str, const char *base_url)
static OptID getCmdOption(const CLI_options *options, int argc, char **argv, char **opt_argv, int *idx)
int a_Http_proxy_auth(void)
void a_UIcmd_open_url(BrowserWindow *bw, const DilloUrl *url)
static void setPenaltyEmDashRight(int penaltyRightEmDash)
void a_Http_freeall(void)
static void init()
Create the user agent style.
static void setPenaltyHyphen(int penaltyHyphen)
static void setPenaltyEmDashLeft(int penaltyLeftEmDash)
void a_UIcmd_open_url_nt(void *vbw, const DilloUrl *url, int focus)
int a_Misc_parse_geometry(char *str, int *x, int *y, int *w, int *h)
static int numOptions(const CLI_options *options)
void a_Cache_freeall(void)
#define PREFS_UI_TAB_ACTIVE_BG_COLOR
int penalty_em_dash_right
static char * getOldWorkingDir(void)
const char * a_UIcmd_get_passwd(const char *user)
int main(int argc, char **argv)
bool_t middle_click_opens_new_tab
int32_t ui_tab_active_bg_color
void a_Url_set_flags(DilloUrl *u, int flags)
static const CLI_options Options[]
static void custLabelDraw(const Fl_Label *o, int X, int Y, int W, int H, Fl_Align align)
void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url)
char * dStrdup(const char *s)
void a_Http_set_proxy_passwd(const char *str)
void a_UIcmd_set_location_text(void *vbw, const char *text)
#define PREFS_GEOMETRY_DEFAULT_HEIGHT
#define PREFS_UI_BUTTON_HIGHLIGHT_COLOR
void a_Dicache_freeall(void)
int stretchability_factor
#define PREFS_GEOMETRY_DEFAULT_WIDTH
int32_t ui_tab_active_fg_color
char * a_Misc_escape_chars(const char *str, const char *esc_set)
#define dNew0(type, count)
static void printHelp(const char *cmdname, const CLI_options *options)
void a_Dicache_init(void)
static void setUIColorWdef(Fl_Color idx, int32_t color, Fl_Color default_val)
static void custMenuLabelDraw(const Fl_Label *o, int X, int Y, int W, int H, Fl_Align align)