Enlightenment CVS committal

Author  : mej
Project : eterm
Module  : Eterm

Dir     : eterm/Eterm/src


Modified Files:
        term.c 


Log Message:
Mon Feb 24 19:34:56 2003                        Michael Jennings (mej)

This fixes the title answer bug reported on BUGTRAQ (and other lists)
by HD Moore <[EMAIL PROTECTED]>.  It does so by removing
all non-printable characters from the title upon setting it, and
blanking out all non-printable characters when fetching it to display
using the aforementioned escape sequence.

===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/term.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- term.c      19 Feb 2003 21:18:06 -0000      1.90
+++ term.c      25 Feb 2003 00:37:49 -0000      1.91
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: term.c,v 1.90 2003/02/19 21:18:06 mej Exp $";
+static const char cvs_ident[] = "$Id: term.c,v 1.91 2003/02/25 00:37:49 mej Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -1316,14 +1316,13 @@
 void
 process_window_mode(unsigned int nargs, int args[])
 {
-
     register unsigned int i;
     int x, y;
     Screen *scr;
     Window dummy_child;
     int dummy_x, dummy_y;
     unsigned int dummy_border, dummy_depth;
-    char buff[1024], *name;
+    char buff[1024], *name, *ptmp;
 
     if (!nargs)
         return;
@@ -1398,12 +1397,30 @@
               break;
           case 20:
               XGetIconName(Xdisplay, TermWin.parent, &name);
+              for (ptmp = name; *ptmp; ptmp++) {
+                  if (ptmp - name > 4096) {
+                      *ptmp = 0;
+                      break;
+                  }
+                  if (*ptmp < 32) {
+                      *ptmp = ' ';
+                  }
+              }
               snprintf(buff, sizeof(buff), "\033]L%s\033\\", name);
               tt_write((unsigned char *) buff, strlen(buff));
               XFree(name);
               break;
           case 21:
               XFetchName(Xdisplay, TermWin.parent, &name);
+              for (ptmp = name; *ptmp; ptmp++) {
+                  if (ptmp - name > 4096) {
+                      *ptmp = 0;
+                      break;
+                  }
+                  if (*ptmp < 32) {
+                      *ptmp = ' ';
+                  }
+              }
               snprintf(buff, sizeof(buff), "\033]l%s\033\\", name);
               tt_write((unsigned char *) buff, strlen(buff));
               XFree(name);
@@ -1721,12 +1738,21 @@
         str = APL_NAME "-" VERSION;
     }
     if (name == NULL || strcmp(name, str)) {
+        char *pname, *pstr;
+
         if (name != NULL) {
             FREE(name);
         }
-        D_X11(("Setting window title to \"%s\"\n", str));
-        XStoreName(Xdisplay, TermWin.parent, str);
-        name = STRDUP(str);
+        name = MALLOC(strlen(str));
+
+        for (pname = name, pstr = str; *pstr; pstr++) {
+            if (*pstr >= 32) {
+                *pname++ = *pstr;
+            }
+        }
+        *pname = 0;
+        D_X11(("Setting window title to \"%s\"\n", name));
+        XStoreName(Xdisplay, TermWin.parent, name);
     }
 }
 
@@ -1738,12 +1764,21 @@
     if (!str)
         str = APL_NAME "-" VERSION;
     if (name == NULL || strcmp(name, str)) {
+        char *pname, *pstr;
+
         if (name != NULL) {
             FREE(name);
         }
-        D_X11(("Setting window icon name to \"%s\"\n", str));
-        XSetIconName(Xdisplay, TermWin.parent, str);
-        name = STRDUP(str);
+        name = MALLOC(strlen(str));
+
+        for (pname = name, pstr = str; *pstr; pstr++) {
+            if (*pstr >= 32) {
+                *pname++ = *pstr;
+            }
+        }
+        *pname = 0;
+        D_X11(("Setting window icon name to \"%s\"\n", name));
+        XSetIconName(Xdisplay, TermWin.parent, name);
     }
 }
 




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to