repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 2faa5cf161ae1b074501737879c4d77e819f2668:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 2faa5cf161ae1b074501737879c4d77e819f2668
Author: Marc Lehmann 
Date:   Thu Jul 7 19:37:47 2005 +0000

    *** empty log message ***

diff --git a/Changes b/Changes
index dc3fba6d8a252b76163c04544b507eed6f62efed..
index ..e3d9baad7c7be9401dfef555ab389d0a5ac1d219 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,4 @@
+TODO: Make change? [y... flood freezes until outputter is being killed
 TODO: do font request caching, might help rxvtd on some machines
 TODO: safer command: keymap processing.
 TODO: "slow" rendering mode for bidi and scripts
@@ -11,6 +12,9 @@ WISH: OnTheSpot editing, or maybe switch to miiiiiiif
 WISH: tabbed windows (hey, just use screen...)
 WISH: just for fun, do shade and tint with XRender.

+	- implement some useful (hopefully) options for rxvtd.
+        - seperate and improved rxvtc(1) and rxvtd(1) manpages.
+
 5.6  Sun Jun 26 22:11:13 CEST 2005
         - R_SB_RXVT bitset value was 0, so rxvt scrollbar was initialised
           every time resulting in display errors (original rxvt also affected).
diff --git a/MANIFEST b/MANIFEST
index 7ba7b6a8772d371acb523bbd292bfc1b25dc6703..
index ..01dfe5a548a3c32b05c96c9bc052e1937c073972 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -32,13 +32,20 @@ doc/changes.txt
 doc/podtbl
 doc/rxvt.1.pod
 doc/rxvt.7.pod
+doc/rxvtc.1.pod
+doc/rxvtd.1.pod
 doc/rxvt.1.man.in
 doc/rxvt.7.man.in
+doc/rxvtc.1.man.in
+doc/rxvtd.1.man.in
 doc/rxvt.1.html
 doc/rxvt.7.html
+doc/rxvtc.1.html
+doc/rxvtd.1.html
 doc/rxvt.1.txt
 doc/rxvt.7.txt
-doc/rxvtc.1
+doc/rxvtc.1.txt
+doc/rxvtd.1.txt
 doc/rxvt-unicode.spec

 autoconf/.cvsignore
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 878f0878f77c3fe5d1a1461dedbb535958eaf9e5..
index ..47a748bf8942f917280f23d3759c7410a50c9752 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -42,14 +42,21 @@ SEDREPLACE = -e 's%@@RXVT_VERSION@@%$(VERSION)%g;'\

 tags allbin:

-alldoc:	rxvt.1.man.in rxvt.7.man.in rxvt.1.html rxvt.7.html rxvt.1.txt rxvt.7.txt ../README.configure ../README.FAQ
+alldoc:	rxvt.1.man.in rxvt.7.man.in rxvtc.1.man.in rxvtd.1.man.in \
+	rxvt.1.txt    rxvt.7.txt    rxvtc.1.txt    rxvtd.1.txt \
+	rxvt.1.html   rxvt.7.html   rxvtc.1.html   rxvtd.1.html \
+	../README.configure ../README.FAQ
 	infocmp -C rxvt-unicode >etc/rxvt-unicode.termcap

 clean:
 	$(RMF) *~

 realclean: clean
-	$(RMF) tags rxvt.1.man.in rxvt.7.man.in rxvt.1.html rxvt.7.html rxvt.1.txt rxvt.7.txt  ../README.configure ../README.FAQ
+	$(RMF) tags ../README.configure ../README.FAQ
+	$(RMF) rxvt.1.man.in rxvt.7.man.in rxvtc.1.man.in rxvtd.1.man.in
+	$(RMF) rxvt.1.man    rxvt.7.man    rxvtc.1.man    rxvtd.1.man   
+	$(RMF) rxvt.1.txt    rxvt.7.txt    rxvtc.1.txt    rxvtd.1.txt
+	$(RMF) rxvt.1.html   rxvt.7.html   rxvtc.1.html   rxvtd.1.html

 cleandir: realclean

@@ -62,8 +69,10 @@ install:
 	$(INSTALL_DATA) rxvt.1.man $(DESTDIR)$(man1dir)/$(RXVTNAME).$(man1ext)
 	$(SED) $(SEDREPLACE) < rxvt.7.man.in >rxvt.7.man
 	$(INSTALL_DATA) rxvt.7.man $(DESTDIR)$(man7dir)/$(RXVTNAME).$(man7ext)
-	$(INSTALL_DATA) rxvtc.1 $(DESTDIR)$(man1dir)/$(RXVTNAME)c.$(man1ext)
-	$(INSTALL_DATA) rxvtc.1 $(DESTDIR)$(man1dir)/$(RXVTNAME)d.$(man1ext)
+	$(SED) $(SEDREPLACE) < rxvtc.1.man.in >rxvtc.1.man
+	$(INSTALL_DATA) rxvtc.1.man $(DESTDIR)$(man1dir)/$(RXVTNAME)c.$(man1ext)
+	$(SED) $(SEDREPLACE) < rxvtd.1.man.in >rxvtd.1.man
+	$(INSTALL_DATA) rxvtd.1.man $(DESTDIR)$(man1dir)/$(RXVTNAME)d.$(man1ext)
 	if test -x "@TIC@"; then if test -n "@TIC@"; then @TIC@ etc/rxvt-unicode.terminfo; fi; fi

 uninstall:
diff --git a/doc/rxvt-tabbed b/doc/rxvt-tabbed
index dabd965b1a5da5fa9280ee4fd983d5eee2028fd4..
index ..3b67baa7e80f611776688925d683e0963792208e 100755
--- a/doc/rxvt-tabbed
+++ b/doc/rxvt-tabbed
@@ -1,6 +1,6 @@
 #!/usr/bin/perl

-# I tried to write this with Tk, as it uses elss memory and is
+# I tried to write this with Tk, as it uses less memory and is
 # more widely available. Alas, Tk is rather broken with respect to embedding.

 # on debian, do:
diff --git a/doc/rxvt.1.html b/doc/rxvt.1.html
index a38c4c446922e1dde35143fa17db7afe58128b12..
index ..7fae9443bdb415ef37975c8038e7e096d1adbf00 100644
--- a/doc/rxvt.1.html
+++ b/doc/rxvt.1.html
@@ -49,7 +49,7 @@
 


DESCRIPTION

-

rxvt-unicode, version 5.5, is a colour vt102 terminal +

rxvt-unicode, version 5.6, is a colour vt102 terminal emulator intended as an xterm(1) replacement for users who do not require features such as Tektronix 4014 emulation and toolkit-style configurability. As a result, rxvt-unicode uses much less swap space -- @@ -950,6 +950,20 @@ Specify a command pipe for vt100 printer [default lpr(1)]. Use Print to initiate a screen dump to the printer and Ctrl-Print or Shift-Print to include the scrollback as well. +

+

The string will be interpreted as if typed into the shell as-is.

+
+
+

Example:

+
+
+
+   URxvt*print-pipe: cat > $(TMPDIR=$HOME mktemp urxvt.XXXXXX)
+
+
+

This creates a new file in your home directory with the screen contents +everytime you hit Print.

+

scrollBar: boolean
@@ -1583,7 +1597,7 @@ The unix domain socket path used by rxvtc(1) and rxvtd(1).
-

Default $HOME/.rxvt-unicode-<nodename.

+

Default $HOME/.rxvt-unicode-<nodename >>>.

HOME
@@ -1622,7 +1636,7 @@ Color names.


SEE ALSO

-

rxvt(7), xterm(1), sh(1), resize(1), X(1), pty(4), tty(4), utmp(5)

+

rxvt(7), rxvtc(1), rxvtd(1), xterm(1), sh(1), resize(1), X(1), pty(4), tty(4), utmp(5)


diff --git a/doc/rxvt.1.man.in b/doc/rxvt.1.man.in
index 73c62b2983eb8b686f5a4e296a116831e276b4d0..
index ..f91a39550ae9168d25732e98af3faa4cf553de80 100644
--- a/doc/rxvt.1.man.in
+++ b/doc/rxvt.1.man.in
@@ -129,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "rxvt 1"
-.TH rxvt 1 "2005-06-18" "5.5" "RXVT-UNICODE"
+.TH rxvt 1 "2005-07-07" "5.6" "RXVT-UNICODE"
 .SH "NAME"
 rxvt\-unicode (ouR XVT, unicode) \- (a VT102 emulator for the X window system)
 .SH "SYNOPSIS"
@@ -760,6 +760,17 @@ option \fB\-ut\fR. \fBFalse\fR: write record into the system log file \fButmp\fR
 Specify a command pipe for vt100 printer [default \fI\fIlpr\fI\|(1)\fR]. Use
 \&\fBPrint\fR to initiate a screen dump to the printer and \fBCtrl-Print\fR or
 \&\fBShift-Print\fR to include the scrollback as well.
+.Sp
+The string will be interpreted as if typed into the shell as\-is.
+.Sp
+Example:
+.Sp
+.Vb 1
+\&   URxvt*print-pipe: cat > $(TMPDIR=$HOME mktemp urxvt.XXXXXX)
+.Ve
+.Sp
+This creates a new file in your home directory with the screen contents
+everytime you hit \f(CW\*(C`Print\*(C'\fR.
 .IP "\fBscrollBar:\fR \fIboolean\fR" 4
 .IX Item "scrollBar: boolean"
 \&\fBTrue\fR: enable the scrollbar [default]; option \fB\-sb\fR. \fBFalse\fR:
@@ -1226,7 +1237,7 @@ Used in the same way as \f(CW\*(C`RXVTPATH\*(C'\fR.
 The unix domain socket path used by @@RXVT_NAME@@c(1) and
 @@RXVT_NAME@@d(1).
 .Sp
-Default \f(CW\*(C`$HOME/.rxvt\-unicode\-
index 63509ed21eb32aae0c7c262715c0dd1bc45eaf91..
index ..c44b0f49c9fabea6bbb2e9696e5c72cadca67ca8 100644
--- a/doc/rxvt.1.pod
+++ b/doc/rxvt.1.pod
@@ -1249,7 +1249,7 @@ Used in the same way as C.
 The unix domain socket path used by @@RXVT_NAME@@c(1) and
 @@RXVT_NAME@@d(1).

-Default C<< $HOME/.rxvt-unicode->.
+Default F<<< $HOME/.rxvt-unicode-I<< > >>>.

 =item B

@@ -1280,7 +1280,7 @@ Color names.

 =head1 SEE ALSO

-@@RXVT_NAME@@(7), xterm(1), sh(1), resize(1), X(1), pty(4), tty(4), utmp(5)
+@@RXVT_NAME@@(7), @@RXVT_NAME@@c(1), @@RXVT_NAME@@d(1), xterm(1), sh(1), resize(1), X(1), pty(4), tty(4), utmp(5)

 =head1 BUGS

diff --git a/doc/rxvt.1.txt b/doc/rxvt.1.txt
index 16e38a749ccf6e4fedf36137d8b2a1b8b623f096..
index ..86ab46b46870e659ffcecfd2176e2cb18a00f499 100644
--- a/doc/rxvt.1.txt
+++ b/doc/rxvt.1.txt
@@ -6,7 +6,7 @@ SYNOPSIS
     rxvt [options] [-e command [ args ]]

 DESCRIPTION
-    rxvt-unicode, version 5.5, is a colour vt102 terminal emulator intended
+    rxvt-unicode, version 5.6, is a colour vt102 terminal emulator intended
     as an *xterm*(1) replacement for users who do not require features such
     as Tektronix 4014 emulation and toolkit-style configurability. As a
     result, rxvt-unicode uses much less swap space -- a significant
@@ -614,6 +614,15 @@ RESOURCES (available also as long-options)
         Print to initiate a screen dump to the printer and Ctrl-Print or
         Shift-Print to include the scrollback as well.

+        The string will be interpreted as if typed into the shell as-is.
+
+        Example:
+
+           URxvt*print-pipe: cat > $(TMPDIR=$HOME mktemp urxvt.XXXXXX)
+
+        This creates a new file in your home directory with the screen
+        contents everytime you hit "Print".
+
     scrollBar: *boolean*
         True: enable the scrollbar [default]; option -sb. False: disable the
         scrollbar; option +sb.
@@ -1064,7 +1073,7 @@ ENVIRONMENT
     RXVT_SOCKET
         The unix domain socket path used by rxvtc(1) and rxvtd(1).

-        Default "$HOME/.rxvt-unicode- [same options as for @@RXVT_NAME@@]
+
+=head1 DESCRIPTION
+
+This manpage describes the B<@@RXVT_NAME@@c> client program. It connects
+to the B<@@RXVT_NAME@@d> daemon and requests a new terminal window. It
+takes the same arguments as the B<@@RXVT_NAME@@> program. The environment
+will also be respected. Currently, it always returns immediately after
+contacting the daemon.
+
+=head1 OPTIONS
+
+All options that are valid for B<@@RXVT_NAME@@> are valid for
+B<@@RXVT_NAME@@c>, too. Please note that all options are currently
+interpreted in the context of the daemon process, which makes a difference
+for options that specify a file descriptor (such as B<-pty-fd>).
+
+=head1 ENVIRONMENT
+
+All environment variables of the current process will be made available
+to the new instance, and will be interpreted as if B<@@RXVT_NAME@@> were
+started directly.
+
+=over 4
+
+=item B
+
+Both @@RXVT_NAME@@c and @@RXVT_NAME@@d use the environment variable
+F to create a listening socket and to contact
+the @@RXVT_NAME@@d, respectively. If the variable is missing,
+F<<< $HOME/.rxvt-unicode-I<<  >> >>> is used.
+
+=back
+
+=head1 SEE ALSO
+
+@@RXVT_NAME@@(7), @@RXVT_NAME@@d(1)
+
diff --git a/doc/rxvtd.1.pod b/doc/rxvtd.1.pod
new file mode 100644
index 0000000000000000000000000000000000000000..a66a0996e051b345a8b36c864a668a45a047a063
--- /dev/null
+++ b/doc/rxvtd.1.pod
@@ -0,0 +1,88 @@
+=head1 NAME
+
+@@RXVT_NAME@@d - @@RXVT_NAME@@ terminal daemon
+
+=head1 SYNOPSIS
+
+B<@@RXVT_NAME@@d> [-q|--quiet] [-o|--opendisplay] [-f|--fork]
+
+=head1 DESCRIPTION
+
+This manpage describes the @@RXVT_NAME@@d daemon, which is the same vt102
+terminal emulator as @@RXVT_NAME@@, but runs as a daemon that can open
+multiple terminal windows within the same process.
+
+You can run it from your X startup scripts, for example, although it is
+not dependent on a working DISPLAY and, in fact, can open windows on
+multiple X displays on the same time.
+
+Advantages of running a @@RXVT_NAME@@ daemon include faster creation time
+for terminal windows and a lot of saved memory.
+
+The disadvantage is a possible impact on stability - if the
+main program crashes, all processes in the terminal windows are
+terminated. For example, as there is no way to cleanly react to abnormal
+connection closes, C and server resets/restarts will kill the
+B<@@RXVT_NAME@@d> instance including all windows it has opened.
+
+=head1 OPTIONS
+
+B<@@RXVT_NAME@@d> currently understands a few options only. Bundling of
+options is not yet supported.
+
+=over 4
+
+=item B<-q>, B<--quiet>
+
+Normally, B<@@RXVT_NAME@@d> outputs the message C<< rxvt-unicode daemon
+listening on  >> after binding to its control socket. This option
+will suppress this message (errors and warnings will still be logged).
+
+=item B<-o>, B<--opendisplay>
+
+This forces B<@@RXVT_NAME@@d> to open a connection to the current
+C<$DISPLAY> and keep it open.
+
+This is useful if you want to bind an instance of B<@@RXVT_NAME@@d> to
+the lifetime of a specific display/server. If the server does a reset,
+B<@@RXVT_NAME@@d> will be killed automatically.
+
+=item B<-f>, B<--fork>
+
+This makes B<@@RXVT_NAME@@d> fork after it has bound itself to its control
+socket.
+
+=back
+
+=head1 EXAMPLES
+
+This is a useful invocation of B<@@RXVT_NAME@@d> in a F<.xsession>-style
+script:
+
+   B<@@RXVT_NAME@@d> -q -f -o
+
+This waits till the control socket is available, opens the current display
+and forks into the background. When you log-out, the server is reset and
+B<@@RXVT_NAME@@d> is killed.
+
+=head1 ENVIRONMENT
+
+=over 4
+
+=item B
+
+Both B<@@RXVT_NAME@@c> and B<@@RXVT_NAME@@d> use the environment variable
+F to create a listening socket and to contact
+the @@RXVT_NAME@@d, respectively. If the variable is missing,
+F<<< $HOME/.rxvt-unicode-I<<  >> >>> is used.
+
+=item B
+
+Only used when the C<--opendisplay> option is specified. Must contain a
+valid X display name.
+
+=over
+
+=head1 SEE ALSO
+
+@@RXVT_NAME@@(7), @@RXVT_NAME@@c(1)
diff --git a/src/init.C b/src/init.C
index 203551fcf2ffc22366b06895c49b3fec5ad35b41..
index ..51a7fb2a571edbcf94910af4114e3076276f9048 100644
--- a/src/init.C
+++ b/src/init.C
@@ -346,19 +346,7 @@ rxvt_term::init_resources (int argc, const char *const *argv)

   get_options (r_argc, r_argv);

-#ifdef LOCAL_X_IS_UNIX
-  if (rs[Rs_display_name][0] == ':')
-    {
-      val = rxvt_malloc (5 + strlen (rs[Rs_display_name]));
-      strcpy (val, "unix");
-      strcat (val, rs[Rs_display_name]);
-      display = displays.get (val);
-      free (val);
-    }
-#endif
-
-  if (!display
-      && ! (display = displays.get (rs[Rs_display_name])))
+  if (!(display = displays.get (rs[Rs_display_name])))
     rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);

   extract_resources ();
diff --git a/src/rxvtd.C b/src/rxvtd.C
index 6c56f4b2e3eaa2ede4e7bd58ebfc494c409d1a7e..
index ..7bd89af580cd69d45f6228ef0cdf9b9e1a0bafd3 100644
--- a/src/rxvtd.C
+++ b/src/rxvtd.C
@@ -211,19 +211,57 @@ void server::read_cb (io_watcher &w, short revents)
     return err ();
 }

+int opt_fork, opt_opendisplay, opt_quiet;
+
 int
 main (int argc, const char *const *argv)
 {
+  for (int i = 1; i < argc; i++)
+    {
+      if (!strcmp (argv [i], "-f") || !strcmp (argv [i], "--fork"))
+        opt_fork = 1;
+      else if (!strcmp (argv [i], "-o") || !strcmp (argv [i], "--opendisplay"))
+        opt_opendisplay = 1;
+      else if (!strcmp (argv [i], "-q") || !strcmp (argv [i], "--quiet"))
+        opt_quiet = 1;
+      else
+        {
+          rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]);
+          return EXIT_FAILURE;
+        }
+    }
+  
   rxvt_init ();

   chdir ("/");

+  if (opt_opendisplay)
+    displays.get (getenv ("DISPLAY")); // open display and never release it
+
   char *sockname = rxvt_connection::unix_sockname ();
   unix_listener l (sockname);
-  printf ("rxvt-unicode daemon listening on %s.\n", sockname);
-  fflush (stdout);
+
+  if (!opt_quiet)
+    {
+      printf ("rxvt-unicode daemon listening on %s.\n", sockname);
+      fflush (stdout);
+    }
+
   free (sockname);

+  if (opt_fork)
+    {
+      pid_t pid = fork ();
+
+      if (pid < 0)
+        {
+          rxvt_log ("unable to fork daemon, aborting.\n");
+          return EXIT_FAILURE;
+        }
+      else if (pid > 0)
+        _exit (EXIT_SUCCESS);
+    }
+
   io_manager::loop ();

   return EXIT_SUCCESS;
diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C
index d04b5060b79784c17aafa9a8babaf736a2185f5f..
index ..306149ccbbee48f036aba8e57d5cf3ef1212e719 100644
--- a/src/rxvttoolkit.C
+++ b/src/rxvttoolkit.C
@@ -145,7 +145,21 @@ rxvt_display::rxvt_display (const char *id)

 bool rxvt_display::init ()
 {
-  display = XOpenDisplay (id);
+#ifdef LOCAL_X_IS_UNIX
+  if (id[0] == ':')
+    {
+      val = rxvt_malloc (5 + strlen (id) + 1);
+      strcpy (val, "unix/");
+      strcat (val, id);
+      display = XOpenDisplay (val);
+      free (val);
+    }
+  else
+    display = 0;
+#endif
+
+  if (!display)
+    display = XOpenDisplay (id);

   if (!display)
     return false;

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