Re: [dwm] broken pipes

From: Manuel Badzong <lists_AT_badzong.com>
Date: Sun, 26 Nov 2006 15:19:58 +0100

Hi Anslem

Anselm R. Garbe wrote:
> Hi guys,
>
> I applied a mixture of Jukka's and Manuel's patch to hg tip.
>
I tried several inputs (empty lines, lines with multiple '\n', all '\n'
lines). The following patch would handle all of them correctly. Though
I 'm not sure if this is really necessary (but it remains one line of
code).

Manuel

--- readline_dwm-2.3/main.c 2006-11-26 15:10:13.000000000 +0100
+++ my_dwm-2.3/main.c 2006-11-26 15:09:43.000000000 +0100
@@ -284,8 +284,8 @@
                                         readin = False;
                                         break;
                                 default:
- stext[r-(stext[r-1]=='\n'?1:0)] = '\0';
- for(p=stext+strlen(stext)-1;p>stext && *p!='\n';--p);
+ for(stext[r]='\0', p=stext+strlen(stext)-1;p>=stext && *p=='\n' ;*p--='\0');
+ for(p=stext+strlen(stext)-1;p>=stext && *p!='\n' ;--p);
                                         if(p>stext)
                                                 strncpy(stext, p+1, sizeof(stext));
                         }
Received on Sun Nov 26 2006 - 15:19:56 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:32:46 UTC