/[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 287 by ph10, Tue Dec 18 20:11:28 2007 UTC revision 336 by ph10, Sat Apr 12 15:59:03 2008 UTC
# Line 214  for (;;) Line 214  for (;;)
214    if (rlen > 1000)    if (rlen > 1000)
215      {      {
216      int dlen;      int dlen;
217    
218      /* If libreadline support is required, use readline() to read a line if the      /* If libreadline support is required, use readline() to read a line if the
219      input is a terminal. Note that readline() removes the trailing newline, so      input is a terminal. Note that readline() removes the trailing newline, so
220      we must put it back again, to be compatible with fgets(). */      we must put it back again, to be compatible with fgets(). */
221    
222  #ifdef SUPPORT_LIBREADLINE  #ifdef SUPPORT_LIBREADLINE
223      if (isatty(fileno(f)))      if (isatty(fileno(f)))
224        {        {
225        size_t len;        size_t len;
226        char *s = readline(prompt);        char *s = readline(prompt);
227        if (s == NULL) return (here == start)? NULL : start;        if (s == NULL) return (here == start)? NULL : start;
228        len = strlen(s);        len = strlen(s);
229        if (len > 0) add_history(s);        if (len > 0) add_history(s);
230        if (len > rlen - 1) len = rlen - 1;        if (len > rlen - 1) len = rlen - 1;
231        memcpy(here, s, len);        memcpy(here, s, len);
232        here[len] = '\n';        here[len] = '\n';
233        here[len+1] = 0;        here[len+1] = 0;
234        free(s);        free(s);
235        }        }
236      else      else
237  #endif  #endif
238    
239      /* Read the next line by normal means, prompting if the file is stdin. */      /* Read the next line by normal means, prompting if the file is stdin. */
240    
241        {        {
242        if (f == stdin) printf(prompt);        if (f == stdin) printf(prompt);
243        if (fgets((char *)here, rlen,  f) == NULL)        if (fgets((char *)here, rlen,  f) == NULL)
244          return (here == start)? NULL : start;          return (here == start)? NULL : start;
245        }        }
246    
247      dlen = (int)strlen((char *)here);      dlen = (int)strlen((char *)here);
248      if (dlen > 0 && here[dlen - 1] == '\n') return start;      if (dlen > 0 && here[dlen - 1] == '\n') return start;
249      here += dlen;      here += dlen;
# Line 1247  while (!done) Line 1247  while (!done)
1247    
1248        case '<':        case '<':
1249          {          {
1250          int x = check_newline(pp, outfile);          if (strncmp((char *)pp, "JS>", 3) == 0)
1251          if (x == 0) goto SKIP_DATA;            {
1252          options |= x;            options |= PCRE_JAVASCRIPT_COMPAT;
1253          while (*pp++ != '>');            pp += 3;
1254              }
1255            else
1256              {
1257              int x = check_newline(pp, outfile);
1258              if (x == 0) goto SKIP_DATA;
1259              options |= x;
1260              while (*pp++ != '>');
1261              }
1262          }          }
1263        break;        break;
1264    

Legend:
Removed from v.287  
changed lines
  Added in v.336

  ViewVC Help
Powered by ViewVC 1.1.5