version 1.1.1.3, 2011/09/16 17:47:07 |
version 1.1.1.4, 2014/04/25 13:33:50 |
|
|
/* |
/* |
* Copyright (C) 1984-2011 Mark Nudelman |
* Copyright (C) 1984-2012 Mark Nudelman |
* |
* |
* You may distribute under the terms of either the GNU General Public |
* You may distribute under the terms of either the GNU General Public |
* License or the Less License, as specified in the README file. |
* License or the Less License, as specified in the README file. |
* |
* |
* For more information about less, or for information on how to |
* For more information, see the README file. |
* contact the author, see the README file. |
|
*/ |
*/ |
|
|
|
|
|
|
static constant char s_proto[] = |
static constant char s_proto[] = |
"?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\\: %x..%t"; |
"?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\\: %x..%t"; |
static constant char m_proto[] = |
static constant char m_proto[] = |
"?n?f%f .?m(%T %i of %m) ..?e(END) ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t"; |
"?f%f .?m(%T %i of %m) .?e(END) ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t"; |
static constant char M_proto[] = |
static constant char M_proto[] = |
"?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t"; |
"?f%f .?n?m(%T %i of %m) ..?ltlines %lt-%lb?L/%L. :byte %bB?s/%s. .?e(END) ?x- Next\\: %x.:?pB%pB\\%..%t"; |
static constant char e_proto[] = |
static constant char e_proto[] = |
|
|
"HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done"; |
"HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done"; |
static constant char w_proto[] = |
static constant char w_proto[] = |
"Waiting for data"; |
"Waiting for data"; |
static constant char more_proto[] = |
|
"--More--(?eEND ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t)"; |
|
|
|
public char *prproto[3]; |
public char *prproto[3]; |
public char constant *eqproto = e_proto; |
public char constant *eqproto = e_proto; |
|
|
init_prompt() |
init_prompt() |
{ |
{ |
prproto[0] = save(s_proto); |
prproto[0] = save(s_proto); |
prproto[1] = save(less_is_more ? more_proto : m_proto); |
prproto[1] = save(m_proto); |
prproto[2] = save(M_proto); |
prproto[2] = save(M_proto); |
eqproto = save(e_proto); |
eqproto = save(e_proto); |
hproto = save(h_proto); |
hproto = save(h_proto); |
|
|
{ |
{ |
char buf[INT_STRLEN_BOUND(pos) + 2]; |
char buf[INT_STRLEN_BOUND(pos) + 2]; |
|
|
postoa(pos, buf); |
postoa(pos, buf, sizeof(buf)); |
ap_str(buf); |
ap_str(buf); |
} |
} |
|
|
|
|
{ |
{ |
char buf[INT_STRLEN_BOUND(linenum) + 2]; |
char buf[INT_STRLEN_BOUND(linenum) + 2]; |
|
|
linenumtoa(linenum, buf); |
linenumtoa(linenum, buf, sizeof(buf)); |
ap_str(buf); |
ap_str(buf); |
} |
} |
|
|
|
|
{ |
{ |
char buf[INT_STRLEN_BOUND(num) + 2]; |
char buf[INT_STRLEN_BOUND(num) + 2]; |
|
|
inttoa(num, buf); |
inttoa(num, buf, sizeof(buf)); |
ap_str(buf); |
ap_str(buf); |
} |
} |
|
|
|
|
* where to resume parsing the string. |
* where to resume parsing the string. |
* We must keep track of nested IFs and skip them properly. |
* We must keep track of nested IFs and skip them properly. |
*/ |
*/ |
static char * |
static constant char * |
skipcond(p) |
skipcond(p) |
register char *p; |
register constant char *p; |
{ |
{ |
register int iflevel; |
register int iflevel; |
|
|
|
|
/* |
/* |
* Decode a char that represents a position on the screen. |
* Decode a char that represents a position on the screen. |
*/ |
*/ |
static char * |
static constant char * |
wherechar(p, wp) |
wherechar(p, wp) |
char *p; |
char constant *p; |
int *wp; |
int *wp; |
{ |
{ |
switch (*p) |
switch (*p) |
|
|
*/ |
*/ |
public char * |
public char * |
pr_expand(proto, maxwidth) |
pr_expand(proto, maxwidth) |
char *proto; |
constant char *proto; |
int maxwidth; |
int maxwidth; |
{ |
{ |
register char *p; |
register constant char *p; |
register int c; |
register int c; |
int where; |
int where; |
|
|