format: let clang-format run ._.

(won't even talk about clang-tidy)
This commit is contained in:
2024-09-05 20:26:58 +02:00
parent b34528d1cb
commit dbbab78e23
12 changed files with 142 additions and 135 deletions

View File

@@ -20,6 +20,6 @@ int chvt(int n);
* @param str virtual terminal number (string)
* @return int non-negative value on success
*/
int chvt_str(char* str);
int chvt_str(char *str);
#endif

View File

@@ -74,10 +74,9 @@ struct config {
};
bool line_parser(
FILE* fd,
ssize_t* blksize,
FILE *fd, ssize_t *blksize,
u_char (*cb)(char *key,
char *value)); // might use this for parsing .desktop files too
char *value)); // might use this for parsing .desktop files too
struct config *parse_config(char *path);
#endif

View File

@@ -10,9 +10,9 @@ struct editable_field {
char content[255];
};
struct editable_field field_new(char*);
void field_trim(struct editable_field*, u_char);
void field_update(struct editable_field*, char*);
bool field_seek(struct editable_field*, char);
struct editable_field field_new(char *);
void field_trim(struct editable_field *, u_char);
void field_update(struct editable_field *, char *);
bool field_seek(struct editable_field *, char);
#endif

View File

@@ -4,37 +4,37 @@
#include <stdlib.h>
enum keys {
ESC,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
A_UP,
A_DOWN,
A_RIGHT,
A_LEFT,
N_CENTER,
N_UP,
N_DOWN,
N_RIGHT,
N_LEFT,
INS,
SUPR,
HOME,
END,
PAGE_UP,
PAGE_DOWN,
ESC,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
A_UP,
A_DOWN,
A_RIGHT,
A_LEFT,
N_CENTER,
N_UP,
N_DOWN,
N_RIGHT,
N_LEFT,
INS,
SUPR,
HOME,
END,
PAGE_UP,
PAGE_DOWN,
};
static const char * const key_names[] = {
static const char *const key_names[] = {
[ESC] = "ESC",
[F1] = "F1",
[F2] = "F2",
@@ -66,39 +66,39 @@ static const char * const key_names[] = {
};
struct key_mapping {
enum keys key;
const char *sequences[3];
enum keys key;
const char *sequences[3];
};
static const struct key_mapping key_mappings[] = {
{ ESC, { "\x1b", NULL }},
{ F1, { "\x1bOP", "\x1b[[A", NULL }},
{ F2, { "\x1bOQ", "\x1b[[B", NULL }},
{ F3, { "\x1bOR", "\x1b[[C", NULL }},
{ F4, { "\x1bOS", "\x1b[[D", NULL }},
{ F5, { "\x1b[15~", "\x1b[[E", NULL }},
{ F6, { "\x1b[17~", NULL }},
{ F7, { "\x1b[18~", NULL }},
{ F8, { "\x1b[19~", NULL }},
{ F9, { "\x1b[20~", NULL }},
{ F10, { "\x1b[21~", NULL }},
{ F11, { "\x1b[23~", NULL }},
{ F12, { "\x1b[24~", NULL }},
{ A_UP, { "\x1b[A", NULL }},
{ A_DOWN, { "\x1b[B", NULL }},
{ A_RIGHT, { "\x1b[C", NULL }},
{ A_LEFT, { "\x1b[D", NULL }},
{ N_CENTER, { "\x1b[E", NULL }},
{ N_UP, { "\x1bOA", NULL }},
{ N_DOWN, { "\x1bOB", NULL }},
{ N_RIGHT, { "\x1bOC", NULL }},
{ N_LEFT, { "\x1bOD", NULL }},
{ INS, { "\x1b[2~", NULL }},
{ SUPR, { "\x1b[3~", NULL }},
{ HOME, { "\x1b[H", NULL }},
{ END, { "\x1b[F", NULL }},
{ PAGE_UP, { "\x1b[5~", NULL }},
{ PAGE_DOWN, { "\x1b[6~", NULL }},
{ESC, {"\x1b", NULL}},
{F1, {"\x1bOP", "\x1b[[A", NULL}},
{F2, {"\x1bOQ", "\x1b[[B", NULL}},
{F3, {"\x1bOR", "\x1b[[C", NULL}},
{F4, {"\x1bOS", "\x1b[[D", NULL}},
{F5, {"\x1b[15~", "\x1b[[E", NULL}},
{F6, {"\x1b[17~", NULL}},
{F7, {"\x1b[18~", NULL}},
{F8, {"\x1b[19~", NULL}},
{F9, {"\x1b[20~", NULL}},
{F10, {"\x1b[21~", NULL}},
{F11, {"\x1b[23~", NULL}},
{F12, {"\x1b[24~", NULL}},
{A_UP, {"\x1b[A", NULL}},
{A_DOWN, {"\x1b[B", NULL}},
{A_RIGHT, {"\x1b[C", NULL}},
{A_LEFT, {"\x1b[D", NULL}},
{N_CENTER, {"\x1b[E", NULL}},
{N_UP, {"\x1bOA", NULL}},
{N_DOWN, {"\x1bOB", NULL}},
{N_RIGHT, {"\x1bOC", NULL}},
{N_LEFT, {"\x1bOD", NULL}},
{INS, {"\x1b[2~", NULL}},
{SUPR, {"\x1b[3~", NULL}},
{HOME, {"\x1b[H", NULL}},
{END, {"\x1b[F", NULL}},
{PAGE_UP, {"\x1b[5~", NULL}},
{PAGE_DOWN, {"\x1b[6~", NULL}},
};
#endif

View File

@@ -4,8 +4,8 @@
#include <config.h>
void setup(struct config);
int load(struct users_list*, struct sessions_list*);
void print_err(const char*);
void print_errno(const char*);
int load(struct users_list *, struct sessions_list *);
void print_err(const char *);
void print_errno(const char *);
#endif

View File

@@ -5,9 +5,9 @@
#include <stdbool.h>
#include <sys/types.h>
enum keys find_keyname(char*);
enum keys find_ansi(char*);
void read_press(u_char*, char*);
enum keys find_keyname(char *);
enum keys find_ansi(char *);
void read_press(u_char *, char *);
void strcln(char **dest, const char *source);
#endif