aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-main.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-03-03 05:30:04 +0800
committerChristian Persch <chpe@src.gnome.org>2006-03-03 05:30:04 +0800
commitfdb9695a63e0d25e9adffeb485962ee62e67f310 (patch)
tree08b1288995fccfe1e25c65595c3c2ac2b7d7ebad /src/ephy-main.c
parent8dc95a5c584d8fdb99afec102702bd8801b95266 (diff)
downloadgsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.tar
gsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.tar.gz
gsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.tar.bz2
gsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.tar.lz
gsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.tar.xz
gsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.tar.zst
gsoc2013-epiphany-fdb9695a63e0d25e9adffeb485962ee62e67f310.zip
If we can't detect the mime type, fall back to checking the file
2006-03-02 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-bookmarks-import.c: (ephy_bookmarks_import): If we can't detect the mime type, fall back to checking the file extension. Bug #331468. * src/ephy-main.c: (main): Don't pass NULL to realpath if PATH_MAX is defined. Bug #333051.
Diffstat (limited to 'src/ephy-main.c')
-rw-r--r--src/ephy-main.c70
1 files changed, 67 insertions, 3 deletions
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 9b97e1416..51a422f8b 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -449,7 +449,64 @@ main (int argc,
/* check libxml2 API version epiphany was compiled with against the
* version we're running with.
*/
- LIBXML_TEST_VERSION
+ LIBXML_TEST_VERSION;
+
+ /* If we're given -remote arguments, translate them */
+ if (argc >= 2 &&
+ strcmp (argv[1], "-remote") == 0)
+ {
+ const char *opening, *closing;
+ char *command, *argument;
+ char **arguments;
+
+ if (argc != 3)
+ {
+ g_print ("-remote allows exactly one argument\n");
+ exit (1);
+ }
+
+ opening = strchr (argv[2], '(');
+ closing = strchr (argv[2], ')');
+
+ if (opening == NULL ||
+ closing == NULL ||
+ opening == argv[2] ||
+ opening + 1 >= closing)
+ {
+ g_print ("Invalid argument for -remote\n");
+ exit (1);
+ }
+
+ command = g_strstrip (g_strndup (argv[2], opening - argv[2]));
+
+ /* See http://lxr.mozilla.org/seamonkey/source/xpfe/components/xremote/src/XRemoteService.cpp
+ * for the commands that mozilla supports; we'll just support openURL here.
+ */
+ if (g_ascii_strcasecmp (command, "openURL") != 0)
+ {
+ g_print ("-remote command \"%s\" not supported\n", command);
+ g_free (command);
+ exit (1);
+ }
+
+ g_free (command);
+
+ argument = g_strstrip (g_strndup (opening + 1, closing - opening - 1));
+ arguments = g_strsplit (argument, ",", -1);
+ g_free (argument);
+ if (arguments == NULL)
+ {
+ g_print ("Invalid argument for -remote\n");
+
+ exit (1);
+ }
+
+ /* replace arguments */
+ argv[1] = g_strstrip (g_strdup (arguments[0]));
+ argc = 2;
+
+ g_strfreev (arguments);
+ }
/* Initialise our debug helpers */
ephy_debug_init ();
@@ -569,14 +626,21 @@ main (int argc,
for (i = 0; arguments[i] != NULL; ++i)
{
- char *uri, *path = NULL;
+ char *uri, *path;
+#ifdef PATH_MAX
+ char rpath[PATH_MAX];
+#else
+ char *rpath = NULL;
+#endif
- path = realpath (arguments[i], NULL);
+ path = realpath (arguments[i], rpath);
if (path != NULL)
{
uri = g_locale_to_utf8 (path, -1,
NULL, NULL, &error);
+#ifndef PATH_MAX
free (path);
+#endif
}
else
{