home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CODE4-1.ZIP / SOURCE.ZIP / N4MESSAG.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-14  |  1.6 KB  |  66 lines

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