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] );
int scanargs(int argc, char **argv, const char *format,...)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
char * cmd_name(char **argv)
void rle_get_setup_ok(rle_hdr *the_hdr, const char *prog_name, const char *file_name)
int rle_getrow(rle_hdr *the_hdr, rle_pixel *scanline[])
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)