mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Improved error output
This commit is contained in:
parent
0ccdeeeb7d
commit
960d59cbc4
1 changed files with 3 additions and 2 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "gotty/tty.h"
|
#include "gotty/tty.h"
|
||||||
#include "gotty/print.h"
|
#include "gotty/print.h"
|
||||||
#include "gotty/options.h"
|
#include "gotty/options.h"
|
||||||
|
|
@ -94,14 +95,14 @@ int connect_tty(void)
|
||||||
fd = open(option.device, O_RDWR | O_NOCTTY );
|
fd = open(option.device, O_RDWR | O_NOCTTY );
|
||||||
if (fd <0)
|
if (fd <0)
|
||||||
{
|
{
|
||||||
perror(option.device);
|
printf("\033[300DError: %s\n\033[300D", strerror(errno));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure device is of tty type */
|
/* Make sure device is of tty type */
|
||||||
if (!isatty(fd))
|
if (!isatty(fd))
|
||||||
{
|
{
|
||||||
printf("Error: Not a tty device");
|
printf("\033[300DError: Not a tty device\n\033[300D");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue