Revision: 2013 http://geany.svn.sourceforge.net/geany/?rev=2013&view=rev Author: eht16 Date: 2007-11-04 02:06:06 -0800 (Sun, 04 Nov 2007)
Log Message: ----------- Add support for env wrapper in shebang detection (inspired by a patch from Yura Siamashka).
Modified Paths: -------------- trunk/ChangeLog trunk/src/filetypes.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-11-04 09:57:47 UTC (rev 2012) +++ trunk/ChangeLog 2007-11-04 10:06:06 UTC (rev 2013) @@ -5,6 +5,8 @@ contains double quotes. Fix error in Build command when the executable file name contains 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>
Modified: trunk/src/filetypes.c =================================================================== --- trunk/src/filetypes.c 2007-11-04 09:57:47 UTC (rev 2012) +++ trunk/src/filetypes.c 2007-11-04 10:06:06 UTC (rev 2013) @@ -576,9 +576,14 @@
if (strlen(line) > 2 && line[0] == '#' && line[1] == '!') { - /// TODO does g_path_get_basename() also work under Win32 for Unix filenames? - gchar *basename_interpreter = g_path_get_basename(line + 2); + gchar *tmp = 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) ft = filetypes[GEANY_FILETYPES_SH]; else if (strncmp(basename_interpreter, "bash", 4) == 0) @@ -605,9 +610,8 @@ ft = filetypes[GEANY_FILETYPES_D]; else if (strncmp(basename_interpreter, "wish", 4) == 0) ft = filetypes[GEANY_FILETYPES_TCL]; - // what else to add?
- g_free(basename_interpreter); + g_free(tmp); } // detect XML files if (strncmp(line, "<?xml", 5) == 0) @@ -862,7 +866,7 @@ static gboolean loaded[GEANY_MAX_FILE_TYPES] = {FALSE};
g_return_if_fail(ft_id >= 0 && ft_id < GEANY_MAX_FILE_TYPES); - + if (loaded[ft_id]) return; loaded[ft_id] = TRUE; @@ -887,7 +891,7 @@
load_settings(ft_id, config, config_home); highlighting_init_styles(ft_id, config, config_home); - + g_key_file_free(config); g_key_file_free(config_home); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.