[lasem] render: don't overwrite input file if neither -f or -o option is present
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] render: don't overwrite input file if neither -f or -o option is present
- Date: Mon, 3 Aug 2015 12:59:52 +0000 (UTC)
commit 16030a377624b86281d31410a4720eb67ff10958
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Mon Aug 3 14:59:15 2015 +0200
render: don't overwrite input file if neither -f or -o option is present
src/lasemrender.c | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/src/lasemrender.c b/src/lasemrender.c
index 7c6e7fa..c73a579 100644
--- a/src/lasemrender.c
+++ b/src/lasemrender.c
@@ -104,21 +104,21 @@ int main(int argc, char **argv)
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_option_context_free (context);
- g_print (_("Option parsing failed: %s\n"), error->message);
+ printf ("%s %s\n", _("Option parsing failed:"), error->message);
return EXIT_FAILURE;
}
g_option_context_free (context);
if (option_zoom < 0.0) {
- g_print (_("Invalid zoom value"));
+ printf ("%s\n", _("Invalid zoom value"));
return EXIT_FAILURE;
}
lsm_debug_enable (option_debug_domains);
if (option_input_filenames == NULL || g_strv_length (option_input_filenames) > 1) {
- g_print (_("One input file name is required\n"));
+ printf ("%s\n", _("Missing input filename"));
return EXIT_FAILURE;
}
@@ -129,7 +129,7 @@ int main(int argc, char **argv)
if (g_ascii_strcasecmp (option_output_file_format, file_formats[format]) == 0)
break;
if (FORMAT_UNKNOWN == format) {
- g_print (_("Unknown format: %s\n"), option_output_file_format);
+ printf ("%s %s\n", _("Unknown format:"), option_output_file_format);
return EXIT_FAILURE;
}
} else
@@ -168,6 +168,11 @@ int main(int argc, char **argv)
g_free (directory);
}
+ if (format == FORMAT_UNKNOWN) {
+ printf ("%s\n", _("Don't know which format to use, please either give a format (-f) or an
output filename (-o)"));
+ return EXIT_FAILURE;
+ }
+
document = lsm_dom_document_new_from_path (input_filename,
NULL);
if (document == NULL) {
@@ -191,7 +196,7 @@ int main(int argc, char **argv)
lsm_dom_document_save_to_memory (document, &buffer, &size, NULL);
if (buffer != NULL) {
- g_printf ("%*s\n", (int) size, (char *) buffer);
+ printf ("%*s\n", (int) size, (char *) buffer);
g_free (buffer);
}
}
@@ -254,7 +259,8 @@ int main(int argc, char **argv)
lsm_debug_render ("width = %g pt, height = %g pt", width_pt, height_pt);
} else {
- g_print (_("Can't load '%s'\n"), input_filename);
+ printf (_("Can't load '%s'"), input_filename);
+ printf ("\n");
return EXIT_FAILURE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]