summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index d16197a..86c2f95 100644
--- a/src/main.c
+++ b/src/main.c
@@ -19,7 +19,10 @@
* along with fbcon2png. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdio.h>
+
#include "font.h"
+#include "i18n.h"
#include "image.h"
#include "text.h"
@@ -27,6 +30,7 @@ int
main(int argc, char **argv)
{
struct font *font;
+ FILE *fp;
struct text *text;
struct image *image;
@@ -35,7 +39,20 @@ main(int argc, char **argv)
}
font = font_find(argv[1]);
- text = text_new(argv[2]);
+ if (strcmp(argv[2], "-") != 0) {
+ fp = fopen(argv[2], "r");
+ if (!fp) {
+ printf(_("Error: Cannot open \"%s\" for reading\n"),
+ argv[2]);
+ return 1;
+ }
+ } else {
+ fp = stdin;
+ }
+ text = text_new(fp);
+ if (fp != stdin) {
+ fclose(fp);
+ }
text_set_width(text, 80);
text_set_height(text, 25);
image = image_new(argv[3]);