mirror of
https://git.savannah.gnu.org/git/screen.git
synced 2026-02-10 09:22:04 +02:00
clean copyright stuff from help.[ch]
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
This commit is contained in:
191
src/help.c
191
src/help.c
@@ -407,197 +407,6 @@ static void HelpRedisplayLine(int y, int xs, int xe, int isblank)
|
||||
LClearArea(flayer, xs, y, xe, y, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
** here is all the copyright stuff
|
||||
**
|
||||
*/
|
||||
|
||||
static void CopyrightProcess(char **, size_t *);
|
||||
static void CopyrightRedisplayLine(int, int, int, int);
|
||||
static void CopyrightAbort(void);
|
||||
static void copypage(void);
|
||||
|
||||
struct copydata {
|
||||
char *cps, *savedcps; /* position in the message */
|
||||
char *refcps, *refsavedcps; /* backup for redisplaying */
|
||||
};
|
||||
|
||||
static const struct LayFuncs CopyrightLf = {
|
||||
CopyrightProcess,
|
||||
CopyrightAbort,
|
||||
CopyrightRedisplayLine,
|
||||
DefClearLine,
|
||||
DefResize,
|
||||
DefRestore,
|
||||
0
|
||||
};
|
||||
|
||||
static const char cpmsg[] = "\
|
||||
\n\
|
||||
Screen version %v\n\
|
||||
\n\
|
||||
Copyright (c) 2015-2017 Juergen Weigert, Alexander Naumov, Amadeusz Slawinski\n\
|
||||
Copyright (c) 2010-2014 Juergen Weigert, Sadrul Habib Chowdhury\n\
|
||||
Copyright (c) 2008-2009 Juergen Weigert, Michael Schroeder, Micah Cowan, Sadrul Habib Chowdhury\n\
|
||||
Copyright (c) 1993-2007 Juergen Weigert, Michael Schroeder\n\
|
||||
Copyright (c) 1987 Oliver Laumann\n\
|
||||
\n\
|
||||
This program is free software; you can redistribute it and/or \
|
||||
modify it under the terms of the GNU General Public License as published \
|
||||
by the Free Software Foundation; either version 3, or (at your option) \
|
||||
any later version.\n\
|
||||
\n\
|
||||
This program is distributed in the hope that it will be useful, \
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of \
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
|
||||
GNU General Public License for more details.\n\
|
||||
\n\
|
||||
You should have received a copy of the GNU General Public License \
|
||||
along with this program (see the file COPYING); if not, see \
|
||||
http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., \
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA.\n\
|
||||
\n\
|
||||
Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to \
|
||||
screen-devel@gnu.org\n\n\n"
|
||||
#ifdef ENABLE_TELNET
|
||||
"+builtin-telnet "
|
||||
#else
|
||||
"-builtin-telnet "
|
||||
#endif
|
||||
;
|
||||
|
||||
static void CopyrightProcess(char **ppbuf, size_t *plen)
|
||||
{
|
||||
int done = 0;
|
||||
struct copydata *copydata;
|
||||
|
||||
copydata = (struct copydata *)flayer->l_data;
|
||||
while (!done && *plen > 0) {
|
||||
switch (**ppbuf) {
|
||||
case ' ':
|
||||
if (*copydata->cps) {
|
||||
copypage();
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case '\r':
|
||||
case '\n':
|
||||
CopyrightAbort();
|
||||
done = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
++*ppbuf;
|
||||
--*plen;
|
||||
}
|
||||
}
|
||||
|
||||
static void CopyrightAbort()
|
||||
{
|
||||
LAY_CALL_UP(LRefreshAll(flayer, 0));
|
||||
ExitOverlayPage();
|
||||
}
|
||||
|
||||
void display_copyright()
|
||||
{
|
||||
struct copydata *copydata;
|
||||
|
||||
if (flayer->l_width < 10 || flayer->l_height < 5) {
|
||||
LMsg(0, "Window size too small for copyright page");
|
||||
return;
|
||||
}
|
||||
if (InitOverlayPage(sizeof(struct copydata), &CopyrightLf, 0))
|
||||
return;
|
||||
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();
|
||||
}
|
||||
|
||||
static void copypage()
|
||||
{
|
||||
char *cps;
|
||||
char *ws;
|
||||
int x, y, l;
|
||||
char cbuf[80];
|
||||
struct copydata *copydata;
|
||||
|
||||
copydata = (struct copydata *)flayer->l_data;
|
||||
|
||||
LClearAll(flayer, 0);
|
||||
x = y = 0;
|
||||
cps = copydata->cps;
|
||||
copydata->refcps = cps;
|
||||
copydata->refsavedcps = copydata->savedcps;
|
||||
while (*cps && y < flayer->l_height - 3) {
|
||||
ws = cps;
|
||||
while (*cps == ' ')
|
||||
cps++;
|
||||
if (strncmp(cps, "%v", 2) == 0) {
|
||||
copydata->savedcps = cps + 2;
|
||||
cps = version;
|
||||
continue;
|
||||
}
|
||||
while (*cps && *cps != ' ' && *cps != '\n')
|
||||
cps++;
|
||||
l = cps - ws;
|
||||
cps = ws;
|
||||
if (l > flayer->l_width - 1)
|
||||
l = flayer->l_width - 1;
|
||||
if (x && x + l >= flayer->l_width - 2) {
|
||||
x = 0;
|
||||
y++;
|
||||
continue;
|
||||
}
|
||||
if (x) {
|
||||
LPutChar(flayer, &mchar_blank, x, y);
|
||||
x++;
|
||||
}
|
||||
if (l)
|
||||
LPutStr(flayer, ws, l, &mchar_blank, x, y);
|
||||
x += l;
|
||||
cps += l;
|
||||
if (*cps == 0 && copydata->savedcps) {
|
||||
cps = copydata->savedcps;
|
||||
copydata->savedcps = 0;
|
||||
}
|
||||
if (*cps == '\n') {
|
||||
x = 0;
|
||||
y++;
|
||||
}
|
||||
if (*cps == ' ' || *cps == '\n')
|
||||
cps++;
|
||||
}
|
||||
while (*cps == '\n')
|
||||
cps++;
|
||||
sprintf(cbuf, "[Press Space %s Return to end.]", *cps ? "for next page;" : "or");
|
||||
centerline(cbuf, flayer->l_height - 2);
|
||||
copydata->cps = cps;
|
||||
LaySetCursor();
|
||||
}
|
||||
|
||||
static void CopyrightRedisplayLine(int y, int xs, int xe, int isblank)
|
||||
{
|
||||
if (y < 0) {
|
||||
struct copydata *copydata;
|
||||
|
||||
copydata = (struct copydata *)flayer->l_data;
|
||||
copydata->cps = copydata->refcps;
|
||||
copydata->savedcps = copydata->refsavedcps;
|
||||
copypage();
|
||||
return;
|
||||
}
|
||||
if (y != 0 && y != flayer->l_height - 1)
|
||||
return;
|
||||
if (isblank)
|
||||
return;
|
||||
LClearArea(flayer, xs, y, xe, y, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
** The bindkey help page
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
void exit_with_usage (char *, char *, char *);
|
||||
void display_help (char *, struct action *);
|
||||
void display_copyright (void);
|
||||
void display_displays (void);
|
||||
void display_bindkey (char *, struct action *);
|
||||
int InWList (void);
|
||||
void WListUpdatecv (Canvas *, Window *);
|
||||
|
||||
Reference in New Issue
Block a user