mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-10 12:24:20 +00:00
cb053b0cad
* Add r_line_get_prompt() - _set_prompt() uses strdup now - a bit slower but more consistent * Use r_line from r_lang - Added history in #!<lang> prompt - Fix r_lang plugin init from r2-bindings-python-threads - Better help message in lang ? prompt * Fix r_cons control+arrow issue - resets terminal as raw - History data is initialized if needed * Fix sys/swig.sh for latest OSX-ports * Add missing get_fcn_at() method in RAnal vapi
42 lines
829 B
C
42 lines
829 B
C
/* radare - LGPL - Copyright 2007-2011 pancake<nopcode.org> */
|
|
|
|
#include <r_line.h>
|
|
|
|
static RLine r_line_instance;
|
|
#define I r_line_instance
|
|
|
|
/* definitions to be removed */
|
|
int r_line_dietline_init();
|
|
void r_line_hist_free();
|
|
|
|
R_API RLine *r_line_singleton () {
|
|
return &r_line_instance;
|
|
}
|
|
|
|
R_API RLine *r_line_new () {
|
|
I.prompt = strdup ("> ");
|
|
if (!r_line_dietline_init ())
|
|
eprintf ("error: r_line_dietline_init\n");
|
|
return &I;
|
|
}
|
|
|
|
R_API void r_line_free () {
|
|
// XXX: prompt out of the heap?
|
|
free ((void*)I.prompt);
|
|
I.prompt = NULL;
|
|
r_line_hist_free ();
|
|
}
|
|
|
|
// handle const or dynamic prompts?
|
|
R_API void r_line_set_prompt (const char *prompt) {
|
|
free (I.prompt);
|
|
I.prompt = strdup (prompt);
|
|
}
|
|
|
|
// handle const or dynamic prompts?
|
|
R_API char *r_line_get_prompt () {
|
|
return strdup (I.prompt);
|
|
}
|
|
|
|
#include "dietline.c"
|