-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsttyl.c
44 lines (37 loc) · 1.06 KB
/
sttyl.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* sttyl - is a light weight version of stty, and attempts to mimic some of the
* functionality provided by stty.
* date: 3/2/2017
* author: Tasuku Miura
*/
#include <ctype.h>
#include <stdio.h>
#include <termios.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include "sttyltables.h"
#include "sttylutil.h"
/**
** showttyl
** Displays some of current tty settings and capable of setting select number
** of modes.
**/
int main(int argc, char**argv)
{
struct termios ttyinfo; /* this struct holds tty info */
if (tcgetattr(0 , &ttyinfo) == -1 ){ /* get info */
perror( "cannot get params about stdin");
exit(1);
}
if (argc < 2) {
display_info(&ttyinfo);
} else {
//TODO: the characters after special chars should not trigger invalid
//response...this needs to be fixed.
check_valid(argc, argv);
set_specialchars(&ttyinfo, argc, argv);
set_modes(&ttyinfo, argc, argv);
}
return 0;
}