Skip to content

Commit

Permalink
main: fix a bug of handling --tag-relative with no optional argument
Browse files Browse the repository at this point in the history
Close universal-ctags#2096.

Quoted from universal-ctags#2096 reported by @bogdan:
    Original ctags accepts --tag-relative without an option which
    universal ctags does not.  It leads to incompatibility.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed May 14, 2019
1 parent c8405be commit 00277dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Tmain/tag-relative-option-no-optarg.d/exit-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
7 changes: 7 additions & 0 deletions Tmain/tag-relative-option-no-optarg.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright: 2019 Masatake YAMATO
# License: GPL-2

CTAGS=$1
O="--quiet --options=NONE "

${CTAGS} $O --tag-relative --_force-quit=0
4 changes: 2 additions & 2 deletions main/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ optionValues Option = {
.followLinks = true,
.filter = false,
.filterTerminator = NULL,
.tagRelative = false,
.tagRelative = TREL_NO,
.printTotals = false,
.lineDirectives = false,
.printLanguage =false,
Expand Down Expand Up @@ -2413,7 +2413,7 @@ static void processTagRelative (
{
if (isFalse (parameter))
Option.tagRelative = TREL_NO;
else if (isTrue (parameter))
else if (isTrue (parameter) || *parameter == '\0')
Option.tagRelative = TREL_YES;
else if (strcasecmp (parameter, "always") == 0)
Option.tagRelative = TREL_ALWAYS;
Expand Down

0 comments on commit 00277dc

Please sign in to comment.