diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/list/list.c | 14 | ||||
| -rw-r--r-- | lib/list/list.h | 2 | ||||
| -rw-r--r-- | lib/sys/ioctl.h | 11 | ||||
| -rw-r--r-- | lib/tctl/tctl.c | 18 | ||||
| -rw-r--r-- | lib/tctl/tctl.h | 14 |
5 files changed, 58 insertions, 1 deletions
diff --git a/lib/list/list.c b/lib/list/list.c index 753fdb1..8064da4 100644 --- a/lib/list/list.c +++ b/lib/list/list.c @@ -28,6 +28,20 @@ list_t *from_array(void **array, u64 size) } +void free_list(list_t *list) +{ + list_node_t *node = list->first; + list_node_t *next; + free(list); + + while (node) { + next = node->next; + free(node); + node = next; + } +} + + void list_append(list_t *list, void *value) { list_node_t *node = __new_list_node(value); diff --git a/lib/list/list.h b/lib/list/list.h index 9acecac..2021b2a 100644 --- a/lib/list/list.h +++ b/lib/list/list.h @@ -21,6 +21,6 @@ void list_append(list_t *list, void *value); void list_prepend(list_t *list, void *value); void *pop_first(list_t *list); void *pop_last(list_t *list); -void free_list(); +void free_list(list_t *list); #endif diff --git a/lib/sys/ioctl.h b/lib/sys/ioctl.h new file mode 100644 index 0000000..4bf73f7 --- /dev/null +++ b/lib/sys/ioctl.h @@ -0,0 +1,11 @@ +#ifndef SYS_IOCTL_H +#define SYS_IOCTL_H + +#include "syscalls.h" + +int ioctl(unsigned int fd, unsigned int cmd, void *arg) +{ + return syscall(IOCTL, fd, cmd, arg); +} + +#endif diff --git a/lib/tctl/tctl.c b/lib/tctl/tctl.c new file mode 100644 index 0000000..54034f4 --- /dev/null +++ b/lib/tctl/tctl.c @@ -0,0 +1,18 @@ +#include "tctl.h" +#include "../sys/ioctl.h" + +#define GET_WIN_SIZE 0x5413 +#define SET_WIN_SIZE 0x5414 + +window_size_t tctl_get_window_size() +{ + window_size_t ws; + ioctl(0, GET_WIN_SIZE, &ws); + return ws; +} + + +void tctl_set_window_size(window_size_t size) +{ + ioctl(0, SET_WIN_SIZE, &size); +} diff --git a/lib/tctl/tctl.h b/lib/tctl/tctl.h new file mode 100644 index 0000000..d106818 --- /dev/null +++ b/lib/tctl/tctl.h @@ -0,0 +1,14 @@ +#ifndef TCTL_H +#define TCTL_H + +typedef struct { + unsigned short int height; + unsigned short int width; + unsigned short int ws_xpixel; + unsigned short int ws_ypixel; +} window_size_t; + +window_size_t tctl_get_window_size(); +void tctl_set_window_size(window_size_t size); + +#endif |