Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/ntp/libntp/ntp_lineedit.c
Show All 23 Lines | |||||
# define LE_EDITLINE | # define LE_EDITLINE | ||||
#else | #else | ||||
# define LE_NONE | # define LE_NONE | ||||
#endif | #endif | ||||
#include "ntp.h" | #include "ntp.h" | ||||
#include "ntp_stdlib.h" | #include "ntp_stdlib.h" | ||||
#include "ntp_lineedit.h" | #include "ntp_lineedit.h" | ||||
#include "safecast.h" | |||||
#define MAXEDITLINE 512 | #define MAXEDITLINE 512 | ||||
/* | /* | ||||
* external references | * external references | ||||
*/ | */ | ||||
extern char const * progname; | extern char const * progname; | ||||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | |||||
# endif /* VMS */ | # endif /* VMS */ | ||||
fputs(lineedit_prompt, stderr); | fputs(lineedit_prompt, stderr); | ||||
fflush(stderr); | fflush(stderr); | ||||
} | } | ||||
line = fgets(line_buf, sizeof(line_buf), stdin); | line = fgets(line_buf, sizeof(line_buf), stdin); | ||||
if (NULL != line && *line) { | if (NULL != line && *line) { | ||||
*pcount = strlen(line); | *pcount = (int)strlen(line); /* cannot overflow here */ | ||||
line = estrdup(line); | line = estrdup(line); | ||||
} else | } else | ||||
line = NULL; | line = NULL; | ||||
#endif /* LE_NONE */ | #endif /* LE_NONE */ | ||||
if (!line) /* EOF */ | if (!line) /* EOF */ | ||||
Show All 21 Lines |