Commit graph

813 commits

Author SHA1 Message Date
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