diff --git a/manifest b/manifest index d8bd5a6a8e..f370c9f4cc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\s"rbu"\scommand\sline\sutility\sa\sbit. -D 2018-04-20T20:37:25.557 +C Add\sthe\s-dDIRECTORY\scommand-line\soption\sto\sLEMON. +D 2018-04-20T20:47:49.473 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 5ce9343cba9c189046f1afe6d2bcc1f68079439febc05267b98aec6ecc752439 @@ -1643,7 +1643,7 @@ F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4 F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5 F tool/getlock.c f4c39b651370156cae979501a7b156bdba50e7ce F tool/kvtest-speed.sh 4761a9c4b3530907562314d7757995787f7aef8f -F tool/lemon.c 3b5fb488c6b27e7cc4e3191cc1014af6d6250786dcae02991fb0df0d598fc5df +F tool/lemon.c 56eb42d92187547c58646482a49686e114eb4c0e8363820c70b5134bd6bb954f F tool/lempar.c 468a155e8729cfbccfe1d85bf60d064f1dab76167a51149ec5c7928a2de63953 F tool/libvers.c caafc3b689638a1d88d44bc5f526c2278760d9b9 F tool/loadfts.c c3c64e4d5e90e8ba41159232c2189dba4be7b862 @@ -1724,7 +1724,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P d2ab24f59d92527fe503fa7dc2128078fbc4dd2d2c1148effa9ea1957ab19940 -R 0a01952ab5e7062b6ef99418ce0e1189 -U dan -Z 04ee3d5e6c96c9d55fb19cc03ce1ab7e +P 61eb516f83d1a7fe44f72bebe2a2745ab904a02e06e38fb6d932348c49607976 +R 2e3699916a271d97bd14586c4c2b85d2 +U drh +Z 1b705604071ba48d495987879b565b84 diff --git a/manifest.uuid b/manifest.uuid index 84aab461c1..a8768f13cc 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -61eb516f83d1a7fe44f72bebe2a2745ab904a02e06e38fb6d932348c49607976 \ No newline at end of file +9cd20475ff3b2ca1a58e441194c921780d25bdb9b9c744a6b4541b888194efb8 \ No newline at end of file diff --git a/tool/lemon.c b/tool/lemon.c index d42584d107..12c3c8fb8b 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -1535,6 +1535,18 @@ static void handle_D_option(char *z){ *z = 0; } +/* Rember the name of the output directory +*/ +static char *outputDir = NULL; +static void handle_d_option(char *z){ + outputDir = (char *) malloc( lemonStrlen(z)+1 ); + if( outputDir==0 ){ + fprintf(stderr,"out of memory\n"); + exit(1); + } + lemon_strcpy(outputDir, z); +} + static char *user_templatename = NULL; static void handle_T_option(char *z){ user_templatename = (char *) malloc( lemonStrlen(z)+1 ); @@ -1616,9 +1628,11 @@ int main(int argc, char **argv) static int mhflag = 0; static int nolinenosflag = 0; static int noResort = 0; + static struct s_options options[] = { {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."}, {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."}, + {OPT_FSTR, "d", (char*)&handle_d_option, "Output directory. Default '.'"}, {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."}, {OPT_FSTR, "f", 0, "Ignored. (Placeholder for -f compiler options.)"}, {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."}, @@ -3025,13 +3039,28 @@ PRIVATE char *file_makename(struct lemon *lemp, const char *suffix) { char *name; char *cp; + char *filename = lemp->filename; + int sz; - name = (char*)malloc( lemonStrlen(lemp->filename) + lemonStrlen(suffix) + 5 ); + if( outputDir ){ + cp = strrchr(filename, '/'); + if( cp ) filename = cp + 1; + } + sz = lemonStrlen(filename); + sz += lemonStrlen(suffix); + if( outputDir ) sz += lemonStrlen(outputDir) + 1; + sz += 5; + name = (char*)malloc( sz ); if( name==0 ){ fprintf(stderr,"Can't allocate space for a filename.\n"); exit(1); } - lemon_strcpy(name,lemp->filename); + name[0] = 0; + if( outputDir ){ + lemon_strcpy(name, outputDir); + lemon_strcat(name, "/"); + } + lemon_strcat(name,filename); cp = strrchr(name,'.'); if( cp ) *cp = 0; lemon_strcat(name,suffix);