* [: * '[' expr ']' * test: * test expr */
| 840 | * test expr |
| 841 | */ |
| 842 | int |
| 843 | main (int margc, char **margv) |
| 844 | { |
| 845 | bool value; |
| 846 | |
| 847 | #if !defined TEST_STANDALONE |
| 848 | int code; |
| 849 | |
| 850 | code = setjmp (test_exit_buf); |
| 851 | |
| 852 | if (code) |
| 853 | return (test_error_return); |
| 854 | #else /* TEST_STANDALONE */ |
| 855 | initialize_main (&margc, &margv); |
| 856 | set_program_name (margv[0]); |
| 857 | setlocale (LC_ALL, ""); |
| 858 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 859 | textdomain (PACKAGE); |
| 860 | |
| 861 | initialize_exit_failure (TEST_FAILURE); |
| 862 | atexit (close_stdout); |
| 863 | #endif /* TEST_STANDALONE */ |
| 864 | |
| 865 | argv = margv; |
| 866 | |
| 867 | if (LBRACKET) |
| 868 | { |
| 869 | /* Recognize --help or --version, but only when invoked in the |
| 870 | "[" form, when the last argument is not "]". Use direct |
| 871 | parsing, rather than parse_long_options, to avoid accepting |
| 872 | abbreviations. POSIX allows "[ --help" and "[ --version" to |
| 873 | have the usual GNU behavior, but it requires "test --help" |
| 874 | and "test --version" to exit silently with status 0. */ |
| 875 | if (margc == 2) |
| 876 | { |
| 877 | if (streq (margv[1], "--help")) |
| 878 | usage (EXIT_SUCCESS); |
| 879 | |
| 880 | if (streq (margv[1], "--version")) |
| 881 | { |
| 882 | version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, AUTHORS, |
| 883 | (char *) NULL); |
| 884 | test_main_return (EXIT_SUCCESS); |
| 885 | } |
| 886 | } |
| 887 | if (margc < 2 || !streq (margv[margc - 1], "]")) |
| 888 | test_syntax_error (_("missing %s"), quote ("]")); |
| 889 | |
| 890 | --margc; |
| 891 | } |
| 892 | |
| 893 | argc = margc; |
| 894 | pos = 1; |
| 895 | |
| 896 | if (pos >= argc) |
| 897 | test_main_return (TEST_FALSE); |
| 898 | |
| 899 | value = posixtest (argc - 1); |
nothing calls this directly
no test coverage detected