3 - mnemonic lookup
4 - output options/artifacts
*/
-#define MagickCommandDebug 0
+#define MagickCommandDebug 3
#define ThrowFileException(exception,severity,tag,context) \
{ \
break;
}
- /* Sanity check: option is larger than anything that should be posible */
- if( strlen(token_info->token) > INITAL_TOKEN_LENGTH-1 ) {
- token_info->token[INITAL_TOKEN_LENGTH-4] = '.';
- token_info->token[INITAL_TOKEN_LENGTH-3] = '.';
- token_info->token[INITAL_TOKEN_LENGTH-2] = '.';
- token_info->token[INITAL_TOKEN_LENGTH-1] = '\0';
- CLIWandException(OptionFatalError,"UnrecognizedOption",token_info->token);
- break;
- }
-
/* save option details */
CloneString(&option,token_info->token);
Implicit Write of images to final CLI argument
*/
option=argv[i];
+ cli_wand->line=i;
#if MagickCommandDebug
(void) FormatLocaleFile(stderr, "CLI Write File: \"%s\"\n", option );
#define IN_QUOTE 2
#define IN_COMMENT 3
-/* macro to read character from stream */
+/* Macro to read character from stream
+
+ This also keeps track of the line and column counts.
+ The EOL is defined as either '\r\n', or '\r', or '\n'.
+ A '\r' on its own is converted into a '\n' to correctly handle
+ raw input, typically due to 'copy-n-paste' of text files.
+*/
#define GetChar(c) \
{ \
c=fgetc(token_info->stream); \
token_info->curr_column++; \
+ if ( c == '\r' ) { \
+ c=fgetc(token_info->stream); \
+ ungetc(c,token_info->stream); \
+ c = (c!='\n')?'\n':'\r'; \
+ } \
if ( c == '\n' ) \
token_info->curr_line++, token_info->curr_column=0; \
if (c == EOF ) \