summaryrefslogtreecommitdiffstats
path: root/debian/jasper/jasper-1.900.1-debian1/src/appl/dummy2.c
blob: acfd2755adfe399e6993b85dfd801169d4236997 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <stdlib.h>
#include <jasper.h>

#define	FAILED	2

int main(int argc, char **argv)
{
	char *refpath;
	FILE *reffile;
	char *othpath;
	FILE *othfile;
	int c;
	jas_seq2d_t *x;
	jas_seq2d_t *y;

	refpath = 0;
	othpath = 0;

	while ((c = getopt(argc, argv, "f:F:")) != EOF) {
		switch (c) {
		case 'f':
			refpath = optarg;
			break;
		case 'F':
			othpath = optarg;
			break;
		}
	}

	if (!refpath || !othpath) {
		fprintf(stderr, "usage: %s -f reffile -F othfile\n", argv[0]);
		exit(FAILED);
	}

	if (!(reffile = fopen(refpath, "r"))) {
		fprintf(stderr, "cannot open %s\n", refpath);
		exit(FAILED);
	}
	if (!(othfile = fopen(othpath, "r"))) {
		fprintf(stderr, "cannot open %s\n", othpath);
		exit(FAILED);
	}

	if (!(x = jas_seq2d_input(reffile))) {
		fprintf(stderr, "cannot input reference\n");
		exit(FAILED);
	}
	if (!(y = jas_seq2d_input(othfile))) {
		fprintf(stderr, "cannot input other\n");
		exit(FAILED);
	}

	if (!jas_matrix_cmp(x, y)) {
		fprintf(stderr, "equal\n");
		exit(0);
	} else {
		fprintf(stderr, "not equal\n");
		exit(1);
	}

	exit(FAILED);

}