summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/less/command.c8
-rw-r--r--usr.bin/less/edit.c30
-rw-r--r--usr.bin/less/filename.c6
-rw-r--r--usr.bin/less/ifile.c16
-rw-r--r--usr.bin/less/less.h1
-rw-r--r--usr.bin/less/lsystem.c2
-rw-r--r--usr.bin/less/main.c8
-rw-r--r--usr.bin/less/prompt.c4
8 files changed, 37 insertions, 38 deletions
diff --git a/usr.bin/less/command.c b/usr.bin/less/command.c
index c60c0b23f25..d34f2687083 100644
--- a/usr.bin/less/command.c
+++ b/usr.bin/less/command.c
@@ -637,7 +637,7 @@ prompt(void)
*/
if (get_quit_at_eof() == OPT_ONPLUS &&
eof_displayed() && !(ch_getflags() & CH_HELPFILE) &&
- next_ifile(curr_ifile) == NULL_IFILE)
+ next_ifile(curr_ifile) == NULL)
quit(QUIT_OK);
/*
@@ -645,7 +645,7 @@ prompt(void)
*/
if (quit_if_one_screen &&
entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) &&
- next_ifile(curr_ifile) == NULL_IFILE)
+ next_ifile(curr_ifile) == NULL)
quit(QUIT_OK);
/*
@@ -1268,7 +1268,7 @@ again:
/*
* Exit.
*/
- if (curr_ifile != NULL_IFILE &&
+ if (curr_ifile != NULL &&
ch_getflags() & CH_HELPFILE) {
/*
* Quit while viewing the help file
@@ -1505,7 +1505,7 @@ again:
break;
old_ifile = curr_ifile;
new_ifile = getoff_ifile(curr_ifile);
- if (new_ifile == NULL_IFILE) {
+ if (new_ifile == NULL) {
ring_bell();
break;
}
diff --git a/usr.bin/less/edit.c b/usr.bin/less/edit.c
index fc01ec9c3d5..bda64f62152 100644
--- a/usr.bin/less/edit.c
+++ b/usr.bin/less/edit.c
@@ -130,7 +130,7 @@ close_file(void)
{
struct scrpos scrpos;
- if (curr_ifile == NULL_IFILE)
+ if (curr_ifile == NULL)
return;
/*
@@ -156,7 +156,7 @@ close_file(void)
free(curr_altfilename);
curr_altfilename = NULL;
}
- curr_ifile = NULL_IFILE;
+ curr_ifile = NULL;
curr_ino = curr_dev = 0;
}
@@ -169,7 +169,7 @@ int
edit(char *filename)
{
if (filename == NULL)
- return (edit_ifile(NULL_IFILE));
+ return (edit_ifile(NULL));
return (edit_ifile(get_ifile(filename, curr_ifile)));
}
@@ -208,7 +208,7 @@ edit_ifile(IFILE ifile)
*/
end_logfile();
was_curr_ifile = save_curr_ifile();
- if (curr_ifile != NULL_IFILE) {
+ if (curr_ifile != NULL) {
chflags = ch_getflags();
close_file();
if ((chflags & CH_HELPFILE) &&
@@ -221,7 +221,7 @@ edit_ifile(IFILE ifile)
}
}
- if (ifile == NULL_IFILE) {
+ if (ifile == NULL) {
/*
* No new file to open.
* (Don't set old_ifile, because if you call edit_ifile(NULL),
@@ -318,7 +318,7 @@ err1:
* Get the new ifile.
* Get the saved position for the file.
*/
- if (was_curr_ifile != NULL_IFILE) {
+ if (was_curr_ifile != NULL) {
old_ifile = was_curr_ifile;
unsave_ifile(was_curr_ifile);
}
@@ -439,7 +439,7 @@ edit_list(char *filelist)
int
edit_first(void)
{
- curr_ifile = NULL_IFILE;
+ curr_ifile = NULL;
return (edit_next(1));
}
@@ -449,7 +449,7 @@ edit_first(void)
int
edit_last(void)
{
- curr_ifile = NULL_IFILE;
+ curr_ifile = NULL;
return (edit_prev(1));
}
@@ -471,7 +471,7 @@ edit_istep(IFILE h, int n, int dir)
if (edit_ifile(h) == 0)
break;
}
- if (next == NULL_IFILE) {
+ if (next == NULL) {
/*
* Reached end of the ifile list.
*/
@@ -524,9 +524,9 @@ edit_index(int n)
{
IFILE h;
- h = NULL_IFILE;
+ h = NULL;
do {
- if ((h = next_ifile(h)) == NULL_IFILE) {
+ if ((h = next_ifile(h)) == NULL) {
/*
* Reached end of the list without finding it.
*/
@@ -540,7 +540,7 @@ edit_index(int n)
IFILE
save_curr_ifile(void)
{
- if (curr_ifile != NULL_IFILE)
+ if (curr_ifile != NULL)
hold_ifile(curr_ifile, 1);
return (curr_ifile);
}
@@ -548,7 +548,7 @@ save_curr_ifile(void)
void
unsave_ifile(IFILE save_ifile)
{
- if (save_ifile != NULL_IFILE)
+ if (save_ifile != NULL)
hold_ifile(save_ifile, -1);
}
@@ -575,12 +575,12 @@ reedit_ifile(IFILE save_ifile)
/*
* If can't reopen it, open the next input file in the list.
*/
- if (next != NULL_IFILE && edit_inext(next, 0) == 0)
+ if (next != NULL && edit_inext(next, 0) == 0)
return;
/*
* If can't open THAT one, open the previous input file in the list.
*/
- if (prev != NULL_IFILE && edit_iprev(prev, 0) == 0)
+ if (prev != NULL && edit_iprev(prev, 0) == 0)
return;
/*
* If can't even open that, we're stuck. Just quit.
diff --git a/usr.bin/less/filename.c b/usr.bin/less/filename.c
index 3ed929bd195..c22a7e67ef4 100644
--- a/usr.bin/less/filename.c
+++ b/usr.bin/less/filename.c
@@ -225,7 +225,7 @@ fexpand(char *s)
IFILE ifile;
#define fchar_ifile(c) \
- ((c) == '%' ? curr_ifile : (c) == '#' ? old_ifile : NULL_IFILE)
+ ((c) == '%' ? curr_ifile : (c) == '#' ? old_ifile : NULL)
/*
* Make one pass to see how big a buffer we
@@ -247,7 +247,7 @@ fexpand(char *s)
* Single char (not repeated). Treat specially.
*/
ifile = fchar_ifile(*fr);
- if (ifile == NULL_IFILE)
+ if (ifile == NULL)
n++;
else
n += strlen(get_filename(ifile));
@@ -277,7 +277,7 @@ fexpand(char *s)
*to++ = *fr;
} else if (fr[1] != *fr) {
ifile = fchar_ifile(*fr);
- if (ifile == NULL_IFILE) {
+ if (ifile == NULL) {
*to++ = *fr;
} else {
(void) strlcpy(to, get_filename(ifile),
diff --git a/usr.bin/less/ifile.c b/usr.bin/less/ifile.c
index 0675047df0f..92afb91724e 100644
--- a/usr.bin/less/ifile.c
+++ b/usr.bin/less/ifile.c
@@ -124,7 +124,7 @@ del_ifile(IFILE h)
{
struct ifile *p;
- if (h == NULL_IFILE)
+ if (h == NULL)
return;
/*
* If the ifile we're deleting is the currently open ifile,
@@ -147,9 +147,9 @@ next_ifile(IFILE h)
{
struct ifile *p;
- p = (h == NULL_IFILE) ? &anchor : int_ifile(h);
+ p = (h == NULL) ? &anchor : int_ifile(h);
if (p->h_next == &anchor)
- return (NULL_IFILE);
+ return (NULL);
return (ext_ifile(p->h_next));
}
@@ -161,9 +161,9 @@ prev_ifile(IFILE h)
{
struct ifile *p;
- p = (h == NULL_IFILE) ? &anchor : int_ifile(h);
+ p = (h == NULL) ? &anchor : int_ifile(h);
if (p->h_prev == &anchor)
- return (NULL_IFILE);
+ return (NULL);
return (ext_ifile(p->h_prev));
}
@@ -175,11 +175,11 @@ getoff_ifile(IFILE ifile)
{
IFILE newifile;
- if ((newifile = prev_ifile(ifile)) != NULL_IFILE)
+ if ((newifile = prev_ifile(ifile)) != NULL)
return (newifile);
- if ((newifile = next_ifile(ifile)) != NULL_IFILE)
+ if ((newifile = next_ifile(ifile)) != NULL)
return (newifile);
- return (NULL_IFILE);
+ return (NULL);
}
/*
diff --git a/usr.bin/less/less.h b/usr.bin/less/less.h
index 1bc8a956d84..d97533cc628 100644
--- a/usr.bin/less/less.h
+++ b/usr.bin/less/less.h
@@ -91,7 +91,6 @@ typedef off_t LINENUM;
* An IFILE represents an input file.
*/
#define IFILE void *
-#define NULL_IFILE (NULL)
/*
* The structure used to represent a "screen position".
diff --git a/usr.bin/less/lsystem.c b/usr.bin/less/lsystem.c
index 1dae8d688cb..5ef51389aca 100644
--- a/usr.bin/less/lsystem.c
+++ b/usr.bin/less/lsystem.c
@@ -52,7 +52,7 @@ lsystem(const char *cmd, const char *donemsg)
* Close the current input file.
*/
save_ifile = save_curr_ifile();
- (void) edit_ifile(NULL_IFILE);
+ (void) edit_ifile(NULL);
/*
* De-initialize the terminal and take out of raw mode.
diff --git a/usr.bin/less/main.c b/usr.bin/less/main.c
index 0597ad13399..192894e6855 100644
--- a/usr.bin/less/main.c
+++ b/usr.bin/less/main.c
@@ -21,8 +21,8 @@
char *every_first_cmd = NULL;
int new_file;
int is_tty;
-IFILE curr_ifile = NULL_IFILE;
-IFILE old_ifile = NULL_IFILE;
+IFILE curr_ifile = NULL;
+IFILE old_ifile = NULL;
struct scrpos initial_scrpos;
int any_display = FALSE;
off_t start_attnpos = -1;
@@ -185,7 +185,7 @@ main(int argc, char *argv[])
* Call get_ifile with all the command line filenames
* to "register" them with the ifile system.
*/
- ifile = NULL_IFILE;
+ ifile = NULL;
if (dohelp)
ifile = get_ifile(helpfile(), ifile);
while (argc-- > 0) {
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
filename = *argv;
argv++;
(void) get_ifile(filename, ifile);
- ifile = prev_ifile(NULL_IFILE);
+ ifile = prev_ifile(NULL);
free(filename);
}
/*
diff --git a/usr.bin/less/prompt.c b/usr.bin/less/prompt.c
index 58c29f57edc..b7b1ffc4288 100644
--- a/usr.bin/less/prompt.c
+++ b/usr.bin/less/prompt.c
@@ -216,7 +216,7 @@ cond(char c, int where)
case 'x': /* Is there a "next" file? */
if (ntags())
return (0);
- return (next_ifile(curr_ifile) != NULL_IFILE);
+ return (next_ifile(curr_ifile) != NULL);
}
return (0);
}
@@ -350,7 +350,7 @@ protochar(int c, int where)
break;
case 'x': /* Name of next file */
h = next_ifile(curr_ifile);
- if (h != NULL_IFILE)
+ if (h != NULL)
ap_str(get_filename(h));
else
ap_quest();