• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching +full:argument +full:- +full:count

25 %  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization      %
51 #include "MagickWand/magick-wand-private.h"
53 #include "MagickWand/wandcli-private.h"
55 #include "MagickWand/magick-cli.h"
56 #include "MagickWand/script-token.h"
57 #include "MagickCore/utility-private.h"
58 #include "MagickCore/exception-private.h"
62 0 - no debug lines
63 3 - show option details (better to use -debug Command now)
64 5 - image counts (after option runs)
82 % options is given as the 'index' argument of the argument array given.
104 % o argc: the number of elements in the argument vector. (optional)
121 count; in ProcessScriptOptions() local
131 assert(filename != (char *) NULL ); /* at least one argument - script name */ in ProcessScriptOptions()
133 assert(cli_wand->signature == MagickWandSignature); in ProcessScriptOptions()
134 if (cli_wand->wand.debug != MagickFalse) in ProcessScriptOptions()
147 cli_wand->location="in \"%s\" at line %u,column %u"; in ProcessScriptOptions()
148 if ( LocaleCompare("-", filename) == 0 ) in ProcessScriptOptions()
149 cli_wand->filename="stdin"; in ProcessScriptOptions()
151 cli_wand->filename=filename; in ProcessScriptOptions()
160 cli_wand->line=token_info->token_line; in ProcessScriptOptions()
161 cli_wand->column=token_info->token_column; in ProcessScriptOptions()
169 CloneString(&option,token_info->token); in ProcessScriptOptions()
171 /* get option, its argument count, and option type */ in ProcessScriptOptions()
172 cli_wand->command = GetCommandOptionInfo(option); in ProcessScriptOptions()
173 count=cli_wand->command->type; in ProcessScriptOptions()
174 option_type=(CommandOptionFlags) cli_wand->command->flags; in ProcessScriptOptions()
177 cli_wand->line, cli_wand->line, option, cli_wand->command->mnemonic ); in ProcessScriptOptions()
180 /* handle a undefined option - image read - always for "magick-script" */ in ProcessScriptOptions()
184 (void) FormatLocaleFile(stderr, "Script %u,%u Non-Option: \"%s\"\n", in ProcessScriptOptions()
185 cli_wand->line, cli_wand->line, option); in ProcessScriptOptions()
188 /* non-option -- treat as a image read */ in ProcessScriptOptions()
189 cli_wand->command=(const OptionInfo *) NULL; in ProcessScriptOptions()
190 CLIOption(cli_wand,"-read",option); in ProcessScriptOptions()
197 if ( count >= 1 ) { in ProcessScriptOptions()
200 CloneString(&arg1,token_info->token); in ProcessScriptOptions()
205 if ( count >= 2 ) { in ProcessScriptOptions()
208 CloneString(&arg2,token_info->token); in ProcessScriptOptions()
218 "Script %u,%u Option: \"%s\" Count: %d Flags: %04x Args: \"%s\" \"%s\"\n", in ProcessScriptOptions()
219 cli_wand->line,cli_wand->line,option,count,option_type,arg1,arg2); in ProcessScriptOptions()
221 /* Hard Deprecated Options, no code to execute - error */ in ProcessScriptOptions()
235 if ( LocaleCompare(option,"-exit") == 0 ) { in ProcessScriptOptions()
236 goto loop_exit; /* break out of loop - return from script */ in ProcessScriptOptions()
238 if ( LocaleCompare(option,"-script") == 0 ) { in ProcessScriptOptions()
239 /* FUTURE: call new script from this script - error for now */ in ProcessScriptOptions()
243 /* FUTURE: handle special script-argument options here */ in ProcessScriptOptions()
249 /* Process non-specific Option */ in ProcessScriptOptions()
259 fprintf(stderr, "Script Image Count = %ld\n", in ProcessScriptOptions()
260 GetImageListLength(cli_wand->wand.images) ); in ProcessScriptOptions()
267 Loop exit - check for some tokenization error in ProcessScriptOptions()
271 (void) FormatLocaleFile(stderr, "Script End: %d\n", token_info->status); in ProcessScriptOptions()
273 switch( token_info->status ) { in ProcessScriptOptions()
276 if (cli_wand->image_list_stack != (Stack *) NULL) in ProcessScriptOptions()
278 else if (cli_wand->image_info_stack != (Stack *) NULL) in ProcessScriptOptions()
283 if( strlen(token_info->token) > INITAL_TOKEN_LENGTH-1 ) { in ProcessScriptOptions()
284 token_info->token[INITAL_TOKEN_LENGTH-4] = '.'; in ProcessScriptOptions()
285 token_info->token[INITAL_TOKEN_LENGTH-3] = '.'; in ProcessScriptOptions()
286 token_info->token[INITAL_TOKEN_LENGTH-2] = '.'; in ProcessScriptOptions()
287 token_info->token[INITAL_TOKEN_LENGTH-1] = '\0'; in ProcessScriptOptions()
290 token_info->token); in ProcessScriptOptions()
301 if (cli_wand->wand.debug != MagickFalse) in ProcessScriptOptions()
327 % command line argument array. The 'index' defines where in the array we
332 % are to be handled, and if the last argument in array is to be regarded as a
333 % final image write argument (filename or special coder).
344 % o argc: the number of elements in the argument vector.
369 count; in ProcessCommandOptions() local
377 assert(argv[argc-1] != (char *) NULL); in ProcessCommandOptions()
379 assert(cli_wand->signature == MagickWandSignature); in ProcessCommandOptions()
383 cli_wand->location="at %s arg %u"; in ProcessCommandOptions()
384 cli_wand->filename="CLI"; in ProcessCommandOptions()
385 cli_wand->line=index; /* note first argument we will process */ in ProcessCommandOptions()
387 if (cli_wand->wand.debug != MagickFalse) in ProcessCommandOptions()
389 "- Starting (\"%s\")", argv[index]); in ProcessCommandOptions()
392 if ( (cli_wand->process_flags & ProcessImplictWrite) != 0 ) in ProcessCommandOptions()
393 end--; /* the last arument is an implied write, do not process directly */ in ProcessCommandOptions()
395 for (i=index; i < end; i += count +1) { in ProcessCommandOptions()
397 if ( (cli_wand->process_flags & ProcessOneOptionOnly) != 0 && i != index ) in ProcessCommandOptions()
403 cli_wand->line=i; /* note the argument for this option */ in ProcessCommandOptions()
405 /* get option, its argument count, and option type */ in ProcessCommandOptions()
406 cli_wand->command = GetCommandOptionInfo(argv[i]); in ProcessCommandOptions()
407 count=cli_wand->command->type; in ProcessCommandOptions()
408 option_type=(CommandOptionFlags) cli_wand->command->flags; in ProcessCommandOptions()
411 i, argv[i], cli_wand->command->mnemonic ); in ProcessCommandOptions()
417 (void) FormatLocaleFile(stderr, "CLI arg %d Non-Option: \"%s\"\n", in ProcessCommandOptions()
421 if ( (cli_wand->process_flags & ProcessImplictRead) != 0 ) { in ProcessCommandOptions()
422 /* non-option -- treat as a image read */ in ProcessCommandOptions()
423 cli_wand->command=(const OptionInfo *) NULL; in ProcessCommandOptions()
424 CLIOption(cli_wand,"-read",option); in ProcessCommandOptions()
433 ((cli_wand->process_flags & ProcessScriptOption) != 0) && in ProcessCommandOptions()
434 (LocaleCompare(option,"-script") == 0) ) { in ProcessCommandOptions()
435 /* Call Script from CLI, with a filename as a zeroth argument. in ProcessCommandOptions()
436 NOTE: -script may need to use the 'implict write filename' argument in ProcessCommandOptions()
437 so it must be handled specially to prevent a 'missing argument' error. in ProcessCommandOptions()
439 if ( (i+count) >= argc ) in ProcessCommandOptions()
441 ProcessScriptOptions(cli_wand,argv[i+1],argc,argv,i+count); in ProcessCommandOptions()
442 return(argc); /* Script does not return to CLI -- Yet */ in ProcessCommandOptions()
446 if ((i+count) >= end ) { in ProcessCommandOptions()
450 break; /* next option - not that their is any! */ in ProcessCommandOptions()
453 arg1 = ( count >= 1 ) ? argv[i+1] : (char *) NULL; in ProcessCommandOptions()
454 arg2 = ( count >= 2 ) ? argv[i+2] : (char *) NULL; in ProcessCommandOptions()
461 "CLI arg %u Option: \"%s\" Count: %d Flags: %04x Args: \"%s\" \"%s\"\n", in ProcessCommandOptions()
462 i,option,count,option_type,arg1,arg2); in ProcessCommandOptions()
468 /* Handle any special options for CLI (-script handled above) */ in ProcessCommandOptions()
470 if ( (cli_wand->process_flags & ProcessExitOption) != 0 in ProcessCommandOptions()
471 && LocaleCompare(option,"-exit") == 0 ) in ProcessCommandOptions()
472 return(i+count); in ProcessCommandOptions()
484 (void) FormatLocaleFile(stderr, "CLI-post Image Count = %ld\n", in ProcessCommandOptions()
485 (long) GetImageListLength(cli_wand->wand.images) ); in ProcessCommandOptions()
488 return(i+count); in ProcessCommandOptions()
492 if ( (cli_wand->process_flags & ProcessImplictWrite) == 0 ) in ProcessCommandOptions()
493 return(end); /* no implied write -- just return to caller */ in ProcessCommandOptions()
495 assert(end==argc-1); /* end should not include last argument */ in ProcessCommandOptions()
498 Implicit Write of images to final CLI argument in ProcessCommandOptions()
501 cli_wand->line=i; in ProcessCommandOptions()
503 /* check that stacks are empty - or cause exception */ in ProcessCommandOptions()
504 if (cli_wand->image_list_stack != (Stack *) NULL) in ProcessCommandOptions()
506 else if (cli_wand->image_info_stack != (Stack *) NULL) in ProcessCommandOptions()
516 if (LocaleCompare(option,"-exit") == 0 ) in ProcessCommandOptions()
521 -- produce an error */ in ProcessCommandOptions()
528 cli_wand->command=(const OptionInfo *) NULL; in ProcessCommandOptions()
529 CLIOption(cli_wand,"-write",option); in ProcessCommandOptions()
561 % o argc: the number of elements in the argument vector.
583 if (len>=7 && LocaleCompare("convert",name+len-7) == 0) { in MagickUsage()
588 " %s -help | -version | -usage | -list {option}\n\n",name); in MagickUsage()
591 else if (len>=6 && LocaleCompare("script",name+len-6) == 0) { in MagickUsage()
592 /* magick-script usage */ in MagickUsage()
603 " %s [ {option} | {image} ... ] -script {filename} [ {script_args} ...]\n", in MagickUsage()
607 " %s -help | -version | -usage | -list {option}\n\n",name); in MagickUsage()
614 "You must read-in images before you can operate on them.\n", in MagickUsage()
617 " #!/path/to/magick -script\n", in MagickUsage()
620 " :; exec magick -script \"$0\" \"$@\"; exit 10\n", in MagickUsage()
623 " #!/usr/bin/env magick-script\n", in MagickUsage()
625 "Note: \"magick-script\" needs to be linked to the \"magick\" command.\n", in MagickUsage()
634 Concatanate given file arguments to the given output argument.
635 Used for a special -concatenate option used for specific 'delegates'.
638 magick -concatenate files... output
641 however the last argument provides the output filename.
662 output=fopen_utf8(argv[argc-1],"wb"); in ConcatenateImages()
666 argv[argc-1]); in ConcatenateImages()
670 for (i=2; i < (ssize_t) (argc-1); i++) in ConcatenateImages()
704 cli_wand->location="Initializing"; in MagickImageCommand()
705 cli_wand->filename=argv[0]; in MagickImageCommand()
706 cli_wand->line=1; in MagickImageCommand()
708 if (cli_wand->wand.debug != MagickFalse) in MagickImageCommand()
713 GetPathComponent(argv[0],TailPath,cli_wand->wand.name); in MagickImageCommand()
714 SetClientName(cli_wand->wand.name); in MagickImageCommand()
715 ConcatenateMagickString(cli_wand->wand.name,"-CLI",MagickPathExtent); in MagickImageCommand()
719 /* "convert" command - give a "deprecated" warning" */ in MagickImageCommand()
720 if (len>=7 && LocaleCompare("convert",argv[0]+len-7) == 0) { in MagickImageCommand()
721 cli_wand->process_flags = ConvertCommandOptionFlags; in MagickImageCommand()
726 /* Special Case: If command name ends with "script" implied "-script" */ in MagickImageCommand()
727 if (len>=6 && LocaleCompare("script",argv[0]+len-6) == 0) { in MagickImageCommand()
728 if (argc >= 2 && ( (*(argv[1]) != '-') || (strlen(argv[1]) == 1) )) { in MagickImageCommand()
729 GetPathComponent(argv[1],TailPath,cli_wand->wand.name); in MagickImageCommand()
737 if ((LocaleCompare("-version",argv[1]) == 0) || /* GNU standard option */ in MagickImageCommand()
738 (LocaleCompare("--version",argv[1]) == 0) ) { /* just version */ in MagickImageCommand()
739 CLIOption(cli_wand, "-version"); in MagickImageCommand()
742 if ((LocaleCompare("-help",argv[1]) == 0) || /* GNU standard option */ in MagickImageCommand()
743 (LocaleCompare("--help",argv[1]) == 0) ) { /* just a brief summary */ in MagickImageCommand()
744 if (cli_wand->wand.debug != MagickFalse) in MagickImageCommand()
746 "- Special Option \"%s\"", argv[1]); in MagickImageCommand()
750 if (LocaleCompare("-usage",argv[1]) == 0) { /* both version & usage */ in MagickImageCommand()
751 if (cli_wand->wand.debug != MagickFalse) in MagickImageCommand()
753 "- Special Option \"%s\"", argv[1]); in MagickImageCommand()
754 CLIOption(cli_wand, "-version" ); in MagickImageCommand()
760 /* not enough arguments -- including -help */ in MagickImageCommand()
763 "Error: Invalid argument or not enough arguments\n\n"); in MagickImageCommand()
769 if (LocaleCompare("-concatenate",argv[1]) == 0) { in MagickImageCommand()
770 if (cli_wand->wand.debug != MagickFalse) in MagickImageCommand()
772 "- Special Option \"%s\"", argv[1]); in MagickImageCommand()
778 if (argc == 3 && LocaleCompare("-list",argv[1]) == 0) { in MagickImageCommand()
783 /* ------------- */ in MagickImageCommand()
786 if (LocaleCompare("-script",argv[1]) == 0) { in MagickImageCommand()
787 /* Start processing directly from script, no pre-script options in MagickImageCommand()
789 First argument in the argv array is the script name to read. in MagickImageCommand()
791 GetPathComponent(argv[2],TailPath,cli_wand->wand.name); in MagickImageCommand()
798 /* ------------- */ in MagickImageCommand()
801 cli_wand->location="Cleanup"; in MagickImageCommand()
802 cli_wand->filename=argv[0]; in MagickImageCommand()
803 if (cli_wand->wand.debug != MagickFalse) in MagickImageCommand()
808 FUTURE: "-reset stacks" option */ in MagickImageCommand()
809 while ((cli_wand->image_list_stack != (Stack *) NULL) && in MagickImageCommand()
810 (cli_wand->image_list_stack->next != (Stack *) NULL)) in MagickImageCommand()
812 while ((cli_wand->image_info_stack != (Stack *) NULL) && in MagickImageCommand()
813 (cli_wand->image_info_stack->next != (Stack *) NULL)) in MagickImageCommand()
817 assert(cli_wand->wand.image_info == image_info); in MagickImageCommand()
818 assert(cli_wand->wand.exception == exception); in MagickImageCommand()
821 if ((cli_wand->wand.images != (Image *) NULL) && in MagickImageCommand()
831 text=InterpretImageProperties(image_info,cli_wand->wand.images,format, in MagickImageCommand()
844 cli_wand->location="Exiting"; in MagickImageCommand()
845 cli_wand->filename=argv[0]; in MagickImageCommand()
846 if (cli_wand->wand.debug != MagickFalse) in MagickImageCommand()
851 cli_wand->wand.image_info = (ImageInfo *) NULL; /* not these */ in MagickImageCommand()
852 cli_wand->wand.exception = (ExceptionInfo *) NULL; in MagickImageCommand()
855 return(exception->severity < ErrorException ? MagickTrue : MagickFalse); in MagickImageCommand()