Mercurial > hg > toybox
annotate toys/pending/test.c @ 832:75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 26 Mar 2013 22:31:10 -0500 |
parents | |
children | 9927d1d1e7e2 |
rev | line source |
---|---|
832
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 /* test.c - evaluate expression |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 * |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 * Copyright 2013 Rob Landley <rob@landley.net> |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 * |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 USE_TEST(NEWTOY(test, NULL, TOYFLAG_USR|TOYFLAG_BIN)) |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 config TEST |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 bool "test" |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 default n |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 help |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 usage: test [-bcdefghLPrSsuwx PATH] [-nz STRING] [-t FD] [X ?? Y] |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 Return true or false by performing tests. (With no arguments return false.) |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 --- Tests with a single argument (after the option): |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 PATH is/has: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 -b block device -f regular file -p fifo -u setuid bit |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 -c char device -g setgid -r read bit -w write bit |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 -d directory -h symlink -S socket -x execute bit |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 -e exists -L symlink -s nonzero size |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 STRING is: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 -n nonzero size -z zero size (STRING by itself implies -n) |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 FD (integer file descriptor) is: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 -t a TTY |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 --- Tests with one argument on each side of an operator: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 Two strings: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 = are identical != differ |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 Two integers: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 -eq equal -gt first > second -lt first < second |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 -ne not equal -ge first >= second -le first <= second |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 --- Modify or combine tests: |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 ! EXPR not (swap true/false) EXPR -a EXPR and (are both true) |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 ( EXPR ) evaluate this first EXPR -o EXPR or (is either true) |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 */ |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 #include "toys.h" |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 void test_main(void) |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 { |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
44 return; |
75526930cdd7
Add help text for pending test command. (No actual implementation yet.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 } |