~mdw
/
sw-tools
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
usage: Print metavariables in SHOUTY letters.
[sw-tools]
/
src
/
pres_curses.c
diff --git
a/src/pres_curses.c
b/src/pres_curses.c
index
a134eac
..
a4f3b3f
100644
(file)
--- a/
src/pres_curses.c
+++ b/
src/pres_curses.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id
: pres_curses.c,v 1.1 1999/06/02 16:53:35 mdw Exp
$
+ * $Id$
*
* Curses-based output presentation
*
*
* Curses-based output presentation
*
@@
-26,14
+26,6
@@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: pres_curses.c,v $
- * Revision 1.1 1999/06/02 16:53:35 mdw
- * Initial revision
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include "config.h"
/*----- Header files ------------------------------------------------------*/
#include "config.h"
@@
-121,7
+113,9
@@
static void sizes(void)
#ifdef SIGTSTP
static void sig_tstp(int s)
{
#ifdef SIGTSTP
static void sig_tstp(int s)
{
+ int e = errno;
endwin();
endwin();
+ errno = e;
raise(SIGSTOP);
}
#endif
raise(SIGSTOP);
}
#endif
@@
-131,19
+125,25
@@
static void sig_tstp(int s)
#ifdef SIGTSTP
static void sig_cont(int s)
{
#ifdef SIGTSTP
static void sig_cont(int s)
{
+ int e = errno;
wrefresh(curscr);
wrefresh(curscr);
+ errno = e;
}
#endif
/* --- @sig_winch@ --- */
}
#endif
/* --- @sig_winch@ --- */
-#ifdef
HAVE_WRESIZE
+#ifdef
SIGWINCH
static void sig_winch(int s)
{
static void sig_winch(int s)
{
+ int e = errno;
+
+#ifdef HAVE_WRESIZE
cwin *c;
cwin *c;
+
endwin();
endwin();
-
refresh(
);
+
wrefresh(curscr
);
sizes();
for (c = cwins; c; c = c->next) {
mvwin(c->w, c->top, 0);
sizes();
for (c = cwins; c; c = c->next) {
mvwin(c->w, c->top, 0);
@@
-153,6
+153,11
@@
static void sig_winch(int s)
wnoutrefresh(c->s);
}
doupdate();
wnoutrefresh(c->s);
}
doupdate();
+#else
+ endwin();
+ wrefresh(curscr);
+#endif
+ errno = e;
}
#endif
}
#endif
@@
-218,15
+223,14
@@
int curses_init(archcons *a)
scrollok(c->w, TRUE);
leaveok(c->w, TRUE);
leaveok(c->s, TRUE);
scrollok(c->w, TRUE);
leaveok(c->w, TRUE);
leaveok(c->s, TRUE);
- wbkgdset(c->s, A_STANDOUT);
- werase(c->s);
- mvwprintw(c->s, 0, 0, " %s [running]\n", c->e->arch);
+ wbkgd(c->s, A_STANDOUT);
+ mvwprintw(c->s, 0, 0, " %s [running]\n", c->e->arch);
wnoutrefresh(c->w);
wnoutrefresh(c->s);
}
doupdate();
wnoutrefresh(c->w);
wnoutrefresh(c->s);
}
doupdate();
-#ifdef
HAVE_WRESIZE
+#ifdef
SIGWINCH
signal(SIGWINCH, sig_winch);
#endif
#ifdef SIGTSTP
signal(SIGWINCH, sig_winch);
#endif
#ifdef SIGTSTP
@@
-255,8
+259,25
@@
fail_0:
void curses_output(archent *e, const char *p, size_t sz)
{
cwin *c = e->pres;
void curses_output(archent *e, const char *p, size_t sz)
{
cwin *c = e->pres;
+ int y, x;
while (sz) {
while (sz) {
- waddch(c->w, *p);
+ switch (*p) {
+ case '\r':
+ getyx(c->w, y, x);
+ wmove(c->w, y, 0);
+ break;
+ case '\n':
+ getyx(c->w, y, x);
+ if (y < c->height - 1)
+ y++;
+ else
+ scroll(c->w);
+ wmove(c->w, y, 0);
+ break;
+ default:
+ waddch(c->w, *p);
+ break;
+ }
p++;
sz--;
}
p++;
sz--;
}
@@
-265,10
+286,10
@@
void curses_output(archent *e, const char *p, size_t sz)
/* --- @curses_close@ --- */
/* --- @curses_close@ --- */
-void curses_close(archent *e, int ok)
+void curses_close(archent *e, int ok
, const char *summ
)
{
cwin *c = e->pres;
{
cwin *c = e->pres;
- mvwprintw(c->s, 0, 0, " %s [%s]\n", e->arch,
ok ? "finished" : "failed"
);
+ mvwprintw(c->s, 0, 0, " %s [%s]\n", e->arch,
summ
);
wrefresh(c->s);
}
wrefresh(c->s);
}