#ifndef NO_COMPLETION
void completion(const char *buf, linenoiseCompletions *lc, void *userdata) {
+ (void)userdata;
if (buf[0] == 'h') {
linenoiseAddCompletion(lc,"hello");
linenoiseAddCompletion(lc,"hello there");
}
char *hints(const char *buf, int *color, int *bold, void *userdata) {
+ (void)userdata;
if (!strcasecmp(buf,"hello")) {
*color = 35;
*bold = 0;
}
}
+typedef enum {
+ EP_START, /* looking for ESC */
+ EP_ESC, /* looking for [ */
+ EP_DIGITS, /* parsing digits */
+ EP_PROPS, /* parsing digits or semicolons */
+ EP_END, /* ok */
+ EP_ERROR, /* error */
+} ep_state_t;
+
struct esc_parser {
- enum {
- EP_START, /* looking for ESC */
- EP_ESC, /* looking for [ */
- EP_DIGITS, /* parsing digits */
- EP_PROPS, /* parsing digits or semicolons */
- EP_END, /* ok */
- EP_ERROR, /* error */
- } state;
+ ep_state_t state;
int props[5]; /* properties are stored here */
int maxprops; /* size of the props[] array */
int numprops; /* number of properties found */
}
}
#else
-#define DRL(ARGS...)
+#define DRL(...)
#define DRL_CHAR(ch)
#define DRL_STR(str)
#endif
static void refreshStartChars(struct current *current)
{
+ (void)current;
}
static void refreshNewline(struct current *current)
static void refreshEndChars(struct current *current)
{
+ (void)current;
}
#endif
c = fd_read(current);
if (c == ctrl('H') || c == CHAR_DELETE) {
if (rchars) {
- int p = utf8_index(rbuf, --rchars);
- rbuf[p] = 0;
+ int p_ind = utf8_index(rbuf, --rchars);
+ rbuf[p_ind] = 0;
rlen = strlen(rbuf);
}
continue;