#include <stdio.h>
#include <assert.h>
+#include <stdlib.h>
#include <sys/time.h>
#include <event.h>
#include <cli_priv.h>
#include "heritage.h"
+#include "cli_event.h"
static struct event ev_keepalive;
/*--------------------------------------------------------------------*/
static struct cli_proto cli_proto[] = {
- { CLI_PING },
+ { CLI_PING, cli_func_ping },
{ NULL }
};
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
+#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
static void
encode_output(struct cli *cli)
{
- const char *p, *q;
+ char *p, *q;
if (cli->verbose) {
if (cli->result != CLIS_OK)
}
evbuffer_add_printf(cli->bev1->output, "%d \"", cli->result);
for (p = q = sbuf_data(cli->sb); *p != '\0'; p++) {
- if (*p != '"' && *p != '\\' && isgraph(*p) || *p == ' ')
+ if ((*p != '"' && *p != '\\' && isgraph(*p)) || *p == ' ')
continue;
if (p != q)
evbuffer_add(cli->bev1->output, q, p - q);
rdcb(struct bufferevent *bev, void *arg)
{
const char *p;
- char **av;
struct cli *cli = arg;
- unsigned u;
- struct cli_proto *cp;
p = evbuffer_readline(bev->input);
if (p == NULL)
* $Id$
*/
-#include <errno.h>
#include <assert.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <unistd.h>
-#include <signal.h>
-#include <fcntl.h>
#include <sys/wait.h>
static enum {
H_STOP = 0,
- H_START,
+ H_START
} desired;
static pid_t child_pid;
static int child_fds[2];
std_wrcb(struct bufferevent *bev, void *arg)
{
- printf("%s(%p, %p)\n", __func__, bev, arg);
+ printf("%s(%p, %p)\n", __func__, (void*)bev, arg);
exit (2);
}
std_excb(struct bufferevent *bev, short what, void *arg)
{
- printf("%s(%p, %d, %p)\n", __func__, bev, what, arg);
+ printf("%s(%p, %d, %p)\n", __func__, (void*)bev, what, arg);
exit (2);
}
BackSlash(const char *s, int *res)
{
int i, r;
+ unsigned u;
assert(*s == '\\');
r = i = 0;
}
break;
case 'x':
- if (1 == sscanf(s + 1, "x%02x", &i))
+ if (1 == sscanf(s + 1, "x%02x", &u)) {
+ i = u;
r = 4;
+ }
break;
default:
break;
*/
#include <ctype.h>
+#include <string.h>
#include <stdio.h>
#include <cli.h>
void
cli_func_help(struct cli *cli, char **av, void *priv)
{
- unsigned u;
struct cli_proto *cp;
if (av[2] == NULL) {