~ubuntu-branches/ubuntu/gutsy/kbd/gutsy

« back to all changes in this revision

Viewing changes to debian/patches/fgconsole.diff

  • Committer: Package Import Robot
  • Author(s): Denis Barbier
  • Date: 2006-03-29 21:39:02 UTC
  • Revision ID: package-import@ubuntu.com-20060329213902-ootubdqgdvawvpr0
Tags: 1.12-14
* debian/patches/read_keymaps_fmt.diff: When -m flag is set, do not try to
  open a file descriptor on the console so that loadkeys -m can be used
  under X.  See #341956.

* debian/patches/read_keymaps_fmt.diff: Let add_number() return its
  argument if it corresponds to an unknown symbol, because Unicode symbols
  are not always defined (and may appear within Unicode private range,
  anyway).  See #312844.

* debian/patches/braille.diff: New patch, to add braille keysyms, introduced
  in Linux 2.6.17-rc1.  Closes: #360813  Thanks Samuel Thibault

* debian/patches/thai.diff: New patch, to add tis-620 charset for Thai.
  See #360592  Thanks Theppitak Karoonboon

* debian/README.Debian: Rewrite this documentation.
  Closes: #328783  Thanks David Liontooth

* debian/control: Change Maintainer field to pkg-kbd-dev@l.a.d.o, and
  add myself to Uploaders.

* debian/console-screen.kbd.sh: Check for locale variables in both files
  /etc/environment and /etc/default/locale.

* Move openvt and chvt into /bin.  Closes: #320571  Thanks Tim Connors

* Apply changes from console-tools:
  + debian/console-screen.kbd.sh:
    - Include LSB-formatted Init dependency info
    - Remove all exit statements from /etc/init.d/console-screen.kbd.sh.
    - Ensure the correct font, unicode_mode are set for all VTs.
    - Make vcstime work under udev.
    - Read /etc/kbd/config.d for the benefit of fonty, etc. integration.
    - Go into unicode mode if locale is in UTF-8.
    - Added support for LED setting and key remapping.
  + debian/patches/fgconsole.diff: New patch, to add "--next-available"
    option to fgconsole to discover the next unallocated VT.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: trunk/src/fgconsole.c
 
2
===================================================================
 
3
--- trunk.orig/src/fgconsole.c
 
4
+++ trunk/src/fgconsole.c
 
5
@@ -4,24 +4,81 @@
 
6
 #include <stdio.h>
 
7
 #include <stdlib.h>
 
8
 #include <sys/ioctl.h>
 
9
+#include <getopt.h>
 
10
 #include <linux/vt.h>
 
11
+#include <linux/serial.h>
 
12
 #include "getfd.h"
 
13
 #include "nls.h"
 
14
+#include "version.h"
 
15
+
 
16
+static void usage(void)
 
17
+{
 
18
+       fprintf(stderr, _("%s version %s\n"
 
19
+"\n"
 
20
+"Usage: %s [options]\n"
 
21
+"\n"
 
22
+"Valid options are:\n"
 
23
+"\n"
 
24
+"      -h --help            display this help text\n"
 
25
+"      -V --version         display this help text\n"
 
26
+"      -n --next-available  display next unallocated VT\n"),
 
27
+                       progname, VERSION, progname);
 
28
+       exit(1);
 
29
+}
 
30
 
 
31
 int
 
32
 main(int argc, char **argv){
 
33
-       int fd;
 
34
        struct vt_stat vtstat;
 
35
+       int fd, vtno = -1, c, show_vt = 0;
 
36
+       struct serial_struct sr;
 
37
+       const struct option long_opts[] = {
 
38
+          { "help", no_argument, NULL, 'h' },
 
39
+          { "version", no_argument, NULL, 'V' },
 
40
+          { "next-available", no_argument, NULL, 'n' },
 
41
+          { NULL, 0, NULL, 0 } };
 
42
 
 
43
        setlocale(LC_ALL, "");
 
44
        bindtextdomain(PACKAGE, LOCALEDIR);
 
45
        textdomain(PACKAGE);
 
46
 
 
47
+       set_progname(argv[0]);
 
48
+       while (( c = getopt_long (argc, argv, "Vhn", long_opts, NULL)) != EOF) {
 
49
+         switch (c) {
 
50
+         case 'h':
 
51
+           usage();
 
52
+           exit (0);
 
53
+         case 'n':
 
54
+           show_vt = 1;
 
55
+           break;
 
56
+         case 'V':
 
57
+           print_version_and_exit();
 
58
+           break;
 
59
+         case '?':
 
60
+           usage();
 
61
+           exit(1);
 
62
+         }
 
63
+       }
 
64
+       
 
65
        fd = getfd(NULL);
 
66
-       if (ioctl(fd, VT_GETSTATE, &vtstat)) {
 
67
-               perror("fgconsole: VT_GETSTATE");
 
68
-               exit(1);
 
69
+       if (show_vt) {
 
70
+         if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) || vtno == -1) {
 
71
+            perror (_("Couldn't read VTNO: "));
 
72
+            exit(2);
 
73
+         }
 
74
+         printf ("%d\n", vtno);
 
75
+         exit(0);
 
76
+       }
 
77
+       
 
78
+       if (ioctl(fd, TIOCGSERIAL, &sr) == 0) {
 
79
+         printf ("serial\n");
 
80
+         exit (0);
 
81
        }
 
82
+       
 
83
+       if (ioctl(fd, VT_GETSTATE, &vtstat)) 
 
84
+         {
 
85
+           perror("fgconsole: VT_GETSTATE");
 
86
+           exit(1);
 
87
+         }
 
88
        printf("%d\n", vtstat.v_active);
 
89
        return 0;
 
90
 }
 
91
Index: trunk/man/man1/fgconsole.1
 
92
===================================================================
 
93
--- trunk.orig/man/man1/fgconsole.1
 
94
+++ trunk/man/man1/fgconsole.1
 
95
@@ -5,13 +5,23 @@
 
96
 
 
97
 .SH SYNOPSIS
 
98
 .B fgconsole
 
99
-
 
100
+.BI [ "--help" | "--version" | "--next-available" ]
 
101
 .SH DESCRIPTION
 
102
 If the active Virtual Terminal is
 
103
 .IR /dev/ttyN ,
 
104
 then prints
 
105
 .I N
 
106
 on standard output.
 
107
+
 
108
+If the console is a serial console, then 
 
109
+"serial" 
 
110
+is printed instead.
 
111
+.TP
 
112
+.I \-\-next\-available
 
113
+Will show the next unallocated virtual terminal. Normally 6 virtual
 
114
+terminals are allocated, with number 7 used for X; this will return
 
115
+"8" in this case.
 
116
+
 
117
 .SH NOTES
 
118
 Under 
 
119
 .IR devfs ,