home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / SOURCE / N4MESSAG.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-19  |  1.5 KB  |  63 lines

  1. /* n4messag.c    (c)Copyright Sequiter Software Inc., 1987-1990.  All rights reserved. */
  2.  
  3. #include "w4.h"
  4. #include "p4misc.h"
  5.  
  6. #include <string.h>
  7.  
  8. static  void message_do( char *, int, int, int * ) ;
  9. extern  CB_WINDOW *v4window_ptr ;
  10.  
  11.  
  12. static int  v4menu_last_len = 0 ;
  13. int     v4menu_row=24, v4menu_col=0 ;
  14.  
  15. void  n4message_do( char *message_ptr )   
  16. {
  17.    message_do( message_ptr, v4menu_row, v4menu_col, &v4menu_last_len ) ;
  18. }
  19.  
  20.  
  21. static int  v4get_last_len = 0 ;
  22. int     v4get_row=24, v4get_col=0 ;
  23.  
  24. void  g4message_do( char *message_ptr )   
  25. {
  26.    message_do( message_ptr, v4get_row, v4get_col, &v4get_last_len ) ;
  27. }
  28.  
  29.  
  30. static void  message_do( char *message_ptr, int row, int col, int *last_len_ptr)
  31. {
  32.    char buf[81] ;
  33.    int  len ;
  34.  
  35.    if ( message_ptr == (char *) 0 )
  36.       len = 0 ;
  37.    else
  38.       len =  (int) strlen( message_ptr ) ;
  39.  
  40.    if ( len == 0  && *last_len_ptr == 0 )   return ;
  41.  
  42.    memset( buf, (int) ' ', sizeof(buf) ) ;
  43.    if ( len >= sizeof(buf) )  len =  sizeof(buf)-1 ;
  44.  
  45.    if ( message_ptr != (char *) 0 ) 
  46.       memcpy( buf, message_ptr, (size_t) len ) ;
  47.  
  48.    buf[80] = '\000' ;
  49.    if ( *last_len_ptr < len )  *last_len_ptr =  len ;
  50.  
  51.    #ifdef UNIX
  52.       attrset( v4window_ptr->menu_attribute ) ;
  53.       buf[*last_len_ptr] = '\000' ;
  54.       mvaddstr( row,col, buf ) ;
  55.       refresh() ;
  56.    #else
  57.       w4write_att( row,col, buf, *last_len_ptr, v4window_ptr->menu_attribute ) ;
  58.    #endif
  59.  
  60.    *last_len_ptr =  len ;
  61. }
  62.  
  63.