Escape shell commands properly.
[uzbl-mobile] / uzbl.h
diff --git a/uzbl.h b/uzbl.h
index 797dcaa..506f1d3 100644 (file)
--- a/uzbl.h
+++ b/uzbl.h
@@ -1,4 +1,5 @@
-/* 
+/* -*- c-basic-offset: 4; -*- 
+
  * See LICENSE for license details
  *
  * Changelog:
@@ -7,14 +8,14 @@
  * (c) 2009 by Robert Manea
  *     - introduced struct concept
  *     - statusbar template
- *     
+ *
  */
 
 #define STATUS_DEFAULT "<span background=\"darkblue\" foreground=\"white\"> MODE </span> <span background=\"red\" foreground=\"white\">KEYCMD</span> (LOAD_PROGRESS%)  <b>TITLE</b>  - Uzbl browser"
 
 enum {
   /* statusbar symbols */
-  SYM_TITLE, SYM_URI, SYM_NAME, 
+  SYM_TITLE, SYM_URI, SYM_NAME,
   SYM_LOADPRGS, SYM_LOADPRGSBAR,
   SYM_KEYCMD, SYM_MODE, SYM_MSG,
   /* useragent symbols */
@@ -86,10 +87,10 @@ typedef struct {
     GHashTable     *proto_var;
     /* command parsing regexes */
     GRegex         *set_regex;
-    GRegex         *cmd_regex;
+    GRegex         *act_regex;
     GRegex         *keycmd_regex;
-    GRegex         *get_regex; 
-    GRegex         *bind_regex; 
+    GRegex         *get_regex;
+    GRegex         *bind_regex;
 } Communication;
 
 
@@ -104,6 +105,7 @@ typedef struct {
     GString* keycmd;
     gchar    searchtx[500];
     struct utsname unameinfo; /* system info */
+    gboolean verbose;
 } State;
 
 
@@ -136,6 +138,9 @@ typedef struct {
     gchar*   modkey;
     guint    modmask;
     guint    http_debug;
+    guint    default_font_size;
+    guint    minimum_font_size;
+    gchar*   shell_cmd;
 
     /* command list: name -> Command  */
     GHashTable* commands;
@@ -165,6 +170,22 @@ typedef struct {
 
 typedef void sigfunc(int);
 
+/* XDG Stuff */
+
+typedef struct {
+    gchar* environmental;
+    gchar* default_value;
+} XDG_Var;
+
+XDG_Var XDG[] = 
+{
+    { "XDG_CONFIG_HOME", "~/.config" },
+    { "XDG_DATA_HOME",   "~/.local/share" },
+    { "XDG_CACHE_HOME",  "~/.cache" },
+    { "XDG_CONFIG_DIRS", "/etc/xdg" },
+    { "XDG_DATA_DIRS",   "/usr/local/share/:/usr/share/" },
+};
+
 /* Functions */
 static void
 setup_scanner();
@@ -172,6 +193,9 @@ setup_scanner();
 char *
 itos(int val);
 
+static char *
+str_replace (const char* search, const char* replace, const char* string);
+
 static void
 clean_up(void);
 
@@ -239,15 +263,15 @@ static void
 close_uzbl (WebKitWebView *page, const char *param);
 
 static gboolean
-run_command_async(const char *command, const char *args);
-
-static gboolean
-run_command_sync(const char *command, const char *args, char **stdout);
+run_command(const char *command, const char *args, const gboolean sync, char **stdout);
 
 static void
 spawn(WebKitWebView *web_view, const char *param);
 
 static void
+spawn_sh(WebKitWebView *web_view, const char *param);
+
+static void
 parse_command(const char *cmd, const char *param);
 
 static void
@@ -280,12 +304,12 @@ create_stdin();
 static gchar*
 init_socket(gchar *dir);
 
-static void
+static gboolean
 control_socket(GIOChannel *chan);
 
 static void
 update_title (void);
+
 static gboolean
 key_press_cb (WebKitWebView* page, GdkEventKey* event);
 
@@ -304,6 +328,12 @@ GtkWidget* create_window ();
 static void
 add_binding (const gchar *key, const gchar *act);
 
+static gchar*
+get_xdg_var (XDG_Var xdg);
+
+static gchar*
+find_xdg_file (int xdg_type, char* filename);
+
 static void
 settings_init ();