mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 23:33:03 +00:00
Implement --print-datadir.
* src/getargs.c (usage): Mention. (PRINT_DATADIR_OPTION): New anonymous enum member. (long_options): Add entry for it. (getargs): Add case for it calling compute_pkgdatadir. * src/output.c (output_skeleton): Encapsulate data directory computation from here... (prepare): ... and from here... (compute_pkgdatadir): ... into this new function. * src/output.h (compute_pkgdatadir): Prototype.
This commit is contained in:
13
src/output.c
13
src/output.c
@@ -482,7 +482,7 @@ output_skeleton (void)
|
||||
char *full_skeleton;
|
||||
char const *p;
|
||||
char const *m4 = (p = getenv ("M4")) ? p : M4;
|
||||
char const *pkgdatadir = (p = getenv ("BISON_PKGDATADIR")) ? p : PKGDATADIR;
|
||||
char const *pkgdatadir = compute_pkgdatadir ();
|
||||
size_t skeleton_size = strlen (skeleton) + 1;
|
||||
size_t pkgdatadirlen = strlen (pkgdatadir);
|
||||
while (pkgdatadirlen && pkgdatadir[pkgdatadirlen - 1] == '/')
|
||||
@@ -602,12 +602,10 @@ prepare (void)
|
||||
|
||||
/* About the skeletons. */
|
||||
{
|
||||
char const *pkgdatadir = getenv ("BISON_PKGDATADIR");
|
||||
/* b4_pkgdatadir is used inside m4_include in the skeletons, so digraphs
|
||||
would never be expanded. Hopefully no one has M4-special characters in
|
||||
his Bison installation path. */
|
||||
MUSCLE_INSERT_STRING_RAW ("pkgdatadir",
|
||||
pkgdatadir ? pkgdatadir : PKGDATADIR);
|
||||
MUSCLE_INSERT_STRING_RAW ("pkgdatadir", compute_pkgdatadir ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,3 +631,10 @@ output (void)
|
||||
|
||||
obstack_free (&format_obstack, NULL);
|
||||
}
|
||||
|
||||
char const *
|
||||
compute_pkgdatadir (void)
|
||||
{
|
||||
char const *pkgdatadir = getenv ("BISON_PKGDATADIR");
|
||||
return pkgdatadir ? pkgdatadir : PKGDATADIR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user