]> granicus.if.org Git - imagemagick/blob - utilities/magick.c
Added checks for exceptions.
[imagemagick] / utilities / magick.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %       Perform "Magick" on Images via the Command Line Interface             %
13 %                                                                             %
14 %                             Dragon Computing                                %
15 %                             Anthony Thyssen                                 %
16 %                               January 2012                                  %
17 %                                                                             %
18 %                                                                             %
19 %  Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization      %
20 %  dedicated to making software imaging solutions freely available.           %
21 %                                                                             %
22 %  You may not use this file except in compliance with the License.  You may  %
23 %  obtain a copy of the License at                                            %
24 %                                                                             %
25 %    http://www.imagemagick.org/script/license.php                            %
26 %                                                                             %
27 %  Unless required by applicable law or agreed to in writing, software        %
28 %  distributed under the License is distributed on an "AS IS" BASIS,          %
29 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
30 %  See the License for the specific language governing permissions and        %
31 %  limitations under the License.                                             %
32 %                                                                             %
33 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 %
35 %  Read CLI arguments, script files, and pipelines, to provide options that
36 %  manipulate images from many different formats.
37 %
38 */
39 \f
40 /*
41   Include declarations.
42 */
43 #include "MagickWand/studio.h"
44 #include "MagickWand/MagickWand.h"
45 \f
46 /*
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 %                                                                             %
49 %                                                                             %
50 %                                                                             %
51 %  M a i n                                                                    %
52 %                                                                             %
53 %                                                                             %
54 %                                                                             %
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 %
57 %
58 */
59
60 static int MagickMain(int argc,char **argv)
61 {
62   ExceptionInfo
63     *exception;
64
65   ImageInfo
66     *image_info;
67
68   MagickBooleanType
69     status;
70
71   MagickCoreGenesis(*argv,MagickTrue);
72   exception=AcquireExceptionInfo();
73   image_info=AcquireImageInfo();
74   status=MagickCommandGenesis(image_info,MagickImageCommand,argc,argv,
75     (char **) NULL,exception);
76   image_info=DestroyImageInfo(image_info);
77   exception=DestroyExceptionInfo(exception);
78   MagickCoreTerminus();
79   return(status == MagickFalse ? 0 : 1);
80 }
81
82 #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
83 int main(int argc,char **argv)
84 {
85   return(MagickMain(argc,argv));
86 }
87 #else
88 int wmain(int argc,wchar_t *argv[])
89 {
90   char
91     **utf8;
92
93   int
94     status;
95
96   register int
97     i;
98
99   utf8=NTArgvToUTF8(argc,argv);
100   status=MagickMain(argc,utf8);
101   for (i=0; i < argc; i++)
102     utf8[i]=DestroyString(utf8[i]);
103   utf8=(char **) RelinquishMagickMemory(utf8);
104   return(status == MagickFalse ? 0 : 1);
105 }
106 #endif