-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwakit.h
More file actions
57 lines (46 loc) · 1.46 KB
/
Copy pathwakit.h
File metadata and controls
57 lines (46 loc) · 1.46 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef WAKIT_H
#define WAKIT_H
#include "dynamic_string.h"
typedef enum {
Profile,
Action
} cmd_type;
typedef struct {
string name;
string cmd;
cmd_type type;
// Only for profiles. Specifies that the profile is custom to the app.
// It should be 'generic' or be the name of the asociated app. It should be
// empty for Actions
string app;
bool default_for_app;
} cmd;
// Init cmd strigs
#define INIT_CMD(c) c.cmd = (string) {NULL, 0, 0}; \
c.name = (string) {NULL, 0, 0}; \
c.app = (string) {NULL, 0, 0};
typedef struct command_node {
cmd info;
struct command_node *next;
} cmd_node;
// cmd list operations
bool add_command(cmd_node **list, cmd c);
int load_cmd_list(cmd_node **list);
bool save_cmd_list(cmd_node *list);
void free_cmd_list(cmd_node **list);
cmd_node *search_cmd(cmd_node *list, char *cmd_name);
int print_instructions(cmd_node *list, char *wakit_path);
bool insert_command_node_at(cmd_node **list, cmd_node *node, unsigned int pos);
cmd_node *remove_command(cmd_node **list, char *name);
// cmd operations
cmd duplicate_cmd(cmd info);
void free_cmd(cmd_node *cmd);
// User interaction
void print_help(const char *app_path);
int create_command(char *name, char *command, char *type);
int menu();
bool run(cmd_node *list, char *cmd_name);
int start_daemon();
cmd_node *default_app_profile(cmd_node *list, char *app_name);
cmd_node *search_profiles_app(cmd_node *list, char *app_name);
#endif // WAKIT_H