11 char rcsid[] =
"$Header: /tmp_mnt/n/itn/hendrix/u/spencer/RCS/rlesplit.c,v 3.0.1.2 1992/04/30 14:13:55 spencer Exp spencer $";
65 int num = 1, oflag = 0, digits = 3, tflag = 0;
67 CONST_DECL char *infname = NULL, *format =
"%s%0*d.rle";
68 static char nullpref[] =
"";
69 char *prefix = nullpref;
72 rle_hdr in_hdr, out_hdr;
78 "% n%-number!ddigits%d o%-prefix!s t%- infile%s\n(\
79 \tSplit a multi-image file into separate files.\n\
80 \t-n\tSpecify number assigned to first image, optionally specify\n\
81 \t\tnumber of digits used for numbering (default 3).\n\
82 \t-o\tSpecify output filename prefix. If not specified, input\n\
83 \t\tfile name (without .rle) will be used. Output file names are\n\
84 \t\tof the form prefix.number.rle.\n\
85 \t-t\tUse TITLE (or title) comment as file name. They should be distinct.)",
86 &num
, &num
, &digits
, &oflag
, &prefix
, &tflag
,
94 if ( oflag || infname )
96 format =
"%s.%0*d.rle";
101 for ( cp = infname; *cp; cp++ )
104 for ( slashp = cp - 1; *slashp !=
'/' && slashp > infname; )
106 if ( *slashp ==
'/' )
109 while ( *--cp !=
'.' && cp > infname )
111 if ( strcmp( cp,
".rle" ) != 0 )
112 cp = infname + strlen( infname );
114 prefix = (
char *)calloc( cp - slashp + 1, 1 );
117 strncpy( prefix, infname, cp - slashp );
128 sprintf( filebuf,
"%s%s", prefix, title );
130 sprintf( filebuf, format, prefix, digits, num++ );
132 fprintf( stderr,
"%s: Creating %s\n",
cmd_name( argv
), filebuf );
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
void rle_cp(rle_hdr *in_hdr, rle_hdr *the_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
char * cmd_name(char **argv)
void rle_close_f(FILE *fd)
void main(int argc, char **argv)
int rle_get_setup(rle_hdr *the_hdr)
int rle_get_error(int code, const char *pgmname, const char *fname)
int scanargs(int argc, char **argv, const char *format,...)
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
char * rle_getcom(char *name, rle_hdr *the_hdr) const
void rle_put_setup(rle_hdr *the_hdr)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)