#include <inttypes.h>
#include <fcntl.h>
+#ifndef CMDLINE_NO_SOCKET
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/un.h>
+#endif
#include "cmdline_parse.h"
#include "cmdline_rdline.h"
/**********************/
+#ifndef CMDLINE_NO_SOCKET
int
cmdline_tcpv4_listen(in_addr_t addr, uint16_t port)
{
}
struct cmdline *
-cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt)
+cmdline_accept(cmdline_parse_ctx_t *ctx, const char *prompt, int s)
{
- return (cmdline_new(ctx, prompt, 0, 1));
+ int s2;
+ struct sockaddr sin;
+ socklen_t sinlen;
+
+ sinlen = sizeof(struct sockaddr);
+
+ if ((s2 = accept(s, &sin, &sinlen)) < 0) {
+ dprintf("accept() failed\n");
+ return NULL;
+ }
+
+ return (cmdline_new(ctx, prompt, s2, s2));
}
+#endif
struct cmdline *
cmdline_file_new(cmdline_parse_ctx_t *ctx, const char *prompt, const char *path)
}
struct cmdline *
-cmdline_accept(cmdline_parse_ctx_t *ctx, const char *prompt, int s)
+cmdline_stdin_new(cmdline_parse_ctx_t *ctx, const char *prompt)
{
- int s2;
- struct sockaddr sin;
- socklen_t sinlen;
-
- sinlen = sizeof(struct sockaddr);
-
- if ((s2 = accept(s, &sin, &sinlen)) < 0) {
- dprintf("accept() failed\n");
- return NULL;
- }
-
- return (cmdline_new(ctx, prompt, s2, s2));
+ return (cmdline_new(ctx, prompt, 0, 1));
}
-