diff options
author | charmlesscoin <charmlesscoin@gmail.com> | 2013-08-02 22:34:45 -0400 |
---|---|---|
committer | charmlesscoin <charmlesscoin@gmail.com> | 2013-08-02 22:34:45 -0400 |
commit | b9e3bf1fa61aac975abe54586e1928f25767ff0a (patch) | |
tree | 02bb76b29ad08fe4102c6e3d86853e4fa1b3e206 /testing | |
parent | 3678b302dbf2b202afe9e53b46153da69ecbb28e (diff) |
changed some formatting, fixed the removal of x and y
Diffstat (limited to 'testing')
-rw-r--r-- | testing/nTox.c | 16 | ||||
-rw-r--r-- | testing/nTox.h | 3 |
2 files changed, 12 insertions, 7 deletions
diff --git a/testing/nTox.c b/testing/nTox.c index 4989f88a..a498e9a1 100644 --- a/testing/nTox.c +++ b/testing/nTox.c | |||
@@ -36,11 +36,12 @@ | |||
36 | char lines[HISTORY][STRING_LENGTH]; | 36 | char lines[HISTORY][STRING_LENGTH]; |
37 | char line[STRING_LENGTH]; | 37 | char line[STRING_LENGTH]; |
38 | 38 | ||
39 | char *help = "[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status)\n" | 39 | char *help = "[i] commands:\n/f ID (to add friend)\n/m friendnumber message " |
40 | "[i] /l list (list friends), /h for help, /i for info, /n nick (to change nickname), /q (to quit)"; | 40 | "(to send message)\n/s status (to change status)\n[i] /l list (l" |
41 | "ist friends)\n/h for help\n/i for info\n/n nick (to change nick" | ||
42 | "name)\n/q (to quit)"; | ||
41 | int x, y; | 43 | int x, y; |
42 | 44 | ||
43 | |||
44 | uint8_t pending_requests[256][CLIENT_ID_SIZE]; | 45 | uint8_t pending_requests[256][CLIENT_ID_SIZE]; |
45 | uint8_t num_requests = 0; | 46 | uint8_t num_requests = 0; |
46 | 47 | ||
@@ -126,7 +127,7 @@ char *format_message(char *message, int friendnum) | |||
126 | return msg; | 127 | return msg; |
127 | } | 128 | } |
128 | 129 | ||
129 | void line_eval(char lines[HISTORY][STRING_LENGTH], char *line) | 130 | void line_eval(char *line) |
130 | { | 131 | { |
131 | if (line[0] == '/') { | 132 | if (line[0] == '/') { |
132 | char inpt_command = line[1]; | 133 | char inpt_command = line[1]; |
@@ -410,13 +411,16 @@ int main(int argc, char *argv[]) | |||
410 | 411 | ||
411 | char idstring[200]; | 412 | char idstring[200]; |
412 | get_id(idstring); | 413 | get_id(idstring); |
414 | |||
413 | initscr(); | 415 | initscr(); |
414 | noecho(); | 416 | noecho(); |
415 | raw(); | 417 | raw(); |
416 | getmaxyx(stdscr, y, x); | 418 | getmaxyx(stdscr, y, x); |
419 | |||
420 | new_lines("/h for list of commands"); | ||
417 | new_lines(idstring); | 421 | new_lines(idstring); |
418 | new_lines(help); | ||
419 | strcpy(line, ""); | 422 | strcpy(line, ""); |
423 | |||
420 | IP_Port bootstrap_ip_port; | 424 | IP_Port bootstrap_ip_port; |
421 | bootstrap_ip_port.port = htons(atoi(argv[2])); | 425 | bootstrap_ip_port.port = htons(atoi(argv[2])); |
422 | int resolved_address = resolve_addr(argv[1]); | 426 | int resolved_address = resolve_addr(argv[1]); |
@@ -443,7 +447,7 @@ int main(int argc, char *argv[]) | |||
443 | 447 | ||
444 | getmaxyx(stdscr, y, x); | 448 | getmaxyx(stdscr, y, x); |
445 | if (c == '\n') { | 449 | if (c == '\n') { |
446 | line_eval(lines, line); | 450 | line_eval(line); |
447 | strcpy(line, ""); | 451 | strcpy(line, ""); |
448 | } else if (c == 127) { | 452 | } else if (c == 127) { |
449 | line[strlen(line)-1] = '\0'; | 453 | line[strlen(line)-1] = '\0'; |
diff --git a/testing/nTox.h b/testing/nTox.h index 9d82556c..47c73513 100644 --- a/testing/nTox.h +++ b/testing/nTox.h | |||
@@ -37,12 +37,13 @@ | |||
37 | #include <netdb.h> | 37 | #include <netdb.h> |
38 | #include "../core/Messenger.h" | 38 | #include "../core/Messenger.h" |
39 | #include "../core/network.h" | 39 | #include "../core/network.h" |
40 | |||
40 | #define STRING_LENGTH 256 | 41 | #define STRING_LENGTH 256 |
41 | #define HISTORY 50 | 42 | #define HISTORY 50 |
42 | #define PUB_KEY_BYTES 32 | 43 | #define PUB_KEY_BYTES 32 |
43 | 44 | ||
44 | void new_lines(char *line); | 45 | void new_lines(char *line); |
45 | void line_eval(char lines[HISTORY][STRING_LENGTH], char *line); | 46 | void line_eval(char *line); |
46 | void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ; | 47 | void wrap(char output[STRING_LENGTH], char input[STRING_LENGTH], int line_width) ; |
47 | int count_lines(char *string) ; | 48 | int count_lines(char *string) ; |
48 | char *appender(char *str, const char c); | 49 | char *appender(char *str, const char c); |