write-message buffer adjust to full width of the terminal.

This commit is contained in:
Renaud 2015-09-18 17:55:35 +08:00
parent e0550db4d1
commit 2c9cbbfb1e
1 changed files with 14 additions and 7 deletions

21
eval.c
View File

@ -1428,16 +1428,23 @@ int clrmes( int f, int n) {
* int f, n; arguments ignored
*/
int writemsg( int f, int n) {
int status;
char buf[ NSTRING] ; /* buffer to recieve message into */
int status ;
int size ;
char *buf ; /* buffer to receive message into */
status = mlreply( "Message to write: ", buf, sizeof buf - 1) ;
if( status != TRUE)
return status ;
size = term.t_ncol + 1 ;
buf = malloc( size) ;
if( buf == NULL)
return FALSE ;
status = mlreply( "Message to write: ", buf, size) ;
if( status == TRUE)
/* write the message out */
mlforce( buf) ;
return TRUE ;
mlforce( buf) ;
free( buf) ;
return status ;
}
/* end of eval.c */