root / ImageMagick / branches / ImageMagick-6.3.5 / utilities / compare.c

Revision 7647, 5.0 kB (checked in by cristy, 15 months ago)
Line 
1/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3%                                                                             %
4%                                                                             %
5%                                                                             %
6%               CCCC   OOO   M   M  PPPP    AAA   RRRR    EEEEE               %
7%              C      O   O  MM MM  P   P  A   A  R   R   E                   %
8%              C      O   O  M M M  PPPP   AAAAA  RRRR    EEE                 %
9%              C      O   O  M   M  P      A   A  R R     E                   %
10%               CCCC   OOO   M   M  P      A   A  R  R    EEEEE               %
11%                                                                             %
12%                                                                             %
13%                        Image Comparison Utility                             %
14%                                                                             %
15%                                                                             %
16%                           Software Design                                   %
17%                             John Cristy                                     %
18%                            December 2003                                    %
19%                                                                             %
20%                                                                             %
21%  Copyright 1999-2007 ImageMagick Studio LLC, a non-profit organization      %
22%  dedicated to making software imaging solutions freely available.           %
23%                                                                             %
24%  You may not use this file except in compliance with the License.  You may  %
25%  obtain a copy of the License at                                            %
26%                                                                             %
27%    http://www.imagemagick.org/script/license.php                            %
28%                                                                             %
29%  Unless required by applicable law or agreed to in writing, software        %
30%  distributed under the License is distributed on an "AS IS" BASIS,          %
31%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
32%  See the License for the specific language governing permissions and        %
33%  limitations under the License.                                             %
34%                                                                             %
35%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36%
37%  Compare describes the format and characteristics of one or more image
38%  files.  It will also report if an image is incomplete or corrupt.
39%
40%
41*/
42
43/*
44  Include declarations.
45*/
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49#include <time.h>
50#include "wand/MagickWand.h"
51#if defined(__WINDOWS__)
52#include <windows.h>
53#endif
54
55/*
56%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57%                                                                             %
58%                                                                             %
59%                                                                             %
60%  M a i n                                                                    %
61%                                                                             %
62%                                                                             %
63%                                                                             %
64%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65%
66%
67*/
68int main(int argc,char **argv)
69{
70  char
71    *option,
72    *text;
73
74  ExceptionInfo
75    *exception;
76
77  ImageInfo
78    *image_info;
79
80  MagickBooleanType
81    regard_warnings,
82    status;
83
84  register long
85    i;
86
87  MagickCoreGenesis(*argv,MagickTrue);
88  exception=AcquireExceptionInfo();
89  regard_warnings=MagickFalse;
90  for (i=1; i < (long) argc; i++)
91  {
92    option=argv[i];
93    if ((strlen(option) == 1) || ((*option != '-') && (*option != '+')))
94      continue;
95    if (LocaleCompare("debug",option+1) == 0)
96      (void) SetLogEventMask(argv[++i]);
97    if (LocaleCompare("regard-warnings",option+1) == 0)
98      regard_warnings=MagickTrue;
99  }
100  image_info=AcquireImageInfo();
101  text=(char *) NULL;
102  status=CompareImageCommand(image_info,argc,argv,&text,exception);
103  if ((status == MagickFalse) || (exception->severity != UndefinedException))
104    {
105      if ((exception->severity < ErrorException) &&
106          (regard_warnings == MagickFalse))
107        status=MagickTrue;
108      CatchException(exception);
109    }
110  if (text != (char *) NULL)
111    {
112      (void) fputs(text,stdout);
113      (void) fputc('\n',stdout);
114      text=DestroyString(text);
115    }
116  image_info=DestroyImageInfo(image_info);
117  exception=DestroyExceptionInfo(exception);
118  MagickCoreTerminus();
119  return(status == MagickFalse ? 1 : 0);
120}
Note: See TracBrowser for help on using the browser.