head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.54 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.52 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.50 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.48 pkgsrc-2011Q2-base:1.4 pkgsrc-2009Q4:1.4.0.46 pkgsrc-2009Q4-base:1.4 pkgsrc-2008Q4:1.4.0.44 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.42 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.40 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.38 pkgsrc-2008Q2-base:1.4 pkgsrc-2008Q1:1.4.0.36 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.34 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.32 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.30 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.4.0.28 pkgsrc-2007Q1-base:1.4 pkgsrc-2006Q4:1.4.0.26 pkgsrc-2006Q4-base:1.4 pkgsrc-2006Q3:1.4.0.24 pkgsrc-2006Q3-base:1.4 pkgsrc-2006Q2:1.4.0.22 pkgsrc-2006Q2-base:1.4 pkgsrc-2006Q1:1.4.0.20 pkgsrc-2006Q1-base:1.4 pkgsrc-2005Q4:1.4.0.18 pkgsrc-2005Q4-base:1.4 pkgsrc-2005Q3:1.4.0.16 pkgsrc-2005Q3-base:1.4 pkgsrc-2005Q2:1.4.0.14 pkgsrc-2005Q2-base:1.4 pkgsrc-2005Q1:1.4.0.12 pkgsrc-2005Q1-base:1.4 pkgsrc-2004Q4:1.4.0.10 pkgsrc-2004Q4-base:1.4 pkgsrc-2004Q3:1.4.0.8 pkgsrc-2004Q3-base:1.4 pkgsrc-2004Q2:1.4.0.6 pkgsrc-2004Q2-base:1.4 pkgsrc-2004Q1:1.4.0.4 pkgsrc-2004Q1-base:1.4 pkgsrc-2003Q4:1.4.0.2 pkgsrc-2003Q4-base:1.4 buildlink2-base:1.4 netbsd-1-4-PATCH002:1.3 comdex-fall-1999:1.3 netbsd-1-4-PATCH001:1.3 netbsd-1-4-RELEASE:1.3 netbsd-1-3-PATCH003:1.2; locks; strict; comment @# @; 1.4 date 2000.05.17.10.13.23; author tron; state dead; branches; next 1.3; 1.3 date 99.01.10.23.52.17; author tron; state Exp; branches; next 1.2; 1.2 date 98.08.07.10.40.50; author agc; state Exp; branches; next 1.1; 1.1 date 98.07.15.19.52.56; author tron; state Exp; branches; next ; desc @@ 1.4 log @Update "netpbm" package to version 9.2. There are too many changes and bug fixes to list here. Main new features are shared libraries, JPEG and JBIG support. @ text @$NetBSD: patch-be,v 1.3 1999/01/10 23:52:17 tron Exp $ --- ppm/xpmtoppm.c.orig Mon Jan 31 08:42:05 1994 +++ ppm/xpmtoppm.c Sun Jan 10 23:48:41 1999 @@@@ -30,9 +30,8 @@@@ #include "ppm.h" -static void ReadXPMFile ARGS((FILE *stream, int *widthP, int *heightP, - int *ncolorsP, int *chars_per_pixelP, pixel **colorsP, int **dataP)); -static void getline ARGS((char *line, int size, FILE *stream)); +void ReadXPMFile(); +static void getline(); /* number of xpmColorKeys */ #define NKEYS 5 @@@@ -46,7 +45,27 @@@@ "c", /* key #5: color visual */ }; -int +#ifdef NEED_STRSTR +/* for systems which do not provide it */ +static char * +strstr(s1, s2) + char *s1, *s2; +{ + int ls2 = strlen(s2); + + if (ls2 == 0) + return (s1); + while (strlen(s1) >= ls2) { + if (strncmp(s1, s2, ls2) == 0) + return (s1); + s1++; + } + return (0); +} + +#endif + +void main(argc, argv) int argc; char *argv[]; @@@@ -89,7 +108,6 @@@@ #define MAX_LINE 2048 -static void ReadXPMFile(stream, widthP, heightP, ncolorsP, chars_per_pixelP, colorsP, dataP) @ 1.3 log @Major cleanup of "netpbm" package based on patches supply by John F. Woods in PR pkg/6763 and Rob Windsor in PR pkg/6779. @ text @d1 1 a1 1 $NetBSD$ @ 1.2 log @Add NetBSD RCS Ids. @ text @d3 24 a26 26 --- ./pbm/pbmto10x.c.orig Mon Oct 4 05:10:42 1993 +++ ./pbm/pbmto10x.c Sat Aug 12 23:36:40 1995 @@@@ -1,6 +1,6 @@@@ /* pbmto10x.c - read a portable bitmap and produce a Gemini 10X printer file ** -** Copyright (C) 1990 by Ken Yap +** Copyright (C) 1990, 1994 by Ken Yap ** ** Permission to use, copy, modify, and distribute this software and its ** documentation for any purpose and without fee is hereby granted, provided @@@@ -8,6 +8,8 @@@@ ** copyright notice and this permission notice appear in supporting ** documentation. This software is provided "as is" without express or ** implied warranty. +** +** Modified to shorten stripes and eliminate blank stripes. Dec 1994. */ #include "pbm.h" @@@@ -52,15 +54,40 @@@@ } static void +outstripe(stripe, sP, reschar) + register char *stripe, *sP; + register int reschar; d28 1 a28 1 + register int ncols; d30 8 a37 14 + /* scan backwards, removing empty columns */ + while (sP != stripe) + if (*--sP != 0) + { + ++sP; + break; + } + ncols = sP - stripe; + if (ncols > 0) + { + printf("\033%c%c%c", reschar, ncols % 256, ncols / 256); + fwrite(stripe, sizeof(char), ncols, stdout); + } + putchar('\n'); /* flush buffer */ d40 14 a53 92 +static void res_60x72() { register int i, item, npins, row, col; bit *bitrows[LOW_RES_ROWS], *bP[LOW_RES_ROWS]; + char *stripe, *sP; + stripe = malloc(cols); for (i = 0; i < LOW_RES_ROWS; ++i) bitrows[i] = pbm_allocrow(cols); printf("\033A\010"); /* '\n' = 8/72 */ - for (row = 0; row < rows; row += LOW_RES_ROWS) + for (row = 0, sP = stripe; row < rows; row += LOW_RES_ROWS, sP = stripe) { if (row + LOW_RES_ROWS <= rows) npins = LOW_RES_ROWS; @@@@ -68,17 +95,18 @@@@ npins = rows - row; for (i = 0; i < npins; ++i) pbm_readpbmrow(ifp, bP[i] = bitrows[i], cols, format); - printf("\033K%c%c", cols % 256, cols / 256); for (col = 0; col < cols; ++col) { item = 0; for (i = 0; i < npins; ++i) if (*(bP[i]++) == PBM_BLACK) item |= 1 << (7 - i); - putchar(item); + *sP++ = item; } - putchar('\n'); + outstripe(stripe, sP, 'K'); } + printf("\033@@"); + free(stripe); } static void @@@@ -86,11 +114,13 @@@@ { register int i, pin, item, npins, row, col; bit *bitrows[HIGH_RES_ROWS], *bP[HIGH_RES_ROWS]; + char *stripe, *sP; + stripe = malloc(cols); for (i = 0; i < HIGH_RES_ROWS; ++i) bitrows[i] = pbm_allocrow(cols); - putchar('\033'); putchar('3'); putchar('\0'); - for (row = 0; row < rows; row += HIGH_RES_ROWS) + printf("\0333\001"); /* \n = 1/144" */ + for (row = 0, sP = stripe; row < rows; row += HIGH_RES_ROWS, sP = stripe) { if (row + HIGH_RES_ROWS <= rows) npins = HIGH_RES_ROWS; @@@@ -98,7 +128,6 @@@@ npins = rows - row; for (i = 0; i < npins; ++i) pbm_readpbmrow(ifp, bP[i] = bitrows[i], cols, format); - printf("\033L%c%c", cols % 256, cols / 256); for (col = 0; col < cols; ++col) { item = 0; @@@@ -106,11 +135,10 @@@@ for (pin = i = 0; i < npins; i += 2, ++pin) if (*(bP[i]++) == PBM_BLACK) item |= 1 << (7 - pin); - putchar(item); + *sP++ = item; } - putchar('\n'); /* flush buffer */ - printf("\033J\001"); /* 1/144 down */ - printf("\033L%c%c", cols % 256, cols / 256); + outstripe(stripe, sP, 'L'); + sP = stripe; for (col = 0; col < cols; ++col) { item = 0; @@@@ -118,9 +146,11 @@@@ for (i = 1, pin = 0; i < npins; i += 2, ++pin) if (*(bP[i]++) == PBM_BLACK) item |= 1 << (7 - pin); - putchar(item); + *sP++ = item; } - putchar('\n'); /* flush buffer */ - printf("\033J\017"); /* 15/144 down */ + outstripe(stripe, sP, 'L'); + printf("\033J\016"); /* 14/144 down, \n did 1/144 */ } + printf("\033@@"); + free(stripe); } @ 1.1 log @Add well known fixes for "netpbm-1mar1994" supplied by John F. Woods in PR pkg/5723. @ text @d1 2 @