Github User Fetcher 1.0.0
C Application with Server and GUI
|
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "civetweb.h"
#include <sys/utsname.h>
#include <sys/wait.h>
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | tuser_data |
Macros | |
#define | _XOPEN_SOURCE 600 /* For PATH_MAX on linux */ |
#define | IGNORE_UNUSED_RESULT(a) ((void)((a) && 1)) |
#define | NO_RETURN |
#define | _LARGEFILE_SOURCE /* For fseeko(), ftello() */ |
#define | _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ |
#define | __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
#define | __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ |
#define | printf DO_NOT_USE_THIS_FUNCTION__USE_fprintf /* Required for unit testing */ |
#define | DIRSEP '/' |
#define | WINCDECL |
#define | abs_path(rel, abs, abs_size) (realpath((rel), (abs))) |
#define | DEBUG_ASSERT(cond) |
#define | PATH_MAX (1024) |
#define | MAX_OPTIONS (100) /* TODO: Read from civetweb.c ? */ |
#define | MAX_CONF_FILE_LINE_SIZE (8 * 1024) |
#define | CONFIG_FILE "civetweb.conf" |
#define | PASSWORDS_FILE_NAME ".htpasswd" |
Enumerations | |
enum | { OPTION_TITLE , OPTION_ICON , OPTION_WEBPAGE , OPTION_ADD_DOMAIN , OPTION_HIDE_TRAY , NUM_MAIN_OPTIONS } |
Functions | |
static void WINCDECL | signal_handler (int sig_num) |
static NO_RETURN void | die (const char *fmt,...) |
static void | warn (const char *fmt,...) |
static void | show_server_name (void) |
static NO_RETURN void | show_usage_and_exit (const char *exeName) |
static char * | sdup (const char *str) |
static const char * | get_option (const char **options, const char *option_name) |
static int | set_option (const char **options, const char *name, const char *value) |
static int | read_config_file (const char *config_file, const char **options) |
static void | process_command_line_arguments (int argc, char *argv[], const char **options) |
static void | init_system_info (void) |
static void | init_server_name (void) |
static void | free_system_info (void) |
static int | is_path_absolute (const char *path) |
static int | verify_existence (const char **options, const char *option_name, int must_be_dir) |
static void | set_absolute_path (const char *options[], const char *option_name, const char *path_to_civetweb_exe) |
static int | run_client (const char *url_arg) |
static int | sanitize_options (const char *options[], const char *arg0) |
static void | start_civetweb (int argc, char *argv[]) |
static void | stop_civetweb (void) |
int | main (int argc, char *argv[]) |
Variables | |
volatile int | g_exit_flag = 0 |
static char | g_server_base_name [40] |
static const char * | g_server_name |
static const char * | g_icon_name |
static const char * | g_website |
static int | g_num_add_domains |
static const char ** | g_add_domain |
static int | g_hide_tray = 0 |
static char * | g_system_info |
static char | g_config_file_name [PATH_MAX] |
static struct mg_context * | g_ctx |
static struct tuser_data | g_user_data |
static struct mg_option | main_config_options [] |
#define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
Definition at line 78 of file vendor/civetweb/main.c.
#define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ |
Definition at line 81 of file vendor/civetweb/main.c.
#define _FILE_OFFSET_BITS 64 /* Use 64-bit file offsets by default */ |
Definition at line 75 of file vendor/civetweb/main.c.
#define _LARGEFILE_SOURCE /* For fseeko(), ftello() */ |
Definition at line 72 of file vendor/civetweb/main.c.
#define _XOPEN_SOURCE 600 /* For PATH_MAX on linux */ |
Definition at line 45 of file vendor/civetweb/main.c.
#define abs_path | ( | rel, | |
abs, | |||
abs_size ) (realpath((rel), (abs))) |
Definition at line 146 of file vendor/civetweb/main.c.
Referenced by set_absolute_path().
#define CONFIG_FILE "civetweb.conf" |
Definition at line 212 of file vendor/civetweb/main.c.
Referenced by process_command_line_arguments().
#define DEBUG_ASSERT | ( | cond | ) |
Definition at line 168 of file vendor/civetweb/main.c.
Referenced by init_server_name().
#define DIRSEP '/' |
Definition at line 144 of file vendor/civetweb/main.c.
Referenced by process_command_line_arguments(), and set_absolute_path().
Definition at line 57 of file vendor/civetweb/main.c.
Referenced by set_absolute_path().
#define MAX_CONF_FILE_LINE_SIZE (8 * 1024) |
Definition at line 177 of file vendor/civetweb/main.c.
Referenced by read_config_file().
#define MAX_OPTIONS (100) /* TODO: Read from civetweb.c ? */ |
Definition at line 176 of file vendor/civetweb/main.c.
Referenced by set_option(), and start_civetweb().
#define NO_RETURN |
Definition at line 67 of file vendor/civetweb/main.c.
#define PASSWORDS_FILE_NAME ".htpasswd" |
Definition at line 216 of file vendor/civetweb/main.c.
#define PATH_MAX (1024) |
Definition at line 173 of file vendor/civetweb/main.c.
Referenced by set_absolute_path().
#define printf DO_NOT_USE_THIS_FUNCTION__USE_fprintf /* Required for unit testing */ |
Definition at line 104 of file vendor/civetweb/main.c.
Referenced by create_duktape_heap(), create_duktape_heap(), doargs(), doargs(), doargs(), doargs(), duk_alloc_hybrid(), duk_alloc_hybrid_init(), duk_free_hybrid(), duk_realloc_hybrid(), main(), main(), my_class::my_class(), print(), print_github_user(), PrintCode(), PrintCode(), PrintCode(), PrintCode(), PrintConstant(), PrintConstant(), PrintConstant(), PrintConstant(), PrintConstants(), PrintDebug(), PrintDebug(), PrintDebug(), PrintHeader(), PrintHeader(), PrintHeader(), PrintHeader(), PrintLocals(), PrintString(), PrintString(), PrintString(), PrintString(), PrintType(), PrintUpvalues(), pthreadMutexTry(), removeUnindexableInClauseTerms(), sqlite3RegisterBuiltinFunctions(), sqlite3RunParser(), sqlite3VdbeExec(), sqlite3WhereEnd(), start_http_server(), test2(), wrapped_compile_execute(), and my_class::~my_class().
#define WINCDECL |
Definition at line 145 of file vendor/civetweb/main.c.
anonymous enum |
Enumerator | |
---|---|
OPTION_TITLE | |
OPTION_ICON | |
OPTION_WEBPAGE | |
OPTION_ADD_DOMAIN | |
OPTION_HIDE_TRAY | |
NUM_MAIN_OPTIONS |
Definition at line 224 of file vendor/civetweb/main.c.
|
static |
Definition at line 258 of file vendor/civetweb/main.c.
References NULL.
Referenced by process_command_line_arguments(), sdup(), set_option(), and start_civetweb().
|
static |
Definition at line 856 of file vendor/civetweb/main.c.
References free, and g_system_info.
Referenced by main().
|
static |
Definition at line 471 of file vendor/civetweb/main.c.
References NULL.
Referenced by set_absolute_path(), and verify_existence().
|
static |
Definition at line 838 of file vendor/civetweb/main.c.
References DEBUG_ASSERT, g_add_domain, g_icon_name, g_num_add_domains, g_server_base_name, g_server_name, g_website, main_config_options, mg_version(), NULL, NUM_MAIN_OPTIONS, and snprintf.
Referenced by main().
|
static |
Definition at line 825 of file vendor/civetweb/main.c.
References g_system_info, malloc, mg_get_system_info(), NULL, and sdup().
Referenced by main().
|
static |
Definition at line 863 of file vendor/civetweb/main.c.
References NULL.
Referenced by set_absolute_path().
int main | ( | int | argc, |
char * | argv[] ) |
Definition at line 3235 of file vendor/civetweb/main.c.
References free_system_info(), g_ctx, g_exit_flag, g_server_name, init_server_name(), init_system_info(), mg_get_option, start_civetweb(), and stop_civetweb().
|
static |
Definition at line 738 of file vendor/civetweb/main.c.
References CONFIG_FILE, die(), DIRSEP, g_config_file_name, NULL, read_config_file(), set_option(), show_usage_and_exit(), and snprintf.
Referenced by start_civetweb().
|
static |
Definition at line 666 of file vendor/civetweb/main.c.
References MAX_CONF_FILE_LINE_SIZE, NULL, and set_option().
Referenced by process_command_line_arguments(), and start_civetweb().
|
static |
Definition at line 995 of file vendor/civetweb/main.c.
References mg_connection::buf, free, fwrite(), mg_close_connection(), mg_connect_client(), mg_exit_library(), MG_FEATURES_DEFAULT, MG_FEATURES_TLS, mg_get_response(), mg_get_response_info(), mg_init_library(), mg_printf(), mg_read(), sdup(), mg_response_info::status_code, and mg_response_info::status_text.
Referenced by start_civetweb().
|
static |
Definition at line 1139 of file vendor/civetweb/main.c.
References set_absolute_path(), and verify_existence().
Referenced by start_civetweb().
|
static |
Definition at line 453 of file vendor/civetweb/main.c.
References die(), malloc, and NULL.
Referenced by init_system_info(), run_client(), and set_option().
|
static |
Definition at line 914 of file vendor/civetweb/main.c.
References abs_path, DIRSEP, get_option(), IGNORE_UNUSED_RESULT, is_path_absolute(), NULL, PATH_MAX, set_option(), and snprintf.
Referenced by sanitize_options().
|
static |
Definition at line 495 of file vendor/civetweb/main.c.
References die(), free, g_add_domain, g_hide_tray, g_icon_name, g_num_add_domains, g_server_name, g_website, main_config_options, malloc, MAX_OPTIONS, MG_CONFIG_TYPE_BOOLEAN, MG_CONFIG_TYPE_DIRECTORY, MG_CONFIG_TYPE_EXT_PATTERN, MG_CONFIG_TYPE_FILE, MG_CONFIG_TYPE_NUMBER, MG_CONFIG_TYPE_STRING, MG_CONFIG_TYPE_STRING_LIST, MG_CONFIG_TYPE_STRING_MULTILINE, MG_CONFIG_TYPE_UNKNOWN, MG_CONFIG_TYPE_YES_NO_OPTIONAL, mg_get_valid_options(), mg_option::name, name, NULL, OPTION_ADD_DOMAIN, OPTION_HIDE_TRAY, OPTION_ICON, OPTION_TITLE, OPTION_WEBPAGE, realloc, s, sdup(), mg_option::type, and value.
Referenced by process_command_line_arguments(), read_config_file(), set_absolute_path(), and start_civetweb().
|
static |
Definition at line 303 of file vendor/civetweb/main.c.
References mg_version().
Referenced by show_usage_and_exit(), and start_civetweb().
|
static |
Definition at line 319 of file vendor/civetweb/main.c.
References mg_option::default_value, main_config_options, mg_get_valid_options(), mg_option::name, name, NULL, and show_server_name().
Referenced by process_command_line_arguments(), and start_civetweb().
|
static |
Definition at line 251 of file vendor/civetweb/main.c.
References g_exit_flag.
Referenced by start_civetweb().
|
static |
Definition at line 1181 of file vendor/civetweb/main.c.
References mg_init_data::callbacks, mg_init_data::configuration_options, die(), error(), free, g_add_domain, g_ctx, g_num_add_domains, g_server_base_name, g_server_name, g_system_info, g_user_data, MAX_OPTIONS, mg_modify_passwords_file(), mg_start2(), mg_start_domain(), mg_strcasecmp(), NULL, process_command_line_arguments(), read_config_file(), run_client(), run_lua(), sanitize_options(), set_option(), show_server_name(), show_usage_and_exit(), signal_handler(), and mg_init_data::user_data.
Referenced by main().
|
static |
Definition at line 1409 of file vendor/civetweb/main.c.
References g_ctx, and mg_stop().
Referenced by main().
|
static |
Definition at line 878 of file vendor/civetweb/main.c.
References get_option(), NULL, and warn().
Referenced by sanitize_options().
|
static |
Definition at line 279 of file vendor/civetweb/main.c.
References NULL.
Referenced by verify_existence().
|
static |
Definition at line 197 of file vendor/civetweb/main.c.
Referenced by init_server_name(), set_option(), and start_civetweb().
|
static |
Definition at line 203 of file vendor/civetweb/main.c.
Referenced by process_command_line_arguments().
|
static |
Definition at line 207 of file vendor/civetweb/main.c.
Referenced by main(), start_civetweb(), and stop_civetweb().
volatile int g_exit_flag = 0 |
Definition at line 185 of file vendor/civetweb/main.c.
Referenced by main(), and signal_handler().
|
static |
Definition at line 199 of file vendor/civetweb/main.c.
Referenced by set_option().
|
static |
Definition at line 191 of file vendor/civetweb/main.c.
Referenced by init_server_name(), and set_option().
|
static |
Definition at line 195 of file vendor/civetweb/main.c.
Referenced by init_server_name(), set_option(), and start_civetweb().
|
static |
Definition at line 187 of file vendor/civetweb/main.c.
Referenced by init_server_name(), and start_civetweb().
|
static |
Definition at line 189 of file vendor/civetweb/main.c.
Referenced by init_server_name(), main(), set_option(), and start_civetweb().
|
static |
Definition at line 202 of file vendor/civetweb/main.c.
Referenced by free_system_info(), init_system_info(), and start_civetweb().
|
static |
Definition at line 209 of file vendor/civetweb/main.c.
Referenced by start_civetweb().
|
static |
Definition at line 193 of file vendor/civetweb/main.c.
Referenced by init_server_name(), and set_option().
|
static |
Definition at line 237 of file vendor/civetweb/main.c.
Referenced by init_server_name(), set_option(), and show_usage_and_exit().