PageRenderTime 116ms CodeModel.GetById 74ms RepoModel.GetById 0ms app.codeStats 0ms

/pkgs/libs/imagick/src/utilities/identify.c

https://bitbucket.org/bosp/benchmarks-parsec
C | 119 lines | 58 code | 5 blank | 56 comment | 20 complexity | cf64b87c8a1a149e63c3d9289e157371 MD5 | raw file
Possible License(s): CC0-1.0, BSD-2-Clause, AGPL-3.0, MPL-2.0-no-copyleft-exception, Apache-2.0, GPL-3.0, BSD-3-Clause, LGPL-2.1, LGPL-2.0, GPL-2.0
  1. /*
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % %
  4. % %
  5. % %
  6. % IIIII DDDD EEEEE N N TTTTT IIIII FFFFF Y Y %
  7. % I D D E NN N T I F Y Y %
  8. % I D D EEE N N N T I FFF Y %
  9. % I D D E N NN T I F Y %
  10. % IIIII DDDD EEEEE N N T IIIII F Y %
  11. % %
  12. % %
  13. % Identify an Image Format and Characteristics. %
  14. % %
  15. % Software Design %
  16. % John Cristy %
  17. % September 1994 %
  18. % %
  19. % %
  20. % Copyright 1999-2007 ImageMagick Studio LLC, a non-profit organization %
  21. % dedicated to making software imaging solutions freely available. %
  22. % %
  23. % You may not use this file except in compliance with the License. You may %
  24. % obtain a copy of the License at %
  25. % %
  26. % http://www.imagemagick.org/script/license.php %
  27. % %
  28. % Unless required by applicable law or agreed to in writing, software %
  29. % distributed under the License is distributed on an "AS IS" BASIS, %
  30. % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
  31. % See the License for the specific language governing permissions and %
  32. % limitations under the License. %
  33. % %
  34. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  35. %
  36. % Identify describes the format and characteristics of one or more image
  37. % files. It will also report if an image is incomplete or corrupt.
  38. %
  39. %
  40. */
  41. /*
  42. Include declarations.
  43. */
  44. #include <stdio.h>
  45. #include <stdlib.h>
  46. #include <string.h>
  47. #include <time.h>
  48. #include "wand/MagickWand.h"
  49. #if defined(__WINDOWS__)
  50. #include <windows.h>
  51. #endif
  52. /*
  53. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  54. % %
  55. % %
  56. % %
  57. % M a i n %
  58. % %
  59. % %
  60. % %
  61. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  62. %
  63. %
  64. */
  65. int main(int argc,char **argv)
  66. {
  67. char
  68. *option,
  69. *text;
  70. ExceptionInfo
  71. *exception;
  72. ImageInfo
  73. *image_info;
  74. MagickBooleanType
  75. regard_warnings,
  76. status;
  77. register long
  78. i;
  79. MagickCoreGenesis(*argv,MagickTrue);
  80. exception=AcquireExceptionInfo();
  81. regard_warnings=MagickFalse;
  82. for (i=1; i < (long) argc; i++)
  83. {
  84. option=argv[i];
  85. if ((strlen(option) == 1) || ((*option != '-') && (*option != '+')))
  86. continue;
  87. if (LocaleCompare("debug",option+1) == 0)
  88. (void) SetLogEventMask(argv[++i]);
  89. if (LocaleCompare("regard-warnings",option+1) == 0)
  90. regard_warnings=MagickTrue;
  91. }
  92. image_info=AcquireImageInfo();
  93. text=(char *) NULL;
  94. status=IdentifyImageCommand(image_info,argc,argv,&text,exception);
  95. if ((status == MagickFalse) || (exception->severity != UndefinedException))
  96. {
  97. if ((exception->severity < ErrorException) &&
  98. (regard_warnings == MagickFalse))
  99. status=MagickTrue;
  100. CatchException(exception);
  101. }
  102. if (text != (char *) NULL)
  103. {
  104. (void) fputs(text,stdout);
  105. (void) fputc('\n',stdout);
  106. text=DestroyString(text);
  107. }
  108. image_info=DestroyImageInfo(image_info);
  109. exception=DestroyExceptionInfo(exception);
  110. MagickCoreTerminus();
  111. return(status == MagickFalse ? 1 : 0);
  112. }