diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-08-01 14:50:34 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-08-01 14:50:34 +0000 |
commit | a02f74723e0932ed303cf421c31e2fbd96a59623 (patch) | |
tree | acf3978b5b4d38e9a30b7179980e37ddf8a1af12 /examples | |
parent | 58bb013bc704f5c907ed8a2838eb682abf9e7310 (diff) | |
download | pango-a02f74723e0932ed303cf421c31e2fbd96a59623.tar.gz |
Don't ignore all trailing whitespace in input text. Only chop one newline.
2006-08-01 Behdad Esfahbod <behdad@gnome.org>
* examples/renderdemo.c (parse_options): Don't ignore all trailing
whitespace in input text. Only chop one newline.
* examples/viewer-main.c (main): setlocale(LC_ALL, "") to get GOption
work for UTF-8 text on the command line.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/renderdemo.c | 18 | ||||
-rw-r--r-- | examples/viewer-main.c | 2 |
2 files changed, 8 insertions, 12 deletions
diff --git a/examples/renderdemo.c b/examples/renderdemo.c index 0dda7eb2..5a38ffd2 100644 --- a/examples/renderdemo.c +++ b/examples/renderdemo.c @@ -640,19 +640,13 @@ parse_options (int argc, char *argv[]) fail ("%s\n", error->message); } - /* Strip trailing whitespace + /* Strip one trailing newline */ - p = text + len; - while (p > text) - { - gunichar ch; - p = g_utf8_prev_char (p); - ch = g_utf8_get_char (p); - if (!g_unichar_isspace (ch)) - break; - else - *p = '\0'; - } + if (len > 0 && text[len - 1] == '\n') + len--; + if (len > 0 && text[len - 1] == '\r') + len--; + text[len] = '\0'; /* Make sure we have valid markup */ diff --git a/examples/viewer-main.c b/examples/viewer-main.c index cba50564..9dc7cc88 100644 --- a/examples/viewer-main.c +++ b/examples/viewer-main.c @@ -24,6 +24,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <locale.h> #include <glib.h> #include <glib/gstdio.h> @@ -47,6 +48,7 @@ main (int argc, gpointer surface; g_type_init(); + setlocale (LC_ALL, ""); parse_options (argc, argv); view = opt_viewer; |