Jian Zeng
daba29b832
Merge pull request #1026 from evestera/cat-numlines-notrailing
...
cat: fix for numbered lines w/ no trailing newline
2017-01-23 06:39:31 -06:00
Erik Vesteraas
21d9152cfe
cat: Collect output state into a struct
2017-01-23 11:07:47 +01:00
Erik Vesteraas
81996915df
cat: fix for numbered lines w/ no trailing newline
...
Make at_line_start persist between printing each file. This fixes an
issue when numbering lines in the output and one of the input files
does not have a trailing newline.
2017-01-23 03:34:47 +01:00
Anthony Deschamps
6dc1eb54c0
sort: Implement ignore-case
...
Test included.
2017-01-21 13:30:22 -05:00
Alex Lyon
e0bfbc3c23
Merge pull request #1020 from KeenS/ls-inode
...
ls: implement -i option
2017-01-10 00:34:35 -08:00
Sunrin SHIMURA (keen)
20b336ed3c
remove redundant space
2017-01-10 10:37:34 +09:00
Joshua Miller
133934f7cf
add cat support for unix domain sockets
...
- adds conditional supports for unix domain sockets
- adds unix domain socket test
- adds Results to functions, removing unwraps
- uutils `cat` used to panic on broken stdout pipes (e.g. `cat
/dev/zero | head -c1`). this is fixed in this PR
- updated to exit 0 on success, and 1 if an error occurs.
- adds docstrings
- adds an error log on printing a directory
- adds categorization of other filetypes for extensible
differentiation of behaviors
- adds OutputOptions struct to replace params for extensibility
- adds correct status code on exit
2017-01-08 19:56:35 -06:00
Sunrin SHIMURA (keen)
59e4bc431a
ls: return String, not Option<String>
2016-12-26 12:27:06 +09:00
Sunrin SHIMURA (keen)
8a51ddf6fb
ls: implement -i option
2016-12-25 14:39:29 +09:00
Alexander Batischev
67ac0c13b8
mkdir: trying to create existing dir is fine
...
Fixes #1017 .
test_mkdir_dup_dir asserted that creating an existing directory is an
error, but that's not how GNU coreutils behaves. This has been reported
in #121 , but wasn't fixed (only the `-p` case was).
2016-12-23 18:47:38 +03:00
Alexander Batischev
f2166fed0a
tail: implement --pid. Closes #846 .
...
Kudos to zHz for helping out with Windows API part.
2016-12-22 01:32:09 +03:00
Lei Zhang
a34cd30f54
Enable compilation of ls on Fuchsia.
...
This updates the dependency of pretty-bytes to v0.2.
2016-12-14 23:29:38 -05:00
Lei Zhang
ba244794f0
Enable compilation of more on Fuchisa.
2016-12-08 13:08:17 -05:00
Wim Hueskes
829ea9f445
od: fix od --help
2016-12-04 22:24:36 +01:00
Arcterus
5d9437bcaf
chgrp: remove unwrap() in is_bind_root()
2016-12-01 06:02:58 -08:00
Arcterus
dc6ba887ba
uucore: compile on Windows again
2016-11-30 03:51:49 -08:00
Arcterus
f5fce8dadb
chgrp: detect bind mounted root
2016-11-30 03:50:07 -08:00
Arcterus
3ab82f9a66
uucore: read symlinked directories correctly in resolve_relative_path()
2016-11-30 03:50:07 -08:00
Alex Lyon
c403270ac3
Merge pull request #992 from kevgeniy/master
...
cat utility refactoring
2016-11-30 03:24:05 -08:00
Alex Lyon
04fcd823cc
Merge pull request #1002 from antiagainst/itertools
...
Update dependencies and solve deprecated warnings.
2016-11-30 03:11:43 -08:00
Alex Lyon
7ec754ec1b
Merge pull request #985 from knight42/fix-preserve-root
...
chgrp: fix bug in option --preserve-root
2016-11-30 02:59:19 -08:00
Lei Zhang
7d7fc68dee
Solve compiler warning about using deprecated item.
...
PutBackN::new() is replaced by put_back_n.
2016-11-29 12:57:09 -05:00
Michael Gehring
268fe45f24
Merge pull request #1000 from antiagainst/fuchsia
...
Add a new feature to list all utilities that can compile for Fuchsia right now
2016-11-26 10:01:55 +01:00
Joseph Crail
78d2e8db27
Fix comment spelling
2016-11-25 14:36:56 -05:00
Lei Zhang
59c12433e0
Add Fuchsia as recognized host OS in uname.
2016-11-24 17:30:03 -05:00
Lei Zhang
e37468b630
Turn off utmpx and signals for Fuchsia.
...
Fuchsia uses musl as its libc; musl only has stub implementation
for utmpx. From their wiki, that is deliberately chosen.
Fuchsia doesn't have signals mechanism.
2016-11-24 17:15:43 -05:00
Lei Zhang
a2071c258e
Remove unnecessary dependencies on libc in various utilities.
2016-11-24 11:17:36 -05:00
mpkh
de8d96ff7c
Merge pull request #994 from Will-W/windowsfixes
...
Windowsfixes
2016-11-19 16:34:31 +04:00
kevgeniy
6d13bcf2da
cat: fixed indentation
2016-11-18 22:30:12 +03:00
Will Wykeham
0809dce4a2
Fix a number of Windows build warnings
2016-11-18 13:58:36 +00:00
Will Wykeham
d55e2ee80a
Fix mv build on Windows
2016-11-18 13:58:13 +00:00
Lei Zhang
aaa7274b63
Remove unnecessary dependencies of getopts & libc for utilities.
2016-11-17 17:43:31 -05:00
Alex Lyon
4f5e8f4566
Merge pull request #965 from wimh/od
...
od: implement remaining functionality
2016-11-10 15:13:10 -08:00
Wim Hueskes
2550e0f3c7
od: several small changes after review
...
* update status in README.md
* enable busybox tests
Adding `CONFIG_DESKTOP` and `CONFIG_LONG_OPTS` to busybox config.
These flags also enable other tests, but those utilities are not
included in `TEST_PROGS`. (eg. awk)
* fix whitespace and small issues
* fix Eq imp for FormatWriter on nightly + beta
* fix indention in multifilereader.rs
* fix intermittent errors in tests
2016-11-09 20:26:55 +01:00
Zephiris
0d0087053f
ls: Fix '-aR' recursion.
...
ls with -aR was recursing infinitely becacuse it
added ./.. to every node. I don't see a way to
avoid this except by cloning when that option
is used.
2016-11-05 01:29:55 -07:00
Zephiris
606c1badd2
ls: Change symlink behavior to be more POSIX compliant.
...
Symlink directories are read by default, and symlink targets are listed on
Windows.
2016-11-05 00:22:55 -07:00
Zephiris
ca8f5516e9
ln: Make sure we can symlink directories on Windows.
2016-11-05 00:22:55 -07:00
kevgeniy
0d56009c3a
cat: remove recursion
2016-10-24 20:18:44 +03:00
kevgeniy
6228b06e29
cat: remove libc dependency
2016-10-24 05:23:54 +03:00
kevgeniy
72490ef956
cat: rewrote most part of the code
...
Rewrote cat to eliminate code duplication and make it safe
- UnsafeWriter is replaced by BufWriter
- write_lines (any option except -T and -v) and write_bytes (-T and -v
options) are replaced by single write_lines method. A new method use
``write_to_end``, ``write_tab_to_end`` or ``write_nonprint_to_end``
method to write all symbols untill the end of line in the right way.
- Benchmarking (-n, -T and -v options respectively):
| old (ns/iter) | new (ns/iter) |
| -------------------------- | -------------------------- |
| 6,501,496 (+/- 1,173,481) | 6,683,158 (+/- 373,539) |
| 8,634,023 (+/- 547,595) | 5,408,676 (+/- 715,458) |
| 24,056,507 (+/- 1,177,445) | 30,879,788 (+/- 1,180,598) |
2016-10-24 04:51:40 +03:00
evgeniy
4a2b8e3c52
cat: conditional compilation added
2016-10-18 19:09:36 +02:00
kevgeniy
2060048c79
Fixed and made the comments clearer
2016-10-16 17:13:02 +02:00
evgeniy
dd16c58ab4
cat utility refactoring:
...
- Less if branches
- Unnecessary range variable deleted
- Optional fail-assertion commented
2016-10-16 12:43:23 +02:00
Wim Hueskes
046ff62af6
more: fix build on windows
2016-10-06 23:35:16 +02:00
Wim Hueskes
4f91662057
who: use i64 instead of time_t
...
fixes build on raspberry pi 2 (armv7-unknown-linux-gnueabihf)
2016-09-03 22:18:10 +02:00
Wim Hueskes
99f70ba648
od: implement 16-bit floating point type
2016-09-03 21:47:36 +02:00
Wim Hueskes
fd5879dcf2
od: refactor parse_formats.rs
...
simplified, more but shorter functions
2016-09-02 21:29:58 +02:00
Wim Hueskes
184c4af76d
od: fix zero width user input (-w0)
2016-09-02 21:27:06 +02:00
Wim Hueskes
92fc286b0e
od: refactor uumain into smaller functions
2016-09-02 21:26:43 +02:00
Wim Hueskes
2c24911d9c
od: refactor: create struct for formatting info
...
also properly document the alignment algorithm.
2016-09-02 21:26:22 +02:00
Wim Hueskes
83a1ff404f
od: refactor: create InputDecoder to convert input
...
It reads from the input and provides data conversion functions.
2016-09-02 21:26:00 +02:00
Wim Hueskes
283a29fd2c
od: refactor IntWriter, do not require parameters
...
use macros to define a function for each format so byte_size
and print_width do not have to be provided by the caller.
2016-09-02 21:25:38 +02:00
Wim Hueskes
f2db897c47
od: refactor: reduce arguments of odfunc
...
Pass the input stream itself instead of the parameters required to
open it. Create InputOffset to handle functionality required for
the byte offset.
2016-09-02 21:25:17 +02:00
Wim Hueskes
d705dc46ce
od: improve/extend --help text
2016-09-02 21:24:56 +02:00
Wim Hueskes
2f12b06ba1
od: implement --traditional
2016-09-02 21:24:29 +02:00
Wim Hueskes
26ec46835c
od: implement +size to skip bytes
2016-09-01 00:24:29 +02:00
Wim Hueskes
9e33c3a48c
od: fix command-line parsing of file names
2016-09-01 00:23:34 +02:00
Wim Hueskes
e8eab8d3e8
od: implement ascii dump
2016-09-01 00:23:11 +02:00
Wim Hueskes
cea4297fdf
od: implement --format / -t
2016-09-01 00:20:02 +02:00
Wim Hueskes
d15604b2e4
od: fix and add tests for simple format args
2016-09-01 00:19:37 +02:00
Wim Hueskes
c2d61a294e
od: refactor: separate mod for parse_format_flags
2016-09-01 00:19:15 +02:00
Wim Hueskes
69bde1170d
od: finish multi-byte support
2016-09-01 00:14:50 +02:00
Wim Hueskes
459db47c2b
od: implement --skip-bytes and --read-bytes
2016-09-01 00:14:25 +02:00
Wim Hueskes
2b10cc47ff
od: implement Read for MultifileReader
...
also add tests and fix error handling
2016-09-01 00:14:02 +02:00
Wim Hueskes
c15936ad68
od: fix performance issue with large values of -w
...
like -w100000000 or larger
2016-09-01 00:13:39 +02:00
Wim Hueskes
bd0424fa0c
od: start with multi-byte support
2016-09-01 00:13:21 +02:00
Wim Hueskes
1164b9e118
od: fix file byte offset for non-octal types
...
removed binary offset, added no offset.
2016-09-01 00:12:59 +02:00
Wim Hueskes
24fb6d66c4
od: proper align different sized output
2016-09-01 00:12:37 +02:00
Wim Hueskes
45895be96d
od: use structs to specify possible dump formats
...
remove extra padding too - preparing proper allignment
2016-09-01 00:12:11 +02:00
Wim Hueskes
f7d7beb79b
od: implement --endian
2016-09-01 00:11:52 +02:00
Vladimir Matveev
d18be30c8a
od: add byteorder_io
...
copied from: https://github.com/netvl/immeta/blob/4460ee/src/utils.rs
workaround for: https://github.com/BurntSushi/byteorder/issues/41
2016-09-01 00:11:42 +02:00
Wim Hueskes
4770690823
od: suppress duplicates
2016-09-01 00:11:23 +02:00
Wim Hueskes
80386ef04f
od: split odfunc()
2016-09-01 00:11:02 +02:00
Wim Hueskes
e006a84136
od: refactor: do all printing in odfunc
2016-09-01 00:10:40 +02:00
Wim Hueskes
36b88f268d
od: enable hexadecimal output
2016-09-01 00:10:23 +02:00
Wim Hueskes
e905c2ec71
od: do not panic on invalid user input
...
use macros from uucore where possible
2016-09-01 00:10:02 +02:00
Wim Hueskes
167d7d3ca9
od: implement -w (width)
2016-09-01 00:09:45 +02:00
Wim Hueskes
1b01f02e9e
od: remove trailing spaces in output
...
can't find documentation confirming this behaviour
besides it does not work correctly on all formats
see also uutils/coreutils#922
2016-09-01 00:09:25 +02:00
Wim Hueskes
f45169d37c
od: refactor: split into modules
2016-09-01 00:09:04 +02:00
Wim Hueskes
104f8eb509
od: implement 64-bit floating point output
2016-09-01 00:08:41 +02:00
Wim Hueskes
f53aefa7e9
od: implement 32-bit floating point output
2016-09-01 00:08:25 +02:00
Wim Hueskes
5c495359c1
od: refactor: convert bytes using byteorder crate
2016-09-01 00:08:00 +02:00
Wim Hueskes
3e143217a9
od: refactor sign_extend
...
easier to understand algoritm which does not use unsafe
2016-09-01 00:01:55 +02:00
Wim Hueskes
e0b7ff1953
od: implement --help and --version
2016-09-01 00:01:35 +02:00
Alex Lyon
362cabe1a6
hashsum: implement SHAKE-128 and SHAKE-256
2016-08-30 17:33:18 -07:00
knight42
f8bd9e2a1b
chown,chgrp: fix bug in option --preserve-root
2016-08-29 11:19:15 +08:00
knight42
d0196b82ad
touch: respect -h
2016-08-28 07:12:25 +08:00
knight42
89ac03d1c2
uucore::fs: add fn resolve_relative_path
2016-08-28 00:02:58 +08:00
knight42
136ca4e197
chgrp,chown: fix bug in option --preserve-root
2016-08-28 00:02:58 +08:00
Martin Kysel
23bab3df69
moved more to unix utils, minor review updates
2016-08-23 11:40:09 +01:00
Martin Kysel
a90aec3f1b
add author name
2016-08-23 10:50:45 +01:00
Martin Kysel
7d77b9720d
Initial more implementation
2016-08-23 10:45:51 +01:00
Nathan Ross
ae0e1c4768
Merge pull request #977 from knight42/chgrp
...
Implement chgrp
2016-08-21 06:39:54 -04:00
Knight
9dda0bcd25
chgrp: implemented
2016-08-21 17:04:38 +08:00
Knight
8cba71adb4
chgrp: add entries
2016-08-21 17:04:02 +08:00
Knight
a4bf852207
mv: cleanup the code
2016-08-21 14:57:28 +08:00
mpkh
2981eb5112
Merge pull request #975 from nathanross/normalize-coreopts-squashed
...
DRYer code and more UX consistency through use of coreopts
2016-08-20 18:44:17 +00:00
Nathan Ross
36503a77c7
impl: use coreopts for brevity and consistent UX
2016-08-20 10:07:24 -04:00
Nathan Ross
edc3bf7c08
impl: dryer use of coreopts
2016-08-20 10:07:24 -04:00
Nathan Ross
ee3aaa017f
uucore: allow 'wrong number of arguments' macro to be more precise
2016-08-20 10:07:08 -04:00
Michael Gehring
dcefbd54c6
Merge pull request #974 from knight42/fix-bugs
...
Fix bugs of `pinky` and `who`
2016-08-20 15:16:19 +02:00
Jian Zeng
14a34b48bf
Merge pull request #969 from robertclancy/tail-f-dev-stdin-bug
...
tail: fix bug when following /dev/stdin
2016-08-20 20:25:08 +08:00
Knight
fb53c019b4
who: limit the parts of split host to 2
2016-08-20 20:22:18 +08:00
Knight
34d2224098
pinky: correct the test
2016-08-20 20:22:18 +08:00
Robert Clancy
3a0c23561e
tail: fix bug when following /dev/stdin
...
main panics when following /dev/stdin since /dev/stdin is not seekable.
Check to see if file is seekable and use unbounded_seek if so.
Also `tail -f` with no files should not follow stdin.
2016-08-20 11:47:02 +01:00
Nathan Ross
268b691881
uucore: add support for optflagopt to coreopts
2016-08-20 05:58:36 -04:00
Nathan Ross
cb1b32cda1
uucore: fix utility name in coreopts parsing error messages
2016-08-20 05:58:36 -04:00
Knight
9ecf899e3d
Remove uucore::c_types
2016-08-20 12:12:49 +08:00
Knight
ddf47fab31
groups: use uucore::entries::get_groups instead
2016-08-20 11:59:58 +08:00
Knight
f49ee5b58b
uname: use utsname in libc instead
2016-08-20 11:59:58 +08:00
Knight
ac6bc5886b
arch: use utsname in libc instead
2016-08-20 11:59:58 +08:00
Knight
c63aa19cd1
Add uucore::utsname to get system info
2016-08-20 11:59:58 +08:00
Knight
b6c864b7f3
uucore::process: add functions to obtain uid/gid, euid/egid
2016-08-20 03:24:23 +08:00
Knight
369c2c2d83
id: use uucore::entries
2016-08-20 03:24:23 +08:00
Knight
2b96f8f0c1
chroot: use uucore::entries
2016-08-20 03:10:37 +08:00
Knight
270290efe6
whoami: use uucore::entries
2016-08-20 03:10:36 +08:00
Knight
99f0114450
stat: use uucore::entries
2016-08-20 03:10:36 +08:00
Knight
40e6c5a397
pinky: use uucore::entries
2016-08-20 03:10:36 +08:00
Knight
f66aaa8b78
ls: use uucore::entries
2016-08-20 03:10:36 +08:00
Knight
40e01b94f3
chown: use uucore::entries
2016-08-20 03:10:36 +08:00
Knight
799804e455
Add uucore::entries
2016-08-20 03:10:36 +08:00
Knight
c2fb66dfcb
uucore::utmpx: fix doctest errors
2016-08-20 02:55:17 +08:00
Knight
bc61634dba
tr: use HashMap in stdlib instead of vec_map
2016-08-20 02:25:55 +08:00
Nathan Ross
9d2616442a
Merge pull request #963 from alsuren/sort--merge
...
Implement sort --merge
2016-08-12 20:42:30 -04:00
David Laban
cf93826eee
sort --check refactor to use iterator
...
This allows us to check files without bringing them entirely into
memory. Also makes it easier to find the disorder in
(seq 9; echo 0) | sort --check
(points at the end of the file, where our previous version would
point at the start of the file)
Itertools' .coalesce() was the most useful helper that I could find
for comparing adjacent values in an iterator. It is designed for
implementing things like .dedup(), so the resulting code is a little
unintuitive.
2016-08-13 00:42:44 +01:00
David Laban
3531c46fb8
sort --merge --unique
...
This uses Itertools' dedup() rather than Vec::dedup(). There is probably
a cleaner, more polymorphic way to do this. Suggestions welcome.
2016-08-13 00:42:44 +01:00
David Laban
e1af1520e7
sort: make compare_by honour settings.reverse
...
This allows sort --merge --reverse to work as well.
2016-08-13 00:42:43 +01:00
David Laban
8a8319a337
sort --merge works, but ignores --unique and --reverse
...
FileMerger receives Lines Iterables of the pre-sorted input files
via push_file() It implements Iterator, which yields lines from the
input files in (merged) sorted order. If the input files are not sorted,
then the behavior is undefined.
Internally, FileMerger uses a
std::collections::BinaryHeap<MergeableFile>.
MergeableFile is an internal helper that implements Ord in a way that
BinaryHeap can use (note that we want smallest-first, but BinaryHeap
returns largest first, so MergeableFile::cmp() calls reverse() on
whatever compare_by() returns.
2016-08-13 00:42:43 +01:00
David Laban
76abc7e51d
sort: refactor compare_fns into Settings
...
Also split out a compare_by(a, b, settings) helper function,
which may be used by --merge, later.
2016-08-13 00:26:20 +01:00
Knight
f19d361013
uniq: add test for case-insensitive comparison
2016-08-13 02:04:19 +08:00
Knight
0ea5314ea1
uucore: make libc optional
2016-08-13 02:00:20 +08:00
mpkh
96e8748336
Merge pull request #945 from nathanross/cut-fix-chars-ranges
...
cut: make chars mode use byte mode behavior
2016-08-12 04:56:47 +00:00
nathanross
f2dc230d0e
uucore: coreopts alignment, spacing, and optional usage
2016-08-11 23:20:39 -04:00
Nathan Ross
4a2532fc12
cut: chars mode has same behavior as byte mode
2016-08-11 18:49:20 -04:00
Nathan Ross
2e41535d69
pinky: switch to using new coreopts syntax
2016-08-11 14:37:26 -04:00
Nathan Ross
6ecf9ecf66
who: switch to using new coreopts syntax
2016-08-11 14:37:25 -04:00
Nathan Ross
617e8ca682
arch: switch to using new coreopts syntax
2016-08-11 14:37:25 -04:00
Nathan Ross
e019b2657e
cut: switch to using new coreopts syntax
2016-08-11 14:37:24 -04:00
Nathan Ross
f8509240df
uucore: require version; syntax; summary; longhelp
2016-08-11 14:37:16 -04:00
Knight
87894dedca
who: implemented
2016-08-11 15:41:28 +08:00
Knight
18da533538
uucore::utmpx: change API and fix error
2016-08-11 15:41:12 +08:00
Knight
8c6cd72848
who: add entries
2016-08-11 00:19:26 +08:00
Knight
963ab9d321
users: use uucore::utmpx
2016-08-10 15:24:55 +08:00
Knight
f4c50921d8
uptime: use uucore::utmpx
2016-08-10 15:24:45 +08:00
Knight
77ef1580c2
pinky: use uucore::utmpx
2016-08-10 15:24:29 +08:00
Knight
301a240b73
uucore::utmpx: refine implementation
2016-08-10 15:23:07 +08:00
Knight
163a3a2540
coreopts: fix error when using msg_wrong_number_of_arguments
macro
2016-08-10 13:59:30 +08:00
Knight
23979542af
uucore: conditional enable different features
2016-08-10 13:57:40 +08:00
Knight
c9dde462c7
uucore: export latest libc
2016-08-10 01:00:39 +08:00
Knight
7d5a4dbf20
coreopts: display package name instead of module path
2016-08-10 00:16:06 +08:00
Nathan Ross
5aaff02195
cut: implement zero-terminated option
...
no changes to char mode because removal
of specialized char mode behavior is pending
2016-08-08 20:15:53 -04:00
Nathan Ross
1bf2c82520
arch: use message templates for consistent, original-work error handling
2016-08-08 04:36:33 -04:00
Nathan Ross
d56389aca0
cut: use message templates for consistent error UX
2016-08-08 04:32:48 -04:00
Nathan Ross
3eb9bbf4b5
uucore: CoreOptions error and version message templates
2016-08-08 04:29:11 -04:00
Nathan Ross
c91fd51197
uucore: add message templates
2016-08-08 03:05:36 -04:00
Nathan Ross
ea6b0e55ad
cut: provide original-work help message and option descriptions
2016-08-07 23:16:15 -04:00
Chris Nikkel
cdfdc3a2bd
uniq: add command line option -z for zero terminated input and output
2016-08-06 18:41:47 -07:00
Knight
0d48744c0f
base64: simplified
2016-08-07 00:41:53 +08:00
Knight
9c7ff133dc
base32: implemented
2016-08-07 00:41:52 +08:00
Knight
276d2ccd53
uucore: add module encoding
2016-08-07 00:41:52 +08:00
Knight
7c5416799e
base32: add entries
2016-08-06 11:45:03 +08:00
Corey Farwell
01da600f71
Remove unused variable binding.
2016-08-05 09:06:39 -04:00
Corey Farwell
8fe3eac087
Remove unused imports.
2016-08-05 09:05:12 -04:00
Corey Farwell
eca7543c61
Cleanup logic around wait_or_timeout
exit status handling.
2016-08-04 21:30:50 -04:00
Nathan Ross
a8f5b430df
Merge pull request #935 from frewsxcv/refactor-time
...
Prefer handling `Duration` over `f32` when dealing with times.
2016-08-04 21:17:38 -04:00
Corey Farwell
99fda0b716
Prefer handling Duration
over f32
when dealing with times.
...
Also refactored out usage of the `time` crate in `uucore`.
2016-08-04 19:21:30 -04:00
Knight
d4ac9f22fc
uptime & users: move functions extern to uucore::utmpx
2016-08-04 23:39:30 +08:00
Knight
833d50e192
pinky: obtain correct timestamp
2016-08-04 23:39:30 +08:00
Knight
0020d5c80c
uucore: update utmpx
2016-08-04 22:37:54 +08:00
Corey Farwell
160f7ed5f4
Use setpgid
from libc.
2016-08-04 08:34:33 -04:00
David Laban
6751d2c708
implement sort --stable
...
Made a new function sort_by(lines, compare_fns), which accepts a
list of compare_fns and calls lines.sort_by() with a closure that
calls each compare_fn in turn until one returns something other
than equal.
Default behavior ensures that String::cmp is the last element in the
compare_fns list (referred to as 'last resort' sorting by man sort).
Passing --stable (-s) turns this behaviour off.
Test cases provided for `sort --month` and `sort --month --stable`.
2016-08-03 07:56:40 +01:00
Mark Karasek
59ad388cce
ls: remove dependence on nightly
2016-07-29 07:07:38 -07:00
Mark Karasek
900cd41eb6
ls improvments
...
* Add options -c, -F, -L, -l, -r, -R, -S, -t, -U, --color
* Fix options -a, -A
* Remove unused options
* Output in columns when not using -l
* Output date with -l
2016-07-28 17:41:52 -07:00
Kevin Robert Stravers
5226ba963c
ls: Implement the '-a' (all) flag
...
The all flag did not cull/remove the directory entries starting with a
dot. The help message indicates it should. The implementation checks
if the string starts with a dot whilst also using '-a' to determine
whether a DirEntry is to be printed.
2016-07-27 11:29:27 +02:00
Kevin Robert Stravers
0afe9b347e
ls: Show columns correctly padded according to the largest file and the largest symlink count
2016-07-26 16:05:20 +02:00
mpkh
da0de488e6
Merge pull request #913 from knight42/pinky
...
Implement pinky
2016-07-26 13:38:53 +04:00
Knight
be20d8605d
pinky: add tests
2016-07-26 17:26:22 +08:00
Knight
6fff3a7665
pinky: cleanup the code
2016-07-26 16:44:30 +08:00
Knight
e0c950e145
pinky: canonicalize host
2016-07-26 16:44:30 +08:00
Knight
f91c60ff70
pinky: fix a weird bug:
...
Strings passed to C functions must ends with NULL.
2016-07-26 16:44:30 +08:00
Knight
048daee8b9
pinky: make ci happy
2016-07-26 16:44:30 +08:00
Knight
fe952d90d8
pinky: iterate over utmp structs using getutxent()
2016-07-26 16:44:29 +08:00
Knight
1056542dd3
uucore::utmpx: revert the changes
2016-07-26 16:44:29 +08:00
Knight
3ed49033b7
pinky: implement short format
2016-07-26 16:44:25 +08:00
Knight
7fb3eef5e5
pinky: implement long format
2016-07-26 16:44:25 +08:00
king6cong
ff7d2bae16
skip directory tail
2016-07-23 23:03:00 +08:00
Jeremy Neptune
a3004fbbff
cp: added -v/--verbose flag
...
I forgot that -v refers to "verbose" and not "version"
when making earlier changes. So I fixed that and for
good measure added the verbose flag anyway.
2016-07-15 14:41:50 -04:00
Jeremy Neptune
cc57ce7699
cp: added -T/--no-target-directory flag
2016-07-15 14:08:04 -04:00
Jeremy Neptune
5e03b7c75d
cp: Added -t flag, and fixed path bug for source files.
...
* Added flag -t/--target-directory
* No longer assumes that the source arguments are files in the CWD (in other words, can copy files from directories other than CWD)
2016-07-15 13:15:05 -04:00
Ben Eills
28d1de1de0
Fix type synonym relaiance which breaks some rusts
2016-07-13 15:51:41 +02:00
Ben Eills
fa2145bb84
Allow specification of mode strings for install
...
We now accept symbolic and numeric mode strings using the
--mode or -m option for install. This is used either when
moving files into a directory, or when creating component
directories with the -d option. This feature was designed
to mirror the GNU implementation, including the possibly
quirky behaviour of `install --mode=u+wx file dir`
resulting in dir/file having exactly permissions 0300.
Extensive integration tests are included.
This chnage required a higher libc dependency.
2016-07-13 15:29:24 +02:00
Ben Eills
b15fff6269
Implement creation of component directories (-d option)
...
Tested in two integration test:
- One creating three component directories
- One trying to create an already existing directory
2016-07-13 12:56:30 +02:00
Ben Eills
823ffbd1dd
Copy rather than move files
...
Test this with one integration test. Also document functions
and add an '(unimplemented)' marker to some arguments in help.
2016-07-13 12:27:11 +02:00
Ben Eills
a5d97323db
Test for unimplemented command line arguments
...
We check if the user has given one of the (many)
not yet implemented command line arguments. Upon
catching this, we display the specific transgressor
to stderr and exit with return code 2.
This behaviour is tested in one new integration test.
2016-07-13 10:37:08 +02:00
Ben Eills
8a5719561d
Implement basic installation of file to directory
...
Bare minimum functionality of `install file dir` implemented.
Also added TODO markers in code for outstanding parameters
and split main function into smaller logical chunks.
2016-07-12 22:58:44 +02:00
Ben Eills
e72ec4a5bb
Implement skeleton install utility
...
Add install utility skeleton source, based on
mv, including the getopts setup mirroring
GNU's `man install` documentation. Also
add a single test and build system code.
2016-07-12 20:56:21 +02:00
mpkh
61cf4e4fba
Merge pull request #906 from knight42/chown
...
Implement chown
2016-07-10 19:01:03 +04:00
Knight
197e7787a8
chown: follow symlinks correctly
2016-07-10 21:32:07 +08:00
Smigle00
35fec95d60
arch: add new utility
...
Signed-off-by: Smigle00 <smigle00@gmail.com>
2016-07-10 00:48:10 +05:30
Knight
7e4a708e7c
chown: refactor
2016-07-04 22:50:22 +08:00
Knight
d4b2766c4b
chown: Add crate walkdir
2016-06-27 23:22:13 +08:00
Knight
04d7f81fd3
chown: Almost done
...
TODO:
* [ ] Describe changes according to verbosity
* [ ] More tests
* [ ] Clean up the code
2016-06-22 21:40:31 +08:00
Knight
59ed78209a
chown: Add mod passwd
2016-06-22 21:39:01 +08:00
Knight
123175d577
chown: Add main.rs
2016-06-22 21:37:40 +08:00
Knight
69beb787d1
chown: Add entries
2016-06-22 21:36:50 +08:00
Knight
7423c5e644
chmod: fix #831
2016-06-19 22:52:56 +08:00
Neel Kowdley
519c1caa23
add verbose flag to tail
2016-06-18 14:44:05 -04:00
Heather
3a3fbc2840
Merge pull request #901 from knight42/mktemp-dir
...
Improve mktemp
2016-06-18 18:16:22 +04:00
Knight
bb3536bf14
mktemp: respect quiet option
2016-06-18 17:54:52 +08:00
Knight
c53fa53c75
mktemp: rustfmt
2016-06-18 17:54:52 +08:00
Knight
c6897da7f0
mktemp: make temp dir
2016-06-18 17:54:52 +08:00
Heather
2c65aad3cf
Merge pull request #900 from knight42/reorganize-tests
...
Reorganize tests
2016-06-17 19:45:50 +04:00
Knight
5dba86dfa2
dircolors: extract shell name from $SHELL properly
2016-06-17 21:54:44 +08:00
Knight
2758455d73
stat: fix unstable library
2016-06-17 18:30:08 +08:00
Knight
13d06ff800
dircolors: reorganize tests
2016-06-17 16:17:22 +08:00
Knight
02dc461cf8
stat: implement ' format directive & add tests
2016-06-17 16:15:50 +08:00
Knight
d46a02b586
mknod: remove repeated macro
2016-06-17 13:27:19 +08:00
Tshepang Lekhonkhobe
80432e2b94
comm: remove unused import
2016-06-15 19:42:05 +02:00
palaviv
3fd8136423
sort: Support check
2016-06-14 22:21:30 +03:00
palaviv
3bc5a5f769
sort: support multiple input files
2016-06-14 21:25:29 +03:00
palaviv
87455f998a
sort: Version sort support
2016-06-14 20:33:09 +03:00
palaviv
d4ffbe0526
sort: unique option support
2016-06-11 15:46:41 +03:00
Heather
e87407f598
Merge pull request #896 from knight42/ls-patch
...
Improve `ls` implementation
2016-06-08 07:52:18 +04:00
Knight
537ed734af
ls: display the correct permissions
2016-06-07 21:10:00 +08:00
Heather
461a4e72b0
Merge pull request #893 from knight42/stat
...
Implement stat
2016-06-07 16:35:01 +04:00
Knight
ca6831ef91
ls: fix target_family
2016-06-07 20:11:40 +08:00
Knight
0394d5398d
ls: rustfmt the code
2016-06-07 20:07:15 +08:00
Steve Smith
7a3ba3242a
Need to make the use
Linux-only too.
2016-06-05 11:45:44 +01:00
Steve Smith
1606770a3e
getpwuid is linux
platform only currently.
2016-06-05 11:07:28 +01:00
Knight
5a0dd67003
stat: make ci happy
...
1. force ci to use libc@0.2
2. dont use unstable api Metadata::created
3. change quote style
4. pass metadata.mode() as mode_t
2016-06-05 13:21:41 +08:00
Knight
ad3c984afd
stat: get rid of crate users
2016-06-05 11:38:56 +08:00
Knight
580667295c
stat: use struct libc::statfs now
2016-06-05 11:38:56 +08:00
Knight
48968f3d8a
stat: Add tests
2016-06-05 11:38:56 +08:00
Steve Smith
8161bb7fe1
Flag uname/group functions as unix-specific and add NO-OP Windows versions.
2016-06-04 15:30:39 +01:00
Steve Smith
ce7f23bcc4
Fill in group name for ls
2016-06-04 15:14:59 +01:00
Steve Smith
04522760f1
Break cstring->String conversion out into function
2016-06-04 15:12:40 +01:00
Steve Smith
6179b89bcc
Add conversion of UID to username for ls
2016-06-04 14:50:52 +01:00
Knight
fd652bc285
stat: TODO: more tests
2016-06-04 13:33:08 +08:00
kwantam
e2cb5eec0a
fix fmt's behavior for blank prefixed lines
2016-06-01 18:19:53 -04:00
Knight
e125118510
stat: find mount point
2016-06-01 14:47:37 +08:00
Knight
de4a95accb
stat: almost done
...
TODO:
* print escaped char
* find mount point
* more test cases
2016-06-01 09:52:55 +08:00
Knight
03ce99b455
stat: fsext.rs: remove useless brackets
2016-06-01 01:24:13 +08:00
Mariano Casco
79d281394f
tail: -f option on stdin
...
The follow() function takes slices instead of the actual vectors, and in
the case of unbounded_tail the single bufReader is on stdin.
2016-05-31 12:37:03 -03:00
Mariano Casco
fafab00cd8
tail: remove extra println
2016-05-31 10:52:53 -03:00
Knight
676f00fea3
stat: add main.rs
2016-05-31 13:27:45 +08:00
Knight
0926cd43ac
stat: add fsext.rs
...
Mainly includes the pretty-* functions, turning the file types, file system types and
time into human-readable form.
2016-05-31 13:22:19 +08:00
Knight
3202c18c54
stat: add Cargo.toml
2016-05-31 13:21:55 +08:00
Mariano Casco
f9627e02d0
tail: print empty line between headers
2016-05-30 17:33:16 -03:00
Mariano Casco
440fb867bc
tail: no headers when following a single file
...
Headers should only be printed when following more than one file. This
commit makes the test_follow() test pass again.
2016-05-30 16:43:14 -03:00
Mariano Casco
8866e05e98
tail: print headers when following multiple files
...
Before each line of content is printed, check if it's from a different
file than the last one we printed for. If so, print a '==> file <=='
header to separate the output in the way tail does.
2016-05-30 16:12:00 -03:00
Mariano Casco
966bfde70f
tail: follow multiple files
...
If multiple files are passed as arguments with the -f option, a vector
of BufReaders is built as the files are first tailed, so that follow()
can take control for the rest of the time the program is running.
follow() loops over each reader and prints all new available content on
each file before moving on to the next.
2016-05-30 16:11:49 -03:00
Mariano Casco
2132889940
tail: don't follow() as part of bounded_tail
...
To get the -f option to follow multiple files, bounded_tail should just
tail a single file and return, instead of blocking processing of other
files by calling follow() (which loops forever).
2016-05-30 16:11:32 -03:00
Tshepang Lekhonkhobe
1476446ddf
remove compiler warnings
2016-05-24 22:30:48 +02:00
Nathan Ross
e827e80a9f
cksum: resolve msvc unsafe issue
...
Fixes #886
2016-05-23 22:06:37 -04:00
Heather
145f2efe89
Merge pull request #885 from jbcrail/refactor-tests
...
Refactor and fix tests
2016-05-23 09:35:34 +04:00
Christopher Ian Stern
e909e665f0
od: take more format options, respect their order.
2016-05-22 15:46:20 -05:00
Joseph Crail
af6c88f676
mktemp: fix whitespace
2016-05-22 16:41:36 -04:00
Joseph Crail
b132f65126
mktemp: build standalone executable
2016-05-22 16:41:36 -04:00
Joseph Crail
b50fc88ead
mktemp: use tempfile crate from crates.io
2016-05-22 16:41:36 -04:00
Heather
bdc1ca7426
Merge pull request #882 from jbcrail/fix-windows-build
...
Improve Windows build
2016-05-22 16:02:03 +04:00
ibabushkin
d504ae18c9
pathchk implemented (see #841 ) ( #860 )
...
* Added pathchk
2016-05-22 15:59:57 +04:00
Joseph Crail
d4994233c7
whoami: remove unused import
2016-05-22 04:39:02 -04:00
Heather
583ed341a7
Merge pull request #880 from knight42/fix
...
Fix #879
2016-05-21 18:08:35 +04:00
Knight
a196bebd1b
uucore: add disp_err macro
2016-05-21 18:19:13 +08:00
Knight
aac1d40f64
dircolors: bypass the missing SHELL on windows
2016-05-21 18:18:40 +08:00
Joseph Crail
cd89a6e5c7
tr: update vec_map to 0.6.0
...
Fixes #865
2016-05-14 22:56:24 -04:00
Heather
ca78706246
Merge pull request #875 from knight42/dircolors
...
Implement dircolors
2016-05-10 22:18:40 +04:00
Knight
ad9bfcef5b
dircolors: implemented
...
TODO: More test case
2016-05-11 00:43:51 +08:00
Knight
c9f363d09c
Add dircolors
2016-05-11 00:43:51 +08:00
Knight
6592e0308c
mknod: use libc@0.2.4 to avoid unresolved name
2016-05-08 16:24:11 +08:00
Knight
78f9351e71
mknod: correct the help
2016-05-07 16:12:01 +08:00
Knight
467561da36
mknod: implemented
2016-05-07 15:21:37 +08:00
Knight
79478626da
add mknod
2016-05-07 15:21:37 +08:00
Heather
1fafde8c27
Merge pull request #845 from peschkaj/master
...
Basic implementation of ls
2016-05-01 00:56:11 +04:00
Heather
f47fafb28d
Merge pull request #830 from lucaotta/fix-788
...
Fix #788
2016-05-01 00:41:15 +04:00
Heather
57693af48d
Merge pull request #871 from modelorganism/odupdate
...
add functionality to od
2016-05-01 00:34:24 +04:00
modelorganism
3f356a4190
od: take input from stdin, as well as files.
2016-04-26 23:17:00 -05:00
modelorganism
e6cf167d1d
od: Accept multiple files names as input
2016-04-25 21:55:34 -05:00
modelorganism
1fbda9663d
Add extra spaces to output to match formating of origial od
2016-04-25 21:47:24 -05:00
Mike Swanson
c946202094
hashsum: add support for SHA-3 functions
...
Only the fixed output-size functions are supported, SHAKE128 and
SHAKE256 are not included for now.
2016-04-16 06:17:15 -07:00
Michael Gehring
77d1c309cd
od: fix infinite loop at EOF
...
Fixes #866
2016-04-15 07:41:03 +02:00
Nick Fitzgerald
3972c6eb53
tail: Clean up and test suffix multiplier
...
Makes `parse_size` return a `Result` where the `Err` part indicates whether
there was a parsing error, or the parse size is too big to store. Also makes the
value parsed a `u64` rather than a `usize`.
Adds unit tests for `parse_size` and integration tests using the suffix
multiplier in a number passed with the `-n` flag.
2016-04-02 14:16:11 -07:00
Valentin Lorentz
2fd7164cda
tail: Implement tail -z
.
...
This options makes tail use NULL instead of newline as a line
delimiter.
2016-04-02 12:32:33 +02:00
Luca Ottaviano
6ded76714b
chmod: remove unused dependencies
2016-04-02 10:29:57 +02:00
Luca Ottaviano
2686ea75d7
chmod: handle -octal and -[rwx]
...
The main issue is that -octal or -[rwx] is interpreted as an option by
getopts.
Search the args for such a pattern, remove it before parsing and
manually handle it afterwards.
Fixes #788 .
2016-04-02 10:29:57 +02:00
Nick Fitzgerald
2b2c2b64c2
tail: When tailing a file in bytes mode, seek directly to the specified byte
...
When tailing a file, as opposed to stdin, and we are tailing bytes rather than
lines, we can seek the requested number of bytes from the end of the file. This
side steps the whole `backwards_thru_file` file loop and blocks of reads.
Fixes #833 .
2016-03-27 14:34:58 -07:00
Nick Fitzgerald
f851611001
tail: Pre-fill the buffer with zeroes
...
Rather than fill the buffer on every file read iteration, pre-fill it with
zeroes once at initialization time.
2016-03-27 14:34:58 -07:00
Jeremiah Peschka
e7458b6086
Fixing trailing semicolon in display_permissions
2016-03-25 18:43:43 -07:00
Jeremiah Peschka
539da3ba1a
Changed display_symlink_count to use the right variable name. Removed dead code.
2016-03-25 16:36:34 -07:00
Jeremiah Peschka
0bb0c40c36
Adding tests for ls. Corrected issue with ls on the present directory throwing panic!()
2016-03-25 14:25:52 -07:00
Jeremiah Peschka
825a850fa9
Wishing I could spell my own name.
2016-03-25 14:18:23 -07:00
Jeremiah Peschka
9716862cfe
Adding skeleton of ls
2016-03-25 14:00:27 -07:00
Joseph Crail
491320747b
sort: remove explicit enum values
2016-03-25 16:55:58 -04:00
Joseph Crail
2cdccb10bb
sort: fix whitespace and spelling
2016-03-25 16:55:58 -04:00
Joseph Crail
cc63565051
sort: add month sort
2016-03-25 16:55:58 -04:00
Joseph Crail
678a3d1451
sort: fix flag for human numeric sort
2016-03-25 16:55:50 -04:00
Joseph Crail
6488f168fb
sort: refactor settings into dedicated struct
2016-03-25 16:51:39 -04:00
Andre Bogus
986c00cd91
fix two clippy warnings
2016-03-24 12:15:01 +01:00
Shiroy
c8ff895018
Add missing lib.name for uucore
...
Fix build on Linux
2016-03-23 08:44:09 +01:00
Alex Lyon
94b8f9fe37
Merge pull request #836 from jamwt/fix_sleep
...
Fix sleep duration calculations.
2016-03-22 18:00:18 -07:00