Skip to content
Permalink
Browse files Browse the repository at this point in the history
https://github.com/ImageMagick/ImageMagick/issues/196
  • Loading branch information
Cristy committed Jun 4, 2016
1 parent 8f012e5 commit 933e96f
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions MagickWand/magick-cli.c
Expand Up @@ -636,12 +636,15 @@ static void MagickUsage(MagickBooleanType verbose)
however the last argument provides the output filename.
*/
static MagickBooleanType ConcatenateImages(int argc,char **argv,
ExceptionInfo *exception )
ExceptionInfo *exception )
{
FILE
*input,
*output;

MagickBooleanType
status;

int
c;

Expand All @@ -650,29 +653,31 @@ static MagickBooleanType ConcatenateImages(int argc,char **argv,

if (ExpandFilenames(&argc,&argv) == MagickFalse)
ThrowFileException(exception,ResourceLimitError,"MemoryAllocationFailed",
GetExceptionMessage(errno));

GetExceptionMessage(errno));
output=fopen_utf8(argv[argc-1],"wb");
if (output == (FILE *) NULL) {
ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[argc-1]);
return(MagickFalse);
}
for (i=2; i < (ssize_t) (argc-1); i++) {
#if 0
fprintf(stderr, "DEBUG: Concatenate Image: \"%s\"\n", argv[i]);
#endif
if (output == (FILE *) NULL)
{
ThrowFileException(exception,FileOpenError,"UnableToOpenFile",
argv[argc-1]);
return(MagickFalse);
}
status=MagickTrue;
for (i=2; i < (ssize_t) (argc-1); i++)
{
input=fopen_utf8(argv[i],"rb");
if (input == (FILE *) NULL) {
if (input == (FILE *) NULL)
{
ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[i]);
continue;
}
for (c=fgetc(input); c != EOF; c=fgetc(input))
(void) fputc((char) c,output);
if (fputc((char) c,output) != c)
status=MagickFalse;
(void) fclose(input);
(void) remove_utf8(argv[i]);
}
(void) fclose(output);
return(MagickTrue);
return(status);
}

WandExport MagickBooleanType MagickImageCommand(ImageInfo *image_info,int argc,
Expand Down

0 comments on commit 933e96f

Please sign in to comment.