本文整理汇总了C++中el_init函数的典型用法代码示例。如果您正苦于以下问题:C++ el_init函数的具体用法?C++ el_init怎么用?C++ el_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了el_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: initedit
void
initedit()
{
editing = 1;
if (!elc && histc) {
elc = el_init(__progname, stdin, stdout, stderr);
el_set(elc, EL_HIST, history, histc); /* use history */
el_set(elc, EL_EDITOR, "emacs"); /* default type */
el_set(elc, EL_PROMPT, cprompt); /* set the prompt
* function */
el_set(elc, EL_ADDFN, "complt", "Command completion", complt_c);
el_set(elc, EL_BIND, "\t", "complt", NULL);
el_source(elc, NULL); /* read ~/.editrc */
el_set(elc, EL_SIGNAL, 1);
}
if (!eli && histi) {
eli = el_init(__progname, stdin, stdout, stderr); /* again */
el_set(eli, EL_HIST, history, histi);
el_set(eli, EL_EDITOR, "emacs");
el_set(eli, EL_PROMPT, iprompt);
el_set(eli, EL_ADDFN, "complt", "Command completion", complt_i);
el_set(eli, EL_BIND, "\t", "complt", NULL);
#ifdef notyet
el_set(eli, EL_ADDFN, "exit", "Exit", NULL);
el_set(eli, EL_BIND, "\026", "exit", NULL);
#endif
el_source(eli, NULL);
el_set(eli, EL_SIGNAL, 1);
}
}
开发者ID:danrl,项目名称:nsh,代码行数:31,代码来源:complete.c
示例2: initialize_libedit
void initialize_libedit(const char *prog)
{
/* Init the builtin history */
hist = history_init();
/* Remember 100 events */
#ifdef XDC_OLD_LIBEDIT
history(hist, XDC_H_SETSIZE, 100);
#else
history(hist, &ev, XDC_H_SETSIZE, 100);
#endif
/* Initialize editline */
#ifdef XDC_OLD_LIBEDIT
el = el_init(prog, stdin, stdout);
#else
el = el_init(prog, stdin, stdout, stderr);
#endif
el_set(el, EL_EDITOR, "emacs"); /* Default editor is emacs */
el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */
el_set(el, EL_PROMPT, get_prompt); /* Set the prompt function */
/* Tell editline to use this history interface */
el_set(el, EL_HIST, history, hist);
/*
* Source the user's defaults file.
*/
/* el_source(el, "xdebug"); */
}
开发者ID:s3rj1k,项目名称:php-5.2_wheezy,代码行数:31,代码来源:main.c
示例3: ntp_readline_init
/*
* ntp_readline_init - setup, set or reset prompt string
*/
int
ntp_readline_init(
const char * prompt
)
{
int success;
success = 1;
if (prompt) {
if (lineedit_prompt)
free(lineedit_prompt);
lineedit_prompt = estrdup(prompt);
}
#ifdef LE_EDITLINE
if (NULL == ntp_el) {
# if 4 == EL_INIT_ARGS
ntp_el = el_init(progname, stdin, stdout, stderr);
# else
ntp_el = el_init(progname, stdin, stdout);
# endif
if (ntp_el) {
el_set(ntp_el, EL_PROMPT, ntp_prompt_callback);
el_set(ntp_el, EL_EDITOR, "emacs");
ntp_hist = history_init();
if (NULL == ntp_hist) {
mfprintf(stderr, "history_init(): %m\n");
fflush(stderr);
el_end(ntp_el);
ntp_el = NULL;
success = 0;
} else {
ZERO(hev);
#ifdef H_SETSIZE
history(ntp_hist, &hev, H_SETSIZE, 128);
#endif
el_set(ntp_el, EL_HIST, history,
ntp_hist);
/* use any .editrc */
el_source(ntp_el, NULL);
}
} else
success = 0;
}
#endif /* LE_EDITLINE */
ntp_readline_initted = success;
return success;
}
开发者ID:cemeyer,项目名称:freebsd-base-graphics,代码行数:62,代码来源:ntp_lineedit.c
示例4: cmdinit
void *
cmdinit(struct clit *cmds, int ncmds)
{
struct clitenv *env;
HistEvent ev;
if ((env = malloc(sizeof(*env))) == NULL)
err(1, "Can't init cmd interpreter.");
env->cmds = cmds;
env->ncmds = ncmds;
env->hist = history_init();
history(env->hist, &ev, H_SETSIZE, 100);
env->el = el_init(__progname, stdin, stdout, stderr);
el_set(env->el, EL_EDITOR, "emacs");
el_set(env->el, EL_PROMPT, prompt);
el_set(env->el, EL_HIST, history, env->hist);
el_set(env->el, EL_ADDFN, "complt", "complete", complt);
el_set(env->el, EL_BIND, "\t", "complt");
el_source(env->el, NULL);
/* XXX - EL_SIGNAL ? */
return env;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:28,代码来源:clit.c
示例5: history_init
static char *fetchline(void)
{
static EditLine *el;
static History *hist;
HistEvent hevent;
char *line;
int count;
if (!el) {
hist = history_init();
history(hist, &hevent, H_SETSIZE, 100);
el = el_init(progname, stdin, stdout, stderr);
el_source(el, NULL);
el_set(el, EL_SIGNAL, 1);
el_set(el, EL_PROMPT, el_get_prompt);
el_set(el, EL_HIST, history, (const char *)hist);
}
line = strdup(el_gets(el, &count));
if (line) {
if (count > 0) {
line[count-1] = '\0';
}
if (*line) {
history(hist, &hevent, H_ENTER, line);
}
}
return line;
}
开发者ID:jgottula,项目名称:qemu-vfio,代码行数:28,代码来源:qemu-io.c
示例6: acc_el_initialize
static int acc_el_initialize(void)
{
HistEvent ev;
if (el != NULL)
el_end(el);
if (el_hist != NULL)
history_end(el_hist);
el = el_init("accedian", stdin, stdout, stderr);
el_set(el, EL_PROMPT, cli_prompt);
el_set(el, EL_EDITMODE, 1);
el_set(el, EL_EDITOR, "emacs");
el_hist = history_init();
if (!el || !el_hist)
return -1;
/* setup history with 100 entries */
history(el_hist, &ev, H_SETSIZE, 100);
el_set(el, EL_HIST, history, el_hist);
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", cli_complete);
/* Bind <tab> to command completion */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
#if 0 // Ticket #8152 - This corrupts show_rc passwords containing question marks
/* Bind ? to command completion */
el_set(el, EL_BIND, "?", "ed-complete", NULL);
#endif
/* Bind ^D to redisplay */
el_set(el, EL_BIND, "^D", "ed-redisplay", NULL);
return 0;
}
开发者ID:thechinh,项目名称:play-with-code,代码行数:35,代码来源:cli.c
示例7: ntp_readline_init
/*
* ntp_readline_init - setup, set or reset prompt string
*/
int
ntp_readline_init(
const char * prompt
)
{
int success;
success = 1;
if (prompt) {
if (lineedit_prompt)
free(lineedit_prompt);
lineedit_prompt = estrdup(prompt);
}
#ifdef LE_EDITLINE
if (NULL == ntp_el) {
ntp_el = el_init(progname, stdin, stdout, stderr);
if (ntp_el) {
el_set(ntp_el, EL_PROMPT, ntp_prompt_callback);
el_set(ntp_el, EL_EDITOR, "emacs");
ntp_hist = history_init();
if (NULL == ntp_hist) {
fprintf(stderr, "history_init(): %s\n",
strerror(errno));
fflush(stderr);
el_end(ntp_el);
ntp_el = NULL;
success = 0;
} else {
memset(&hev, 0, sizeof hev);
history(ntp_hist, &hev, H_SETSIZE, 128);
el_set(ntp_el, EL_HIST, history, ntp_hist);
/* use any .editrc */
el_source(ntp_el, NULL);
}
} else
success = 0;
}
#endif /* LE_EDITLINE */
ntp_readline_initted = success;
return success;
}
开发者ID:ystk,项目名称:debian-ntp,代码行数:59,代码来源:ntp_lineedit.c
示例8: el_reset
/* This routine resets the interface. */
void el_reset(int unit)
{
int s;
dprintf(("elreset()\n"));
s = splimp();
el_stop(unit);
el_init(unit);
splx(s);
}
开发者ID:metacore,项目名称:spin,代码行数:11,代码来源:if_el.c
示例9: _history
EditLineReader::EditLineReader()
: _history(history_init())
, _editLine(el_init("ccons", stdin, stdout, stderr))
{
reader = this;
history(_history, &_event, H_SETSIZE, INT_MAX);
el_set(_editLine, EL_PROMPT, ccons_prompt);
el_set(_editLine, EL_EDITOR, "emacs");
el_set(_editLine, EL_HIST, history, _history);
el_set(_editLine, EL_ADDFN, "ccons-ac", "autocomplete", ccons_autocomplete);
el_set(_editLine, EL_BIND, "^I", "ccons-ac", NULL);
}
开发者ID:asvitkine,项目名称:ccons,代码行数:12,代码来源:EditLineReader.cpp
示例10: readline
char *
readline(const char* prompt)
{
static EditLine *e;
#ifdef H_SETSIZE
HistEvent ev;
#endif
int count;
const char *str;
if(e == NULL){
#ifdef EL_INIT_FOUR
e = el_init("", stdin, stdout, stderr);
#else
e = el_init("", stdin, stdout);
#endif
el_set(e, EL_PROMPT, ret_prompt);
h = history_init();
#ifdef H_SETSIZE
history(h, &ev, H_SETSIZE, 25);
#else
history(h, H_EVENT, 25);
#endif
el_set(e, EL_HIST, history, h);
el_set(e, EL_EDITOR, "emacs"); /* XXX? */
}
pr = prompt ? prompt : "";
str = el_gets(e, &count);
if (str && count > 0) {
char *ret = strdup (str);
if (ret == NULL)
return NULL;
if (ret[strlen(ret) - 1] == '\n')
ret[strlen(ret) - 1] = '\0';
return ret;
}
return NULL;
}
开发者ID:SimonWilkinson,项目名称:heimdal,代码行数:40,代码来源:edit_compat.c
示例11: mtranApi_ussrSetup
void mtranApi_ussrSetup(int portRC, int portEvent, char* host, void (*msgHandler)(char*, char, char)) {
/*Initialize Message Handler*/
mtranApi_msgHandler = msgHandler;
/*Initialize command sender*/
cs_init(portRC, host);
cs_sendCommand_void("setup"); //initializes simulator
/*Initialize event listener*/
el_init(portEvent, host);
el_installEvent("handleMessage", mtranApi_handleMessage);
el_startEventListen();
}
开发者ID:DavidJohan,项目名称:Assemble-and-Animate,代码行数:13,代码来源:MTRANSocketApi.c
示例12: el
EditLine::EditLine(std::string argv0, FILE* input, FILE* output,
FILE* error) :
el(el_init(argv0.c_str(), input, output, error)),
mPromptCallback(0) {
el_set(el, EL_EDITOR, "emacs");
el_set(el, EL_SIGNAL, 1);
el_set(el, EL_CLIENTDATA, this);
el_set(el, EL_SETTY, "-d", "intr=^@", NULL);
el_set(el, EL_SETTY, "-d", "eof=^@", NULL);
el_set(el, EL_ADDFN, "cust-control-c", "", controlC);
el_set(el, EL_BIND, "^C", "cust-control-c", NULL);
el_set(el, EL_BIND, "^D", "ed-end-of-file", NULL);
}
开发者ID:Symaxion,项目名称:seychelles,代码行数:13,代码来源:libedit.cpp
示例13: history_init
static EditLine *initEditLine()
{
EditLine *e;
HistEvent ev;
cmdHistory = history_init();
history(cmdHistory, &ev, H_SETSIZE, 100);
e = el_init("ejs", stdin, stdout, stderr);
el_set(e, EL_EDITOR, "vi");
el_set(e, EL_HIST, history, cmdHistory);
el_source(e, NULL);
return e;
}
开发者ID:satanupup,项目名称:appweb,代码行数:13,代码来源:ejs.c
示例14: el_init
CommandPrompt::CommandPrompt()
{
#ifdef ZORBA_HAVE_LIBEDIT_H
theEditLine = el_init("xqdb", stdin, stdout, stderr);
theHistory = history_init();
HistEvent lHistoryEvent;
history(theHistory, &lHistoryEvent, H_SETSIZE, 100);
el_set(theEditLine, EL_PROMPT, prompt);
el_set(theEditLine, EL_HIST, history, theHistory);
el_set(theEditLine, EL_EDITOR, "emacs");
#endif
}
开发者ID:alyst,项目名称:zorba,代码行数:14,代码来源:command_prompt.cpp
示例15: main
int
main(int argc, char *argv[])
{
HistEvent he;
static EditLine *el;
static History *hist;
bool interactive;
acting_as_client = 1;
peer = -1;
strcpy(mode, "netascii");
signal(SIGINT, intr);
interactive = isatty(STDIN_FILENO);
if (interactive) {
el = el_init("tftp", stdin, stdout, stderr);
hist = history_init();
history(hist, &he, H_SETSIZE, 100);
el_set(el, EL_HIST, history, hist);
el_set(el, EL_EDITOR, "emacs");
el_set(el, EL_PROMPT, command_prompt);
el_set(el, EL_SIGNAL, 1);
el_source(el, NULL);
}
if (argc > 1) {
if (setjmp(toplevel) != 0)
exit(txrx_error);
if (strncmp(argv[1], "tftp://", 7) == 0) {
urihandling(argv[1]);
exit(txrx_error);
}
setpeer(argc, argv);
}
if (setjmp(toplevel) != 0) {
if (interactive)
el_reset(el);
(void)putchar('\n');
}
init_options();
command(interactive, el, hist, &he);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:46,代码来源:main.c
示例16: _cliDebuggerInit
static void _cliDebuggerInit(struct Debugger* debugger) {
struct CLIDebugger* cliDebugger = (struct CLIDebugger*) debugger;
// TODO: get argv[0]
cliDebugger->elstate = el_init(binaryName, stdin, stdout, stderr);
el_set(cliDebugger->elstate, EL_PROMPT, _prompt);
el_set(cliDebugger->elstate, EL_EDITOR, "emacs");
el_set(cliDebugger->elstate, EL_CLIENTDATA, cliDebugger);
el_set(cliDebugger->elstate, EL_ADDFN, "tab-complete", "Tab completion", _tabComplete);
el_set(cliDebugger->elstate, EL_BIND, "\t", "tab-complete", 0);
cliDebugger->histate = history_init();
HistEvent ev;
history(cliDebugger->histate, &ev, H_SETSIZE, 200);
el_set(cliDebugger->elstate, EL_HIST, history, cliDebugger->histate);
_activeDebugger = cliDebugger;
signal(SIGINT, _breakIntoDefault);
}
开发者ID:gitter-badger,项目名称:ML-emulator,代码行数:17,代码来源:cli-debugger.c
示例17: setlocale
void repl::init_editline(FILE * infile, FILE * outfile) noexcept {
setlocale(LC_CTYPE, "");
hist = history_init();
history(hist, &ev, H_SETSIZE, 100);
el = el_init("./MoNS", infile, outfile, outfile);
el_set(el, EL_EDITOR, "vi");
// el_set(el, EL_PROMPT_ESC,
// +[](EditLine *el) -> const char * {
// const char *prompt = "λ ";
// return prompt;
// },
// '\1');
el_set(el, EL_PROMPT_ESC, &prompt, '\1');
el_set(el, EL_HIST, history, hist);
el_source(el, NULL);
}
开发者ID:rroohhh,项目名称:MoNS,代码行数:18,代码来源:repl.cpp
示例18: create_sem
status_t
CliContext::Init(Team* team, UserInterfaceListener* listener)
{
fTeam = team;
fListener = listener;
fTeam->AddListener(this);
status_t error = fLock.InitCheck();
if (error != B_OK)
return error;
fBlockingSemaphore = create_sem(0, "CliContext block");
if (fBlockingSemaphore < 0)
return fBlockingSemaphore;
fEditLine = el_init("Debugger", stdin, stdout, stderr);
if (fEditLine == NULL)
return B_ERROR;
fHistory = history_init();
if (fHistory == NULL)
return B_ERROR;
HistEvent historyEvent;
history(fHistory, &historyEvent, H_SETSIZE, 100);
el_set(fEditLine, EL_HIST, &history, fHistory);
el_set(fEditLine, EL_EDITOR, "emacs");
el_set(fEditLine, EL_PROMPT, &_GetPrompt);
fNodeManager = new(std::nothrow) ValueNodeManager();
if (fNodeManager == NULL)
return B_NO_MEMORY;
fNodeManager->AddListener(this);
fExpressionInfo = new(std::nothrow) ExpressionInfo();
if (fExpressionInfo == NULL)
return B_NO_MEMORY;
fExpressionInfo->AddListener(this);
return B_OK;
}
开发者ID:looncraz,项目名称:haiku,代码行数:43,代码来源:CliContext.cpp
示例19: main
int
main(int argc, char **argv)
{
EditLine *el;
History *hist;
const char *buf;
int num, state;
check_args(argc, argv);
if(connect_uri)
{
sql_conn = sql_connect(connect_uri);
if(!sql_conn)
{
fprintf(stderr, "%s: [%s] %s\n", short_program_name, sql_sqlstate(NULL), sql_error(NULL));
exit(EXIT_FAILURE);
}
}
fprintf(stderr, "%s interactive SQL shell (%s)\n\n", PACKAGE, VERSION);
fprintf(stderr,
"Type: \\c URI to establish a new connection\n"
" \\g or ; to execute query\n"
" \\G to execute the query showing results in long format\n"
" \\q to end the SQL session\n"
"\n"
);
hist = history_init();
el = el_init(argv[0], stdin, stdout, stderr);
el_set(el, EL_EDITOR, "emacs");
el_set(el, EL_SIGNAL, 1);
el_set(el, EL_PROMPT, prompt);
el_set(el, EL_HIST, history, hist);
el_source(el, NULL);
while((buf = el_gets(el, &num)) != NULL && num != 0)
{
state = parse_query(buf);
if(state == 0)
{
exec_queries(hist);
}
}
return 0;
}
开发者ID:nevali,项目名称:libsql,代码行数:43,代码来源:isql.c
示例20: IoObject_new
IoEditLine *IoEditLine_proto(void *state)
{
IoMethodTable methodTable[] = {
{"hasEditLib", IoEditLine_hasEditLib},
{"readLine", IoEditLine_readLine},
{"addHistory", IoEditLine_addHistory},
{NULL, NULL},
};
IoObject *self = IoObject_new(state);
IoObject_tag_(self, IoEditLine_newTag(state));
/* Make sure editline returns characters in the multi-byte charset
of the locale */
setlocale(LC_CTYPE, "");
IoObject_setDataPointer_(self, io_calloc(1, sizeof(IoEditLineData)));
DATA(self)->prompt = IOSYMBOL("");
DATA(self)->editline = el_init("io", stdin, stdout, stderr);
DATA(self)->history = history_init();
el_set(DATA(self)->editline, EL_CLIENTDATA, self);
el_set(DATA(self)->editline, EL_HIST, history, DATA(self)->history);
el_set(DATA(self)->editline, EL_PROMPT, promptCallback);
el_set(DATA(self)->editline, EL_SIGNAL, 1);
el_set(DATA(self)->editline, EL_EDITOR, "emacs");
{
HistEvent ev;
history(DATA(self)->history, &ev, H_SETSIZE, 300);
}
el_source(DATA(self)->editline, NULL);
IoState_registerProtoWithFunc_((IoState *)state, self, IoEditLine_proto);
IoObject_addMethodTable_(self, methodTable);
return self;
}
开发者ID:cdcarter,项目名称:io,代码行数:40,代码来源:IoEditLine.c
注:本文中的el_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论