aboutsummaryrefslogtreecommitdiff
path: root/src/gui_index.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui_index.c')
-rw-r--r--src/gui_index.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/gui_index.c b/src/gui_index.c
index 6ce406e3..ba9302a3 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -641,9 +641,31 @@ gint index_one_sig(GtkWidget *widget, struct crystfelproject *proj)
}
+static int contains_spaces(const char *str)
+{
+ int i;
+ size_t len;
+ len = strlen(str);
+ for ( i=0; i<len; i++ ) {
+ if ( str[i] == ' ' ) return 1;
+ }
+ return 0;
+}
+
+
static void add_arg(char **args, int pos, const char *label)
{
- args[pos] = strdup(label);
+ if ( contains_spaces(label) ) {
+ size_t len = strlen(label)+3;
+ args[pos] = malloc(len);
+ args[pos][0] = '"';
+ args[pos][1] = '\0';
+ strcat(args[pos], label);
+ args[pos][len-2] = '"';
+ args[pos][len-1] = '\0';
+ } else {
+ args[pos] = strdup(label);
+ }
}