aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/less/prompt.c')
-rw-r--r--contrib/less/prompt.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/contrib/less/prompt.c b/contrib/less/prompt.c
index e587bd762000..0e38c0f6e438 100644
--- a/contrib/less/prompt.c
+++ b/contrib/less/prompt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2020 Mark Nudelman
+ * Copyright (C) 1984-2021 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
@@ -123,7 +123,7 @@ ap_pos(pos)
/*
* Append a line number to the end of the message.
*/
- static void
+ static void
ap_linenum(linenum)
LINENUM linenum;
{
@@ -187,48 +187,48 @@ cond(c, where)
switch (c)
{
- case 'a': /* Anything in the message yet? */
+ case 'a': /* Anything in the message yet? */
return (mp > message);
- case 'b': /* Current byte offset known? */
+ case 'b': /* Current byte offset known? */
return (curr_byte(where) != NULL_POSITION);
case 'c':
return (hshift != 0);
- case 'e': /* At end of file? */
+ case 'e': /* At end of file? */
return (eof_displayed());
- case 'f': /* Filename known? */
+ case 'f': /* Filename known? */
case 'g':
return (strcmp(get_filename(curr_ifile), "-") != 0);
- case 'l': /* Line number known? */
- case 'd': /* Same as l */
+ case 'l': /* Line number known? */
+ case 'd': /* Same as l */
if (!linenums)
return 0;
return (currline(where) != 0);
- case 'L': /* Final line number known? */
- case 'D': /* Final page number known? */
+ case 'L': /* Final line number known? */
+ case 'D': /* Final page number known? */
return (linenums && ch_length() != NULL_POSITION);
- case 'm': /* More than one file? */
+ case 'm': /* More than one file? */
#if TAGS
return (ntags() ? (ntags() > 1) : (nifile() > 1));
#else
return (nifile() > 1);
#endif
- case 'n': /* First prompt in a new file? */
+ case 'n': /* First prompt in a new file? */
#if TAGS
return (ntags() ? 1 : new_file);
#else
return (new_file);
#endif
- case 'p': /* Percent into file (bytes) known? */
+ case 'p': /* Percent into file (bytes) known? */
return (curr_byte(where) != NULL_POSITION &&
ch_length() > 0);
- case 'P': /* Percent into file (lines) known? */
+ case 'P': /* Percent into file (lines) known? */
return (currline(where) != 0 &&
(len = ch_length()) > 0 &&
find_linenum(len) != 0);
- case 's': /* Size of file known? */
+ case 's': /* Size of file known? */
case 'B':
return (ch_length() != NULL_POSITION);
- case 'x': /* Is there a "next" file? */
+ case 'x': /* Is there a "next" file? */
#if TAGS
if (ntags())
return (0);
@@ -264,7 +264,7 @@ protochar(c, where, iseditproto)
switch (c)
{
- case 'b': /* Current byte offset */
+ case 'b': /* Current byte offset */
pos = curr_byte(where);
if (pos != NULL_POSITION)
ap_pos(pos);
@@ -274,14 +274,14 @@ protochar(c, where, iseditproto)
case 'c':
ap_int(hshift);
break;
- case 'd': /* Current page number */
+ case 'd': /* Current page number */
linenum = currline(where);
if (linenum > 0 && sc_height > 1)
ap_linenum(PAGE_NUM(linenum));
else
ap_quest();
break;
- case 'D': /* Final page number */
+ case 'D': /* Final page number */
/* Find the page number of the last byte in the file (len-1). */
len = ch_length();
if (len == NULL_POSITION)
@@ -299,22 +299,22 @@ protochar(c, where, iseditproto)
}
break;
#if EDITOR
- case 'E': /* Editor name */
+ case 'E': /* Editor name */
ap_str(editor);
break;
#endif
- case 'f': /* File name */
+ case 'f': /* File name */
ap_str(get_filename(curr_ifile));
break;
- case 'F': /* Last component of file name */
+ case 'F': /* Last component of file name */
ap_str(last_component(get_filename(curr_ifile)));
break;
- case 'g': /* Shell-escaped file name */
+ case 'g': /* Shell-escaped file name */
s = shell_quote(get_filename(curr_ifile));
ap_str(s);
free(s);
break;
- case 'i': /* Index into list of files */
+ case 'i': /* Index into list of files */
#if TAGS
if (ntags())
ap_int(curr_tag());
@@ -322,14 +322,14 @@ protochar(c, where, iseditproto)
#endif
ap_int(get_index(curr_ifile));
break;
- case 'l': /* Current line number */
+ case 'l': /* Current line number */
linenum = currline(where);
if (linenum != 0)
ap_linenum(linenum);
else
ap_quest();
break;
- case 'L': /* Final line number */
+ case 'L': /* Final line number */
len = ch_length();
if (len == NULL_POSITION || len == ch_zero() ||
(linenum = find_linenum(len)) <= 0)
@@ -337,7 +337,7 @@ protochar(c, where, iseditproto)
else
ap_linenum(linenum-1);
break;
- case 'm': /* Number of files */
+ case 'm': /* Number of files */
#if TAGS
n = ntags();
if (n)
@@ -346,7 +346,7 @@ protochar(c, where, iseditproto)
#endif
ap_int(nifile());
break;
- case 'p': /* Percent into file (bytes) */
+ case 'p': /* Percent into file (bytes) */
pos = curr_byte(where);
len = ch_length();
if (pos != NULL_POSITION && len > 0)
@@ -354,7 +354,7 @@ protochar(c, where, iseditproto)
else
ap_quest();
break;
- case 'P': /* Percent into file (lines) */
+ case 'P': /* Percent into file (lines) */
linenum = currline(where);
if (linenum == 0 ||
(len = ch_length()) == NULL_POSITION || len == ch_zero() ||
@@ -363,7 +363,7 @@ protochar(c, where, iseditproto)
else
ap_int(percentage(linenum, last_linenum));
break;
- case 's': /* Size of file */
+ case 's': /* Size of file */
case 'B':
len = ch_length();
if (len != NULL_POSITION)
@@ -371,12 +371,12 @@ protochar(c, where, iseditproto)
else
ap_quest();
break;
- case 't': /* Truncate trailing spaces in the message */
+ case 't': /* Truncate trailing spaces in the message */
while (mp > message && mp[-1] == ' ')
mp--;
*mp = '\0';
break;
- case 'T': /* Type of list */
+ case 'T': /* Type of list */
#if TAGS
if (ntags())
ap_str("tag");
@@ -384,7 +384,7 @@ protochar(c, where, iseditproto)
#endif
ap_str("file");
break;
- case 'x': /* Name of next file */
+ case 'x': /* Name of next file */
h = next_ifile(curr_ifile);
if (h != NULL_IFILE)
ap_str(get_filename(h));
@@ -469,12 +469,12 @@ wherechar(p, wp)
case 'b': case 'd': case 'l': case 'p': case 'P':
switch (*++p)
{
- case 't': *wp = TOP; break;
- case 'm': *wp = MIDDLE; break;
- case 'b': *wp = BOTTOM; break;
- case 'B': *wp = BOTTOM_PLUS_ONE; break;
+ case 't': *wp = TOP; break;
+ case 'm': *wp = MIDDLE; break;
+ case 'b': *wp = BOTTOM; break;
+ case 'B': *wp = BOTTOM_PLUS_ONE; break;
case 'j': *wp = sindex_from_sline(jump_sline); break;
- default: *wp = TOP; p--; break;
+ default: *wp = TOP; p--; break;
}
}
return (p);
@@ -501,14 +501,14 @@ pr_expand(proto, maxwidth)
{
switch (*p)
{
- default: /* Just put the character in the message */
+ default: /* Just put the character in the message */
ap_char(*p);
break;
- case '\\': /* Backslash escapes the next character */
+ case '\\': /* Backslash escapes the next character */
p++;
ap_char(*p);
break;
- case '?': /* Conditional (IF) */
+ case '?': /* Conditional (IF) */
if ((c = *++p) == '\0')
--p;
else
@@ -519,12 +519,12 @@ pr_expand(proto, maxwidth)
p = skipcond(p);
}
break;
- case ':': /* ELSE */
+ case ':': /* ELSE */
p = skipcond(p);
break;
- case '.': /* ENDIF */
+ case '.': /* ENDIF */
break;
- case '%': /* Percent escape */
+ case '%': /* Percent escape */
if ((c = *++p) == '\0')
--p;
else