003 File Manager
Current Path:
/usr/src/contrib/ntp/libntp
usr
/
src
/
contrib
/
ntp
/
libntp
/
📁
..
📄
Makefile.am
(3.27 KB)
📄
Makefile.in
(105.83 KB)
📄
README
(272 B)
📄
a_md5encrypt.c
(6.76 KB)
📄
adjtime.c
(10.29 KB)
📄
adjtimex.c
(334 B)
📄
atoint.c
(801 B)
📄
atolfp.c
(1.88 KB)
📄
atouint.c
(885 B)
📄
audio.c
(13.09 KB)
📄
authkeys.c
(19.92 KB)
📄
authreadkeys.c
(9.06 KB)
📄
authusekey.c
(748 B)
📄
bsd_strerror.c
(1.35 KB)
📄
buftvtots.c
(643 B)
📄
caljulian.c
(891 B)
📄
caltontp.c
(2.25 KB)
📄
calyearstart.c
(2.1 KB)
📄
clocktime.c
(4.49 KB)
📄
clocktypes.c
(3.69 KB)
📄
decodenetnum.c
(3.93 KB)
📄
dofptoa.c
(2.19 KB)
📄
dolfptoa.c
(3.14 KB)
📄
emalloc.c
(3.4 KB)
📄
findconfig.c
(1.46 KB)
📄
getopt.c
(2.21 KB)
📄
hextoint.c
(673 B)
📄
hextolfp.c
(1.35 KB)
📄
humandate.c
(1.1 KB)
📄
icom.c
(4.22 KB)
📄
iosignal.c
(12.27 KB)
📄
is_ip_address.c
(2.02 KB)
📄
lib_strbuf.c
(633 B)
📄
libssl_compat.c
(6.13 KB)
📄
machines.c
(13.05 KB)
📄
mktime.c
(8.29 KB)
📄
modetoa.c
(507 B)
📄
mstolfp.c
(2.01 KB)
📄
msyslog.c
(12.67 KB)
📄
netof.c
(1.17 KB)
📄
ntp_calendar.c
(58.49 KB)
📄
ntp_calgps.c
(15.73 KB)
📄
ntp_crypto_rnd.c
(2.11 KB)
📄
ntp_intres.c
(28.64 KB)
📄
ntp_libopts.c
(1.27 KB)
📄
ntp_lineedit.c
(3.88 KB)
📄
ntp_random.c
(17.63 KB)
📄
ntp_rfc2553.c
(14.85 KB)
📄
ntp_worker.c
(7.21 KB)
📄
numtoa.c
(963 B)
📄
numtohost.c
(908 B)
📄
octtoint.c
(578 B)
📄
prettydate.c
(5.53 KB)
📄
recvbuff.c
(7.3 KB)
📄
refidsmear.c
(1.05 KB)
📄
refnumtoa.c
(673 B)
📄
snprintf.c
(52.56 KB)
📄
socket.c
(4.88 KB)
📄
socktoa.c
(2.88 KB)
📄
socktohost.c
(2.54 KB)
📄
ssl_init.c
(5.09 KB)
📄
statestr.c
(11.4 KB)
📄
strdup.c
(854 B)
📄
strl_obsd.c
(3.65 KB)
📄
syssignal.c
(2.69 KB)
📄
systime.c
(17.51 KB)
📄
systime_s.c
(33 B)
📄
timespecops.c
(4.27 KB)
📄
timetoa.c
(2.75 KB)
📄
timevalops.c
(12.97 KB)
📄
timexsup.c
(1.17 KB)
📄
uglydate.c
(958 B)
📄
vint64ops.c
(5.1 KB)
📄
work_fork.c
(12.73 KB)
📄
work_thread.c
(22.88 KB)
📄
xsbprintf.c
(2.06 KB)
📄
ymd2yd.c
(582 B)
Editing: ntp_lineedit.c
/* * ntp_lineedit.c - generic interface to various line editing libs */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <errno.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #if defined(HAVE_READLINE_HISTORY) && \ (!defined(HAVE_READLINE_HISTORY_H) || \ !defined(HAVE_READLINE_READLINE_H)) # undef HAVE_READLINE_HISTORY #endif #if defined(HAVE_READLINE_HISTORY) # include <readline/readline.h> # include <readline/history.h> # define LE_READLINE #elif defined(HAVE_HISTEDIT_H) # include <histedit.h> # define LE_EDITLINE #else # define LE_NONE #endif #include "ntp.h" #include "ntp_stdlib.h" #include "ntp_lineedit.h" #include "safecast.h" #define MAXEDITLINE 512 /* * external references */ extern char const * progname; /* * globals, private prototypes */ static int ntp_readline_initted; static char * lineedit_prompt; #ifdef LE_EDITLINE # ifndef H_SETSIZE # define H_SETSIZE H_EVENT # endif static EditLine * ntp_el; static History * ntp_hist; static HistEvent hev; char * ntp_prompt_callback(EditLine *); #endif /* LE_EDITLINE */ /* * 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; } /* * ntp_readline_uninit - release resources */ void ntp_readline_uninit( void ) { #ifdef LE_EDITLINE if (ntp_el) { el_end(ntp_el); ntp_el = NULL; history_end(ntp_hist); ntp_hist = NULL; } #endif /* LE_EDITLINE */ if (lineedit_prompt) { free(lineedit_prompt); lineedit_prompt = NULL; } ntp_readline_initted = 0; } /* * ntp_readline - read a line with the line editor available * * The string returned must be released with free() */ char * ntp_readline( int * pcount ) { char * line; #ifdef LE_NONE char line_buf[MAXEDITLINE]; #endif #ifdef LE_EDITLINE const char * cline; #endif if (!ntp_readline_initted) return NULL; *pcount = 0; #ifdef LE_READLINE line = readline(lineedit_prompt ? lineedit_prompt : ""); if (NULL != line) { if (*line) { add_history(line); } *pcount = strlen(line); } #endif /* LE_READLINE */ #ifdef LE_EDITLINE cline = el_gets(ntp_el, pcount); if (NULL != cline) { history(ntp_hist, &hev, H_ENTER, cline); line = estrdup(cline); } else if (*pcount == -1) { line = NULL; } else { line = estrdup(""); } #endif /* LE_EDITLINE */ #ifdef LE_NONE /* stone hammers */ if (lineedit_prompt) { # ifdef VMS /* * work around problem mixing * stdout & stderr */ fputs("", stdout); # endif /* VMS */ fputs(lineedit_prompt, stderr); fflush(stderr); } line = fgets(line_buf, sizeof(line_buf), stdin); if (NULL != line && *line) { *pcount = (int)strlen(line); /* cannot overflow here */ line = estrdup(line); } else line = NULL; #endif /* LE_NONE */ if (!line) /* EOF */ fputs("\n", stderr); return line; } #ifdef LE_EDITLINE /* * ntp_prompt_callback - return prompt string to el_gets() */ char * ntp_prompt_callback( EditLine *el ) { UNUSED_ARG(el); return lineedit_prompt; } #endif /* LE_EDITLINE */
Upload File
Create Folder