mirror of
https://github.com/uutils/coreutils.git
synced 2025-07-07 21:45:01 +00:00
docs ~ spell-check repairs and addition of exceptions
This commit is contained in:
parent
ce1d6d882a
commit
f82de13847
133 changed files with 332 additions and 93 deletions
|
@ -1,6 +1,4 @@
|
|||
# spell-checker:ignore (cargo-make) duckscript macos
|
||||
# spell-checker:ignore (rust) clippy
|
||||
# spell-checker:ignore (uutils) uutil uutils
|
||||
# spell-checker:ignore (cargo-make) duckscript
|
||||
|
||||
[config]
|
||||
min_version = "0.26.2"
|
||||
|
|
3
build.rs
3
build.rs
|
@ -1,5 +1,4 @@
|
|||
// spell-checker:ignore (utils) chgrp chmod chown chroot cksum dircolors hashsum hostid logname mkdir mkfifo mknod mktemp nohup nproc numfmt pathchk printenv printf readlink realpath relpath rmdir shuf stdbuf tsort uname unexpand whoami
|
||||
// spell-checker:ignore () uutils uumain rustfmt rustc macos krate
|
||||
// spell-checker:ignore (vars) krate
|
||||
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
|
|
|
@ -7,11 +7,6 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
// spell-checker:ignore (acronyms/names) Gehring
|
||||
// spell-checker:ignore (rustlang/crates) clippy concat rustlang termwidth textwrap
|
||||
// spell-checker:ignore (uutils) coreutils sigpipe uucore uumain uutils
|
||||
// spell-checker:ignore (shell) busybox symlinks
|
||||
|
||||
extern crate lazy_static;
|
||||
extern crate textwrap;
|
||||
extern crate uucore;
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
|
||||
use uucore::encoding::{wrap_print, Data, Format};
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, BufReader, Read};
|
||||
use std::path::Path;
|
||||
|
||||
use uucore::encoding::{wrap_print, Data, Format};
|
||||
|
||||
pub fn execute(
|
||||
args: Vec<String>,
|
||||
syntax: &str,
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
|
||||
use uucore::encoding::{wrap_print, Data, Format};
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{stdin, BufReader, Read};
|
||||
use std::path::Path;
|
||||
|
||||
use uucore::encoding::{wrap_print, Data, Format};
|
||||
|
||||
pub fn execute(
|
||||
args: Vec<String>,
|
||||
syntax: &str,
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) fullname
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "uu_cat"
|
|||
version = "0.0.1"
|
||||
authors = ["uutils developers"]
|
||||
license = "MIT"
|
||||
description = "cat ~ (uutils) concatentate and display input"
|
||||
description = "cat ~ (uutils) concatenate and display input"
|
||||
|
||||
homepage = "https://github.com/uutils/coreutils"
|
||||
repository = "https://github.com/uutils/coreutils/tree/master/src/uu/cat"
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) nonprint nonblank nonprinting
|
||||
|
||||
#[macro_use]
|
||||
extern crate quick_error;
|
||||
#[cfg(unix)]
|
||||
|
@ -265,7 +267,7 @@ fn open(path: &str) -> CatResult<InputHandle> {
|
|||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `files` - There is no short circuit when encountiner an error
|
||||
/// * `files` - There is no short circuit when encountering an error
|
||||
/// reading a file in this vector
|
||||
fn write_fast(files: Vec<String>) -> CatResult<()> {
|
||||
let mut writer = stdout();
|
||||
|
@ -310,7 +312,7 @@ struct OutputState {
|
|||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `files` - There is no short circuit when encountiner an error
|
||||
/// * `files` - There is no short circuit when encountering an error
|
||||
/// reading a file in this vector
|
||||
fn write_lines(files: Vec<String>, options: &OutputOptions) -> CatResult<()> {
|
||||
let mut error_count = 0;
|
||||
|
@ -332,7 +334,7 @@ fn write_lines(files: Vec<String>, options: &OutputOptions) -> CatResult<()> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Outputs file contents to stdout in a linewise fashion,
|
||||
/// Outputs file contents to stdout in a line-by-line fashion,
|
||||
/// propagating any errors that might occur.
|
||||
fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState) -> CatResult<()> {
|
||||
let mut handle = open(file)?;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) COMFOLLOW Chgrper RFILE RFILE's derefer dgid nonblank nonprint nonprinting
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
pub use uucore::entries;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) Chmoder cmode fmode fperm fref ugoa RFILE RFILE's
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
extern crate walker;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
||||
|
||||
// spell-checker:ignore (ToDO) COMFOLLOW Chowner Passwd RFILE RFILE's derefer dgid duid
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
pub use uucore::entries::{self, Group, Locate, Passwd};
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) NEWROOT Userspec pstatus
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) fname
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) delim mkdelim
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<!-- spell-checker:ignore (markdown) markdownlint -->
|
||||
|
||||
## Feature list
|
||||
|
||||
<!-- spell-checker:ignore (options) linkgs reflink -->
|
||||
|
||||
### To Do
|
||||
|
||||
- [ ] archive
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) ficlone linkgs lstat nlink nlinks pathbuf reflink strs xattrs
|
||||
|
||||
extern crate clap;
|
||||
extern crate filetime;
|
||||
#[cfg(target_os = "linux")]
|
||||
|
@ -690,7 +692,7 @@ fn parse_path_args(path_args: &[String], options: &Options) -> CopyResult<(Vec<S
|
|||
|
||||
let (sources, target) = match options.target_dir {
|
||||
Some(ref target) => {
|
||||
// All path arges are sources, and the target dir was
|
||||
// All path args are sources, and the target dir was
|
||||
// specified separately
|
||||
(paths, PathBuf::from(target))
|
||||
}
|
||||
|
@ -1041,7 +1043,7 @@ fn handle_existing_dest(source: &Path, dest: &Path, options: &Options) -> CopyRe
|
|||
}
|
||||
|
||||
/// Copy the a file from `source` to `dest`. No path manipulation is
|
||||
/// done on either `source` or `dest`, the are used as provieded.
|
||||
/// done on either `source` or `dest`, the are used as provided.
|
||||
///
|
||||
/// Behavior when copying to existing files is contingent on the
|
||||
/// `options.overwrite` mode. If a file is skipped, the return type
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
// spell-checker:ignore (ToDO) SRes Newl
|
||||
|
||||
use std::io::Result as IoResult;
|
||||
use std::io::{BufRead, BufReader, Read, Write};
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) delim sourcefiles
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
|
@ -110,7 +112,7 @@ struct Options {
|
|||
|
||||
struct FieldOptions {
|
||||
delimiter: String, // one char long, String because of UTF8 representation
|
||||
out_delimeter: Option<String>,
|
||||
out_delimiter: Option<String>,
|
||||
only_delimited: bool,
|
||||
zero_terminated: bool,
|
||||
}
|
||||
|
@ -288,7 +290,7 @@ fn cut_fields_delimiter<R: Read>(
|
|||
#[allow(clippy::cognitive_complexity)]
|
||||
fn cut_fields<R: Read>(reader: R, ranges: &[Range], opts: &FieldOptions) -> i32 {
|
||||
let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' };
|
||||
if let Some(ref o_delim) = opts.out_delimeter {
|
||||
if let Some(ref o_delim) = opts.out_delimiter {
|
||||
return cut_fields_delimiter(
|
||||
reader,
|
||||
ranges,
|
||||
|
@ -498,7 +500,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
ranges,
|
||||
FieldOptions {
|
||||
delimiter: delim,
|
||||
out_delimeter: out_delim,
|
||||
out_delimiter: out_delim,
|
||||
only_delimited,
|
||||
zero_terminated,
|
||||
},
|
||||
|
@ -509,7 +511,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
ranges,
|
||||
FieldOptions {
|
||||
delimiter: "\t".to_owned(),
|
||||
out_delimeter: out_delim,
|
||||
out_delimiter: out_delim,
|
||||
only_delimited,
|
||||
zero_terminated,
|
||||
},
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
// spell-checker:ignore (ToDO) inval
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug)]
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (format) MMDDhhmm
|
||||
// spell-checker:ignore (ToDO) DATEFILE
|
||||
|
||||
extern crate chrono;
|
||||
|
||||
extern crate clap;
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) mountinfo mtab BLOCKSIZE getmntinfo fobj mptr noatime Iused overmounted
|
||||
// spell-checker:ignore (libc/fs) asyncreads asyncwrites autofs bavail bfree bsize charspare cifs debugfs devfs devpts ffree frsize fsid fstypename fusectl inode inodes iosize kernfs mntbufp mntfromname mntonname mqueue namemax pipefs smbfs statfs statvfs subfs syncreads syncwrites sysfs wcslen
|
||||
|
||||
extern crate clap;
|
||||
extern crate libc;
|
||||
extern crate number_prefix;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) EIGHTBIT ETERM MULTIHARDLINK cpio dtterm jfbterm konsole kterm mlterm rmvb rxvt stat'able svgz tmux webm xspf
|
||||
|
||||
pub const INTERNAL_DB: &str = r#"# Configuration file for dircolors, a utility to help you set the
|
||||
# LS_COLORS environment variable used by GNU ls with the --color option.
|
||||
# Copyright (C) 1996-2016 Free Software Foundation, Inc.
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) clrtoeol dircolors eightbit endcode fnmatch leftcode multihardlink rightcode setenv sgid suid
|
||||
|
||||
extern crate glob;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) BLOCKSIZE inode inodes ment strs
|
||||
|
||||
extern crate time;
|
||||
|
||||
#[macro_use]
|
||||
|
|
2
src/uu/env/src/env.rs
vendored
2
src/uu/env/src/env.rs
vendored
|
@ -7,6 +7,8 @@
|
|||
|
||||
/* last synced with: env (GNU coreutils) 8.13 */
|
||||
|
||||
// spell-checker:ignore (ToDO) execvp progname subcommand subcommands unsets
|
||||
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) ctype cwidth iflag nbytes nspaces nums tspaces uflag
|
||||
|
||||
extern crate getopts;
|
||||
extern crate unicode_width;
|
||||
|
||||
|
|
|
@ -6,10 +6,12 @@
|
|||
//* file that was distributed with this source code.
|
||||
|
||||
//!
|
||||
//! Here we employ shunting-yard algorithm for building AST from tokens according to operators' precedence and associativeness.
|
||||
//! Here we employ shunting-yard algorithm for building AST from tokens according to operators' precedence and associative-ness.
|
||||
//! * https://en.wikipedia.org/wiki/Shunting-yard_algorithm
|
||||
//!
|
||||
|
||||
// spell-checker:ignore (ToDO) binop binops ints paren prec
|
||||
|
||||
use onig::{Regex, RegexOptions, Syntax};
|
||||
|
||||
use crate::tokens::Token;
|
||||
|
@ -199,7 +201,10 @@ pub fn tokens_to_ast(
|
|||
maybe_dump_rpn(&out_stack);
|
||||
let result = ast_from_rpn(&mut out_stack);
|
||||
if !out_stack.is_empty() {
|
||||
Err("syntax error (fist RPN token does not represent expression AST's root)".to_owned())
|
||||
Err(
|
||||
"syntax error (first RPN token does not represent the root of the expression AST)"
|
||||
.to_owned(),
|
||||
)
|
||||
} else {
|
||||
maybe_dump_ast(&result);
|
||||
result
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
//! Hence all we need is to map the strings into the Token structures, except for some ugly fiddling with +-escaping.
|
||||
//!
|
||||
|
||||
// spell-checker:ignore (ToDO) paren
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Token {
|
||||
Value {
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
|
||||
//! Generate a table of the multiplicative inverses of p_i mod 2^64
|
||||
//! for the first 1027 odd primes (all 13 bit and smaller primes).
|
||||
//! You can supply a commandline argument to override the default
|
||||
//! You can supply a command line argument to override the default
|
||||
//! value of 1027 for the number of entries in the table.
|
||||
//!
|
||||
//! 2 has no multiplicative inverse mode 2^64 because 2 | 2^64,
|
||||
//! and in any case divisibility by two is trivial by checking the LSB.
|
||||
|
||||
// spell-checker:ignore (ToDO) invs newr newrp newtp outstr
|
||||
|
||||
#![cfg_attr(test, allow(dead_code))]
|
||||
|
||||
use std::env::{self, args};
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE file
|
||||
// * that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) filts, minidx, minkey paridx
|
||||
|
||||
use std::iter::{Chain, Cycle, Map};
|
||||
use std::slice::Iter;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (URL) appspot
|
||||
|
||||
use crate::numeric::*;
|
||||
|
||||
// Small set of bases for the Miller-Rabin prime test, valid for all 64b integers;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker: ignore (ToDO) INVS
|
||||
|
||||
use std::num::Wrapping;
|
||||
|
||||
use crate::Factors;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) PSKIP linebreak ostream parasplit tabwidth xanti xprefix
|
||||
|
||||
extern crate unicode_width;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) INFTY MULT accum breakwords linebreak linebreaking linebreaks linelen maxlength minlength nchars ostream overlen parasplit plass posn powf punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen
|
||||
|
||||
use std::cmp;
|
||||
use std::i64;
|
||||
use std::io::{BufWriter, Stdout, Write};
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) INFTY MULT PSKIP accum aftertab beforetab breakwords fmt's formatline linebreak linebreaking linebreaks linelen maxlength minlength nchars noformat noformatline ostream overlen parasplit pfxind plass pmatch poffset posn powf prefixindent punct signum slen sstart tabwidth tlen underlen winfo wlen wordlen wordsplits xanti xprefix
|
||||
|
||||
use std::io::{BufRead, Lines};
|
||||
use std::iter::Peekable;
|
||||
use std::slice::Iter;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDOs) ncount routput
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) passwd
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
use uucore::entries::{get_groups, gid2grp, Locate, Passwd};
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) algo, algoname, regexes, nread
|
||||
|
||||
extern crate getopts;
|
||||
extern crate hex;
|
||||
extern crate md5;
|
||||
|
|
|
@ -131,16 +131,16 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
let mut buffer = BufReader::new(stdin());
|
||||
head(&mut buffer, &settings);
|
||||
} else {
|
||||
let mut firstime = true;
|
||||
let mut first_time = true;
|
||||
|
||||
for file in &files {
|
||||
if settings.verbose {
|
||||
if !firstime {
|
||||
if !first_time {
|
||||
println!();
|
||||
}
|
||||
println!("==> {} <==", file);
|
||||
}
|
||||
firstime = false;
|
||||
first_time = false;
|
||||
|
||||
let path = Path::new(file);
|
||||
let reader = File::open(&path).unwrap();
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE file
|
||||
// * that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) gethostid
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) MAKEWORD addrs hashset
|
||||
|
||||
extern crate clap;
|
||||
extern crate hostname;
|
||||
extern crate libc;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
// http://ftp-archive.freebsd.org/mirror/FreeBSD-Archive/old-releases/i386/1.0-RELEASE/ports/shellutils/src/id.c
|
||||
// http://www.opensource.apple.com/source/shell_cmds/shell_cmds-118/id/id.c
|
||||
|
||||
// spell-checker:ignore (ToDO) asid auditid auditinfo auid cstr egid emod euid getaudit getlogin gflag nflag pline rflag termid uflag
|
||||
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE file
|
||||
// * that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) rwxr sourcepath targetpath
|
||||
|
||||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
|
@ -25,7 +27,7 @@ static LONG_HELP: &str = "";
|
|||
const DEFAULT_MODE: u32 = 755;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct Behaviour {
|
||||
pub struct Behavior {
|
||||
main_function: MainFunction,
|
||||
specified_mode: Option<u32>,
|
||||
suffix: String,
|
||||
|
@ -40,7 +42,7 @@ pub enum MainFunction {
|
|||
Standard,
|
||||
}
|
||||
|
||||
impl Behaviour {
|
||||
impl Behavior {
|
||||
/// Determine the mode for chmod after copy.
|
||||
pub fn mode(&self) -> u32 {
|
||||
match self.specified_mode {
|
||||
|
@ -62,7 +64,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
return 2;
|
||||
}
|
||||
|
||||
let behaviour = match behaviour(&matches) {
|
||||
let behavior = match behavior(&matches) {
|
||||
Ok(x) => x,
|
||||
Err(ret) => {
|
||||
return ret;
|
||||
|
@ -80,9 +82,9 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
arguments.map(to_owned).collect()
|
||||
};
|
||||
|
||||
match behaviour.main_function {
|
||||
MainFunction::Directory => directory(&paths[..], behaviour),
|
||||
MainFunction::Standard => standard(&paths[..], behaviour),
|
||||
match behavior.main_function {
|
||||
MainFunction::Directory => directory(&paths[..], behavior),
|
||||
MainFunction::Standard => standard(&paths[..], behavior),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,15 +253,15 @@ fn check_unimplemented(matches: &getopts::Matches) -> Result<(), &str> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Determine behaviour, given command line arguments.
|
||||
/// Determine behavior, given command line arguments.
|
||||
///
|
||||
/// If successful, returns a filled-out Behaviour struct.
|
||||
/// If successful, returns a filled-out Behavior struct.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// In event of failure, returns an integer intended as a program return code.
|
||||
///
|
||||
fn behaviour(matches: &getopts::Matches) -> Result<Behaviour, i32> {
|
||||
fn behavior(matches: &getopts::Matches) -> Result<Behavior, i32> {
|
||||
let main_function = if matches.opt_present("directory") {
|
||||
MainFunction::Directory
|
||||
} else {
|
||||
|
@ -306,7 +308,7 @@ fn behaviour(matches: &getopts::Matches) -> Result<Behaviour, i32> {
|
|||
"~".to_owned()
|
||||
};
|
||||
|
||||
Ok(Behaviour {
|
||||
Ok(Behavior {
|
||||
main_function,
|
||||
specified_mode,
|
||||
suffix: backup_suffix,
|
||||
|
@ -321,7 +323,7 @@ fn behaviour(matches: &getopts::Matches) -> Result<Behaviour, i32> {
|
|||
///
|
||||
/// Returns an integer intended as a program return code.
|
||||
///
|
||||
fn directory(paths: &[PathBuf], b: Behaviour) -> i32 {
|
||||
fn directory(paths: &[PathBuf], b: Behavior) -> i32 {
|
||||
if paths.is_empty() {
|
||||
println!("{} with -d requires at least one argument.", NAME);
|
||||
1
|
||||
|
@ -363,11 +365,11 @@ fn is_new_file_path(path: &Path) -> bool {
|
|||
path.is_file() || !path.exists() && path.parent().map(Path::is_dir).unwrap_or(true)
|
||||
}
|
||||
|
||||
/// Perform an install, given a list of paths and behaviour.
|
||||
/// Perform an install, given a list of paths and behavior.
|
||||
///
|
||||
/// Returns an integer intended as a program return code.
|
||||
///
|
||||
fn standard(paths: &[PathBuf], b: Behaviour) -> i32 {
|
||||
fn standard(paths: &[PathBuf], b: Behavior) -> i32 {
|
||||
if paths.len() < 2 {
|
||||
println!("{} requires at least 2 arguments.", NAME);
|
||||
1
|
||||
|
@ -393,7 +395,7 @@ fn standard(paths: &[PathBuf], b: Behaviour) -> i32 {
|
|||
/// _files_ must all exist as non-directories.
|
||||
/// _target_dir_ must be a directory.
|
||||
///
|
||||
fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -> i32 {
|
||||
fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 {
|
||||
if !target_dir.is_dir() {
|
||||
show_error!("target ‘{}’ is not a directory", target_dir.display());
|
||||
return 1;
|
||||
|
@ -435,7 +437,7 @@ fn copy_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -
|
|||
/// _file_ must exist as a non-directory.
|
||||
/// _target_ must be a non-directory
|
||||
///
|
||||
fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behaviour) -> i32 {
|
||||
fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behavior) -> i32 {
|
||||
if copy(file, &target, b).is_err() {
|
||||
1
|
||||
} else {
|
||||
|
@ -454,7 +456,7 @@ fn copy_file_to_file(file: &PathBuf, target: &PathBuf, b: &Behaviour) -> i32 {
|
|||
///
|
||||
/// If the copy system call fails, we print a verbose error and return an empty error value.
|
||||
///
|
||||
fn copy(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> Result<(), ()> {
|
||||
fn copy(from: &PathBuf, to: &PathBuf, b: &Behavior) -> Result<(), ()> {
|
||||
let io_result = fs::copy(from, to);
|
||||
|
||||
if let Err(err) = io_result {
|
||||
|
|
|
@ -9,7 +9,7 @@ use uucore::mode;
|
|||
pub fn parse(mode_string: &str, considering_dir: bool) -> Result<u32, String> {
|
||||
let numbers: &[char] = &['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
|
||||
// Passing 000 as the existing permissions seems to mirror GNU behaviour.
|
||||
// Passing 000 as the existing permissions seems to mirror GNU behavior.
|
||||
if mode_string.contains(numbers) {
|
||||
mode::parse_numeric(0, mode_string)
|
||||
} else {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck
|
||||
|
||||
extern crate clap;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE file
|
||||
// * that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) signalname pids
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) srcpath targetpath EEXIST
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
/* last synced with: logname (GNU coreutils) 8.22 */
|
||||
|
||||
// spell-checker:ignore (ToDO) getlogin userlogin
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf
|
||||
|
||||
extern crate getopts;
|
||||
#[cfg(unix)]
|
||||
extern crate isatty;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) parsemode makedev sysmacros makenod newmode perror IFBLK IFCHR IFIFO
|
||||
|
||||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) fperm
|
||||
|
||||
extern crate libc;
|
||||
use libc::{mode_t, S_IRGRP, S_IROTH, S_IRUSR, S_IWGRP, S_IWOTH, S_IWUSR};
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) tempfile tempdir SUFF TMPDIR tmpname
|
||||
|
||||
extern crate getopts;
|
||||
extern crate rand;
|
||||
extern crate tempfile;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) tempdir tmpdir
|
||||
|
||||
// Mainly taken from crate `tempdir`
|
||||
|
||||
extern crate rand;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE file
|
||||
// * that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) lflag ICANON tcgetattr tcsetattr TCSADRAIN
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// For the full copyright and license information, please view the LICENSE file
|
||||
// that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) sourcepath targetpath
|
||||
|
||||
extern crate fs_extra;
|
||||
extern crate getopts;
|
||||
|
||||
|
@ -26,7 +28,7 @@ use fs_extra::dir::{move_dir, CopyOptions as DirCopyOptions};
|
|||
static NAME: &str = "mv";
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub struct Behaviour {
|
||||
pub struct Behavior {
|
||||
overwrite: OverwriteMode,
|
||||
backup: BackupMode,
|
||||
suffix: String,
|
||||
|
@ -117,7 +119,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
return 1;
|
||||
}
|
||||
|
||||
let behaviour = Behaviour {
|
||||
let behavior = Behavior {
|
||||
overwrite: overwrite_mode,
|
||||
backup: backup_mode,
|
||||
suffix: backup_suffix,
|
||||
|
@ -147,7 +149,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
|
|||
help(&usage);
|
||||
0
|
||||
} else {
|
||||
exec(&paths[..], behaviour)
|
||||
exec(&paths[..], behavior)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,7 +227,7 @@ fn help(usage: &str) {
|
|||
);
|
||||
}
|
||||
|
||||
fn exec(files: &[PathBuf], b: Behaviour) -> i32 {
|
||||
fn exec(files: &[PathBuf], b: Behavior) -> i32 {
|
||||
if let Some(ref name) = b.target_dir {
|
||||
return move_files_into_dir(files, &PathBuf::from(name), &b);
|
||||
}
|
||||
|
@ -309,7 +311,7 @@ fn exec(files: &[PathBuf], b: Behaviour) -> i32 {
|
|||
0
|
||||
}
|
||||
|
||||
fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -> i32 {
|
||||
fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behavior) -> i32 {
|
||||
if !target_dir.is_dir() {
|
||||
show_error!("target ‘{}’ is not a directory", target_dir.display());
|
||||
return 1;
|
||||
|
@ -347,7 +349,7 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &PathBuf, b: &Behaviour) -
|
|||
}
|
||||
}
|
||||
|
||||
fn rename(from: &PathBuf, to: &PathBuf, b: &Behaviour) -> io::Result<()> {
|
||||
fn rename(from: &PathBuf, to: &PathBuf, b: &Behavior) -> io::Result<()> {
|
||||
let mut backup_path = None;
|
||||
|
||||
if to.exists() {
|
||||
|
@ -413,7 +415,7 @@ fn rename_with_fallback(from: &PathBuf, to: &PathBuf) -> io::Result<()> {
|
|||
rename_symlink_fallback(&from, &to)?;
|
||||
} else if file_type.is_dir() {
|
||||
// We remove the destination directory if it exists to match the
|
||||
// behaviour of `fs::rename`. As far as I can tell, `fs_extra`'s
|
||||
// behavior of `fs::rename`. As far as I can tell, `fs_extra`'s
|
||||
// `move_dir` would otherwise behave differently.
|
||||
if to.exists() {
|
||||
fs::remove_dir_all(to)?;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) getpriority execvp setpriority nstr PRIO cstrs ENOENT
|
||||
|
||||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv
|
||||
|
||||
extern crate getopts;
|
||||
extern crate regex;
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// * file that was distributed with this source code.
|
||||
// *
|
||||
|
||||
// spell-checker:ignore (ToDO) corasick memchr
|
||||
|
||||
extern crate aho_corasick;
|
||||
extern crate getopts;
|
||||
extern crate memchr;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) execvp SIGHUP cproc vprocmgr cstrs homeout
|
||||
|
||||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) NPROCESSORS nprocs numstr threadstr sysconf
|
||||
|
||||
extern crate getopts;
|
||||
extern crate num_cpus;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) byteorder
|
||||
|
||||
// workaround until https://github.com/BurntSushi/byteorder/issues/41 has been fixed
|
||||
// based on: https://github.com/netvl/immeta/blob/4460ee/src/utils.rs#L76
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) formatteriteminfo
|
||||
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Copy)]
|
||||
|
|
|
@ -70,7 +70,7 @@ fn test_input_offset() {
|
|||
sut.increase_position(10);
|
||||
assert_eq!("000014", &sut.format_byte_offset());
|
||||
|
||||
// note normally the radix will not change after initialisation
|
||||
// note normally the radix will not change after initialization
|
||||
sut.set_radix(Radix::Decimal);
|
||||
assert_eq!("0000020", &sut.format_byte_offset());
|
||||
|
||||
|
@ -95,7 +95,7 @@ fn test_input_offset_with_label() {
|
|||
sut.increase_position(10);
|
||||
assert_eq!("000014 (00001E)", &sut.format_byte_offset());
|
||||
|
||||
// note normally the radix will not change after initialisation
|
||||
// note normally the radix will not change after initialization
|
||||
sut.set_radix(Radix::Decimal);
|
||||
assert_eq!("0000020 (0000030)", &sut.format_byte_offset());
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) multifile curr fnames fname xfrd fillloop mockstream
|
||||
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::io::BufReader;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) formatteriteminfo inputdecoder inputoffset mockstream nrofbytes partialreader odfunc multifile exitcode
|
||||
|
||||
extern crate byteorder;
|
||||
extern crate getopts;
|
||||
extern crate half;
|
||||
|
@ -54,14 +56,14 @@ static USAGE: &str = r#"Usage:
|
|||
|
||||
Displays data in various human-readable formats. If multiple formats are
|
||||
specified, the output will contain all formats in the order they appear on the
|
||||
commandline. Each format will be printed on a new line. Only the line
|
||||
command line. Each format will be printed on a new line. Only the line
|
||||
containing the first format will be prefixed with the offset.
|
||||
|
||||
If no filename is specified, or it is "-", stdin will be used. After a "--", no
|
||||
more options will be recognised. This allows for filenames starting with a "-".
|
||||
more options will be recognized. This allows for filenames starting with a "-".
|
||||
|
||||
If a filename is a valid number which can be used as an offset in the second
|
||||
form, you can force it to be recognised as a filename if you include an option
|
||||
form, you can force it to be recognized as a filename if you include an option
|
||||
like "-j0", which is only valid in the first form.
|
||||
|
||||
RADIX is one of o,d,x,n for octal, decimal, hexadecimal or none.
|
||||
|
@ -84,7 +86,7 @@ TYPE contains one or more format specifications consisting of:
|
|||
SIZE is the number of bytes which can be the number 1, 2, 4, 8 or 16,
|
||||
or C, I, S, L for 1, 2, 4, 8 bytes for integer types,
|
||||
or F, D, L for 4, 8, 16 bytes for floating point.
|
||||
Any type specification can have a "z" suffic, which will add a ASCII dump at
|
||||
Any type specification can have a "z" suffix, which will add a ASCII dump at
|
||||
the end of the line.
|
||||
|
||||
If an error occurred, a diagnostic message will be printed to stderr, and the
|
||||
|
@ -286,7 +288,7 @@ impl OdOptions {
|
|||
}
|
||||
}
|
||||
|
||||
/// parses and validates commandline parameters, prepares data structures,
|
||||
/// parses and validates command line parameters, prepares data structures,
|
||||
/// opens the input and calls `odfunc` to process the input.
|
||||
pub fn uumain(args: Vec<String>) -> i32 {
|
||||
let opts = create_getopts_options();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore formatteriteminfo blocksize thisblock
|
||||
|
||||
use std::cmp;
|
||||
use std::slice::Iter;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore formatteriteminfo docopt fvox fvoxw vals acdx
|
||||
|
||||
use crate::formatteriteminfo::FormatterItemInfo;
|
||||
use crate::prn_char::*;
|
||||
use crate::prn_float::*;
|
||||
|
@ -89,9 +91,9 @@ fn od_argument_with_option(ch: char) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
/// Parses format flags from commandline
|
||||
/// Parses format flags from command line
|
||||
///
|
||||
/// getopts, docopt, clap don't seem suitable to parse the commandline
|
||||
/// getopts, docopt, clap don't seem suitable to parse the command line
|
||||
/// arguments used for formats. In particular arguments can appear
|
||||
/// multiple times and the order they appear in, is significant.
|
||||
///
|
||||
|
@ -99,7 +101,7 @@ fn od_argument_with_option(ch: char) -> bool {
|
|||
/// it can also be mixed with non format related flags like -v: -fvox
|
||||
/// arguments with parameters like -w16 can only appear at the end: -fvoxw16
|
||||
/// parameters of -t/--format specify 1 or more formats.
|
||||
/// if -- appears on the commandline, parsing should stop.
|
||||
/// if -- appears on the command line, parsing should stop.
|
||||
pub fn parse_format_flags(args: &[String]) -> Result<Vec<ParsedFormatterItemInfo>, String> {
|
||||
let mut formats = Vec::new();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use getopts::Matches;
|
|||
|
||||
/// Abstraction for getopts
|
||||
pub trait CommandLineOpts {
|
||||
/// returns all commandline parameters which do not belong to an option.
|
||||
/// returns all command line parameters which do not belong to an option.
|
||||
fn inputs(&self) -> Vec<String>;
|
||||
/// tests if any of the specified options is present.
|
||||
fn opts_present(&self, _: &[&str]) -> bool;
|
||||
|
@ -31,7 +31,7 @@ pub enum CommandLineInputs {
|
|||
FileAndOffset((String, usize, Option<usize>)),
|
||||
}
|
||||
|
||||
/// Interprets the commandline inputs of od.
|
||||
/// Interprets the command line inputs of od.
|
||||
///
|
||||
/// Returns either an unspecified number of filenames.
|
||||
/// Or it will return a single filename, with an offset and optional label.
|
||||
|
@ -45,7 +45,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result<CommandLineInputs,
|
|||
return parse_inputs_traditional(input_strings);
|
||||
}
|
||||
|
||||
// test if commandline contains: [file] <offset>
|
||||
// test if command line contains: [file] <offset>
|
||||
// fall-through if no (valid) offset is found
|
||||
if input_strings.len() == 1 || input_strings.len() == 2 {
|
||||
// if any of the options -A, -j, -N, -t, -v or -w are present there is no offset
|
||||
|
@ -74,7 +74,7 @@ pub fn parse_inputs(matches: &dyn CommandLineOpts) -> Result<CommandLineInputs,
|
|||
Ok(CommandLineInputs::FileNames(input_strings))
|
||||
}
|
||||
|
||||
/// interprets inputs when --traditional is on the commandline
|
||||
/// interprets inputs when --traditional is on the command line
|
||||
///
|
||||
/// normally returns CommandLineInputs::FileAndOffset, but if no offset is found,
|
||||
/// it returns CommandLineInputs::FileNames (also to differentiate from the offset == 0)
|
||||
|
@ -125,7 +125,7 @@ pub fn parse_inputs_traditional(input_strings: Vec<String>) -> Result<CommandLin
|
|||
}
|
||||
}
|
||||
|
||||
/// parses format used by offset and label on the commandline
|
||||
/// parses format used by offset and label on the command line
|
||||
pub fn parse_offset_operand(s: &str) -> Result<usize, &'static str> {
|
||||
let mut start = 0;
|
||||
let mut len = s.len();
|
||||
|
@ -159,10 +159,10 @@ pub fn parse_offset_operand(s: &str) -> Result<usize, &'static str> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// A mock for the commandline options type
|
||||
/// A mock for the command line options type
|
||||
///
|
||||
/// `inputs` are all commandline parameters which do not belong to an option.
|
||||
/// `option_names` are the names of the options on the commandline.
|
||||
/// `inputs` are all command line parameters which do not belong to an option.
|
||||
/// `option_names` are the names of the options on the command line.
|
||||
struct MockOptions<'a> {
|
||||
inputs: Vec<String>,
|
||||
option_names: Vec<&'a str>,
|
||||
|
@ -245,13 +245,13 @@ mod tests {
|
|||
parse_inputs(&MockOptions::new(vec!["+10a"], vec![""])).unwrap()
|
||||
);
|
||||
|
||||
// if -j is included in the commandline, there cannot be an offset.
|
||||
// if -j is included in the command line, there cannot be an offset.
|
||||
assert_eq!(
|
||||
CommandLineInputs::FileNames(vec!["+10".to_string()]),
|
||||
parse_inputs(&MockOptions::new(vec!["+10"], vec!["j"])).unwrap()
|
||||
);
|
||||
|
||||
// if -v is included in the commandline, there cannot be an offset.
|
||||
// if -v is included in the command line, there cannot be an offset.
|
||||
assert_eq!(
|
||||
CommandLineInputs::FileNames(vec!["+10".to_string()]),
|
||||
parse_inputs(&MockOptions::new(vec!["+10"], vec!["o", "v"])).unwrap()
|
||||
|
@ -278,7 +278,7 @@ mod tests {
|
|||
parse_inputs(&MockOptions::new(vec!["file1", "+10"], vec!["j"])).unwrap()
|
||||
);
|
||||
|
||||
// offset must be last on the commandline
|
||||
// offset must be last on the command line
|
||||
assert_eq!(
|
||||
CommandLineInputs::FileNames(vec!["+10".to_string(), "file1".to_string()]),
|
||||
parse_inputs(&MockOptions::new(vec!["+10", "file1"], vec![""])).unwrap()
|
||||
|
@ -287,7 +287,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_parse_inputs_traditional() {
|
||||
// it should not return FileAndOffset to signal no offset was entered on the commandline.
|
||||
// it should not return FileAndOffset to signal no offset was entered on the command line.
|
||||
assert_eq!(
|
||||
CommandLineInputs::FileNames(vec!["-".to_string()]),
|
||||
parse_inputs(&MockOptions::new(vec![], vec!["traditional"])).unwrap()
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore mockstream abcdefgh bcdefgh
|
||||
|
||||
use std::cmp;
|
||||
use std::io;
|
||||
use std::io::Read;
|
||||
|
@ -147,7 +149,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_limitting_all() {
|
||||
fn test_read_limiting_all() {
|
||||
let mut v = [0; 10];
|
||||
let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(0));
|
||||
|
||||
|
@ -155,7 +157,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_limitting() {
|
||||
fn test_read_limiting() {
|
||||
let mut v = [0; 10];
|
||||
let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(6));
|
||||
|
||||
|
@ -164,7 +166,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_limitting_with_error() {
|
||||
fn test_read_limiting_with_error() {
|
||||
let mut v = [0; 10];
|
||||
let f = FailingMockStream::new(ErrorKind::PermissionDenied, "No access", 3);
|
||||
let mut sut = PartialReader::new(f, 0, Some(6));
|
||||
|
@ -175,7 +177,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_limitting_with_large_limit() {
|
||||
fn test_read_limiting_with_large_limit() {
|
||||
let mut v = [0; 10];
|
||||
let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(20));
|
||||
|
||||
|
@ -184,7 +186,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_limitting_with_multiple_reads() {
|
||||
fn test_read_limiting_with_multiple_reads() {
|
||||
let mut v = [0; 3];
|
||||
let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 0, Some(6));
|
||||
|
||||
|
@ -196,7 +198,7 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_skipping_and_limitting() {
|
||||
fn test_read_skipping_and_limiting() {
|
||||
let mut v = [0; 10];
|
||||
let mut sut = PartialReader::new(Cursor::new(&b"abcdefgh"[..]), 2, Some(4));
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) tempbuffer abcdefgh abcdefghij
|
||||
|
||||
//! Contains the trait `PeekRead` and type `PeekReader` implementing it.
|
||||
|
||||
use std::io;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) CHRS itembytes MUTF
|
||||
|
||||
use std::str::from_utf8;
|
||||
|
||||
use crate::formatteriteminfo::*;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) itembytes
|
||||
|
||||
use crate::formatteriteminfo::*;
|
||||
|
||||
/// format string to print octal using `int_writer_unsigned`
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) delim
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE file
|
||||
// * that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) lstat
|
||||
|
||||
extern crate getopts;
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
||||
|
||||
// spell-checker:ignore (ToDO) BUFSIZE gecos fullname, mesg iobuf
|
||||
|
||||
#[macro_use]
|
||||
extern crate uucore;
|
||||
use uucore::entries::{Locate, Passwd};
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//! stdio convenience fns
|
||||
|
||||
// spell-checker:ignore (ToDO) bslice
|
||||
|
||||
use std::env;
|
||||
use std::io::{stderr, stdout, Write};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Memo runner of printf
|
||||
//! Takes a format string and arguments
|
||||
//! 1. tokenizes format string into tokens, consuming
|
||||
//! 1. tokenize format string into tokens, consuming
|
||||
//! any subst. arguments along the way.
|
||||
//! 2. feeds remaining arguments into function
|
||||
//! that prints tokens.
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
// spell-checker:ignore (change!) each's
|
||||
// spell-checker:ignore (ToDO) LONGHELP FORMATSTRING templating parameterizing formatstr
|
||||
|
||||
extern crate itertools;
|
||||
extern crate uucore;
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
//! Primitievs used by Sub Tokenizer
|
||||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum fprim interp
|
||||
|
||||
//! Primitives used by Sub Tokenizer
|
||||
//! and num_format modules
|
||||
#[derive(Clone)]
|
||||
pub enum FieldType {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) inprefix for conv
|
||||
|
||||
//! Primitives used by num_format and sub_modules.
|
||||
//! never dealt with above (e.g. Sub Tokenizer never uses these)
|
||||
|
||||
|
@ -55,7 +57,7 @@ pub trait Formatter {
|
|||
inprefix: &InPrefix,
|
||||
str_in: &str,
|
||||
) -> Option<FormatPrimitive>;
|
||||
// return a string from a formatprimitive,
|
||||
// return a string from a FormatPrimitive,
|
||||
// given information about the field
|
||||
fn primitive_to_str(&self, prim: &FormatPrimitive, field: FormatField) -> String;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) arrnum mult basenum bufferval refd vals arrfloat conv intermed addl
|
||||
|
||||
pub fn arrnum_int_mult(arr_num: &[u8], basenum: u8, base_ten_int_fact: u8) -> Vec<u8> {
|
||||
let mut carry: u16 = 0;
|
||||
let mut rem: u16;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv arrnum mult shortcircuit
|
||||
|
||||
#[cfg(test)]
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum
|
||||
|
||||
//! formatter for %a %F C99 Hex-floating-point subs
|
||||
use super::super::format_field::FormatField;
|
||||
use super::super::formatter::{FormatPrimitive, Formatter, InPrefix};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum fprim interp
|
||||
|
||||
//! formatter for %g %G decimal subs
|
||||
use super::super::format_field::FormatField;
|
||||
use super::super::formatter::{FormatPrimitive, Formatter, InPrefix};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix hexifying glibc floatnum rten rhex arrnum
|
||||
|
||||
use super::super::format_field::FormatField;
|
||||
use super::super::formatter::{get_it_at, warn_incomplete_conv, Base, FormatPrimitive, InPrefix};
|
||||
use super::base_conv;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) floatf inprefix
|
||||
|
||||
//! formatter for %f %F common-notation floating-point subs
|
||||
use super::super::format_field::FormatField;
|
||||
use super::super::formatter::{FormatPrimitive, Formatter, InPrefix};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) fchar conv decr inprefix intf ints finalstr
|
||||
|
||||
//! formatter for unsigned and signed int subs
|
||||
//! unsigned ints: %X %x (hex u64) %o (octal u64) %u (base ten u64)
|
||||
//! signed ints: %i %d (both base ten i64)
|
||||
|
@ -193,7 +195,7 @@ impl Formatter for Intf {
|
|||
*field.field_char == 'i' || *field.field_char == 'd',
|
||||
inprefix,
|
||||
);
|
||||
// We always will have a formatprimitive to return
|
||||
// We always will have a format primitive to return
|
||||
Some(if convert_hints.len_digits == 0 || convert_hints.is_zero {
|
||||
// if non-digit or end is reached before a non-zero digit
|
||||
let mut fmt_prim: FormatPrimitive = Default::default();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv cninetyninehexfloatf floatf intf scif
|
||||
|
||||
mod base_conv;
|
||||
pub mod cninetyninehexfloatf;
|
||||
pub mod decf;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety inprefix
|
||||
|
||||
//! formatter for %e %E scientific notation subs
|
||||
use super::super::format_field::FormatField;
|
||||
use super::super::formatter::{FormatPrimitive, Formatter, InPrefix};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety qchar topchar structs fmtr fchar inprefix devs octals cninetyninehexfloatf
|
||||
|
||||
//! handles creating printed output for numeric substitutions
|
||||
|
||||
use std::env;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// spell-checker:ignore (ToDO) conv intf strf floatf scif charf fieldtype vals subparser unescaping submodule Cninety
|
||||
|
||||
//! Sub is a token that represents a
|
||||
//! segment of the format string that is a substitution
|
||||
//! it is created by Sub's implementation of the Tokenizer trait
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::str::Chars;
|
|||
|
||||
// A token object is an object that can print the expected output
|
||||
// of a contiguous segment of the format string, and
|
||||
// requires at most 1 argusegment
|
||||
// requires at most 1 argument
|
||||
pub trait Token {
|
||||
fn print(&self, args: &mut Peekable<Iter<String>>);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
//! and escaped character literals (of allowed escapes),
|
||||
//! into an unescaped text byte array
|
||||
|
||||
// spell-checker:ignore (ToDO) retval hexchars octals printf's bvec vals coreutil addchar eval bytecode
|
||||
|
||||
use itertools::PutBackN;
|
||||
use std::char::from_u32;
|
||||
use std::iter::Peekable;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDOs) corasick memchr Roff trunc oset iset
|
||||
|
||||
extern crate aho_corasick;
|
||||
extern crate getopts;
|
||||
extern crate memchr;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) errno
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) retcode
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) subpath absto absfrom absbase
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) bitor ulong
|
||||
|
||||
extern crate getopts;
|
||||
extern crate remove_dir_all;
|
||||
extern crate walkdir;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// TODO: Make -w flag work with decimals
|
||||
// TODO: Support -f flag
|
||||
|
||||
// spell-checker:ignore (ToDO) istr chiter argptr ilen
|
||||
|
||||
extern crate getopts;
|
||||
|
||||
#[macro_use]
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) NAMESET FILESIZE fstab coeff journaling writeback REiser journaled
|
||||
|
||||
extern crate getopts;
|
||||
extern crate rand;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue