qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs shell.c tty.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs shell.c tty.c
Date: Wed, 09 Apr 2008 16:51:30 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        08/04/09 16:51:30

Modified files:
        .              : shell.c tty.c 

Log message:
        fixed shell mode: use ptsname instead of ptsname_r
        disabled 16 color modes in cygwin, some issues remain if shell is 
started

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.41&r2=1.42

Patches:
Index: shell.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/shell.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- shell.c     8 Apr 2008 19:57:33 -0000       1.51
+++ shell.c     9 Apr 2008 16:51:30 -0000       1.52
@@ -96,8 +96,18 @@
 
     /* First try Unix98 pseudo tty master */
     if ((fd = open("/dev/ptmx", O_RDWR)) >= 0) {
+#ifdef CONFIG_CYGWIN
+        const char *name = ptsname(fd);
+
+        if (name) {
+            pstrcpy(tty_str, size, name);
+            if (!grantpt(fd) && !unlockpt(fd))
+                return fd;
+        }
+#else
         if (!ptsname_r(fd, tty_str, size) && !grantpt(fd) && !unlockpt(fd))
             return fd;
+#endif
         close(fd);
     }
     /* then try BSD pseudo tty pre-created pairs */

Index: tty.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/tty.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- tty.c       9 Apr 2008 16:27:15 -0000       1.41
+++ tty.c       9 Apr 2008 16:51:30 -0000       1.42
@@ -505,7 +505,6 @@
     }
 }
 
-#if 0
 unsigned int const tty_full_colors[8] = {
     QERGB(0x00, 0x00, 0x00),
     QERGB(0xff, 0x00, 0x00),
@@ -516,7 +515,6 @@
     QERGB(0x00, 0xff, 0xff),
     QERGB(0xff, 0xff, 0xff),
 };
-#endif
 
 unsigned int const tty_putty_colors[256] = {
     QERGB(0x00, 0x00, 0x00),
@@ -788,9 +786,16 @@
 #endif
 };
 
+#ifdef CONFIG_CYGWIN
+int tty_use_bold_as_bright = 1;
+unsigned int const *tty_bg_colors = tty_full_colors;
+int tty_bg_colors_count = 8;
+#else
+int tty_use_bold_as_bright = 0;
 unsigned int const *tty_bg_colors = tty_putty_colors;
-unsigned int const *tty_fg_colors = tty_putty_colors;
 int tty_bg_colors_count = 16;
+#endif
+unsigned int const *tty_fg_colors = tty_putty_colors;
 int tty_fg_colors_count = 16;
 
 static inline int color_dist(unsigned int c1, unsigned c2)
@@ -1101,13 +1106,13 @@
                         /* should use array of strings */
                         bgcolor = TTYCHAR_GETBG(cc);
                         TTY_FPRINTF(s->STDOUT, "\033[%dm",
-                                    bgcolor >= 8 ? 100 + bgcolor - 8 :
+                                    bgcolor > 7 ? 100 + bgcolor - 8 :
                                     40 + bgcolor);
                     }
                     if (fgcolor != (int)TTYCHAR_GETFG(cc) && ch != ' ') {
                         fgcolor = TTYCHAR_GETFG(cc);
                         /* should use array of strings */
-                        if (0) {
+                        if (tty_use_bold_as_bright) {
                             /* use bold for high color */
                             TTY_FPRINTF(s->STDOUT, "\033[%dm",
                                         (fgcolor > 7) ? 1 : 22);
@@ -1115,7 +1120,7 @@
                                         30 + (fgcolor & 7));
                         } else {
                             TTY_FPRINTF(s->STDOUT, "\033[%dm",
-                                        fgcolor >= 8 ? 90 + fgcolor - 8 :
+                                        fgcolor > 8 ? 90 + fgcolor - 8 :
                                         30 + fgcolor);
                         }
                     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]