project(ttyd VERSION "1.4.0")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
if(CMAKE_VERSION VERSION_LESS "3.1")
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
+#include <string.h>
+#include <libwebsockets.h>
+
#include "server.h"
#include "html.h"
goto try_to_reuse;
}
- if (strncmp((const char *) in, "/", 1)) {
+ if (strncmp((const char *) in, "/", 1) != 0) {
lws_return_http_status(wsi, HTTP_STATUS_NOT_FOUND, NULL);
goto try_to_reuse;
}
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+#include <sys/select.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <pthread.h>
+
+#if defined(__OpenBSD__) || defined(__APPLE__)
+#include <util.h>
+#elif defined(__FreeBSD__)
+#include <libutil.h>
+#else
+#include <pty.h>
+#endif
+
+#include <libwebsockets.h>
+#include <json.h>
+
#include "server.h"
+#include "utils.h"
int
send_initial_message(struct lws *wsi) {
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+#include <pthread.h>
+#include <signal.h>
+#include <sys/stat.h>
+
+#ifdef HAVE_LWS_CONFIG_H
+#include "lws_config.h"
+#endif
+#include <libwebsockets.h>
+#include <json.h>
+
#include "server.h"
+#include "utils.h"
+
+#ifndef TTYD_VERSION
+#define TTYD_VERSION "unknown"
+#endif
volatile bool force_exit = false;
struct lws_context *context;
-#ifdef HAVE_LWS_CONFIG_H
-#include "lws_config.h"
-#endif
-
-#ifndef TTYD_VERSION
-#define TTYD_VERSION "unknown"
-#endif
-
-#define _GNU_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
#include <stdbool.h>
-#include <signal.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <pthread.h>
#include <sys/ioctl.h>
#include <sys/queue.h>
-#include <sys/stat.h>
-#include <sys/select.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <assert.h>
-
-#ifdef __OpenBSD__
-#define STAILQ_HEAD SIMPLEQ_HEAD
-#define STAILQ_ENTRY SIMPLEQ_ENTRY
-#define STAILQ_INIT SIMPLEQ_INIT
-#define STAILQ_INSERT_TAIL SIMPLEQ_INSERT_TAIL
-#define STAILQ_EMPTY SIMPLEQ_EMPTY
-#define STAILQ_FIRST SIMPLEQ_FIRST
-#define STAILQ_REMOVE_HEAD SIMPLEQ_REMOVE_HEAD
-#define STAILQ_FOREACH SIMPLEQ_FOREACH
-#endif
-
-#if defined(__OpenBSD__) || defined(__APPLE__)
-#include <util.h>
-#elif defined(__FreeBSD__)
-#include <libutil.h>
-#else
-#include <pty.h>
-#endif
-
-#include <libwebsockets.h>
-#include <json.h>
-
-#include "utils.h"
// client message
#define INPUT '0'
-#define _GNU_SOURCE
-
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>