repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 51b6557c4f72b163631bb125c76037cede63b308:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 51b6557c4f72b163631bb125c76037cede63b308
Author: Emanuele Giaquinta 
Date:   Mon Oct 6 11:14:49 2014 +0000

    Add -k option to urxvtc for killing the daemon process.

diff --git a/doc/rxvtc.1.pod b/doc/rxvtc.1.pod
index d97f2f2517cf265692c0b1a5acb3bdda6c0e8dd0..
index ..3712dd4376f0a8faaaaabad7c271360286c3d3b3 100644
--- a/doc/rxvtc.1.pod
+++ b/doc/rxvtc.1.pod
@@ -16,6 +16,9 @@ contacting the daemon.

 =head1 OPTIONS

+If the first option is B<-k>, B<@@RXVT_NAME@@c> tries to kill the
+daemon process and returns.
+
 All options that are valid for B<@@RXVT_NAME@@> are valid for
 B<@@RXVT_NAME@@c>, too. Please note that options are interpreted in the
 context of the daemon process. However, as current working directory,
diff --git a/src/rxvtc.C b/src/rxvtc.C
index ee2a059575d4d56cf7706c066cb3601e3698e3c0..
index ..71fa330b359c4b7e5f8e42784797808a727d93f6 100644
--- a/src/rxvtc.C
+++ b/src/rxvtc.C
@@ -95,6 +95,12 @@ main (int argc, const char *const *argv)
     sigprocmask (SIG_BLOCK, &ss, 0);
   }

+  if (argc >= 2 && !strcmp (argv[1], "-k"))
+    {
+      c.send ("QUIT");
+      return 0;
+    }
+
   c.send ("NEW");

   for (char **var = environ; *var; var++)
diff --git a/src/rxvtd.C b/src/rxvtd.C
index 8e2eae1d3409d22718461cfca085b3d5fcd4329b..
index ..50261c62bdde8b502ed0667cbcb9eabda23d2538 100644
--- a/src/rxvtd.C
+++ b/src/rxvtd.C
@@ -215,6 +215,8 @@ void server::read_cb (ev::io &w, int revents)
             send ("END"); send (success ? 1 : 0);
           }
         }
+      else if (!strcmp (tok, "QUIT"))
+        _exit (0);
       else
         return err ("protocol error: request '%s' unsupported.\n", (char *)tok);
     }

-----END OF PAGE-----