From da4247d87c78d80b83f60fb6d89c8650bee36f3d Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 19 Aug 2014 15:04:30 +0200 Subject: [PATCH] app: interpreter arguments for plugins not returned. When a plugin file's shebang would start with "/usr/bin/env", the interpreter's arguments were not returned by resolve_sh_bang(). --- app/plug-in/gimpinterpreterdb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/plug-in/gimpinterpreterdb.c b/app/plug-in/gimpinterpreterdb.c index 28d0e05139..68582443da 100644 --- a/app/plug-in/gimpinterpreterdb.c +++ b/app/plug-in/gimpinterpreterdb.c @@ -692,12 +692,18 @@ resolve_sh_bang (GimpInterpreterDB *db, { if (strcmp ("/usr/bin/env", name) == 0) { - program = g_hash_table_lookup (db->programs, cp); - if (program) - return g_strdup (program); + /* Shift program name and arguments to the right. */ + name = cp; + + for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) + ; + + while ((*cp == ' ') || (*cp == '\t')) + *cp++ = '\0'; } - *interp_arg = g_strdup (cp); + if (*cp) + *interp_arg = g_strdup (cp); } program = g_hash_table_lookup (db->programs, name);