home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume16 / pcomm2 / part06 / st_line.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-09-14  |  2.1 KB  |  80 lines

  1. /*
  2.  * Display the status line.  Up to now, we've never really cared how
  3.  * large the physical screen was... but now we want the status line
  4.  * on the bottom.
  5.  */
  6.  
  7. #include <curses.h>
  8. #include "config.h"
  9. #include "dial_dir.h"
  10. #include "misc.h"
  11. #include "modem.h"
  12. #include "param.h"
  13. #include "status.h"
  14.  
  15. void
  16. st_line(message)
  17. char *message;
  18. {
  19.     extern int xmc;
  20.     WINDOW *sl_win, *newwin();
  21.     int d, x, y;
  22.     static char *dn[2] = {"FDX", "HDX"};
  23.     static char *ln[2] = {"LOG OFF", "LOG ON"};
  24.     static char *pn[2] = {"PTR OFF", "PTR ON "};
  25.     char buf[80], field_one[15], *cur_tty;
  26.  
  27.                     /* is anybody missing? */
  28.     if (dir == NULL || modem == NULL || param == NULL)
  29.         return;
  30.                     /* remember where we parked the car.. */
  31.     getyx(stdscr, y, x);
  32.  
  33.     sl_win = newwin(1, 80, LINES-1, 0);
  34.                     /* duplex message */
  35.     d = 0;
  36.     if (dir->duplex[dir->d_cur] == 'H')
  37.         d++;
  38.                     /* the current TTY */
  39.     cur_tty = "No TTY";
  40.     if (modem->t_cur != -1)
  41.         cur_tty = modem->tty[modem->t_cur];
  42.  
  43.     /*
  44.      * The philosophy is:  If you press a command sequence that
  45.      * doesn't generate a window on the screen, then show the user
  46.      * what's going on in the status line.
  47.      */
  48.     if (*message == NULL)
  49.         sprintf(field_one, " %4.4s-0 HELP  ", param->ascii_hot);
  50.     else
  51.         sprintf(field_one, " %-13.13s", message);
  52.  
  53. #ifdef XMC_BROKE
  54.     if (xmc > 0)
  55.         sprintf(buf, "%s | %-9.9s| %s | %5d %c%d%d | %-7.7s | %-7.7s | %-5.5s|%-5.5s",
  56.          field_one, cur_tty, dn[d], dir->baud[dir->d_cur],
  57.          dir->parity[dir->d_cur], dir->dbits[dir->d_cur],
  58.          dir->sbits[dir->d_cur], ln[status->log], pn[status->print],
  59.          param->cr_in, param->cr_out);
  60.     else
  61. #endif /* XMC_BROKE */
  62.         sprintf(buf, "%s | %-9.9s| %s | %5d %c%d%d | %-7.7s | %-7.7s | %-5.5s| %-5.5s",
  63.          field_one, cur_tty, dn[d], dir->baud[dir->d_cur],
  64.          dir->parity[dir->d_cur], dir->dbits[dir->d_cur],
  65.          dir->sbits[dir->d_cur], ln[status->log], pn[status->print],
  66.          param->cr_in, param->cr_out);
  67.  
  68.     if (xmc > 0) {
  69.         touchwin(sl_win);
  70.         werase(sl_win);
  71.         wrefresh(sl_win);
  72.     }
  73.     wattrstr(sl_win, A_STANDOUT, buf);
  74.     wrefresh(sl_win);
  75.                     /* go ahead and delete it now */
  76.     delwin(sl_win);
  77.     move(y, x);
  78.     return;
  79. }
  80.