Rename folders
This commit is contained in:
parent
4d3bb95e78
commit
ceacd1306f
4 changed files with 9 additions and 19 deletions
|
@ -48,7 +48,7 @@ void ncurses_init()
|
||||||
{
|
{
|
||||||
/* check if it is interactive shell */
|
/* check if it is interactive shell */
|
||||||
if (!isatty(STDIN_FILENO)) {
|
if (!isatty(STDIN_FILENO)) {
|
||||||
error(1, "No tty detected. zsm requires an interactive shell to run");
|
error(1, "No tty detected. zen requires an interactive shell to run");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize screen, don't print special chars,
|
/* initialize screen, don't print special chars,
|
||||||
|
@ -562,13 +562,13 @@ void ncurses_deinit()
|
||||||
/*
|
/*
|
||||||
* Main loop of user interface
|
* Main loop of user interface
|
||||||
*/
|
*/
|
||||||
void ui(int fd)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
signal(SIGPIPE, signal_handler);
|
signal(SIGPIPE, signal_handler);
|
||||||
signal(SIGABRT, signal_handler);
|
signal(SIGABRT, signal_handler);
|
||||||
signal(SIGINT, signal_handler);
|
signal(SIGINT, signal_handler);
|
||||||
signal(SIGTERM, signal_handler);
|
signal(SIGTERM, signal_handler);
|
||||||
sockfd = fd;
|
connect_server();
|
||||||
ncurses_init();
|
ncurses_init();
|
||||||
windows_init();
|
windows_init();
|
||||||
users = arraylist_init(LINES);
|
users = arraylist_init(LINES);
|
||||||
|
@ -579,27 +579,18 @@ void ui(int fd)
|
||||||
refresh();
|
refresh();
|
||||||
int ch;
|
int ch;
|
||||||
while (1) {
|
while (1) {
|
||||||
/*
|
|
||||||
if (COLS < 80 || LINES < 24) {
|
|
||||||
endwin();
|
|
||||||
error(1, "Terminal size needs to be at least 80x24");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (current_window == CHAT_WINDOW) {
|
if (current_window == CHAT_WINDOW) {
|
||||||
wclear(textbox);
|
wclear(textbox);
|
||||||
mvwprintw(textbox, 0, 0, "> %s", content);
|
mvwprintw(textbox, 0, 0, "> %s", content);
|
||||||
wrefresh(textbox);
|
wrefresh(textbox);
|
||||||
wmove(textbox, 0, curs_pos + 2);
|
wmove(textbox, 0, curs_pos + 2);
|
||||||
|
/* Set cursor to visible */
|
||||||
curs_set(2);
|
curs_set(2);
|
||||||
} else {
|
} else {
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
}
|
}
|
||||||
ch = getch();
|
ch = getch();
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case CTRLD:
|
|
||||||
ncurses_deinit();
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* go up by k or up arrow */
|
/* go up by k or up arrow */
|
||||||
case UP:
|
case UP:
|
||||||
if (current_window == USERS_WINDOW) {
|
if (current_window == USERS_WINDOW) {
|
||||||
|
@ -645,5 +636,6 @@ void ui(int fd)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
ncurses_deinit();
|
||||||
|
return 0;
|
||||||
}
|
}
|
|
@ -7,8 +7,6 @@
|
||||||
#include "client/db.h"
|
#include "client/db.h"
|
||||||
#include "server/server.h"
|
#include "server/server.h"
|
||||||
|
|
||||||
int sockfd;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Authenticate with server by signing a challenge
|
* Authenticate with server by signing a challenge
|
||||||
*/
|
*/
|
||||||
|
@ -132,7 +130,7 @@ int main()
|
||||||
error(1, "Error initializing libnotify");
|
error(1, "Error initializing libnotify");
|
||||||
}
|
}
|
||||||
|
|
||||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
int sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
error(1, "Error on opening socket");
|
error(1, "Error on opening socket");
|
||||||
}
|
}
|
||||||
|
@ -149,8 +147,8 @@ int main()
|
||||||
memcpy(&server_addr.sin_addr.s_addr, server->h_addr, server->h_length);
|
memcpy(&server_addr.sin_addr.s_addr, server->h_addr, server->h_length);
|
||||||
|
|
||||||
/* free(server); Can't be freed seems */
|
/* free(server); Can't be freed seems */
|
||||||
if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)
|
if (connect(sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr))
|
||||||
) < 0) {
|
< 0) {
|
||||||
error(1, "Error on connect");
|
error(1, "Error on connect");
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
return 0;
|
return 0;
|
Loading…
Reference in a new issue