--- inkscape-0.48.3.1/src/main.cpp.orig 2012-04-18 20:25:28.000000000 +0200 +++ inkscape-0.48.3.1/src/main.cpp 2012-04-19 17:42:14.731534000 +0200 @@ -986,12 +986,13 @@ sp_main_gui(int argc, char const **argv) } /** * Process file list */ -void sp_process_file_list(GSList *fl) +int sp_process_file_list(GSList *fl) { + int retVal = 0; while (fl) { const gchar *filename = (gchar *)fl->data; SPDocument *doc = NULL; try { @@ -1011,10 +1012,11 @@ void sp_process_file_list(GSList *fl) doc = NULL; } } if (doc == NULL) { g_warning("Specified document %s cannot be opened (does not exist or not a valid SVG file)", filename); + retVal++; } else { if (sp_vacuum_defs) { vacuum_document(doc); } if (sp_vacuum_defs && !sp_export_svg) { @@ -1060,10 +1062,11 @@ void sp_process_file_list(GSList *fl) delete doc; } fl = g_slist_remove(fl, fl->data); } + return retVal; } /** * Run the application as an interactive shell, parsing command lines from stdin * Returns -1 on error. @@ -1115,19 +1118,21 @@ int sp_main_shell(char const* command_na if ( g_shell_parse_argv(command_line, &argc, &argv, &parseError) ) { poptContext ctx = poptGetContext(NULL, argc, const_cast(argv), options, 0); poptSetOtherOptionHelp(ctx, _("[OPTIONS...] [FILE...]\n\nAvailable options:")); if ( ctx ) { GSList *fl = sp_process_args(ctx); - sp_process_file_list(fl); + if (sp_process_file_list(fl)) + retval = -1; poptFreeContext(ctx); } else { retval = 1; // not sure why. But this was the previous return value } resetCommandlineGlobals(); g_strfreev(argv); } else { g_warning("Cannot parse commandline: %s", useme); + retval = -1; } } } } // if (linedata... } while (linedata && (retval == 0)); @@ -1160,14 +1165,15 @@ int sp_main_console(int argc, char const } inkscape_application_init(argv[0], false); if (sp_shell) { - sp_main_shell(argv[0]); // Run as interactive shell - exit(0); + int retVal = sp_main_shell(argv[0]); // Run as interactive shell + exit((retVal < 0) ? 1 : 0); } else { - sp_process_file_list(fl); // Normal command line invokation + int retVal = sp_process_file_list(fl); // Normal command line invokation + if (retVal) exit(1); } return 0; }