Author: ed
Date: Wed Nov 11 08:39:57 2009
New Revision: 199174
URL: http://svn.freebsd.org/changeset/base/199174

Log:
  Add a new flag to vidcontrol, -T, that allows terminal mode switching.
  
  This will make it more easy for people to experiment with TERM=xterm.
  Instead of echoing these strange escape sequences, I can just instruct
  them to run `vidcontrol -T xterm'.

Modified:
  head/usr.sbin/vidcontrol/vidcontrol.1
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/vidcontrol/vidcontrol.1
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.1       Wed Nov 11 08:28:18 2009        
(r199173)
+++ head/usr.sbin/vidcontrol/vidcontrol.1       Wed Nov 11 08:39:57 2009        
(r199174)
@@ -38,6 +38,7 @@
 .Op Fl r Ar foreground Ar background
 .Op Fl S Cm on | off
 .Op Fl s Ar number
+.Op Fl T Cm xterm | cons25
 .Op Fl t Ar N | Cm off
 .Op Ar mode
 .Op Ar foreground Op Ar background
@@ -243,6 +244,8 @@ is supposed to be physically secure.
 .It Fl s Ar number
 Set the current vty to
 .Ar number .
+.It Fl T Cm xterm | cons25
+Switch between xterm and cons25 style terminal emulation.
 .It Fl t Ar N | Cm off
 Set the screensaver timeout to
 .Ar N

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.c       Wed Nov 11 08:28:18 2009        
(r199173)
+++ head/usr.sbin/vidcontrol/vidcontrol.c       Wed Nov 11 08:39:57 2009        
(r199174)
@@ -185,8 +185,8 @@ usage(void)
 "usage: vidcontrol [-CdHLPpx] [-b color] [-c appearance] [-f [size] file]",
 "                  [-g geometry] [-h size] [-i adapter | mode] [-l 
screen_map]",
 "                  [-M char] [-m on | off] [-r foreground background]",
-"                  [-S on | off] [-s number] [-t N | off] [mode]",
-"                  [foreground [background]] [show]");
+"                  [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]",
+"                  [mode] [foreground [background]] [show]");
        exit(1);
 }
 
@@ -1159,6 +1159,18 @@ clear_history(void)
        }
 }
 
+static void
+set_terminal_mode(char *arg)
+{
+
+       if (strcmp(arg, "xterm") == 0)
+               fprintf(stderr, "\033[=T");
+       else if (strcmp(arg, "cons25") == 0)
+               fprintf(stderr, "\033[=1T");
+       else
+               usage();
+}
+
 
 int
 main(int argc, char **argv)
@@ -1175,7 +1187,8 @@ main(int argc, char **argv)
                err(1, "must be on a virtual console");
        dumpmod = 0;
        dumpopt = DUMP_FBF;
-       while((opt = getopt(argc, argv, "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:t:x")) 
!= -1)
+       while ((opt = getopt(argc, argv,
+           "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x")) != -1)
                switch(opt) {
                case 'b':
                        set_border_color(optarg);
@@ -1244,6 +1257,9 @@ main(int argc, char **argv)
                case 's':
                        set_console(optarg);
                        break;
+               case 'T':
+                       set_terminal_mode(optarg);
+                       break;
                case 't':
                        set_screensaver_timeout(optarg);
                        break;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to