1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

moved more to unix utils, minor review updates

This commit is contained in:
Martin Kysel 2016-08-23 11:40:09 +01:00
parent a90aec3f1b
commit 23bab3df69
2 changed files with 5 additions and 7 deletions

View file

@ -21,6 +21,7 @@ unix = [
"logname",
"mkfifo",
"mknod",
"more",
"mv",
"nice",
"nohup",
@ -63,7 +64,6 @@ generic = [
"ls",
"mkdir",
"mktemp",
"more",
"nl",
"nproc",
"od",

View file

@ -15,7 +15,7 @@ extern crate getopts;
extern crate uucore;
use getopts::Options;
use std::io::{stdout, stdin, stderr, Write, Read, Result};
use std::io::{stdout, Write, Read};
use std::fs::File;
extern crate nix;
@ -75,12 +75,11 @@ fn help(usage: &str) {
}
fn more(matches: getopts::Matches) {
let mut files = matches.free;
let files = matches.free;
let mut f = File::open(files.first().unwrap()).unwrap();
let mut buffer = [0; 1024];
let saved_term = termios::tcgetattr(0).unwrap();
let mut term = saved_term;
let mut term = termios::tcgetattr(0).unwrap();
// Unset canonical mode, so we get characters immediately
term.c_lflag.remove(termios::ICANON);
// Disable local echo
@ -92,8 +91,7 @@ fn more(matches: getopts::Matches) {
if sz == 0 { break; }
stdout().write(&buffer[0..sz]).unwrap();
for byte in std::io::stdin().bytes() {
let byte = byte.unwrap();
match byte {
match byte.unwrap() {
b' ' => break,
b'q' | 27 => {
end = true;