Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
getgmr.c
Go to the documentation of this file.
1 /*
2  * getgmr.c - Copy a file to the frame buffer.
3  *
4  * Author: Spencer W. Thomas
5  * Computer Science Dept.
6  * University of Utah
7  * Date: 1 April 1981
8  * Copyright (c) 1981 Spencer W. Thomas
9  *
10  * $Id: getgmr.c,v 3.0.1.2 1992/01/28 18:51:16 spencer Exp $
11  */
12 
13 #include "rle_config.h"
14 #include "stdio.h"
15 #include "getfb.h"
16 #include "rle_code.h"
17 
18 int x = 0, y = 0, posflag = 0, background = 0, query = 0, debug = 0,
19  cflag = 0, getchan, putchan = -1;
20 
21 main(argc, argv)
22 char **argv;
23 {
24  char * fname = NULL;
25  short magic;
26 
27  if (scanargs(argc, argv,
28  "% D%- q%- BO%- Pi%-x!dy!d c%-channel!dinto%d file%s ",
29  &debug,
30  &query, &background, &posflag, &x, &y,
31  &cflag, &getchan, &putchan, &fname) == 0)
32  exit(1);
33 
34  fd = rle_open_f("getgmr", fname, "r");
35  if ((!query) && Fbopen() < 0)
36  exit(1);
37 
38  if (fread((char *)&magic, sizeof(short), 1, fd) != 1)
39  {
40  fprintf(stderr, "Can't read magic number\n");
41  exit(1);
42  }
43 
44  switch(magic)
45  {
46  case (RLE_MAGIC):
47  if (query)
48  fprintf(stderr, "Image saved in Run Length Encoded form\n");
49  XtndRunGet(magic);
50  break;
51 
52  default:
53  fprintf(stderr,
54  "File not an RLE file, can't restore (magic=0x%x)\n",
55  magic);
56  exit(1);
57  break;
58  }
59  return 0;
60 }
int cflag
Definition: getgmr.c:19
int query
Definition: getgmr.c:18
void main(int argc, char **argv)
Definition: aliastorle.c:121
#define RLE_MAGIC
Definition: rle_code.h:67
int putchan
Definition: getgmr.c:19
int debug
Definition: getgmr.c:18
int y
Definition: getgmr.c:18
int posflag
Definition: get4d.c:41
int getchan
Definition: getgmr.c:19
FILE * fd
Definition: getfb.h:18
int x
Definition: getgmr.c:18
int background
Definition: getgmr.c:18