home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / ELM23-2 / ELM23-2.ZIP / src / out_utils.c < prev    next >
C/C++ Source or Header  |  1990-04-28  |  3KB  |  153 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: out_utils.c,v 4.1 90/04/28 22:43:40 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
  6.  *
  7.  *             Copyright (c) 1986, 1987 Dave Taylor
  8.  *             Copyright (c) 1988, 1989, 1990 USENET Community Trust
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log:    out_utils.c,v $
  17.  * Revision 4.1  90/04/28  22:43:40  syd
  18.  * checkin of Elm 2.3 as of Release PL0
  19.  *
  20.  *
  21.  ******************************************************************************/
  22.  
  23. /** This file contains routines used for output in the ELM program.
  24.  
  25. **/
  26.  
  27. #include "headers.h"
  28.  
  29.  
  30. static char err_buffer[SLEN];        /* store last error message */
  31.  
  32. static char central_message_buffer[SLEN];
  33.  
  34. char *strcpy();
  35.  
  36. show_last_error()
  37. {
  38.     /** rewrite last error message! **/
  39.  
  40.     error(err_buffer);
  41. }
  42.  
  43. clear_error()
  44. {
  45.     MoveCursor(LINES,0);
  46.     CleartoEOLN();
  47.     err_buffer[0] = '\0';
  48. }
  49.  
  50. set_error(s)
  51. char *s;
  52. {
  53.     strcpy(err_buffer, s);
  54. }
  55.  
  56. error(s)
  57. char *s;
  58. {
  59.     /** outputs error 's' to screen at line 22, centered! **/
  60.  
  61.     if(batch_only)
  62.       printf("%s\n\r", s);
  63.     else {
  64.       MoveCursor(LINES,0);
  65.       CleartoEOLN();
  66.       PutLine0(LINES,(COLUMNS-strlen(s))/2,s);
  67.       fflush(stdout);
  68.     }
  69.     strcpy(err_buffer, s);    /* save it too! */
  70. }
  71.  
  72. /*VARARGS1*/
  73.  
  74. error1(s, a)
  75. char *s, *a;
  76. {
  77.     /** same as error, but with a 'printf' argument **/
  78.     char buffer[SLEN];
  79.  
  80.     sprintf(buffer,s,a);
  81.     error(buffer);
  82. }
  83.  
  84. /*VARARGS1*/
  85.  
  86. error2(s, a1, a2)
  87. char *s, *a1, *a2;
  88. {
  89.     /** same as error, but with two 'printf' arguments **/
  90.     char buffer[SLEN];
  91.  
  92.     sprintf(buffer,s, a1, a2);
  93.     error(buffer);
  94. }
  95.  
  96. /*VARARGS1*/
  97.  
  98. error3(s, a1, a2, a3)
  99. char *s, *a1, *a2, *a3;
  100. {
  101.     /** same as error, but with three 'printf' arguments **/
  102.     char buffer[SLEN];
  103.  
  104.     sprintf(buffer,s, a1, a2, a3);
  105.     error(buffer);
  106. }
  107.  
  108. lower_prompt(s)
  109. char *s;
  110. {
  111.     /** prompt user for input on LINES-1 line, left justified **/
  112.  
  113.     PutLine0(LINES-1,0,s);
  114.     CleartoEOLN();
  115. }
  116.  
  117. prompt(s)
  118. char *s;
  119. {
  120.     /** prompt user for input on LINES-3 line, left justified **/
  121.  
  122.     PutLine0(LINES-3,0,s);
  123.     CleartoEOLN();
  124. }
  125.  
  126.  
  127. set_central_message(string, arg)
  128. char *string, *arg;
  129. {
  130.     /** set up the given message to be displayed in the center of
  131.         the current window **/
  132.  
  133.     sprintf(central_message_buffer, string, arg);
  134. }
  135.  
  136. display_central_message()
  137. {
  138.     /** display the message if set... **/
  139.  
  140.     if (central_message_buffer[0] != '\0') {
  141.       ClearLine(LINES-15);
  142.       Centerline(LINES-15, central_message_buffer);
  143.       fflush(stdout);
  144.     }
  145. }
  146.  
  147. clear_central_message()
  148. {
  149.     /** clear the central message buffer **/
  150.  
  151.     central_message_buffer[0] = '\0';
  152. }
  153.