Dillo v3.1.1-99-gf3103cc4
Loading...
Searching...
No Matches
dillo.cc File Reference

Dillo web browser. More...

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <locale.h>
#include <errno.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/fl_ask.H>
#include <FL/fl_draw.H>
#include "msg.h"
#include "paths.hh"
#include "uicmd.hh"
#include "prefs.h"
#include "prefsparser.hh"
#include "keys.hh"
#include "bw.h"
#include "misc.h"
#include "history.h"
#include "dns.h"
#include "web.hh"
#include "IO/tls.h"
#include "IO/Url.h"
#include "IO/mime.h"
#include "capi.h"
#include "dicache.h"
#include "cookies.h"
#include "hsts.h"
#include "domain.h"
#include "auth.h"
#include "styleengine.hh"
#include "dw/fltkcore.hh"
#include "dw/widget.hh"
#include "dw/textblock.hh"
#include "dw/table.hh"
Include dependency graph for dillo.cc:

Go to the source code of this file.

Enumerations

enum  OptID {
  DILLO_CLI_NONE = 0 , DILLO_CLI_XID = 1 << 0 , DILLO_CLI_FULLWINDOW = 1 << 1 , DILLO_CLI_HELP = 1 << 2 ,
  DILLO_CLI_VERSION = 1 << 3 , DILLO_CLI_LOCAL = 1 << 4 , DILLO_CLI_GEOMETRY = 1 << 5 , DILLO_CLI_ERROR = 1 << 15
}
 Command line options structure. More...
 

Functions

static void raw_sigchld2 (int signum)
 Avoid our children (Dpid) to become zombies.
 
static void handler_usr1 (int signum)
 
static void est_sigchld (void)
 Establish SIGCHLD handler.
 
static void printHelp (const char *cmdname, const CLI_options *options)
 Print help text generated from the options structure.
 
static int numOptions (const CLI_options *options)
 Return the maximum number of option arguments.
 
static OptID getCmdOption (const CLI_options *options, int argc, char **argv, char **opt_argv, int *idx)
 Get next command line option.
 
static void custLabelDraw (const Fl_Label *o, int X, int Y, int W, int H, Fl_Align align)
 Set FL_NORMAL_LABEL to interpret neither symbols (@) nor shortcuts (&), and FL_FREE_LABELTYPE to interpret shortcuts.
 
static void custLabelMeasure (const Fl_Label *o, int &W, int &H)
 
static void custMenuLabelDraw (const Fl_Label *o, int X, int Y, int W, int H, Fl_Align align)
 
static void custMenuLabelMeasure (const Fl_Label *o, int &W, int &H)
 
static void checkFont (const char *name, const char *type)
 Tell the user if default/pref fonts can't be found.
 
static void checkPreferredFonts ()
 
static void setUIColorWdef (Fl_Color idx, int32_t color, Fl_Color default_val)
 Set UI color.
 
static void setColors ()
 
static DilloUrlmakeStartUrl (char *str, bool local)
 Given a command line argument, build a DilloUrl for it.
 
int main (int argc, char **argv)
 

Variables

static volatile sig_atomic_t sig_reload = 0
 
static const CLI_options Options []
 

Detailed Description

Dillo web browser.

Definition in file dillo.cc.

Enumeration Type Documentation

◆ OptID

enum OptID

Command line options structure.

Enumerator
DILLO_CLI_NONE 
DILLO_CLI_XID 
DILLO_CLI_FULLWINDOW 
DILLO_CLI_HELP 
DILLO_CLI_VERSION 
DILLO_CLI_LOCAL 
DILLO_CLI_GEOMETRY 
DILLO_CLI_ERROR 

Definition at line 74 of file dillo.cc.

Function Documentation

◆ checkFont()

static void checkFont ( const char *  name,
const char *  type 
)
static

Tell the user if default/pref fonts can't be found.

Definition at line 308 of file dillo.cc.

References dw::fltk::FltkFont::fontExists(), and MSG_WARN.

Referenced by checkPreferredFonts().

◆ checkPreferredFonts()

static void checkPreferredFonts ( )
static

◆ custLabelDraw()

static void custLabelDraw ( const Fl_Label *  o,
int  X,
int  Y,
int  W,
int  H,
Fl_Align  align 
)
static

Set FL_NORMAL_LABEL to interpret neither symbols (@) nor shortcuts (&), and FL_FREE_LABELTYPE to interpret shortcuts.

Definition at line 265 of file dillo.cc.

References H.

Referenced by main().

◆ custLabelMeasure()

static void custLabelMeasure ( const Fl_Label *  o,
int &  W,
int &  H 
)
static

Definition at line 276 of file dillo.cc.

References H.

Referenced by main().

◆ custMenuLabelDraw()

static void custMenuLabelDraw ( const Fl_Label *  o,
int  X,
int  Y,
int  W,
int  H,
Fl_Align  align 
)
static

Definition at line 285 of file dillo.cc.

References H.

Referenced by main().

◆ custMenuLabelMeasure()

static void custMenuLabelMeasure ( const Fl_Label *  o,
int &  W,
int &  H 
)
static

Definition at line 296 of file dillo.cc.

References H.

Referenced by main().

◆ est_sigchld()

static void est_sigchld ( void  )
static

Establish SIGCHLD handler.

Definition at line 159 of file dillo.cc.

References handler_usr1(), and raw_sigchld2().

Referenced by main().

◆ getCmdOption()

static OptID getCmdOption ( const CLI_options *  options,
int  argc,
char **  argv,
char **  opt_argv,
int *  idx 
)
static

Get next command line option.

Definition at line 213 of file dillo.cc.

References DILLO_CLI_ERROR, and DILLO_CLI_NONE.

Referenced by main().

◆ handler_usr1()

static void handler_usr1 ( int  signum)
static

Definition at line 151 of file dillo.cc.

References sig_reload.

Referenced by est_sigchld().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 399 of file dillo.cc.

References a_Auth_init(), a_Bw_init(), a_Cache_freeall(), a_Capi_init(), a_Cookies_freeall(), a_Cookies_init(), a_Dicache_freeall(), a_Dicache_init(), a_Dns_freeall(), a_Dns_init(), a_Domain_freeall(), a_Domain_parse(), a_Dpi_init(), a_History_freeall(), a_Hsts_freeall(), a_Hsts_init(), a_Http_freeall(), a_Http_init(), a_Http_proxy_auth(), a_Http_set_proxy_passwd(), a_Mime_init(), a_Misc_parse_geometry(), a_Prefs_freeall(), a_Prefs_init(), a_Tls_freeall(), a_Tls_init(), a_UIcmd_browser_window_new(), a_UIcmd_get_passwd(), a_UIcmd_init(), a_UIcmd_open_url(), a_UIcmd_open_url_nt(), a_UIcmd_open_url_nw(), a_UIcmd_reload_all_active(), a_UIcmd_set_location_text(), a_Url_free(), a_Web_init(), DilloPrefs::adjust_min_width, DilloPrefs::adjust_table_min_width, checkPreferredFonts(), custLabelDraw(), custLabelMeasure(), custMenuLabelDraw(), custMenuLabelMeasure(), dFree(), DILLO_CLI_FULLWINDOW, DILLO_CLI_GEOMETRY, DILLO_CLI_HELP, DILLO_CLI_LOCAL, DILLO_CLI_VERSION, DILLO_CLI_XID, dLib_show_messages(), dNew0, dStrAsciiCasecmp(), est_sigchld(), DilloPrefs::font_sans_serif, Keys::free(), Paths::free(), dw::core::freeall(), dw::fltk::freeall(), DilloPrefs::fullwindow_start, dw::fltk::FltkFont::get(), getCmdOption(), Paths::getPrefsFP(), DilloPrefs::height, DilloPrefs::http_proxyuser, Keys::init(), StyleEngine::init(), Paths::init(), makeStartUrl(), DilloPrefs::middle_click_opens_new_tab, MSG, MSG_WARN, numOptions(), Options, Keys::parse(), PATHS_HSTS_PRELOAD, PATHS_RC_DOMAIN, PATHS_RC_KEYS, PATHS_RC_PREFS, DilloPrefs::penalty_em_dash_left, DilloPrefs::penalty_em_dash_right, DilloPrefs::penalty_em_dash_right_2, DilloPrefs::penalty_hyphen, DilloPrefs::penalty_hyphen_2, prefs, PREFS_GEOMETRY_DEFAULT_HEIGHT, PREFS_GEOMETRY_DEFAULT_WIDTH, PREFS_GEOMETRY_DEFAULT_XPOS, PREFS_GEOMETRY_DEFAULT_YPOS, printHelp(), dw::core::Widget::setAdjustMinWidth(), dw::Table::setAdjustTableMinWidth(), setColors(), dw::Textblock::setPenaltyEmDashLeft(), dw::Textblock::setPenaltyEmDashRight(), dw::Textblock::setPenaltyEmDashRight2(), dw::Textblock::setPenaltyHyphen(), dw::Textblock::setPenaltyHyphen2(), dw::Textblock::setStretchabilityFactor(), DilloPrefs::show_msg, DilloPrefs::show_ui_tooltip, sig_reload, DilloPrefs::start_page, DilloPrefs::stretchability_factor, DilloPrefs::theme, TRUE, BrowserWindow::ui, URL_PATH, URL_SCHEME, URL_STR, DilloPrefs::width, DilloPrefs::xpos, and DilloPrefs::ypos.

◆ makeStartUrl()

static DilloUrl * makeStartUrl ( char *  str,
bool  local 
)
static

Given a command line argument, build a DilloUrl for it.

Definition at line 369 of file dillo.cc.

References a_Misc_escape_chars(), a_Url_new(), a_Url_set_flags(), a_Url_string_strip_delimiters(), dFree(), dStrconcat(), dStrdup(), Paths::getOldWorkingDir(), URL_FLAGS, and URL_SpamSafe.

Referenced by main().

◆ numOptions()

static int numOptions ( const CLI_options *  options)
static

Return the maximum number of option arguments.

Definition at line 200 of file dillo.cc.

Referenced by main().

◆ printHelp()

static void printHelp ( const char *  cmdname,
const CLI_options *  options 
)
static

Print help text generated from the options structure.

Definition at line 184 of file dillo.cc.

Referenced by main().

◆ raw_sigchld2()

static void raw_sigchld2 ( int  signum)
static

Avoid our children (Dpid) to become zombies.

:-) Notes: . We let sigaction block SIGCHLD while in the handler. . Portability is not simple. e.g. http://www.faqs.org/faqs/unix-faq/faq/part3/section-13.html man sigaction, waitpid

Definition at line 126 of file dillo.cc.

Referenced by est_sigchld().

◆ setColors()

◆ setUIColorWdef()

static void setUIColorWdef ( Fl_Color  idx,
int32_t  color,
Fl_Color  default_val 
)
static

Set UI color.

'color' is an 0xrrggbb value, whereas 'default_val' is a fltk color (index 0-0xFF, or 0xrrggbb00).

Definition at line 327 of file dillo.cc.

Referenced by setColors().

Variable Documentation

◆ Options

const CLI_options Options[]
static
Initial value:
= {
{"-f", "--fullwindow", 0, DILLO_CLI_FULLWINDOW,
" -f, --fullwindow Start in full window mode: hide address bar,\n"
" navigation buttons, menu, and status bar."},
{"-g", "-geometry", 1, DILLO_CLI_GEOMETRY,
" -g, -geometry GEO Set initial window position where GEO is\n"
" WxH[{+-}X{+-}Y]"},
{"-h", "--help", 0, DILLO_CLI_HELP,
" -h, --help Display this help text and exit."},
{"-l", "--local", 0, DILLO_CLI_LOCAL,
" -l, --local Don't load images or stylesheets, or follow\n"
" redirections, for these FILEs or URLs."},
{"-v", "--version", 0, DILLO_CLI_VERSION,
" -v, --version Display version info and exit."},
{"-x", "--xid", 1, DILLO_CLI_XID,
" -x, --xid XID Open first Dillo window in an existing\n"
" window whose window ID is XID."},
{NULL, NULL, 0, DILLO_CLI_NONE, NULL}
}
@ DILLO_CLI_XID
Definition dillo.cc:76
@ DILLO_CLI_LOCAL
Definition dillo.cc:80
@ DILLO_CLI_NONE
Definition dillo.cc:75
@ DILLO_CLI_FULLWINDOW
Definition dillo.cc:77
@ DILLO_CLI_HELP
Definition dillo.cc:78
@ DILLO_CLI_VERSION
Definition dillo.cc:79
@ DILLO_CLI_GEOMETRY
Definition dillo.cc:81

Definition at line 93 of file dillo.cc.

Referenced by main().

◆ sig_reload

volatile sig_atomic_t sig_reload = 0
static

Definition at line 69 of file dillo.cc.

Referenced by handler_usr1(), and main().