diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-05-12 10:24:00 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-05-12 10:24:00 +0000 |
| commit | 6f4ab22c8a752dbd7d73765fb8429f0845dc6d38 (patch) | |
| tree | 2ed90ceeea5d62f3e2fc01fdd384e9e2686df3d1 /src | |
| parent | Fix for Bug #982846 (untranslatable and unlocalized strings). (diff) | |
| download | inkscape-6f4ab22c8a752dbd7d73765fb8429f0845dc6d38.tar.gz inkscape-6f4ab22c8a752dbd7d73765fb8429f0845dc6d38.zip | |
Fix for externally reported patch by Juergen Weigert, Bug #993500 (inkscape should return non-0 on 'errors')
(bzr r11357)
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 261df9145..15efd22d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -994,8 +994,9 @@ 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; @@ -1019,6 +1020,7 @@ void sp_process_file_list(GSList *fl) } 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) { doc->vacuumDocument(); @@ -1068,6 +1070,7 @@ void sp_process_file_list(GSList *fl) } fl = g_slist_remove(fl, fl->data); } + return retVal; } /** @@ -1123,7 +1126,9 @@ int sp_main_shell(char const* command_name) 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 @@ -1132,6 +1137,7 @@ int sp_main_shell(char const* command_name) g_strfreev(argv); } else { g_warning("Cannot parse commandline: %s", useme); + retval = -1; } } } @@ -1168,10 +1174,13 @@ int sp_main_console(int argc, char const **argv) 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; |
