remove the ctypes submodule

pull/311/head^2
nullgemm 3 years ago
parent 77f6958241
commit b448fc97b2

@ -1,15 +0,0 @@
[submodule "sub/argoat"]
path = sub/argoat
url = https://git.nullgemm.fr/nullgemm/argoat.git
[submodule "sub/configator"]
path = sub/configator
url = https://git.nullgemm.fr/nullgemm/configator.git
[submodule "sub/ctypes"]
path = sub/ctypes
url = https://git.nullgemm.fr/nullgemm/ctypes.git
[submodule "sub/dragonfail"]
path = sub/dragonfail
url = https://git.nullgemm.fr/nullgemm/dragonfail.git
[submodule "sub/termbox_next"]
path = sub/termbox_next
url = https://git.nullgemm.fr/nullgemm/termbox_next.git

1
.gitignore vendored

@ -1,4 +1,3 @@
bin
obj
.gitmodules
valgrind.log

@ -4,9 +4,6 @@
[submodule "sub/configator"]
path = sub/configator
url = https://github.com/nullgemm/configator.git
[submodule "sub/ctypes"]
path = sub/ctypes
url = https://github.com/nullgemm/ctypes.git
[submodule "sub/dragonfail"]
path = sub/dragonfail
url = https://github.com/nullgemm/dragonfail.git

@ -110,18 +110,10 @@ remotes:
@git remote add github git@github.com:nullgemm/$(NAME).git
@git remote add gitea ssh://git@git.nullgem.fr:2999/nullgemm/$(NAME).git
gitea: github
github:
@echo "sourcing submodules from https://github.com"
@cp .github .gitmodules
@echo "sourcing submodules"
@git submodule sync
@git submodule update --init --remote
@cd $(SUBD)/argoat && make github
@git submodule update --init --recursive --remote
gitea:
@echo "sourcing submodules from personal server"
@cp .gitea .gitmodules
@git submodule sync
@git submodule update --init --remote
@cd $(SUBD)/argoat && make gitea
@git submodule update --init --recursive --remote

@ -2,7 +2,9 @@
#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -30,11 +32,11 @@ static void config_handle_u8(void* data, char** pars, const int pars_count)
{
if (strcmp(*pars, "") == 0)
{
*((u8*)data) = 0;
*((uint8_t*)data) = 0;
}
else
{
*((u8*)data) = atoi(*pars);
*((uint8_t*)data) = atoi(*pars);
}
}
@ -42,11 +44,11 @@ static void config_handle_u16(void* data, char** pars, const int pars_count)
{
if (strcmp(*pars, "") == 0)
{
*((u16*)data) = 0;
*((uint16_t*)data) = 0;
}
else
{
*((u16*)data) = atoi(*pars);
*((uint16_t*)data) = atoi(*pars);
}
}

@ -1,7 +1,8 @@
#ifndef H_LY_CONFIG
#define H_LY_CONFIG
#include "ctypes.h"
#include <stdbool.h>
#include <stdint.h>
enum INPUTS {
SESSION_SWITCH,
@ -61,25 +62,25 @@ struct lang
struct config
{
bool animate;
u8 animation;
uint8_t animation;
char asterisk;
u8 bg;
uint8_t bg;
bool blank_box;
bool blank_password;
char* console_dev;
u8 default_input;
u8 fg;
uint8_t default_input;
uint8_t fg;
bool hide_borders;
u8 input_len;
uint8_t input_len;
char* lang;
bool load;
u8 margin_box_h;
u8 margin_box_v;
u8 max_desktop_len;
u8 max_login_len;
u8 max_password_len;
uint8_t margin_box_h;
uint8_t margin_box_v;
uint8_t max_desktop_len;
uint8_t max_login_len;
uint8_t max_password_len;
char* mcookie_cmd;
u16 min_refresh_delta;
uint16_t min_refresh_delta;
char* path;
char* restart_cmd;
bool save;
@ -87,7 +88,7 @@ struct config
char* service_name;
char* shutdown_cmd;
char* term_reset_cmd;
u8 tty;
uint8_t tty;
char* wayland_cmd;
bool wayland_specifier;
char* waylandsessions;

@ -1,14 +1,14 @@
#include "dragonfail.h"
#include "termbox.h"
#include "ctypes.h"
#include "inputs.h"
#include "utils.h"
#include "config.h"
#include "draw.h"
#include <ctype.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
@ -29,8 +29,8 @@ void draw_init(struct term_buf* buf)
buf->height = tb_height();
hostname(&buf->info_line);
u16 len_login = strlen(lang.login);
u16 len_password = strlen(lang.password);
uint16_t len_login = strlen(lang.login);
uint16_t len_password = strlen(lang.password);
if (len_login > len_password)
{
@ -78,10 +78,10 @@ void draw_free(struct term_buf* buf)
void draw_box(struct term_buf* buf)
{
u16 box_x = (buf->width - buf->box_width) / 2;
u16 box_y = (buf->height - buf->box_height) / 2;
u16 box_x2 = (buf->width + buf->box_width) / 2;
u16 box_y2 = (buf->height + buf->box_height) / 2;
uint16_t box_x = (buf->width - buf->box_width) / 2;
uint16_t box_y = (buf->height - buf->box_height) / 2;
uint16_t box_x2 = (buf->width + buf->box_width) / 2;
uint16_t box_y2 = (buf->height + buf->box_height) / 2;
buf->box_x = box_x;
buf->box_y = box_y;
@ -117,7 +117,7 @@ void draw_box(struct term_buf* buf)
struct tb_cell c1 = {buf->box_chars.top, config.fg, config.bg};
struct tb_cell c2 = {buf->box_chars.bot, config.fg, config.bg};
for (u8 i = 0; i < buf->box_width; ++i)
for (uint8_t i = 0; i < buf->box_width; ++i)
{
tb_put_cell(
box_x + i,
@ -133,7 +133,7 @@ void draw_box(struct term_buf* buf)
c1.ch = buf->box_chars.left;
c2.ch = buf->box_chars.right;
for (u8 i = 0; i < buf->box_height; ++i)
for (uint8_t i = 0; i < buf->box_height; ++i)
{
tb_put_cell(
box_x - 1,
@ -151,9 +151,9 @@ void draw_box(struct term_buf* buf)
{
struct tb_cell blank = {' ', config.fg, config.bg};
for (u8 i = 0; i < buf->box_height; ++i)
for (uint8_t i = 0; i < buf->box_height; ++i)
{
for (u8 k = 0; k < buf->box_width; ++k)
for (uint8_t k = 0; k < buf->box_width; ++k)
{
tb_put_cell(
box_x + k,
@ -164,15 +164,15 @@ void draw_box(struct term_buf* buf)
}
}
struct tb_cell* strn_cell(char* s, u16 len) // throws
struct tb_cell* strn_cell(char* s, uint16_t len) // throws
{
struct tb_cell* cells = malloc((sizeof (struct tb_cell)) * len);
char* s2 = s;
u32 c;
uint32_t c;
if (cells != NULL)
{
for (u16 i = 0; i < len; ++i)
for (uint16_t i = 0; i < len; ++i)
{
if ((s2 - s) >= len)
{
@ -239,7 +239,7 @@ void draw_labels(struct term_buf* buf) // throws
if (buf->info_line != NULL)
{
u16 len = strlen(buf->info_line);
uint16_t len = strlen(buf->info_line);
struct tb_cell* info_cell = str_cell(buf->info_line);
if (dgn_catch())
@ -315,7 +315,7 @@ void draw_lock_state(struct term_buf* buf)
close(fd);
// print text
u16 pos_x = buf->width - strlen(lang.numlock);
uint16_t pos_x = buf->width - strlen(lang.numlock);
if (numlock_on)
{
@ -352,7 +352,7 @@ void draw_lock_state(struct term_buf* buf)
void draw_desktop(struct desktop* target)
{
u16 len = strlen(target->list[target->cur]);
uint16_t len = strlen(target->list[target->cur]);
if (len > (target->visible_len - 3))
{
@ -373,7 +373,7 @@ void draw_desktop(struct desktop* target)
config.fg,
config.bg);
for (u16 i = 0; i < len; ++ i)
for (uint16_t i = 0; i < len; ++ i)
{
tb_change_cell(
target->x + i + 2,
@ -386,8 +386,8 @@ void draw_desktop(struct desktop* target)
void draw_input(struct text* input)
{
u16 len = strlen(input->text);
u16 visible_len = input->visible_len;
uint16_t len = strlen(input->text);
uint16_t visible_len = input->visible_len;
if (len > visible_len)
{
@ -407,7 +407,7 @@ void draw_input(struct text* input)
struct tb_cell c1 = {' ', config.fg, config.bg};
for (u16 i = input->end - input->visible_start; i < visible_len; ++i)
for (uint16_t i = input->end - input->visible_start; i < visible_len; ++i)
{
tb_put_cell(
input->x + i,
@ -419,8 +419,8 @@ void draw_input(struct text* input)
void draw_input_mask(struct text* input)
{
u16 len = strlen(input->text);
u16 visible_len = input->visible_len;
uint16_t len = strlen(input->text);
uint16_t visible_len = input->visible_len;
if (len > visible_len)
{
@ -430,7 +430,7 @@ void draw_input_mask(struct text* input)
struct tb_cell c1 = {config.asterisk, config.fg, config.bg};
struct tb_cell c2 = {' ', config.fg, config.bg};
for (u16 i = 0; i < visible_len; ++i)
for (uint16_t i = 0; i < visible_len; ++i)
{
if (input->visible_start + i < input->end)
{
@ -455,8 +455,8 @@ void position_input(
struct text* login,
struct text* password)
{
u16 x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1;
i32 len = buf->box_x + buf->box_width - config.margin_box_h - x;
uint16_t x = buf->box_x + config.margin_box_h + buf->labels_max_len + 1;
int32_t len = buf->box_x + buf->box_width - config.margin_box_h - x;
if (len < 0)
{
@ -481,7 +481,7 @@ static void doom_init(struct term_buf* buf)
buf->init_width = buf->width;
buf->init_height = buf->height;
u16 tmp_len = buf->width * buf->height;
uint16_t tmp_len = buf->width * buf->height;
buf->tmp_buf = malloc(tmp_len);
tmp_len -= buf->width;
@ -528,12 +528,12 @@ static void doom(struct term_buf* term_buf)
{0x2588, 8, 4}, // white
};
u16 src;
u16 random;
u16 dst;
uint16_t src;
uint16_t random;
uint16_t dst;
u16 w = term_buf->init_width;
u8* tmp = term_buf->tmp_buf;
uint16_t w = term_buf->init_width;
uint8_t* tmp = term_buf->tmp_buf;
if ((term_buf->width != term_buf->init_width) || (term_buf->height != term_buf->init_height))
{
@ -542,9 +542,9 @@ static void doom(struct term_buf* term_buf)
struct tb_cell* buf = tb_cell_buffer();
for (u16 x = 0; x < w; ++x)
for (uint16_t x = 0; x < w; ++x)
{
for (u16 y = 1; y < term_buf->init_height; ++y)
for (uint16_t y = 1; y < term_buf->init_height; ++y)
{
src = y * w + x;
random = ((rand() % 7) & 3);
@ -590,10 +590,10 @@ void animate(struct term_buf* buf)
}
}
bool cascade(struct term_buf* term_buf, u8* fails)
bool cascade(struct term_buf* term_buf, uint8_t* fails)
{
u16 width = term_buf->width;
u16 height = term_buf->height;
uint16_t width = term_buf->width;
uint16_t height = term_buf->height;
struct tb_cell* buf = tb_cell_buffer();
bool changes = false;

@ -2,45 +2,46 @@
#define H_LY_DRAW
#include "termbox.h"
#include "ctypes.h"
#include "inputs.h"
#include <stdbool.h>
#include <stdint.h>
struct box
{
u32 left_up;
u32 left_down;
u32 right_up;
u32 right_down;
u32 top;
u32 bot;
u32 left;
u32 right;
uint32_t left_up;
uint32_t left_down;
uint32_t right_up;
uint32_t right_down;
uint32_t top;
uint32_t bot;
uint32_t left;
uint32_t right;
};
struct term_buf
{
u16 width;
u16 height;
u16 init_width;
u16 init_height;
uint16_t width;
uint16_t height;
uint16_t init_width;
uint16_t init_height;
struct box box_chars;
char* info_line;
u16 labels_max_len;
u16 box_x;
u16 box_y;
u16 box_width;
u16 box_height;
uint16_t labels_max_len;
uint16_t box_x;
uint16_t box_y;
uint16_t box_width;
uint16_t box_height;
u8* tmp_buf;
uint8_t* tmp_buf;
};
void draw_init(struct term_buf* buf);
void draw_free(struct term_buf* buf);
void draw_box(struct term_buf* buf);
struct tb_cell* strn_cell(char* s, u16 len);
struct tb_cell* strn_cell(char* s, uint16_t len);
struct tb_cell* str_cell(char* s);
void draw_labels(struct term_buf* buf);
@ -58,6 +59,6 @@ void position_input(
void animate_init(struct term_buf* buf);
void animate(struct term_buf* buf);
bool cascade(struct term_buf* buf, u8* fails);
bool cascade(struct term_buf* buf, uint8_t* fails);
#endif

@ -1,10 +1,9 @@
#include "dragonfail.h"
#include "termbox.h"
#include "ctypes.h"
#include "inputs.h"
#include "config.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
@ -89,7 +88,7 @@ void input_desktop(struct desktop* target)
#endif
}
void input_text(struct text* target, u64 len)
void input_text(struct text* target, uint64_t len)
{
target->text = malloc(len + 1);
@ -123,7 +122,7 @@ void input_desktop_free(struct desktop* target)
{
if (target != NULL)
{
for (u16 i = 0; i < target->len; ++i)
for (uint16_t i = 0; i < target->len; ++i)
{
if (target->list[i] != NULL)
{

@ -2,7 +2,8 @@
#define H_LY_INPUTS
#include "termbox.h"
#include "ctypes.h"
#include <stdint.h>
enum display_server {DS_WAYLAND, DS_SHELL, DS_XINITRC, DS_XORG};
@ -10,13 +11,13 @@ struct text
{
char* text;
char* end;
i64 len;
int64_t len;
char* cur;
char* visible_start;
u16 visible_len;
uint16_t visible_len;
u16 x;
u16 y;
uint16_t x;
uint16_t y;
};
struct desktop
@ -25,17 +26,17 @@ struct desktop
char** cmd;
enum display_server* display_server;
u16 cur;
u16 len;
u16 visible_len;
u16 x;
u16 y;
uint16_t cur;
uint16_t len;
uint16_t visible_len;
uint16_t x;
uint16_t y;
};
void handle_desktop(void* input_struct, struct tb_event* event);
void handle_text(void* input_struct, struct tb_event* event);
void input_desktop(struct desktop* target);
void input_text(struct text* target, u64 len);
void input_text(struct text* target, uint64_t len);
void input_desktop_free(struct desktop* target);
void input_text_free(struct text* target);
void input_desktop_right(struct desktop* target);

@ -12,6 +12,7 @@
#include <pwd.h>
#include <security/pam_appl.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -24,7 +25,7 @@
int get_free_display()
{
char xlock[1024];
u8 i;
uint8_t i;
for (i = 0; i < 200; ++i)
{
@ -594,7 +595,7 @@ void auth(
// add pam variables
char** env = pam_getenvlist(handle);
for (u16 i = 0; env && env[i]; ++i)
for (uint16_t i = 0; env && env[i]; ++i)
{
putenv(env[i]);
}

@ -2,7 +2,6 @@
#include "configator.h"
#include "dragonfail.h"
#include "termbox.h"
#include "ctypes.h"
#include "draw.h"
#include "inputs.h"
@ -10,8 +9,10 @@
#include "utils.h"
#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
@ -138,7 +139,7 @@ int main(int argc, char** argv)
// init visible elements
struct tb_event event;
struct term_buf buf;
u8 active_input = config.default_input;
uint8_t active_input = config.default_input;
(*input_handles[active_input])(input_structs[active_input], NULL);
@ -162,7 +163,7 @@ int main(int argc, char** argv)
bool update = true;
bool reboot = false;
bool shutdown = false;
u8 auth_fails = 0;
uint8_t auth_fails = 0;
switch_tty(&buf);

@ -1,12 +1,12 @@
#include "configator.h"
#include "dragonfail.h"
#include "inputs.h"
#include "config.h"
#include "utils.h"
#include <dirent.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

@ -1 +0,0 @@
Subproject commit eb4b36559de8d17015f9416861ed085d06f5f5ed
Loading…
Cancel
Save