Allow compilation of jtag.c if readline isn't installed (needs more work)

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@824 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent 54fc8fc0a9
commit 0ddc31415e

@ -1,5 +1,6 @@
2007-12-09 [822] Kolja Waschk <kawk>
* src/jtag.c: show version from config.h, compile without readline
* configure.ac: Improve detection of flex version, get Subversion
revision from 1. svn info, or 2. ChangeLog, or 3. Revision tag
* src/version.awk: not needed anymore as SVN info is now put into

@ -35,9 +35,9 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_READLINE
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#ifdef HAVE_READLINE_HISTORY
#ifdef HAVE_READLINE_HISTORY_H
#include <readline/history.h>
#endif
#endif
@ -96,6 +96,7 @@ jtag_create_jtagdir( void )
free( jdir );
}
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_READLINE_HISTORY
static void
@ -149,6 +150,7 @@ jtag_save_history( void )
}
#endif /* HAVE_READLINE_HISTORY */
#endif
static int
jtag_parse_line( char *line )
@ -223,6 +225,7 @@ static int jtag_readline_multiple_commands_support(char * line) /* multiple comm
static void
jtag_readline_loop( const char *prompt )
{
#ifdef HAVE_LIBREADLINE
char *line = NULL;
/* Iterate */
@ -232,11 +235,23 @@ jtag_readline_loop( const char *prompt )
/* Read a line from the terminal */
line = readline( prompt );
#ifdef HAVE_READLINE_HISTORY
/* Check if we actually got something */
if (line && (strlen( line ) > 0))
add_history( line );
#endif
}
free( line );
#else
char line[1024];
line[0] = 0;
do
{
printf("%s", prompt);
jtag_readline_multiple_commands_support( line );
}
while(fgets(line, 1023, stdin));
#endif
}
static int
@ -498,14 +513,18 @@ main( int argc, const char **argv )
free(s);
}
#ifdef HAVE_READLINE_HISTORY
/* Load history */
jtag_load_history();
#endif
/* main loop */
jtag_readline_loop( "jtag> " );
#ifdef HAVE_READLINE_HISTORY
/* Save history */
jtag_save_history();
#endif
}
cleanup();

Loading…
Cancel
Save