mirror of
https://github.com/lammertb/libhttp.git
synced 2026-01-03 16:02:30 +03:00
Consistent policy of empty lines
This commit is contained in:
@@ -102,7 +102,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Including a dertificate from a certificate authority
|
||||
----
|
||||
|
||||
|
||||
CivetWeb requires one certificate file in PEM format.
|
||||
If you got multiple files from your certificate authority,
|
||||
you need to copy their content together into one file.
|
||||
|
||||
49
src/main.c
49
src/main.c
@@ -157,12 +157,14 @@ static struct mg_option main_config_options[] = {
|
||||
{"icon", CONFIG_TYPE_STRING, NULL},
|
||||
{NULL, CONFIG_TYPE_UNKNOWN, NULL}};
|
||||
|
||||
|
||||
static void WINCDECL
|
||||
signal_handler(int sig_num)
|
||||
{
|
||||
g_exit_flag = sig_num;
|
||||
}
|
||||
|
||||
|
||||
static NO_RETURN void
|
||||
die(const char *fmt, ...)
|
||||
{
|
||||
@@ -183,10 +185,12 @@ die(const char *fmt, ...)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
static int MakeConsole(void);
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
show_server_name(void)
|
||||
{
|
||||
@@ -197,6 +201,7 @@ show_server_name(void)
|
||||
fprintf(stderr, "CivetWeb v%s, built on %s\n", mg_version(), __DATE__);
|
||||
}
|
||||
|
||||
|
||||
static NO_RETURN void
|
||||
show_usage_and_exit(const char *exeName)
|
||||
{
|
||||
@@ -246,6 +251,7 @@ show_usage_and_exit(const char *exeName)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(USE_COCOA)
|
||||
static const char *config_file_top_comment =
|
||||
"# Civetweb web server configuration file.\n"
|
||||
@@ -286,6 +292,7 @@ get_url_to_first_open_port(const struct mg_context *ctx)
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_CREATE_CONFIG_FILE
|
||||
static void
|
||||
create_config_file(const struct mg_context *ctx, const char *path)
|
||||
@@ -314,6 +321,7 @@ create_config_file(const struct mg_context *ctx, const char *path)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
static char *
|
||||
sdup(const char *str)
|
||||
{
|
||||
@@ -327,6 +335,7 @@ sdup(const char *str)
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
get_option(char **options, const char *option_name)
|
||||
{
|
||||
@@ -350,6 +359,7 @@ get_option(char **options, const char *option_name)
|
||||
return opt_value;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
set_option(char **options, const char *name, const char *value)
|
||||
{
|
||||
@@ -428,6 +438,7 @@ set_option(char **options, const char *name, const char *value)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
read_config_file(const char *config_file, char **options)
|
||||
{
|
||||
@@ -498,6 +509,7 @@ read_config_file(const char *config_file, char **options)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
process_command_line_arguments(char *argv[], char **options)
|
||||
{
|
||||
@@ -564,6 +576,7 @@ process_command_line_arguments(char *argv[], char **options)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init_server_name(int argc, const char *argv[])
|
||||
{
|
||||
@@ -594,6 +607,7 @@ init_server_name(int argc, const char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
log_message(const struct mg_connection *conn, const char *message)
|
||||
{
|
||||
@@ -609,6 +623,7 @@ log_message(const struct mg_connection *conn, const char *message)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
is_path_absolute(const char *path)
|
||||
{
|
||||
@@ -623,6 +638,7 @@ is_path_absolute(const char *path)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
verify_existence(char **options, const char *option_name, int must_be_dir)
|
||||
{
|
||||
@@ -659,6 +675,7 @@ verify_existence(char **options, const char *option_name, int must_be_dir)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_absolute_path(char *options[],
|
||||
const char *option_name,
|
||||
@@ -697,6 +714,7 @@ set_absolute_path(char *options[],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_LUA
|
||||
|
||||
#include "civetweb_lua.h"
|
||||
@@ -755,6 +773,7 @@ run_lua(const char *file_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_DUKTAPE
|
||||
|
||||
#include "duktape.h"
|
||||
@@ -787,11 +806,13 @@ finished:
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
/* For __MINGW32/64_MAJOR/MINOR_VERSION define */
|
||||
#include <_mingw.h>
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
start_civetweb(int argc, char *argv[])
|
||||
{
|
||||
@@ -1042,6 +1063,7 @@ start_civetweb(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
stop_civetweb(void)
|
||||
{
|
||||
@@ -1050,6 +1072,7 @@ stop_civetweb(void)
|
||||
g_user_data.first_message = NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
enum {
|
||||
ID_ICON = 100,
|
||||
@@ -1081,12 +1104,14 @@ enum {
|
||||
text box ID. */
|
||||
ID_FILE_BUTTONS_DELTA = 1000
|
||||
};
|
||||
|
||||
static HICON hIcon;
|
||||
static SERVICE_STATUS ss;
|
||||
static SERVICE_STATUS_HANDLE hStatus;
|
||||
static const char *service_magic_argument = "--";
|
||||
static NOTIFYICONDATA TrayIcon;
|
||||
|
||||
|
||||
static void WINAPI
|
||||
ControlHandler(DWORD code)
|
||||
{
|
||||
@@ -1097,6 +1122,7 @@ ControlHandler(DWORD code)
|
||||
SetServiceStatus(hStatus, &ss);
|
||||
}
|
||||
|
||||
|
||||
static void WINAPI
|
||||
ServiceMain(void)
|
||||
{
|
||||
@@ -1117,6 +1143,7 @@ ServiceMain(void)
|
||||
SetServiceStatus(hStatus, &ss);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
show_error(void)
|
||||
{
|
||||
@@ -1131,6 +1158,7 @@ show_error(void)
|
||||
MessageBox(NULL, buf, "Error", MB_OK);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
align(void *ptr, DWORD alig)
|
||||
{
|
||||
@@ -1140,6 +1168,7 @@ align(void *ptr, DWORD alig)
|
||||
return ((void *)ul);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
save_config(HWND hDlg, FILE *fp)
|
||||
{
|
||||
@@ -1170,6 +1199,7 @@ save_config(HWND hDlg, FILE *fp)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static INT_PTR CALLBACK
|
||||
SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
@@ -1323,11 +1353,13 @@ SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
struct tstring_input_buf {
|
||||
unsigned buflen;
|
||||
char *buffer;
|
||||
};
|
||||
|
||||
|
||||
static INT_PTR CALLBACK
|
||||
InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
|
||||
{
|
||||
@@ -1376,6 +1408,7 @@ InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
suggest_passwd(char *passwd)
|
||||
{
|
||||
@@ -1399,6 +1432,7 @@ suggest_passwd(char *passwd)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void add_control(unsigned char **mem,
|
||||
DLGTEMPLATE *dia,
|
||||
WORD type,
|
||||
@@ -1410,6 +1444,7 @@ static void add_control(unsigned char **mem,
|
||||
short cy,
|
||||
const char *caption);
|
||||
|
||||
|
||||
static int
|
||||
get_password(const char *user,
|
||||
const char *realm,
|
||||
@@ -1572,6 +1607,7 @@ get_password(const char *user,
|
||||
#undef LABEL_WIDTH
|
||||
}
|
||||
|
||||
|
||||
static INT_PTR CALLBACK
|
||||
PasswordDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
|
||||
{
|
||||
@@ -1641,6 +1677,7 @@ PasswordDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_control(unsigned char **mem,
|
||||
DLGTEMPLATE *dia,
|
||||
@@ -1683,6 +1720,7 @@ add_control(unsigned char **mem,
|
||||
*mem = (unsigned char *)p;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
show_settings_dialog()
|
||||
{
|
||||
@@ -1858,6 +1896,7 @@ show_settings_dialog()
|
||||
#undef LABEL_WIDTH
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
change_password_file()
|
||||
{
|
||||
@@ -2063,6 +2102,7 @@ change_password_file()
|
||||
#undef LABEL_WIDTH
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
manage_service(int action)
|
||||
{
|
||||
@@ -2235,6 +2275,7 @@ WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
return DefWindowProc(hWnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
MakeConsole(void)
|
||||
{
|
||||
@@ -2270,6 +2311,7 @@ MakeConsole(void)
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
|
||||
{
|
||||
@@ -2277,7 +2319,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
|
||||
HWND hWnd;
|
||||
MSG msg;
|
||||
|
||||
|
||||
int i;
|
||||
int dataLen = 4;
|
||||
char data[256] = {0};
|
||||
@@ -2324,7 +2365,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
|
||||
return state[index];
|
||||
}
|
||||
|
||||
|
||||
uint32_t x, y, z, w;
|
||||
|
||||
uint32_t xorshift128(void)
|
||||
@@ -2336,12 +2376,10 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
|
||||
return w = w ^ (w >> 19) ^ t ^ (t >> 8);
|
||||
}
|
||||
|
||||
|
||||
static uint64_t lfsr = 1;
|
||||
static uint64_t lcg = 0;
|
||||
uint64_t r = 0;
|
||||
|
||||
|
||||
do {
|
||||
lfsr = (lfsr >> 1)
|
||||
| ((((lfsr >> 0) ^ (lfsr >> 1) ^ (lfsr >> 3) ^ (lfsr >> 4)) & 1)
|
||||
@@ -2350,7 +2388,6 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
|
||||
++r;
|
||||
} while (lcg != 0);
|
||||
|
||||
|
||||
fprintf(stdout, "lfsr = %I64u, lcg = %i64u, r = %i64u\n", lfsr, lcg, r);
|
||||
#endif
|
||||
|
||||
@@ -2409,6 +2446,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR cmdline, int show)
|
||||
return (int)msg.wParam;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -2418,6 +2456,7 @@ main(int argc, char *argv[])
|
||||
return WinMain(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
#elif defined(USE_COCOA)
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user