~ecs/sd

ref: d988cda562c3800b153ba8407b2c9f3330c80ba2 sd/commands.c -rw-r--r-- 495 bytes
d988cda5 — Eyal Sawady run_command: keep searching on -2 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "common.h"

int
quit(struct state *state)
{
	(void)state;
	return -1;
}

int
force_quit(struct state *state)
{
	state->dirty = 0;
	return -1;
}

int
nop(struct state *state)
{
	(void)state;
	return 0;
}

int
init_commands(struct registry *reg)
{
	init_registry(reg);
	if (register_command(reg, "q", quit)) {
		return -1;
	}
	if (register_command(reg, "q!", force_quit)) {
		return -1;
	}
	if (register_command(reg, "nop", nop)) {
		return -1;
	}
	/* TODO: more commands */
	return 0;
}