home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume9 / elm2 / part01 / src / output_utils.c < prev    next >
C/C++ Source or Header  |  1987-03-08  |  2KB  |  130 lines

  1. /**            output_utils.c            **/
  2.  
  3. /** This file contains routines used for output in the ELM program.
  4.  
  5.     These routines (C) Copyright 1986 Dave Taylor
  6. **/
  7.  
  8. #include "headers.h"
  9.  
  10.  
  11. static char err_buffer[SLEN];        /* store last error message */
  12.  
  13. static char central_message_buffer[SLEN];
  14.  
  15. char *strcpy();
  16.  
  17. show_last_error()
  18. {
  19.     /** rewrite last error message! **/
  20.  
  21.     error(err_buffer);
  22. }
  23.  
  24. clear_error()
  25. {
  26.     MoveCursor(LINES,0);
  27.     CleartoEOLN();
  28.     err_buffer[0] = '\0';
  29. }
  30.  
  31. set_error(s)
  32. char *s;
  33. {
  34.     strcpy(err_buffer, s);
  35. }
  36.  
  37. error(s)
  38. char *s;
  39. {
  40.     /** outputs error 's' to screen at line 22, centered! **/
  41.  
  42.     MoveCursor(LINES,0);
  43.     CleartoEOLN();
  44.     PutLine0(LINES,(COLUMNS-strlen(s))/2,s);
  45.     fflush(stdout);
  46.     strcpy(err_buffer, s);    /* save it too! */
  47. }
  48.  
  49. /*VARARGS1*/
  50.  
  51. error1(s, a)
  52. char *s, *a;
  53. {
  54.     /** same as error, but with a 'printf' argument **/
  55.     char buffer[SLEN];
  56.  
  57.     sprintf(buffer,s,a);
  58.     error(buffer);
  59. }
  60.  
  61. /*VARARGS1*/
  62.  
  63. error2(s, a1, a2)
  64. char *s, *a1, *a2;
  65. {
  66.     /** same as error, but with two 'printf' arguments **/
  67.     char buffer[SLEN];
  68.  
  69.     sprintf(buffer,s, a1, a2);
  70.     error(buffer);
  71. }
  72.  
  73. /*VARARGS1*/
  74.  
  75. error3(s, a1, a2, a3)
  76. char *s, *a1, *a2, *a3;
  77. {
  78.     /** same as error, but with three 'printf' arguments **/
  79.     char buffer[SLEN];
  80.  
  81.     sprintf(buffer,s, a1, a2, a3);
  82.     error(buffer);
  83. }
  84.  
  85. lower_prompt(s)
  86. char *s;
  87. {
  88.     /** prompt user for input on LINES-1 line, left justified **/
  89.  
  90.     PutLine0(LINES-1,0,s);
  91.     CleartoEOLN();
  92. }
  93.  
  94. prompt(s)
  95. char *s;
  96. {
  97.     /** prompt user for input on LINES-3 line, left justified **/
  98.  
  99.     PutLine0(LINES-3,0,s);
  100.     CleartoEOLN();
  101. }
  102.  
  103.  
  104. set_central_message(string, arg)
  105. char *string, *arg;
  106. {
  107.     /** set up the given message to be displayed in the center of
  108.         the current window **/ 
  109.  
  110.     sprintf(central_message_buffer, string, arg);
  111. }
  112.  
  113. display_central_message()
  114. {
  115.     /** display the message if set... **/
  116.  
  117.     if (central_message_buffer[0] != '\0') {
  118.       ClearLine(LINES-15);
  119.       Centerline(LINES-15, central_message_buffer);
  120.       fflush(stdout);
  121.     }
  122. }
  123.  
  124. clear_central_message()
  125. {
  126.     /** clear the central message buffer **/
  127.  
  128.     central_message_buffer[0] = '\0';
  129. }
  130.