Commit graph

321 commits

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