]> git.armaanb.net Git - chorizo.git/commitdiff
The FIFO filename can have a suffix
authorPeter Hofmann <scm@uninformativ.de>
Thu, 19 Jun 2014 07:49:20 +0000 (09:49 +0200)
committerPeter Hofmann <scm@uninformativ.de>
Thu, 19 Jun 2014 07:49:20 +0000 (09:49 +0200)
This allows for launching lariza like this:

$ LARIZA_FIFO_SUFFIX=1 lariza file:///home/void/bookmarks.xhtml

And another instance like this:

$ LARIZA_FIFO_SUFFIX=2 lariza http://www.startpage.com

browser.c

index fe66eb46e75d452dcec60bec04b6adb31f6ce7d6..1ce72c2047645f0c771cdcb5e8a10066d0646fb1 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -325,9 +325,17 @@ void
 cooperation_setup(void)
 {
        GIOChannel *towatch;
+       const gchar *e;
+       gchar *fifofilename;
        gchar *fifopath;
 
-       fifopath = g_build_filename(g_get_user_runtime_dir(), __NAME__".fifo", NULL);
+       e = g_getenv(__NAME_UPPERCASE__"_FIFO_SUFFIX");
+       if (e != NULL)
+               fifofilename = g_strdup_printf("%s-%s", __NAME__".fifo", e);
+       else
+               fifofilename = g_strdup(__NAME__".fifo");
+       fifopath = g_build_filename(g_get_user_runtime_dir(), fifofilename, NULL);
+       g_free(fifofilename);
 
        if (!g_file_test(fifopath, G_FILE_TEST_EXISTS))
                mkfifo(fifopath, 0600);