aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/brac.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2009-05-08 23:34:35 +0000
committerXin LI <delphij@FreeBSD.org>2009-05-08 23:34:35 +0000
commitad5f463cf975eb6a9c4cb335fc2ce7a84c7d49a7 (patch)
tree2526f6b109843b646672c1537476dc51e56c0454 /contrib/less/brac.c
parent33a9f6ab73c5cd49f65ba4389ec32216bbe5fee3 (diff)
downloadsrc-ad5f463cf975eb6a9c4cb335fc2ce7a84c7d49a7.tar.gz
src-ad5f463cf975eb6a9c4cb335fc2ce7a84c7d49a7.zip
Flatten all tags of the dist tree of less.
Notes
Notes: svn path=/vendor/less/dist/; revision=191925
Diffstat (limited to 'contrib/less/brac.c')
-rw-r--r--contrib/less/brac.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/contrib/less/brac.c b/contrib/less/brac.c
deleted file mode 100644
index 20c7353469b3..000000000000
--- a/contrib/less/brac.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 1984-2007 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
-
-
-/*
- * Routines to perform bracket matching functions.
- */
-
-#include "less.h"
-#include "position.h"
-
-/*
- * Try to match the n-th open bracket
- * which appears in the top displayed line (forwdir),
- * or the n-th close bracket
- * which appears in the bottom displayed line (!forwdir).
- * The characters which serve as "open bracket" and
- * "close bracket" are given.
- */
- public void
-match_brac(obrac, cbrac, forwdir, n)
- register int obrac;
- register int cbrac;
- int forwdir;
- int n;
-{
- register int c;
- register int nest;
- POSITION pos;
- int (*chget)();
-
- extern int ch_forw_get(), ch_back_get();
-
- /*
- * Seek to the line containing the open bracket.
- * This is either the top or bottom line on the screen,
- * depending on the type of bracket.
- */
- pos = position((forwdir) ? TOP : BOTTOM);
- if (pos == NULL_POSITION || ch_seek(pos))
- {
- if (forwdir)
- error("Nothing in top line", NULL_PARG);
- else
- error("Nothing in bottom line", NULL_PARG);
- return;
- }
-
- /*
- * Look thru the line to find the open bracket to match.
- */
- do
- {
- if ((c = ch_forw_get()) == '\n' || c == EOI)
- {
- if (forwdir)
- error("No bracket in top line", NULL_PARG);
- else
- error("No bracket in bottom line", NULL_PARG);
- return;
- }
- } while (c != obrac || --n > 0);
-
- /*
- * Position the file just "after" the open bracket
- * (in the direction in which we will be searching).
- * If searching forward, we are already after the bracket.
- * If searching backward, skip back over the open bracket.
- */
- if (!forwdir)
- (void) ch_back_get();
-
- /*
- * Search the file for the matching bracket.
- */
- chget = (forwdir) ? ch_forw_get : ch_back_get;
- nest = 0;
- while ((c = (*chget)()) != EOI)
- {
- if (c == obrac)
- nest++;
- else if (c == cbrac && --nest < 0)
- {
- /*
- * Found the matching bracket.
- * If searching backward, put it on the top line.
- * If searching forward, put it on the bottom line.
- */
- jump_line_loc(ch_tell(), forwdir ? -1 : 1);
- return;
- }
- }
- error("No matching bracket", NULL_PARG);
-}