1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Move setup_console() to terminal.c

This commit is contained in:
jsteube 2016-09-28 23:40:16 +02:00
parent f7fe6b1491
commit de21c005fd
3 changed files with 32 additions and 30 deletions

View File

@ -23,6 +23,8 @@
#include <windows.h>
#endif // _WIN
int setup_console ();
void send_prompt ();
void clear_prompt ();

View File

@ -130,36 +130,6 @@ static void setup_umask ()
umask (077);
}
static int setup_console ()
{
#if defined (_WIN)
SetConsoleWindowSize (132);
if (_setmode (_fileno (stdin), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stdin", strerror (errno));
return -1;
}
if (_setmode (_fileno (stdout), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stdout", strerror (errno));
return -1;
}
if (_setmode (_fileno (stderr), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stderr", strerror (errno));
return -1;
}
#endif
return 0;
}
static void setup_seeding (const user_options_t *user_options, const time_t *proc_start)
{
if (user_options->rp_gen_seed_chgd == true)

View File

@ -36,6 +36,36 @@ extern hc_thread_mutex_t mux_display;
const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
int setup_console ()
{
#if defined (_WIN)
SetConsoleWindowSize (132);
if (_setmode (_fileno (stdin), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stdin", strerror (errno));
return -1;
}
if (_setmode (_fileno (stdout), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stdout", strerror (errno));
return -1;
}
if (_setmode (_fileno (stderr), _O_BINARY) == -1)
{
log_error ("ERROR: %s: %s", "stderr", strerror (errno));
return -1;
}
#endif
return 0;
}
void send_prompt ()
{
fprintf (stdout, "%s", PROMPT);