Skip to content

Commit 159e846

Browse files
committed
fixup! readtags: add an optoin (-X) for emitting an aggregate tag file
1 parent d66a3a0 commit 159e846

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

extra-cmds/readtags-cmd.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include <stdio.h> /* stderr */
2525
#include <stdbool.h>
2626

27-
#include <unistd.h>
2827

2928
typedef struct sReadOption {
3029
bool sortOverride;
@@ -784,21 +783,14 @@ static void printMustPseudoTag(tagPrintOptions *opts, FILE *fp,
784783

785784
static void printMustPseudoTags(tagPrintOptions *opts, FILE *fp)
786785
{
787-
char buf[PATH_MAX];
788-
if (!getcwd(buf, sizeof(buf)))
789-
{
790-
fprintf(stderr, "Failed to get the current working directory\n");
791-
exit (1);
792-
}
793-
794786
printMustPseudoTag(opts, fp, "!_TAG_FILE_FORMAT", "2", "//");
795787
printMustPseudoTag(opts, fp, "!_TAG_FILE_SORTED", "1", "//");
796788
printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_EXCMD", "pattern", "//");
797789
printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_FILESEP", "slash", "//");
798790
printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_MODE", "u-ctags", "//");
799791
printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_VERSION", "0.0", "/current.age/");
800792
printMustPseudoTag(opts, fp, "!_TAG_PATTERN_LENGTH_LIMIT", "0", "//");
801-
printMustPseudoTag(opts, fp, "!_TAG_PROC_CWD", buf, "//");
793+
printMustPseudoTag(opts, fp, "!_TAG_PROC_CWD", CurrentDirectory, "//");
802794
printMustPseudoTag(opts, fp, "!_TAG_PROGRAM_AUTHOR", "Universal Ctags Team", "//");
803795
printMustPseudoTag(opts, fp, "!_TAG_PROGRAM_NAME", "readtags", "/with -X option/");
804796
printMustPseudoTag(opts, fp, "!_TAG_PROGRAM_URL", "https://ctags.io/", "/official site/");
@@ -1124,6 +1116,9 @@ extern int main (int argc, char **argv)
11241116
if (actionSpec.action & ACTION_AGGREGATE)
11251117
{
11261118
tagEntry e;
1119+
1120+
setCurrentDirectory ();
1121+
11271122
for (unsigned int i = 0; i < ptrArrayCount (inputSpecs); i++)
11281123
{
11291124
struct inputSpec *inputSpec = ptrArrayItem (inputSpecs, i);

0 commit comments

Comments
 (0)