27 static char rcsid[] =
"$Header: /l/spencer/src/urt/cnv/RCS/rletogray.c,v 3.0.1.2 1992/04/30 13:59:29 spencer Exp $";
50 static char defpref[] =
"out";
55 register char * cp, * slashp;
64 "% o%-outprefix!s infile%s", &oflag
, &prefix
, &inpnam
))
85 if ( !inpnam && !oflag )
87 else if ( inpnam && !oflag )
91 for ( cp = inpnam; *cp; cp++ )
94 for ( slashp = cp - 1; *slashp !=
'/' && slashp > inpnam; )
99 while ( *--cp !=
'.' && cp > inpnam )
101 if ( strcmp( cp,
".rle" ) != 0 )
102 cp = inpnam + strlen( inpnam );
104 prefix = (
char *)calloc( cp - slashp + 1, 1 );
106 strncpy( prefix, inpnam, cp - slashp );
115 for ( i = -aflag; i<files-aflag; i++ )
120 sprintf( outnam,
"%s.alpha", prefix );
124 sprintf( outnam,
"%s.red", prefix );
128 sprintf( outnam,
"%s.green", prefix );
132 sprintf( outnam,
"%s.blue", prefix );
136 sprintf( outnam,
"%s.%03d", prefix, i );
141 if ( (outfil[i+aflag] = fopen( outnam,
"w" )) == NULL )
143 fprintf( stderr,
"%s: Can't create %s: ", hdr
.cmd, outnam );
153 fprintf(stderr,
"%s: Out of memory.\n", hdr
.cmd);
159 for (row=0; (row<scans); row++)
162 for ( i = -aflag; i<files-aflag; i++ )
163 fwrite( inprow[i], 1, rasts, outfil[i+aflag] );
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
int rle_getrow(rle_hdr *the_hdr, scanline)
int scanargs(int argc, char **argv, const char *format,...)
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)