changed some formatting, fixed the removal of x and y

This commit is contained in:
charmlesscoin 2013-08-02 22:34:45 -04:00
parent 3678b302db
commit b9e3bf1fa6
2 changed files with 12 additions and 7 deletions

View File

@ -36,11 +36,12 @@
char lines[HISTORY][STRING_LENGTH];
char line[STRING_LENGTH];
char *help = "[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status)\n"
"[i] /l list (list friends), /h for help, /i for info, /n nick (to change nickname), /q (to quit)";
char *help = "[i] commands:\n/f ID (to add friend)\n/m friendnumber message "
"(to send message)\n/s status (to change status)\n[i] /l list (l"
"ist friends)\n/h for help\n/i for info\n/n nick (to change nick"
"name)\n/q (to quit)";
int x, y;
uint8_t pending_requests[256][CLIENT_ID_SIZE];
uint8_t num_requests = 0;
@ -126,7 +127,7 @@ char *format_message(char *message, int friendnum)
return msg;
}
void line_eval(char lines[HISTORY][STRING_LENGTH], char *line)
void line_eval(char *line)
{
if (line[0] == '/') {
char inpt_command = line[1];
@ -410,13 +411,16 @@ int main(int argc, char *argv[])
char idstring[200];
get_id(idstring);
initscr();
noecho();
raw();
getmaxyx(stdscr, y, x);
new_lines("/h for list of commands");
new_lines(idstring);
new_lines(help);
strcpy(line, "");
IP_Port bootstrap_ip_port;
bootstrap_ip_port.port = htons(atoi(argv[2]));
int resolved_address = resolve_addr(argv[1]);
@ -443,7 +447,7 @@ int main(int argc, char *argv[])
getmaxyx(stdscr, y, x);
if (c == '\n') {
line_eval(lines, line);
line_eval(line);
strcpy(line, "");
} else if (c == 127) {
line[strlen(line)-1] = '\0';

View File

@ -37,12 +37,13 @@
#include <netdb.h>
#include "../core/Messenger.h"
#include "../core/network.h"
#define STRING_LENGTH 256
#define HISTORY 50
#define PUB_KEY_BYTES 32
void new_lines(char *line);
void line_eval(char lines[HISTORY][STRING_LENGTH], char *line);
void line_eval(char *line);
void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ;
int count_lines(char *string) ;
char *appender(char *str, const char c);