zeur here.

[sent this about a week ago, but it never seems to have arrived...
 re-trying.]

In case anyone's still interested, here's the X patch.

Disclaimer: I'm unfamiliar with either syscons or pcvt, but those cases
seemed to contain OpenBSD-related code so I patched them, too. Apologies
if I shouldn't have touched them.

This patch is messy. So is X. A perfect match...

        --zeurkous.

Index: xenocara/xserver/hw/xfree86/os-support/bsd/bsd_init.c
===================================================================
RCS file: /cvs/xenocara/xserver/hw/xfree86/os-support/bsd/bsd_init.c,v
retrieving revision 1.21
diff -u -p -r1.21 bsd_init.c
--- xenocara/xserver/hw/xfree86/os-support/bsd/bsd_init.c       8 Dec 2017 
15:02:01 -0000       1.21
+++ xenocara/xserver/hw/xfree86/os-support/bsd/bsd_init.c       29 Dec 2018 
06:08:05 -0000
@@ -461,7 +461,7 @@ xf86OpenSyscons(void)
 #ifndef __OpenBSD__
             snprintf(vtname, sizeof(vtname), "/dev/ttyv%01x", xf86Info.vtno - 
1);
 #else
-            sprintf(vtname, sizeof(vtname), "/dev/ttyC%01x", xf86Info.vtno - 
1);
+            sprintf(vtname, sizeof(vtname), "/dev/ttyC%i", xf86Info.vtno - 1);
 #endif
             if ((fd = open(vtname, SYSCONS_CONSOLE_MODE, 0)) < 0) {
                 FatalError("xf86OpenSyscons: Cannot open %s (%s)",
@@ -511,7 +511,7 @@ xf86OpenPcvt(void)
 #endif
 
     if (VTnum != -1) {
-            snprintf(vtname, sizeof(vtname), "%s%x", vtprefix, VTnum - 1);
+            snprintf(vtname, sizeof(vtname), "%s%i", vtprefix, VTnum - 1);
             fd  = open(vtname, PCVT_CONSOLE_MODE, 0);
     }
     else {
@@ -558,12 +558,12 @@ xf86OpenPcvt(void)
             }
 
             close(fd);
-            snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, xf86Info.vtno 
- 1);
+            snprintf(vtname, sizeof(vtname), "%s%i", vtprefix, xf86Info.vtno - 
1);
             if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
                 ErrorF("xf86OpenPcvt: Cannot open %s (%s)",
                        vtname, strerror(errno));
                 xf86Info.vtno = initialVT;
-                snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, 
xf86Info.vtno - 1);
+                snprintf(vtname, sizeof(vtname), "%s%i", vtprefix, 
xf86Info.vtno - 1);
                 if ((fd = open(vtname, PCVT_CONSOLE_MODE, 0)) < 0) {
                     FatalError("xf86OpenPcvt: Cannot open %s (%s)",
                                 vtname, strerror(errno));
@@ -633,7 +633,7 @@ xf86OpenWScons(void)
        }
     }
     if (VTnum != -1) {
-        snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix, VTnum - 1);
+        snprintf(vtname, sizeof(vtname), "%s%i", vtprefix, VTnum - 1);
         xf86Info.vtno = VTnum;
     } else {
         snprintf(vtname, sizeof(vtname), "%s0", vtprefix);
@@ -670,7 +670,7 @@ xf86OpenWScons(void)
             }
             /* re-open the new VT */
             close(fd);
-            snprintf(vtname, sizeof(vtname), "%s%01x", vtprefix,
+            snprintf(vtname, sizeof(vtname), "%s%i", vtprefix,
                      xf86Info.vtno - 1);
             if ((fd = open(vtname, O_RDWR)) < 0)
                 FatalError("xf86OpenWScons: cannot open %s (%s)",
@@ -756,7 +756,7 @@ xf86ProcessArgument(int argc, char *argv
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
         || defined(WSCONS_SUPPORT)
     if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
-        if (sscanf(argv[i], "vt%2d", &VTnum) == 0 || VTnum < 1 || VTnum > 12) {
+        if (sscanf(argv[i], "vt%3d", &VTnum) == 0 || (++VTnum) < 1 || VTnum > 
255) {
             UseMsg();
             VTnum = -1;
             return 0;
@@ -772,7 +772,7 @@ xf86UseMsg(void)
 {
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT) \
     || defined(WSCONS_SUPPORT)
-    ErrorF("vtXX                   use the specified VT number (1-12)\n");
+    ErrorF("vtXXX                  use the specified VT number (0..254)\n");
 #endif                          /* SYSCONS_SUPPORT || PCVT_SUPPORT */
     ErrorF("-keeptty               ");
     ErrorF("don't detach controlling tty (for debugging only)\n");

Reply via email to