78 char *
fname = NULL, * out_fname = NULL;
83 int oflag = 0,
iflag = 0, delflag = 0, ncomment = 0;
91 if (
scanargs( argc, argv,
"% d%- i%- o%-outfile!s infile!s comments!*s",
92 &delflag, &
iflag, &oflag, &out_fname, &fname,
93 &ncomment, &comments ) == 0 )
106 if ( strcmp( i_fname,
"-" ) == 0 )
109 "%s: Can't add comments \"in place\" to standard %s.\n",
110 my_name, oflag ?
"output" :
"input" );
113 #ifndef NO_OPEN_PIPES
114 if ( *i_fname ==
'|' )
117 "%s: Can't add comments \"in place\" to piped %s.\n",
118 my_name, oflag ?
"output" :
"input" );
122 strcpy(
buf, i_fname );
132 #ifndef NO_OPEN_PIPES
134 cp = i_fname + strlen( i_fname ) - 2;
135 if ( cp > i_fname && *cp ==
'.' && *(cp + 1) ==
'Z' )
155 outfile =
rle_open_f( my_name, out_fname,
"w" );
159 for ( j = 0; j < ncomment; j++ )
171 rle_cp( &in_hdr, &out_hdr );
187 fprintf( stderr,
"%s: %s not replaced\n",
191 #ifndef NO_OPEN_PIPES
198 if ( rename(
buf, i_fname ) < 0 )
200 fprintf( stderr,
"%s: rename failed: ", my_name );
int scanargs(int argc, char **argv, const char *format,...)
const char * rle_delcom(const char *name, rle_hdr *the_hdr)
const char * rle_putcom(const char *value, rle_hdr *the_hdr)
void rle_cp(rle_hdr *in_hdr, rle_hdr *out_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
int rle_get_setup(rle_hdr *the_hdr)
int rle_get_error(int code, const char *pgmname, const char *fname)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
void rle_put_setup(rle_hdr *the_hdr)
char * cmd_name(char **argv)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)