Michael McConville
2016-01-29 16:33:50 UTC
Does this make sense?
Note that screen_crashed can also be 2, so we leave it as an int.
Assigning it to TRUE seems to have been a mistake.
No binary change, surprisingly.
Index: ch.c
===================================================================
RCS file: /cvs/src/usr.bin/less/ch.c,v
retrieving revision 1.16
diff -u -p -r1.16 ch.c
--- ch.c 27 Dec 2015 17:51:19 -0000 1.16
+++ ch.c 29 Jan 2016 16:29:30 -0000
@@ -141,7 +141,7 @@ ch_get(void)
struct buf *bp;
struct bufnode *bn;
int n;
- int slept;
+ bool slept;
int h;
off_t pos;
off_t len;
@@ -159,7 +159,7 @@ ch_get(void)
return (bp->data[ch_offset]);
}
- slept = FALSE;
+ slept = false;
/*
* Look for a buffer holding the desired block.
@@ -282,7 +282,7 @@ read_more:
ierror("%s", &parg);
}
sleep(1);
- slept = TRUE;
+ slept = true;
if (follow_mode == FOLLOW_NAME) {
/*
@@ -352,12 +352,12 @@ ch_ungetchar(int c)
void
end_logfile(void)
{
- static int tried = FALSE;
+ static bool tried = false;
if (logfile < 0)
return;
if (!tried && ch_fsize == -1) {
- tried = TRUE;
+ tried = true;
ierror("Finishing logfile", NULL);
while (ch_forw_get() != EOI)
if (ABORT_SIGS())
@@ -378,25 +378,25 @@ sync_logfile(void)
{
struct buf *bp;
struct bufnode *bn;
- int warned = FALSE;
+ bool warned = false;
BLOCKNUM block;
BLOCKNUM nblocks;
nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE;
for (block = 0; block < nblocks; block++) {
- int wrote = FALSE;
+ bool wrote = false;
FOR_BUFS(bn) {
bp = bufnode_buf(bn);
if (bp->block == block) {
(void) write(logfile, (char *)bp->data,
bp->datasize);
- wrote = TRUE;
+ wrote = true;
break;
}
}
if (!wrote && !warned) {
error("Warning: log file is incomplete", NULL);
- warned = TRUE;
+ warned = true;
}
}
}
@@ -404,7 +404,7 @@ sync_logfile(void)
/*
* Determine if a specific block is currently in one of the buffers.
*/
-static int
+static bool
buffered(BLOCKNUM block)
{
struct buf *bp;
@@ -415,9 +415,9 @@ buffered(BLOCKNUM block)
FOR_BUFS_IN_CHAIN(h, bn) {
bp = bufnode_buf(bn);
if (bp->block == block)
- return (TRUE);
+ return true;
}
- return (FALSE);
+ return false;
}
/*
@@ -785,7 +785,7 @@ ch_init(int f, int flags)
void
ch_close(void)
{
- int keepstate = FALSE;
+ bool keepstate = false;
if (thisfile == NULL)
return;
@@ -796,7 +796,7 @@ ch_close(void)
*/
ch_delbufs();
} else {
- keepstate = TRUE;
+ keepstate = true;
}
if (!(ch_flags & CH_KEEPOPEN)) {
/*
@@ -809,7 +809,7 @@ ch_close(void)
close(ch_file);
ch_file = -1;
} else {
- keepstate = TRUE;
+ keepstate = true;
}
if (!keepstate) {
/*
Index: command.c
===================================================================
RCS file: /cvs/src/usr.bin/less/command.c,v
retrieving revision 1.28
diff -u -p -r1.28 command.c
--- command.c 12 Jan 2016 17:48:04 -0000 1.28
+++ command.c 29 Jan 2016 16:29:30 -0000
@@ -20,7 +20,7 @@
extern int erase_char, erase2_char, kill_char;
extern volatile sig_atomic_t sigs;
-extern int quit_if_one_screen;
+extern bool quit_if_one_screen;
extern int less_is_more;
extern int squished;
extern int sc_width;
@@ -270,7 +270,7 @@ mca_opt_first_char(int c)
switch (c) {
case '_':
/* "__" = long option name. */
- optgetname = TRUE;
+ optgetname = true;
mca_opt_toggle();
return (MCA_MORE);
}
@@ -292,7 +292,7 @@ mca_opt_first_char(int c)
return (MCA_MORE);
case '-':
/* "--" = long option name. */
- optgetname = TRUE;
+ optgetname = true;
mca_opt_toggle();
return (MCA_MORE);
}
@@ -377,7 +377,7 @@ mca_opt_char(int c)
error("There is no --%s option", &parg);
return (MCA_DONE);
}
- optgetname = FALSE;
+ optgetname = false;
cmd_reset();
} else {
if (is_erase_char(c))
@@ -1518,7 +1518,7 @@ again:
case A_OPT_TOGGLE:
optflag = OPT_TOGGLE;
- optgetname = FALSE;
+ optgetname = false;
mca_opt_toggle();
c = getcc();
goto again;
@@ -1528,7 +1528,7 @@ again:
* Report a flag setting.
*/
optflag = OPT_NO_TOGGLE;
- optgetname = FALSE;
+ optgetname = false;
mca_opt_toggle();
c = getcc();
goto again;
Index: edit.c
===================================================================
RCS file: /cvs/src/usr.bin/less/edit.c,v
retrieving revision 1.21
diff -u -p -r1.21 edit.c
--- edit.c 12 Jan 2016 23:01:23 -0000 1.21
+++ edit.c 29 Jan 2016 16:29:30 -0000
@@ -17,7 +17,7 @@ static int fd0 = 0;
extern int new_file;
extern int errmsgs;
extern char *every_first_cmd;
-extern int any_display;
+extern bool any_display;
extern int force_open;
extern int is_tty;
extern volatile sig_atomic_t sigs;
@@ -29,7 +29,7 @@ extern char openquote;
extern char closequote;
extern int less_is_more;
extern int logfile;
-extern int force_logfile;
+extern bool force_logfile;
extern char *namelogfile;
dev_t curr_dev;
@@ -327,7 +327,7 @@ err1:
curr_altpipe = alt_pipe;
set_open(curr_ifile); /* File has been opened */
get_pos(curr_ifile, &initial_scrpos);
- new_file = TRUE;
+ new_file = true;
ch_init(f, chflags);
if (!(chflags & CH_HELPFILE)) {
@@ -348,7 +348,7 @@ err1:
free(qopen_filename);
no_display = !any_display;
flush(0);
- any_display = TRUE;
+ any_display = true;
if (is_tty) {
/*
Index: forwback.c
===================================================================
RCS file: /cvs/src/usr.bin/less/forwback.c,v
retrieving revision 1.11
diff -u -p -r1.11 forwback.c
--- forwback.c 6 Nov 2015 15:50:33 -0000 1.11
+++ forwback.c 29 Jan 2016 16:29:30 -0000
@@ -26,7 +26,7 @@ extern volatile sig_atomic_t sigs;
extern int top_scroll;
extern int quiet;
extern int sc_width, sc_height;
-extern int plusoption;
+extern bool plusoption;
extern int forw_scroll;
extern int back_scroll;
extern int ignore_eoi;
Index: input.c
===================================================================
RCS file: /cvs/src/usr.bin/less/input.c,v
retrieving revision 1.10
diff -u -p -r1.10 input.c
--- input.c 6 Nov 2015 15:50:33 -0000 1.10
+++ input.c 29 Jan 2016 16:29:30 -0000
@@ -24,7 +24,7 @@
extern int squeeze;
extern int chopline;
extern int hshift;
-extern int quit_if_one_screen;
+extern bool quit_if_one_screen;
extern volatile sig_atomic_t sigs;
extern int ignore_eoi;
extern int status_col;
@@ -140,9 +140,9 @@ get_forw_line:
new_pos = ch_tell();
if (backchars > 0 && !chopline && hshift == 0) {
new_pos -= backchars + 1;
- endline = FALSE;
+ endline = false;
} else
- endline = TRUE;
+ endline = true;
break;
}
if (c != '\r')
@@ -167,11 +167,11 @@ get_forw_line:
c = ch_forw_get();
} while (c != '\n' && c != EOI);
new_pos = ch_tell();
- endline = TRUE;
- quit_if_one_screen = FALSE;
+ endline = true;
+ quit_if_one_screen = false;
} else {
new_pos = ch_tell() - backchars;
- endline = FALSE;
+ endline = false;
}
break;
}
@@ -309,7 +309,7 @@ get_back_line:
null_line();
return (-1);
}
- endline = FALSE;
+ endline = false;
prewind();
plinenum(new_pos);
loop:
@@ -329,7 +329,7 @@ loop:
backchars++;
goto shift;
}
- endline = TRUE;
+ endline = true;
break;
}
backchars = pappend(c, ch_tell()-1);
@@ -340,8 +340,8 @@ loop:
* and start a new one.
*/
if (chopline || hshift > 0) {
- endline = TRUE;
- quit_if_one_screen = FALSE;
+ endline = true;
+ quit_if_one_screen = false;
break;
}
shift:
Index: less.h
===================================================================
RCS file: /cvs/src/usr.bin/less/less.h,v
retrieving revision 1.26
diff -u -p -r1.26 less.h
--- less.h 29 Jan 2016 16:13:17 -0000 1.26
+++ less.h 29 Jan 2016 16:29:30 -0000
@@ -22,6 +22,7 @@
#include <libgen.h>
#include <limits.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -40,13 +41,6 @@
#define IS_DIGIT(c) isdigit((unsigned char)(c))
#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI))
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
#define OPT_OFF 0
#define OPT_ON 1
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/less/main.c,v
retrieving revision 1.32
diff -u -p -r1.32 main.c
--- main.c 12 Jan 2016 23:01:23 -0000 1.32
+++ main.c 29 Jan 2016 16:29:30 -0000
@@ -24,7 +24,7 @@ int is_tty;
IFILE curr_ifile = NULL;
IFILE old_ifile = NULL;
struct scrpos initial_scrpos;
-int any_display = FALSE;
+bool any_display = false;
off_t start_attnpos = -1;
off_t end_attnpos = -1;
int wscroll;
@@ -36,7 +36,7 @@ int secure;
int dohelp;
int logfile = -1;
-int force_logfile = FALSE;
+bool force_logfile = false;
char *namelogfile = NULL;
char *editor;
char *editproto;
@@ -47,7 +47,7 @@ extern int jump_sline;
extern int less_is_more;
extern int missing_cap;
extern int know_dumb;
-extern int quit_if_one_screen;
+extern bool quit_if_one_screen;
extern int quit_at_eof;
extern int pr_type;
extern int hilite_search;
Index: optfunc.c
===================================================================
RCS file: /cvs/src/usr.bin/less/optfunc.c,v
retrieving revision 1.14
diff -u -p -r1.14 optfunc.c
--- optfunc.c 12 Jan 2016 23:01:23 -0000 1.14
+++ optfunc.c 29 Jan 2016 16:29:30 -0000
@@ -30,13 +30,13 @@
extern int bufspace;
extern int pr_type;
-extern int plusoption;
+extern bool plusoption;
extern int swindow;
extern int sc_width;
extern int sc_height;
extern int secure;
extern int dohelp;
-extern int any_display;
+extern bool any_display;
extern char openquote;
extern char closequote;
extern char *prproto[];
@@ -49,7 +49,7 @@ extern int jump_sline;
extern int jump_sline_fraction;
extern int less_is_more;
extern char *namelogfile;
-extern int force_logfile;
+extern bool force_logfile;
extern int logfile;
char *tagoption = NULL;
extern char *tags;
@@ -104,7 +104,7 @@ opt_o(int type, char *s)
void
opt__O(int type, char *s)
{
- force_logfile = TRUE;
+ force_logfile = true;
opt_o(type, s);
}
@@ -310,7 +310,7 @@ opt_p(int type, char *s)
* {{ This won't work if the "/" command is
* changed or invalidated by a .lesskey file. }}
*/
- plusoption = TRUE;
+ plusoption = true;
ungetsc(s);
/*
* In "more" mode, the -p argument is a command,
Index: option.c
===================================================================
RCS file: /cvs/src/usr.bin/less/option.c,v
retrieving revision 1.15
diff -u -p -r1.15 option.c
--- option.c 23 Nov 2015 09:26:51 -0000 1.15
+++ option.c 29 Jan 2016 16:29:30 -0000
@@ -22,7 +22,7 @@
#include "option.h"
static struct loption *pendopt;
-int plusoption = FALSE;
+bool plusoption = false;
static char *optstring(char *, char **, char *, char *);
static int flip_triple(int, int);
@@ -103,7 +103,7 @@ scan_option(char *s)
return;
}
- set_default = FALSE;
+ set_default = false;
optname = NULL;
moreopt = 0;
o = NULL;
@@ -146,7 +146,7 @@ scan_option(char *s)
* "++" means process the commands at the start of
* EVERY input file.
*/
- plusoption = TRUE;
+ plusoption = true;
s = optstring(s, &str, propt('+'), NULL);
if (s == NULL)
return;
@@ -480,7 +480,7 @@ toggle_option(struct loption *o, int low
}
if (how_toggle != OPT_NO_TOGGLE && (o->otype & REPAINT))
- screen_trashed = TRUE;
+ screen_trashed = 1;
}
/*
@@ -597,7 +597,7 @@ num_error(char *printopt, int *errp)
PARG parg;
if (errp != NULL) {
- *errp = TRUE;
+ *errp = true;
return (-1);
}
if (printopt != NULL) {
@@ -620,9 +620,9 @@ getnum(char **sp, char *printopt, int *e
int neg;
s = skipsp(*sp);
- neg = FALSE;
+ neg = false;
if (*s == '-') {
- neg = TRUE;
+ neg = true;
s++;
}
if (*s < '0' || *s > '9')
@@ -633,7 +633,7 @@ getnum(char **sp, char *printopt, int *e
n = 10 * n + *s++ - '0';
*sp = s;
if (errp != NULL)
- *errp = FALSE;
+ *errp = false;
if (neg)
n = -n;
return (n);
@@ -668,7 +668,7 @@ getfraction(char **sp, char *printopt, i
frac *= 10;
*sp = s;
if (errp != NULL)
- *errp = FALSE;
+ *errp = false;
return (frac);
}
Index: opttbl.c
===================================================================
RCS file: /cvs/src/usr.bin/less/opttbl.c,v
retrieving revision 1.18
diff -u -p -r1.18 opttbl.c
--- opttbl.c 12 Nov 2015 18:46:50 -0000 1.18
+++ opttbl.c 29 Jan 2016 16:29:30 -0000
@@ -26,7 +26,7 @@ int pr_type; /* Type of prompt (short,
int bs_mode; /* How to process backspaces */
int know_dumb; /* Don't complain about dumb terminals */
int quit_at_eof; /* Quit after hitting end of file twice */
-int quit_if_one_screen; /* Quit if EOF on first screen */
+bool quit_if_one_screen;/* Quit if EOF on first screen */
int squeeze; /* Squeeze multiple blank lines into one */
int back_scroll; /* Repaint screen on backwards movement */
int forw_scroll; /* Repaint screen on forward movement */
Index: output.c
===================================================================
RCS file: /cvs/src/usr.bin/less/output.c,v
retrieving revision 1.16
diff -u -p -r1.16 output.c
--- output.c 26 Jan 2016 01:51:06 -0000 1.16
+++ output.c 29 Jan 2016 16:29:30 -0000
@@ -21,7 +21,7 @@ extern volatile sig_atomic_t sigs;
extern int sc_width;
extern int so_s_width, so_e_width;
extern int screen_trashed;
-extern int any_display;
+extern bool any_display;
extern int is_tty;
extern int oldbot;
Note that screen_crashed can also be 2, so we leave it as an int.
Assigning it to TRUE seems to have been a mistake.
No binary change, surprisingly.
Index: ch.c
===================================================================
RCS file: /cvs/src/usr.bin/less/ch.c,v
retrieving revision 1.16
diff -u -p -r1.16 ch.c
--- ch.c 27 Dec 2015 17:51:19 -0000 1.16
+++ ch.c 29 Jan 2016 16:29:30 -0000
@@ -141,7 +141,7 @@ ch_get(void)
struct buf *bp;
struct bufnode *bn;
int n;
- int slept;
+ bool slept;
int h;
off_t pos;
off_t len;
@@ -159,7 +159,7 @@ ch_get(void)
return (bp->data[ch_offset]);
}
- slept = FALSE;
+ slept = false;
/*
* Look for a buffer holding the desired block.
@@ -282,7 +282,7 @@ read_more:
ierror("%s", &parg);
}
sleep(1);
- slept = TRUE;
+ slept = true;
if (follow_mode == FOLLOW_NAME) {
/*
@@ -352,12 +352,12 @@ ch_ungetchar(int c)
void
end_logfile(void)
{
- static int tried = FALSE;
+ static bool tried = false;
if (logfile < 0)
return;
if (!tried && ch_fsize == -1) {
- tried = TRUE;
+ tried = true;
ierror("Finishing logfile", NULL);
while (ch_forw_get() != EOI)
if (ABORT_SIGS())
@@ -378,25 +378,25 @@ sync_logfile(void)
{
struct buf *bp;
struct bufnode *bn;
- int warned = FALSE;
+ bool warned = false;
BLOCKNUM block;
BLOCKNUM nblocks;
nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE;
for (block = 0; block < nblocks; block++) {
- int wrote = FALSE;
+ bool wrote = false;
FOR_BUFS(bn) {
bp = bufnode_buf(bn);
if (bp->block == block) {
(void) write(logfile, (char *)bp->data,
bp->datasize);
- wrote = TRUE;
+ wrote = true;
break;
}
}
if (!wrote && !warned) {
error("Warning: log file is incomplete", NULL);
- warned = TRUE;
+ warned = true;
}
}
}
@@ -404,7 +404,7 @@ sync_logfile(void)
/*
* Determine if a specific block is currently in one of the buffers.
*/
-static int
+static bool
buffered(BLOCKNUM block)
{
struct buf *bp;
@@ -415,9 +415,9 @@ buffered(BLOCKNUM block)
FOR_BUFS_IN_CHAIN(h, bn) {
bp = bufnode_buf(bn);
if (bp->block == block)
- return (TRUE);
+ return true;
}
- return (FALSE);
+ return false;
}
/*
@@ -785,7 +785,7 @@ ch_init(int f, int flags)
void
ch_close(void)
{
- int keepstate = FALSE;
+ bool keepstate = false;
if (thisfile == NULL)
return;
@@ -796,7 +796,7 @@ ch_close(void)
*/
ch_delbufs();
} else {
- keepstate = TRUE;
+ keepstate = true;
}
if (!(ch_flags & CH_KEEPOPEN)) {
/*
@@ -809,7 +809,7 @@ ch_close(void)
close(ch_file);
ch_file = -1;
} else {
- keepstate = TRUE;
+ keepstate = true;
}
if (!keepstate) {
/*
Index: command.c
===================================================================
RCS file: /cvs/src/usr.bin/less/command.c,v
retrieving revision 1.28
diff -u -p -r1.28 command.c
--- command.c 12 Jan 2016 17:48:04 -0000 1.28
+++ command.c 29 Jan 2016 16:29:30 -0000
@@ -20,7 +20,7 @@
extern int erase_char, erase2_char, kill_char;
extern volatile sig_atomic_t sigs;
-extern int quit_if_one_screen;
+extern bool quit_if_one_screen;
extern int less_is_more;
extern int squished;
extern int sc_width;
@@ -270,7 +270,7 @@ mca_opt_first_char(int c)
switch (c) {
case '_':
/* "__" = long option name. */
- optgetname = TRUE;
+ optgetname = true;
mca_opt_toggle();
return (MCA_MORE);
}
@@ -292,7 +292,7 @@ mca_opt_first_char(int c)
return (MCA_MORE);
case '-':
/* "--" = long option name. */
- optgetname = TRUE;
+ optgetname = true;
mca_opt_toggle();
return (MCA_MORE);
}
@@ -377,7 +377,7 @@ mca_opt_char(int c)
error("There is no --%s option", &parg);
return (MCA_DONE);
}
- optgetname = FALSE;
+ optgetname = false;
cmd_reset();
} else {
if (is_erase_char(c))
@@ -1518,7 +1518,7 @@ again:
case A_OPT_TOGGLE:
optflag = OPT_TOGGLE;
- optgetname = FALSE;
+ optgetname = false;
mca_opt_toggle();
c = getcc();
goto again;
@@ -1528,7 +1528,7 @@ again:
* Report a flag setting.
*/
optflag = OPT_NO_TOGGLE;
- optgetname = FALSE;
+ optgetname = false;
mca_opt_toggle();
c = getcc();
goto again;
Index: edit.c
===================================================================
RCS file: /cvs/src/usr.bin/less/edit.c,v
retrieving revision 1.21
diff -u -p -r1.21 edit.c
--- edit.c 12 Jan 2016 23:01:23 -0000 1.21
+++ edit.c 29 Jan 2016 16:29:30 -0000
@@ -17,7 +17,7 @@ static int fd0 = 0;
extern int new_file;
extern int errmsgs;
extern char *every_first_cmd;
-extern int any_display;
+extern bool any_display;
extern int force_open;
extern int is_tty;
extern volatile sig_atomic_t sigs;
@@ -29,7 +29,7 @@ extern char openquote;
extern char closequote;
extern int less_is_more;
extern int logfile;
-extern int force_logfile;
+extern bool force_logfile;
extern char *namelogfile;
dev_t curr_dev;
@@ -327,7 +327,7 @@ err1:
curr_altpipe = alt_pipe;
set_open(curr_ifile); /* File has been opened */
get_pos(curr_ifile, &initial_scrpos);
- new_file = TRUE;
+ new_file = true;
ch_init(f, chflags);
if (!(chflags & CH_HELPFILE)) {
@@ -348,7 +348,7 @@ err1:
free(qopen_filename);
no_display = !any_display;
flush(0);
- any_display = TRUE;
+ any_display = true;
if (is_tty) {
/*
Index: forwback.c
===================================================================
RCS file: /cvs/src/usr.bin/less/forwback.c,v
retrieving revision 1.11
diff -u -p -r1.11 forwback.c
--- forwback.c 6 Nov 2015 15:50:33 -0000 1.11
+++ forwback.c 29 Jan 2016 16:29:30 -0000
@@ -26,7 +26,7 @@ extern volatile sig_atomic_t sigs;
extern int top_scroll;
extern int quiet;
extern int sc_width, sc_height;
-extern int plusoption;
+extern bool plusoption;
extern int forw_scroll;
extern int back_scroll;
extern int ignore_eoi;
Index: input.c
===================================================================
RCS file: /cvs/src/usr.bin/less/input.c,v
retrieving revision 1.10
diff -u -p -r1.10 input.c
--- input.c 6 Nov 2015 15:50:33 -0000 1.10
+++ input.c 29 Jan 2016 16:29:30 -0000
@@ -24,7 +24,7 @@
extern int squeeze;
extern int chopline;
extern int hshift;
-extern int quit_if_one_screen;
+extern bool quit_if_one_screen;
extern volatile sig_atomic_t sigs;
extern int ignore_eoi;
extern int status_col;
@@ -140,9 +140,9 @@ get_forw_line:
new_pos = ch_tell();
if (backchars > 0 && !chopline && hshift == 0) {
new_pos -= backchars + 1;
- endline = FALSE;
+ endline = false;
} else
- endline = TRUE;
+ endline = true;
break;
}
if (c != '\r')
@@ -167,11 +167,11 @@ get_forw_line:
c = ch_forw_get();
} while (c != '\n' && c != EOI);
new_pos = ch_tell();
- endline = TRUE;
- quit_if_one_screen = FALSE;
+ endline = true;
+ quit_if_one_screen = false;
} else {
new_pos = ch_tell() - backchars;
- endline = FALSE;
+ endline = false;
}
break;
}
@@ -309,7 +309,7 @@ get_back_line:
null_line();
return (-1);
}
- endline = FALSE;
+ endline = false;
prewind();
plinenum(new_pos);
loop:
@@ -329,7 +329,7 @@ loop:
backchars++;
goto shift;
}
- endline = TRUE;
+ endline = true;
break;
}
backchars = pappend(c, ch_tell()-1);
@@ -340,8 +340,8 @@ loop:
* and start a new one.
*/
if (chopline || hshift > 0) {
- endline = TRUE;
- quit_if_one_screen = FALSE;
+ endline = true;
+ quit_if_one_screen = false;
break;
}
shift:
Index: less.h
===================================================================
RCS file: /cvs/src/usr.bin/less/less.h,v
retrieving revision 1.26
diff -u -p -r1.26 less.h
--- less.h 29 Jan 2016 16:13:17 -0000 1.26
+++ less.h 29 Jan 2016 16:29:30 -0000
@@ -22,6 +22,7 @@
#include <libgen.h>
#include <limits.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -40,13 +41,6 @@
#define IS_DIGIT(c) isdigit((unsigned char)(c))
#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI))
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
#define OPT_OFF 0
#define OPT_ON 1
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/less/main.c,v
retrieving revision 1.32
diff -u -p -r1.32 main.c
--- main.c 12 Jan 2016 23:01:23 -0000 1.32
+++ main.c 29 Jan 2016 16:29:30 -0000
@@ -24,7 +24,7 @@ int is_tty;
IFILE curr_ifile = NULL;
IFILE old_ifile = NULL;
struct scrpos initial_scrpos;
-int any_display = FALSE;
+bool any_display = false;
off_t start_attnpos = -1;
off_t end_attnpos = -1;
int wscroll;
@@ -36,7 +36,7 @@ int secure;
int dohelp;
int logfile = -1;
-int force_logfile = FALSE;
+bool force_logfile = false;
char *namelogfile = NULL;
char *editor;
char *editproto;
@@ -47,7 +47,7 @@ extern int jump_sline;
extern int less_is_more;
extern int missing_cap;
extern int know_dumb;
-extern int quit_if_one_screen;
+extern bool quit_if_one_screen;
extern int quit_at_eof;
extern int pr_type;
extern int hilite_search;
Index: optfunc.c
===================================================================
RCS file: /cvs/src/usr.bin/less/optfunc.c,v
retrieving revision 1.14
diff -u -p -r1.14 optfunc.c
--- optfunc.c 12 Jan 2016 23:01:23 -0000 1.14
+++ optfunc.c 29 Jan 2016 16:29:30 -0000
@@ -30,13 +30,13 @@
extern int bufspace;
extern int pr_type;
-extern int plusoption;
+extern bool plusoption;
extern int swindow;
extern int sc_width;
extern int sc_height;
extern int secure;
extern int dohelp;
-extern int any_display;
+extern bool any_display;
extern char openquote;
extern char closequote;
extern char *prproto[];
@@ -49,7 +49,7 @@ extern int jump_sline;
extern int jump_sline_fraction;
extern int less_is_more;
extern char *namelogfile;
-extern int force_logfile;
+extern bool force_logfile;
extern int logfile;
char *tagoption = NULL;
extern char *tags;
@@ -104,7 +104,7 @@ opt_o(int type, char *s)
void
opt__O(int type, char *s)
{
- force_logfile = TRUE;
+ force_logfile = true;
opt_o(type, s);
}
@@ -310,7 +310,7 @@ opt_p(int type, char *s)
* {{ This won't work if the "/" command is
* changed or invalidated by a .lesskey file. }}
*/
- plusoption = TRUE;
+ plusoption = true;
ungetsc(s);
/*
* In "more" mode, the -p argument is a command,
Index: option.c
===================================================================
RCS file: /cvs/src/usr.bin/less/option.c,v
retrieving revision 1.15
diff -u -p -r1.15 option.c
--- option.c 23 Nov 2015 09:26:51 -0000 1.15
+++ option.c 29 Jan 2016 16:29:30 -0000
@@ -22,7 +22,7 @@
#include "option.h"
static struct loption *pendopt;
-int plusoption = FALSE;
+bool plusoption = false;
static char *optstring(char *, char **, char *, char *);
static int flip_triple(int, int);
@@ -103,7 +103,7 @@ scan_option(char *s)
return;
}
- set_default = FALSE;
+ set_default = false;
optname = NULL;
moreopt = 0;
o = NULL;
@@ -146,7 +146,7 @@ scan_option(char *s)
* "++" means process the commands at the start of
* EVERY input file.
*/
- plusoption = TRUE;
+ plusoption = true;
s = optstring(s, &str, propt('+'), NULL);
if (s == NULL)
return;
@@ -480,7 +480,7 @@ toggle_option(struct loption *o, int low
}
if (how_toggle != OPT_NO_TOGGLE && (o->otype & REPAINT))
- screen_trashed = TRUE;
+ screen_trashed = 1;
}
/*
@@ -597,7 +597,7 @@ num_error(char *printopt, int *errp)
PARG parg;
if (errp != NULL) {
- *errp = TRUE;
+ *errp = true;
return (-1);
}
if (printopt != NULL) {
@@ -620,9 +620,9 @@ getnum(char **sp, char *printopt, int *e
int neg;
s = skipsp(*sp);
- neg = FALSE;
+ neg = false;
if (*s == '-') {
- neg = TRUE;
+ neg = true;
s++;
}
if (*s < '0' || *s > '9')
@@ -633,7 +633,7 @@ getnum(char **sp, char *printopt, int *e
n = 10 * n + *s++ - '0';
*sp = s;
if (errp != NULL)
- *errp = FALSE;
+ *errp = false;
if (neg)
n = -n;
return (n);
@@ -668,7 +668,7 @@ getfraction(char **sp, char *printopt, i
frac *= 10;
*sp = s;
if (errp != NULL)
- *errp = FALSE;
+ *errp = false;
return (frac);
}
Index: opttbl.c
===================================================================
RCS file: /cvs/src/usr.bin/less/opttbl.c,v
retrieving revision 1.18
diff -u -p -r1.18 opttbl.c
--- opttbl.c 12 Nov 2015 18:46:50 -0000 1.18
+++ opttbl.c 29 Jan 2016 16:29:30 -0000
@@ -26,7 +26,7 @@ int pr_type; /* Type of prompt (short,
int bs_mode; /* How to process backspaces */
int know_dumb; /* Don't complain about dumb terminals */
int quit_at_eof; /* Quit after hitting end of file twice */
-int quit_if_one_screen; /* Quit if EOF on first screen */
+bool quit_if_one_screen;/* Quit if EOF on first screen */
int squeeze; /* Squeeze multiple blank lines into one */
int back_scroll; /* Repaint screen on backwards movement */
int forw_scroll; /* Repaint screen on forward movement */
Index: output.c
===================================================================
RCS file: /cvs/src/usr.bin/less/output.c,v
retrieving revision 1.16
diff -u -p -r1.16 output.c
--- output.c 26 Jan 2016 01:51:06 -0000 1.16
+++ output.c 29 Jan 2016 16:29:30 -0000
@@ -21,7 +21,7 @@ extern volatile sig_atomic_t sigs;
extern int sc_width;
extern int so_s_width, so_e_width;
extern int screen_trashed;
-extern int any_display;
+extern bool any_display;
extern int is_tty;
extern int oldbot;