#include <stdio.h>
#include <termio.h>
#include <sys/fcntl.h>

main(int argc, char *argv[]) 
{
	struct termios tp;
	int fd;
	char buf[80];

	if (argc < 2) {
		printf("Must give me a terminal name\n");
		exit(-1);
	}

	if ((fd = open(argv[1], O_RDONLY)) < 0) {
		printf("bad terminal device, try another\n");
		exit(-1);
	}
	
	if (tcgetattr(fd, &tp) < 0) {
		printf("Couldn't get term attributes");
		exit(-1);
	}

	printf("iflag - 0%o; oflag - 0%o; cflag - 0%o; lflag - 0%o\n",
			tp.c_iflag, tp.c_oflag, tp.c_cflag, tp.c_lflag);
	
}