Posted to tcl by mookie at Thu Sep 17 13:40:32 GMT 2026view pretty
#include <ncurses.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h> // Required for time()
void draw_footer() {
int row, col;
getmaxyx(stdscr, row, col);
// Move to the bottom
move(row - 2, 0);
// Draw a line of dashes for the top of the bar
for(int i = 0; i < col; i++) {
addch('-');
}
// Print status text on the last line
move(row - 1, 0);
// Get current time
time_t t = time(NULL);
struct tm *tm = localtime(&t);
char time_str[20];
strftime(time_str, sizeof(time_str), "%H:%M:%S", tm);
printw(" STATUS: ONLINE | CRYSTAL FOREST | TIME: %s ", time_str);
}
int main() {
char ip_address[50];
initscr();
cbreak();
keypad(stdscr, TRUE);
noecho();
curs_set(0); // Hide cursor for a cleaner look
// Draw the Footer first (it sits at the bottom)
draw_footer();
// Draw the Title at the top
mvprintw(1, (COLS - 27) / 2, "NEONCRYSTAL TUI SYSTEM v1.0");
refresh();
// Draw the Connection Box in the center
int height = 5;
int width = 40;
int starty = (LINES - height) / 2;
int startx = (COLS - width) / 2;
WINDOW *my_win = newwin(height, width, starty, startx);
box(my_win, 0, 0);
mvwprintw(my_win, 1, 1, "BANDIT BALLOON CONNECTION");
mvwprintw(my_win, 2, 1, "Target IP:");
wrefresh(my_win);
// Enable echo for typing
echo();
mvwgetnstr(my_win, 3, 2, ip_address, 49);
noecho();
// Update Footer with connection status
move(LINES - 1, 0);
clrtoeol(); // Clear the previous text
mvprintw(LINES - 1, 0, " STATUS: CONNECTING TO %s...", ip_address);
refresh();
sleep(2); // Simulate connection
// Success
mvprintw(LINES / 2, (COLS - 25) / 2, "NEONCRYSTAL WELCOMES YOU");
refresh();
getch(); // Wait for input
endwin();
return 0;
}