Commit 13dc7bac by Alan Mishchenko

Added detection of 'readline' library at compile-time.

parent 71bdfae9
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "base/abc/abc.h" #include "base/abc/abc.h"
#include "mainInt.h" #include "mainInt.h"
#ifndef _WIN32 #if !defined(_WIN32) && defined(READLINE)
#include <readline/readline.h> #include <readline/readline.h>
#include <readline/history.h> #include <readline/history.h>
#endif #endif
...@@ -71,21 +71,20 @@ char * Abc_UtilsGetVersion( Abc_Frame_t * pAbc ) ...@@ -71,21 +71,20 @@ char * Abc_UtilsGetVersion( Abc_Frame_t * pAbc )
char * Abc_UtilsGetUsersInput( Abc_Frame_t * pAbc ) char * Abc_UtilsGetUsersInput( Abc_Frame_t * pAbc )
{ {
static char Prompt[5000]; static char Prompt[5000];
#ifndef _WIN32
static char * line = NULL;
#endif
sprintf( Prompt, "abc %02d> ", pAbc->nSteps ); sprintf( Prompt, "abc %02d> ", pAbc->nSteps );
#ifdef _WIN32 #if !defined(_WIN32) && defined(READLINE)
fprintf( pAbc->Out, "%s", Prompt ); {
fgets( Prompt, 5000, stdin ); static char * line = NULL;
return Prompt;
#else
if (line != NULL) ABC_FREE(line); if (line != NULL) ABC_FREE(line);
line = readline(Prompt); line = readline(Prompt);
if (line == NULL){ printf("***EOF***\n"); exit(0); } if (line == NULL){ printf("***EOF***\n"); exit(0); }
add_history(line); add_history(line);
return line; return line;
}
#else
fprintf( pAbc->Out, "%s", Prompt );
fgets( Prompt, 5000, stdin );
return Prompt;
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment