aboutsummaryrefslogtreecommitdiff
path: root/contrib/less/tags.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/less/tags.c')
-rw-r--r--contrib/less/tags.c87
1 files changed, 27 insertions, 60 deletions
diff --git a/contrib/less/tags.c b/contrib/less/tags.c
index 23a9b92f018b..41f6f220e610 100644
--- a/contrib/less/tags.c
+++ b/contrib/less/tags.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 1984-2021 Mark Nudelman
+ * Copyright (C) 1984-2023 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.
@@ -44,13 +44,13 @@ enum {
T_GPATH /* 'GPATH': path name (global) */
};
-static enum tag_result findctag LESSPARAMS((char *tag));
-static enum tag_result findgtag LESSPARAMS((char *tag, int type));
-static char *nextgtag(VOID_PARAM);
-static char *prevgtag(VOID_PARAM);
-static POSITION ctagsearch(VOID_PARAM);
-static POSITION gtagsearch(VOID_PARAM);
-static int getentry LESSPARAMS((char *buf, char **tag, char **file, char **line));
+static enum tag_result findctag(char *tag);
+static enum tag_result findgtag(char *tag, int type);
+static char *nextgtag(void);
+static char *prevgtag(void);
+static POSITION ctagsearch(void);
+static POSITION gtagsearch(void);
+static int getentry(char *buf, char **tag, char **file, char **line);
/*
* The list of tags generated by the last findgtag() call.
@@ -88,8 +88,7 @@ static struct tag *curtag;
/*
* Delete tag structures.
*/
- public void
-cleantags(VOID_PARAM)
+public void cleantags(void)
{
struct tag *tp;
@@ -112,13 +111,7 @@ cleantags(VOID_PARAM)
/*
* Create a new tag entry.
*/
- static struct tag *
-maketagent(name, file, linenum, pattern, endline)
- char *name;
- char *file;
- LINENUM linenum;
- char *pattern;
- int endline;
+static struct tag * maketagent(char *name, char *file, LINENUM linenum, char *pattern, int endline)
{
struct tag *tp;
@@ -140,8 +133,7 @@ maketagent(name, file, linenum, pattern, endline)
/*
* Get tag mode.
*/
- public int
-gettagtype(VOID_PARAM)
+public int gettagtype(void)
{
int f;
@@ -171,9 +163,7 @@ gettagtype(VOID_PARAM)
* and "tagpattern" to the search pattern which should be used
* to find the tag.
*/
- public void
-findtag(tag)
- char *tag;
+public void findtag(char *tag)
{
int type = gettagtype();
enum tag_result result;
@@ -202,8 +192,7 @@ findtag(tag)
/*
* Search for a tag.
*/
- public POSITION
-tagsearch(VOID_PARAM)
+public POSITION tagsearch(void)
{
if (curtag == NULL)
return (NULL_POSITION); /* No gtags loaded! */
@@ -216,9 +205,7 @@ tagsearch(VOID_PARAM)
/*
* Go to the next tag.
*/
- public char *
-nexttag(n)
- int n;
+public char * nexttag(int n)
{
char *tagfile = (char *) NULL;
@@ -230,9 +217,7 @@ nexttag(n)
/*
* Go to the previous tag.
*/
- public char *
-prevtag(n)
- int n;
+public char * prevtag(int n)
{
char *tagfile = (char *) NULL;
@@ -244,8 +229,7 @@ prevtag(n)
/*
* Return the total number of tags.
*/
- public int
-ntags(VOID_PARAM)
+public int ntags(void)
{
return total;
}
@@ -253,8 +237,7 @@ ntags(VOID_PARAM)
/*
* Return the sequence number of current tag.
*/
- public int
-curr_tag(VOID_PARAM)
+public int curr_tag(void)
{
return curseq;
}
@@ -267,9 +250,7 @@ curr_tag(VOID_PARAM)
* Find tags in the "tags" file.
* Sets curtag to the first tag entry.
*/
- static enum tag_result
-findctag(tag)
- char *tag;
+static enum tag_result findctag(char *tag)
{
char *p;
char *q;
@@ -387,16 +368,14 @@ findctag(tag)
/*
* Edit current tagged file.
*/
- public int
-edit_tagfile(VOID_PARAM)
+public int edit_tagfile(void)
{
if (curtag == NULL)
return (1);
return (edit(curtag->tag_file));
}
- static int
-curtag_match(char const *line, POSITION linepos)
+static int curtag_match(char constant *line, POSITION linepos)
{
/*
* Test the line to see if we have a match.
@@ -424,8 +403,7 @@ curtag_match(char const *line, POSITION linepos)
* regcmp vs. re_comp) behave differently in the presence of
* parentheses (which are almost always found in a tag).
*/
- static POSITION
-ctagsearch(VOID_PARAM)
+static POSITION ctagsearch(void)
{
POSITION pos, linepos;
LINENUM linenum;
@@ -503,12 +481,9 @@ ctagsearch(VOID_PARAM)
* for future use by gtagsearch().
* Sets curtag to the first tag entry.
*/
- static enum tag_result
-findgtag(tag, type)
- char *tag; /* tag to load */
- int type; /* tags type */
+static enum tag_result findgtag(char *tag, int type)
{
- char buf[256];
+ char buf[1024];
FILE *fp;
struct tag *tp;
@@ -638,8 +613,7 @@ static int circular = 0; /* 1: circular tag structure */
* by findgtag(). The next call to gtagsearch() will try to position at the
* appropriate tag.
*/
- static char *
-nextgtag(VOID_PARAM)
+static char * nextgtag(void)
{
struct tag *tp;
@@ -668,8 +642,7 @@ nextgtag(VOID_PARAM)
* setup by findgtat(). The next call to gtagsearch() will try to position
* at the appropriate tag.
*/
- static char *
-prevgtag(VOID_PARAM)
+static char * prevgtag(void)
{
struct tag *tp;
@@ -698,8 +671,7 @@ prevgtag(VOID_PARAM)
* using either findtag() or one of nextgtag() and prevgtag(). Returns -1
* if it was unable to position at the tag, 0 if successful.
*/
- static POSITION
-gtagsearch(VOID_PARAM)
+static POSITION gtagsearch(void)
{
if (curtag == NULL)
return (NULL_POSITION); /* No gtags loaded! */
@@ -734,12 +706,7 @@ gtagsearch(VOID_PARAM)
* The tag, file, and line will each be NUL-terminated pointers
* into buf.
*/
- static int
-getentry(buf, tag, file, line)
- char *buf; /* standard or extended ctags -x format data */
- char **tag; /* name of the tag we actually found */
- char **file; /* file in which to find this tag */
- char **line; /* line number of file where this tag is found */
+static int getentry(char *buf, char **tag, char **file, char **line)
{
char *p = buf;