SCCS-vsn: usr.bin/window/main.c 1.4
SCCS-vsn: usr.bin/window/wwchild.c 1.4
SCCS-vsn: usr.bin/window/wwend.c 1.4
SCCS-vsn: usr.bin/window/wwiomux.c 1.4
SCCS-vsn: usr.bin/window/wwspawn.c 1.4
SCCS-vsn: usr.bin/window/wwinit.c 1.4
SCCS-vsn: usr.bin/window/wwmisc.c 1.4
SCCS-vsn: usr.bin/window/wwopen.c 1.4
SCCS-vsn: usr.bin/window/wwputc.c 1.4
SCCS-vsn: usr.bin/window/wwputs.c 1.4
SCCS-vsn: usr.bin/window/ww.h 1.4
SCCS-vsn: usr.bin/window/cmd.c 1.2
SCCS-vsn: usr.bin/window/cmd1.c 1.2
SCCS-vsn: usr.bin/window/wwtty.c 1.3
SCCS-vsn: usr.bin/window/wwwrite.c 1.3
SCCS-vsn: usr.bin/window/cmd2.c 1.2
SCCS-vsn: usr.bin/window/wwsuspend.c 1.3
SCCS-vsn: usr.bin/window/wwprintf.c 1.3
SCCS-vsn: usr.bin/window/cmd3.c 1.2
SCCS-vsn: usr.bin/window/wwgets.c 1.2
SCCS-vsn: usr.bin/window/wwclose.c 1.2
SCCS-vsn: usr.bin/window/wwframe.c 1.2
SCCS-vsn: usr.bin/window/wwlabel.c 1.2
SCCS-vsn: usr.bin/window/defs.h 1.2
24 files changed:
-static char *sccsid = "@(#)cmd.c 1.1 83/07/18";
+static char *sccsid = "@(#)cmd.c 1.2 83/07/19";
case 'w':
dowindow();
break;
case 'w':
dowindow();
break;
+ case 'Q':
+ doquery();
+ break;
case 'r':
selwin->ww_refresh = 0;
break;
case 'r':
selwin->ww_refresh = 0;
break;
goto out;
default:
Ding();
goto out;
default:
Ding();
- wwputs("Type ? for help. ", cmdwin);
+ wwprintf(cmdwin, "(%x) Type ? for help. ", c);
break;
}
}
wwputs("Command: ", cmdwin);
wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
break;
}
}
wwputs("Command: ", cmdwin);
wwsetcursor(WCurRow(cmdwin->ww_win), WCurCol(cmdwin->ww_win));
- while (bpeekc() < 0) {
- wwflush();
goto top;
out:
if (!quit)
goto top;
out:
if (!quit)
register int c;
struct ww *w;
register int c;
struct ww *w;
- while ((c = bgetc()) < 0) {
- wwflush();
+ while ((c = bgetc()) < 0)
if (c < '1' || c > '9') {
Ding();
return 0;
if (c < '1' || c > '9') {
Ding();
return 0;
-static char *sccsid = "@(#)cmd1.c 1.1 83/07/18";
+static char *sccsid = "@(#)cmd1.c 1.2 83/07/19";
row = 1;
for (;;) {
wwsetcursor(row, col);
row = 1;
for (;;) {
wwsetcursor(row, col);
- while (bpeekc() < 0) {
- wwflush();
switch (getpos(&row, &col, 0, 0)) {
case -1:
WBoxActive = 0;
switch (getpos(&row, &col, 0, 0)) {
case -1:
WBoxActive = 0;
+ wwputs("\r\nCancelled. ", cmdwin);
+ return;
- wwprintf(cmdwin, "%d %d. Upper left corner: ", col, row);
+ wwputs("\r\nLower right corner: ", cmdwin);
xcol = col + 1;
xrow = row + 1;
for (;;) {
Wbox(col, row, xcol - col + 1, xrow - row + 1);
wwsetcursor(xrow, xcol);
wwflush();
xcol = col + 1;
xrow = row + 1;
for (;;) {
Wbox(col, row, xcol - col + 1, xrow - row + 1);
wwsetcursor(xrow, xcol);
wwflush();
- while (bpeekc() < 0) {
- wwflush();
switch (getpos(&xrow, &xcol, row + 1, col + 1)) {
case -1:
WBoxActive = 0;
switch (getpos(&xrow, &xcol, row + 1, col + 1)) {
case -1:
WBoxActive = 0;
+ wwputs("\r\nCancelled. ", cmdwin);
+ return;
- wwprintf(cmdwin, "%d %d. ", xcol, xrow);
+ wwputs("\r\n", cmdwin);
if ((w = wwopen(WW_PTY, id, xrow-row+1, xcol-col+1, row, col)) == 0) {
if ((w = wwopen(WW_PTY, id, xrow-row+1, xcol-col+1, row, col)) == 0) {
- wwprintf(cmdwin, "Can't open window. ");
+ wwputs("Can't open window. ", cmdwin);
setselwin(w);
else
wwsetcurrent(cmdwin);
setselwin(w);
else
wwsetcurrent(cmdwin);
-out:
- wwputs("\r\n", cmdwin);
}
getpos(row, col, minrow, mincol)
}
getpos(row, col, minrow, mincol)
case '\r':
return 1;
default:
case '\r':
return 1;
default:
+ wwputs("\r\nType [hjklHJKL] to move, return to enter position, escape to cancel.", cmdwin);
-static char *sccsid = "@(#)cmd2.c 1.1 83/07/18";
+static char *sccsid = "@(#)cmd2.c 1.2 83/07/19";
- if ((w = openwin(20, "Help")) == 0)
+ if ((w = openwin(22, "Help")) == 0)
return;
wwprintf(w, "The escape character is ^P, which gets you into command mode.\r\n");
wwprintf(w, "The commands are:\r\n");
return;
wwprintf(w, "The escape character is ^P, which gets you into command mode.\r\n");
wwprintf(w, "The commands are:\r\n");
- wwprintf(w, "%%[1-9] select window [1-9]\r\n");
wwprintf(w, "[1-9] select window [1-9] and exit command mode\r\n");
wwprintf(w, "[1-9] select window [1-9] and exit command mode\r\n");
+ wwprintf(w, "%%[1-9] select window [1-9]\r\n");
wwprintf(w, "c[1-9] close window [1-9]\r\n");
wwprintf(w, "C close all empty windows\r\n");
wwprintf(w, "c[1-9] close window [1-9]\r\n");
wwprintf(w, "C close all empty windows\r\n");
+ wwprintf(w, "Z close all windows\r\n");
+ wwprintf(w, "Q show all windows in sequence\r\n");
wwprintf(w, "R force refresh after every newline in current window\r\n");
wwprintf(w, "r don't refresh every line\r\n");
wwprintf(w, "w open a new window\r\n");
wwprintf(w, "R force refresh after every newline in current window\r\n");
wwprintf(w, "r don't refresh every line\r\n");
wwprintf(w, "w open a new window\r\n");
wwprintf(w, "^L redraw screen\r\n");
wwprintf(w, "^Z suspend\r\n");
wwprintf(w, ". quit\r\n");
wwprintf(w, "^L redraw screen\r\n");
wwprintf(w, "^Z suspend\r\n");
wwprintf(w, ". quit\r\n");
struct rusage rusage;
struct timeval timeval;
struct rusage rusage;
struct timeval timeval;
- if ((w = openwin(9, "Time")) == 0)
+ if ((w = openwin(8, "Time")) == 0)
return;
gettimeofday(&timeval, &timezone);
return;
gettimeofday(&timeval, &timezone);
rusage.ru_msgsnd, rusage.ru_msgrcv, rusage.ru_nsignals,
rusage.ru_nvcsw, rusage.ru_nivcsw);
rusage.ru_msgsnd, rusage.ru_msgrcv, rusage.ru_nsignals,
rusage.ru_nvcsw, rusage.ru_nivcsw);
register struct ww *w;
{
wwprintf(w, "\r\nType return to continue: ");
wwsetcursor(WCurRow(w->ww_win), WCurCol(w->ww_win));
register struct ww *w;
{
wwprintf(w, "\r\nType return to continue: ");
wwsetcursor(WCurRow(w->ww_win), WCurCol(w->ww_win));
- while (bgetc() < 0) {
- wwflush();
+}
+
+closewin(w)
+register struct ww *w;
+{
wwclose(w);
wwsetcurrent(cmdwin);
}
wwclose(w);
wwsetcurrent(cmdwin);
}
-static char *sccsid = "@(#)cmd3.c 1.1 83/07/18";
+static char *sccsid = "@(#)cmd3.c 1.2 83/07/19";
w = (w1 = w)->ww_next;
if (w1 == selwin)
setselwin(0);
w = (w1 = w)->ww_next;
if (w1 == selwin)
setselwin(0);
+ if (w->ww_state == WW_HASPROC && w->ww_pid == 0)
+ {
+ wwprintf(cmdwin, "%d: pid == 0. ",
+ w->ww_ident);
+ } else
+ wwclose(w1);
-/* @(#)defs.h 1.1 83/07/18 */
+/* @(#)defs.h 1.2 83/07/19 */
#include "ww.h"
#include <signal.h>
#include "ww.h"
#include <signal.h>
-static char *sccsid = "@(#)main.c 1.3 83/07/18";
+static char *sccsid = "@(#)main.c 1.4 83/07/19";
+ /*
+ * Loop until we get some keyboard input.
+ */
while (ibufc == 0) {
wwsetcursor(WCurRow(curwin->ww_win),
WCurCol(curwin->ww_win));
wwflush();
while (ibufc == 0) {
wwsetcursor(WCurRow(curwin->ww_win),
WCurCol(curwin->ww_win));
wwflush();
- imask = 1<<0;
- wwforce(&imask);
- if ((imask & 1<<0) == 0)
+ imask = 1 << 0;
+ while (wwforce(&imask) < 0)
+ ;
+ if ((imask & 1 << 0) == 0)
- if (ibufc == 0)
- ibufp = ibuf;
- p = ibufp + ibufc;
- n = read(0, p, ibuf + sizeof ibuf - p);
- if (n > 0)
- ibufc = n;
- }
- for (p = ibufp, n = ibufc; n-- > 0 && *p != ESCAPE; p++)
- ;
- if ((n = p - ibufp) > 0) {
- write(curwin->ww_pty, ibufp, n);
- ibufp = p;
- ibufc -= n;
+ /* NOTE: ibufc == 0 */
+ ibufp = ibuf;
+ if ((ibufc = read(0, ibuf, sizeof ibuf)) < 0)
+ ibufc = 0;
- if (*p == ESCAPE) {
- ibufp++;
- ibufc--;
- wwsetcurrent(cmdwin);
+ /*
+ * Weird loop. Copy the buffer to the pty stopping
+ * on the escape character in a hopefully efficient
+ * way.
+ * Probably a good thing to make ibufc == 1 a special
+ * case.
+ */
+ for (p = ibufp, n = ibufc;;) {
+ if (--n < 0) {
+ write(curwin->ww_pty, ibufp, ibufc);
+ ibufp = ibuf;
+ ibufc = 0;
+ break;
+ } else if (*p++ == ESCAPE) {
+ if ((n = p - ibufp) > 1)
+ write(curwin->ww_pty, ibufp, n - 1);
+ ibufp = p;
+ ibufc -= n;
+ wwsetcurrent(cmdwin);
+ break;
+ }
-/* @(#)ww.h 1.3 83/07/18 */
+/* @(#)ww.h 1.4 83/07/19 */
#include <stdio.h>
#include <sgtty.h>
#include <stdio.h>
#include <sgtty.h>
-static char *sccsid = "@(#)wwchild.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwchild.c 1.4 83/07/19";
-static char *sccsid = "@(#)wwclose.c 1.1 83/07/18";
+static char *sccsid = "@(#)wwclose.c 1.2 83/07/19";
-static char *sccsid = "@(#)wwend.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwend.c 1.4 83/07/19";
-static char *sccsid = "@(#)wwframe.c 1.1 83/07/18";
+static char *sccsid = "@(#)wwframe.c 1.2 83/07/19";
-static char *sccsid = "@(#)wwgets.c 1.1 83/07/18";
+static char *sccsid = "@(#)wwgets.c 1.2 83/07/19";
- imask = 1 << 0;
- wwforce(&imask);
- if ((imask & 1<<0) == 0)
- return;
- if (ibufc == 0)
- ibufp = ibuf;
- n = read(0, ibufp + ibufc, ibuf + sizeof ibuf - ibufp - ibufc);
- if (n > 0)
- ibufc += n;
+ while (ibufc == 0) {
+ wwflush();
+ imask = 1 << 0;
+ while (wwforce(&imask) < 0)
+ ;
+ if ((imask & 1 << 0) == 0)
+ continue;
+ if (ibufc == 0) {
+ p = ibufp = ibuf;
+ n = sizeof ibuf;
+ } else {
+ p = ibufp + ibufc;
+ n = (ibuf + sizeof ibuf) - p;
+ }
+ if ((n = read(0, p, n)) > 0)
+ ibufc += n;
+ }
-static char *sccsid = "@(#)wwinit.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwinit.c 1.4 83/07/19";
{ -1, -1, -1, -1, -1, -1 },
0, 0, 0
};
{ -1, -1, -1, -1, -1, -1 },
0, 0, 0
};
if (done)
return 0;
done++;
if (done)
return 0;
done++;
+ _wwdtablesize = getdtablesize();
if (wwgettty(0, &wwoldtty) < 0)
return -1;
wwnewtty.ww_sgttyb.sg_flags = wwoldtty.ww_sgttyb.sg_flags;
if (wwgettty(0, &wwoldtty) < 0)
return -1;
wwnewtty.ww_sgttyb.sg_flags = wwoldtty.ww_sgttyb.sg_flags;
-static char *sccsid = "@(#)wwiomux.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwiomux.c 1.4 83/07/19";
+extern int _wwdtablesize;
+
wwforce(imask)
register int *imask;
{
wwforce(imask)
register int *imask;
{
for (w = wwhead; w; w = w->ww_next)
if (w->ww_pty >= 0)
*imask |= 1 << w->ww_pty;
for (w = wwhead; w; w = w->ww_next)
if (w->ww_pty >= 0)
*imask |= 1 << w->ww_pty;
- n = select(getdtablesize(), imask,
+ n = select(_wwdtablesize, imask,
(int *)0, (int *)0, (struct timeval *)0);
if (n <= 0)
return -1;
(int *)0, (int *)0, (struct timeval *)0);
if (n <= 0)
return -1;
-static char *sccsid = "@(#)wwlabel.c 1.1 83/07/18";
+static char *sccsid = "@(#)wwlabel.c 1.2 83/07/19";
-static char *sccsid = "@(#)wwmisc.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwmisc.c 1.4 83/07/19";
-static char *sccsid = "@(#)wwopen.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwopen.c 1.4 83/07/19";
#include <sys/stat.h>
struct ww *
#include <sys/stat.h>
struct ww *
-wwopen(flag, id, nrow, ncol, row, col)
+wwopen(mode, id, nrow, ncol, row, col)
{
register struct ww *w = 0;
{
register struct ww *w = 0;
if (w == 0)
goto bad;
w->ww_pty = w->ww_tty = -1;
if (w == 0)
goto bad;
w->ww_pty = w->ww_tty = -1;
case WW_PTY:
if (wwgetpty(w) < 0)
goto bad;
case WW_PTY:
if (wwgetpty(w) < 0)
goto bad;
if ((w->ww_win = Wopen(id, col, row, ncol, nrow, ncol, nrow)) == 0)
goto bad;
Woncursor(w->ww_win, 0); /* don't show cursor */
if ((w->ww_win = Wopen(id, col, row, ncol, nrow, ncol, nrow)) == 0)
goto bad;
Woncursor(w->ww_win, 0); /* don't show cursor */
w->ww_ident = id;
w->ww_icol = w->ww_col = col;
w->ww_irow = w->ww_row = row;
w->ww_ident = id;
w->ww_icol = w->ww_col = col;
w->ww_irow = w->ww_row = row;
-static char *sccsid = "@(#)wwprintf.c 1.2 83/07/18";
+static char *sccsid = "@(#)wwprintf.c 1.3 83/07/19";
return wwwrite(w, buf, _wwbuf._ptr - buf);
}
return wwwrite(w, buf, _wwbuf._ptr - buf);
}
wwprintf(w, fmt, args)
struct ww *w;
char *fmt;
wwprintf(w, fmt, args)
struct ww *w;
char *fmt;
-static char *sccsid = "@(#)wwputc.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwputc.c 1.4 83/07/19";
-static char *sccsid = "@(#)wwputs.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwputs.c 1.4 83/07/19";
-static char *sccsid = "@(#)wwspawn.c 1.3 83/07/18";
+static char *sccsid = "@(#)wwspawn.c 1.4 83/07/19";
+extern int _wwdtablesize;
+
wwfork(wp)
register struct ww *wp;
{
wwfork(wp)
register struct ww *wp;
{
dup2(wp->ww_tty, 0);
dup2(wp->ww_tty, 1);
dup2(wp->ww_tty, 2);
dup2(wp->ww_tty, 0);
dup2(wp->ww_tty, 1);
dup2(wp->ww_tty, 2);
- for (i = getdtablesize() - 1; i > 2; i--)
+ for (i = _wwdtablesize - 1; i > 2; i--)
close(i);
/*
i = open("/dev/tty");
close(i);
/*
i = open("/dev/tty");
-static char *sccsid = "@(#)wwsuspend.c 1.2 83/07/18";
+static char *sccsid = "@(#)wwsuspend.c 1.3 83/07/19";
-static char *sccsid = "@(#)wwtty.c 1.2 83/07/18";
+static char *sccsid = "@(#)wwtty.c 1.3 83/07/19";
-static char *sccsid = "@(#)wwwrite.c 1.2 83/07/18";
+static char *sccsid = "@(#)wwwrite.c 1.3 83/07/19";