Re: [PATCH] login-utils: remove unwanted newlines from wall

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

 



 Hi Matthias,

On Fri, Jul 13, 2007 at 04:04:05PM +0200, Matthias Koenig wrote:
> login-utils: remove unwanted newlines from wall

 Good catch, but..

> diff --git a/login-utils/wall.c b/login-utils/wall.c
> index 2797f46..b5455c1 100644
> --- a/login-utils/wall.c
> +++ b/login-utils/wall.c
> @@ -217,8 +217,6 @@ makemsg(fname)
>  			if (cnt == 79 || ch == '\n') {
>  				for (; cnt < 79; ++cnt)
>  					putc(' ', fp);
> -				putc('\r', fp);
> -				putc('\n', fp);
>  				cnt = 0;
>  			}
>  			carefulputc(ch, fp);

 .. the old version is always using \r\n\n, with your change is there
 \n only. We need \r\n. I think the right bugfix is:


diff --git a/login-utils/wall.c b/login-utils/wall.c
index 2797f46..c9893d7 100644
--- a/login-utils/wall.c
+++ b/login-utils/wall.c
@@ -221,7 +221,8 @@ makemsg(fname)
 				putc('\n', fp);
 				cnt = 0;
 			}
-			carefulputc(ch, fp);
+			if (ch != '\n')
+				carefulputc(ch, fp);
 		}
 	}
 	fprintf(fp, "%79s\r\n", " ");


 I've applied this version.


 BTW, see makemsg() and hardcoded number of terminal columns (79) ;-(

     Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux