summaryrefslogtreecommitdiffstats
path: root/src/cmd.h
blob: 43275457089924371793cb2f34cd4eac37275f4f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <wchar.h>

#include <stdbool.h>

#define CMD_SET_STATUS(...) do { \
		free(cmd_status); \
		cmd_status = aprintf(__VA_ARGS__); \
	} while (0)

typedef bool (*cmd_func)(const wchar_t *args);

struct cmd {
	const wchar_t *name;
	cmd_func func;
};

void cmd_init(void);
void cmd_deinit(void);

extern const struct cmd commands[];
extern const size_t command_count;
extern char *cmd_status;