[glabels] Allow merge source to be stdin



commit 3444d934754fcc305af29a8c05f19792c77b89e2
Author: Alessandro Zummo <a zummo towertech it>
Date:   Tue Dec 8 22:27:43 2009 -0500

    Allow merge source to be stdin
    
    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 |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/merge-text.c b/src/merge-text.c
index e23803e..c42cd3f 100644
--- a/src/merge-text.c
+++ b/src/merge-text.c
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]