diff options
author | fadhil riyanto <me@fadev.org> | 2024-08-17 17:22:13 +0700 |
---|---|---|
committer | fadhil riyanto <me@fadev.org> | 2024-08-17 17:22:13 +0700 |
commit | 4e24d62b0f928cc9d5c8ba95ec973385257e59b9 (patch) | |
tree | a27d80e9c5b70f56926ed9b5b6ffc511b7a8beaf /init.c | |
parent | fcc81c7f8e6efab177a55238188f5ea1e3db7734 (diff) |
test execve
Signed-off-by: fadhil riyanto <me@fadev.org>
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -119,21 +119,32 @@ static void exec_xsetroot(struct gc_data *gc, char** envp, char* text) execve(XSETROOT_PATH, args, envp); } - int main(int argc, char **argv, char *envp[]) { signal(SIGINT, signal_handler); struct gc_data gc; + char randombuf[100]; + setup_fd(&gc); - // while (!need_exit) { - // get_bat_num(&gc); - // char* cropped = newline_cut(gc.bat0bufptr, &gc); + while (!need_exit) { + memset(randombuf, '\0', 100); + + get_bat_num(&gc); + char* battery = newline_cut(gc.bat0bufptr, &gc); + char* time = newline_cut(get_time(), &gc); + + snprintf(randombuf, 100, "%s %s %s", time, battery, DESKTOP_NAME); - // free(cropped); - // } - exec_xsetroot(&gc, envp, "tes aaa st"); + exec_xsetroot(&gc, envp, randombuf); + + free(battery); + free(time); + + sleep(1); + } + run_garbage_collector_clear(&gc); return 0; |