home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume14 / pcomm / part05 / st_line.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-17  |  1.8 KB  |  73 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 "dial_dir.h"
  9. #include "misc.h"
  10. #include "modem.h"
  11. #include "param.h"
  12. #include "status.h"
  13.  
  14. void
  15. status_line(message)
  16. char *message;
  17. {
  18.     WINDOW *sl_win, *newwin();
  19.     int d, x, y;
  20.     static char *dn[2] = {"FDX", "HDX"};
  21.     static char *ln[2] = {"LOG OFF", "LOG ON"};
  22.     static char *pn[2] = {"PTR OFF", "PTR ON "};
  23.     char buf[80], field_one[15], *cur_tty;
  24.     extern int xmc;
  25.  
  26.     /*
  27.      * Sometimes curses() doesn't remember where the cursor is on
  28.      * the screen, so we move it to the opposite corner to guarantee
  29.      * that the status line is on the bottom.
  30.      */
  31.     getyx(stdscr, y, x);
  32.     move(0, COLS-1);
  33.     refresh();
  34.  
  35.     sl_win = newwin(1, 80, LINES-1, 0);
  36.                     /* duplex message */
  37.     d = 0;
  38.     if (dir->duplex[dir->d_cur] == 'H')
  39.         d = 1;
  40.                     /* the current tty */
  41.     cur_tty = "No TTY";
  42.     if (modem->t_cur != -1)
  43.         cur_tty = modem->tty[modem->t_cur];
  44.     
  45.     /*
  46.      * The philosophy is:  If you press a command sequence that
  47.      * doesn't generate a window on the screen, then show the user
  48.      * what's going on in the status line.
  49.      */
  50.     if (message == NULL)
  51.         sprintf(field_one, " %4.4s-0 HELP  ", param->ascii_hot);
  52.     else
  53.         sprintf(field_one, " %-13.13s", message);
  54.  
  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.     
  61.     if (xmc > 0) {
  62.         touchwin(sl_win);
  63.         werase(sl_win);
  64.         wrefresh(sl_win);
  65.     }
  66.     wattrstr(sl_win, A_STANDOUT, buf);
  67.     wrefresh(sl_win);
  68.                     /* go ahead and delete it now */
  69.     delwin(sl_win);
  70.     move(y, x);
  71.     return;
  72. }
  73.