diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-09-29 17:50:50 -0400 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-09-29 17:50:50 -0400 |
commit | 13dc7bacf1c88b61e92f7622f6f125593524a89a (patch) | |
tree | 2982d699471a07bc1466e2cf8e0e35e852a35ac5 /src/base/main | |
parent | 71bdfae94122fff6f245c47721d284f78c286164 (diff) | |
download | abc-13dc7bacf1c88b61e92f7622f6f125593524a89a.tar.gz abc-13dc7bacf1c88b61e92f7622f6f125593524a89a.tar.bz2 abc-13dc7bacf1c88b61e92f7622f6f125593524a89a.zip |
Added detection of 'readline' library at compile-time.
Diffstat (limited to 'src/base/main')
-rw-r--r-- | src/base/main/mainUtils.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/base/main/mainUtils.c b/src/base/main/mainUtils.c index b46ffaea..475d13ec 100644 --- a/src/base/main/mainUtils.c +++ b/src/base/main/mainUtils.c @@ -21,7 +21,7 @@ #include "base/abc/abc.h" #include "mainInt.h" -#ifndef _WIN32 +#if !defined(_WIN32) && defined(READLINE) #include <readline/readline.h> #include <readline/history.h> #endif @@ -71,21 +71,20 @@ char * Abc_UtilsGetVersion( Abc_Frame_t * pAbc ) char * Abc_UtilsGetUsersInput( Abc_Frame_t * pAbc ) { static char Prompt[5000]; -#ifndef _WIN32 - static char * line = NULL; -#endif - sprintf( Prompt, "abc %02d> ", pAbc->nSteps ); -#ifdef _WIN32 - fprintf( pAbc->Out, "%s", Prompt ); - fgets( Prompt, 5000, stdin ); - return Prompt; -#else +#if !defined(_WIN32) && defined(READLINE) + { + static char * line = NULL; if (line != NULL) ABC_FREE(line); line = readline(Prompt); if (line == NULL){ printf("***EOF***\n"); exit(0); } add_history(line); return line; + } +#else + fprintf( pAbc->Out, "%s", Prompt ); + fgets( Prompt, 5000, stdin ); + return Prompt; #endif } |