Freeciv-3.2
Loading...
Searching...
No Matches
Functions | Variables
console.c File Reference
#include "fc_prehdrs.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "deprecations.h"
#include "fcbacktrace.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "support.h"
#include "game.h"
#include "notify.h"
#include "srv_main.h"
#include "console.h"

Go to the source code of this file.

Functions

static int con_dump (enum rfc_status rfc_status, const char *message,...)
 
static void con_handle_log (enum log_level level, const char *message, bool file_too)
 
static void con_update_prompt (void)
 
static void depr_warn_callback (const char *msg)
 
void con_log_init (const char *log_filename, enum log_level level, int fatal_assertions)
 
void con_log_close (void)
 
static int con_dump (enum rfc_status rfc_status, const char *message,...)
 
void con_write (enum rfc_status rfc_status, const char *message,...)
 
void con_puts (enum rfc_status rfc_status, const char *str)
 
void con_flush (void)
 
void con_set_style (bool i)
 
bool con_get_style (void)
 
void con_prompt_init (void)
 
void con_prompt_on (void)
 
void con_prompt_off (void)
 
void con_prompt_enter (void)
 
void con_prompt_enter_clear (void)
 

Variables

static bool console_show_prompt = FALSE
 
static bool console_prompt_is_showing = FALSE
 
static bool console_rfcstyle = FALSE
 

Function Documentation

◆ con_dump() [1/2]

static int con_dump ( enum rfc_status  rfc_status,
const char message,
  ... 
)
static

Referenced by con_update_prompt().

◆ con_dump() [2/2]

static int con_dump ( enum rfc_status  rfc_status,
const char message,
  ... 
)
static

Write to console without line-break, don't print prompt.

Definition at line 178 of file console.c.

◆ con_flush()

void con_flush ( void  )

Ensure timely update.

Definition at line 243 of file console.c.

Referenced by con_update_prompt(), and srv_prepare().

◆ con_get_style()

bool con_get_style ( void  )

Returns rfc-style.

Definition at line 264 of file console.c.

Referenced by handle_stdin_input_real(), show_help_command_list(), and show_help_option_list().

◆ con_handle_log()

static void con_handle_log ( enum log_level  level,
const char message,
bool  file_too 
)
static

Function to handle log messages. This must match the log_callback_fn typedef signature.

Definition at line 58 of file console.c.

Referenced by con_log_init().

◆ con_log_close()

void con_log_close ( void  )

Deinitialize logging

Definition at line 167 of file console.c.

Referenced by main(), and server_quit().

◆ con_log_init()

void con_log_init ( const char log_filename,
enum log_level  level,
int  fatal_assertions 
)

Initialize logging via console.

Definition at line 150 of file console.c.

Referenced by main(), and srv_prepare().

◆ con_prompt_enter()

void con_prompt_enter ( void  )

User pressed enter: will need a new prompt

Definition at line 303 of file console.c.

Referenced by server_sniff_all_input().

◆ con_prompt_enter_clear()

void con_prompt_enter_clear ( void  )

Clear "user pressed enter" state (used in special cases).

Definition at line 314 of file console.c.

Referenced by server_sniff_all_input().

◆ con_prompt_init()

void con_prompt_init ( void  )

Initialize prompt; display initial message.

Definition at line 272 of file console.c.

Referenced by server_sniff_all_input().

◆ con_prompt_off()

void con_prompt_off ( void  )

Do not print a prompt after log messages.

Definition at line 295 of file console.c.

Referenced by server_sniff_all_input().

◆ con_prompt_on()

void con_prompt_on ( void  )

Make sure a prompt is printed, and re-printed after every message.

Definition at line 286 of file console.c.

Referenced by server_sniff_all_input().

◆ con_puts()

void con_puts ( enum rfc_status rfc_status rfc_status  ,
const char str 
)

Write to console and add line-break, and show prompt if required. Same as con_write, but without the format string stuff. The real reason for this is because attribute complained with con_write(C_COMMENT, "") of "warning: zero-length format string"; this allows con_puts(C_COMMENT, "");

Definition at line 226 of file console.c.

Referenced by con_prompt_init(), con_set_style(), con_write(), srv_prepare(), and start_game().

◆ con_set_style()

void con_set_style ( bool  i)

Set style.

Definition at line 251 of file console.c.

Referenced by handle_stdin_input_real().

◆ con_update_prompt()

static void con_update_prompt ( void  )
static

Print the prompt if it is not the last thing printed.

Definition at line 91 of file console.c.

Referenced by con_prompt_on(), and con_puts().

◆ con_write()

void con_write ( enum rfc_status rfc_status  ,
const char message,
  ... 
)

Write to console and add line-break, and show prompt if required.

Definition at line 203 of file console.c.

Referenced by chat_msg_to_all(), cmd_reply_line(), con_handle_log(), handle_stdin_input_real(), main(), save_thread_run(), set_command(), and srv_prepare().

◆ depr_warn_callback()

static void depr_warn_callback ( const char msg)
static

Deprecation warning callback to send event to clients.

Definition at line 142 of file console.c.

Referenced by con_log_init().

Variable Documentation

◆ console_prompt_is_showing

bool console_prompt_is_showing = FALSE
static

◆ console_rfcstyle

bool console_rfcstyle = FALSE
static

Definition at line 47 of file console.c.

Referenced by con_dump(), con_get_style(), con_handle_log(), con_puts(), and con_set_style().

◆ console_show_prompt

bool console_show_prompt = FALSE
static

Definition at line 45 of file console.c.

Referenced by con_prompt_off(), con_prompt_on(), and con_update_prompt().