Commit graph

1383 commits

Author SHA1 Message Date
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
Heather
eba90561f6 Merge pull request #596 from jbcrail/remove-returns
Remove tail return statements.
2015-05-13 07:21:55 +03:00
Joseph Crail
f502b187a7 Remove tail return statements. 2015-05-12 19:54:12 -04:00
Joseph Crail
481fdd744a Add tests for readlink. 2015-05-12 17:09:41 -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
Heather
60e3603410 Merge pull request #592 from jbcrail/fix-nice
Fix nice.
2015-05-12 07:06:43 +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
Heather
c8dbe036e5 Merge pull request #591 from jbcrail/fix-od
Fix od.
2015-05-11 08:07:17 +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
Heather
8deb9a8dc1 Merge pull request #588 from jbcrail/cleanup-pwd
Cleanup pwd.
2015-05-10 12:35:22 +03:00
Heather
93a96abcae Merge pull request #587 from jbcrail/add-tsort-test
Add initial test for tsort.
2015-05-10 12:35:05 +03: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
Joseph Crail
82dbd02c03 Add initial test for tsort. 2015-05-09 23:38:48 -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
Heather
7300624a50 Merge pull request #586 from jbcrail/add-more-tests
Add more tests.
2015-05-09 22:20:19 +03:00
Heather
478fe40d3b Merge pull request #584 from jbcrail/fix-basename-bug
Fix basename when trailing slashes are present.
2015-05-09 22:19:06 +03:00
Joseph Crail
08aea6d549 Add initial test for pwd. 2015-05-09 15:17:26 -04:00
Joseph Crail
9172bb9bd8 Add initial tests for false/true. 2015-05-09 15:17:16 -04:00
Joseph Crail
87e7cc9b44 Add initial tests for echo. 2015-05-09 15:17:01 -04:00
Joseph Crail
e700e0d2f4 Add initial tests for dirname. 2015-05-09 15:16:45 -04:00
Joseph Crail
646285f684 Add initial tests for basename. 2015-05-09 13:32:47 -04: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
Heather
df27f5035c Merge pull request #582 from jbcrail/fix-split
Fix split.
2015-05-09 08:10:50 +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
Heather
7cb74885c4 Merge pull request #579 from jbcrail/update-fold
Update fold and add tests.
2015-05-08 08:05:38 +03:00
Joseph Crail
5878d9904e Add tests for fold. 2015-05-08 00:58:43 -04:00
Joseph Crail
dd19bc27c1 Update fold to nightly build. 2015-05-08 00:57:41 -04:00
Heather
b4c106b004 Merge pull request #578 from jbcrail/fix-broken-seq-tests
Fix broken seq tests.
2015-05-08 07:47:25 +03: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
Heather
a457a870e9 Merge pull request #558 from kwantam/master
slight refactor in `unexpand` ; fix and optimize `factor` ; fix `touch`, `test`, `tac`, `shuf`, `sleep` ; merge PR from @ctjhoa for `cksum`
2015-05-08 07:45:58 +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