/[pcre]/code/trunk/pcretest.c
ViewVC logotype

Diff of /code/trunk/pcretest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1027 by ph10, Mon Sep 3 14:01:38 2012 UTC revision 1030 by ph10, Sat Sep 8 15:58:38 2012 UTC
# Line 1097  return sys_errlist[n]; Line 1097  return sys_errlist[n];
1097  #endif /* HAVE_STRERROR */  #endif /* HAVE_STRERROR */
1098    
1099    
1100    
1101    /*************************************************
1102    *       Print newline configuration              *
1103    *************************************************/
1104    
1105    /*
1106    Argument: the return code from PCRE_CONFIG_NEWLINE
1107    Returns:  nothing
1108    */
1109    
1110    static void
1111    print_newline_config(int rc)
1112    {
1113    const char *s = NULL;
1114    printf("  Newline sequence is ");
1115    switch(rc)
1116      {
1117      case CHAR_CR: s = "CR"; break;
1118      case CHAR_LF: s = "LF"; break;
1119      case (CHAR_CR<<8 | CHAR_LF): s = "CRLF"; break;
1120      case -1: s = "ANY"; break;
1121      case -2: s = "ANYCRLF"; break;
1122    
1123      default:
1124      printf("a non-standard value: 0x%04x\n", rc);
1125      return;
1126      }
1127    
1128    printf("%s\n", s);
1129    }
1130    
1131    
1132    
1133  /*************************************************  /*************************************************
1134  *         JIT memory callback                    *  *         JIT memory callback                    *
1135  *************************************************/  *************************************************/
# Line 2428  while (argc > 1 && argv[op][0] == '-') Line 2461  while (argc > 1 && argv[op][0] == '-')
2461        if (strcmp(argv[op + 1], "newline") == 0)        if (strcmp(argv[op + 1], "newline") == 0)
2462          {          {
2463          (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);          (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);
2464          /* Note that these values are always the ASCII values, even          print_newline_config(rc);
         in EBCDIC environments. CR is 13 and NL is 10. */  
         printf("%s\n", (rc == 13)? "CR" :  
           (rc == 10)? "LF" : (rc == (13<<8 | 10))? "CRLF" :  
           (rc == -2)? "ANYCRLF" :  
           (rc == -1)? "ANY" : "???");  
2465          goto EXIT;          goto EXIT;
2466          }          }
2467        printf("Unknown -C option: %s\n", argv[op + 1]);        printf("Unknown -C option: %s\n", argv[op + 1]);
# Line 2442  while (argc > 1 && argv[op][0] == '-') Line 2470  while (argc > 1 && argv[op][0] == '-')
2470    
2471      printf("PCRE version %s\n", version);      printf("PCRE version %s\n", version);
2472      printf("Compiled with\n");      printf("Compiled with\n");
2473    
2474    #ifdef EBCDIC
2475        printf("  EBCDIC code support: LF is 0x%02x\n", CHAR_LF);
2476    #endif
2477    
2478  /* At least one of SUPPORT_PCRE8 and SUPPORT_PCRE16 will be set. If both  /* At least one of SUPPORT_PCRE8 and SUPPORT_PCRE16 will be set. If both
2479  are set, either both UTFs are supported or both are not supported. */  are set, either both UTFs are supported or both are not supported. */
# Line 2475  are set, either both UTFs are supported Line 2507  are set, either both UTFs are supported
2507      else      else
2508        printf("  No just-in-time compiler support\n");        printf("  No just-in-time compiler support\n");
2509      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_NEWLINE, &rc);
2510      /* Note that these values are always the ASCII values, even      print_newline_config(rc);
     in EBCDIC environments. CR is 13 and NL is 10. */  
     printf("  Newline sequence is %s\n", (rc == 13)? "CR" :  
       (rc == 10)? "LF" : (rc == (13<<8 | 10))? "CRLF" :  
       (rc == -2)? "ANYCRLF" :  
       (rc == -1)? "ANY" : "???");  
2511      (void)PCRE_CONFIG(PCRE_CONFIG_BSR, &rc);      (void)PCRE_CONFIG(PCRE_CONFIG_BSR, &rc);
2512      printf("  \\R matches %s\n", rc? "CR, LF, or CRLF only" :      printf("  \\R matches %s\n", rc? "CR, LF, or CRLF only" :
2513                                       "all Unicode newlines");                                       "all Unicode newlines");

Legend:
Removed from v.1027  
changed lines
  Added in v.1030

  ViewVC Help
Powered by ViewVC 1.1.5