]> git.sur5r.net Git - glabels/commitdiff
Allow merge source to be stdin
authorAlessandro Zummo <a.zummo@towertech.it>
Wed, 9 Dec 2009 03:27:43 +0000 (22:27 -0500)
committerJim Evins <evins@snaught.com>
Wed, 9 Dec 2009 03:27:43 +0000 (22:27 -0500)
Use the filename "-" to indicate that the merge source is to be taken from
standard input (stdin).  This is primarily intended for the glabels-batch
program.

src/merge-text.c

index e23803e9d01f96823bb6abf60dad0184df841c0f..c42cd3f72023f655ddd7910ee0eedd5c7effeaae 100644 (file)
@@ -340,7 +340,11 @@ gl_merge_text_open (glMerge *merge)
 
        if (src != NULL)
         {
-               merge_text->priv->fp = fopen (src, "r");
+               if (g_utf8_strlen(src, -1) == 1 && src[0] == '-')
+                       merge_text->priv->fp = stdin;
+               else
+                       merge_text->priv->fp = fopen (src, "r");
+
                 g_free (src);
 
                 clear_keys (merge_text);