Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Functions | Variables
repos.c File Reference
#include <stdio.h>
#include "rle.h"
Include dependency graph for repos.c:

Go to the source code of this file.

Functions

void main (int argc, argv)
 

Variables

static char rcs_ident [] = "$Header: /software/dmsv/sun4/sunos/SWT-BACKUP/spencer/src/urt/tools/tools/RCS/repos.c,v 3.0.1.1 1992/01/23 16:26:39 spencer Exp $"
 
char buffer [4096]
 

Function Documentation

void main ( int  argc,
argv   
)

Definition at line 38 of file repos.c.

41 {
42  int xlen, ylen, xpos, ypos, posflag=0;
43  int oflag = 0, incflag=0, xinc, yinc;
44  char * infilename = NULL, *out_fname = NULL;
45  FILE *outfile = stdout;
47  int rle_cnt, rle_err;
48 
49  in_hdr = *rle_hdr_init( NULL );
50  out_hdr = *rle_hdr_init( NULL );
51 
52  if (scanargs(argc, argv,
53  "% p%-xpos!dypos!d P%-xinc!dyinc!d o%-outfile!s infile%s",
54  &posflag, &xpos, &ypos, &incflag, &xinc, &yinc,
55  &oflag, &out_fname, &infilename) == 0)
56  {
57  exit(-1);
58  }
59 
60  in_hdr.rle_file = rle_open_f( cmd_name( argv ), infilename, "r" );
61  rle_names( &in_hdr, cmd_name( argv ), infilename, 0 );
62  rle_names( &out_hdr, in_hdr.cmd, out_fname, 0 );
63 
64  for ( rle_cnt = 0;
65  (rle_err = rle_get_setup( &in_hdr )) == RLE_SUCCESS;
66  rle_cnt++ )
67  {
68  (void)rle_hdr_cp( &in_hdr, &out_hdr );
69  if ( rle_cnt == 0 )
70  outfile = rle_open_f( cmd_name( argv ), out_fname, "w" );
71  out_hdr.rle_file = outfile;
72  rle_addhist( argv, &in_hdr, &out_hdr );
73 
74  xlen = in_hdr.xmax - in_hdr.xmin;
75  ylen = in_hdr.ymax - in_hdr.ymin;
76 
77  if (posflag)
78  {
79  out_hdr.xmin = xpos;
80  out_hdr.ymin = ypos;
81  out_hdr.xmax = xpos + xlen;
82  out_hdr.ymax = ypos + ylen;
83  }
84  else if (incflag)
85  {
86  out_hdr.xmin = in_hdr.xmin + xinc;
87  out_hdr.ymin = in_hdr.ymin + yinc;
88  out_hdr.xmax = in_hdr.xmax + xinc;
89  out_hdr.ymax = in_hdr.ymax + yinc;
90  }
91  else
92  {
93  /* nothing specified on command line, assume -p 0 0 */
94  out_hdr.xmin = 0;
95  out_hdr.ymin = 0;
96  out_hdr.xmax = xlen;
97  out_hdr.ymax = ylen;
98  }
99 
100  if ((out_hdr.xmin < 0) || (out_hdr.ymin < 0))
101  {
102  fprintf(stderr, "Negative boundaries are not allowed!!!\n");
103  exit( -1 );
104  }
105 
106  rle_put_setup( &out_hdr );
107 
108  rle_cp( &in_hdr, &out_hdr );
109  }
110 
111  /* Check for an error. EOF or EMPTY is ok if at least one image
112  * has been read. Otherwise, print an error message.
113  */
114  if ( rle_cnt == 0 || (rle_err != RLE_EOF && rle_err != RLE_EMPTY) )
115  rle_get_error( rle_err, cmd_name( argv ), infilename );
116 
117  exit( 0 );
118 }
int xmin
Definition: rle.h:100
int scanargs(int argc, char **argv, const char *format,...)
Definition: scanargs.c:94
static rle_hdr in_hdr
Definition: rletogif.c:37
FILE * outfile
Definition: giftorle.c:61
#define RLE_EMPTY
Definition: rle.h:73
void rle_cp(rle_hdr *in_hdr, rle_hdr *out_hdr)
Definition: rle_cp.c:69
void rle_addhist(char *argv[], rle_hdr *in_hdr, rle_hdr *out_hdr)
#define RLE_SUCCESS
Definition: rle.h:70
int ymin
Definition: rle.h:100
int posflag
Definition: get4d.c:41
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
const char * cmd
Definition: rle.h:133
int rle_get_setup(rle_hdr *the_hdr)
Definition: rle_getrow.c:74
Definition: rle.h:96
int xmax
Definition: rle.h:100
int rle_get_error(int code, const char *pgmname, const char *fname)
#define RLE_EOF
Definition: rle.h:74
int ymax
Definition: rle.h:100
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
Definition: rle_hdr.c:119
FILE * rle_open_f(const char *prog_name, const char *f_name, const char *mode)
void rle_put_setup(rle_hdr *the_hdr)
Definition: rle_putrow.c:453
char * cmd_name(char **argv)
Definition: cmd_name.c:31
int oflag
Definition: painttorle.c:45
FILE * rle_file
Definition: rle.h:114
rle_hdr out_hdr
Definition: dvirle2.c:89
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
Definition: rle_hdr.c:267

Variable Documentation

char buffer[4096]

Definition at line 35 of file repos.c.

char rcs_ident[] = "$Header: /software/dmsv/sun4/sunos/SWT-BACKUP/spencer/src/urt/tools/tools/RCS/repos.c,v 3.0.1.1 1992/01/23 16:26:39 spencer Exp $"
static

Definition at line 29 of file repos.c.