home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3247
< prev
next >
Wrap
Internet Message Format
|
1991-04-28
|
53KB
From: mcastle@mcs213d.cs.umr.edu (Mike Castle {Nexus})
Newsgroups: alt.sources
Subject: PBMPlus on MSDOS patches (02/03)
Message-ID: <2693@umriscc.isc.umr.edu>
Date: 29 Apr 91 03:47:24 GMT
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtopi3.c pbmplus.new/pbm/pbmtopi3.c
*** pbmplus.old/pbm/pbmtopi3.c Fri Apr 12 00:30:36 1991
--- pbmplus.new/pbm/pbmtopi3.c Fri Apr 19 19:56:32 1991
***************
*** 17,22 ****
--- 17,27 ----
static void putinit(), putbit(), putrest(), putitem();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 34,40 ****
if ( argc == 2 )
ifp = pm_openr( argv[1] );
else
! ifp = stdin;
pbm_readpbminit( ifp, &cols, &rows, &format );
if (cols > 640)
--- 39,57 ----
if ( argc == 2 )
ifp = pm_openr( argv[1] );
else
! ifp = stdin;
!
! #ifdef GNUDOS
! if ( ifp == stdin )
! strcpy( fname, "noname" );
! else {
! strcpy( fname, argv[1] );
! if ( ( fcp = index( fname, '.' ) ) != 0 )
! *fcp = '\0';
! }
! strcat( fname, ".pi3" );
! ofp = pm_openwb( fname );
! #endif /* GNUDOS */
pbm_readpbminit( ifp, &cols, &rows, &format );
if (cols > 640)
***************
*** 63,69 ****
putrest( );
! exit( 0 );
}
short item;
--- 80,89 ----
putrest( );
! #ifdef GNUDOS
! pm_close( ofp );
! #endif /* GNUDOS */
! exit( 0 );
}
short item;
***************
*** 81,87 ****
--- 101,111 ----
hdr.res = 2;
hdr.pal[0] = 0x0777;
hdr.pal[1] = 0x0700;
+ #ifdef GNUDOS
+ fwrite( &hdr, sizeof(hdr), 1, ofp );
+ #else /* GNUDOS */
fwrite( &hdr, sizeof(hdr), 1, stdout );
+ #endif /* GNUDOS */
item = 0;
bitsperitem = 0;
bitshift = 15;
***************
*** 108,115 ****
static void
putitem( )
! {
fwrite( &item, sizeof(item), 1, stdout );
item = 0;
bitsperitem = 0;
bitshift = 15;
--- 132,143 ----
static void
putitem( )
! {
! #ifdef GNUDOS
! fwrite( &item, sizeof(item), 1, ofp );
! #else /* GNUDOS */
fwrite( &item, sizeof(item), 1, stdout );
+ #endif /* GNUDOS */
item = 0;
bitsperitem = 0;
bitshift = 15;
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtoplo.c pbmplus.new/pbm/pbmtoplo.c
*** pbmplus.old/pbm/pbmtoplo.c Fri Apr 12 00:30:32 1991
--- pbmplus.new/pbm/pbmtoplo.c Fri Apr 19 19:56:26 1991
***************
*** 13,24 ****
--- 13,34 ----
#include <stdio.h>
#include "pbm.h"
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
static void
puttwo( i )
int i;
{
+ #ifdef GNUDOS
+ (void) fputc( i, ofp );
+ (void) fputc( i >> 8, ofp );
+ #else /* GNUDOS */
(void) putchar(i);
(void) putchar(i >> 8);
+ #endif /* GNUDOS */
}
void main( argc, argv )
***************
*** 37,47 ****
ifp = (argc == 2) ? pm_openr( argv[1] ) : stdin;
! bits = pbm_readpbm( ifp, &cols, &rows );
pm_close( ifp );
(void) putchar( 's' );
puttwo( 0 );
puttwo( 0 );
puttwo( rows - 1 );
--- 47,73 ----
ifp = (argc == 2) ? pm_openr( argv[1] ) : stdin;
! #ifdef GNUDOS
! if ( ifp == stdin )
! strcpy( fname, "noname" );
! else {
! strcpy( fname, argv[1] );
! if ( ( fcp = index( fname, '.' ) ) != 0 )
! *fcp = '\0';
! }
! strcat( fname, ".plo" );
! ofp = pm_openwb( fname );
! #endif /* GNUDOS */
!
! bits = pbm_readpbm( ifp, &cols, &rows );
pm_close( ifp );
+ #ifdef GNUDOS
+ (void) fputc( 's', ofp );
+ #else /* GNUDOS */
(void) putchar( 's' );
+ #endif /* GNUDOS */
puttwo( 0 );
puttwo( 0 );
puttwo( rows - 1 );
***************
*** 57,66 ****
--- 83,100 ----
; /* nothing */
--col;
if ( col == scol )
+ #ifdef GNUDOS
+ (void) fputc( 'p', ofp );
+ #else /* GNUDOS */
(void) putchar( 'p' );
+ #endif /* GNUDOS */
else
{
+ #ifdef GNUDOS
+ (void) fputc( 'l', ofp );
+ #else /* GNUDOS */
(void) putchar( 'l' );
+ #endif /* GNUDOS */
puttwo( scol );
puttwo( rows - 1 - row );
}
***************
*** 68,73 ****
--- 102,111 ----
puttwo( rows - 1 - row );
}
}
+
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtoptx.c pbmplus.new/pbm/pbmtoptx.c
*** pbmplus.old/pbm/pbmtoptx.c Fri Apr 12 00:30:30 1991
--- pbmplus.new/pbm/pbmtoptx.c Fri Apr 19 19:56:12 1991
***************
*** 14,19 ****
--- 14,24 ----
static void putinit(), putbit(), putrest(), putitem();
+ #ifdef GNUDOS
+ FILE *ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 33,38 ****
--- 38,57 ----
else
ifp = stdin;
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.') ) != 0 )
+ *fcp = '\0';
+ }
+
+ strcat( fname, ".ptx" );
+ ofp = pm_openwb( fname );
+
+ #endif /* GNUDOS */
+
pbm_readpbminit( ifp, &cols, &rows, &format );
bitrow = pbm_allocrow( cols );
***************
*** 43,54 ****
for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
putbit( *bP );
putrest( );
putchar( 5 );
putchar( '\n' );
}
pm_close( ifp );
!
exit( 0 );
}
--- 62,82 ----
for ( col = 0, bP = bitrow; col < cols; col++, bP++ )
putbit( *bP );
putrest( );
+ #ifdef GNUDOS
+ fputc( 5, ofp );
+ fputc( '\n', ofp );
+ #else /* GNUDOS */
putchar( 5 );
putchar( '\n' );
+ #endif /* GNUDOS */
}
pm_close( ifp );
!
! #ifdef GNUDOS
! pm_close( ofp );
! #endif /* GNUDOS */
!
exit( 0 );
}
***************
*** 86,92 ****
--- 114,124 ----
static void
putitem( )
{
+ #ifdef GNUDOS
+ fputc( item, ofp );
+ #else /* GNUDOS */
putchar( item );
+ #endif /* GNUDOS */
bitsperitem = 0;
item = 64;
bitshift = 0;
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtox10.c pbmplus.new/pbm/pbmtox10.c
*** pbmplus.old/pbm/pbmtox10.c Fri Apr 12 00:30:30 1991
--- pbmplus.new/pbm/pbmtox10.c Fri Apr 19 19:56:06 1991
***************
*** 12,17 ****
--- 12,22 ----
#include "pbm.h"
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 49,54 ****
--- 54,71 ----
strcpy( name, "noname" );
}
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".x10" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pbm_readpbminit( ifp, &cols, &rows, &format );
bitrow = pbm_allocrow( cols );
***************
*** 55,63 ****
/* Compute padding to round cols up to the nearest multiple of 16. */
padright = ( ( cols + 15 ) / 16 ) * 16 - cols;
! printf( "#define %s_width %d\n", name, cols );
printf( "#define %s_height %d\n", name, rows );
printf( "static short %s_bits[] = {\n", name );
itemsperline = 0;
bitsperitem = 0;
--- 72,86 ----
/* Compute padding to round cols up to the nearest multiple of 16. */
padright = ( ( cols + 15 ) / 16 ) * 16 - cols;
! #ifdef GNUDOS
! fprintf( ofp, "#define %s_width %d\n", name, cols );
! fprintf( ofp, "#define %s_height %d\n", name, rows );
! fprintf( ofp, "static short %s_bits[] = {\n", name );
! #else /* GNUDOS */
! printf( "#define %s_width %d\n", name, cols );
printf( "#define %s_height %d\n", name, rows );
printf( "static short %s_bits[] = {\n", name );
+ #endif /* GNUDOS */
itemsperline = 0;
bitsperitem = 0;
***************
*** 64,69 ****
--- 87,117 ----
item = 0;
firstitem = 1;
+ #ifdef GNUDOS
+ #define PUTITEM \
+ { \
+ if ( firstitem ) \
+ firstitem = 0; \
+ else \
+ fputc( ',', ofp ); \
+ if ( itemsperline == 11 ) \
+ { \
+ fputc( '\n', ofp ); \
+ itemsperline = 0; \
+ } \
+ if ( itemsperline == 0 ) \
+ fputc( ' ', ofp ); \
+ itemsperline++; \
+ fputc('0', ofp ); \
+ fputc('x', ofp ); \
+ fputc(hexchar[item >> 12], ofp ); \
+ fputc(hexchar[(item >> 8) & 15], ofp ); \
+ fputc(hexchar[(item >> 4) & 15], ofp ); \
+ fputc(hexchar[item & 15], ofp ); \
+ bitsperitem = 0; \
+ item = 0; \
+ }
+ #else /* GNUDOS */
#define PUTITEM \
{ \
if ( firstitem ) \
***************
*** 87,92 ****
--- 135,141 ----
bitsperitem = 0; \
item = 0; \
}
+ #endif /* GNUDOS */
#define PUTBIT(b) \
{ \
***************
*** 110,116 ****
if ( bitsperitem > 0 )
PUTITEM;
! printf( "};\n" );
exit( 0 );
}
--- 159,173 ----
if ( bitsperitem > 0 )
PUTITEM;
! #ifdef GNUDOS
! fprintf( ofp, "};\n" );
! #else /* GNUDOS */
! printf( "};\n" );
! #endif /* GNUDOS */
!
! #ifdef GNUDOS
! pm_close( ofp );
! #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtoxbm.c pbmplus.new/pbm/pbmtoxbm.c
*** pbmplus.old/pbm/pbmtoxbm.c Fri Apr 12 00:30:30 1991
--- pbmplus.new/pbm/pbmtoxbm.c Fri Apr 19 19:55:58 1991
***************
*** 12,17 ****
--- 12,22 ----
#include "pbm.h"
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 49,54 ****
--- 54,71 ----
strcpy( name, "noname" );
}
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".xbm" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pbm_readpbminit( ifp, &cols, &rows, &format );
bitrow = pbm_allocrow( cols );
***************
*** 55,63 ****
--- 72,86 ----
/* Compute padding to round cols up to the nearest multiple of 8. */
padright = ( ( cols + 7 ) / 8 ) * 8 - cols;
+ #ifdef GNUDOS
+ fprintf( ofp, "#define %s_width %d\n", name, cols );
+ fprintf( ofp, "#define %s_height %d\n", name, rows );
+ fprintf( ofp, "static char %s_bits[] = {\n", name );
+ #else /* GNUDOS */
printf( "#define %s_width %d\n", name, cols );
printf( "#define %s_height %d\n", name, rows );
printf( "static char %s_bits[] = {\n", name );
+ #endif /* GNUDOS */
itemsperline = 0;
bitsperitem = 0;
***************
*** 64,69 ****
--- 87,115 ----
item = 0;
firstitem = 1;
+ #ifdef GNUDOS
+ #define PUTITEM \
+ { \
+ if ( firstitem ) \
+ firstitem = 0; \
+ else \
+ fputc( ',' , ofp ); \
+ if ( itemsperline == 15 , ofp ) \
+ { \
+ fputc( '\n' , ofp ); \
+ itemsperline = 0; \
+ } \
+ if ( itemsperline == 0 , ofp ) \
+ fputc( ' ' , ofp ); \
+ itemsperline++; \
+ fputc('0', ofp ); \
+ fputc('x', ofp ); \
+ fputc(hexchar[item >> 4], ofp ); \
+ fputc(hexchar[item & 15], ofp ); \
+ bitsperitem = 0; \
+ item = 0; \
+ }
+ #else /* GNUDOS */
#define PUTITEM \
{ \
if ( firstitem ) \
***************
*** 85,90 ****
--- 131,137 ----
bitsperitem = 0; \
item = 0; \
}
+ #endif /* GNUDOS */
#define PUTBIT(b) \
{ \
***************
*** 109,115 ****
if ( bitsperitem > 0 )
PUTITEM;
! printf( "};\n" );
!
exit( 0 );
}
--- 156,166 ----
if ( bitsperitem > 0 )
PUTITEM;
! #ifdef GNUDOS
! fprintf( ofp, "};\n" );
! pm_close( ofp );
! #else /* GNUDOS */
! printf( "};\n" );
! #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtoybm.c pbmplus.new/pbm/pbmtoybm.c
*** pbmplus.old/pbm/pbmtoybm.c Fri Apr 12 00:30:36 1991
--- pbmplus.new/pbm/pbmtoybm.c Fri Apr 19 22:40:18 1991
***************
*** 18,23 ****
--- 18,28 ----
static void putinit(), putbit(), putrest(), putitem();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 36,41 ****
--- 41,58 ----
else
ifp = stdin;
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".ybm" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pbm_readpbminit( ifp, &cols, &rows, &format );
bitrow = pbm_allocrow( cols );
***************
*** 45,51 ****
putinit( cols, rows );
for ( row = 0; row < rows; ++row )
{
! printf(stderr,"row %d\n", row);
pbm_readpbmrow( ifp, bitrow, cols, format );
for ( col = 0, bP = bitrow; col < cols; ++col, ++bP )
putbit( *bP );
--- 62,68 ----
putinit( cols, rows );
for ( row = 0; row < rows; ++row )
{
! fprintf(stderr,"row %d\n", row);
pbm_readpbmrow( ifp, bitrow, cols, format );
for ( col = 0, bP = bitrow; col < cols; ++col, ++bP )
putbit( *bP );
***************
*** 58,63 ****
--- 75,84 ----
putrest( );
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit( 0 );
}
***************
*** 68,76 ****
putinit( cols, rows )
int cols, rows;
{
! pm_writebigshort( stdout, YBM_MAGIC );
pm_writebigshort( stdout, cols );
pm_writebigshort( stdout, rows );
item = 0;
bitsperitem = 0;
bitshift = 0;
--- 89,103 ----
putinit( cols, rows )
int cols, rows;
{
! #ifdef GNUDOS
! pm_writebigshort( ofp, YBM_MAGIC );
! pm_writebigshort( ofp, cols );
! pm_writebigshort( ofp, rows );
! #else /* GNUDOS */
! pm_writebigshort( stdout, YBM_MAGIC );
pm_writebigshort( stdout, cols );
pm_writebigshort( stdout, rows );
+ #endif /* GNUDOS */
item = 0;
bitsperitem = 0;
bitshift = 0;
***************
*** 98,104 ****
--- 125,135 ----
static void
putitem( )
{
+ #ifdef GNUDOS
+ pm_writebigshort( ofp, item );
+ #else /* GNUDOS */
pm_writebigshort( stdout, item );
+ #endif /* GNUDOS */
item = 0;
bitsperitem = 0;
bitshift = 0;
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pbmtozin.c pbmplus.new/pbm/pbmtozin.c
*** pbmplus.old/pbm/pbmtozin.c Fri Apr 12 00:30:36 1991
--- pbmplus.new/pbm/pbmtozin.c Fri Apr 19 20:45:32 1991
***************
*** 21,26 ****
--- 21,31 ----
#include <stdio.h>
#include "pbm.h"
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 59,64 ****
--- 64,75 ----
strcpy( name, "noname" );
}
+ #ifdef GNUDOS
+ strcpy( fname, name );
+ strcat( fname, ".zin" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pbm_readpbminit( ifp, &cols, &rows, &format );
bitrow = pbm_allocrow( cols );
***************
*** 65,73 ****
--- 76,90 ----
/* Compute padding to round cols up to the nearest multiple of 16. */
padright = ( ( cols + 15 ) / 16 ) * 16 - cols;
+ #ifdef GNUDOS
+ fprintf( ofp, "USHORT %s[] = {\n",name);
+ fprintf( ofp, " %d\n", cols );
+ fprintf( ofp, " %d\n", rows );
+ #else /* GNUDOS */
printf( "USHORT %s[] = {\n",name);
printf( " %d\n", cols );
printf( " %d\n", rows );
+ #endif /* GNUDOS */
itemsperline = 0;
bitsperitem = 0;
***************
*** 74,79 ****
--- 91,121 ----
item = 0;
firstitem = 1;
+ #ifdef GNUDOS
+ #define PUTITEM \
+ { \
+ if ( firstitem ) \
+ firstitem = 0; \
+ else \
+ fputc( ',', ofp ); \
+ if ( itemsperline == 11 ) \
+ { \
+ fputc( '\n', ofp ); \
+ itemsperline = 0; \
+ } \
+ if ( itemsperline == 0 ) \
+ fputc( ' ', ofp ); \
+ ++itemsperline; \
+ fputc('0', ofp ); \
+ fputc('x', ofp ); \
+ fputc(hexchar[item & 15], ofp ); \
+ fputc(hexchar[(item >> 4) & 15], ofp ); \
+ fputc(hexchar[(item >> 8) & 15], ofp ); \
+ fputc(hexchar[item >> 12], ofp ); \
+ bitsperitem = 0; \
+ item = 0; \
+ }
+ #else /* GNUDOS */
#define PUTITEM \
{ \
if ( firstitem ) \
***************
*** 97,102 ****
--- 139,145 ----
bitsperitem = 0; \
item = 0; \
}
+ #endif /* GNUDOS */
#define PUTBIT(b) \
{ \
***************
*** 120,126 ****
if ( bitsperitem > 0 )
PUTITEM;
! printf( "};\n" );
exit( 0 );
}
--- 163,174 ----
if ( bitsperitem > 0 )
PUTITEM;
! #ifdef GNUDOS
! fprintf( ofp, "};\n" );
! pm_close( ofp );
! #else /* GNUDOS */
! printf( "};\n" );
! #endif /* GNUDOS */
exit( 0 );
}
diff -c -B -H +new-file +recursive pbmplus.old/pbm/pi3topbm.c pbmplus.new/pbm/pi3topbm.c
*** pbmplus.old/pbm/pi3topbm.c Fri Apr 12 00:30:36 1991
--- pbmplus.new/pbm/pi3topbm.c Fri Apr 19 12:48:02 1991
***************
*** 57,63 ****
--- 57,67 ----
if (argc == 1)
f = stdin;
else if (argc == 2)
+ #ifdef GNUDOS
+ f = pm_openrb( argv[1] );
+ #else /* GNUDOS */
f = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
pm_usage("[-d] [pi3file]");
diff -c -B -H +new-file +recursive pbmplus.old/pbm/xbmtopbm.c pbmplus.new/pbm/xbmtopbm.c
*** pbmplus.old/pbm/xbmtopbm.c Fri Apr 12 00:30:28 1991
--- pbmplus.new/pbm/xbmtopbm.c Fri Apr 19 12:44:56 1991
***************
*** 27,33 ****
--- 27,37 ----
pm_usage( "[bitmapfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/pbm/ybmtopbm.c pbmplus.new/pbm/ybmtopbm.c
*** pbmplus.old/pbm/ybmtopbm.c Fri Apr 12 00:30:36 1991
--- pbmplus.new/pbm/ybmtopbm.c Fri Apr 19 22:39:46 1991
***************
*** 32,38 ****
--- 32,42 ----
pm_usage( "[ybmfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
***************
*** 74,86 ****
{
short magic;
! if ( pm_readbigshort( file, &magic ) == -1 )
pm_error( "EOF / read error", 0,0,0,0,0 );
if ( magic != YBM_MAGIC )
pm_error( "bad magic number in YBM file", 0,0,0,0,0 );
! if ( pm_readbigshort( file, colsP ) == -1 )
pm_error( "EOF / read error", 0,0,0,0,0 );
! if ( pm_readbigshort( file, rowsP ) == -1 )
pm_error( "EOF / read error", 0,0,0,0,0 );
*depthP = 1;
--- 78,90 ----
{
short magic;
! if ( pm_readbigshort( file, &magic ) == -1 )
pm_error( "EOF / read error", 0,0,0,0,0 );
if ( magic != YBM_MAGIC )
pm_error( "bad magic number in YBM file", 0,0,0,0,0 );
! if ( pm_readbigshort( file, colsP ) == -1 )
pm_error( "EOF / read error", 0,0,0,0,0 );
! if ( pm_readbigshort( file, rowsP ) == -1 )
pm_error( "EOF / read error", 0,0,0,0,0 );
*depthP = 1;
diff -c -B -H +new-file +recursive pbmplus.old/pbmplus.h pbmplus.new/pbmplus.h
*** pbmplus.old/pbmplus.h Fri Apr 12 00:30:52 1991
--- pbmplus.new/pbmplus.h Sat Apr 20 01:56:56 1991
***************
*** 35,41 ****
** using uuencode or the equivalent, or running the files through pnmnoraw.
** Note that reading "raw" files works whether writing is enabled or not.
*/
! #define PBMPLUS_RAWBITS
/* CONFIGURE: On some systems, the putc() macro is broken and will return
** EOF when you write out a 255. For example, ULTRIX does this. This
--- 35,41 ----
** using uuencode or the equivalent, or running the files through pnmnoraw.
** Note that reading "raw" files works whether writing is enabled or not.
*/
! /* #define PBMPLUS_RAWBITS */
/* CONFIGURE: On some systems, the putc() macro is broken and will return
** EOF when you write out a 255. For example, ULTRIX does this. This
***************
*** 106,114 ****
** that point here, feel free to tweak or remove these declarations.
*/
#include <malloc.h>
! extern char* malloc();
extern char* realloc();
! extern char* calloc();
/* End of configurable definitions. */
--- 106,114 ----
** that point here, feel free to tweak or remove these declarations.
*/
#include <malloc.h>
! /* extern char* malloc();
extern char* realloc();
! extern char* calloc(); */
/* End of configurable definitions. */
***************
*** 170,175 ****
--- 170,180 ----
FILE* pm_openr ARGS(( char* name ));
FILE* pm_openw ARGS(( char* name ));
void pm_close ARGS(( FILE* f ));
+
+ #ifdef GNUDOS
+ FILE* pm_openrb ARGS(( char* name ));
+ FILE* pm_openwb ARGS(( char* name ));
+ #endif /* GNUDOS */
/* Endian I/O. */
diff -c -B -H +new-file +recursive pbmplus.old/pgm/delpgm.bat pbmplus.new/pgm/delpgm.bat
*** pbmplus.old/pgm/delpgm.bat
--- pbmplus.new/pgm/delpgm.bat Fri Apr 12 22:47:50 1991
***************
*** 0 ****
--- 1,18 ----
+ del FITSTOPG
+ del FSTOPGM
+ del HIPSTOPG
+ del LISPMTOP
+ del PGMBENTL
+ del PGMEDGE
+ del PGMENHAN
+ del PGMHIST
+ del PGMNORM
+ del PGMOIL
+ del PGMRAMP
+ del PGMTOFIT
+ del PGMTOFS
+ del PGMTOLIS
+ del PGMTOPBM
+ del PGMTOPS
+ del PSIDTOPG
+ del RAWTOPGM
diff -c -B -H +new-file +recursive pbmplus.old/pgm/exepgm.bat pbmplus.new/pgm/exepgm.bat
*** pbmplus.old/pgm/exepgm.bat
--- pbmplus.new/pgm/exepgm.bat Fri Apr 12 22:48:48 1991
***************
*** 0 ****
--- 1,18 ----
+ copy /b c:\gcc\bin\stub.exe+FITSTOPG FITSTOPG.exe
+ copy /b c:\gcc\bin\stub.exe+FSTOPGM FSTOPGM.exe
+ copy /b c:\gcc\bin\stub.exe+HIPSTOPG HIPSTOPG.exe
+ copy /b c:\gcc\bin\stub.exe+LISPMTOP LISPMTOP.exe
+ copy /b c:\gcc\bin\stub.exe+PGMBENTL PGMBENTL.exe
+ copy /b c:\gcc\bin\stub.exe+PGMEDGE PGMEDGE.exe
+ copy /b c:\gcc\bin\stub.exe+PGMENHAN PGMENHAN.exe
+ copy /b c:\gcc\bin\stub.exe+PGMHIST PGMHIST.exe
+ copy /b c:\gcc\bin\stub.exe+PGMNORM PGMNORM.exe
+ copy /b c:\gcc\bin\stub.exe+PGMOIL PGMOIL.exe
+ copy /b c:\gcc\bin\stub.exe+PGMRAMP PGMRAMP.exe
+ copy /b c:\gcc\bin\stub.exe+PGMTOFIT PGMTOFIT.exe
+ copy /b c:\gcc\bin\stub.exe+PGMTOFS PGMTOFS.exe
+ copy /b c:\gcc\bin\stub.exe+PGMTOLIS PGMTOLIS.exe
+ copy /b c:\gcc\bin\stub.exe+PGMTOPBM PGMTOPBM.exe
+ copy /b c:\gcc\bin\stub.exe+PGMTOPS PGMTOPS.exe
+ copy /b c:\gcc\bin\stub.exe+PSIDTOPG PSIDTOPG.exe
+ copy /b c:\gcc\bin\stub.exe+RAWTOPGM RAWTOPGM.exe
diff -c -B -H +new-file +recursive pbmplus.old/pgm/fitstopg.c pbmplus.new/pgm/fitstopg.c
*** pbmplus.old/pgm/fitstopg.c Fri Apr 12 00:30:56 1991
--- pbmplus.new/pgm/fitstopg.c Fri Apr 19 22:51:46 1991
***************
*** 60,66 ****
--- 60,70 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
++argn;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/pgm/fstopgm.c pbmplus.new/pgm/fstopgm.c
*** pbmplus.old/pgm/fstopgm.c Fri Apr 12 00:30:54 1991
--- pbmplus.new/pgm/fstopgm.c Fri Apr 19 22:54:16 1991
***************
*** 33,39 ****
--- 33,43 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
argn++;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/pgm/hipstopg.c pbmplus.new/pgm/hipstopg.c
*** pbmplus.old/pgm/hipstopg.c Fri Apr 12 00:30:54 1991
--- pbmplus.new/pgm/hipstopg.c Fri Apr 19 22:53:52 1991
***************
*** 54,60 ****
--- 54,64 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
argn++;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/pgm/lispmtop.c pbmplus.new/pgm/lispmtop.c
*** pbmplus.old/pgm/lispmtop.c Fri Apr 12 00:30:56 1991
--- pbmplus.new/pgm/lispmtop.c Fri Apr 19 22:53:22 1991
***************
*** 41,47 ****
--- 41,51 ----
pm_usage( "[lispmfile]" );
if ( argc == 2 )
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[1] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[1] );
+ #endif /* GNUDOS */
else
ifp = stdin;
diff -c -B -H +new-file +recursive pbmplus.old/pgm/makefile.pc pbmplus.new/pgm/makefile.pc
*** pbmplus.old/pgm/makefile.pc
--- pbmplus.new/pgm/makefile.pc Fri Apr 19 22:47:40 1991
***************
*** 0 ****
--- 1,130 ----
+ # Makefile for pgm tools.
+ #
+ # Copyright (C) 1989, 1991 by Jef Poskanzer.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose and without fee is hereby granted, provided
+ # that the above copyright notice appear in all copies and that both that
+ # copyright notice and this permission notice appear in supporting
+ # documentation. This software is provided "as is" without express or
+ # implied warranty.
+
+ # Default values, usually overridden by top-level Makefile.
+ #CC = cc
+ CC = gcc -fcombine-regs
+ #CFLAGS = -O
+ CFLAGS = -g
+ #CFLAGS = -g -O
+ #LDFLAGS = -s
+ LDFLAGS =
+ INSTALLBINARIES = /usr/new/pbm
+ INSTALLMANUALS1 = /usr/man/man1
+ SUFFIXMANUALS1 = 1
+ INSTALLMANUALS3 = /usr/man/man3
+ SUFFIXMANUALS3 = 3
+ INSTALLMANUALS5 = /usr/man/man5
+ SUFFIXMANUALS5 = 5
+ MANCP = cp
+
+ PBMDIR = ../pbm
+ INCLUDEPBM = -I$(PBMDIR)
+ LIBPBM = $(PBMDIR)/libpbm.a
+ DEFPBM = $(PBMDIR)/pbm.h ../pbmplus.h
+ DEFLIBPBM = $(PBMDIR)/libpbm.h
+
+ SHELL = /bin/sh
+ INCLUDE = $(INCLUDEPBM)
+ ALLCFLAGS = $(CFLAGS) $(INCLUDE)
+ LIBPGM = libpgm.a
+
+ PORTBINARIES = fitstopgm fstopgm hipstopgm lispmtopgm pgmbentley \
+ pgmenhance pgmhist pgmnorm pgmoil pgmramp \
+ pgmtopbm pgmtofits pgmtofs pgmtolispm pgmtops \
+ psidtopgm rawtopgm
+ MATHBINARIES = pgmedge
+ BINARIES = $(PORTBINARIES) $(MATHBINARIES)
+
+ OBJECTS = fitstopgm.o fstopgm.o hipstopgm.o lispmtopgm.o pgmbentley.o \
+ pgmenhance.o pgmhist.o pgmnorm.o pgmoil.o pgmramp.o \
+ pgmtopbm.o pgmtofits.o pgmtofs.o pgmtolispm.o pgmtops.o \
+ psidtopgm.o rawtopgm.o pgmedge.o
+
+ MANUALS1 = $(BINARIES)
+ MANUALS3 = libpgm
+ MANUALS5 = pgm
+
+
+ all: binaries
+
+
+ binaries: $(BINARIES)
+
+ installbinaries: binaries
+ cd $(INSTALLBINARIES)
+ cp $(BINARIES) $(INSTALLBINARIES)
+
+
+ merge: pgmmerge
+ pgmmerge: pgmmerge.c $(OBJECTS) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(OBJECTS) -lm $(LIBPGM) $(LIBPBM)
+
+ installmerge: installpgmmerge
+ installpgmmerge: pgmmerge
+ cd $(INSTALLBINARIES) ;
+ cp pgmmerge $(INSTALLBINARIES)
+ cd $(INSTALLBINARIES) ; for i in $(BINARIES) ; do ln pgmmerge $$i ; done
+
+
+
+ installmanuals:
+ for i in $(MANUALS1) ; do $(MANCP) $$i.1 $(INSTALLMANUALS1)/$$i.$(SUFFIXMANUALS1) ; done
+ for i in $(MANUALS3) ; do $(MANCP) $$i.3 $(INSTALLMANUALS3)/$$i.$(SUFFIXMANUALS3) ; done
+ for i in $(MANUALS5) ; do $(MANCP) $$i.5 $(INSTALLMANUALS5)/$$i.$(SUFFIXMANUALS5) ; done
+
+
+ # Rule for plain programs.
+ $(PORTBINARIES): pgm.h $(DEFPBM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPGM) $(LIBPBM)
+
+ # Rule for math-dependent programs.
+ $(MATHBINARIES): pgm.h $(DEFPBM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c -lm $(LIBPGM) $(LIBPBM)
+
+ # Rule for objects.
+ $(OBJECTS): pgm.h $(DEFPBM)
+ $(CC) $(ALLCFLAGS) "-Dmain=$*_main" -c $*.c
+
+ # And libraries.
+ $(LIBPBM):
+ cd $(PBMDIR) ; make lib
+ lib: $(LIBPGM)
+ $(LIBPGM): libpgm1.o libpgm2.o
+
+ ar rc $(LIBPGM) libpgm1.o libpgm2.o
+
+
+ libpgm1.o: pgm.h $(DEFPBM) libpgm.h libpgm1.c
+ $(CC) $(ALLCFLAGS) -c libpgm1.c
+ libpgm2.o: pgm.h $(DEFPBM) libpgm.h libpgm2.c $(DEFLIBPBM)
+ $(CC) $(ALLCFLAGS) -c libpgm2.c
+
+ # Other dependencies.
+ fitstopgm fitstopgm.o: fitstopgm.c
+ fstopgm fstopgm.o: fstopgm.c
+ hipstopgm hipstopgm.o: hipstopgm.c
+ lispmtopgm lispmtopgm.o: lispmtopgm.c
+ pgmbentley pgmbentley.o: pgmbentley.c
+ pgmedge pgmedge.o: pgmedge.c
+ pgmenhance pgmenhance.o: pgmenhance.c
+ pgmhist pgmhist.o: pgmhist.c
+ pgmnorm pgmnorm.o: pgmnorm.c
+ pgmoil pgmoil.o: pgmoil.c
+ pgmramp pgmramp.o: pgmramp.c
+ pgmtopbm pgmtopbm.o: pgmtopbm.c dithers.h $(DEFPBM)
+ pgmtofits pgmtofits.o: pgmtofits.c
+ pgmtofs pgmtofs.o: pgmtofs.c
+ pgmtolispm pgmtolispm.o: pgmtolispm.c
+ pgmtops pgmtops.o: pgmtops.c
+ psidtopgm psidtopgm.o: psidtopgm.c
+ rawtopgm rawtopgm.o: rawtopgm.c
+
diff -c -B -H +new-file +recursive pbmplus.old/pgm/pgmtofit.c pbmplus.new/pgm/pgmtofit.c
*** pbmplus.old/pgm/pgmtofit.c Fri Apr 12 00:30:54 1991
--- pbmplus.new/pgm/pgmtofit.c Fri Apr 19 23:46:46 1991
***************
*** 12,17 ****
--- 12,22 ----
#include "pgm.h"
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 34,39 ****
--- 39,56 ----
else
ifp = stdin;
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".fit" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
if ( argn != argc )
pm_usage( "[pgmfile]" );
***************
*** 48,61 ****
--- 65,90 ----
{
pgm_readpgmrow( ifp, grayrow, cols, maxval, format );
for ( col = 0, gP = grayrow; col < cols; col++, gP++ )
+ #ifdef GNUDOS
+ fputc( *gP, ofp );
+ #else /* GNUDOS */
putchar( *gP );
+ #endif /* GNUDOS */
}
for ( i = ( rows * cols ) % 2880; i < 2880; i++ )
+ #ifdef GNUDOS
+ fputc( '\0', ofp );
+ #else /* GNUDOS */
putchar( '\0' );
+ #endif /* GNUDOS */
pm_close( ifp );
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit( 0 );
}
***************
*** 97,101 ****
--- 126,134 ----
write_card( str )
char *str;
{
+ #ifdef GNUDOS
+ fwrite( str, sizeof (char), 80, ofp );
+ #else /* GNUDOS */
fwrite( str, sizeof (char), 80, stdout );
+ #endif /* GNUDOS */
}
diff -c -B -H +new-file +recursive pbmplus.old/pgm/pgmtofs.c pbmplus.new/pgm/pgmtofs.c
*** pbmplus.old/pgm/pgmtofs.c Fri Apr 12 00:30:58 1991
--- pbmplus.new/pgm/pgmtofs.c Fri Apr 19 23:48:28 1991
***************
*** 14,19 ****
--- 14,24 ----
static void putinit(), putinit(), putitem(), putgray(), putrest();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 41,46 ****
--- 46,63 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".fs" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
grays = pgm_readpgm( ifp, &cols, &rows, &maxval );
pm_close( ifp );
***************
*** 73,78 ****
--- 90,99 ----
putrest( );
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit( 0 );
}
***************
*** 84,89 ****
--- 105,124 ----
putinit( cols, rows, bps )
int cols, rows, bps;
{
+ #ifdef GNUDOS
+ fprintf( ofp, "FirstName: \n" );
+ fprintf( ofp, "LastName: \n" );
+ fprintf( ofp, "E-mail: \n" );
+ fprintf( ofp, "Telephone: \n" );
+ fprintf( ofp, "Company: \n" );
+ fprintf( ofp, "Address1: \n" );
+ fprintf( ofp, "Address2: \n" );
+ fprintf( ofp, "CityStateZip: \n" );
+ fprintf( ofp, "Date: \n" );
+ fprintf( ofp, "PicData: %d %d %d\n", cols, rows, bps );
+ fprintf( ofp, "Image: %d %d %d\n", cols, rows, bps );
+ fprintf( ofp, "\n" );
+ #else /* GNUDOS */
printf( "FirstName: \n" );
printf( "LastName: \n" );
printf( "E-mail: \n" );
***************
*** 96,101 ****
--- 131,137 ----
printf( "PicData: %d %d %d\n", cols, rows, bps );
printf( "Image: %d %d %d\n", cols, rows, bps );
printf( "\n" );
+ #endif /* GNUDOS */
bitspersample = bps;
itemsperline = items = 0;
***************
*** 111,121 ****
--- 147,165 ----
if ( itemsperline == 30 )
{
+ #ifdef GNUDOS
+ fputc( '\n', ofp );
+ itemsperline = 0;
+ }
+ fputc( hexits[item >> 4], ofp );
+ fputc( hexits[item & 15], ofp );
+ #else /* GNUDOS */
putchar( '\n' );
itemsperline = 0;
}
putchar( hexits[item >> 4] );
putchar( hexits[item & 15] );
+ #endif /* GNUDOS */
++itemsperline;
++items;
item = 0;
***************
*** 139,143 ****
--- 183,191 ----
{
if ( bitsperitem > 0 )
putitem( );
+ #ifdef GNUDOS
+ fprintf( ofp, "\n" );
+ #else /* GNUDOS */
printf( "\n" );
+ #endif /* GNUDOS */
}
diff -c -B -H +new-file +recursive pbmplus.old/pgm/pgmtolis.c pbmplus.new/pgm/pgmtolis.c
*** pbmplus.old/pgm/pgmtolis.c Fri Apr 12 00:30:56 1991
--- pbmplus.new/pgm/pgmtolis.c Fri Apr 19 23:48:12 1991
***************
*** 23,28 ****
--- 23,33 ----
static int depth_to_word_size();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 42,47 ****
--- 47,64 ----
else
ifp = stdin;
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".lis" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pgm_readpgminit( ifp, &cols, &rows, &maxval, &format );
grayrow = pgm_allocrow( cols );
depth = pm_maxvaltobits( maxval );
***************
*** 61,67 ****
pm_close( ifp );
! putrest( );
exit( 0 );
}
--- 78,88 ----
pm_close( ifp );
! putrest( );
!
! #ifdef GNUDOS
! pm_close( ofp );
! #endif /* GNUDOS */
exit( 0 );
}
***************
*** 75,81 ****
int i;
int cols32 = ( ( cols + 31 ) / 32 ) * 32; /* Lispms are able to write bit files that are not mod32 wide, but we */
/* don't. This should be ok, since bit arrays which are not mod32 wide */
! printf(LISPM_MAGIC); /* are pretty useless on a lispm (can't hand them to bitblt). */
pm_writelittleshort( stdout, cols );
pm_writelittleshort( stdout, rows );
pm_writelittleshort( stdout, cols32 );
--- 96,112 ----
int i;
int cols32 = ( ( cols + 31 ) / 32 ) * 32; /* Lispms are able to write bit files that are not mod32 wide, but we */
/* don't. This should be ok, since bit arrays which are not mod32 wide */
! #ifdef GNUDOS
! fprintf( ofp, LISPM_MAGIC); /* are pretty useless on a lispm (can't hand them to bitblt). */
! pm_writelittleshort( ofp, cols );
! pm_writelittleshort( ofp, rows );
! pm_writelittleshort( ofp, cols32 );
! fputc(depth & 0xFF, ofp );
!
! for ( i = 0; i < 9; ++i )
! fputc( 0, ofp ); /* pad bytes */
! #else /* GNUDOS */
! printf(LISPM_MAGIC); /* are pretty useless on a lispm (can't hand them to bitblt). */
pm_writelittleshort( stdout, cols );
pm_writelittleshort( stdout, rows );
pm_writelittleshort( stdout, cols32 );
***************
*** 83,88 ****
--- 114,120 ----
for ( i = 0; i < 9; ++i )
putchar( 0 ); /* pad bytes */
+ #endif /* GNUDOS */
item = 0;
bitsperitem = 0;
***************
*** 122,128 ****
putitem( )
{
! pm_writelittlelong( stdout, ~item );
item = 0;
bitsperitem = 0;
bitshift = 0;
--- 154,164 ----
putitem( )
{
! #ifdef GNUDOS
! pm_writelittlelong( ofp, ~item );
! #else /* GNUDOS */
! pm_writelittlelong( stdout, ~item );
! #endif /* GNUDOS */
item = 0;
bitsperitem = 0;
bitshift = 0;
diff -c -B -H +new-file +recursive pbmplus.old/pgm/pgmtops.c pbmplus.new/pgm/pgmtops.c
*** pbmplus.old/pgm/pgmtops.c Fri Apr 12 00:30:56 1991
--- pbmplus.new/pgm/pgmtops.c Fri Apr 19 23:47:48 1991
***************
*** 15,20 ****
--- 15,25 ----
static void putinit(), putinit(), putitem(), putgray(), putrest(),
rleputinit(), rleputbuffer(), rleputitem(), rleputgray(), rleputrest();
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char *argv[];
***************
*** 73,78 ****
--- 78,95 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".ps" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
pgm_readpgminit( ifp, &cols, &rows, &maxval, &format );
grayrow = pgm_allocrow( cols );
***************
*** 119,124 ****
--- 136,145 ----
else
putrest( );
+ #ifdef GNUDOS
+ pm_close( ofp );
+ #endif /* GNUDOS */
+
exit( 0 );
}
***************
*** 143,148 ****
--- 164,189 ----
if ( llx < 0.0 || lly < 0.0 )
pm_message( "warning, image too large for page", 0,0,0,0,0 );
+ #ifdef GNUDOS
+ fprintf( ofp, "%%!PS-Adobe-2.0 EPSF-2.0\n" );
+ fprintf( ofp, "%%%%Creator: pgmtops\n" );
+ fprintf( ofp, "%%%%Title: %s.ps\n", name );
+ fprintf( ofp, "%%%%Pages: 1\n" );
+ fprintf( ofp,
+ "%%%%BoundingBox: %d %d %d %d\n",
+ (int) llx, (int) lly, (int) ( llx + scols ), (int) ( lly + srows ) );
+ fprintf( ofp, "%%%%EndComments\n" );
+ fprintf( ofp, "%%%%EndProlog\n" );
+ fprintf( ofp, "%%%%Page: 1 1\n" );
+ fprintf( ofp, "/picstr %d string def\n", HSBUFSIZ );
+ fprintf( ofp, "gsave\n" );
+ fprintf( ofp, "%g %g translate\n", llx, lly );
+ fprintf( ofp, "%g %g scale\n", scols, srows );
+ fprintf( ofp, "%d %d %d\n", cols, rows, bps );
+ fprintf( ofp, "[ %d 0 0 -%d 0 %d ]\n", cols, rows, rows );
+ fprintf( ofp, "{ currentfile picstr readhexstring pop }\n" );
+ fprintf( ofp, "image\n" );
+ #else /* GNUDOS */
printf( "%%!PS-Adobe-2.0 EPSF-2.0\n" );
printf( "%%%%Creator: pgmtops\n" );
printf( "%%%%Title: %s.ps\n", name );
***************
*** 161,166 ****
--- 202,208 ----
printf( "[ %d 0 0 -%d 0 %d ]\n", cols, rows, rows );
printf( "{ currentfile picstr readhexstring pop }\n" );
printf( "image\n" );
+ #endif /* GNUDOS */
bitspersample = bps;
itemsperline = items = 0;
***************
*** 176,186 ****
--- 218,238 ----
if ( itemsperline == 30 )
{
+ #ifdef GNUDOS
+ fputc( '\n', ofp );
+ #else /* GNUDOS */
putchar( '\n' );
+ #endif /* GNUDOS */
+
itemsperline = 0;
}
+ #ifdef GNUDOS
+ fputc( hexits[item >> 4], ofp );
+ fputc( hexits[item & 15], ofp );
+ #else /* GNUDOS */
putchar( hexits[item >> 4] );
putchar( hexits[item & 15] );
+ #endif /* GNUDOS */
itemsperline++;
items++;
item = 0;
***************
*** 206,215 ****
--- 258,274 ----
putitem( );
while ( items % HSBUFSIZ != 0 )
putitem( );
+ #ifdef GNUDOS
+ fprintf( ofp, "\n" );
+ fprintf( ofp, "grestore\n" );
+ fprintf( ofp, "showpage\n" );
+ fprintf( ofp, "%%%%Trailer\n" );
+ #else /* GNUDOS */
printf( "\n" );
printf( "grestore\n" );
printf( "showpage\n" );
printf( "%%%%Trailer\n" );
+ #endif /* GNUDOS */
}
static void
***************
*** 227,232 ****
--- 286,325 ----
if ( llx < 0.0 || lly < 0.0 )
pm_message( "warning, image too large for page", 0,0,0,0,0 );
+ #ifdef GNUDOS
+ fprintf( ofp, "%%!PS-Adobe-2.0 EPSF-2.0\n" );
+ fprintf( ofp, "%%%%Creator: pgmtops\n" );
+ fprintf( ofp, "%%%%Title: %s.ps\n", name );
+ fprintf( ofp, "%%%%Pages: 1\n" );
+ fprintf( ofp,
+ "%%%%BoundingBox: %d %d %d %d\n",
+ (int) llx, (int) lly, (int) ( llx + scols ), (int) ( lly + srows ) );
+ fprintf( ofp, "%%%%EndComments\n" );
+ fprintf( ofp, "%%%%EndProlog\n" );
+ fprintf( ofp, "/rlestr1 1 string def\n" );
+ fprintf( ofp, "/rlestr 128 string def\n" );
+ fprintf( ofp, "/readrlestring {\n" );
+ fprintf( ofp, " currentfile rlestr1 readhexstring pop 0 get\n" );
+ fprintf( ofp, " dup 127 le {\n" );
+ fprintf( ofp, " currentfile rlestr 0 4 3 roll 1 add getinterval\n" );
+ fprintf( ofp, " readhexstring pop\n" );
+ fprintf( ofp, " } {\n" );
+ fprintf( ofp, " 256 exch sub dup\n" );
+ fprintf( ofp, " currentfile rlestr1 readhexstring pop 0 get\n" );
+ fprintf( ofp, " exch 0 exch 1 exch 1 sub { rlestr exch 2 index put } for\n" );
+ fprintf( ofp, " pop rlestr exch 0 exch getinterval\n" );
+ fprintf( ofp, " } ifelse\n" );
+ fprintf( ofp, "} bind def\n" );
+ fprintf( ofp, "%%%%EndProlog\n" );
+ fprintf( ofp, "%%%%Page: 1 1\n" );
+ fprintf( ofp, "gsave\n" );
+ fprintf( ofp, "%g %g translate\n", llx, lly );
+ fprintf( ofp, "%g %g scale\n", scols, srows );
+ fprintf( ofp, "%d %d %d\n", cols, rows, bps );
+ fprintf( ofp, "[ %d 0 0 -%d 0 %d ]\n", cols, rows, rows );
+ fprintf( ofp, "{ readrlestring }\n" );
+ fprintf( ofp, "image\n" );
+ #else /* GNUDOS */
printf( "%%!PS-Adobe-2.0 EPSF-2.0\n" );
printf( "%%%%Creator: pgmtops\n" );
printf( "%%%%Title: %s.ps\n", name );
***************
*** 259,264 ****
--- 352,358 ----
printf( "[ %d 0 0 -%d 0 %d ]\n", cols, rows, rows );
printf( "{ readrlestring }\n" );
printf( "image\n" );
+ #endif /* GNUDOS */
bitspersample = bps;
itemsperline = items = 0;
***************
*** 382,389 ****
--- 476,490 ----
rleputitem( );
if ( count > 0 )
rleputbuffer( );
+ #ifdef GNUDOS
+ fprintf( ofp, "\n" );
+ fprintf( ofp, "grestore\n" );
+ fprintf( ofp, "showpage\n" );
+ fprintf( ofp, "%%%%Trailer\n" );
+ #else /* GNUDOS */
printf( "\n" );
printf( "grestore\n" );
printf( "showpage\n" );
printf( "%%%%Trailer\n" );
+ #endif /* GNUDOS */
}
diff -c -B -H +new-file +recursive pbmplus.old/pgm/psidtopg.c pbmplus.new/pgm/psidtopg.c
*** pbmplus.old/pgm/psidtopg.c Fri Apr 12 00:30:56 1991
--- pbmplus.new/pgm/psidtopg.c Fri Apr 19 22:55:00 1991
***************
*** 41,47 ****
--- 41,51 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
argn++;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/pgm/rawtopgm.c pbmplus.new/pgm/rawtopgm.c
*** pbmplus.old/pgm/rawtopgm.c Fri Apr 12 00:30:54 1991
--- pbmplus.new/pgm/rawtopgm.c Fri Apr 19 22:52:30 1991
***************
*** 63,69 ****
--- 63,73 ----
if ( argn < argc )
{
+ #ifdef GNUDOS
+ ifp = pm_openrb( argv[argn] );
+ #else /* GNUDOS */
ifp = pm_openr( argv[argn] );
+ #endif /* GNUDOS */
++argn;
}
else
diff -c -B -H +new-file +recursive pbmplus.old/pnm/body.c pbmplus.new/pnm/body.c
*** pbmplus.old/pnm/body.c
--- pbmplus.new/pnm/body.c Sat Apr 20 10:08:52 1991
***************
*** 0 ****
--- 1,11 ----
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
diff -c -B -H +new-file +recursive pbmplus.old/pnm/delpnm.bat pbmplus.new/pnm/delpnm.bat
*** pbmplus.old/pnm/delpnm.bat
--- pbmplus.new/pnm/delpnm.bat Fri Apr 12 22:53:10 1991
***************
*** 0 ****
--- 1,21 ----
+ del PNMARITH
+ del PNMCAT
+ del PNMCONVO
+ del PNMCROP
+ del PNMCUT
+ del PNMDEPTH
+ del PNMENLAR
+ del PNMFILE
+ del PNMFLIP
+ del PNMGAMMA
+ del PNMINVER
+ del PNMNORAW
+ del PNMPASTE
+ del PNMROTAT
+ del PNMSCALE
+ del PNMSHEAR
+ del PNMTILE
+ del PNMTORAS
+ del PNMTOXWD
+ del RASTTOPN
+ del XWDTOPNM
diff -c -B -H +new-file +recursive pbmplus.old/pnm/exepnm.bat pbmplus.new/pnm/exepnm.bat
*** pbmplus.old/pnm/exepnm.bat
--- pbmplus.new/pnm/exepnm.bat Fri Apr 12 22:51:54 1991
***************
*** 0 ****
--- 1,21 ----
+ copy /b c:\gcc\bin\stub.exe+PNMARITH PNMARITH.exe
+ copy /b c:\gcc\bin\stub.exe+PNMCAT PNMCAT.exe
+ copy /b c:\gcc\bin\stub.exe+PNMCONVO PNMCONVO.exe
+ copy /b c:\gcc\bin\stub.exe+PNMCROP PNMCROP.exe
+ copy /b c:\gcc\bin\stub.exe+PNMCUT PNMCUT.exe
+ copy /b c:\gcc\bin\stub.exe+PNMDEPTH PNMDEPTH.exe
+ copy /b c:\gcc\bin\stub.exe+PNMENLAR PNMENLAR.exe
+ copy /b c:\gcc\bin\stub.exe+PNMFILE PNMFILE.exe
+ copy /b c:\gcc\bin\stub.exe+PNMFLIP PNMFLIP.exe
+ copy /b c:\gcc\bin\stub.exe+PNMGAMMA PNMGAMMA.exe
+ copy /b c:\gcc\bin\stub.exe+PNMINVER PNMINVER.exe
+ copy /b c:\gcc\bin\stub.exe+PNMNORAW PNMNORAW.exe
+ copy /b c:\gcc\bin\stub.exe+PNMPASTE PNMPASTE.exe
+ copy /b c:\gcc\bin\stub.exe+PNMROTAT PNMROTAT.exe
+ copy /b c:\gcc\bin\stub.exe+PNMSCALE PNMSCALE.exe
+ copy /b c:\gcc\bin\stub.exe+PNMSHEAR PNMSHEAR.exe
+ copy /b c:\gcc\bin\stub.exe+PNMTILE PNMTILE.exe
+ copy /b c:\gcc\bin\stub.exe+PNMTORAS PNMTORAS.exe
+ copy /b c:\gcc\bin\stub.exe+PNMTOXWD PNMTOXWD.exe
+ copy /b c:\gcc\bin\stub.exe+RASTTOPN RASTTOPN.exe
+ copy /b c:\gcc\bin\stub.exe+XWDTOPNM XWDTOPNM.exe
diff -c -B -H +new-file +recursive pbmplus.old/pnm/header.c pbmplus.new/pnm/header.c
*** pbmplus.old/pnm/header.c
--- pbmplus.new/pnm/header.c Fri Apr 19 15:37:02 1991
***************
*** 0 ****
--- 1,4 ----
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
diff -c -B -H +new-file +recursive pbmplus.old/pnm/makefile.pc pbmplus.new/pnm/makefile.pc
*** pbmplus.old/pnm/makefile.pc
--- pbmplus.new/pnm/makefile.pc Sat Apr 20 17:01:24 1991
***************
*** 0 ****
--- 1,186 ----
+ # Makefile for pnm tools.
+ #
+ # Copyright (C) 1989, 1991 by Jef Poskanzer.
+ #
+ # Permission to use, copy, modify, and distribute this software and its
+ # documentation for any purpose and without fee is hereby granted, provided
+ # that the above copyright notice appear in all copies and that both that
+ # copyright notice and this permission notice appear in supporting
+ # documentation. This software is provided "as is" without express or
+ # implied warranty.
+
+ # Default values, usually overridden by top-level Makefile.
+ #CC = cc
+ CC = gcc -fcombine-regs
+ #CFLAGS = -O
+ CFLAGS = -g
+ #CFLAGS = -g -O
+ TIFFDEF =
+ TIFFINC =
+ TIFFLIB =
+ TIFFBINARIES =
+ TIFFOBJECTS =
+ #TIFFDEF = -DLIBTIFF
+ #TIFFINC = -I../libtiff
+ #TIFFLIB = ../libtiff/libtiff.a
+ #TIFFBINARIES = tifftopnm pnmtotiff
+ #TIFFOBJECTS = tifftopnm.o pnmtotiff.o
+ #LDFLAGS = -s
+ LDFLAGS =
+ INSTALLBINARIES = /usr/new/pbm
+ INSTALLSCRIPTS = $(INSTALLBINARIES)
+ INSTALLMANUALS1 = /usr/man/man1
+ SUFFIXMANUALS1 = 1
+ INSTALLMANUALS3 = /usr/man/man3
+ SUFFIXMANUALS3 = 3
+ INSTALLMANUALS5 = /usr/man/man5
+ SUFFIXMANUALS5 = 5
+ MANCP = cp
+
+ # CONFIGURE: You can compile PNM without PPM. If you don't want PPM,
+ # comment out the next six definitions. This will make the PNM programs
+ # use # less memory. If you change this, don't forget to change the
+ # SUBDIRS definition in the top-level Makefile.
+ PPMOPT = -DPPM
+ PPMDIR = .
+ INCLUDEPPM = -I$(PPMDIR)
+ LIBPPM = $(PPMDIR)/libppm.a
+ DEFPPM = $(PPMDIR)/ppm.h ../pbmplus.h
+ DEFLIBPPM = $(PPMDIR)/libppm.h
+
+ # CONFIGURE: Likewise here: if you don't have PGM, comment these lines out.
+ PGMOPT = -DPGM
+ PGMDIR = .
+ INCLUDEPGM = -I$(PGMDIR)
+ LIBPGM = $(PGMDIR)/libpgm.a
+ DEFPGM = $(PGMDIR)/pgm.h
+ DEFLIBPGM = $(PGMDIR)/libpgm.h
+
+ # PBM is required, don't comment these lines out.
+ PBMOPT = -DPBM
+ PBMDIR = .
+ INCLUDEPBM = -I$(PBMDIR)
+ LIBPBM = $(PBMDIR)/libpbm.a
+ DEFPBM = $(PBMDIR)/pbm.h
+ DEFLIBPBM = $(PBMDIR)/libpbm.h
+
+ SHELL = /bin/sh
+ INCLUDE = $(INCLUDEPPM) $(INCLUDEPGM) $(INCLUDEPBM)
+ ALLCFLAGS = $(CFLAGS) $(PPMOPT) $(PGMOPT) $(PBMOPT) $(INCLUDE) $(TIFFDEF) $(TIFFINC)
+ LIBPNM = libpnm.a
+
+ PORTBINARIES = pnmarith pnmcat pnmconvol pnmcrop pnmcut \
+ pnmdepth pnmenlarge pnmfile pnmflip pnminvert \
+ pnmnoraw pnmpaste pnmscale pnmtile \
+ pnmtorast pnmtoxwd rasttopnm xwdtopnm
+ MATHBINARIES = pnmgamma pnmrotate pnmshear
+ BINARIES = $(PORTBINARIES) $(MATHBINARIES) $(TIFFBINARIES)
+ SCRIPTS = anytopnm pnmindex pnmmargin pnmsmooth
+
+ PORTOBJECTS = pnmarith.o pnmcat.o pnmconvol.o pnmcrop.o pnmcut.o \
+ pnmdepth.o pnmenlarge.o pnmfile.o pnmflip.o pnminvert.o \
+ pnmnoraw.o pnmpaste.o pnmscale.o pnmtile.o \
+ pnmtorast.o pnmtoxwd.o rasttopnm.o xwdtopnm.o \
+ pnmgamma.o pnmrotate.o pnmshear.o
+ OBJECTS = $(PORTOBJECTS) $(TIFFOBJECTS)
+
+ MANUALS1 = $(BINARIES) $(SCRIPTS)
+ MANUALS3 = libpnm
+ MANUALS5 = pnm
+
+
+ all: binaries
+
+
+ binaries: $(BINARIES)
+
+ installbinaries: binaries
+ cd $(INSTALLBINARIES) ; rm -f $(BINARIES)
+ cp $(BINARIES) $(INSTALLBINARIES)
+ cd $(INSTALLSCRIPTS) ; rm -f $(SCRIPTS)
+ cp $(SCRIPTS) $(INSTALLSCRIPTS)
+ cd $(INSTALLSCRIPTS) ; chmod +x $(SCRIPTS)
+
+
+ merge: pnmmerge
+ pnmmerge: pnmmerge.c $(OBJECTS) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(OBJECTS) -lm $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(TIFFLIB)
+
+ installmerge: installpnmmerge
+ installpnmmerge: pnmmerge
+ cd $(INSTALLBINARIES) ; rm -f $(BINARIES)
+ cp pnmmerge $(INSTALLBINARIES)
+ cd $(INSTALLBINARIES) ; for i in $(BINARIES) ; do ln pnmmerge $$i ; done
+ rm $(INSTALLBINARIES)/pnmmerge
+ cd $(INSTALLSCRIPTS) ; rm -f $(SCRIPTS)
+ cp $(SCRIPTS) $(INSTALLSCRIPTS)
+ cd $(INSTALLSCRIPTS) ; chmod +x $(SCRIPTS)
+
+
+ installmanuals:
+ for i in $(MANUALS1) ; do $(MANCP) $$i.1 $(INSTALLMANUALS1)/$$i.$(SUFFIXMANUALS1) ; done
+ for i in $(MANUALS3) ; do $(MANCP) $$i.3 $(INSTALLMANUALS3)/$$i.$(SUFFIXMANUALS3) ; done
+ for i in $(MANUALS5) ; do $(MANCP) $$i.5 $(INSTALLMANUALS5)/$$i.$(SUFFIXMANUALS5) ; done
+
+
+ # Rules for plain programs.
+ $(PORTBINARIES) $(TIFFBINARIES): pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(TIFFLIB)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM) $(TIFFLIB)
+
+ # Rule for math-dependent programs.
+ $(MATHBINARIES): pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) $(LIBPNM) \
+ $(LIBPPM) $(LIBPGM) $(LIBPBM)
+ $(CC) $(ALLCFLAGS) $(LDFLAGS) -o $@ $@.c -lm $(LIBPNM) $(LIBPPM) $(LIBPGM) $(LIBPBM)
+
+ # Rule for objects.
+ $(OBJECTS): pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM)
+ $(CC) $(ALLCFLAGS) "-Dmain=$*_main" -c $*.c
+
+ # And libraries.
+ $(LIBPBM):
+ cd $(PBMDIR) ; make lib
+ $(LIBPGM) FOO:
+ cd $(PGMDIR) ; make lib
+ $(LIBPPM) BAR:
+ cd $(PPMDIR) ; make lib
+ lib: $(LIBPNM)
+ $(LIBPNM): libpnm1.o libpnm2.o libpnm3.o libpnm4.o
+
+ ar rc $(LIBPNM) libpnm1.o libpnm2.o libpnm3.o libpnm4.o
+
+
+ libpnm1.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm1.c
+ $(CC) $(ALLCFLAGS) -c libpnm1.c
+ libpnm2.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm2.c $(DEFLIBPPM) \
+ $(DEFLIBPGM) $(DEFLIBPBM)
+ $(CC) $(ALLCFLAGS) -c libpnm2.c
+ libpnm3.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) libpnm3.c $(DEFLIBPPM) \
+ $(DEFLIBPGM) $(DEFLIBPBM)
+ $(CC) $(ALLCFLAGS) -c libpnm3.c
+ libpnm4.o: pnm.h $(DEFPPM) $(DEFPGM) $(DEFPBM) rast.h libpnm4.c
+ $(CC) $(ALLCFLAGS) -c libpnm4.c
+
+ # Other dependencies.
+ pnmarith pnmarith.o: pnmarith.c
+ pnmcat pnmcat.o: pnmcat.c
+ pnmconvol pnmconvol.o: pnmconvol.c
+ pnmcrop pnmcrop.o: pnmcrop.c
+ pnmcut pnmcut.o: pnmcut.c
+ pnmdepth pnmdepth.o: pnmdepth.c
+ pnmenlarge pnmenlarge.o: pnmenlarge.c
+ pnmfile pnmfile.o: pnmfile.c
+ pnmflip pnmflip.o: pnmflip.c
+ pnmgamma pnmgamma.o: pnmgamma.c
+ pnminvert pnminvert.o: pnminvert.c
+ pnmnoraw pnmnoraw.o: pnmnoraw.c
+ pnmpaste pnmpaste.o: pnmpaste.c
+ pnmrotate pnmrotate.o: pnmrotate.c
+ pnmscale pnmscale.o: pnmscale.c
+ pnmshear pnmshear.o: pnmshear.c
+ pnmtile pnmtile.o: pnmtile.c
+ pnmtorast pnmtorast.o: pnmtorast.c rast.h
+ pnmtotiff pnmtotiff.o: pnmtotiff.c
+ pnmtoxwd pnmtoxwd.o: pnmtoxwd.c x11wd.h
+ rasttopnm rasttopnm.o: rasttopnm.c rast.h
+ tifftopnm tifftopnm.o: tifftopnm.c
+ xwdtopnm xwdtopnm.o: xwdtopnm.c x10wd.h x11wd.h
diff -c -B -H +new-file +recursive pbmplus.old/pnm/pnmtoras.c pbmplus.new/pnm/pnmtoras.c
*** pbmplus.old/pnm/pnmtoras.c Fri Apr 12 00:31:04 1991
--- pbmplus.new/pnm/pnmtoras.c Sat Apr 20 17:21:20 1991
***************
*** 19,24 ****
--- 19,29 ----
static colormap_t* make_pr_colormap();
#endif /*PPM*/
+ #ifdef GNUDOS
+ FILE* ofp;
+ char fname[100], *fcp;
+ #endif /* GNUDOS */
+
void main( argc, argv )
int argc;
char* argv[];
***************
*** 69,74 ****
--- 74,91 ----
if ( argn != argc )
pm_usage( usage );
+ #ifdef GNUDOS
+ if ( ifp == stdin )
+ strcpy( fname, "noname" );
+ else {
+ strcpy( fname, argv[1] );
+ if ( ( fcp = index( fname, '.' ) ) != 0 )
+ *fcp = '\0';
+ }
+ strcat( fname, ".ras" );
+ ofp = pm_openwb( fname );
+ #endif /* GNUDOS */
+
xels = pnm_readpnm( ifp, &cols, &rows, &maxval, &format );
pm_close( ifp );
***************
*** 248,254 ****
}
/* Finally, write the sucker out. */
! pr_dump( pr, stdout, pr_colormapP, pr_type, 0 );
exit( 0 );
}
--- 265,279 ----
}
/* Finally, write the sucker out. */
! #ifdef GNUDOS
! pr_dump( pr, ofp, pr_colormapP, pr_type, 0 );
! #else /* GNUDOS */
! pr_dump( pr, stdout, pr_colormapP, pr_type, 0 );
! #endif /* GNUDOS */
!
! #ifdef GNUDOS
! pm_close( ofp );
! #endif /* GNUDOS */
exit( 0 );
}