|
24 | 24 | #include <stdio.h> /* stderr */ |
25 | 25 | #include <stdbool.h> |
26 | 26 |
|
27 | | -#include <unistd.h> |
28 | 27 |
|
29 | 28 | typedef struct sReadOption { |
30 | 29 | bool sortOverride; |
@@ -784,21 +783,14 @@ static void printMustPseudoTag(tagPrintOptions *opts, FILE *fp, |
784 | 783 |
|
785 | 784 | static void printMustPseudoTags(tagPrintOptions *opts, FILE *fp) |
786 | 785 | { |
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 | | - |
794 | 786 | printMustPseudoTag(opts, fp, "!_TAG_FILE_FORMAT", "2", "//"); |
795 | 787 | printMustPseudoTag(opts, fp, "!_TAG_FILE_SORTED", "1", "//"); |
796 | 788 | printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_EXCMD", "pattern", "//"); |
797 | 789 | printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_FILESEP", "slash", "//"); |
798 | 790 | printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_MODE", "u-ctags", "//"); |
799 | 791 | printMustPseudoTag(opts, fp, "!_TAG_OUTPUT_VERSION", "0.0", "/current.age/"); |
800 | 792 | printMustPseudoTag(opts, fp, "!_TAG_PATTERN_LENGTH_LIMIT", "0", "//"); |
801 | | - printMustPseudoTag(opts, fp, "!_TAG_PROC_CWD", buf, "//"); |
| 793 | + printMustPseudoTag(opts, fp, "!_TAG_PROC_CWD", CurrentDirectory, "//"); |
802 | 794 | printMustPseudoTag(opts, fp, "!_TAG_PROGRAM_AUTHOR", "Universal Ctags Team", "//"); |
803 | 795 | printMustPseudoTag(opts, fp, "!_TAG_PROGRAM_NAME", "readtags", "/with -X option/"); |
804 | 796 | printMustPseudoTag(opts, fp, "!_TAG_PROGRAM_URL", "https://ctags.io/", "/official site/"); |
@@ -1124,6 +1116,9 @@ extern int main (int argc, char **argv) |
1124 | 1116 | if (actionSpec.action & ACTION_AGGREGATE) |
1125 | 1117 | { |
1126 | 1118 | tagEntry e; |
| 1119 | + |
| 1120 | + setCurrentDirectory (); |
| 1121 | + |
1127 | 1122 | for (unsigned int i = 0; i < ptrArrayCount (inputSpecs); i++) |
1128 | 1123 | { |
1129 | 1124 | struct inputSpec *inputSpec = ptrArrayItem (inputSpecs, i); |
|
0 commit comments