This patch fixes picttoppm so: + it doesn't complain about rowbytes + uses a global fontdir + closes the fontdir file =========================================================================== *** ppm/picttoppm.1 Tue Jul 8 22:25:00 1997 --- ppm/picttoppm.1.orig Fri Oct 22 09:43:17 1993 *************** *** 8,14 **** .RB [ -fullres ] .RB [ -noheader ] .RB [ -quickdraw ] - .RB [ -warnings ] .RB [ -fontdir file ] .RI [ pictfile ] .SH DESCRIPTION --- 8,13 ---- *************** *** 17,30 **** .IX Macintosh Useful as the first step in converting a scanned image to something that can be displayed on Unix. - (this not the original program; modified Jul 1995) .SH OPTIONS .TP .B \-fontdir \fIfile\fP Make the list of BDF fonts in ``file'' available for use by .IR picttoppm ! when drawing text. This overrides the environment variable ! PICT_FONTDIR. (variable added by SPDsoft, 1995). See below for the format of the fontdir file. .TP .B \-fullres --- 16,27 ---- .IX Macintosh Useful as the first step in converting a scanned image to something that can be displayed on Unix. .SH OPTIONS .TP .B \-fontdir \fIfile\fP Make the list of BDF fonts in ``file'' available for use by .IR picttoppm ! when drawing text. See below for the format of the fontdir file. .TP .B \-fullres *************** *** 43,56 **** Execute only pure quickdraw operations. In particular, turn off the interpretation of special PostScript printer operations. .TP - .B \-warnings - This is a modified - .IR picttoppm - (SPDsoft, 1995) which supresses those nasty 'linelen > rowbytes' warnings. - With this option, modified - .IR picttoppm - behaves just like the original program. - .TP .B \-verbose Turns on verbose mode which prints a a whole bunch of information that only --- 40,45 ---- *************** *** 121,132 **** Obviously the font defintions are strongly related to the Macintosh. More font numbers and information about fonts can be found in Macintosh documentation. - .SH ENVIRONMENT VARIABLES - .IP PICT_FONTDIR - The default fontdir file is located at /usr/local/netpbm/lib/fontdir. - You can set this variable to point to your personal 'fontdir' - .SH FILES - /usr/local/netpbm/lib/fontdir: Default fontdir. .SH SEE ALSO Inside Macintosh volumes 1 and 5, ppmtopict(1), --- 110,115 ---- *** ppm/picttoppm.c Wed Jul 9 02:06:45 1997 --- ppm/picttoppm.c.orig Tue Dec 7 08:47:02 1993 *************** *** 23,29 **** #ifdef STANDALONE #include - #include #ifdef __STDC__ #define ARGS(x) x #else --- 23,28 ---- *************** *** 113,119 **** static word rowlen; static word collen; static longword planelen; - static int warnings; static int verbose; static int fullres; static int recognize_comment; --- 112,117 ---- *************** *** 543,555 **** int argn; int header; char* usage = ! "[-warnings] [-verbose] [-fullres] [-noheader] [-quickdraw] [-fontdir file] [pictfile]"; - char *fontdir; ppm_init( &argc, argv ); argn = 1; - warnings = 0; verbose = 0; fullres = 0; header = 1; --- 541,551 ---- int argn; int header; char* usage = ! "[-verbose] [-fullres] [-noheader] [-quickdraw] [-fontdir file] [pictfile]"; ppm_init( &argc, argv ); argn = 1; verbose = 0; fullres = 0; header = 1; *************** *** 558,565 **** while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0') { if (pm_keymatch(argv[argn], "-verbose", 2)) verbose++; - else if (pm_keymatch(argv[argn], "-warnings", 2)) - warnings = 1; else if (pm_keymatch(argv[argn], "-fullres", 3)) fullres = 1; else if (pm_keymatch(argv[argn], "-noheader", 2)) --- 554,559 ---- *************** *** 578,587 **** ++argn; } ! fontdir=getenv("PICT_FONTDIR"); ! ! if (load_fontdir( fontdir == NULL ? "/usr/local/netpbm/lib/fontdir" ! : fontdir ) < 0) pm_message("warning: can't load font directory 'fontdir'\n", 0,0,0,0); if (argn < argc) { --- 572,578 ---- ++argn; } ! if (load_fontdir("fontdir") < 0) pm_message("warning: can't load font directory 'fontdir'\n", 0,0,0,0); if (argn < argc) { *************** *** 1800,1806 **** pm_message("linelen: %d", linelen, 0, 0, 0, 0); if (linelen > rowBytes) { - if ( warnings ) pm_message("linelen > rowbytes! (%d > %d) at line %d", linelen, rowBytes, i, 0, 0); } --- 1791,1796 ---- *************** *** 3266,3281 **** { FILE* fp; int n, nfont; ! char* arg[50], line[1024]; struct fontinfo* fontinfo; - if (!(fp = fopen(dirfile, "r"))) return -1; nfont = 0; while (fgets(line, 1024, fp)) { ! if (( *line == '#' ) || (n = mk_argvn(line, arg, 5))) continue; if (n != 4) continue; --- 3256,3270 ---- { FILE* fp; int n, nfont; ! char* arg[5], line[1024]; struct fontinfo* fontinfo; if (!(fp = fopen(dirfile, "r"))) return -1; nfont = 0; while (fgets(line, 1024, fp)) { ! if ((n = mk_argvn(line, arg, 5)) == 0 || arg[0][0] == '#') continue; if (n != 4) continue; *************** *** 3296,3302 **** fontlist_ins = &fontinfo->next; nfont++; } - fclose(fp); return nfont; } --- 3285,3290 ----