GLOBAL-6.5.3 Patches

Jason Hood <[email protected]>
Newsgroups gmane.comp.gnu.global.bugs
Message-ID <[email protected]>
More Windows patches; more manual tweaks. :)

-- 
Jason.

_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global
global-6.5.3.txt (text/plain, 10.8 KB)
diff -urp global-6.5.3/gtags/manual.in global-6.5-3/gtags/manual.in
--- global-6.5.3/gtags/manual.in	2016-03-18 17:03:51 +1000
+++ global-6.5-3/gtags/manual.in	2016-03-21 12:22:37 +1000
@@ -68,7 +68,7 @@
 		The argument @arg{file} can be set to @val{-} to accept a list of
 		files from the standard input.
 		File names must be separated by newline.
-		You may use find
+		You may use @xref{find,1}.
 	@item{@option{--gtagsconf} @arg{file}}
 		Set environment variable @var{GTAGSCONF} to @arg{file}.
 	@item{@option{--gtagslabel} @arg{label}}
diff -urp global-6.5.3/htags/completion.cgi.in global-6.5-3/htags/completion.cgi.in
--- global-6.5.3/htags/completion.cgi.in	2016-03-18 17:03:51 +1000
+++ global-6.5-3/htags/completion.cgi.in	2016-03-21 10:51:52 +1000
@@ -66,15 +66,16 @@ if (-f "../GTAGSROOT" && open(GTAGSROOT,
 }
 chdir($gtagsroot);
 print "Content-Type: text/html\n\n";
-#
-# This code was commented out, because it may have a security hole in the future.
-# To use this code, please uncomment in your own responsibility.
-#
-#if ($^O eq 'MSWin32') {
-#	open(PIPE, $global_command . " -${flags}e $q |");
-#} else {
+if ($^O eq 'MSWin32') {
+	#
+	# This code was commented out, because it may have a security hole in the
+	# future.  To use this code, please uncomment in your own responsibility.
+	#
+	#open(PIPE, $global_command . " -${flags}e \"$q\" |");
+	error_and_exit("Feature not implemented.");
+} else {
 	open(PIPE, "-|") || exec $global_command, '-'.$flags.'e', $q;
-#}
+}
 if ($limit > 0) {
 	while (<PIPE>) {
 		print if ($limit-- > 0);
diff -urp global-6.5.3/htags/global.cgi.in global-6.5-3/htags/global.cgi.in
--- global-6.5.3/htags/global.cgi.in	2016-03-18 17:03:51 +1000
+++ global-6.5-3/htags/global.cgi.in	2016-03-21 10:51:51 +1000
@@ -131,18 +131,19 @@ if ($?) {
 # of each line.
 #
 $flags = '-' . $flag . $iflag . $oflag . 'e';
-#
-# This code was commented out, because it may have a security hole in the future.
-# To use this code, please uncomment in your own responsibility.
-#
-#if ($^O eq 'MSWin32') {
-#	open(PIPE, "$global_command" . " --result=ctags-xid $flags $pattern |");
-#} else {
+if ($^O eq 'MSWin32') {
+	#
+	# This code was commented out, because it may have a security hole in the
+	# future.  To use this code, please uncomment in your own responsibility.
+	#
+	#open(PIPE, "$global_command" . " --result=ctags-xid $flags \"$pattern\" |");
+	error_and_exit("Feature not implemented.");
+} else {
 	open(PIPE, "-|") || exec "$global_command", '--result=ctags-xid', $flags, $pattern;
 	if ($?) {
 		error_and_exit("Cannot execute global.");
 	}
-#}
+}
 local(%ctab) = ('&', '&amp;', '<', '&lt;', '>', '&gt;');
 $pattern =~ s/([&<>])/$ctab{$1}/ge;
 local($tag, $lno, $filename);
diff -urp global-6.5.3/htags/htags.c global-6.5-3/htags/htags.c
--- global-6.5.3/htags/htags.c	2016-03-18 17:03:51 +1000
+++ global-6.5-3/htags/htags.c	2016-03-21 16:15:21 +1000
@@ -1658,14 +1658,8 @@ main(int argc, char **argv)
 	if (enable_xhtml) {
 		char src[MAXPATHLEN];
 		char dist[MAXPATHLEN];
-#ifdef __DJGPP__
-		const char *template = "";
 		snprintf(src, sizeof(src), "%s/gtags/style.css", datadir);
 		snprintf(dist, sizeof(dist), "%s/style.css", distpath);
-#else
-		snprintf(src, sizeof(src), "%s/gtags/style.css", datadir);
-		snprintf(dist, sizeof(dist), "%s/style.css", distpath);
-#endif
 		copyfile(src, dist);
 	}
 	if (auto_completion || tree_view) {
diff -urp global-6.5.3/libutil/conf.c global-6.5-3/libutil/conf.c
--- global-6.5.3/libutil/conf.c	2016-03-18 17:03:51 +1000
+++ global-6.5-3/libutil/conf.c	2016-03-21 16:18:34 +1000
@@ -470,10 +470,15 @@ getconfs(const char *name, STRBUF *resul
 				if (sb)
 					strbuf_puts(sb, DATADIR);
 			} else {
-				char path[MAX_PATH], *name;
+				char path[MAX_PATH], *name, *p;
 				GetModuleFileName(NULL, path, MAX_PATH);
-				name = strrchr(path, '\\');
-				strcpy(name+1, "..\\share");
+				for (p = name = path; *p; ++p) {
+					if (*p == '\\') {
+						*p = '/';
+						name = p+1;
+					}
+				}
+				strcpy(name, "../share");
 				if (sb)
 					strbuf_puts(sb, path);
 			}
diff -urp global-6.5.3/libutil/manual.in global-6.5-3/libutil/manual.in
--- global-6.5.3/libutil/manual.in	2016-03-18 17:03:51 +1000
+++ global-6.5-3/libutil/manual.in	2016-03-21 18:45:00 +1000
@@ -38,14 +38,14 @@
 	[sysconfdir] is @file{/usr/local/etc} by default; you can change it by the --sysconfdir
 	option of configure script.
 
-	The format is almost same to @xref{termcap,5} except for some extensions described
+	The format is similar to @xref{termcap,5} except for some extensions described
 	later.
 	The file includes one or more records. You should select a record using a label.
 	Default label is 'default'. If @var{GTAGSLABEL} is set, its value is used. Please be
-	aware of the meaning of 'default' it is different from one of @xref{termcap,5}.
+	aware the meaning of 'default' is different to that of @xref{termcap,5}.
 
 	Lines starting with '#' are ignored.
-	A record consists of one or more fields sepalated by ':' and ends with a newline.
+	A record consists of one or more fields separated by ':' and ends with a newline.
 	The first field must have a label name. Each field of the rest has a variable definition.
 	There are three types in those variables.
 	@begin_itemize
@@ -55,7 +55,7 @@
 	@end_itemize
 	Most variables are relevant to string type.
 
-	If data includes ':' or newline, you need quote it by '\\'.
+	If data includes ':' or newline, you need to quote it by '\\'.
 	An empty field is permitted, but it doesn't make sense.
 
 	When there is more than one definition, the previous one is adopted. 
@@ -63,18 +63,18 @@
 	adopted and connected respectively.
 @Variable substitution
 	Variable substitution similar to @xref{sh,1} is available.
-	You can refer any string variable using '$' prefix. For example, the following
+	You can refer to any string variable using '$' prefix. For example, the following
 	@name{b} has a value 'XYZ'.
 	@begin_verbatim
 	:a=Y:b=X${a}Z:
 	@end_verbatim
 @Including another record
-	@name{Tc} is a special variable; it read in definitions in another record.
+	@name{Tc} is a special variable; it reads in definitions in another record.
 	It is similar to the @name{tc} of @xref{termcap,5}.
 	Syntax is as follows:@br
 	@name{tc}=@arg{label}[@@@arg{file}]@br
-	If only a @arg{label} is given, @name{tc} read from a record specified by the @arg{label}
-	in the same file. If @@@arg{file} is also given, @name{tc} read from a record
+	If only a @arg{label} is given, @name{tc} is read from a record specified by the @arg{label}
+	in the same file. If @@@arg{file} is also given, @name{tc} is read from a record
 	specified by the @arg{label} in the specified @arg{file}.
 	@arg{File} should be an absolute path, and should not include variables.
 	Different from @xref{termcap,5}, you can use @name{tc} anytime anywhere.
@@ -104,10 +104,10 @@
 	By default, each of them has a directory path given by the configure
 	script.@br
 	@name{bindir}@br
-        @name{datadir}@br
-        @name{libdir}@br
-        @name{localstatedir}@br
-        @name{sysconfdir}@br
+	@name{datadir}@br
+	@name{libdir}@br
+	@name{localstatedir}@br
+	@name{sysconfdir}@br
 @ENVIRONMENT
 	The following environment variables affect the execution of the commands.
 
@@ -124,7 +124,7 @@
 	@xref{gtags,1},
 	@xref{htags,1}.
 
-        GNU GLOBAL source code tag system@br
-        (http://www.gnu.org/software/global/).
+	GNU GLOBAL source code tag system@br
+	(http://www.gnu.org/software/global/).
 @HISTORY
 	The @name{gtags.conf} file appeared in GLOBAL-3.0 (1998).
diff -urp global-6.5.3/plugin-factory/exuberant-ctags.c global-6.5-3/plugin-factory/exuberant-ctags.c
--- global-6.5.3/plugin-factory/exuberant-ctags.c	2016-03-18 17:03:51 +1000
+++ global-6.5-3/plugin-factory/exuberant-ctags.c	2016-03-21 17:41:55 +1000
@@ -97,7 +97,7 @@ copy_langmap_converting_cpp(char *dst, c
 #include <windows.h>
 #include <fcntl.h>
 static HANDLE pid;
-static char argv[] = "ctags "
+static char argv[] = "\" "
 #if defined(USE_EXTRA_FIELDS)
 	"\"--_xformat=%R %-16N %4n %-16F %C\" "
 	"--extra=+r "
@@ -117,12 +117,20 @@ start_ctags(const struct parser_param *p
 	STARTUPINFO si;
 	PROCESS_INFORMATION pi;
 	char* arg;
+	char *path = param->getconf("ctagscom");
 
-	arg = malloc(sizeof(argv) + strlen(param->langmap));
+	if (path && strlen(path) > 0 && strcmp(path, "no") != 0)
+		ctagscom = path;
+	if (!ctagscom || !strlen(ctagscom) || !strcmp(ctagscom, "no"))
+		param->die(ctagsnotfound);
+
+	arg = malloc(1 + strlen(ctagscom) + sizeof(argv) + strlen(param->langmap));
 	if (arg == NULL)
 		param->die("short of memory.");
-	strcpy(arg, argv);
-	copy_langmap_converting_cpp(arg + sizeof(argv) - 1, param->langmap);
+	*arg = '"';
+	strcpy(arg+1, ctagscom);
+	strcat(arg, argv);
+	copy_langmap_converting_cpp(arg + strlen(arg), param->langmap);
 
 	sa.nLength = sizeof(sa);
 	sa.bInheritHandle = TRUE;
@@ -138,7 +146,8 @@ start_ctags(const struct parser_param *p
 	si.hStdOutput = ipipe[1];
 	si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
 	si.dwFlags = STARTF_USESTDHANDLES;
-	CreateProcess(NULL, arg, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
+	if (!CreateProcess(NULL, arg, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
+		param->die(ctagsnotfound);
 	CloseHandle(opipe[0]);
 	CloseHandle(ipipe[1]);
 	CloseHandle(pi.hThread);
diff -urp global-6.5.3/plugin-factory/PLUGIN_HOWTO.pygments global-6.5-3/plugin-factory/PLUGIN_HOWTO.pygments
--- global-6.5.3/plugin-factory/PLUGIN_HOWTO.pygments	2016-03-18 17:03:51 +1000
+++ global-6.5-3/plugin-factory/PLUGIN_HOWTO.pygments	2016-03-21 12:48:30 +1000
@@ -58,7 +58,7 @@ Please execute gtags(1) as usual.
 $ gtags
 
 If it is doubtful whether Pygments plug-in parser is used,
-please try --explaina option. It shows the libraries used by
+please try --explain option. It shows the libraries used by
 gtags.
 
 $ gtags --explain
diff -urp global-6.5.3/plugin-factory/pygments-parser.c global-6.5-3/plugin-factory/pygments-parser.c
--- global-6.5.3/plugin-factory/pygments-parser.c	2016-03-18 17:03:51 +1000
+++ global-6.5-3/plugin-factory/pygments-parser.c	2016-03-21 15:41:01 +1000
@@ -18,6 +18,9 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef __MINGW32__
+#define __USE_MINGW_ANSI_STDIO 0	/* no need for C99 sprintf here */
+#endif
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -102,10 +105,10 @@ start_process(const struct parser_param
 	GetModuleFileName(NULL, parser, MAX_PATH);
 	arg = strrchr(parser, '\\');
 	strcpy(arg+1, PYGMENTS_PARSER);
-	arg = malloc(sizeof(PYTHON) + strlen(parser) + sizeof(LANGMAP_OPTION) + strlen(param->langmap) + 1);
+	arg = malloc(sizeof(PYTHON) + strlen(parser) + sizeof(LANGMAP_OPTION) + strlen(param->langmap) + 2 + 1);
 	if (arg == NULL)
 		param->die("short of memory.");
-	len = sprintf(arg, "%s %s %s", PYTHON, parser, LANGMAP_OPTION);
+	len = sprintf(arg, "%s \"%s\" %s", PYTHON, parser, LANGMAP_OPTION);
 	copy_langmap_converting_cpp(arg + len, param->langmap);
 
 	sa.nLength = sizeof(sa);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.