From 44a31f1ba6fac1a84029a0d9d5c40f7af8717cca Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 1 Jan 2009 23:55:09 +0000 Subject: Don't fail if 'fontdir' file doesn't exist. git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@808 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/ppm/picttoppm.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'converter') diff --git a/converter/ppm/picttoppm.c b/converter/ppm/picttoppm.c index 6f34dae4..a89c3086 100644 --- a/converter/ppm/picttoppm.c +++ b/converter/ppm/picttoppm.c @@ -4056,6 +4056,23 @@ interpret_pict(FILE * const ofP) { +static void +loadDefaultFontDir(void) { +/*---------------------------------------------------------------------------- + Load the fonts from the font directory file "fontdir" (in the current + directory), if it exists. +-----------------------------------------------------------------------------*/ + struct stat statbuf; + int rc; + + rc = stat("fontdir", &statbuf); + + if (rc == 0) + load_fontdir("fontdir"); +} + + + int main(int argc, char * argv[]) { int argn; @@ -4092,8 +4109,6 @@ main(int argc, char * argv[]) { ++argn; } - load_fontdir("fontdir"); - if (argn < argc) { ifp = pm_openr(argv[argn]); ++argn; @@ -4103,6 +4118,8 @@ main(int argc, char * argv[]) { if (argn != argc) pm_usage(usage); + loadDefaultFontDir(); + if (header) { stage = "Reading 512 byte header"; skip(512); -- cgit 1.4.1