OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [sys/] [sysvi386/] [tcline.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
#define _NO_MACROS
#define _NO_MACROS
#include <sys/unistd.h>
#include <sys/unistd.h>
#include <sys/termios.h>
#include <sys/termios.h>
#include <errno.h>
#include <errno.h>
 
 
int
int
tcsendbreak (int fd, int dur) {
tcsendbreak (int fd, int dur) {
        do {
        do {
                if (_ioctl (fd, _TCSBRK, 0) == -1)
                if (_ioctl (fd, _TCSBRK, 0) == -1)
                        return -1;
                        return -1;
        } while (dur--);
        } while (dur--);
        return 0;
        return 0;
}
}
 
 
int
int
tcdrain (int fd) {
tcdrain (int fd) {
        return _ioctl (fd, _TCSBRK, 1);
        return _ioctl (fd, _TCSBRK, 1);
}
}
 
 
int
int
tcflush(int fd, int what) {
tcflush(int fd, int what) {
        return _ioctl (fd, _TCFLSH, what);
        return _ioctl (fd, _TCFLSH, what);
}
}
 
 
/*
/*
 * I'm not positive about this function.  I *think* it's right,
 * I'm not positive about this function.  I *think* it's right,
 * but I could be missing something.
 * but I could be missing something.
 */
 */
 
 
int
int
tcflow (int fd, int action) {
tcflow (int fd, int action) {
        struct termios t;
        struct termios t;
 
 
        switch (action) {
        switch (action) {
        case TCOOFF:
        case TCOOFF:
        case TCOON:
        case TCOON:
                return _ioctl (fd, _TCXONC, action);
                return _ioctl (fd, _TCXONC, action);
/*
/*
 * Here is where I'm not terribly certain.  1003.1 says:
 * Here is where I'm not terribly certain.  1003.1 says:
 * if action is TCIOFF, the system shall transmit a STOP
 * if action is TCIOFF, the system shall transmit a STOP
 * character, which is intended to cause the terminal device
 * character, which is intended to cause the terminal device
 * to stop transmitting data to the system.  (Similarly for
 * to stop transmitting data to the system.  (Similarly for
 * TCION.)
 * TCION.)
 * I *assume* that means I find out what VSTOP for the
 * I *assume* that means I find out what VSTOP for the
 * terminal device is, and then write it.  1003.1 also does
 * terminal device is, and then write it.  1003.1 also does
 * not say what happens if c_cc[VSTOP] is _POSIX_VDISABLE;
 * not say what happens if c_cc[VSTOP] is _POSIX_VDISABLE;
 * I assume it should reaturn EINVAL, so that's what I do.
 * I assume it should reaturn EINVAL, so that's what I do.
 * Anyway, here's the code.  It might or might not be right.
 * Anyway, here's the code.  It might or might not be right.
 */
 */
        case TCIOFF:
        case TCIOFF:
                if (tcgetattr (fd, &t) == -1)
                if (tcgetattr (fd, &t) == -1)
                        return -1;
                        return -1;
                if (tcgetattr (fd, &t) == -1)
                if (tcgetattr (fd, &t) == -1)
                        return -1;
                        return -1;
#ifdef _POSIX_VDISABLE
#ifdef _POSIX_VDISABLE
                if (t.c_cc[VSTOP] == _POSIX_VDISABLE) {
                if (t.c_cc[VSTOP] == _POSIX_VDISABLE) {
                        errno = EINVAL;
                        errno = EINVAL;
                        return -1;
                        return -1;
                }
                }
#endif
#endif
                if (write (fd, &t.c_cc[VSTOP], 1) == 1)
                if (write (fd, &t.c_cc[VSTOP], 1) == 1)
                        return 0;
                        return 0;
                else
                else
                        return -1;
                        return -1;
        case TCION:
        case TCION:
                if (tcgetattr (fd, &t) == -1)
                if (tcgetattr (fd, &t) == -1)
                        return -1;
                        return -1;
                if (tcgetattr (fd, &t) == -1)
                if (tcgetattr (fd, &t) == -1)
                        return -1;
                        return -1;
#ifdef _POSIX_VDISABLE
#ifdef _POSIX_VDISABLE
                if (t.c_cc[VSTART] == _POSIX_VDISABLE) {
                if (t.c_cc[VSTART] == _POSIX_VDISABLE) {
                        errno = EINVAL;
                        errno = EINVAL;
                        return -1;
                        return -1;
                }
                }
#endif
#endif
                if (write (fd, &t.c_cc[VSTART], 1) == 1)
                if (write (fd, &t.c_cc[VSTART], 1) == 1)
                        return 0;
                        return 0;
                else
                else
                        return -1;
                        return -1;
        default:
        default:
                errno = EINVAL;
                errno = EINVAL;
                return -1;
                return -1;
        }
        }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.