Commit graph

1273 commits

Author SHA1 Message Date
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
Florian Gilcher
0be3e61d9f Avoid using char() in tr 2016-03-22 22:03:06 +01:00
Florian Gilcher
2befeef179 Remove use of str_char in fmt 2016-03-22 21:57:52 +01:00
Jamie Turner
7d89717d4b Fix sleep duration calculations.
Durations longer than ~4s were overflowing u32 and just.. not working.
2016-03-22 13:00:01 -07:00
Florian Gilcher
509d6efc78 Remove rustc_unicode dependency 2016-03-22 19:56:14 +01:00
Nick Fitzgerald
56d16ca7e7 tail: Optimize tail for bounded searches in files
When tail'ing a file, we do not need to read the whole file from start to finish
just to find the last n lines or bytes. Instead, we can seek to the end of the
file, and then read the file "backwards" in chunks until we find the location of
the first line/byte we wish to print. This ends up being a nice performance win
for very large files.

Fixes #764
2016-03-21 07:51:38 -07:00
Nick Fitzgerald
977742f209 tail: Take ownership of the provided BufReader<T>
The `BufReader` argument passed to the `fn tail<T: Read>(&mut BufReader<T>,
settings: &settings)` function is never reused, so the `tail` function should
just take ownership of it.
2016-03-21 07:51:32 -07:00
Luca Ottaviano
5dc0a55630 chmod: fix reference option
Reference option must have a file path.
Fix C interface using CString.
Better error message if the file doesn't exist.
2016-03-10 20:34:49 +01:00
Heather
8d278913c2 Merge pull request #825 from nathanross/dirname-fix-impl
Dirname: fix windows' failing test for absolute-path behavior (approach 2/2: platform-independent behavior)
2016-03-01 11:55:54 +04:00
Chirag B. Jadwani
d674a3bb63 uniq: minor refactoring in skip_fields 2016-02-29 11:16:58 +05:30
Chirag B. Jadwani
fc5b798ff1 uniq: fix skip & check characters logic 2016-02-29 11:10:38 +05:30
Andrew Eikum
d25ab4adc1 sort: Implement -o switch 2016-02-21 13:32:42 -06:00
Nathan Ross
3e6ac628bc link: normalize file-not-found error message across platforms 2016-02-20 17:32:15 -05:00
Nathan Ross
51d7227aeb dirname: in impl, make behavior for '/' fs root agnostic of host platform 2016-02-19 20:10:41 -05:00
Nathan Ross
a4e1372451 cat: squeeze blank keeps up to one blank line 2016-02-16 18:52:51 -05:00
Nathan Ross
c8dcdf7d25 basename: too few or many args messages go to stderr 2016-02-15 20:44:50 -05:00
Nathan Ross
5f88dfe12b printf: rustfmt pass 2016-02-15 00:48:08 -05:00
Nathan Ross
9242ba1db6 printf: scaffolding for C99 hex float 2016-02-15 00:17:11 -05:00
Nathan Ross
0892ad3cde printf: add (spare C99 hex floats) 2016-02-15 00:10:30 -05:00
Joseph Crail
53c60e2990 Fix type mismatch error. 2016-01-22 22:02:10 -05:00
Arcterus
0d3cc86936 uucore: don't follow symlinks when examining them (fixes #799) 2016-01-10 03:39:31 -08:00
Arcterus
d9ad0b185a tests: fix tests that were failing on OS X 2016-01-10 00:09:05 -08:00
Heather
27c77db122 Merge pull request #795 from ebfe/ptx-stable
ptx: fix build on stable
2016-01-06 19:56:14 +04:00
Michael Gehring
26280d9083 expand, unexpand: fix build on stable 2016-01-06 16:35:33 +01:00
Michael Gehring
9cd7d03eff ptx: fix build on stable 2016-01-06 16:20:59 +01:00
Alex Lyon
027e02db8b Merge pull request #793 from ebfe/clippy
Fix clippy warnings
2016-01-06 00:56:07 -08:00
Michael Gehring
a2944e06db Fix clippy warnings 2016-01-06 09:36:20 +01:00
Arcterus
bc40f93f7e chmod: implement --verbose, --changes, and --quiet 2016-01-05 14:08:24 -08:00
Arcterus
ee669ab55b chmod: rewrite mode parser 2016-01-04 20:00:34 -08:00
Michael Gehring
73cd23ca71 Merge pull request #781 from KeenS/mktemp
Mktemp
2016-01-04 18:40:08 +01:00
Arcterus
96817dfbc5 Fix #784 2016-01-03 23:15:19 -08:00
Sunrin SHIMURA (keen)
e733ffb936 [mktemp] allow empty argument 2016-01-03 22:40:21 +09:00
Sunrin SHIMURA (keen)
a09abc63a0 [mktemp] remove old comment 2016-01-03 19:13:01 +09:00
Sunrin SHIMURA (keen)
58d1d66d16 [mktemp] implement mktemp 2016-01-03 19:10:47 +09:00
Fort
cf1204b2b3 Fix copyright line 2015-12-31 08:56:11 -08:00
Fort
649aa2693d pattern name generating function handles random as well 2015-12-30 13:53:59 -08:00
Fort
67698a9f2e Creating pattern string works correctly now 2015-12-30 13:30:20 -08:00
Fort
4a42b981f9 Open file once for all passes, seek back to start between passes. Do not use File::create, because it truncates existing files 2015-12-30 11:27:59 -08:00
Fort
04d2134856 Skip creating a new File object when getting file size 2015-12-30 10:06:24 -08:00
Fort
6c3917e123 Add caution about effectiveness to help text 2015-12-30 09:22:21 -08:00
Fort
eb6453013e Implement shred 2015-12-29 13:30:05 -08:00
Michael Gehring
74a5869d21 du: fix default symlink handling
Fixes #776
2015-12-26 18:36:36 +01:00
Nick Herman
5958354b01 Fix busybox seq formatting test 2015-12-26 16:23:06 +03:00
Nathan Ross
a3196319c5 support busybox newer tests through multicall 2015-12-25 00:45:23 -05:00
Heather
97793313c0 Merge pull request #766 from nathanross/install
*nix install script and appveyor script
2015-12-25 08:28:28 +04:00
Nathan Ross
d99d5c1338 fixes for linux install see notes
calling install goal overrides utility build settings with utility install settings
calling install goal defaults profile to --release
PROG_PREFIX is now applied to all utilities
modify uutils.rs to make symbolic link bins possible
binary install paths rmd first to prevent errors due to lns
simplify vars for more readable install target
other minor fixes
2015-12-24 00:13:16 -05:00
Joseph Crail
3b4baeb1e7 Fix "private type in public interface" warnings. 2015-12-23 20:08:53 -05:00
Michael Gehring
519802bdf9 expr: add '|' and '&' operators 2015-12-22 13:41:30 +01:00
Michael Gehring
3d94dea397 hostname: fix '-i' 2015-12-21 21:08:17 +01:00
Michael Gehring
bcaa859ca7 fmt: fix warnings 2015-12-21 20:23:55 +01:00
Heather
f16ce871c6 Merge pull request #754 from ebfe/fix-dirname
dirname: fix "/" "." ""
2015-12-21 14:55:57 +04:00
Michael Gehring
c918fb6a6b dirname: fix "/" "." "" 2015-12-21 11:14:08 +01:00
Michael Gehring
cf8a86ca2d id: fix '-u'
Some cases printed gid instead of uid.
2015-12-21 10:45:49 +01:00
Nathan Ross
5ee7b5b8fc rm recognition of "busybox" bin name in uutils.rs 2015-12-20 21:06:05 -05:00
Michael Gehring
ab0639d88a Fix arm build
Fixes #719
2015-12-19 08:53:28 +01:00
Michael Gehring
bc0dd2006c Merge pull request #749 from jbcrail/refactor-tail-2
tail: use read_line/read instead of lines/bytes
2015-12-19 08:43:43 +01:00
Joseph Crail
23202f5aef Remove unused imports 2015-12-19 01:32:05 -05:00
Joseph Crail
aa0ce61b3f tail: use read_line/read instead of lines/bytes
In order to work around lines() removing the newline byte and CRLF, I
switched from the iterator methods (lines/bytes) to the direct methods
(read_line/read). I also manually skipped lines/bytes.

Fixes #744.
2015-12-18 23:52:09 -05:00
Joseph Crail
77abd58be7 Refactor settings into dedicated struct 2015-12-12 18:37:17 -05:00
Joseph Crail
b6abe56357 Fix whitespace 2015-12-12 15:29:45 -05:00
Joseph Crail
8fa09b2004 Remove trait shim needed before Path stabilized
Now that Path has stabilized in Rust 1.5, I removed the UUPathExt trait
needed to support stable, beta, and nightly.
2015-12-10 14:20:01 -05:00
Joseph Crail
58d6add8d1 Add macro to properly find program name. 2015-12-07 21:56:46 -05:00
Joseph Crail
b90d253584 Refactor and simplify build for utilities.
For coreutils, there are two build artifacts:

  1. multicall executable (each utility is a separate static library)
  2. individual utilities (still separate library with main wrapper)

To avoid namespace collision, each utility crate is defined as
"uu_{CMD}". The end user only sees the original utility name. This
simplifies build.rs.

Also, the thin wrapper for the main() function is no longer contained in
the crate. It has been separated into a dedicated file. This was
necessary to work around Cargo's need for the crate name attribute to
match the name in the respective Cargo.toml.
2015-12-07 21:56:45 -05:00
Joseph Crail
cbce549de7 More import fixes for Windows. 2015-12-01 01:27:20 -05:00
Joseph Crail
e8aa7241fa Fix errors with bools represented as ints. 2015-12-01 01:27:08 -05:00
Heather
614044cff0 Merge pull request #736 from jbcrail/refactor-interactive
Refactor check for standard stream interactivity.
2015-11-30 08:39:18 +04:00
Heather
b18c558d6c Merge pull request #735 from jbcrail/update-windows
Update Windows support.
2015-11-30 08:38:32 +04:00
Joseph Crail
9a4c1aa7fa Refactor check for standard stream interactivity.
Since several utilities check if the standard streams are interactive, I
moved this into the uucore::fs library as is_std*_interactive(). I also
added Windows support for these methods, which only return false (or at
least until someone finds a way to support this).
2015-11-29 21:03:53 -05:00
Joseph Crail
1c7da36f76 Remove unused imports and macro attribute. 2015-11-29 20:23:01 -05:00
Joseph Crail
b46050460e uucore: specify a few modules to be Unix-only 2015-11-29 17:27:43 -05:00
Michael Gehring
8a6768e9bd comm: clear buffers between read_line calls 2015-11-28 20:35:43 +01:00
Michael Gehring
14b1313eaf comm: fix EOF detection 2015-11-28 20:25:16 +01:00
Joseph Crail
e3eb633ac9 cut: fix off-by-one error for range calculation
When determining the range from which to select portions of a line, the
upper limit of the range is a usize. The maximum upper value is
usize::MAX, but at one point this value is incremented, causing an
overflow. By setting the maximum upper value to usize::MAX-1, the bug is
averted. Since the upper limit of the range is an index (thus, ranging
from 0 to 2^64-1 for 64-bit platforms), the maximum usize should not be
reached.
2015-11-28 00:42:35 -05:00
Michael Gehring
a773db7325 Remove deprecated lint 2015-11-27 22:23:06 +01:00
Joseph Crail
012414c49f test: fix namespace and broken test
I separated test's main() into a separate file to override Cargo's
requirement for matching crate names. I had to update the build command
to use a special extern reference for test.

Fixes issues caused by #728.
2015-11-27 15:35:20 -05:00
Joseph Crail
d4e0ea41a3 Fix namespace collision for test.
To avoid linking issues with Rust's libtest, the crate for the test
utility was changed to 'uutest'. However, the user doesn't need to see
this so a few hoops were jumped through to make this transparent.

I also updated the make rules to build the individual features first and
then uutils. This makes 'make && make test' look more organized.
2015-11-27 01:54:18 -05:00
Michael Gehring
ca16e66a55 switch to cargo version numbers 2015-11-25 10:58:49 +01:00
Michael Gehring
9365e100d9 Merge pull request #723 from jbcrail/cleanup
Fix whitespace, unused file, and warnings.
2015-11-25 10:20:46 +01:00
Joseph Crail
55e5327573 Use name/version when showing hostname's usage. 2015-11-25 04:05:12 -05:00
Michael Gehring
cdbae736f1 sum: use wrapping_add to avoid overflow panics 2015-11-25 09:58:58 +01:00
Joseph Crail
ca1074201f Split utility files into separate library.
Everything in src/common has been moved to src/uucore. This is defined
as a Cargo library, instead of directly included. This gives us
flexibility to make the library an external crate in the future.

Fixes #717.
2015-11-24 22:20:27 -05:00
Nathan Ross
502957dc3e use cargo idioms to manage dependency resolution and compilation 2015-11-23 02:04:15 -05:00
Nathan Ross
b20b2cca19 update uses of libc 0.1.x and deprecated stdlib uses 2015-11-23 02:04:15 -05:00
Joseph Crail
3b5c776675 Add tests for rmdir.
I also adjusted error message to conform to GNU implementation.
2015-11-01 15:31:48 -05:00
Joseph Crail
4121d1e25d Remove unnecessary parentheses. 2015-10-31 02:32:55 -04:00
Roman Gafiyatullin
7b54410557 expr: prefix operators length/1, index/3 and substr/3 2015-10-09 19:26:51 +03:00
Roman Gafiyatullin
092e4d1ed4 Implement expr.
Implemented as follows:

    Usage: expr EXPRESSION
      or:  expr OPTION

          --help     display this help and exit
          --version  output version information and exit

    Print the value of EXPRESSION to standard output.  A blank line below
    separates increasing precedence groups.  EXPRESSION may be:

      ARG1 | ARG2       ARG1 if it is neither null nor 0, otherwise ARG2

      ARG1 & ARG2       ARG1 if neither argument is null or 0, otherwise 0

      ARG1 < ARG2       ARG1 is less than ARG2
      ARG1 <= ARG2      ARG1 is less than or equal to ARG2
      ARG1 = ARG2       ARG1 is equal to ARG2
      ARG1 != ARG2      ARG1 is unequal to ARG2
      ARG1 >= ARG2      ARG1 is greater than or equal to ARG2
      ARG1 > ARG2       ARG1 is greater than ARG2

      ARG1 + ARG2       arithmetic sum of ARG1 and ARG2
      ARG1 - ARG2       arithmetic difference of ARG1 and ARG2

      ARG1 * ARG2       arithmetic product of ARG1 and ARG2
      ARG1 / ARG2       arithmetic quotient of ARG1 divided by ARG2
      ARG1 % ARG2       arithmetic remainder of ARG1 divided by ARG2

      STRING : REGEXP   [NOT IMPLEMENTED] anchored pattern match of REGEXP in STRING

      match STRING REGEXP        [NOT IMPLEMENTED] same as STRING : REGEXP
      substr STRING POS LENGTH   [NOT IMPLEMENTED] substring of STRING, POS counted from 1
      index STRING CHARS         [NOT IMPLEMENTED] index in STRING where any CHARS is found, or 0
      length STRING              [NOT IMPLEMENTED] length of STRING
      + TOKEN                    interpret TOKEN as a string, even if it is a
                                   keyword like 'match' or an operator like '/'

      ( EXPRESSION )             value of EXPRESSION

    Beware that many operators need to be escaped or quoted for shells.
    Comparisons are arithmetic if both ARGs are numbers, else lexicographical.
    Pattern matches return the string matched between \( and \) or null; if
    \( and \) are not used, they return the number of characters matched or 0.

    Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null
    or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred.

    Environment variables:
    	* EXPR_DEBUG_TOKENS=1   dump expression's tokens
    	* EXPR_DEBUG_RPN=1      dump expression represented in reverse polish notation
    	* EXPR_DEBUG_SYA_STEP=1 dump each parser step
    	* EXPR_DEBUG_AST=1      dump expression represented abstract syntax tree
2015-10-09 12:31:25 +03:00
Carlos Liam
87d14978e9 Clean whitespace
Remove leading newlines and replace lines containing only whitespace
with empty lines
2015-10-06 12:04:46 -04:00
Michael Gehring
d167674ba7 Fix nightly build 2015-09-29 22:37:24 +02:00
Roman Gafiyatullin
b4dd12104f factor: panic running againts power of two.
No further calculations required in case 'num' is already 1.
2015-10-02 20:30:35 +03:00
Steve Klabnik
0c117eb8a8 initial work 2015-09-27 23:55:28 -04:00
Steve Klabnik
ac7e289d29 Fix the build 2015-09-27 23:34:23 -04:00
Danilo Bargen
3e1c6e7e71 Use system error codes 2015-09-18 11:51:59 +02:00
Danilo Bargen
0e7223cfb0 Handle null pointer return value for getpwuid on Linux 2015-09-18 11:12:39 +02:00
Danilo Bargen
a8f9b40674 Return Result<String, String> from getusername 2015-09-18 11:12:39 +02:00
Heather
fe0a49f7a4 Merge pull request #671 from ebfe/cargo-build
Basic Cargo based build
2015-09-17 16:42:43 +03:00
Christian Zinck
f31192d46a enhanced numeric sort and new human readable sort 2015-08-30 20:06:33 -04:00
Michael Gehring
5411252d3a touch: add filetime dependency 2015-08-28 21:12:30 +02:00
Michael Gehring
9d8abbcb06 Basic Cargo build
Builds the uutils multicall binary containing all utils (except stdbuf)
by default. To only build a subset
    `cargo --no-default-features --features <utils>`
can be used.

Whats missing is building the standalone binaries and a mechanism to
automatically disable the build of unix only utils on windows.
2015-08-28 21:12:30 +02:00
Gustavo Hexsel
f8df842dfb Moved code officially to run on nightly since it's a dependency 2015-08-26 12:50:07 -04:00
Sam Gibson
c06b8218f7 Fix build by making du not use futures
Use channels and push them into a vector instead. Code remains largely the same.
2015-08-24 18:57:09 +12:00
Joseph Crail
26f0ec8379 Fix difference w/ GNU coreutils' sum.
When using the SYSV algorithm and reading from standard input, the GNU
coreutils implementation does not output the filename, in this case "-".
2015-08-14 00:10:15 -04:00
Heather
809affff6c Merge pull request #678 from jbcrail/stabilize-4
Remove unstable features from mv/touch.
2015-08-12 08:13:40 +03:00
Joseph Crail
e9b008cf70 Remove unstable features from ptx.
I cleaned up string references, whitespace, and use of unstable
features. I also added a comment about reverting to connect, making
others aware that the method should be replaced by join after 1.3.
2015-08-12 00:01:10 -04:00
Joseph Crail
eff8851cf9 Fix bug when setting time w/o year. 2015-08-11 21:45:11 -04:00
Joseph Crail
e455ba5de1 Replace unstable set_file_times w/ external crate. 2015-08-11 21:45:11 -04:00
Joseph Crail
9d84890c89 Convert to byte vec w/o using deprecated methods. 2015-08-11 21:45:11 -04:00
Joseph Crail
480019f5b3 Add comments for deprecated connect().
We are using connect() instead of join() until Rust 1.3 is stable.
Currently, connect() is just a thin wrapper over join(). Keeping the
deprecated method allows us to build on all releases.
2015-08-09 23:12:23 -04:00
Joseph Crail
43d3834880 Backport and/or replace unstable features.
I removed the unstable slice_patterns and str_char features. I also used
the deprecated connect() method, instead of join().
2015-08-08 03:53:21 -04:00
Joseph Crail
b089831ea0 Switch over to internal canonicalize().
The method, fs::canonicalize(), is unstable and can't be used for stable
builds. We already have our own implementation of canonicalize(), which
supports more options than the Rust library implementation.
2015-07-31 18:55:33 -04:00
Joseph Crail
4a331897cb Replace unstable VecMap w/ external crate. 2015-07-31 17:05:22 -04:00
Joseph Crail
4300cd5a48 Replace unstable init() method. 2015-07-31 16:21:06 -04:00
Joseph Crail
047d963a26 Remove unused feature attribute. 2015-07-31 16:21:06 -04:00
Joseph Crail
f41d5b3f8f Replace unstable fs:walk_dir() w/ external crate. 2015-07-31 16:21:06 -04:00
Joseph Crail
6ff576e300 Use non-PathExt canonicalize(). 2015-07-31 16:21:06 -04:00
Joseph Crail
f03b22a65c Stabilize several PathExt methods. 2015-07-31 16:21:06 -04:00
Karol Rozycki
b025b44806 -f flag for uniq 2015-07-31 19:37:40 +02:00
Joseph Crail
9bc6eb4e7b Replace deprecated methods.
I replaced position_elem() and slice_chars(). I also removed an unused
feature attribute.
2015-07-30 22:21:18 -04:00
Joseph Crail
157c20c7d3 Replace deprecated methods. 2015-07-27 00:35:34 -04:00
Peter Atashian
010bda9df2 Fix build on non-windows
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-07-20 16:40:29 -04:00
Peter Atashian
47f82f0de2 Various Windows fixes
Improve handling of unicode on Windows
Disable a few crates on Windows that abuse unix APIs too much

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-07-19 20:25:48 -04:00
Joseph Crail
49d9de17fe Fix deprecation warnings for tr.
I switched over to the bit-vec/bit-set cargos.
2015-07-09 18:30:03 -04:00
Alex Lyon
8f6d13df5f Merge pull request #647 from jbcrail/fix-osx-stdbuf
Fix OS X build errors for stdbuf.
2015-07-09 14:58:07 -07:00
Alex Lyon
7c2ed679ab Merge pull request #649 from jbcrail/fix-stdbuf-regression
Fix stdbuf regression.
2015-07-09 12:58:13 -07:00
Joseph Crail
b8ab2c125f Fix stdbuf regression.
When replacing range_inclusive(), I introduced a bug when parsing
arguments. I added a smoke test to prevent basic regressions in the
future.
2015-07-09 15:23:14 -04:00
Joseph Crail
3fa2e89a7a Fix OS X build errors for stdbuf.
I removed unused linker flags, added platform-specific linker flags, and
used DYLD_LIBRARY_PATH (instead of DYLD_INSERT_LIBRARIES) for loading
the dynamic library. I also removed an unused variable mutation.
2015-07-09 13:04:04 -04:00
Joseph Crail
3270040778 Remove unused mutation from variables. 2015-07-08 22:24:02 -04:00
Joseph Crail
01b0d5da1c Remove unused attribute. 2015-07-05 22:36:34 -04:00
Joseph Crail
9f1dc98925 Add initial implementation for ln.
There are several areas needing improvement:

1) add tests for hard links
2) add implementation for uncommon flags (-d, -L, -n, -P, -r)
3) align error messages more closely with GNU implementation
2015-07-05 14:52:31 -04:00
Joseph Crail
951be1bfaa Fix alignment of mv help. 2015-07-01 22:09:33 -04:00
Joseph Crail
dd97629a0e Merge pull request #640 from remram44/mv-strip-trailing-slashes
Implement mv's --strip-trailing-slashes
2015-06-30 23:31:03 -04:00
Remi Rampin
0691965d63 Use ChildExt to wait from timeout.rs 2015-06-30 18:45:13 -04:00
Remi Rampin
dc40480e6e Switch wait_or_timeout() to f64 2015-06-30 18:44:32 -04:00
Remi Rampin
d806ab4809 Use ChildExt to kill from timeout.rs 2015-06-30 18:44:30 -04:00
Remi Rampin
cce3d5171d ChildExt for send_signal() and wait_or_timeout() 2015-06-30 18:42:51 -04:00
Remi Rampin
13f5994e15 Rename time.rs to parse_time.rs
Conflicts with crate time.
2015-06-30 18:42:51 -04:00
Remi Rampin
28302555b8 Replace missing signal() by libc kill() directly 2015-06-30 18:42:50 -04:00
Remi Rampin
66a40d555d Update timeout.rs to new io 2015-06-30 18:42:19 -04:00
Remi Rampin
0ed57b3896 Fix simple typo in mv.rs 2015-06-30 15:21:40 -04:00
Remi Rampin
b8d5602655 Implement mv's --strip-trailing-slashes 2015-06-30 13:24:19 -04:00
Joseph Crail
690a483a8a Update to nightly build.
I updated the library dependencies, features, and deprecated methods.
2015-06-23 23:00:00 -04:00
Joseph Crail
cf7db989e7 Update dependencies.
I added the regex-syntax crate to the dependencies for hashsum, nl, and
ptx.
2015-06-04 22:37:51 -04:00
Joseph Crail
0df4918f2d Fix split tests.
I added an additional regex dependency and converted strings to
Vec<u8>'s for the assertions.
2015-06-04 13:57:17 -04:00
Joseph Crail
1e22455032 Align formatting with GNU implementation. 2015-06-03 01:41:56 -04:00
Joseph Crail
ac8d972ed9 Refactor wc settings into dedicated struct. 2015-06-03 01:41:56 -04:00
Joseph Crail
b25a344566 Add quiet and verbose flags to head. 2015-05-31 20:26:57 -04:00
Joseph Crail
1580daea7c Refactor utility settings into dedicated struct.
This will make it easier to add support for additional options, such as
verbosity and negative byte/line counts.
2015-05-30 19:10:15 -04:00
Joseph Crail
b008ed103d Improve descriptions of available options. 2015-05-30 19:10:15 -04:00
Joseph Crail
826d8a6530 Add newline when printing lines. 2015-05-30 19:10:15 -04:00
dokaptur
5aa68eb716 printing version unified and tests 2015-05-30 13:48:53 +02:00
dokaptur
ea7df03c0a initial ptx commit 2015-05-30 09:35:28 +02:00
Joseph Crail
17e732f0fd Flush pending stdout writes. 2015-05-29 13:51:11 -04:00
Heather
f84d5462a3 Merge pull request #625 from jbcrail/add-base64-tests
Add tests for base64.
2015-05-29 07:57:35 +03:00
Joseph Crail
1be9c41105 Upgrade regex cargo. 2015-05-29 00:50:32 -04:00
Joseph Crail
1c405d9c91 Remove duplicate header in error messages. 2015-05-28 23:23:54 -04:00
Camille TJHOA
72d8ab0506 Fix hostname 2015-05-27 23:55:25 +02:00
Nikita Ofitserov
abd3e1e8e4 Fix 'env -' case 2015-05-27 00:51:14 +03:00
Joseph Crail
28e00cbd78 Standardize display of utility name and version. 2015-05-25 14:50:15 -04:00
Joseph Crail
d558e37288 Add macro to manually flush a writer.
I built upon the pipe_* macros, adding pipe_flush!() to flush an
optional writer (default to stdout if no writer is given).
2015-05-23 03:31:42 -04:00
Heather
9ee7d96e5b Merge pull request #619 from jbcrail/replace-utf8-ellipsis
Replace UTF-8 ellipsis character w/ ASCII periods.
2015-05-23 09:06:56 +03:00
Joseph Crail
2ef14832dc Replace UTF-8 ellipsis character w/ ASCII periods. 2015-05-23 01:56:33 -04:00
Joseph Crail
07d57ac109 Fix failure to print stdout for echo.
Upon program termination, pending stdout writes were not automatically
flushed. When newlines are disabled, I force a flush to stdout.
2015-05-22 21:49:33 -04:00
Vinícius dos Santos Oliveira
c17f925b11 cat.rs: removing need for mut variable 2015-05-22 13:53:13 -03:00
Joseph Crail
496d5883a4 Switch to external getopts cargo (part 3).
I switched over to the getopts crate on crates.io, instead of Rust's
private implementation. This will allow coreutils to build for Rust 1.0.

I'm splitting the updates into several commits for easier reviewing.
2015-05-21 21:32:55 -04:00
Joseph Crail
509a35ff7a Switch to external getopts cargo (part 2).
I switched over to the getopts crate on crates.io, instead of Rust's
private implementation. This will allow coreutils to build for Rust 1.0.

I'm splitting the updates into several commits for better reviewing.
2015-05-21 15:00:34 -04:00
Joseph Crail
b4b08de42c Switch to external getopts cargo (part 1).
I switched over to the getopts crate on crates.io, instead of Rust's
private implementation. This will allow coreutils to build for Rust 1.0.

I'm splitting the updates into several commits for better reviewing.
2015-05-20 22:47:30 -04:00
Joseph Crail
a94bd0bd35 Remove unstable regex macros.
This will allow coreutils to get further along when building against
Rust 1.0.
2015-05-19 21:40:03 -04:00
Heather
e7518b3eae Merge pull request #608 from jbcrail/rm-unstable-exit-status
Replace unstable set_exit_status() with exit().
2015-05-19 07:15:14 +03:00
Joseph Crail
7d1d307b92 Replace unstable set_exit_status() with exit().
With the 1.0 release, unstable features are causing build errors. I
replaced references to std::env::set_exit_status() with
std::process::exit().
2015-05-18 21:22:51 -04:00
Joseph Crail
430e9530d4 Fix nohup.
I upgraded to the nightly build.
2015-05-18 20:27:32 -04:00
Heather
37f35cd3f8 Merge pull request #605 from jbcrail/fix-stdbuf
Fix stdbuf.
2015-05-18 08:45:17 +03:00
Joseph Crail
c4d8312e6b Fix mkfifo on Linux.
The build failed because of type mismatch errors for the mode
permission.
2015-05-18 00:53:37 -04:00
Joseph Crail
a2400a272f Fix stdbuf.
The build only works on Linux at the moment.
2015-05-17 23:27:57 -04:00
Joseph Crail
7d71dfbbf4 Fix kill. 2015-05-17 15:26:52 -04:00
Joseph Crail
c93440170d Fix id. 2015-05-17 14:59:04 -04:00
Joseph Crail
1837146134 Update hashsum.
Most of the work centered around fixing lifetime issues.
2015-05-16 13:28:36 -04:00
kwantam
e1dac4695e improved Sieve implementation ; add cargo update
This commit adds `cargo update` to the distclean target in the
makefile. This updates the Cargo.lock file when clearing the
deps directory.

In addition, it adds a faster implementation of the Sieve of
Eratosthenes for use by `src/factor/gen_table.rs` and `test/factor.rs`.
2015-05-15 19:39:43 -04:00
Joseph Crail
349622a05b Fix du.
In addition to upgrading the nightly build, I flattened the Stat struct
to embed the metadata fields. This simplified access to the values, but
needed a constructor method for ergonomic reasons.
2015-05-14 18:35:55 -04:00
Heather
94cd6eb543 usernames can only be up to 104 characters in windows, fix #565 2015-05-14 08:27:47 +04:00
Heather
f0e5c19ed4 Merge pull request #597 from jbcrail/update-mkdir
Update mkdir.
2015-05-14 07:16:11 +03:00
Heather
aca7775926 Merge pull request #598 from jbcrail/fix-mv
Fix mv.
2015-05-14 07:14:54 +03:00
Joseph Crail
46bd77c3c2 Fix mkfifo. 2015-05-13 22:22:13 -04:00
Joseph Crail
18da32f394 Fix mv. 2015-05-13 21:05:36 -04:00
Joseph Crail
7f3d4ebf5b Update mkdir.
In addition to upgrading to the nightly build, I refactored the method
that creates the directories by switching from a recursive approach to
an iterative one. I also replaced the obsolete fs::mkdir() with a custom
method using fs::create_dir() and libc::chmod(). I added several
diagnostic messages that match the GNU implementation.
2015-05-13 16:38:11 -04:00
Heather
9b193d8d8a Merge pull request #594 from jbcrail/update-fold
Update fold to replace vector concatenation.
2015-05-13 07:22:47 +03:00
Heather
e078092c80 Merge pull request #595 from jbcrail/update-readlink
Update readlink.
2015-05-13 07:22:21 +03:00
Joseph Crail
f502b187a7 Remove tail return statements. 2015-05-12 19:54:12 -04:00
Joseph Crail
b2063d6d73 Update readlink.
I updated to the nightly build, completed support for the verbose flag,
and refactored the canonicalization method to simplify and add support
for Windows paths.
2015-05-12 17:07:31 -04:00
Joseph Crail
66a7dc8cb7 Update fold to replace vector concatenation.
The syntax for concatenating a vector and a slice use the '+' operator
was removed from Rust.
2015-05-12 16:52:15 -04:00
Heather
57050517f9 Merge pull request #593 from kwantam/master
fix `cut`
2015-05-12 07:10:02 +03:00
kwantam
aabbf83d88 fix cut
This commit updates `cut` to build on rust nightly.

In addition, it adds support for null input and output delimiters,
and fixes a bug in the `cut_characters()` function that would cause
incorrect output when two adjacent fields were specified in the range
list.
2015-05-11 21:15:39 -04:00
Joseph Crail
1ee57fa229 Fix nice. 2015-05-11 17:40:45 -04:00
Heather
c94a5ce808 Merge pull request #589 from jbcrail/fix-nl
Fix nl.
2015-05-11 08:08:50 +03:00
Heather
cf1723892d Merge pull request #590 from jbcrail/fix-nproc
Fix nproc.
2015-05-11 08:08:21 +03:00
Joseph Crail
b20bde94cb Fix od.
I upgraded to the nightly build and replaced the unstable BYTES constant
with mem::size_of().
2015-05-11 00:48:36 -04:00
Joseph Crail
58de022ed4 Fix nproc.
Since std::os::num_cpus() was removed from the library, I added the
num_cpus crate to the dependencies.
2015-05-10 22:20:20 -04:00
Joseph Crail
28c21902c5 Fix nl.
Aside from the usual upgrades to sync with the nightly build, I fixed an
unwrap() panic when reading lines with only a newline. I also refactored
the repeated command calls to use helper functions.
2015-05-10 18:59:37 -04:00
Joseph Crail
aa6a9c6fd7 Cleanup pwd.
I removed an unused argument from the usage documentation. I also
removed the redundant return calls.
2015-05-09 23:45:43 -04:00
Heather
1f67aaaf8c Merge pull request #585 from jbcrail/add-basename-split-tests
Add initial tests for basename/split.
2015-05-09 22:20:23 +03:00
Joseph Crail
234c81311f Add initial tests for split.
I created random data to test several cases. I verified that the data is
split into the correct number of files and can also be reassembled into
the original file.
2015-05-09 13:32:30 -04:00
Joseph Crail
3abf19a595 Fix basename when trailing slashes are present.
The GNU implementation first strips all trailing slashes before deleting
the directory portion. This case wasn't handled.

I also rewrote the method that strips the directory to use the PathBuf
methods for improved platform-indepedence.
2015-05-09 13:23:48 -04:00
Heather
39de3f7b71 Merge pull request #581 from kwantam/master
fix `rm` and `rmdir`
2015-05-09 08:11:28 +03:00
Joseph Crail
10339e6c32 Fix split.
I upgraded to the nightly build.
2015-05-08 23:11:15 -04:00
kwantam
a3acb00394 fix rmdir 2015-05-08 20:24:03 -04:00
kwantam
4854eb238d fix rm
In addition, this commit brings the behavior of `rm` better in line
with the behavior of GNU Coreutils rm, especially as regarding recursive
interactive deletion of directories. This version asks to delete files
in a different order from GNU rm, but it now gives the option of stopping
the recursion at each new directory that is reached.
2015-05-08 19:42:19 -04:00
Joseph Crail
dd19bc27c1 Update fold to nightly build. 2015-05-08 00:57:41 -04:00
Heather
4e2cd4dd24 Merge pull request #580 from jbcrail/remove-unused-feature
Remove unused feature from cat.
2015-05-08 07:46:21 +03:00
kwantam
ff24d48e73 modify factor impl to eliminate overflow issue
This change does the following:

1. Updates the arithmetic functions in `src/factor/numeric.rs` to
   correctly handle all cases up to 2^64. When numbers are larger
   than 2^63, we fall back to slightly slower routines that check
   for and handle overflow.

2. Since the arithmetic functions will now not overflow, we no longer
   need the safety net trial division implementation. We now always
   use Pollard's rho after eliminating small (<=13 bit) primes.

3. Slight tweak in `src/factor/gen_table.rs` to generate the first
   1027 primes, which means we test every prime of 13 or fewer bits
   before going into Pollard's rho. Includes corresponding update in
   `src/factor/prime_table.rs` and the Makefile to reflect this.

4. Add a new test that generates random numbers with exclusively
   large (14 to 50 bit) prime factors. This exercises the possible
   overflow paths.

5. Add another new test that checks the `is_prime()` function against
   a few dozen 64-bit primes. Again this is to exercise possible
   overflow paths.
2015-05-08 00:06:35 -04:00
Joseph Crail
dfaee63cd3 Remove unused feature from cat. 2015-05-07 23:02:47 -04:00
kwantam
7565c27c00 fixed sleep 2015-05-07 18:13:40 -04:00
Camille TJHOA
d8f58305d6 new io cksum (includes BufReader fix)
closes kwantam/coreutils#1 via cherry-pick
2015-05-07 18:13:40 -04:00
kwantam
d89fbedf12 fix shuf 2015-05-07 18:13:39 -04:00
kwantam
4390e4ffa6 fix tac 2015-05-07 18:13:39 -04:00
kwantam
9a806346a9 add test for factor
Add a test for `factor`.

This commit also pulls factor's Sieve implementation into its own module
so that the factor test can use it.

Finally, slight refactoring for clarity in gen_table.rs.
2015-05-07 18:13:39 -04:00
kwantam
cab4f8d570 fix test 2015-05-07 18:12:32 -04:00
kwantam
1c93a793e9 fix touch 2015-05-07 18:12:32 -04:00
kwantam
6c4e967fc6 fix and slight optimization for factor
This commit builds upon @wikol's Pollard rho implementation.
It adds the following:

1. A generator for prime inverse tables. With these, we can do
   very fast divisibility tests (a single multiply and comparison)
   for small primes (presently, the first 1000 primes are in the
   table, which means all numbers of ~26 bits or less can be
   factored very quickly.

2. Always try prime inverse tables before jumping into Pollard's
   rho method or using trial division.

3. Since we have eliminated all small factors by the time we're
   done with the table division, only use slow trial division when
   the number is big enough to cause overflow issues in Pollard's
   rho, and jump out of trial division and into Pollard's rho as
   soon as the number is small enough.

4. Updates the Makefile to regenerate the prime table if it's not
   up-to-date.
2015-05-07 18:12:32 -04:00
Wiktor Kuropatwa
06b70877db factor: Rho-Pollard factorization implementation 2015-05-07 18:12:32 -04:00
kwantam
cee1837879 slight clarification / refactoring in unexpand
This keeps equivalent functionality but makes the code slightly cleaner.
Also added one more test case.
2015-05-07 18:12:32 -04:00
Joseph Crail
b00a49eab2 Unescape all special characters in delimiter list. 2015-05-07 16:50:54 -04:00
Joseph Crail
773eeb6d5e Update paste to nightly build. 2015-05-07 16:49:07 -04:00
Heather
22093d1e5a Merge pull request #574 from ctjhoa/master
Update comm to new_io
2015-05-07 07:42:23 +03:00
Joseph Crail
500bbbfa83 Fix env and add tests.
I updated env to use the nightly build. I also added several tests.
2015-05-06 23:59:58 -04:00
Camille TJHOA
53f62cdd6f Update comm to new_io 2015-05-07 01:05:30 +02:00
Heather
1f2b68251f Merge pull request #573 from jbcrail/fix-link-sum
Fix link and sum.
2015-05-07 00:21:09 +03:00
Heather
5ec1c7bea4 Merge pull request #570 from jbcrail/fix-sort-test
Fix failing test for sort.
2015-05-07 00:19:53 +03:00
Joseph Crail
0c883155f5 Fix sum. 2015-05-06 14:12:30 -04:00
Joseph Crail
6911c7e2ce Fix link. 2015-05-06 13:38:45 -04:00
Heather
7c732bcefe Merge pull request #571 from jbcrail/fix-cp
Fix cp.
2015-05-06 07:43:16 +03:00
Joseph Crail
b854a3161a Fix realpath and relpath.
I used the new Path/PathBuf/PathExt libraries.
2015-05-06 00:14:13 -04:00
Joseph Crail
c31ad75226 Fix cp.
I used the new File/Path libraries. The canonicalize method made much of
paths_refer_to_same_file() redundant.
2015-05-05 19:42:38 -04:00
Joseph Crail
b809af601a Fix failing test for sort.
The sorted values were not outputted using a newline.
2015-05-05 19:39:30 -04:00
Joseph Crail
cec0a29b93 Rewrite tee.
The utility need a substantial rewrite due to library changes and
lifetime issues. I needed to implement the MultiWriter struct since it
was no longer available.
2015-05-05 00:08:54 -04:00
Heather
15acf2a2b5 Merge pull request #566 from jbcrail/update-tty
Update tty and ignore build directories.
2015-05-04 08:32:26 +03:00
Joseph Crail
b0f531c7a3 Fix sort.
Minor corrections: upgrade to new libraries, remove unused features, use
new slicing syntax.
2015-05-03 17:42:01 -04:00
Joseph Crail
6de22f91a9 Update tty's options to conform to GNU version. 2015-05-03 17:11:42 -04:00
Michael Gehring
88ab6cfff7 Merge pull request #563 from jbcrail/fix-printenv
Fix printenv.
2015-05-03 11:49:13 +02:00
Joseph Crail
965a770841 Remove quotes from current directory. 2015-05-02 21:05:30 -04:00
Joseph Crail
c4ae971e8c Fix hostid and pwd.
Minor library upgrades and whitespace corrections.
2015-05-01 22:00:53 -04:00
Joseph Crail
930896bac1 Fix printenv.
Minor corrections and upgrade to new env variable module.
2015-05-01 15:54:49 -04:00
Joseph Crail
c7d07315b8 Fix groups and logname.
Minor upgrades and whitespace corrections.
2015-04-30 17:56:35 -04:00
Joseph Crail
3465525d55 Fix tty.
I made minor corrections to upgrade to Rust nightly build.
2015-04-30 17:06:38 -04:00
Alex Lyon
4a6b7d33cb Merge pull request #557 from jbcrail/fix-truncate
Fix truncate and related tests.
2015-04-29 18:50:05 -07:00
Joseph Crail
27947c9d2d Fix dirname. 2015-04-29 21:20:08 -04:00
Joseph Crail
5ec7f28625 Fix truncate and related tests. 2015-04-29 19:23:50 -04:00
Joseph Crail
c6cfca8366 Remove redundant length checks. 2015-04-29 02:37:29 -04:00
Joseph Crail
3b09af815d Fix head and tail.
I upgraded to the recent Rust release. The only major change was the
reduction of the sleep millisecond resolution from u64 to u32 (this
matches the thread::sleep_ms() method).
2015-04-29 02:37:29 -04:00
kwantam
91827a594a fix tr and its test
In addition, this commit substantially reduces the number
of allocations that tr does when building the substitution
tables.
2015-04-29 01:31:16 -04:00
kwantam
8e2788bd39 fix/rewrite expand
This is a reworked version of expand. I did this for two main
reasons:

1. The previous version assumed the input was UTF-8. This
   version is compatible with both UTF-8 and non-UTF-8 inputs.

2. This version has a new flag, -U, which forces expand to
   treat input as 8-bit ASCII rather than interpreting it
   as UTF-8. This might be handy in some cases.
2015-04-29 01:09:27 -04:00
kwantam
feee266b20 fix/rewrite unexpand and its tests
This is a reworked version of unexpand. I did this for two main
reasons:

1. The previous version of unexpand had issues correctly computing
   tabstops when the `-a` flag was supplied.

2. The previous version assumed the input was UTF-8. This version works
   with non-UTF-8 inputs.

3. This version has a new flag, -U, which forces unexpand to
   treat input as 8-bit ASCII rather than interpreting it
   as UTF-8. This might be handy in some cases.
2015-04-29 01:09:27 -04:00
kwantam
ec4e3a60e4 fix unlink 2015-04-29 01:09:26 -04:00
kwantam
d1f594eb68 remove box_syntax feature from fmt, base64, cat 2015-04-29 01:09:26 -04:00
Joseph Crail
2c4fd7ae23 Fix tsort.
I upgraded to the recent Rust release.
2015-04-29 00:01:46 -04:00
kwantam
2e237dd6bb fix uname 2015-04-27 22:06:19 -04:00
kwantam
1d62f35b45 fix uptime 2015-04-27 22:00:19 -04:00
kwantam
a122849e7c fix wc 2015-04-27 18:19:56 -04:00
kwantam
143aea72ee fix users 2015-04-27 17:38:39 -04:00
kwantam
09937b66b9 fix whoami 2015-04-27 17:31:53 -04:00
kwantam
8cd81ec418 update uniq 2015-04-27 15:27:15 -04:00
kwantam
05520e69cb clean up #![features]
For the most part, this commit removes the `collections` feature.
In some places I've removed other features where the effort to do
so was pretty low.
2015-04-27 15:27:15 -04:00
kwantam
de28072140 update yes
This commit makes `yes` build on recent nightly.
2015-04-27 15:27:15 -04:00
kwantam
970857ccbe working chroot implementation 2015-04-27 00:06:12 -04:00
kwantam
664f7d474e update chroot (not quite working yet) 2015-04-26 16:12:19 -04:00
kwantam
06f1b38c91 update chmod for latest stdlib changes 2015-04-26 16:12:19 -04:00
Camille TJHOA
c8365f78b4 chroot new_io 2015-04-26 20:23:29 +02:00
Camille TJHOA
d990efff83 chmod new_io 2015-04-26 20:03:37 +02:00
kwantam
d4f39e1638 dependency builds use Cargo
With this change, individual submodules can specify their dependencies with
an additional file called "deps.mk" in the subdir. When building, only
the dependencies that are necessary are built, using cargo, and then linked.

This greatly simplifies adding new dependencies: add the package in
deps/Cargo.toml, and add the appropriate line in "deps.mk" in the
src/utilname/ directory, and the dependency will be built automatically
as needed.

This also removes the need to use git submodules.
2015-04-25 22:18:03 -04:00
kwantam
c6585b7086 make seq build on nightly 2015-04-25 22:09:06 -04:00
kwantam
cc48e83e98 update cat, cat tests to new API
This commit updates the `cat` utility as well as its testbench
to work with the latest APIs.
2015-04-25 03:28:06 -04:00
Joseph Crail
7c0eb246a0 Upgrade echo to use recent Rust nightly build.
I removed unused features, switched to the new range syntax, and other
minor updates.
2015-04-24 22:31:47 -04:00
Camille TJHOA
7332d7d827 Basename new_io 2015-04-24 00:10:18 +02:00
Camille TJHOA
a7caf3c86a Cksum new_io 2015-04-23 23:52:45 +02:00
Joseph Crail
92bbd7b2ce Upgrade base64 to use recent Rust nightly build. 2015-04-23 01:03:35 -04:00
kwantam
ecf248c5e3 fix build infrastructure ; modernize library use
This patch begins the work of modernizing uutils to work with 1.0-ish
Rust. In particular, it

1. Updates to the latest submodules.

2. Convert mkmain.rs, mkuutils.rs, and src/uutils/uutils.rs
   to new slice syntax and use of new io, fs, and path APIs.

3. Convert src/common/util.rs to new io, fs, and path APIs.

4. Convert fmt to use new APIs.
2015-04-18 19:55:32 -04:00
Michael Gehring
3529c5d809 Update feature flags 2015-03-08 19:09:41 +01:00
Michael Gehring
9f8fd55b4a Integer type changes 2015-03-08 19:06:30 +01:00
Michael Gehring
bce3382fd2 Closure syntax 2015-03-08 19:06:04 +01:00
Michael Gehring
a5547507af c_str_to_bytes -> CStr::from_ptr 2015-02-22 13:59:57 +01:00
Michael Gehring
eb6594cc91 CString::from_slice -> CString::new 2015-02-22 13:59:57 +01:00
Michael Gehring
3993a2bf90 Update feature flags 2015-02-22 13:59:57 +01:00
Michael Gehring
26568d2021 Update to the new integer suffixes 2015-02-22 13:59:57 +01:00
Michael Gehring
8098d172d7 Update slicing syntax ([] -> [..]) 2015-02-22 13:59:12 +01:00
Michael Gehring
9ae9a48387 feature io -> old_io, path -> old_path 2015-02-22 13:59:12 +01:00
Michael Gehring
4e79a82f46 fix feature warnings 2015-02-22 13:59:12 +01:00
Michael Gehring
50301e63ee env::args return Strings now 2015-02-22 13:59:12 +01:00
Michael Gehring
ec9c8659ea Drop unused imports 2015-02-22 13:59:12 +01:00
Michael Gehring
910fd61070 os::args -> env::args 2015-02-22 13:59:12 +01:00
Michael Gehring
e7b647171f os::set_exit_status(isize) -> env::set_exit_status(i32) 2015-02-22 13:59:12 +01:00
Michael Gehring
4d62e8289a collections::BitvSet -> collections::BitSet 2015-02-22 10:31:49 +01:00
Michael Gehring
b6ff2aeeae collections::RingBuf -> collections::VecDeque 2015-02-22 10:29:28 +01:00
Michael Gehring
80f9ef08d2 various integer type changes 2015-02-22 10:27:16 +01:00
Michael Gehring
09b1162912 CString::as_slice_with_nul -> CString::as_bytes_with_nul 2015-02-22 10:06:26 +01:00
Michael Gehring
e78900e56a new plugin attribute syntax 2015-02-13 16:45:01 +01:00
Michael Gehring
7c617f524b Fix closure syntax 2015-02-07 10:15:16 +01:00
Michael Gehring
d3ff46d0c7 Drop deprecated 'libc' feature flag 2015-02-06 14:10:07 +01:00
Michael Gehring
8021b491f6 fmt: iter::Peekable changes 2015-02-06 14:10:07 +01:00
Michael Gehring
5e70473a2b std::path -> std::old_path 2015-02-06 13:45:45 +01:00
Michael Gehring
25232c3697 Fix warnings 2015-02-03 23:59:48 +01:00
Michael Gehring
3eb5a814a3 Fix most unstable feature warnings 2015-02-03 23:54:37 +01:00
Michael Gehring
db8506532e derive(Show) -> derive(Debug) 2015-02-03 22:42:36 +01:00
Michael Gehring
d89d9ca73b Various functions in std::str return Result instead of Option now 2015-02-03 22:32:30 +01:00
Alex Lyon
9c0ed7236c Merge pull request #517 from keunwoo/keunwoo-fix-address-radix-20150127
od: fix --address-radix interpretation and minor cleanups
2015-02-01 12:13:37 -08:00
Michael Gehring
906d3e4ec5 write -> write_all 2015-01-29 08:47:43 +01:00
Michael Gehring
d187dc574b std::io -> std::old_io 2015-01-29 08:45:37 +01:00
Keunwoo Lee
f6a07663e8 od: proper interpretation of -A flag
Prior to this CL, --address-radix was being used to determine the format
of the output bytes.  This was wrong: this flag controls the printing of
the address (in the POSIX spec for od, this is called the "input offset
base"), not the printing of the content bytes.
2015-01-27 21:51:28 -08:00
Keunwoo Lee
55be34a2c4 od: clean up fname usage
+ rm superfluous clone
+ rm superfluous mut variable
2015-01-27 21:51:28 -08:00
Keunwoo Lee
71bc68a987 od: rm -v alias for --version
This shortflag conflicts with --output-duplicates.
2015-01-27 21:51:28 -08:00
Keunwoo Lee
b756a57345 od: clean up parse_radix code and use site
+ Make parse_radix terser and clearer.
+ Make purpose of radix clearer at use site
  (note that the code currently completely misuses the --address-radix
  flag; this is inherited from the previous code)
+ Don't panic! inside parse_radix; instead return Result<> and let the
  caller handle errors (currently we panic, but probably we'll want to use
  some less alarming error routine); this will be more testable later as
  well.
2015-01-27 21:51:28 -08:00
Alex Lyon
2f0d8c89c9 Merge pull request #515 from keunwoo/merge-benhirsch-od-20150125
Merge benhirsch24 work on od
2015-01-27 21:24:42 -08:00
Keunwoo Lee
288179be49 address Arcterus comments on uutils/coreutils PR 515
Mostly style things.
2015-01-27 19:32:26 -08:00
dokaptur
fecc81f270 stdbuf - fix issue 512 2015-01-25 15:06:41 +01:00
Alex Lyon
333e58283f Merge pull request #509 from Stebalien/cleanup-wc
Cleanup wc
2015-01-25 00:27:31 -08:00
Keunwoo Lee
1954274700 od: fix warnings 2015-01-25 00:17:38 -08:00
Alex Lyon
80d79d6053 Merge pull request #508 from Stebalien/cleanup-sync
Cleanup sync.
2015-01-25 00:12:35 -08:00
Alex Lyon
5766a0f6eb Merge pull request #507 from Stebalien/cleanup-cat
Cleanup cat
2015-01-25 00:10:07 -08:00
Keunwoo Lee
a6e5deaa16 od: whitespace fix (4-space indents, 99-column) 2015-01-25 00:03:14 -08:00
Alex Lyon
bfc6d2e288 Merge pull request #469 from dokaptur/stdbuf
stdbuf - basic version
2015-01-25 00:02:43 -08:00
Keunwoo Lee
2d8e7f6dec od: fix build
Just the minimal stuff needed to make od build again.  I have restrained
myself from making more invasive changes.
2015-01-24 23:56:10 -08:00
Steven Allen
03312d0bb1 Cleanup wc.
* Avoid cloning.
* Use slicing syntax.
* Use while let.
* Misc cleanup.
2015-01-25 02:29:06 -05:00
Steven Allen
be117de7e7 wc: reset current_char_count after each line. 2015-01-25 02:20:08 -05:00
Keunwoo Lee
3739c82c95 mv od/ -> src/ 2015-01-24 23:16:13 -08:00
Steven Allen
903bb00189 Cleanup sync.
* Use slicing syntax.
* Don't unnecessarily use the match binding syntax.
2015-01-25 01:46:55 -05:00
Steven Allen
7647a37bf8 Cleanup cat: use slicing syntax. 2015-01-25 01:21:31 -05:00
Steven Allen
8a101b2203 Cleanup cat: use while let instead of loop then match. 2015-01-24 22:53:27 -05:00
Steven Allen
9326dbc3de Cleanup cat: open files in for loop header. 2015-01-24 22:52:40 -05:00
Steven Allen
e7f80e9826 Cleanup yes
Mostly avoid copying where not needed.
2015-01-24 22:42:16 -05:00
dokaptur
ec4182fcf1 stdbuf - install multicall 2015-01-25 00:39:30 +01:00
dokaptur
b71df2fd78 prepare_libs in Makefile 2015-01-25 00:39:30 +01:00
dokaptur
563c9ab34e preloading improvement 2015-01-25 00:39:06 +01:00
dokaptur
32259aadda basic version 1 2015-01-25 00:38:20 +01:00
Heather
6c897dc76c Merge pull request #504 from ebfe/slice
Replace deprecated slice_{to,from} with slicing syntax
2015-01-24 18:47:46 +03:00
Michael Gehring
fbdf04c072 Replace deprecated slice_{to,from} with slicing syntax 2015-01-24 10:46:28 +01:00
Michael Gehring
78408fda78 sort: fix build 2015-01-24 09:50:33 +01:00
Michael Gehring
cb1dd390bb base64, cp: fix build 2015-01-24 03:56:37 +01:00
Tom Genco
406735e6f2 uname: change trim_left() to trim()
Otherwise all options have a space at the end, causing a warning in grml zsh config, and who knows what else.
2015-01-13 15:04:21 -07:00
Haitao Li
a6750e90a7 Implement readlink
Fixes #111
2015-01-13 22:21:23 +11:00
Arcterus
41cc268df8 Make dependency info usable for test, sync, true, and false 2015-01-10 13:00:15 -08:00
Michael Gehring
58bd009a9e Remove unused imports 2015-01-10 20:44:57 +01:00
Michael Gehring
6aef8cc38c Don't link to regex_macros 2015-01-10 20:44:56 +01:00
Michael Gehring
4d6cbfa393 Disable unstable warnings for now 2015-01-10 20:44:56 +01:00
Arcterus
e142b4f23e env, expand, fmt: fix build 2015-01-10 20:40:38 +01:00
Michael Gehring
8e430d6952 nl: fix build 2015-01-10 20:40:38 +01:00
Michael Gehring
782fad4667 int/uint -> isize/usize 2015-01-10 20:40:37 +01:00
Michael Gehring
cc854698d7 relpath, tee, split, unexpand: fix build 2015-01-10 20:40:37 +01:00
Michael Gehring
8d889fc5c9 uptime, users, whoami: fix build 2015-01-10 20:40:37 +01:00
Michael Gehring
8cd7295a19 test, tr, tsort: fix build 2015-01-10 20:40:37 +01:00
Michael Gehring
fecd3433cb id, nice, nohup: fix build 2015-01-10 16:54:45 +01:00
Michael Gehring
f2d49f4bb6 Make uumain return isize everywhere 2015-01-10 14:07:39 +01:00
Michael Gehring
c223e28fac uniq, wc: fix build 2015-01-10 13:49:40 +01:00
Michael Gehring
7860ef275c sort, sum tac: fix build 2015-01-10 13:49:18 +01:00
Michael Gehring
5402e69923 mkfifo, paste, shuf: fix build 2015-01-10 13:48:42 +01:00
Michael Gehring
c62bacb9fa hashsum: fix build 2015-01-10 13:18:15 +01:00
Arcterus
a12fd89cb2 chmod, chroot, comm: fix build 2015-01-09 16:51:51 -08:00
Arcterus
4e0360c495 base64, cat: fix build for Rust alpha 2015-01-09 16:16:05 -08:00
Michael Gehring
b50a2639a9 base64, du, realpath: fix build 2015-01-10 00:13:16 +01:00
Michael Gehring
cb87309e92 cut: fix build 2015-01-09 14:09:12 +01:00
Michael Gehring
0a757b957f Partially fixed build with rust master
String::from_raw_buf removal
Deprecated closure syntax
cmp::Ord -> cmp::Ordering
Vec::from_{elem,fn} removal
rand::TaskRng -> rand::ThreadRng
PtrExt::is_not_null removal
to_c_str removal
2015-01-09 09:41:49 +01:00
Michael Gehring
9aef41b8f6 << precedence 2015-01-08 14:50:03 +01:00
Michael Gehring
f580275ef8 s/mod/self/ in imports 2015-01-08 14:50:03 +01:00
Michael Gehring
48f129ea49 std::char::UnicodeChar removal 2015-01-08 14:50:03 +01:00
Michael Gehring
b8a96da278 into_string -> to_string 2015-01-08 14:50:03 +01:00
Michael Gehring
fd69e7fa4a str::from_str removal/changes 2015-01-08 14:50:03 +01:00
Michael Gehring
7d8053561e Use new array syntax 2015-01-08 14:50:03 +01:00
Michael Gehring
074a58eafd deriving is now called derive 2015-01-08 14:50:03 +01:00
Michael Gehring
1b381f49fa Use new macro feature flags/attributes 2015-01-08 14:50:02 +01:00
Timofey Misarenkov
59710d5ff8 NULL-pointer check. 2015-01-08 00:32:30 +03:00