Kaydet (Commit) dc4bc34e authored tarafından Enrico Tröger's avatar Enrico Tröger

Add support for env wrapper in shebang detection (inspired by a patch from Yura Siamashka).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2013 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 281641de
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
contains double quotes. contains double quotes.
Fix error in Build command when the executable file name contains Fix error in Build command when the executable file name contains
spaces(Linux and Windows). spaces(Linux and Windows).
* src/filetypes.c: Add support for env wrapper in shebang detection
(inspired by a patch from Yura Siamashka).
2007-11-02 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> 2007-11-02 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
......
...@@ -576,8 +576,13 @@ static filetype *find_shebang(gint idx) ...@@ -576,8 +576,13 @@ static filetype *find_shebang(gint idx)
if (strlen(line) > 2 && line[0] == '#' && line[1] == '!') if (strlen(line) > 2 && line[0] == '#' && line[1] == '!')
{ {
/// TODO does g_path_get_basename() also work under Win32 for Unix filenames? gchar *tmp = g_path_get_basename(line + 2);
gchar *basename_interpreter = g_path_get_basename(line + 2); gchar *basename_interpreter = tmp;
if (strncmp(tmp, "env ", 4) == 0 && strlen(tmp) > 4)
{ // skip "env" and read the following interpreter
basename_interpreter +=4;
}
if (strncmp(basename_interpreter, "sh", 2) == 0) if (strncmp(basename_interpreter, "sh", 2) == 0)
ft = filetypes[GEANY_FILETYPES_SH]; ft = filetypes[GEANY_FILETYPES_SH];
...@@ -605,9 +610,8 @@ static filetype *find_shebang(gint idx) ...@@ -605,9 +610,8 @@ static filetype *find_shebang(gint idx)
ft = filetypes[GEANY_FILETYPES_D]; ft = filetypes[GEANY_FILETYPES_D];
else if (strncmp(basename_interpreter, "wish", 4) == 0) else if (strncmp(basename_interpreter, "wish", 4) == 0)
ft = filetypes[GEANY_FILETYPES_TCL]; ft = filetypes[GEANY_FILETYPES_TCL];
// what else to add?
g_free(basename_interpreter); g_free(tmp);
} }
// detect XML files // detect XML files
if (strncmp(line, "<?xml", 5) == 0) if (strncmp(line, "<?xml", 5) == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment