diff --git a/ssheven-console.c b/ssheven-console.c index 3f49215..bf3bc67 100644 --- a/ssheven-console.c +++ b/ssheven-console.c @@ -107,6 +107,22 @@ void print_char(char c) } } +void print_int(int d) +{ + char itoc[] = {'0','1','2','3','4','5','6','7','8','9'}; + + char buffer[12] = {0}; + int i = 10; + + for (; d > 0; i--) + { + buffer[i] = itoc[d % 10]; + d /= 10; + } + + print_string(buffer+i+1); +} + void print_string_i(const char* c) { print_string(c); diff --git a/ssheven-console.h b/ssheven-console.h index 253442e..036ac88 100644 --- a/ssheven-console.h +++ b/ssheven-console.h @@ -22,6 +22,7 @@ int is_printable(char c); void print_char(char c); void print_string(const char* c); void print_string_i(const char* c); +void print_int(int d); void set_window_title(WindowPtr w, const char* c_name);