| 59 |
#include <locale.h> |
#include <locale.h> |
| 60 |
#include <errno.h> |
#include <errno.h> |
| 61 |
|
|
| 62 |
#ifdef SUPPORT_LIBREADLINE |
/* Both libreadline and libedit are optionally supported. The user-supplied |
| 63 |
|
original patch uses readline/readline.h for libedit, but in at least one system |
| 64 |
|
it is installed as editline/readline.h, so the configuration code now looks for |
| 65 |
|
that first, falling back to readline/readline.h. */ |
| 66 |
|
|
| 67 |
|
#if defined(SUPPORT_LIBREADLINE) || defined(SUPPORT_LIBEDIT) |
| 68 |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
| 69 |
#include <unistd.h> |
#include <unistd.h> |
| 70 |
#endif |
#endif |
| 71 |
|
#if defined(SUPPORT_LIBREADLINE) |
| 72 |
#include <readline/readline.h> |
#include <readline/readline.h> |
| 73 |
#include <readline/history.h> |
#include <readline/history.h> |
| 74 |
|
#else |
| 75 |
|
#if defined(HAVE_EDITLINE_READLINE_H) |
| 76 |
|
#include <editline/readline.h> |
| 77 |
|
#else |
| 78 |
|
#include <readline/readline.h> |
| 79 |
|
#endif |
| 80 |
|
#endif |
| 81 |
#endif |
#endif |
|
|
|
| 82 |
|
|
| 83 |
/* A number of things vary for Windows builds. Originally, pcretest opened its |
/* A number of things vary for Windows builds. Originally, pcretest opened its |
| 84 |
input and output without "b"; then I was told that "b" was needed in some |
input and output without "b"; then I was told that "b" was needed in some |
| 1304 |
{ |
{ |
| 1305 |
int dlen; |
int dlen; |
| 1306 |
|
|
| 1307 |
/* If libreadline support is required, use readline() to read a line if the |
/* If libreadline or libedit support is required, use readline() to read a |
| 1308 |
input is a terminal. Note that readline() removes the trailing newline, so |
line if the input is a terminal. Note that readline() removes the trailing |
| 1309 |
we must put it back again, to be compatible with fgets(). */ |
newline, so we must put it back again, to be compatible with fgets(). */ |
| 1310 |
|
|
| 1311 |
#ifdef SUPPORT_LIBREADLINE |
#if defined(SUPPORT_LIBREADLINE) || defined(SUPPORT_LIBEDIT) |
| 1312 |
if (isatty(fileno(f))) |
if (isatty(fileno(f))) |
| 1313 |
{ |
{ |
| 1314 |
size_t len; |
size_t len; |
| 2124 |
{ |
{ |
| 2125 |
printf("Usage: pcretest [options] [<input file> [<output file>]]\n\n"); |
printf("Usage: pcretest [options] [<input file> [<output file>]]\n\n"); |
| 2126 |
printf("Input and output default to stdin and stdout.\n"); |
printf("Input and output default to stdin and stdout.\n"); |
| 2127 |
#ifdef SUPPORT_LIBREADLINE |
#if defined(SUPPORT_LIBREADLINE) || defined(SUPPORT_LIBEDIT) |
| 2128 |
printf("If input is a terminal, readline() is used to read from it.\n"); |
printf("If input is a terminal, readline() is used to read from it.\n"); |
| 2129 |
#else |
#else |
| 2130 |
printf("This version of pcretest is not linked with readline().\n"); |
printf("This version of pcretest is not linked with readline().\n"); |