Branch: master

c98929e9 2014-03-28 00:36:55 Timothy Pearson
Fix tdelfeditor choking on metadata parameters that start with a dash
M tdelfeditor/tdelfeditor.cpp
diff --git a/tdelfeditor/tdelfeditor.cpp b/tdelfeditor/tdelfeditor.cpp
index fc17f03..8f4317c 100644
--- a/tdelfeditor/tdelfeditor.cpp
+++ b/tdelfeditor/tdelfeditor.cpp
@@ -187,7 +187,7 @@
 	
 	opterr = 0;  /* Prevent automatic getopt() error message */
 
-	while ((c = getopt_long(argc, argv, elficon_options.short_options, elficon_options.long_options, &index)) != EOF)
+	while ((c = getopt_long((argc>3)?3:argc, argv, elficon_options.short_options, elficon_options.long_options, &index)) != EOF)
 	{
 		switch(c)
 		{
@@ -234,8 +234,10 @@
 				goto print_icon_usage;
 		}
 		index++;
-		if(argc != required_params)
+		if(argc != required_params) {
+			fprintf(stderr, _("%s: was given %d arguments, needed %d\n"), argv[PARAM_PROGNAME], argc, required_params);
 			goto print_icon_usage;
+		}
 	}
 	return TRUE;
 print_icon_usage: