aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/edit.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/less/edit.c')
-rw-r--r--contrib/less/edit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/contrib/less/edit.c b/contrib/less/edit.c
index 4873c1f212d2..3d8ec9dfad44 100644
--- a/contrib/less/edit.c
+++ b/contrib/less/edit.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2002 Mark Nudelman
+ * Copyright (C) 1984-2005 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.
@@ -322,6 +322,14 @@ edit_ifile(ifile)
/*
* Re-open the current file.
*/
+ if (was_curr_ifile == ifile)
+ {
+ /*
+ * Whoops. The "current" ifile is the one we just deleted.
+ * Just give up.
+ */
+ quit(QUIT_ERROR);
+ }
reedit_ifile(was_curr_ifile);
return (1);
} else if ((f = open(qopen_filename, OPEN_READ)) < 0)
@@ -498,7 +506,7 @@ edit_last()
/*
- * Edit the next or previous file in the command line (ifile) list.
+ * Edit the n-th next or previous file in the command line (ifile) list.
*/
static int
edit_istep(h, n, dir)
@@ -547,14 +555,14 @@ edit_inext(h, n)
IFILE h;
int n;
{
- return (edit_istep(h, n, 1));
+ return (edit_istep(h, n, +1));
}
public int
edit_next(n)
int n;
{
- return edit_istep(curr_ifile, n, 1);
+ return edit_istep(curr_ifile, n, +1);
}
static int