Commit graph

383 commits

Author SHA1 Message Date
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
Michael Gehring
cac838155e travis: skip unsupported utils on stable/beta builds 2016-01-06 13:56:19 +01:00
Sunrin SHIMURA (keen)
58d1d66d16 [mktemp] implement mktemp 2016-01-03 19:10:47 +09:00
Fort
eb6453013e Implement shred 2015-12-29 13:30:05 -08: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
2c8ebb6215 Mark chmod as Unix-only until better Win support. 2015-12-01 01:33:38 -05:00
Joseph Crail
a8bb7f4417 build: create group features for target systems
This allows a user to create builds with or without the Unix-specific
utilities. Right now the Makefile handles this, but this is needed to
migrate away from make.

To build Unix-specific utilities (default):

cargo build
(or)
cargo build --features unix --no-default-features

To build without the Unix-specific utilities:

cargo build --features generic --no-default-features
2015-11-29 17:27:54 -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
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
a21c54e2cd rewrite tests for cargo compat, decoupled directory, output handling 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
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
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
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
Arcterus
7abc6c007a Implement most of chmod 2014-10-25 20:32:40 -07:00
Alex Lyon
ea5d67f8dc Merge pull request #420 from skv-headless/move_util
move utility
2014-10-19 11:50:15 -07:00
skv
9f20647984 move_util 2014-10-19 22:41:11 +04:00
Michael Yin
bde6d8d643 basic byte and numeric sort
tests for numeric sort
2014-10-18 18:33:18 -04:00
Virgile Andreani
49a733a864 Implement unexpand 2014-07-28 19:36:33 +02:00
Virgile Andreani
69cb8da6ed Implement expand 2014-07-26 12:57:26 +02:00
Arcterus
a38ee8a007 Implement timeout (resolves #364) 2014-07-21 18:55:52 -07:00
Akira Hayakawa
f414fcb89d Add tsort
Signed-off-by: Akira Hayakawa <ruby.wktk@gmail.com>
2014-07-20 12:19:38 +09:00
Julian Orth
a4eb5c16f9 add test 2014-07-15 14:56:21 +02:00
Arcterus
0b76c70aaa Add shuf to Cargo.toml and remove shuf from to-do list 2014-07-09 19:45:12 -07:00
Chirag Jadwani
fc027254df uniq - Add initial implementation 2014-07-06 12:48:14 +05:30
Akira Hayakawa
16463243e3 split: Initial import
Signed-off-by: Akira Hayakawa <ruby.wktk@gmail.com>
2014-07-02 07:30:08 +09:00
Vsevolod Velichko
c6f75a1419 relpath implementation 2014-06-29 23:59:25 +04:00
Vsevolod Velichko
c7e93c009e realpath implementation 2014-06-29 23:57:54 +04:00
polyphemus
a470c330e6 Add cut to Cargo.toml, remove cut from To Do list 2014-06-27 17:39:59 +02:00
Vsevolod Velichko
3d75a9ba9d Added nohup to cargo 2014-06-26 10:41:32 +04:00
Michael Gehring
9a09e2d756 add Cargo.toml 2014-06-25 07:35:03 +02:00