i3
display_version.c File Reference
#include "all.h"
#include <fcntl.h>
#include <time.h>
#include <unistd.h>
Include dependency graph for display_version.c:

Go to the source code of this file.

Macros

#define KEY_MATCHES(x)
 

Functions

static int version_string (void *ctx, const unsigned char *val, size_t len)
 
static int version_map_key (void *ctx, const unsigned char *stringval, size_t stringlen)
 
static void print_config_path (const char *path, const char *role)
 
void display_running_version (void)
 Connects to i3 to find out the currently running version.
 

Variables

static bool human_readable_key
 
static bool loaded_config_file_name_key
 
static bool included_config_file_names
 
static char * human_readable_version
 
static char * loaded_config_file_name
 
static yajl_callbacks version_callbacks
 

Macro Definition Documentation

◆ KEY_MATCHES

#define KEY_MATCHES ( x)
Value:
(stringlen == strlen(x) && strncmp((const char *)stringval, x, strlen(x)) == 0)

Referenced by version_map_key().

Function Documentation

◆ display_running_version()

void display_running_version ( void )

Connects to i3 to find out the currently running version.

Useful since it might be different from the version compiled into this binary (maybe the user didn’t correctly install i3 or forgot to restart it).

The output looks like this: Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

The i3 binary you just called: /home/michael/i3/i3 The i3 binary you are running: /home/michael/i3/i3

Definition at line 81 of file display_version.c.

References conn, conn_screen, human_readable_version, included_files, ipc_connect(), ipc_recv_message(), ipc_send_message(), loaded_config_file_name, IncludedFile::path, print_config_path(), root_atom_contents(), sasprintf(), smalloc(), srealloc(), state, TAILQ_FOREACH, and version_callbacks.

Referenced by main().

Here is the call graph for this function:

◆ print_config_path()

static void print_config_path ( const char * path,
const char * role )
static

Definition at line 53 of file display_version.c.

References ELOG.

Referenced by display_running_version().

◆ version_map_key()

static int version_map_key ( void * ctx,
const unsigned char * stringval,
size_t stringlen )
static

◆ version_string()

static int version_string ( void * ctx,
const unsigned char * val,
size_t len )
static

Variable Documentation

◆ human_readable_key

bool human_readable_key
static

Definition at line 17 of file display_version.c.

Referenced by version_map_key(), and version_string().

◆ human_readable_version

char* human_readable_version
static

Definition at line 21 of file display_version.c.

Referenced by display_running_version(), and version_string().

◆ included_config_file_names

bool included_config_file_names
static

Definition at line 19 of file display_version.c.

Referenced by version_map_key(), and version_string().

◆ loaded_config_file_name

char* loaded_config_file_name
static

Definition at line 22 of file display_version.c.

Referenced by display_running_version(), and version_string().

◆ loaded_config_file_name_key

bool loaded_config_file_name_key
static

Definition at line 18 of file display_version.c.

Referenced by version_map_key(), and version_string().

◆ version_callbacks

yajl_callbacks version_callbacks
static
Initial value:
= {
.yajl_string = version_string,
.yajl_map_key = version_map_key,
}
static int version_map_key(void *ctx, const unsigned char *stringval, size_t stringlen)
static int version_string(void *ctx, const unsigned char *val, size_t len)

Definition at line 48 of file display_version.c.

Referenced by display_running_version().