Package: console-tools
Version: 1:0.2.3dbs-64
Severity: wishlist
Tags: patch

When using both options -w and -s with openvt, after command is executed,
the screen switches back to the previous terminal. This isn't always a
wanted behaviour, the wait option is useful with scripts, the switch
option is useful to switch to the new terminal, there is no need to
switch back when these options are used together, so I added the -b
option (switch `b'ack) to force this behaviour when the user wants it,
not when -w and -s options are used. The man page has been also updated.
Working patch for the debian package is attached.

Cheers,
Daniele

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12.3
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages console-tools depends on:
ii  debconf [debconf-2.0]      1.5.2         Debian configuration management sy
ii  libc6                      2.3.6-15      GNU C Library: Shared libraries
ii  libconsole                 1:0.2.3dbs-64 Shared libraries for Linux console
ii  sysvinit                   2.86.ds1-14.1 System-V-like init utilities

Versions of packages console-tools recommends:
ii  console-common                0.7.59     Basic infrastructure for text cons
ii  console-data                  20060609   Keymaps, fonts, charset maps, fall

-- no debconf information
diff -ruN console-tools-0.2.3-old/doc/man/openvt.1 
console-tools-0.2.3/doc/man/openvt.1
--- console-tools-0.2.3-old/doc/man/openvt.1    2006-07-23 15:01:52.000000000 
+0200
+++ console-tools-0.2.3/doc/man/openvt.1        2006-07-23 15:13:33.000000000 
+0200
@@ -28,6 +28,9 @@
 Switch to the new VT when starting the command. The VT of the new command
 will be made the new current VT.
 .TP
+.I "\-b"
+Switch back to the controlling terminal when the command completes.
+.TP
 .I "\-u"
 Figure out the owner of the current VT, and run login as that user.
 Suitable to be called by init. Shouldn't be used with -c or -l.
@@ -40,9 +43,7 @@
 Be a bit more verbose.
 .TP
 .I "\-w"
-wait for command to complete. If \-w and \-s are used together then
-.B openvt
-will switch back to the controlling terminal when the command completes.
+Wait for command to complete.
 .TP
 .I "\-\-" 
 end of options to
diff -ruN console-tools-0.2.3-old/vttools/openvt.c 
console-tools-0.2.3/vttools/openvt.c
--- console-tools-0.2.3-old/vttools/openvt.c    2006-07-23 15:01:52.000000000 
+0200
+++ console-tools-0.2.3/vttools/openvt.c        2006-07-23 15:10:12.000000000 
+0200
@@ -92,6 +92,7 @@
   int fd       = -1;
   char optc    = FALSE;
   char show    = FALSE;
+  char back    = FALSE;
   char login   = FALSE;
   char force   = FALSE;
   char verbose = FALSE;
@@ -109,7 +110,7 @@
    * as soon as a non-option argument is encountered.  That way the
    * child options are left intact.
    */
-  while ((opt = getopt(argc, argv, "+c:lsvfuw")) != -1)
+  while ((opt = getopt(argc, argv, "+c:lsbvfuw")) != -1)
     {
       switch (opt)
        {
@@ -130,6 +131,9 @@
        case 's':
          show = TRUE;
          break;
+       case 'b':
+         back = TRUE;
+         break;
        case 'v':
          verbose = TRUE;
          break;
@@ -355,7 +359,7 @@
   if ( do_wait )
     {
       wait(NULL);
-      if (show)        /* Switch back... */
+      if (back)        /* Switch back... */
        {
          (void) ioctl(fd, VT_ACTIVATE, vtstat.v_active);
          /* wait to be really sure we have switched */

Reply via email to