/* * Copyright (c) 1995, 1996 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include void logtermios(struct termios *tio) { printf("termios: " "i(0x%04hx) o(0x%04hx) c(0x%04hx) l(0x%04hx) ln(0x%04hx)\n", tio->c_iflag, tio->c_oflag, tio->c_cflag, tio->c_lflag, tio->c_reserved); } main() { struct termios tio; int fd = open("/dev/lpp", O_RDWR); if(fd == -1) { perror("open"); exit(1); } tio.c_iflag = 0x0123; tio.c_oflag = 0x4567; tio.c_cflag = 0x89ab; tio.c_lflag = 0xcdef; tio.c_reserved = 5; tio.c_cc[0] = 0; tio.c_cc[1] = 1; tio.c_cc[2] = 2; tio.c_cc[3] = 3; tio.c_cc[4] = 4; logtermios(&tio); if(ioctl(fd, TCSETATTRF, &tio) == -1) { perror("TCSETAF"); exit(1); } exit(0); }