termios-0.3.3/.gitignore010064400017500001750000000000241325626224500134130ustar0000000000000000/target /Cargo.lock termios-0.3.3/.travis.yml010064400017500001750000000001151335667252600135450ustar0000000000000000language: rust cache: cargo rust: - 1.13.0 - stable - beta - nightly termios-0.3.3/CHANGELOG.md010064400017500001750000000044041364246635500132510ustar0000000000000000# Change Log ## 0.3.2 (2020-04-05) ### Added * ([#22](https://github.com/dcuddeback/termios-rs/pull/22)) Added support for NetBSD. * ([#21](https://github.com/dcuddeback/termios-rs/pull/21)) Added support for illumos. ## 0.3.1 (2018-10-08) ### Added * ([#19](https://github.com/dcuddeback/termios-rs/pull/19)) Added support for Android. ### Changed * Minimum supported version of Rust is now 1.13.0. ## 0.3.0 (2017-12-03) ### Added * ([#6](https://github.com/dcuddeback/termios-rs/pull/6)) Added DragonflyBSD support. ### Removed * Removed `TAB3` from top-level export. ## 0.2.2 (2016-01-26) ### Added * ([#5](https://github.com/dcuddeback/termios-rs/pull/5)) Added OpenBSD support. ## 0.2.1 (2015-11-04) ### Changed * Bumped `libc` dependency to v0.2.0. ## 0.2.0 (2015-10-15) ### Added * ([#3](https://github.com/dcuddeback/termios-rs/pull/3)) Added FreeBSD support. ### Removed * Removed top-level export for `c_oflag` values that are not supported globally. ## 0.1.0 (2015-05-02) ### Added * Added safe wrapper for `tcgetsid()`. * Converted `Termios` to a wrapper struct with `Deref` and `DerefMut` implementations to access the inner `termios` struct. * Export target-specific modules as `os::{platform}`. ### Changed * Export target OS module as `os::target` instead of `os`. ### Removed * Removed `Default` implementation for `Termios`. * Removed `Termios::zeroed()`. ### Changed * Replaced `c_int` with `RawFd`. ## 0.0.5 (2015-04-07) ### Fixed * ([#2](https://github.com/dcuddeback/termios-rs/pull/2)) Updated for compatibility with the new Rust beta channel: - `libc` is now an external crate. ## 0.0.4 (2015-04-03) ### Fixed * Updated for compatibility with 1.0.0-beta: - Implementing `Copy` now requires implementing `Clone`. ## 0.0.3 (2015-03-29) ### Changed * Migrated from `std::old_io` to `std::io`. ## 0.0.2 (2015-02-10) ### Added * ([#1](https://github.com/dcuddeback/termios-rs/pull/1)) Implement `PartialEq` and `Eq` for `Termios` struct. ### Fixed * ([#1](https://github.com/dcuddeback/termios-rs/pull/1)) Updated for compatibility with latest Rust nightly: - `std::io` renamed to `std::old_io`. - `Show` renamed to `Debug`. ## 0.0.1 (2015-02-01) ### Addded * Added Linux support. * Added OS X support. * Added safe wrappers for termios API. termios-0.3.3/CONTRIBUTING.md010064400017500001750000000324741364246635500137010ustar0000000000000000# Contributing Termios is a pervasive API on Unix-like systems. One person can't possibly be an expert is all of the platforms that `termios-rs` may want to target. This document provides guidelines for how we can work together as complete strangers while maintaining a high standard for quality. ## General Guidelines * Above all, don't be a jerk. You won't get what you want that way. * Please try to keep discussion focused on improving this project. Don't use the issue tracker to promote other projects. A brief mention of another project as it relates to the development of this project is okay. This also isn't the place for political activism. * Remember that nobody is paid to work on this project. There are no contractual obligations, and no promises have been made. Maintainers have friends, family, kids, hobbies, and responsibilities outside of this project. Please calibrate your expectations accordingly. * Maintainers have the final say. The maintainers are not your co-workers and they don't work for you. Please calibrate your expectations accordingly. * Avoid "+1" or similar comments. Try to find a more constructive way to move the project forward. A comment with how you've tested a patch and your results adds more value than "+1" while serving the same purpose. See "[Reviewing Patches](#reviewing-patches)" below for ideas of how you can help. * If you want to see something get done, the best way is to roll up your sleeves and do it. Read below for details on how you can help. ## Moderating Some people just don't know how to behave on the internet. Unfortunately, this is one of the leading causes for maintainers to walk away from their projects. That makes moderating user behavior one of most important things that any mentally-stable adult can do to contribute to an open source project. Being a moderator doesn't require being blessed with a special status. Anyone can help. If you see anyone being rude, acting with a sense of entitlement, putting down others or their work, arguing in bad faith, or in any other way making the project an unpleasant place to spend one's time, please call out the bad behavior. As a maintainer, it helps to see that we're not on our own when dealing with bad behavior. This includes enforcing theses contributing guidelines. If you see patches or issues that don't appear to be based on these guidelines, please ask the submitter to provide the missing details. If you'd prefer to email me privately about someone's behavior, please do so. My email can be found in public profiles or the project's commit history. ## Adding Support for New Platforms The currently supported platforms are listed in the README. If an operating system and architecture aren't listed there, it means that nobody has confirmed that `termios-rs` works on that platform. The following sections describe different ways that one can help add support for a new platform. The guidelines in this section are meant to increase the chances that a patch can land smoothly the first time that a maintainer reviews it. ### Sending Patches Patches should be based on reading the C header file `termios.h`. This is often located at `/usr/include/termios.h` or `/usr/include/sys/termios.h`. You may have to install a package to get the header files. IMPORTANT: Please do not count on a platform being so similar to another platform that you can just copy the definitions. I'm pretty sure every patch that has been submitted that way has proven the assumption to be wrong. That just wastes everyone's time. Don't submit patches without testing them. To make a patch for a new platform, you'll need to setup the target platform with a working Rust compiler and `termios.h` header file. Sometimes a working C compiler can help, too. Please take note of the steps you use to setup your platform so that you can provide testing guidance when submitting your patch. See "[Testing Guidance](#testing-guidance)," for details. 1. Start by creating a new file in `src/os/` for the target platform. To keep things consistent, pick a name that matches the value of Rust's `target_os` configuration variable, e.g., `src/os/freebsd.rs`. 2. Adjust the `use` and `mod` items in `src/os/mod.rs`. 3. Add an example to the doctest under "OS-Specific Extensions" in `src/lib.rs`. `cargo test` won't pass without it. 3. Read through the `termios.h` header file and transliterate it to Rust. Someone reading through the Rust file and C header file side-by-side should be able to easily verify that they produce the same values. That means: * Values in the Rust file should be defined in the same radix (decimal, octal, hexidecimal) as the C header file. * Definitions should appear roughly in the same order that they appear in the C header file. Please try to keep them grouped similar to other platforms. That means keeping `c_cc` character indexes together, `c_iflag` bits together, `c_oflag` bits together, etc. But within each of those groups, match the order of the C header file. One exception to transliterating the header file is to expand macros to their literal value. For example, ```c #define _TIOC 'T' #define TCSANOW (_TIOC|14) ``` should be reduced to ```rust pub const TCSANOW: c_int = 0x005E; ``` In this case, simplicity is the overriding concern. This is where having a C compiler on the target platform can help. To avoid error in computing the literal value, you can let a C compiler do it for you: ```c #include #include #include int main(void) { printf("TCSANOW = 0x%04X\n", TCSANOW); return EXIT_SUCCESS; } ``` 4. Check which of the functions in `src/ffi.rs` the target platform implements (look for them in `termios.h`). If the target platform doesn't implement one or more of them, adjust the `#[cfg]` items in `src/ffi.rs` to use the fallback imlementations. (`cfmakeraw()` and `cfsetspeed()` are technically not part of the [POSIX standard for termios][posix]. Many operating systems provide them, but some do not.) 5. Make sure `cargo build` and `cargo test` for `termios-rs` both pass on the target platform. 6. Optionally, test some projects that depend on `termios-rs`. Some popular projects that depend on `termios-rs` include: * [`serial-rs`](https://github.com/dcuddeback/serial-rs) * [`bat`](https://github.com/sharkdp/bat) When submitting a patch, please provide testing guidance. See the section, "[Testing Guidance](#testing-guidance)," for details. ### Reviewing Patches The best way to help land an existing patch is to review it. If you review a patch, please leave a review comment on its submission so that maintainers can see how many eyes have looked at a patch. If you don't comment, we won't know. And commenting on a patch with what you've done to review and test it is much more helpful than "+1" comments. See the section, "[Testing](#testing)," for details on how to test a patch. If you tested something that others hadn't, such as a different version of an operating system or a different reverse dependency, please comment with details of what you tested and the results. Check the patch for conformance to the guidelines described in "[Sending Patches](#sending-patches)." Feel free to add line comments where you spot anything that looks incorrect. Whether or not you spot any errors, please leave a review comment so that maintainers know how much peer-review a patch has received. Make sure that the patch was submitted with sufficient testing guidance. See the section, "[Testing Guidance](#testing-guidance)," for details. If the guidance seems incomplete, ask the submitter to provide additional details or add the relevant details yourself if you can. If you have an alternative way of testing, feel free to provide those details according to the "[Testing Guidance](#testing-guidance)" section. ### Testing If you're interested in a different architecture of an existing operating system, it may be just a matter of testing the new architecture. Or if you see a patch for a platform you're interested in, you can help test that patch, too. To test platform support, you'll need to have a working Rust compiler on the target platform, and you'll need the C header files for `termios`. A working C compiler can help, too. 1. Find the Rust definitions for the platform you're testing. This will be in `src/os/{platform}.rs`, e.g., `src/os/freebsd.rs` for FreeBSD. 2. Find the C header file for your platform. This is often located at `/usr/include/termios.h` or `/usr/include/sys/termios.h`. On some platforms, you may have to install a package to get the header files. (If so, please report which package.) 3. Verify that the definitions in the Rust code match the definitions from the C header file. If reviewing a new patch submission, verify that the values are defined in the same radix as the C header file and are defined in roughly the same order. If the submitter followed the guidelines in "[Sending Patches](#sending-patches)," this step should go smoothly. 4. Verify that `cargo build` and `cargo test` for `termios-rs` both succeed on the target platform. 5. Optionally, test some projects that depend on `termios-rs`. Some popular projects that depend on `termios-rs` include: * [`serial-rs`](https://github.com/dcuddeback/serial-rs) * [`bat`](https://github.com/sharkdp/bat) Please report back on your findings. Knowing that a platform has had several sets of eyes looking at it is helpful. If you tested a new architecture for an already-supported operating system and everything appears correct, please submit a patch to add the architecture to the list of supported platforms in the README. When submitting such a patch, please describe what you tested, including any reverse dependencies, and provide any testing guidance you can for the maintainers. See the section, "[Testing Guidance](#testing-guidance)," for details. ### Testing Guidance Before landing a patch, a maintainer will need to verify the patch on the target platform. That means a maintainer will need to setup a virtual machine running the target platform, setup SSH access, and install a working Rust compiler, `termios.h` header files, and possibly a C compiler. Any instructions you can provide to help a maintainer or other testers through those steps will help land the patch quicker. Try to be as complete and precise as possible, including full commands where appropriate. Some helpful tips could include: * How to obtain installation media for the target platform. Some platforms are made up of many distributions. Some less popular platforms may not have official Rust support or may have recently gained Rust support in their latest nightly snapshot. If this matters, please point to the release channel that provides the greatest chance of success of getting things working. At the very least, just tell us what you used (which distribution, version, and release channel, if applicable). * Any special steps to setup a virtual machine. How should the virtual hardware be setup? For less popular architectures, providing specific commands to use with QEMU or libvirt would be ideal. If you only have instructions for other hypervisors, go ahead and provide them. * How to setup and configure SSH access. What packages need to be installed? Is there a configuration file that needs to be edited? * How to install Rust and Cargo. Does `rustup` work on the target platform? Is Rust in the platform's package manager? What's the package name? Does it need to be installed from an unofficial channel? * How to install the termios header files and a C compiler. Usually these are just packages that needs to be installed. Which packages? The easier it is for a maintainer to verify a patch, the easier it will be for a maintainer to land the patch. :) ### Requesting Support for New Platforms Platforms that have been tested are listed in the README. Any platform that implements the termios API is fair game to add to `termios-rs`, so there is implicitly an open ticket for any platform not listed in the README. If you're interested in a platform that isn't listed in the README, you may open a ticket to request support, but that won't change much. Someone will need to roll up their sleeves and do the work to support it. At most, a ticket provides a place to coordinate who's working on support for a platform. ## Other Requests There may occasionally be a small enhancement worth considering, like adding a trait implementation or adding to the documentation. Go ahead and open tickets or send patches for small enhancements. Most other requests are probably out of scope. `termios-rs` aims to be a very stable, low-churn library with wide platform support. There's little value in constantly refactoring it, adding dependencies, or debating design patterns. This also isn't the place to ask for help with general programming questions or how to use the termios API. The scope of this project is to provide the Rust bindings for the termios API. The termios API itself is standardized by POSIX and provided by your operating system. The [POSIX standard][posix], your operating system's manual pages, and internet searches are your best resources for termios-specific help. [posix]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/termios.h.html termios-0.3.3/CONTRIBUTORS010064400017500001750000000004051374120337100133000ustar0000000000000000Aaron Bieber atomicules Conrad Kleinespel David Cuddeback Greg V Joshua M. Clulow Mike Zeller termios-0.3.3/Cargo.toml.orig010064400017500001750000000007031374120530300143050ustar0000000000000000[package] name = "termios" version = "0.3.3" authors = ["David Cuddeback "] description = "Safe bindings for the termios library." license = "MIT" homepage = "https://github.com/dcuddeback/termios-rs" repository = "https://github.com/dcuddeback/termios-rs" documentation = "http://dcuddeback.github.io/termios-rs/termios/" readme = "README.md" keywords = ["termios", "tty", "terminal", "posix"] [dependencies] libc = "0.2" termios-0.3.3/Cargo.toml0000644000000017270000000000000105650ustar00# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] name = "termios" version = "0.3.3" authors = ["David Cuddeback "] description = "Safe bindings for the termios library." homepage = "https://github.com/dcuddeback/termios-rs" documentation = "http://dcuddeback.github.io/termios-rs/termios/" readme = "README.md" keywords = ["termios", "tty", "terminal", "posix"] license = "MIT" repository = "https://github.com/dcuddeback/termios-rs" [dependencies.libc] version = "0.2" termios-0.3.3/LICENSE010064400017500001750000000020431325626224500124330ustar0000000000000000Copyright (c) 2015 David Cuddeback Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. termios-0.3.3/README.md010064400017500001750000000043331374116657400127200ustar0000000000000000# Termios Rust Bindings The `termios` crate provides safe bindings for the Rust programming language to the [terminal I/O interface](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/termios.h.html) implemented by Unix operating systems. The safe bindings are a small wrapper around the raw C functions, which converts integer return values to `std::io::Result` to indicate success or failure. * [Documentation](http://dcuddeback.github.io/termios-rs/termios/) ## Project Status This is a very low-maintenance project. The termios API is decades old. This isn't an area that you should expect to see daily commits, so don't be put off if you don't see commits for several years. This just means that the project is stable. That's a good thing. :) If, however, you see old patches that you'd like to see land, please see [`CONTRIBUTING.md`](CONTRIBUTING.md) to see how you can help. ## Dependencies & Compatibility In order to use the `termios` crate, you must have a native `libc` library that implements the termios API. This should be available on any Unix operating system. This library contains the termios definitions for the following platforms: * Linux (x86_64, armv6l) * Android (x86) * OS X (x86_64) * FreeBSD (amd64) * OpenBSD (amd64) * NetBSD (amd64) * DragonFly BSD (x86_64) * illumos (x86_64) If you're interested in a platform that's not listed here, please see [`CONTRIBUTING.md`](CONTRIBUTING.md) to see how you can help. ## Usage Add `termios` as a dependency in `Cargo.toml`: ```toml [dependencies] termios = "0.3" ``` Import the `termios` crate and any symbols needed from `termios`. You may also need `std::os::unix::io::RawFd` for file descriptors and `std::io::Result` to propagate errors. ```rust extern crate termios; use std::io; use std::os::unix::io::RawFd; use termios::*; fn setup_fd(fd: RawFd) -> io::Result<()> { let mut termios = try!(Termios::from_fd(fd)); termios.c_iflag = IGNPAR | IGNBRK; termios.c_oflag = 0; termios.c_cflag = CS8 | CREAD | CLOCAL; termios.c_lflag = 0; try!(cfsetspeed(&mut termios, B9600)); try!(tcsetattr(fd, TCSANOW, &termios)); try!(tcflush(fd, TCIOFLUSH)); Ok(()) } ``` ## License Copyright © 2015 David Cuddeback Distributed under the [MIT License](LICENSE). termios-0.3.3/src/ffi.rs010064400017500001750000000043371374117077000133370ustar0000000000000000//! Unsafe FFI bindings. use libc::{c_int,pid_t}; #[link(name = "c")] extern "C" { pub fn tcgetattr(fd: c_int, termios_p: *mut ::os::target::termios) -> c_int; pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios_p: *const ::os::target::termios) -> c_int; pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int; pub fn tcdrain(fd: c_int) -> c_int; pub fn tcflush(fd: c_int, queue_selector: c_int) -> c_int; pub fn tcflow(fd: c_int, action: c_int) -> c_int; #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] pub fn cfmakeraw(termios_p: *mut ::os::target::termios); pub fn cfgetispeed(termios_p: *const ::os::target::termios) -> ::os::target::speed_t; pub fn cfgetospeed(termios_p: *const ::os::target::termios) -> ::os::target::speed_t; pub fn cfsetispeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int; pub fn cfsetospeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int; #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] pub fn cfsetspeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int; pub fn tcgetsid(fd: c_int) -> pid_t; } #[cfg(any(target_os = "solaris", target_os = "illumos"))] #[no_mangle] pub unsafe extern "C" fn cfmakeraw(termios: *mut ::os::target::termios) { use ::os::target::{IMAXBEL, IGNBRK, BRKINT, PARMRK, ISTRIP, INLCR, IGNCR, ICRNL, IXON}; use ::os::target::{OPOST, ECHO, ECHONL, ICANON, ISIG, IEXTEN, CSIZE, PARENB, CS8}; use ::os::target::{VMIN, VTIME}; // Equivalent of cfmakeraw() in glibc (*termios).c_iflag &= !(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); (*termios).c_oflag &= !OPOST; (*termios).c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN); (*termios).c_cflag &= !(CSIZE | PARENB); (*termios).c_cflag |= CS8; (*termios).c_cc[VMIN] = 1; (*termios).c_cc[VTIME] = 0; } #[cfg(any(target_os = "solaris", target_os = "illumos"))] #[no_mangle] pub unsafe extern "C" fn cfsetspeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int { match cfsetispeed(termios_p, speed) { 0 => cfsetospeed(termios_p, speed), err => err, } } termios-0.3.3/src/lib.rs010064400017500001750000000443711374117077000133430ustar0000000000000000//! The `termios` crate provides Rust bindings for the POSIX termios API that is implemented on //! Unix operating systems. The termios API is defined in the [IEEE Std 1003.1 ("POSIX.1") //! specification](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html). //! //! ## Getting Started //! //! The termios API operates on file descriptors that are associated with terminal devices, e.g., //! `/dev/tty*`. When used with other file descriptors, termios functions return an error. All //! functions that are part of the POSIX standard are included in the `termios` crate. Where file //! descriptors are expected, the type `std::os::unix::io::RawFd` is used, and integer error codes //! are translated to `std::io::Result`. //! //! A major feature of the termios API is configuring a terminal device's parameters. The POSIX //! standard defines a `termios` structure that contains the parameters and several functions for //! manipulating the parameters. The `termios` crate defines a safe constructor that returns a //! [`Termios`](struct.Termios.html) struct populated with the parameters of an open terminal //! device: //! //! ```no_run //! use termios::*; //! # let fd = 1; //! let mut termios = Termios::from_fd(fd).unwrap(); //! ``` //! //! The [`Termios`](struct.Termios.html) struct provides access to the fields defined in the POSIX //! standard (`c_iflag`, `c_oflag`, `c_cflag`, `c_lflag`, and `c_cc`): //! //! ```no_run //! # use termios::*; //! # let fd = 1; //! # let mut termios = Termios::from_fd(fd).unwrap(); //! termios.c_cflag |= CREAD | CLOCAL; //! termios.c_lflag &= !(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG | IEXTEN); //! termios.c_oflag &= !OPOST; //! termios.c_iflag &= !(INLCR | IGNCR | ICRNL | IGNBRK); //! //! termios.c_cc[VMIN] = 0; //! termios.c_cc[VTIME] = 0; //! ``` //! //! The [`Termios`](struct.Termios.html) struct can also be manipulated using any of the standard //! termios API functions: //! //! ```no_run //! # use termios::*; //! # let fd = 1; //! # let mut termios = Termios::from_fd(fd).unwrap(); //! cfgetispeed(&termios); //! cfgetospeed(&termios); //! cfsetispeed(&mut termios, B9600).unwrap(); //! cfsetospeed(&mut termios, B9600).unwrap(); //! tcsetattr(fd, TCSANOW, &termios).unwrap(); //! ``` //! //! ## Portability //! //! The `termios` crate is organized in a way to help write portable code, while also allowing //! access to OS-specific functionality when necessary. //! //! The crate root contains types, constants, and function definitions that are common across Unix //! operating systems. Most of the definitions in the crate root are from the POSIX standard; //! however, support for the standard may differ across operating systems. A couple functions in //! the crate root are not part of the POSIX standard, but are included in the crate root because //! they are widely available across Unix operating systems. //! //! To write portable code, import the `termios` crate and use only the definitions from the crate //! root. //! //! ### OS-Specific Extensions //! //! Each operating system may define extensions to the POSIX API. To make it clear when code //! depends on OS-specific definitions, any non-standard definitions are exported in the //! `termios::os` module. Programs that depend on OS-specific functionality must explicity opt-in. //! When writing portable code that depends on OS-specific definitions, it will often be necessary //! to use `#[cfg(...)]` attributes to support alternative implementations. The following is an //! example of a portable function that sets the maximum speed on a `Termios` struct. //! //! ```no_run //! use std::io; //! use termios::{Termios,cfsetspeed}; //! //! #[cfg(target_os = "linux")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::linux::B4000000) //! } //! //! #[cfg(target_os = "macos")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::macos::B230400) //! } //! //! #[cfg(target_os = "freebsd")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::freebsd::B921600) //! } //! //! #[cfg(target_os = "openbsd")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::openbsd::B921600) //! } //! //! #[cfg(target_os = "netbsd")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::netbsd::B921600) //! } //! //! #[cfg(target_os = "dragonfly")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::dragonfly::B230400) //! } //! //! #[cfg(target_os = "solaris")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::solaris::B921600) //! } //! //! #[cfg(target_os = "illumos")] //! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> { //! cfsetspeed(termios, termios::os::illumos::B921600) //! } //! //! # let fd = 1; //! let mut termios = Termios::from_fd(fd).unwrap(); //! set_fastest_speed(&mut termios).unwrap(); //! ``` extern crate libc; use std::io; use std::mem; use std::ops::{Deref,DerefMut}; use std::os::unix::io::RawFd; use libc::{c_int,pid_t}; pub use ::os::target::{cc_t,speed_t,tcflag_t}; // types pub use ::os::target::{VEOF,VEOL,VERASE,VINTR,VKILL,VMIN,VQUIT,VSTART,VSTOP,VSUSP,VTIME}; // c_cc subscripts pub use ::os::target::{BRKINT,ICRNL,IGNBRK,IGNCR,IGNPAR,INLCR,INPCK,ISTRIP,IXANY,IXOFF,IXON,PARMRK}; // input modes pub use ::os::target::{OPOST,ONLCR,OCRNL,ONOCR,ONLRET}; // output modes pub use ::os::target::{B0,B50,B75,B110,B134,B150,B200,B300,B600,B1200,B1800,B2400,B4800,B9600,B19200,B38400}; // baud rate selection pub use ::os::target::{CSIZE,CS5,CS6,CS7,CS8,CSTOPB,CREAD,PARENB,PARODD,HUPCL,CLOCAL}; // control modes pub use ::os::target::{ECHO,ECHOE,ECHOK,ECHONL,ICANON,IEXTEN,ISIG,NOFLSH,TOSTOP}; // local modes pub use ::os::target::{TCSANOW,TCSADRAIN,TCSAFLUSH}; // attribute selection pub use ::os::target::{TCIFLUSH,TCIOFLUSH,TCOFLUSH,TCIOFF,TCION,TCOOFF,TCOON}; // line control pub mod ffi; pub mod os; /// Unix terminal I/O control structure. /// /// The `Termios` structure is a thin wrapper for the OS-specific `termios` struct. The only safe /// way to obtain a `Termios` structure is to fill one from a file descriptor with /// [`Termios::from_fd()`](#method.from_fd), after which it can be treated just like the POSIX /// `termios` struct. It provides access to the standard fields of the `termios` struct (`c_iflag`, /// `c_oflag`, `c_cflag`, `c_lflag`, and `c_cc`) through the `Deref` and `DerefMut` traits. /// /// ## Example /// /// The following is an example of how one might setup a file descriptor for a serial port: /// /// ```no_run /// use std::io; /// use std::os::unix::io::RawFd; /// /// fn setup_serial(fd: RawFd) -> io::Result<()> { /// use termios::*; /// /// let mut termios = try!(Termios::from_fd(fd)); /// /// termios.c_cflag |= CREAD | CLOCAL; /// termios.c_lflag &= !(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG | IEXTEN); /// termios.c_oflag &= !OPOST; /// termios.c_iflag &= !(INLCR | IGNCR | ICRNL | IGNBRK); /// /// termios.c_cc[VMIN] = 0; /// termios.c_cc[VTIME] = 0; /// /// try!(cfsetspeed(&mut termios, B9600)); /// try!(tcsetattr(fd, TCSANOW, &mut termios)); /// /// Ok(()) /// } /// ``` #[derive(Debug,Copy,Clone,Eq,PartialEq)] pub struct Termios { inner: ::os::target::termios } impl Termios { /// Creates a `Termios` structure based on the current settings of a file descriptor. /// /// `fd` must be an open file descriptor for a terminal device. pub fn from_fd(fd: RawFd) -> io::Result { let mut termios = unsafe { mem::uninitialized() }; match tcgetattr(fd, &mut termios) { Ok(_) => Ok(termios), Err(err) => Err(err) } } fn inner(&self) -> &::os::target::termios { &self.inner } fn inner_mut(&mut self) -> &mut ::os::target::termios { &mut self.inner } } impl Deref for Termios { type Target = ::os::target::termios; fn deref(&self) -> &::os::target::termios { self.inner() } } impl DerefMut for Termios { fn deref_mut(&mut self) -> &mut ::os::target::termios { self.inner_mut() } } /// Gets the input baud rate stored in a `Termios` structure. /// /// # Examples /// /// ``` /// # use std::mem; /// # use termios::{Termios,B9600,cfsetispeed,cfgetispeed}; /// # let mut termios = unsafe { mem::uninitialized() }; /// cfsetispeed(&mut termios, B9600).unwrap(); /// assert_eq!(cfgetispeed(&termios), B9600); /// ``` pub fn cfgetispeed(termios: &Termios) -> speed_t { unsafe { ffi::cfgetispeed(termios.inner()) } } /// Gets the output baud rate stored in a `Termios` structure. /// /// # Examples /// /// ``` /// # use std::mem; /// # use termios::{Termios,B9600,cfsetospeed,cfgetospeed}; /// # let mut termios = unsafe { mem::uninitialized() }; /// cfsetospeed(&mut termios, B9600).unwrap(); /// assert_eq!(cfgetospeed(&termios), B9600); /// ``` pub fn cfgetospeed(termios: &Termios) -> speed_t { unsafe { ffi::cfgetospeed(termios.inner()) } } /// Sets the input baud rate. /// /// This function only sets the necessary values on the given `Termios` structure. The settings are /// applied by a subsequent call to [`tcsetattr()`](fn.tcsetattr.html). /// /// # Parameters /// /// * `termios` should be a mutable reference to a `Termios` structure. /// * `speed` should be one of the baud rate constants: /// - `B0` /// - `B50` /// - `B75` /// - `B110` /// - `B134` /// - `B150` /// - `B200` /// - `B300` /// - `B600` /// - `B1200` /// - `B1800` /// - `B2400` /// - `B4800` /// - `B9600` /// - `B19200` /// - `B38400` /// - any OS-specific baud rate defined in [`termios::os`](os/index.html). /// /// A value of `B0` for `speed` sets the input baud rate to be the same as the output baud rate. /// /// # Examples /// /// ``` /// # use std::mem; /// # use termios::{Termios,B9600,cfsetispeed,cfgetispeed}; /// # let mut termios = unsafe { mem::uninitialized() }; /// cfsetispeed(&mut termios, B9600).unwrap(); /// assert_eq!(cfgetispeed(&termios), B9600); /// ``` pub fn cfsetispeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> { io_result(unsafe { ffi::cfsetispeed(termios.inner_mut(), speed) }) } /// Sets the output baud rate. /// /// This function only sets the necessary values on the given `Termios` structure. The settings are /// applied on a successful call to [`tcsetattr()`](fn.tcsetattr.html). /// /// # Parameters /// /// * `termios` should be a mutable reference to a `Termios` structure. /// * `speed` should be one of the baud rate constants: /// - `B0` (hang up) /// - `B50` /// - `B75` /// - `B110` /// - `B134` /// - `B150` /// - `B200` /// - `B300` /// - `B600` /// - `B1200` /// - `B1800` /// - `B2400` /// - `B4800` /// - `B9600` /// - `B19200` /// - `B38400` /// - any OS-specific baud rate defined in [`termios::os`](os/index.html). /// /// A value of `B0` for `speed` deasserts the modem control lines when applied with /// [`tcsetattr()`](fn.tcsetattr.html). This normally has the effect of disconnecting the line. /// /// # Examples /// /// ``` /// # use std::mem; /// # use termios::{Termios,B9600,cfsetospeed,cfgetospeed}; /// # let mut termios = unsafe { mem::uninitialized() }; /// cfsetospeed(&mut termios, B9600).unwrap(); /// assert_eq!(cfgetospeed(&termios), B9600); /// ``` pub fn cfsetospeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> { io_result(unsafe { ffi::cfsetospeed(termios.inner_mut(), speed) }) } /// Sets input and output baud rates. /// /// This function only sets the necessary values on the given `Termios` structure. The settings are /// applied on a successful call to [`tcsetattr()`](fn.tcsetattr.html). /// /// # Parameters /// /// * `termios` should be a mutable reference to a `Termios` structure. /// * `speed` should be one of the baud rate constants: /// - `B0` /// - `B50` /// - `B75` /// - `B110` /// - `B134` /// - `B150` /// - `B200` /// - `B300` /// - `B600` /// - `B1200` /// - `B1800` /// - `B2400` /// - `B4800` /// - `B9600` /// - `B19200` /// - `B38400` /// - any OS-specific baud rate defined in [`termios::os`](os/index.html). /// /// # Examples /// /// ``` /// # use std::mem; /// # use termios::{Termios,B9600,cfsetspeed,cfgetispeed,cfgetospeed}; /// # let mut termios = unsafe { mem::uninitialized() }; /// cfsetspeed(&mut termios, B9600).unwrap(); /// assert_eq!(cfgetispeed(&termios), B9600); /// assert_eq!(cfgetospeed(&termios), B9600); /// ``` /// /// # Portability /// /// This function is not part of the IEEE Std 1003.1 ("POSIX.1") specification, but it is available /// on Linux, BSD, and OS X. pub fn cfsetspeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> { io_result(unsafe { ffi::cfsetspeed(termios.inner_mut(), speed) }) } /// Sets flags to disable all input and output processing. /// /// This function only sets the necessary values on the given `Termios` structure. The settings are /// applied on a successful call to [`tcsetattr()`](fn.tcsetattr.html). /// /// # Portability /// /// This function is not part of the IEEE Std 1003.1 ("POSIX.1") specification, but it is available /// on Linux, BSD, and OS X. pub fn cfmakeraw(termios: &mut Termios) { unsafe { ffi::cfmakeraw(termios.inner_mut()) }; } /// Blocks until all output written to the file descriptor is transmitted. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a terminal. pub fn tcdrain(fd: RawFd) -> io::Result<()> { io_result(unsafe { ffi::tcdrain(fd) }) } /// Suspends or restarts transmission or reception of data. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a terminal. /// * `action` should be one of the following constants: /// - `TCOOFF` suspends output. /// - `TCOON` restarts output. /// - `TCIOFF` transmits a STOP character, intended to cause the remote device to stop /// transmitting. /// - `TCION` transmits a START character, intended to cause the remote device to resume /// transmitting. pub fn tcflow(fd: RawFd, action: c_int) -> io::Result<()> { io_result(unsafe { ffi::tcflow(fd, action) }) } /// Discards data waiting in the terminal device's buffers. /// /// `tcflush()` discards data that has been written to the device by an application but has not yet /// been transmitted by the hardware or data that has been received by the hardware but has not yet /// been read by an application. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a terminal. /// * `queue_selector` should be one of: /// - `TCIFLUSH` to discard data received but not read. /// - `TCOFLUSH` to discard data written but not transmitted. /// - `TCIOFLUSH` to discard both data received but not read and data written but not /// transmitted. pub fn tcflush(fd: RawFd, queue_selector: c_int) -> io::Result<()> { io_result(unsafe { ffi::tcflush(fd, queue_selector) }) } /// Populates a `Termios` structure with parameters associated with a terminal. /// /// Upon successful completion, the `Termios` structure referred to by the `termios` parameter will /// contain the parameters associated with the terminal device referred to by `fd`. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a terminal. /// * `termios` should be a mutable reference to the `Termios` structure that will hold the /// terminal device's parameters. pub fn tcgetattr(fd: RawFd, termios: &mut Termios) -> io::Result<()> { io_result(unsafe { ffi::tcgetattr(fd, termios.inner_mut()) }) } /// Sets a terminal device's parameters. /// /// `tcsetattr()` returns successfully if it was able to perform any of the requested actions, even /// if other requested actions could not be performed. It will set all attributes that the /// implementation supports and leave others unchanged. The `Termios` structure will not be updated /// to reflect the changes that were applied. /// /// In order to determine which parameters were applied to the terminal device, an application /// should use [`tcgetattr()`](fn.tcgetattr.html) to obtain the latest state of the terminal /// device. In particular, when attempting to change baud rates, [`tcgetattr()`](fn.tcgetattr.html) /// can be used to determine which baud rates were actually selected. /// /// If none of the requested actions could be performed, then `tcsetattr()` returns an error. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a terminal. /// * `action` should be one of the constants: /// - `TCSANOW` applies the change immediately. /// - `TCSADRAIN` applies the change after all output previously written to `fd` is transmitted. /// This mode should be used when changing parameters that affect output. /// - `TCSAFLUSH` applies the change after all output previously written to `fd` is transmitted. /// All data received but not read is discarded before applying the change. /// * `termios` should be a mutable reference to a `Termios` structure containing the parameters to /// apply to the terminal device. pub fn tcsetattr(fd: RawFd, action: c_int, termios: &Termios) -> io::Result<()> { io_result(unsafe { ffi::tcsetattr(fd, action, termios.inner()) }) } /// Returns the process group ID of the controlling terminal's session. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a controlling terminal. pub fn tcgetsid(fd: RawFd) -> pid_t { unsafe { ffi::tcgetsid(fd) } } /// Transmits data to generate a break condition. /// /// If the terminal device is using asynchronous data transmission, `tcsendbreak()` transmits a /// continuous stream of zero bits for a specific duration. /// /// # Parameters /// /// * `fd` should be an open file descriptor associated with a terminal. /// * `duration` controls the duration of the transmitted zero bits. A value of 0 causes a /// transmission between 0.25 and 0.5 seconds. A value other than 0 causes a transmission for an /// implementation-defined period of time. pub fn tcsendbreak(fd: RawFd, duration: c_int) -> io::Result<()> { io_result(unsafe { ffi::tcsendbreak(fd, duration) }) } #[inline] fn io_result(result: c_int) -> io::Result<()> { match result { 0 => Ok(()), _ => Err(io::Error::last_os_error()) } } termios-0.3.3/src/os/android.rs010064400017500001750000000133061335666652500146420ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, c_line: cc_t, pub c_cc: [cc_t; NCCS] } pub const NCCS: usize = 19; // c_cc characters pub const VINTR: usize = 0; pub const VQUIT: usize = 1; pub const VERASE: usize = 2; pub const VKILL: usize = 3; pub const VEOF: usize = 4; pub const VTIME: usize = 5; pub const VMIN: usize = 6; pub const VSWTC: usize = 7; pub const VSTART: usize = 8; pub const VSTOP: usize = 9; pub const VSUSP: usize = 10; pub const VEOL: usize = 11; pub const VREPRINT: usize = 12; pub const VDISCARD: usize = 13; pub const VWERASE: usize = 14; pub const VLNEXT: usize = 15; pub const VEOL2: usize = 16; // c_iflag bits pub const IGNBRK: tcflag_t = 0o000001; pub const BRKINT: tcflag_t = 0o000002; pub const IGNPAR: tcflag_t = 0o000004; pub const PARMRK: tcflag_t = 0o000010; pub const INPCK: tcflag_t = 0o000020; pub const ISTRIP: tcflag_t = 0o000040; pub const INLCR: tcflag_t = 0o000100; pub const IGNCR: tcflag_t = 0o000200; pub const ICRNL: tcflag_t = 0o000400; pub const IUCLC: tcflag_t = 0o001000; pub const IXON: tcflag_t = 0o002000; pub const IXANY: tcflag_t = 0o004000; pub const IXOFF: tcflag_t = 0o010000; pub const IMAXBEL: tcflag_t = 0o020000; pub const IUTF8: tcflag_t = 0o040000; // c_oflag bits pub const OPOST: tcflag_t = 0o000001; pub const OLCUC: tcflag_t = 0o000002; pub const ONLCR: tcflag_t = 0o000004; pub const OCRNL: tcflag_t = 0o000010; pub const ONOCR: tcflag_t = 0o000020; pub const ONLRET: tcflag_t = 0o000040; pub const OFILL: tcflag_t = 0o000100; pub const OFDEL: tcflag_t = 0o000200; pub const NLDLY: tcflag_t = 0o000400; pub const NL0: tcflag_t = 0o000000; pub const NL1: tcflag_t = 0o000400; pub const CRDLY: tcflag_t = 0o003000; pub const CR0: tcflag_t = 0o000000; pub const CR1: tcflag_t = 0o001000; pub const CR2: tcflag_t = 0o002000; pub const CR3: tcflag_t = 0o003000; pub const TABDLY: tcflag_t = 0o014000; pub const TAB0: tcflag_t = 0o000000; pub const TAB1: tcflag_t = 0o004000; pub const TAB2: tcflag_t = 0o010000; pub const TAB3: tcflag_t = 0o014000; pub const BSDLY: tcflag_t = 0o020000; pub const BS0: tcflag_t = 0o000000; pub const BS1: tcflag_t = 0o020000; pub const FFDLY: tcflag_t = 0o100000; pub const FF0: tcflag_t = 0o000000; pub const FF1: tcflag_t = 0o100000; pub const VTDLY: tcflag_t = 0o040000; pub const VT0: tcflag_t = 0o000000; pub const VT1: tcflag_t = 0o040000; pub const XTABS: tcflag_t = 0o014000; // c_cflag bits pub const CBAUD: tcflag_t = 0o010017; pub const CSIZE: tcflag_t = 0o000060; pub const CS5: tcflag_t = 0o000000; pub const CS6: tcflag_t = 0o000020; pub const CS7: tcflag_t = 0o000040; pub const CS8: tcflag_t = 0o000060; pub const CSTOPB: tcflag_t = 0o000100; pub const CREAD: tcflag_t = 0o000200; pub const PARENB: tcflag_t = 0o000400; pub const PARODD: tcflag_t = 0o001000; pub const HUPCL: tcflag_t = 0o002000; pub const CLOCAL: tcflag_t = 0o004000; pub const CBAUDEX: tcflag_t = 0o010000; pub const CIBAUD: tcflag_t = 0o02003600000; pub const CMSPAR: tcflag_t = 0o10000000000; pub const CRTSCTS: tcflag_t = 0o20000000000; // c_lflag bits pub const ISIG: tcflag_t = 0o000001; pub const ICANON: tcflag_t = 0o000002; pub const XCASE: tcflag_t = 0o000004; pub const ECHO: tcflag_t = 0o000010; pub const ECHOE: tcflag_t = 0o000020; pub const ECHOK: tcflag_t = 0o000040; pub const ECHONL: tcflag_t = 0o000100; pub const NOFLSH: tcflag_t = 0o000200; pub const TOSTOP: tcflag_t = 0o000400; pub const ECHOCTL: tcflag_t = 0o001000; pub const ECHOPRT: tcflag_t = 0o002000; pub const ECHOKE: tcflag_t = 0o004000; pub const FLUSHO: tcflag_t = 0o010000; pub const PENDIN: tcflag_t = 0o040000; pub const IEXTEN: tcflag_t = 0o100000; pub const EXTPROC: tcflag_t = 0o200000; // baud rates pub const B0: speed_t = 0o000000; pub const B50: speed_t = 0o000001; pub const B75: speed_t = 0o000002; pub const B110: speed_t = 0o000003; pub const B134: speed_t = 0o000004; pub const B150: speed_t = 0o000005; pub const B200: speed_t = 0o000006; pub const B300: speed_t = 0o000007; pub const B600: speed_t = 0o000010; pub const B1200: speed_t = 0o000011; pub const B1800: speed_t = 0o000012; pub const B2400: speed_t = 0o000013; pub const B4800: speed_t = 0o000014; pub const B9600: speed_t = 0o000015; pub const B19200: speed_t = 0o000016; pub const B38400: speed_t = 0o000017; pub const EXTA: speed_t = B19200; pub const EXTB: speed_t = B38400; pub const B57600: speed_t = 0o010001; pub const B115200: speed_t = 0o010002; pub const B230400: speed_t = 0o010003; pub const B460800: speed_t = 0o010004; pub const B500000: speed_t = 0o010005; pub const B576000: speed_t = 0o010006; pub const B921600: speed_t = 0o010007; pub const B1000000: speed_t = 0o010010; pub const B1152000: speed_t = 0o010011; pub const B1500000: speed_t = 0o010012; pub const B2000000: speed_t = 0o010013; pub const B2500000: speed_t = 0o010014; pub const B3000000: speed_t = 0o010015; pub const B3500000: speed_t = 0o010016; pub const B4000000: speed_t = 0o010017; // tcflow() pub const TCOOFF: c_int = 0; pub const TCOON: c_int = 1; pub const TCIOFF: c_int = 2; pub const TCION: c_int = 3; // tcflush() pub const TCIFLUSH: c_int = 0; pub const TCOFLUSH: c_int = 1; pub const TCIOFLUSH: c_int = 2; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; termios-0.3.3/src/os/dragonfly.rs010064400017500001750000000114351325626224500151760ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS], c_ispeed: speed_t, c_ospeed: speed_t } pub const NCCS: usize = 20; // c_cc characters pub const VEOF: usize = 0; pub const VEOL: usize = 1; pub const VEOL2: usize = 2; pub const VERASE: usize = 3; pub const VWERASE: usize = 4; pub const VKILL: usize = 5; pub const VREPRINT: usize = 6; pub const VERASE2: usize = 7; pub const VINTR: usize = 8; pub const VQUIT: usize = 9; pub const VSUSP: usize = 10; pub const VDSUSP: usize = 11; pub const VSTART: usize = 12; pub const VSTOP: usize = 13; pub const VLNEXT: usize = 14; pub const VDISCARD: usize = 15; pub const VMIN: usize = 16; pub const VTIME: usize = 17; pub const VSTATUS: usize = 18; pub const VCHECKPT: usize = 19; // c_iflag bits pub const IGNBRK: tcflag_t = 0x00000001; pub const BRKINT: tcflag_t = 0x00000002; pub const IGNPAR: tcflag_t = 0x00000004; pub const PARMRK: tcflag_t = 0x00000008; pub const INPCK: tcflag_t = 0x00000010; pub const ISTRIP: tcflag_t = 0x00000020; pub const INLCR: tcflag_t = 0x00000040; pub const IGNCR: tcflag_t = 0x00000080; pub const ICRNL: tcflag_t = 0x00000100; pub const IXON: tcflag_t = 0x00000200; pub const IXOFF: tcflag_t = 0x00000400; pub const IXANY: tcflag_t = 0x00000800; pub const IMAXBEL: tcflag_t = 0x00002000; // c_oflag bits pub const OPOST: tcflag_t = 0x00000001; pub const ONLCR: tcflag_t = 0x00000002; pub const OXTABS: tcflag_t = 0x00000004; pub const ONOEOT: tcflag_t = 0x00000008; pub const OCRNL: tcflag_t = 0x00000010; pub const ONOCR: tcflag_t = 0x00000020; pub const ONLRET: tcflag_t = 0x00000040; // c_cflag bits pub const CIGNORE: tcflag_t = 0x00000001; pub const CSIZE: tcflag_t = 0x00000300; pub const CS5: tcflag_t = 0x00000000; pub const CS6: tcflag_t = 0x00000100; pub const CS7: tcflag_t = 0x00000200; pub const CS8: tcflag_t = 0x00000300; pub const CSTOPB: tcflag_t = 0x00000400; pub const CREAD: tcflag_t = 0x00000800; pub const PARENB: tcflag_t = 0x00001000; pub const PARODD: tcflag_t = 0x00002000; pub const HUPCL: tcflag_t = 0x00004000; pub const CLOCAL: tcflag_t = 0x00008000; pub const CCTS_OFLOW: tcflag_t = 0x00010000; pub const CRTSCTS: tcflag_t = CCTS_OFLOW | CRTS_IFLOW; pub const CRTS_IFLOW: tcflag_t = 0x00020000; pub const CDTR_IFLOW: tcflag_t = 0x00040000; pub const CDSR_OFLOW: tcflag_t = 0x00080000; pub const CCAR_OFLOW: tcflag_t = 0x00100000; pub const MDMBUF: tcflag_t = 0x00100000; // c_lflag bits pub const ECHOKE: tcflag_t = 0x00000001; pub const ECHOE: tcflag_t = 0x00000002; pub const ECHOK: tcflag_t = 0x00000004; pub const ECHO: tcflag_t = 0x00000008; pub const ECHONL: tcflag_t = 0x00000010; pub const ECHOPRT: tcflag_t = 0x00000020; pub const ECHOCTL: tcflag_t = 0x00000040; pub const ISIG: tcflag_t = 0x00000080; pub const ICANON: tcflag_t = 0x00000100; pub const ALTWERASE: tcflag_t = 0x00000200; pub const IEXTEN: tcflag_t = 0x00000400; pub const EXTPROC: tcflag_t = 0x00000800; pub const TOSTOP: tcflag_t = 0x00400000; pub const FLUSHO: tcflag_t = 0x00800000; pub const NOKERNINFO: tcflag_t = 0x02000000; pub const PENDIN: tcflag_t = 0x20000000; pub const NOFLSH: tcflag_t = 0x80000000; // baud rates pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; pub const B110: speed_t = 110; pub const B134: speed_t = 134; pub const B150: speed_t = 150; pub const B200: speed_t = 200; pub const B300: speed_t = 300; pub const B600: speed_t = 600; pub const B1200: speed_t = 1200; pub const B1800: speed_t = 1800; pub const B2400: speed_t = 2400; pub const B4800: speed_t = 4800; pub const B9600: speed_t = 9600; pub const B19200: speed_t = 19200; pub const B38400: speed_t = 38400; pub const B7200: speed_t = 7200; pub const B14400: speed_t = 14400; pub const B28800: speed_t = 28800; pub const B57600: speed_t = 57600; pub const B76800: speed_t = 76800; pub const B115200: speed_t = 115200; pub const B230400: speed_t = 230400; pub const EXTA: speed_t = 19200; pub const EXTB: speed_t = 38400; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; pub const TCSASOFT: c_int = 0x10; // tcflush() pub const TCIFLUSH: c_int = 1; pub const TCOFLUSH: c_int = 2; pub const TCIOFLUSH: c_int = 3; // tcflow() pub const TCOOFF: c_int = 1; pub const TCOON: c_int = 2; pub const TCIOFF: c_int = 3; pub const TCION: c_int = 4; termios-0.3.3/src/os/freebsd.rs010064400017500001750000000116741325626224500146300ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS], c_ispeed: speed_t, c_ospeed: speed_t } pub const NCCS: usize = 20; // c_cc characters pub const VEOF: usize = 0; pub const VEOL: usize = 1; pub const VEOL2: usize = 2; pub const VERASE: usize = 3; pub const VWERASE: usize = 4; pub const VKILL: usize = 5; pub const VREPRINT: usize = 6; pub const VERASE2: usize = 7; pub const VINTR: usize = 8; pub const VQUIT: usize = 9; pub const VSUSP: usize = 10; pub const VDSUSP: usize = 11; pub const VSTART: usize = 12; pub const VSTOP: usize = 13; pub const VLNEXT: usize = 14; pub const VDISCARD: usize = 15; pub const VMIN: usize = 16; pub const VTIME: usize = 17; pub const VSTATUS: usize = 18; // c_iflag bits pub const IGNBRK: tcflag_t = 0x00000001; pub const BRKINT: tcflag_t = 0x00000002; pub const IGNPAR: tcflag_t = 0x00000004; pub const PARMRK: tcflag_t = 0x00000008; pub const INPCK: tcflag_t = 0x00000010; pub const ISTRIP: tcflag_t = 0x00000020; pub const INLCR: tcflag_t = 0x00000040; pub const IGNCR: tcflag_t = 0x00000080; pub const ICRNL: tcflag_t = 0x00000100; pub const IXON: tcflag_t = 0x00000200; pub const IXOFF: tcflag_t = 0x00000400; pub const IXANY: tcflag_t = 0x00000800; pub const IMAXBEL: tcflag_t = 0x00002000; // c_oflag bits pub const OPOST: tcflag_t = 0x00000001; pub const ONLCR: tcflag_t = 0x00000002; pub const TABDLY: tcflag_t = 0x00000004; pub const TAB0: tcflag_t = 0x00000000; pub const TAB3: tcflag_t = 0x00000004; pub const OXTABS: tcflag_t = TAB3; pub const ONOEOT: tcflag_t = 0x00000008; pub const OCRNL: tcflag_t = 0x00000010; pub const ONOCR: tcflag_t = 0x00000020; pub const ONLRET: tcflag_t = 0x00000040; // c_cflag bits pub const CIGNORE: tcflag_t = 0x00000001; pub const CSIZE: tcflag_t = 0x00000300; pub const CS5: tcflag_t = 0x00000000; pub const CS6: tcflag_t = 0x00000100; pub const CS7: tcflag_t = 0x00000200; pub const CS8: tcflag_t = 0x00000300; pub const CSTOPB: tcflag_t = 0x00000400; pub const CREAD: tcflag_t = 0x00000800; pub const PARENB: tcflag_t = 0x00001000; pub const PARODD: tcflag_t = 0x00002000; pub const HUPCL: tcflag_t = 0x00004000; pub const CLOCAL: tcflag_t = 0x00008000; pub const CCTS_OFLOW: tcflag_t = 0x00010000; pub const CRTSCTS: tcflag_t = CCTS_OFLOW | CRTS_IFLOW; pub const CRTS_IFLOW: tcflag_t = 0x00020000; pub const CDTR_IFLOW: tcflag_t = 0x00040000; pub const CDSR_OFLOW: tcflag_t = 0x00080000; pub const CCAR_OFLOW: tcflag_t = 0x00100000; pub const MDMBUF: tcflag_t = CCAR_OFLOW; // c_lflag bits pub const ECHOKE: tcflag_t = 0x00000001; pub const ECHOE: tcflag_t = 0x00000002; pub const ECHOK: tcflag_t = 0x00000004; pub const ECHO: tcflag_t = 0x00000008; pub const ECHONL: tcflag_t = 0x00000010; pub const ECHOPRT: tcflag_t = 0x00000020; pub const ECHOCTL: tcflag_t = 0x00000040; pub const ISIG: tcflag_t = 0x00000080; pub const ICANON: tcflag_t = 0x00000100; pub const ALTWERASE: tcflag_t = 0x00000200; pub const IEXTEN: tcflag_t = 0x00000400; pub const EXTPROC: tcflag_t = 0x00000800; pub const TOSTOP: tcflag_t = 0x00400000; pub const FLUSHO: tcflag_t = 0x00800000; pub const NOKERNINFO: tcflag_t = 0x02000000; pub const PENDIN: tcflag_t = 0x20000000; pub const NOFLSH: tcflag_t = 0x80000000; // baud rates pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; pub const B110: speed_t = 110; pub const B134: speed_t = 134; pub const B150: speed_t = 150; pub const B200: speed_t = 200; pub const B300: speed_t = 300; pub const B600: speed_t = 600; pub const B1200: speed_t = 1200; pub const B1800: speed_t = 1800; pub const B2400: speed_t = 2400; pub const B4800: speed_t = 4800; pub const B9600: speed_t = 9600; pub const B19200: speed_t = 19200; pub const B38400: speed_t = 38400; pub const B7200: speed_t = 7200; pub const B14400: speed_t = 14400; pub const B28800: speed_t = 28800; pub const B57600: speed_t = 57600; pub const B76800: speed_t = 76800; pub const B115200: speed_t = 115200; pub const B230400: speed_t = 230400; pub const B460800: speed_t = 460800; pub const B921600: speed_t = 921600; pub const EXTA: speed_t = 19200; pub const EXTB: speed_t = 38400; // tcflow() pub const TCOOFF: c_int = 1; pub const TCOON: c_int = 2; pub const TCIOFF: c_int = 3; pub const TCION: c_int = 4; // tcflush() pub const TCIFLUSH: c_int = 1; pub const TCOFLUSH: c_int = 2; pub const TCIOFLUSH: c_int = 3; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; pub const TCSASOFT: c_int = 0x10; termios-0.3.3/src/os/illumos.rs010064400017500001750000000133211374117077000146710ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS] } pub const NCCS: usize = 19; // c_cc characters pub const VINTR: usize = 0; pub const VQUIT: usize = 1; pub const VERASE: usize = 2; pub const VKILL: usize = 3; pub const VEOF: usize = 4; pub const VEOL: usize = 5; pub const VEOL2: usize = 6; pub const VMIN: usize = 4; pub const VTIME: usize = 5; pub const VSWTCH: usize = 7; pub const VSTART: usize = 8; pub const VSTOP: usize = 9; pub const VSUSP: usize = 10; pub const VDSUSP: usize = 11; pub const VREPRINT: usize = 12; pub const VDISCARD: usize = 13; pub const VWERASE: usize = 14; pub const VLNEXT: usize = 15; pub const VSTATUS: usize = 16; pub const VERASE2: usize = 17; // c_iflag bits pub const IGNBRK: tcflag_t = 0o000001; pub const BRKINT: tcflag_t = 0o000002; pub const IGNPAR: tcflag_t = 0o000004; pub const PARMRK: tcflag_t = 0o000010; pub const INPCK: tcflag_t = 0o000020; pub const ISTRIP: tcflag_t = 0o000040; pub const INLCR: tcflag_t = 0o000100; pub const IGNCR: tcflag_t = 0o000200; pub const ICRNL: tcflag_t = 0o000400; pub const IUCLC: tcflag_t = 0o001000; pub const IXON: tcflag_t = 0o002000; pub const IXANY: tcflag_t = 0o004000; pub const IXOFF: tcflag_t = 0o010000; pub const IMAXBEL: tcflag_t = 0o020000; pub const DOSMODE: tcflag_t = 0o100000; // c_oflag bits pub const OPOST: tcflag_t = 0o000001; pub const OLCUC: tcflag_t = 0o000002; pub const ONLCR: tcflag_t = 0o000004; pub const OCRNL: tcflag_t = 0o000010; pub const ONOCR: tcflag_t = 0o000020; pub const ONLRET: tcflag_t = 0o000040; pub const OFILL: tcflag_t = 0o000100; pub const OFDEL: tcflag_t = 0o000200; pub const NLDLY: tcflag_t = 0o000400; pub const NL0: tcflag_t = 0o000000; pub const NL1: tcflag_t = 0o000400; pub const CRDLY: tcflag_t = 0o003000; pub const CR0: tcflag_t = 0o000000; pub const CR1: tcflag_t = 0o001000; pub const CR2: tcflag_t = 0o002000; pub const CR3: tcflag_t = 0o003000; pub const TABDLY: tcflag_t = 0o014000; pub const TAB0: tcflag_t = 0o000000; pub const TAB1: tcflag_t = 0o004000; pub const TAB2: tcflag_t = 0o010000; pub const TAB3: tcflag_t = 0o014000; pub const XTABS: tcflag_t = 0o014000; pub const BSDLY: tcflag_t = 0o020000; pub const BS0: tcflag_t = 0o000000; pub const BS1: tcflag_t = 0o020000; pub const VTDLY: tcflag_t = 0o040000; pub const VT0: tcflag_t = 0o000000; pub const VT1: tcflag_t = 0o040000; pub const FFDLY: tcflag_t = 0o100000; pub const FF0: tcflag_t = 0o000000; pub const FF1: tcflag_t = 0o100000; pub const PAGEOUT: tcflag_t = 0o200000; pub const WRAP: tcflag_t = 0o400000; // c_cflag bits pub const CBAUD: tcflag_t = 0o000017; pub const CSIZE: tcflag_t = 0o000060; pub const CS5: tcflag_t = 0o000000; pub const CS6: tcflag_t = 0o000020; pub const CS7: tcflag_t = 0o000040; pub const CS8: tcflag_t = 0o000060; pub const CSTOPB: tcflag_t = 0o000100; pub const CREAD: tcflag_t = 0o000200; pub const PARENB: tcflag_t = 0o000400; pub const PARODD: tcflag_t = 0o001000; pub const HUPCL: tcflag_t = 0o002000; pub const CLOCAL: tcflag_t = 0o004000; pub const RCV1EN: tcflag_t = 0o010000; pub const XMT1EN: tcflag_t = 0o020000; pub const LOBLK: tcflag_t = 0o040000; pub const XCLUDE: tcflag_t = 0o100000; pub const CRTSXOFF: tcflag_t = 0o10000000000; pub const CRTSCTS: tcflag_t = 0o20000000000; pub const CIBAUD: tcflag_t = 0o3600000; pub const PAREXT: tcflag_t = 0o4000000; pub const CBAUDEXT: tcflag_t = 0o10000000; pub const CIBAUDEXT: tcflag_t = 0o20000000; // c_lflag bits pub const ISIG: tcflag_t = 0o000001; pub const ICANON: tcflag_t = 0o000002; pub const XCASE: tcflag_t = 0o000004; pub const ECHO: tcflag_t = 0o000010; pub const ECHOE: tcflag_t = 0o000020; pub const ECHOK: tcflag_t = 0o000040; pub const ECHONL: tcflag_t = 0o000100; pub const NOFLSH: tcflag_t = 0o000200; pub const TOSTOP: tcflag_t = 0o000400; pub const ECHOCTL: tcflag_t = 0o001000; pub const ECHOPRT: tcflag_t = 0o002000; pub const ECHOKE: tcflag_t = 0o004000; pub const DEFECHO: tcflag_t = 0o010000; pub const FLUSHO: tcflag_t = 0o020000; pub const PENDIN: tcflag_t = 0o040000; pub const IEXTEN: tcflag_t = 0o100000; // baud rates pub const B0: speed_t = 0; pub const B50: speed_t = 1; pub const B75: speed_t = 2; pub const B110: speed_t = 3; pub const B134: speed_t = 4; pub const B150: speed_t = 5; pub const B200: speed_t = 6; pub const B300: speed_t = 7; pub const B600: speed_t = 8; pub const B1200: speed_t = 9; pub const B1800: speed_t = 10; pub const B2400: speed_t = 11; pub const B4800: speed_t = 12; pub const B9600: speed_t = 13; pub const B19200: speed_t = 14; pub const B38400: speed_t = 15; pub const EXTA: speed_t = B19200; pub const EXTB: speed_t = B38400; pub const B57600: speed_t = 16; pub const B76800: speed_t = 17; pub const B115200: speed_t = 18; pub const B153600: speed_t = 19; pub const B230400: speed_t = 20; pub const B307200: speed_t = 21; pub const B460800: speed_t = 22; pub const B921600: speed_t = 23; // tcflow() pub const TCOOFF: c_int = 0; pub const TCOON: c_int = 1; pub const TCIOFF: c_int = 2; pub const TCION: c_int = 3; // tcflush() pub const TCIFLUSH: c_int = 0; pub const TCOFLUSH: c_int = 1; pub const TCIOFLUSH: c_int = 2; // tcsetattr() pub const TCSANOW: c_int = 0x540E; pub const TCSADRAIN: c_int = 0x540F; pub const TCSAFLUSH: c_int = 0x5410; termios-0.3.3/src/os/linux.rs010064400017500001750000000133641325626224500143530ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, c_line: cc_t, pub c_cc: [cc_t; NCCS], c_ispeed: speed_t, c_ospeed: speed_t } pub const NCCS: usize = 32; // c_cc characters pub const VINTR: usize = 0; pub const VQUIT: usize = 1; pub const VERASE: usize = 2; pub const VKILL: usize = 3; pub const VEOF: usize = 4; pub const VTIME: usize = 5; pub const VMIN: usize = 6; pub const VSWTC: usize = 7; pub const VSTART: usize = 8; pub const VSTOP: usize = 9; pub const VSUSP: usize = 10; pub const VEOL: usize = 11; pub const VREPRINT: usize = 12; pub const VDISCARD: usize = 13; pub const VWERASE: usize = 14; pub const VLNEXT: usize = 15; pub const VEOL2: usize = 16; // c_iflag bits pub const IGNBRK: tcflag_t = 0o000001; pub const BRKINT: tcflag_t = 0o000002; pub const IGNPAR: tcflag_t = 0o000004; pub const PARMRK: tcflag_t = 0o000010; pub const INPCK: tcflag_t = 0o000020; pub const ISTRIP: tcflag_t = 0o000040; pub const INLCR: tcflag_t = 0o000100; pub const IGNCR: tcflag_t = 0o000200; pub const ICRNL: tcflag_t = 0o000400; pub const IUCLC: tcflag_t = 0o001000; pub const IXON: tcflag_t = 0o002000; pub const IXANY: tcflag_t = 0o004000; pub const IXOFF: tcflag_t = 0o010000; pub const IMAXBEL: tcflag_t = 0o020000; pub const IUTF8: tcflag_t = 0o040000; // c_oflag bits pub const OPOST: tcflag_t = 0o000001; pub const OLCUC: tcflag_t = 0o000002; pub const ONLCR: tcflag_t = 0o000004; pub const OCRNL: tcflag_t = 0o000010; pub const ONOCR: tcflag_t = 0o000020; pub const ONLRET: tcflag_t = 0o000040; pub const OFILL: tcflag_t = 0o000100; pub const OFDEL: tcflag_t = 0o000200; pub const NLDLY: tcflag_t = 0o000400; pub const NL0: tcflag_t = 0o000000; pub const NL1: tcflag_t = 0o000400; pub const CRDLY: tcflag_t = 0o003000; pub const CR0: tcflag_t = 0o000000; pub const CR1: tcflag_t = 0o001000; pub const CR2: tcflag_t = 0o002000; pub const CR3: tcflag_t = 0o003000; pub const TABDLY: tcflag_t = 0o014000; pub const TAB0: tcflag_t = 0o000000; pub const TAB1: tcflag_t = 0o004000; pub const TAB2: tcflag_t = 0o010000; pub const TAB3: tcflag_t = 0o014000; pub const BSDLY: tcflag_t = 0o020000; pub const BS0: tcflag_t = 0o000000; pub const BS1: tcflag_t = 0o020000; pub const FFDLY: tcflag_t = 0o100000; pub const FF0: tcflag_t = 0o000000; pub const FF1: tcflag_t = 0o100000; pub const VTDLY: tcflag_t = 0o040000; pub const VT0: tcflag_t = 0o000000; pub const VT1: tcflag_t = 0o040000; pub const XTABS: tcflag_t = 0o014000; // c_cflag bits pub const CBAUD: tcflag_t = 0o010017; pub const CSIZE: tcflag_t = 0o000060; pub const CS5: tcflag_t = 0o000000; pub const CS6: tcflag_t = 0o000020; pub const CS7: tcflag_t = 0o000040; pub const CS8: tcflag_t = 0o000060; pub const CSTOPB: tcflag_t = 0o000100; pub const CREAD: tcflag_t = 0o000200; pub const PARENB: tcflag_t = 0o000400; pub const PARODD: tcflag_t = 0o001000; pub const HUPCL: tcflag_t = 0o002000; pub const CLOCAL: tcflag_t = 0o004000; pub const CBAUDEX: tcflag_t = 0o010000; pub const CIBAUD: tcflag_t = 0o02003600000; pub const CMSPAR: tcflag_t = 0o10000000000; pub const CRTSCTS: tcflag_t = 0o20000000000; // c_lflag bits pub const ISIG: tcflag_t = 0o000001; pub const ICANON: tcflag_t = 0o000002; pub const XCASE: tcflag_t = 0o000004; pub const ECHO: tcflag_t = 0o000010; pub const ECHOE: tcflag_t = 0o000020; pub const ECHOK: tcflag_t = 0o000040; pub const ECHONL: tcflag_t = 0o000100; pub const NOFLSH: tcflag_t = 0o000200; pub const TOSTOP: tcflag_t = 0o000400; pub const ECHOCTL: tcflag_t = 0o001000; pub const ECHOPRT: tcflag_t = 0o002000; pub const ECHOKE: tcflag_t = 0o004000; pub const FLUSHO: tcflag_t = 0o010000; pub const PENDIN: tcflag_t = 0o040000; pub const IEXTEN: tcflag_t = 0o100000; pub const EXTPROC: tcflag_t = 0o200000; // baud rates pub const B0: speed_t = 0o000000; pub const B50: speed_t = 0o000001; pub const B75: speed_t = 0o000002; pub const B110: speed_t = 0o000003; pub const B134: speed_t = 0o000004; pub const B150: speed_t = 0o000005; pub const B200: speed_t = 0o000006; pub const B300: speed_t = 0o000007; pub const B600: speed_t = 0o000010; pub const B1200: speed_t = 0o000011; pub const B1800: speed_t = 0o000012; pub const B2400: speed_t = 0o000013; pub const B4800: speed_t = 0o000014; pub const B9600: speed_t = 0o000015; pub const B19200: speed_t = 0o000016; pub const B38400: speed_t = 0o000017; pub const EXTA: speed_t = B19200; pub const EXTB: speed_t = B38400; pub const B57600: speed_t = 0o010001; pub const B115200: speed_t = 0o010002; pub const B230400: speed_t = 0o010003; pub const B460800: speed_t = 0o010004; pub const B500000: speed_t = 0o010005; pub const B576000: speed_t = 0o010006; pub const B921600: speed_t = 0o010007; pub const B1000000: speed_t = 0o010010; pub const B1152000: speed_t = 0o010011; pub const B1500000: speed_t = 0o010012; pub const B2000000: speed_t = 0o010013; pub const B2500000: speed_t = 0o010014; pub const B3000000: speed_t = 0o010015; pub const B3500000: speed_t = 0o010016; pub const B4000000: speed_t = 0o010017; // tcflow() pub const TCOOFF: c_int = 0; pub const TCOON: c_int = 1; pub const TCIOFF: c_int = 2; pub const TCION: c_int = 3; // tcflush() pub const TCIFLUSH: c_int = 0; pub const TCOFLUSH: c_int = 1; pub const TCIOFLUSH: c_int = 2; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; termios-0.3.3/src/os/macos.rs010064400017500001750000000135021325626224500143100ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uchar,c_ulong}; pub type tcflag_t = c_ulong; pub type cc_t = c_uchar; pub type speed_t = c_ulong; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS], c_ispeed: speed_t, c_ospeed: speed_t } pub const NCCS: usize = 20; // c_cc characters pub const VEOF: usize = 0; pub const VEOL: usize = 1; pub const VEOL2: usize = 2; pub const VERASE: usize = 3; pub const VWERASE: usize = 4; pub const VKILL: usize = 5; pub const VREPRINT: usize = 6; pub const VINTR: usize = 8; pub const VQUIT: usize = 9; pub const VSUSP: usize = 10; pub const VDSUSP: usize = 11; pub const VSTART: usize = 12; pub const VSTOP: usize = 13; pub const VLNEXT: usize = 14; pub const VDISCARD: usize = 15; pub const VMIN: usize = 16; pub const VTIME: usize = 17; pub const VSTATUS: usize = 18; // c_iflag bits pub const IGNBRK: tcflag_t = 0x00000001; pub const BRKINT: tcflag_t = 0x00000002; pub const IGNPAR: tcflag_t = 0x00000004; pub const PARMRK: tcflag_t = 0x00000008; pub const INPCK: tcflag_t = 0x00000010; pub const ISTRIP: tcflag_t = 0x00000020; pub const INLCR: tcflag_t = 0x00000040; pub const IGNCR: tcflag_t = 0x00000080; pub const ICRNL: tcflag_t = 0x00000100; pub const IXON: tcflag_t = 0x00000200; pub const IXOFF: tcflag_t = 0x00000400; pub const IXANY: tcflag_t = 0x00000800; pub const IMAXBEL: tcflag_t = 0x00002000; pub const IUTF8: tcflag_t = 0x00004000; // c_oflag bits pub const OPOST: tcflag_t = 0x00000001; pub const ONLCR: tcflag_t = 0x00000002; pub const OXTABS: tcflag_t = 0x00000004; pub const ONOEOT: tcflag_t = 0x00000008; pub const OCRNL: tcflag_t = 0x00000010; pub const ONOCR: tcflag_t = 0x00000020; pub const ONLRET: tcflag_t = 0x00000040; pub const OFILL: tcflag_t = 0x00000080; pub const NLDLY: tcflag_t = 0x00000300; pub const TABDLY: tcflag_t = 0x00000c04; pub const CRDLY: tcflag_t = 0x00003000; pub const FFDLY: tcflag_t = 0x00004000; pub const BSDLY: tcflag_t = 0x00008000; pub const VTDLY: tcflag_t = 0x00010000; pub const OFDEL: tcflag_t = 0x00020000; pub const NL0: tcflag_t = 0x00000000; pub const NL1: tcflag_t = 0x00000100; pub const NL2: tcflag_t = 0x00000200; pub const NL3: tcflag_t = 0x00000300; pub const TAB0: tcflag_t = 0x00000000; pub const TAB1: tcflag_t = 0x00000400; pub const TAB2: tcflag_t = 0x00000800; pub const TAB3: tcflag_t = 0x00000004; pub const CR0: tcflag_t = 0x00000000; pub const CR1: tcflag_t = 0x00001000; pub const CR2: tcflag_t = 0x00002000; pub const CR3: tcflag_t = 0x00003000; pub const FF0: tcflag_t = 0x00000000; pub const FF1: tcflag_t = 0x00004000; pub const BS0: tcflag_t = 0x00000000; pub const BS1: tcflag_t = 0x00008000; pub const VT0: tcflag_t = 0x00000000; pub const VT1: tcflag_t = 0x00010000; // c_cflag bits pub const CIGNORE: tcflag_t = 0x00000001; pub const CSIZE: tcflag_t = 0x00000300; pub const CS5: tcflag_t = 0x00000000; pub const CS6: tcflag_t = 0x00000100; pub const CS7: tcflag_t = 0x00000200; pub const CS8: tcflag_t = 0x00000300; pub const CSTOPB: tcflag_t = 0x00000400; pub const CREAD: tcflag_t = 0x00000800; pub const PARENB: tcflag_t = 0x00001000; pub const PARODD: tcflag_t = 0x00002000; pub const HUPCL: tcflag_t = 0x00004000; pub const CLOCAL: tcflag_t = 0x00008000; pub const CCTS_OFLOW: tcflag_t = 0x00010000; pub const CRTSCTS: tcflag_t = CCTS_OFLOW | CRTS_IFLOW; pub const CRTS_IFLOW: tcflag_t = 0x00020000; pub const CDTR_IFLOW: tcflag_t = 0x00040000; pub const CDSR_OFLOW: tcflag_t = 0x00080000; pub const CCAR_OFLOW: tcflag_t = 0x00100000; pub const MDMBUF: tcflag_t = 0x00100000; // c_lflag bits pub const ECHOKE: tcflag_t = 0x00000001; pub const ECHOE: tcflag_t = 0x00000002; pub const ECHOK: tcflag_t = 0x00000004; pub const ECHO: tcflag_t = 0x00000008; pub const ECHONL: tcflag_t = 0x00000010; pub const ECHOPRT: tcflag_t = 0x00000020; pub const ECHOCTL: tcflag_t = 0x00000040; pub const ISIG: tcflag_t = 0x00000080; pub const ICANON: tcflag_t = 0x00000100; pub const ALTWERASE: tcflag_t = 0x00000200; pub const IEXTEN: tcflag_t = 0x00000400; pub const EXTPROC: tcflag_t = 0x00000800; pub const TOSTOP: tcflag_t = 0x00400000; pub const FLUSHO: tcflag_t = 0x00800000; pub const NOKERNINFO: tcflag_t = 0x02000000; pub const PENDIN: tcflag_t = 0x20000000; pub const NOFLSH: tcflag_t = 0x80000000; // baud speeds pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; pub const B110: speed_t = 110; pub const B134: speed_t = 134; pub const B150: speed_t = 150; pub const B200: speed_t = 200; pub const B300: speed_t = 300; pub const B600: speed_t = 600; pub const B1200: speed_t = 1200; pub const B1800: speed_t = 1800; pub const B2400: speed_t = 2400; pub const B4800: speed_t = 4800; pub const B9600: speed_t = 9600; pub const B19200: speed_t = 19200; pub const B38400: speed_t = 38400; pub const B7200: speed_t = 7200; pub const B14400: speed_t = 14400; pub const B28800: speed_t = 28800; pub const B57600: speed_t = 57600; pub const B76800: speed_t = 76800; pub const B115200: speed_t = 115200; pub const B230400: speed_t = 230400; pub const EXTA: speed_t = 19200; pub const EXTB: speed_t = 38400; // tcflow() pub const TCOOFF: c_int = 1; pub const TCOON: c_int = 2; pub const TCIOFF: c_int = 3; pub const TCION: c_int = 4; // tcflush() pub const TCIFLUSH: c_int = 1; pub const TCOFLUSH: c_int = 2; pub const TCIOFLUSH: c_int = 3; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; pub const TCSASOFT: c_int = 0x10; termios-0.3.3/src/os/mod.rs010064400017500001750000000017611374117077000137710ustar0000000000000000//! OS-specific definitions. #[cfg(target_os = "linux")] pub use self::linux as target; #[cfg(target_os = "android")] pub use self::android as target; #[cfg(target_os = "macos")] pub use self::macos as target; #[cfg(target_os = "freebsd")] pub use self::freebsd as target; #[cfg(target_os = "openbsd")] pub use self::openbsd as target; #[cfg(target_os = "netbsd")] pub use self::netbsd as target; #[cfg(target_os = "dragonfly")] pub use self::dragonfly as target; #[cfg(target_os = "solaris")] pub use self::solaris as target; #[cfg(target_os = "illumos")] pub use self::illumos as target; #[cfg(target_os = "linux")] pub mod linux; #[cfg(target_os = "android")] pub mod android; #[cfg(target_os = "macos")] pub mod macos; #[cfg(target_os = "freebsd")] pub mod freebsd; #[cfg(target_os = "openbsd")] pub mod openbsd; #[cfg(target_os = "netbsd")] pub mod netbsd; #[cfg(target_os = "dragonfly")] pub mod dragonfly; #[cfg(target_os = "solaris")] pub mod solaris; #[cfg(target_os = "illumos")] pub mod illumos; termios-0.3.3/src/os/netbsd.rs010064400017500001750000000113201364222301100144440ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS], c_ispeed: c_int, c_ospeed: c_int } pub const NCCS: usize = 20; // c_cc characters pub const VEOF: usize = 0; pub const VEOL: usize = 1; pub const VEOL2: usize = 2; pub const VERASE: usize = 3; pub const VWERASE: usize = 4; pub const VKILL: usize = 5; pub const VREPRINT: usize = 6; pub const VINTR: usize = 8; pub const VQUIT: usize = 9; pub const VSUSP: usize = 10; pub const VSTART: usize = 12; pub const VSTOP: usize = 13; pub const VLNEXT: usize = 14; pub const VDISCARD: usize = 15; pub const VMIN: usize = 16; pub const VTIME: usize = 17; pub const VSTATUS: usize = 18; // c_iflag bits pub const IGNBRK: tcflag_t = 0x00000001; pub const BRKINT: tcflag_t = 0x00000002; pub const IGNPAR: tcflag_t = 0x00000004; pub const PARMRK: tcflag_t = 0x00000008; pub const INPCK: tcflag_t = 0x00000010; pub const ISTRIP: tcflag_t = 0x00000020; pub const INLCR: tcflag_t = 0x00000040; pub const IGNCR: tcflag_t = 0x00000080; pub const ICRNL: tcflag_t = 0x00000100; pub const IXON: tcflag_t = 0x00000200; pub const IXOFF: tcflag_t = 0x00000400; pub const IXANY: tcflag_t = 0x00000800; pub const IMAXBEL: tcflag_t = 0x00002000; // c_oflag bits pub const OPOST: tcflag_t = 0x00000001; pub const ONLCR: tcflag_t = 0x00000002; pub const OXTABS: tcflag_t = 0x00000004; pub const ONOEOT: tcflag_t = 0x00000008; pub const OCRNL: tcflag_t = 0x00000010; pub const ONOCR: tcflag_t = 0x00000020; pub const ONLRET: tcflag_t = 0x00000040; // c_cflag bits pub const CIGNORE: tcflag_t = 0x00000001; pub const CSIZE: tcflag_t = 0x00000300; pub const CS5: tcflag_t = 0x00000000; pub const CS6: tcflag_t = 0x00000100; pub const CS7: tcflag_t = 0x00000200; pub const CS8: tcflag_t = 0x00000300; pub const CSTOPB: tcflag_t = 0x00000400; pub const CREAD: tcflag_t = 0x00000800; pub const PARENB: tcflag_t = 0x00001000; pub const PARODD: tcflag_t = 0x00002000; pub const HUPCL: tcflag_t = 0x00004000; pub const CLOCAL: tcflag_t = 0x00008000; pub const CRTSCTS: tcflag_t = 0x00010000; pub const CRTS_IFLOW: tcflag_t = CRTSCTS; pub const CCTS_OFLOW: tcflag_t = CRTSCTS; pub const CDTRCTS: tcflag_t = 0x00020000; pub const MDMBUF: tcflag_t = 0x00100000; pub const CHWFLOW: tcflag_t = MDMBUF|CRTSCTS|CDTRCTS; // c_lflag bits pub const ECHOKE: tcflag_t = 0x00000001; pub const ECHOE: tcflag_t = 0x00000002; pub const ECHOK: tcflag_t = 0x00000004; pub const ECHO: tcflag_t = 0x00000008; pub const ECHONL: tcflag_t = 0x00000010; pub const ECHOPRT: tcflag_t = 0x00000020; pub const ECHOCTL: tcflag_t = 0x00000040; pub const ISIG: tcflag_t = 0x00000080; pub const ICANON: tcflag_t = 0x00000100; pub const ALTWERASE: tcflag_t = 0x00000200; pub const IEXTEN: tcflag_t = 0x00000400; pub const EXTPROC: tcflag_t = 0x00000800; pub const TOSTOP: tcflag_t = 0x00400000; pub const FLUSHO: tcflag_t = 0x00800000; pub const NOKERNINFO: tcflag_t = 0x02000000; pub const PENDIN: tcflag_t = 0x20000000; pub const NOFLSH: tcflag_t = 0x80000000; // baud rates pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; pub const B110: speed_t = 110; pub const B134: speed_t = 134; pub const B150: speed_t = 150; pub const B200: speed_t = 200; pub const B300: speed_t = 300; pub const B600: speed_t = 600; pub const B1200: speed_t = 1200; pub const B1800: speed_t = 1800; pub const B2400: speed_t = 2400; pub const B4800: speed_t = 4800; pub const B9600: speed_t = 9600; pub const B19200: speed_t = 19200; pub const B38400: speed_t = 38400; pub const B7200: speed_t = 7200; pub const B14400: speed_t = 14400; pub const B28800: speed_t = 28800; pub const B57600: speed_t = 57600; pub const B76800: speed_t = 76800; pub const B115200: speed_t = 115200; pub const B230400: speed_t = 230400; pub const B460800: speed_t = 460800; pub const B921600: speed_t = 921600; pub const EXTA: speed_t = 19200; pub const EXTB: speed_t = 38400; // tcflow() pub const TCOOFF: c_int = 1; pub const TCOON: c_int = 2; pub const TCIOFF: c_int = 3; pub const TCION: c_int = 4; // tcflush() pub const TCIFLUSH: c_int = 1; pub const TCOFLUSH: c_int = 2; pub const TCIOFLUSH: c_int = 3; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; pub const TCSASOFT: c_int = 0x10; termios-0.3.3/src/os/openbsd.rs010064400017500001750000000111061325626224500146360ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS], c_ispeed: speed_t, c_ospeed: speed_t } pub const NCCS: usize = 20; // c_cc characters pub const VEOF: usize = 0; pub const VEOL: usize = 1; pub const VEOL2: usize = 2; pub const VERASE: usize = 3; pub const VWERASE: usize = 4; pub const VKILL: usize = 5; pub const VREPRINT: usize = 6; pub const VERASE2: usize = 7; pub const VINTR: usize = 8; pub const VQUIT: usize = 9; pub const VSUSP: usize = 10; pub const VSTART: usize = 12; pub const VSTOP: usize = 13; pub const VLNEXT: usize = 14; pub const VDISCARD: usize = 15; pub const VMIN: usize = 16; pub const VTIME: usize = 17; // c_iflag bits pub const IGNBRK: tcflag_t = 0x00000001; pub const BRKINT: tcflag_t = 0x00000002; pub const IGNPAR: tcflag_t = 0x00000004; pub const PARMRK: tcflag_t = 0x00000008; pub const INPCK: tcflag_t = 0x00000010; pub const ISTRIP: tcflag_t = 0x00000020; pub const INLCR: tcflag_t = 0x00000040; pub const IGNCR: tcflag_t = 0x00000080; pub const ICRNL: tcflag_t = 0x00000100; pub const IXON: tcflag_t = 0x00000200; pub const IXOFF: tcflag_t = 0x00000400; pub const IXANY: tcflag_t = 0x00000800; pub const IMAXBEL: tcflag_t = 0x00002000; // c_oflag bits pub const OPOST: tcflag_t = 0x00000001; pub const ONLCR: tcflag_t = 0x00000002; pub const TAB3: tcflag_t = 0x00000004; pub const OXTABS: tcflag_t = TAB3; pub const ONOEOT: tcflag_t = 0x00000008; pub const OCRNL: tcflag_t = 0x00000010; pub const ONOCR: tcflag_t = 0x00000040; pub const ONLRET: tcflag_t = 0x00000080; // c_cflag bits pub const CIGNORE: tcflag_t = 0x00000001; pub const CSIZE: tcflag_t = 0x00000300; pub const CS5: tcflag_t = 0x00000000; pub const CS6: tcflag_t = 0x00000100; pub const CS7: tcflag_t = 0x00000200; pub const CS8: tcflag_t = 0x00000300; pub const CSTOPB: tcflag_t = 0x00000400; pub const CREAD: tcflag_t = 0x00000800; pub const PARENB: tcflag_t = 0x00001000; pub const PARODD: tcflag_t = 0x00002000; pub const HUPCL: tcflag_t = 0x00004000; pub const CLOCAL: tcflag_t = 0x00008000; pub const CRTSCTS: tcflag_t = 0x00010000; pub const CRTS_IFLOW: tcflag_t = CRTSCTS; pub const CCTS_OFLOW: tcflag_t = CRTSCTS; pub const MDMBUF: tcflag_t = 0x00100000; // c_lflag bits pub const ECHOKE: tcflag_t = 0x00000001; pub const ECHOE: tcflag_t = 0x00000002; pub const ECHOK: tcflag_t = 0x00000004; pub const ECHO: tcflag_t = 0x00000008; pub const ECHONL: tcflag_t = 0x00000010; pub const ECHOPRT: tcflag_t = 0x00000020; pub const ECHOCTL: tcflag_t = 0x00000040; pub const ISIG: tcflag_t = 0x00000080; pub const ICANON: tcflag_t = 0x00000100; pub const ALTWERASE: tcflag_t = 0x00000200; pub const IEXTEN: tcflag_t = 0x00000400; pub const EXTPROC: tcflag_t = 0x00000800; pub const TOSTOP: tcflag_t = 0x00400000; pub const FLUSHO: tcflag_t = 0x00800000; pub const NOKERNINFO: tcflag_t = 0x02000000; pub const PENDIN: tcflag_t = 0x20000000; pub const NOFLSH: tcflag_t = 0x80000000; // baud rates pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; pub const B110: speed_t = 110; pub const B134: speed_t = 134; pub const B150: speed_t = 150; pub const B200: speed_t = 200; pub const B300: speed_t = 300; pub const B600: speed_t = 600; pub const B1200: speed_t = 1200; pub const B1800: speed_t = 1800; pub const B2400: speed_t = 2400; pub const B4800: speed_t = 4800; pub const B9600: speed_t = 9600; pub const B19200: speed_t = 19200; pub const B38400: speed_t = 38400; pub const B7200: speed_t = 7200; pub const B14400: speed_t = 14400; pub const B28800: speed_t = 28800; pub const B57600: speed_t = 57600; pub const B76800: speed_t = 76800; pub const B115200: speed_t = 115200; pub const B230400: speed_t = 230400; pub const EXTA: speed_t = 19200; pub const EXTB: speed_t = 38400; // tcflow() pub const TCOOFF: c_int = 1; pub const TCOON: c_int = 2; pub const TCIOFF: c_int = 3; pub const TCION: c_int = 4; // tcflush() pub const TCIFLUSH: c_int = 1; pub const TCOFLUSH: c_int = 2; pub const TCIOFLUSH: c_int = 3; // tcsetattr() pub const TCSANOW: c_int = 0; pub const TCSADRAIN: c_int = 1; pub const TCSAFLUSH: c_int = 2; pub const TCSASOFT: c_int = 0x10; termios-0.3.3/src/os/solaris.rs010064400017500001750000000133211364246635500146700ustar0000000000000000#![allow(non_camel_case_types)] use libc::{c_int,c_uint,c_uchar}; pub type cc_t = c_uchar; pub type speed_t = c_uint; pub type tcflag_t = c_uint; #[derive(Debug,Copy,Clone,Eq,PartialEq)] #[repr(C)] pub struct termios { pub c_iflag: tcflag_t, pub c_oflag: tcflag_t, pub c_cflag: tcflag_t, pub c_lflag: tcflag_t, pub c_cc: [cc_t; NCCS] } pub const NCCS: usize = 19; // c_cc characters pub const VINTR: usize = 0; pub const VQUIT: usize = 1; pub const VERASE: usize = 2; pub const VKILL: usize = 3; pub const VEOF: usize = 4; pub const VEOL: usize = 5; pub const VEOL2: usize = 6; pub const VMIN: usize = 4; pub const VTIME: usize = 5; pub const VSWTCH: usize = 7; pub const VSTART: usize = 8; pub const VSTOP: usize = 9; pub const VSUSP: usize = 10; pub const VDSUSP: usize = 11; pub const VREPRINT: usize = 12; pub const VDISCARD: usize = 13; pub const VWERASE: usize = 14; pub const VLNEXT: usize = 15; pub const VSTATUS: usize = 16; pub const VERASE2: usize = 17; // c_iflag bits pub const IGNBRK: tcflag_t = 0o000001; pub const BRKINT: tcflag_t = 0o000002; pub const IGNPAR: tcflag_t = 0o000004; pub const PARMRK: tcflag_t = 0o000010; pub const INPCK: tcflag_t = 0o000020; pub const ISTRIP: tcflag_t = 0o000040; pub const INLCR: tcflag_t = 0o000100; pub const IGNCR: tcflag_t = 0o000200; pub const ICRNL: tcflag_t = 0o000400; pub const IUCLC: tcflag_t = 0o001000; pub const IXON: tcflag_t = 0o002000; pub const IXANY: tcflag_t = 0o004000; pub const IXOFF: tcflag_t = 0o010000; pub const IMAXBEL: tcflag_t = 0o020000; pub const DOSMODE: tcflag_t = 0o100000; // c_oflag bits pub const OPOST: tcflag_t = 0o000001; pub const OLCUC: tcflag_t = 0o000002; pub const ONLCR: tcflag_t = 0o000004; pub const OCRNL: tcflag_t = 0o000010; pub const ONOCR: tcflag_t = 0o000020; pub const ONLRET: tcflag_t = 0o000040; pub const OFILL: tcflag_t = 0o000100; pub const OFDEL: tcflag_t = 0o000200; pub const NLDLY: tcflag_t = 0o000400; pub const NL0: tcflag_t = 0o000000; pub const NL1: tcflag_t = 0o000400; pub const CRDLY: tcflag_t = 0o003000; pub const CR0: tcflag_t = 0o000000; pub const CR1: tcflag_t = 0o001000; pub const CR2: tcflag_t = 0o002000; pub const CR3: tcflag_t = 0o003000; pub const TABDLY: tcflag_t = 0o014000; pub const TAB0: tcflag_t = 0o000000; pub const TAB1: tcflag_t = 0o004000; pub const TAB2: tcflag_t = 0o010000; pub const TAB3: tcflag_t = 0o014000; pub const XTABS: tcflag_t = 0o014000; pub const BSDLY: tcflag_t = 0o020000; pub const BS0: tcflag_t = 0o000000; pub const BS1: tcflag_t = 0o020000; pub const VTDLY: tcflag_t = 0o040000; pub const VT0: tcflag_t = 0o000000; pub const VT1: tcflag_t = 0o040000; pub const FFDLY: tcflag_t = 0o100000; pub const FF0: tcflag_t = 0o000000; pub const FF1: tcflag_t = 0o100000; pub const PAGEOUT: tcflag_t = 0o200000; pub const WRAP: tcflag_t = 0o400000; // c_cflag bits pub const CBAUD: tcflag_t = 0o000017; pub const CSIZE: tcflag_t = 0o000060; pub const CS5: tcflag_t = 0o000000; pub const CS6: tcflag_t = 0o000020; pub const CS7: tcflag_t = 0o000040; pub const CS8: tcflag_t = 0o000060; pub const CSTOPB: tcflag_t = 0o000100; pub const CREAD: tcflag_t = 0o000200; pub const PARENB: tcflag_t = 0o000400; pub const PARODD: tcflag_t = 0o001000; pub const HUPCL: tcflag_t = 0o002000; pub const CLOCAL: tcflag_t = 0o004000; pub const RCV1EN: tcflag_t = 0o010000; pub const XMT1EN: tcflag_t = 0o020000; pub const LOBLK: tcflag_t = 0o040000; pub const XCLUDE: tcflag_t = 0o100000; pub const CRTSXOFF: tcflag_t = 0o10000000000; pub const CRTSCTS: tcflag_t = 0o20000000000; pub const CIBAUD: tcflag_t = 0o3600000; pub const PAREXT: tcflag_t = 0o4000000; pub const CBAUDEXT: tcflag_t = 0o10000000; pub const CIBAUDEXT: tcflag_t = 0o20000000; // c_lflag bits pub const ISIG: tcflag_t = 0o000001; pub const ICANON: tcflag_t = 0o000002; pub const XCASE: tcflag_t = 0o000004; pub const ECHO: tcflag_t = 0o000010; pub const ECHOE: tcflag_t = 0o000020; pub const ECHOK: tcflag_t = 0o000040; pub const ECHONL: tcflag_t = 0o000100; pub const NOFLSH: tcflag_t = 0o000200; pub const TOSTOP: tcflag_t = 0o000400; pub const ECHOCTL: tcflag_t = 0o001000; pub const ECHOPRT: tcflag_t = 0o002000; pub const ECHOKE: tcflag_t = 0o004000; pub const DEFECHO: tcflag_t = 0o010000; pub const FLUSHO: tcflag_t = 0o020000; pub const PENDIN: tcflag_t = 0o040000; pub const IEXTEN: tcflag_t = 0o100000; // baud rates pub const B0: speed_t = 0; pub const B50: speed_t = 1; pub const B75: speed_t = 2; pub const B110: speed_t = 3; pub const B134: speed_t = 4; pub const B150: speed_t = 5; pub const B200: speed_t = 6; pub const B300: speed_t = 7; pub const B600: speed_t = 8; pub const B1200: speed_t = 9; pub const B1800: speed_t = 10; pub const B2400: speed_t = 11; pub const B4800: speed_t = 12; pub const B9600: speed_t = 13; pub const B19200: speed_t = 14; pub const B38400: speed_t = 15; pub const EXTA: speed_t = B19200; pub const EXTB: speed_t = B38400; pub const B57600: speed_t = 16; pub const B76800: speed_t = 17; pub const B115200: speed_t = 18; pub const B153600: speed_t = 19; pub const B230400: speed_t = 20; pub const B307200: speed_t = 21; pub const B460800: speed_t = 22; pub const B921600: speed_t = 23; // tcflow() pub const TCOOFF: c_int = 0; pub const TCOON: c_int = 1; pub const TCIOFF: c_int = 2; pub const TCION: c_int = 3; // tcflush() pub const TCIFLUSH: c_int = 0; pub const TCOFLUSH: c_int = 1; pub const TCIOFLUSH: c_int = 2; // tcsetattr() pub const TCSANOW: c_int = 0x540E; pub const TCSADRAIN: c_int = 0x540F; pub const TCSAFLUSH: c_int = 0x5410; termios-0.3.3/.cargo_vcs_info.json0000644000000001120000000000000125520ustar00{ "git": { "sha1": "c0a99bf904ab41a152a43dd9cdd2c44eb0857b47" } }