implemented CLEAR_AND_GO_UP in chat stuff

This commit is contained in:
Václav Šmejkal 2023-03-12 14:44:55 +01:00
parent 899b79941b
commit eedea02701
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
3 changed files with 4 additions and 2 deletions

View File

@ -38,4 +38,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#define SERVER_PORT 1204 #define SERVER_PORT 1204
#define MAX_CONNECTIONS 1000 #define MAX_CONNECTIONS 1000
#define CLEAR_AND_GO_UP "\33[2K\r\033[A"
#endif #endif

View File

@ -56,7 +56,7 @@ int main(void)
for (;;) for (;;)
{ {
getline(&line, &line_length, stdin); getline(&line, &line_length, stdin);
printf("\33[2K\r\033[A"); printf(CLEAR_AND_GO_UP);
why2_send_socket(line, listen_socket); why2_send_socket(line, listen_socket);

View File

@ -273,7 +273,7 @@ void *why2_listen_server(void *socket)
for (;;) for (;;)
{ {
read = why2_read_socket(*((int*) socket)); //TODO: Fix other user message formatting read = why2_read_socket(*((int*) socket)); //TODO: Fix other user message formatting
printf("\33[2K\r\033[A"); printf(CLEAR_AND_GO_UP);
printf("%s\n>>> ", read); printf("%s\n>>> ", read);
fflush(stdout); fflush(stdout);