summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'help.c')
-rw-r--r--help.c519
1 files changed, 350 insertions, 169 deletions
diff --git a/help.c b/help.c
index 88745fc..bcd74ae 100644
--- a/help.c
+++ b/help.c
@@ -33,9 +33,13 @@ RCS_ID("$Id: help.c,v 1.7 1994/05/31 12:32:04 mlschroe Exp $ FAU")
char version[40]; /* initialised by main() */
-extern struct display *display;
+extern struct layer *flayer;
+extern struct display *displays;
extern char *noargs[];
-extern struct mchar mchar_null;
+extern struct mchar mchar_blank;
+extern char *blank;
+
+static void PadStr __P((char *, int, int, int));
void
@@ -44,35 +48,38 @@ char *myname, *message, *arg;
{
printf("Use: %s [-opts] [cmd [args]]\n", myname);
printf(" or: %s -r [host.tty]\n\nOptions:\n", myname);
- printf("-a Force all capabilities into each window's termcap.\n");
- printf("-A -[r|R] Adapt all windows to the new display width & height.\n");
- printf("-c file Read configuration file instead of '.screenrc'.\n");
+ printf("-a Force all capabilities into each window's termcap.\n");
+ printf("-A -[r|R] Adapt all windows to the new display width & height.\n");
+ printf("-c file Read configuration file instead of '.screenrc'.\n");
#ifdef REMOTE_DETACH
- printf("-d (-r) Detach the elsewhere running screen (and reattach here).\n");
- printf("-D (-r) Detach and logout remote (and reattach here).\n");
+ printf("-d (-r) Detach the elsewhere running screen (and reattach here).\n");
+ printf("-dmS name Start as daemon: Screen session in detached mode.\n");
+ printf("-D (-r) Detach and logout remote (and reattach here).\n");
+ printf("-D -RR Do whatever is needed to get a screen session.\n");
#endif
- printf("-e xy Change command characters.\n");
- printf("-f Flow control on, -fn = off, -fa = auto.\n");
- printf("-h lines Set the size of the scrollback history buffer.\n");
- printf("-i Interrupt output sooner when flow control is on.\n");
+ printf("-e xy Change command characters.\n");
+ printf("-f Flow control on, -fn = off, -fa = auto.\n");
+ printf("-h lines Set the size of the scrollback history buffer.\n");
+ printf("-i Interrupt output sooner when flow control is on.\n");
#if defined(LOGOUTOK) && defined(UTMPOK)
- printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE);
+ printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE);
#endif
- printf("-list or -ls. Do nothing, just list our SockDir.\n");
- printf("-L Terminal's last character can be safely updated.\n");
- printf("-m ignore $STY variable, do create a new screen session.\n");
- printf("-O Choose optimal output rather than exact vt100 emulation.\n");
- printf("-q Quiet startup. Exits with non-zero return code if unsuccessful.\n");
- printf("-r Reattach to a detached screen process.\n");
- printf("-R Reattach if possible, otherwise start a new session.\n");
- printf("-s shell Shell to execute rather than $SHELL.\n");
- printf("-S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.\n");
- printf("-t title Set title. (window's name).\n");
- printf("-T term Use term as $TERM for windows, rather than \"screen\".\n");
- printf("-v Print \"Screen version %s\".\n", version);
- printf("-wipe Do nothing, just clean up SockDir.\n");
+ printf("-list or -ls. Do nothing, just list our SockDir.\n");
+ printf("-L Terminal's last character can be safely updated.\n");
+ printf("-m ignore $STY variable, do create a new screen session.\n");
+ printf("-O Choose optimal output rather than exact vt100 emulation.\n");
+ printf("-p window Preselect the named window if it exists.\n");
+ printf("-q Quiet startup. Exits with non-zero return code if unsuccessful.\n");
+ printf("-r Reattach to a detached screen process.\n");
+ printf("-R Reattach if possible, otherwise start a new session.\n");
+ printf("-s shell Shell to execute rather than $SHELL.\n");
+ printf("-S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>.\n");
+ printf("-t title Set title. (window's name).\n");
+ printf("-T term Use term as $TERM for windows, rather than \"screen\".\n");
+ printf("-v Print \"Screen version %s\".\n", version);
+ printf("-wipe Do nothing, just clean up SockDir.\n");
#ifdef MULTI
- printf("-x Attach to a not detached screen. (Multi display mode).\n");
+ printf("-x Attach to a not detached screen. (Multi display mode).\n");
#endif /* MULTI */
if (message && *message)
{
@@ -83,7 +90,6 @@ char *myname, *message, *arg;
exit(1);
}
-
/*
** Here come the help page routines
*/
@@ -94,9 +100,8 @@ extern struct action ktab[];
static void HelpProcess __P((char **, int *));
static void HelpAbort __P((void));
static void HelpRedisplayLine __P((int, int, int, int));
-static void HelpSetCursor __P((void));
static void add_key_to_buf __P((char *, int));
-static int AddAction __P((struct action *, int));
+static void AddAction __P((struct action *, int, int));
static int helppage __P((void));
struct helpdata
@@ -118,7 +123,6 @@ static struct LayFuncs HelpLf =
HelpRedisplayLine,
DefClearLine,
DefRewrite,
- HelpSetCursor,
DefResize,
DefRestore
};
@@ -131,15 +135,15 @@ display_help()
struct helpdata *helpdata;
int used[RC_LAST + 1];
- if (D_height < 6)
+ if (flayer->l_height < 6)
{
- Msg(0, "Window height too small for help page");
+ LMsg(0, "Window height too small for help page");
return;
}
if (InitOverlayPage(sizeof(*helpdata), &HelpLf, 0))
return;
- helpdata = (struct helpdata *)D_lay->l_data;
+ helpdata = (struct helpdata *)flayer->l_data;
helpdata->num_names = helpdata->command_bindings = 0;
helpdata->command_search = 0;
for (n = 0; n <= RC_LAST; n++)
@@ -175,14 +179,14 @@ display_help()
if (mkey > MAXKLEN)
mkey = MAXKLEN;
- helpdata->numcols = (D_width - !D_CLP)/(mcom + mkey + 1);
+ helpdata->numcols = flayer->l_width / (mcom + mkey + 1);
if (helpdata->numcols == 0)
{
HelpAbort();
- Msg(0, "Width too small");
+ LMsg(0, "Width too small");
return;
}
- helpdata->inter = (D_width - !D_CLP - (mcom + mkey) * helpdata->numcols) / (helpdata->numcols + 1);
+ helpdata->inter = (flayer->l_width - (mcom + mkey) * helpdata->numcols) / (helpdata->numcols + 1);
if (helpdata->inter <= 0)
helpdata->inter = 1;
debug1("inter: %d\n", helpdata->inter);
@@ -190,34 +194,29 @@ display_help()
helpdata->mkey = mkey;
helpdata->numrows = (helpdata->num_names + helpdata->numcols - 1) / helpdata->numcols;
debug1("Numrows: %d\n", helpdata->numrows);
- helpdata->numskip = D_height-5 - (2 + helpdata->numrows);
+ helpdata->numskip = flayer->l_height-5 - (2 + helpdata->numrows);
while (helpdata->numskip < 0)
- helpdata->numskip += D_height-5;
- helpdata->numskip %= D_height-5;
+ helpdata->numskip += flayer->l_height-5;
+ helpdata->numskip %= flayer->l_height-5;
debug1("Numskip: %d\n", helpdata->numskip);
- if (helpdata->numskip > D_height/3 || helpdata->numskip > helpdata->command_bindings)
+ if (helpdata->numskip > flayer->l_height/3 || helpdata->numskip > helpdata->command_bindings)
helpdata->numskip = 1;
helpdata->maxrow = 2 + helpdata->numrows + helpdata->numskip + helpdata->command_bindings;
helpdata->grow = 0;
- helpdata->numpages = (helpdata->maxrow + D_height-6) / (D_height-5);
+ helpdata->numpages = (helpdata->maxrow + flayer->l_height-6) / (flayer->l_height-5);
+ flayer->l_x = 0;
+ flayer->l_y = flayer->l_height - 1;
helppage();
}
static void
-HelpSetCursor()
-{
- GotoPos(0, D_height - 1);
-}
-
-static void
HelpProcess(ppbuf, plen)
char **ppbuf;
int *plen;
{
int done = 0;
- GotoPos(0, D_height-1);
while (!done && *plen > 0)
{
switch (**ppbuf)
@@ -243,7 +242,7 @@ int *plen;
static void
HelpAbort()
{
- LAY_CALL_UP(Activate(0));
+ LAY_CALL_UP(RedisplayLayer(flayer, 0));
ExitOverlayPage();
}
@@ -252,10 +251,10 @@ static int
helppage()
{
struct helpdata *helpdata;
- int col, crow, n, key;
+ int col, crow, n, key, x;
char buf[MAXKLEN], Esc_buf[5], cbuf[256];
- helpdata = (struct helpdata *)D_lay->l_data;
+ helpdata = (struct helpdata *)flayer->l_data;
if (helpdata->grow >= helpdata->maxrow)
return -1;
@@ -263,46 +262,53 @@ helppage()
helpdata->refcommand_search = helpdata->command_search;
/* Clear the help screen */
- SetRendition(&mchar_null);
- ClearDisplay();
+ ClearLayer(flayer, 0);
- sprintf(cbuf,"Screen key bindings, page %d of %d.", helpdata->grow / (D_height-5) + 1, helpdata->numpages);
- centerline(cbuf);
- AddChar('\n');
+ sprintf(cbuf,"Screen key bindings, page %d of %d.", helpdata->grow / (flayer->l_height-5) + 1, helpdata->numpages);
+ centerline(cbuf, 0);
crow = 2;
*Esc_buf = '\0';
- add_key_to_buf(Esc_buf, D_user->u_Esc);
+ *buf = '\0';
+ /* XXX fix escape character */
+ if (flayer->l_cvlist && flayer->l_cvlist->c_display)
+ {
+ add_key_to_buf(buf, flayer->l_cvlist->c_display->d_user->u_MetaEsc);
+ add_key_to_buf(Esc_buf, flayer->l_cvlist->c_display->d_user->u_Esc);
+ }
+ else
+ {
+ strcpy(Esc_buf, "??");
+ strcpy(buf, "??");
+ }
- for (; crow < D_height - 3; crow++)
+ for (; crow < flayer->l_height - 3; crow++)
{
if (helpdata->grow < 1)
{
- *buf = '\0';
- add_key_to_buf(buf, D_user->u_MetaEsc);
sprintf(cbuf,"Command key: %s Literal %s: %s", Esc_buf, Esc_buf, buf);
- centerline(cbuf);
+ centerline(cbuf, crow);
helpdata->grow++;
}
else if (helpdata->grow >= 2 && helpdata->grow-2 < helpdata->numrows)
{
+ x = 0;
for (col = 0; col < helpdata->numcols && (n = helpdata->numrows * col + (helpdata->grow-2)) < helpdata->num_names; col++)
{
- AddStrn("", helpdata->inter - !col);
+ x += helpdata->inter - !col;
n = helpdata->nact[n];
- debug1("help: searching key %d\n", n);
buf[0] = '\0';
for (key = 0; key < 256; key++)
if (ktab[key].nr == n && ktab[key].args == noargs && strlen(buf) < sizeof(buf) - 7)
-
{
strcat(buf, " ");
add_key_to_buf(buf, key);
}
- AddStrn(comms[n].name, helpdata->mcom);
- AddStrn(buf, helpdata->mkey);
+ PadStr(comms[n].name, helpdata->mcom, x, crow);
+ x += helpdata->mcom;
+ PadStr(buf, helpdata->mkey, x, crow);
+ x += helpdata->mkey;
}
- AddStr("\r\n");
helpdata->grow++;
}
else if (helpdata->grow-2-helpdata->numrows >= helpdata->numskip
@@ -316,43 +322,45 @@ helppage()
}
buf[0] = '\0';
add_key_to_buf(buf, helpdata->command_search);
- AddStrn(buf, 4);
- AddAction(&ktab[helpdata->command_search++], D_width - 5);
- AddStr("\r\n");
+ PadStr(buf, 4, 0, crow);
+ AddAction(&ktab[helpdata->command_search++], 4, crow);
helpdata->grow++;
}
else
- {
- AddChar('\n');
- helpdata->grow++;
- }
+ helpdata->grow++;
}
- AddChar('\n');
sprintf(cbuf,"[Press Space %s Return to end.]",
helpdata->grow < helpdata->maxrow ? "for next page;" : "or");
- centerline(cbuf);
- SetLastPos(0, D_height-1);
+ centerline(cbuf, flayer->l_height - 2);
+ SetCursor();
return 0;
}
-static int
-AddAction(act, fr)
+static void
+AddAction(act, x, y)
struct action *act;
-int fr;
+int x, y;
{
char buf[256];
int del, l;
char *bp, *cp, **pp;
+ int fr;
+ struct mchar mchar_dol;
+ mchar_dol = mchar_blank;
+ mchar_dol.image = '$';
+
+ fr = flayer->l_width - 1 - x;
if (fr <= 0)
- return 0;
+ return;
l = strlen(comms[act->nr].name);
if (l + 1 > fr)
l = fr - 1;
- AddStrn(comms[act->nr].name, l);
+ PadStr(comms[act->nr].name, l, x, y);
+ x += l;
fr -= l + 1;
- AddChar(fr ? ' ' : '$');
+ LPutChar(flayer, fr ? &mchar_blank : &mchar_dol, x++, y);
pp = act->args;
while (pp && (cp = *pp) != NULL)
@@ -375,17 +383,17 @@ int fr;
{
fr += bp - buf;
if (fr > 0)
- AddStrn(buf, fr);
+ PadStr(buf, fr, x, y);
if (fr == 0)
- AddChar('$');
- return 0;
+ LPutChar(flayer, &mchar_dol, x, y);
+ return;
}
- AddStr(buf);
+ PadStr(buf, strlen(buf), x, y);
+ x += strlen(buf);
pp++;
if (*pp)
- AddChar(fr ? ' ' : '$');
+ LPutChar(flayer, fr ? &mchar_blank : &mchar_dol, x++, y);
}
- return fr;
}
static void
@@ -393,7 +401,6 @@ add_key_to_buf(buf, key)
char *buf;
int key;
{
- debug1("help: key found: %c\n", key);
buf += strlen(buf);
if (key < 0)
strcpy(buf, "unset");
@@ -412,17 +419,16 @@ int y, xs, xe, isblank;
{
struct helpdata *helpdata;
- helpdata = (struct helpdata *)D_lay->l_data;
+ helpdata = (struct helpdata *)flayer->l_data;
helpdata->grow = helpdata->refgrow;
helpdata->command_search = helpdata->refcommand_search;
helppage();
return;
}
- if (y != 0 && y != D_height - 1)
+ if (y != 0 && y != flayer->l_height - 1)
return;
- if (isblank)
- return;
- Clear(xs, y, xs, xe, xe, y, 0);
+ if (!isblank)
+ LClear(flayer, xs, y, xe, y, 0);
}
@@ -435,7 +441,6 @@ int y, xs, xe, isblank;
static void CopyrightProcess __P((char **, int *));
static void CopyrightRedisplayLine __P((int, int, int, int));
static void CopyrightAbort __P((void));
-static void CopyrightSetCursor __P((void));
static void copypage __P((void));
struct copydata
@@ -451,7 +456,6 @@ static struct LayFuncs CopyrightLf =
CopyrightRedisplayLine,
DefClearLine,
DefRewrite,
- CopyrightSetCursor,
DefResize,
DefRestore
};
@@ -460,7 +464,7 @@ static const char cpmsg[] = "\
\n\
Screen version %v\n\
\n\
-Copyright (c) 1993 Juergen Weigert, Michael Schroeder\n\
+Copyright (c) 1993-1999 Juergen Weigert, Michael Schroeder\n\
Copyright (c) 1987 Oliver Laumann\n\
\n\
This program is free software; you can redistribute it and/or \
@@ -483,12 +487,6 @@ screen@uni-erlangen.de\n";
static void
-CopyrightSetCursor()
-{
- GotoPos(0, D_height - 1);
-}
-
-static void
CopyrightProcess(ppbuf, plen)
char **ppbuf;
int *plen;
@@ -496,8 +494,7 @@ int *plen;
int done = 0;
struct copydata *copydata;
- copydata = (struct copydata *)D_lay->l_data;
- GotoPos(0, D_height - 1);
+ copydata = (struct copydata *)flayer->l_data;
while (!done && *plen > 0)
{
switch (**ppbuf)
@@ -525,7 +522,7 @@ int *plen;
static void
CopyrightAbort()
{
- LAY_CALL_UP(Activate(0));
+ LAY_CALL_UP(RedisplayLayer(flayer, 0));
ExitOverlayPage();
}
@@ -534,16 +531,18 @@ display_copyright()
{
struct copydata *copydata;
- if (D_width < 10 || D_height < 5)
+ if (flayer->l_width < 10 || flayer->l_height < 5)
{
- Msg(0, "Window size too small for copyright page");
+ LMsg(0, "Window size too small for copyright page");
return;
}
if (InitOverlayPage(sizeof(*copydata), &CopyrightLf, 0))
return;
- copydata = (struct copydata *)D_lay->l_data;
+ copydata = (struct copydata *)flayer->l_data;
copydata->cps = (char *)cpmsg;
copydata->savedcps = 0;
+ flayer->l_x = 0;
+ flayer->l_y = flayer->l_height - 1;
copypage();
}
@@ -556,14 +555,15 @@ copypage()
char cbuf[80];
struct copydata *copydata;
- copydata = (struct copydata *)D_lay->l_data;
- SetRendition(&mchar_null);
- ClearDisplay();
+ ASSERT(flayer);
+ copydata = (struct copydata *)flayer->l_data;
+
+ ClearLayer(flayer, 0);
x = y = 0;
cps = copydata->cps;
copydata->refcps = cps;
copydata->refsavedcps = copydata->savedcps;
- while (*cps && y < D_height - 3)
+ while (*cps && y < flayer->l_height - 3)
{
ws = cps;
while (*cps == ' ')
@@ -578,22 +578,21 @@ copypage()
cps++;
l = cps - ws;
cps = ws;
- if (l > D_width - 1)
- l = D_width - 1;
- if (x && x + l >= D_width - 2)
+ if (l > flayer->l_width - 1)
+ l = flayer->l_width - 1;
+ if (x && x + l >= flayer->l_width - 2)
{
- AddStr("\r\n");
x = 0;
y++;
continue;
}
if (x)
{
- AddChar(' ');
+ LPutChar(flayer, &mchar_blank, x, y);
x++;
}
if (l)
- AddStrn(ws, l);
+ LPutStr(flayer, ws, l, &mchar_blank, x, y);
x += l;
cps += l;
if (*cps == 0 && copydata->savedcps)
@@ -603,7 +602,6 @@ copypage()
}
if (*cps == '\n')
{
- AddStr("\r\n");
x = 0;
y++;
}
@@ -612,42 +610,221 @@ copypage()
}
while (*cps == '\n')
cps++;
- while (y++ < D_height - 2)
- AddStr("\r\n");
sprintf(cbuf,"[Press Space %s Return to end.]",
*cps ? "for next page;" : "or");
- centerline(cbuf);
- SetLastPos(0, D_height-1);
+ centerline(cbuf, flayer->l_height - 2);
copydata->cps = cps;
+ SetCursor();
}
static void
CopyrightRedisplayLine(y, xs, xe, isblank)
int y, xs, xe, isblank;
{
+ ASSERT(flayer);
if (y < 0)
{
struct copydata *copydata;
- copydata = (struct copydata *)D_lay->l_data;
+ copydata = (struct copydata *)flayer->l_data;
copydata->cps = copydata->refcps;
copydata->savedcps = copydata->refsavedcps;
copypage();
return;
}
- if (y != 0 && y != D_height - 1)
+ if (y != 0 && y != flayer->l_height - 1)
return;
if (isblank)
return;
- Clear(xs, y, xs, xe, xe, y, 0);
+ LClear(flayer, xs, y, xe, y, 0);
+}
+
+
+
+/*
+**
+** here is all the displays stuff
+**
+*/
+
+static void DisplaysProcess __P((char **, int *));
+static void DisplaysRedisplayLine __P((int, int, int, int));
+static void displayspage __P((void));
+
+struct displaysdata
+{
+ int dummy_element_for_solaris;
+};
+
+static struct LayFuncs DisplaysLf =
+{
+ DisplaysProcess,
+ HelpAbort,
+ DisplaysRedisplayLine,
+ DefClearLine,
+ DefRewrite,
+ DefResize,
+ DefRestore
+};
+
+static void
+DisplaysProcess(ppbuf, plen)
+char **ppbuf;
+int *plen;
+{
+ int done = 0;
+ struct displaysdata *displaysdata;
+
+ ASSERT(flayer);
+ displaysdata = (struct displaysdata *)flayer->l_data;
+ while (!done && *plen > 0)
+ {
+ switch (**ppbuf)
+ {
+ case ' ':
+ displayspage();
+ break;
+ /* FALLTHROUGH */
+ case '\r':
+ case '\n':
+ HelpAbort();
+ done = 1;
+ break;
+ default:
+ break;
+ }
+ ++*ppbuf;
+ --*plen;
+ }
}
-void
+void
display_displays()
{
+ struct displaysdata *displaysdata;
+
+ if (flayer->l_width < 10 || flayer->l_height < 5)
+ {
+ LMsg(0, "Window size too small for displays page");
+ return;
+ }
+ if (InitOverlayPage(sizeof(*displaysdata), &DisplaysLf, 0))
+ return;
+ displaysdata = (struct displaysdata *)flayer->l_data;
+ flayer->l_x = 0;
+ flayer->l_y = flayer->l_height - 1;
+ displayspage();
+}
+
+/*
+ * layout of the displays page is as follows:
+
+xterm 80x42 jnweiger@/dev/ttyp4 0(m11) &rWx
+facit 80x24 nb mlschroe@/dev/ttyhf 11(tcsh) rwx
+xterm 80x42 jnhollma@/dev/ttyp5 0(m11) &R.x
+
+ | | | | | | | | ¦___ window permissions
+ | | | | | | | | (R. is locked r-only,
+ | | | | | | | | W has wlock)
+ | | | | | | | |___ Window is shared
+ | | | | | | |___ Name/Title of window
+ | | | | | |___ Number of window
+ | | | | |___ Name of the display (the attached device)
+ | | | |___ Username who is logged in at the display
+ | | |___ Display is in nonblocking mode. Shows 'NB' if obuf is full.
+ | |___ Displays geometry as width x height.
+ |___ the terminal type known by screen for this display.
+
+ */
+
+static void
+displayspage()
+{
+ int y, l;
+ char tbuf[80];
+ struct displaysdata *displaysdata;
+ struct display *d;
+ struct win *w;
+
+ displaysdata = (struct displaysdata *)flayer->l_data;
+
+ ClearLayer(flayer, 0);
+
+ leftline("term-type size user interface window", 0);
+ leftline("---------- ------- ---------- ----------------- ----------", 1);
+ y = 2;
+
+ for (d = displays; d; d = d->d_next)
+ {
+ w = d->d_fore;
+
+ if (y >= flayer->l_height - 3)
+ break;
+ sprintf(tbuf, "%-10.10s%4dx%-4d%10.10s@%-16.16s%s",
+ d->d_termname, d->d_width, d->d_height, d->d_user->u_name,
+ d->d_usertty,
+ d->d_nonblock ? ((( d->d_obufp - d->d_obuf) > d->d_obufmax) ?
+ "NB" : "nb") : " ");
+
+ if (w)
+ {
+ l = 10 - strlen(w->w_title);
+ if (l < 0)
+ l = 0;
+ sprintf(tbuf + strlen(tbuf), "%3d(%.10s)%*s%c%c%c%c",
+ w->w_number, w->w_title, l, "",
+ /* w->w_dlist->next */ 0 ? '&' : ' ',
+ /*
+ * The rwx triple:
+ * -,r,R no read, read, read only due to foreign wlock
+ * -,.,w,W no write, write suppressed by foreign wlock,
+ * write, own wlock
+ * -,x no execute, execute
+ */
+#ifdef MULTIUSER
+ (AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' :
+ ((w->w_wlock == WLOCK_OFF || d->d_user == w->w_wlockuser) ?
+ 'r' : 'R')),
+ (AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' :
+ ((w->w_wlock == WLOCK_OFF) ? 'w' :
+ ((d->d_user == w->w_wlockuser) ? 'W' : 'v'))),
+ (AclCheckPermWin(d->d_user, ACL_READ, w) ? '-' : 'x')
+#else
+ 'r', 'w', 'x'
+#endif
+ );
+ }
+ leftline(tbuf, y);
+ y++;
+ }
+ sprintf(tbuf,"[Press Space %s Return to end.]",
+ 1 ? "to refresh;" : "or");
+ centerline(tbuf, flayer->l_height - 2);
+ SetCursor();
+}
+
+static void
+DisplaysRedisplayLine(y, xs, xe, isblank)
+int y, xs, xe, isblank;
+{
+ ASSERT(flayer);
+ if (y < 0)
+ {
+ struct displaysdata *displaysdata;
+
+ displaysdata = (struct displaysdata *)flayer->l_data;
+ displayspage();
+ return;
+ }
+ if (y != 0 && y != flayer->l_height - 1)
+ return;
+ if (isblank)
+ return;
+ LClear(flayer, xs, y, xe, y, 0);
/* To be filled in... */
}
+
/*
**
** The bindkey help page
@@ -663,7 +840,6 @@ extern struct term term[];
static void BindkeyProcess __P((char **, int *));
static void BindkeyAbort __P((void));
static void BindkeyRedisplayLine __P((int, int, int, int));
-static void BindkeySetCursor __P((void));
static void bindkeypage __P((void));
struct bindkeydata
@@ -683,7 +859,6 @@ static struct LayFuncs BindkeyLf =
BindkeyRedisplayLine,
DefClearLine,
DefRewrite,
- BindkeySetCursor,
DefResize,
DefRestore
};
@@ -697,17 +872,15 @@ struct action *tab;
struct bindkeydata *bindkeydata;
int i, n;
- if (display == 0)
- return;
- if (D_height < 6)
+ if (flayer->l_height < 6)
{
- Msg(0, "Window height too small for bindkey page");
+ LMsg(0, "Window height too small for bindkey page");
return;
}
if (InitOverlayPage(sizeof(*bindkeydata), &BindkeyLf, 0))
return;
- bindkeydata = (struct bindkeydata *)D_lay->l_data;
+ bindkeydata = (struct bindkeydata *)flayer->l_data;
bindkeydata->title = title;
bindkeydata->tab = tab;
@@ -719,22 +892,18 @@ struct action *tab;
}
bindkeydata->pos = 0;
bindkeydata->page = 1;
- bindkeydata->pages = (n + D_height - 6) / (D_height - 5);
+ bindkeydata->pages = (n + flayer->l_height - 6) / (flayer->l_height - 5);
if (bindkeydata->pages == 0)
bindkeydata->pages = 1;
+ flayer->l_x = 0;
+ flayer->l_y = flayer->l_height - 1;
bindkeypage();
}
static void
-BindkeySetCursor()
-{
- GotoPos(0, D_height - 1);
-}
-
-static void
BindkeyAbort()
{
- LAY_CALL_UP(Activate(0));
+ LAY_CALL_UP(RedisplayLayer(flayer, 0));
ExitOverlayPage();
}
@@ -747,16 +916,14 @@ bindkeypage()
struct action *act;
char *xch, *s, *p;
- bindkeydata = (struct bindkeydata *)D_lay->l_data;
+ bindkeydata = (struct bindkeydata *)flayer->l_data;
- SetRendition(&mchar_null);
- ClearDisplay();
+ ClearLayer(flayer, 0);
sprintf(tbuf, "%s key bindings, page %d of %d.", bindkeydata->title, bindkeydata->page, bindkeydata->pages);
- centerline(tbuf);
- AddChar('\n');
- y = D_height - 5;
- for (i = bindkeydata->pos; i < KMAP_KEYS+KMAP_AKEYS+KMAP_EXT && y; i++)
+ centerline(tbuf, 0);
+ y = 2;
+ for (i = bindkeydata->pos; i < KMAP_KEYS+KMAP_AKEYS+KMAP_EXT && y < flayer->l_height - 3; i++)
{
p = tbuf;
act = &bindkeydata->tab[i];
@@ -790,23 +957,20 @@ bindkeypage()
*p++ = ' ';
sprintf(p, "%s -> ", xch);
p += 7;
- if (p - tbuf > D_width - 1)
+ if (p - tbuf > flayer->l_width - 1)
{
- tbuf[D_width - 2] = '$';
- tbuf[D_width - 1] = 0;
+ tbuf[flayer->l_width - 2] = '$';
+ tbuf[flayer->l_width - 1] = 0;
}
- AddStr(tbuf);
- AddAction(act, D_width - 1 - strlen(tbuf));
- AddStr("\r\n");
- y--;
+ PadStr(tbuf, strlen(tbuf), 0, y);
+ AddAction(act, strlen(tbuf), y);
+ y++;
}
y++;
- while(y--)
- AddChar('\n');
bindkeydata->last = i;
sprintf(tbuf,"[Press Space %s Return to end.]", bindkeydata->page < bindkeydata->pages ? "for next page;" : "or");
- centerline(tbuf);
- SetLastPos(0, D_height-1);
+ centerline(tbuf, flayer->l_height - 2);
+ SetCursor();
}
static void
@@ -817,8 +981,7 @@ int *plen;
int done = 0;
struct bindkeydata *bindkeydata;
- bindkeydata = (struct bindkeydata *)D_lay->l_data;
- GotoPos(0, D_height-1);
+ bindkeydata = (struct bindkeydata *)flayer->l_data;
while (!done && *plen > 0)
{
switch (**ppbuf)
@@ -855,11 +1018,29 @@ int y, xs, xe, isblank;
bindkeypage();
return;
}
- if (y != 0 && y != D_height - 1)
+ if (y != 0 && y != flayer->l_height - 1)
return;
- if (isblank)
- return;
- Clear(xs, y, xs, xe, xe, y, 0);
+ if (!isblank)
+ LClear(flayer, xs, y, xe, y, 0);
+}
+
+#endif /* MAPKEYS */
+
+
+
+
+static void
+PadStr(str, n, x, y)
+char *str;
+int n, x, y;
+{
+ int l;
+
+ l = strlen(str);
+ if (l > n)
+ l = n;
+ LPutStr(flayer, str, l, &mchar_blank, x, y);
+ if (l < n)
+ LPutStr(flayer, blank, n - l, &mchar_blank, x + l, y);
}
-#endif