Changes in tests/configs/usage.cfa [0b6089f:9e042d8]
- File:
-
- 1 edited
-
tests/configs/usage.cfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/configs/usage.cfa
r0b6089f r9e042d8 10 10 // Author : Thierry Delisle 11 11 // Created On : Wed Oct 12 15:28:01 2022 12 // Last Modified By : Peter A. Buhr13 // Last Modified On : Sun Feb 11 09:29:51 202414 // Update Count : 112 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 15 15 // 16 16 … … 24 24 25 25 sout | "No args, no errors"; 26 if ( pid_t child = strict_fork(); child == 0) {26 if(pid_t child = strict_fork(); child == 0) { 27 27 array( cfa_option, 0 ) opts; 28 print_args_usage(1, fake_argv, opts, "Test usage", false ); 29 } else { 30 int status = do_wait( child ); 31 print_status( status ); 32 } // if 28 print_args_usage(1, fake_argv, opts, "Test usage", false); 29 } 30 else { 31 int status = do_wait(child); 32 print_status(status); 33 } 33 34 34 35 sout | "No args, with errors"; 35 if ( pid_t child = strict_fork(); child == 0) {36 if(pid_t child = strict_fork(); child == 0) { 36 37 array( cfa_option, 0 ) opts; 37 print_args_usage(1, fake_argv, opts, "Test usage", true ); 38 } else { 39 int status = do_wait( child ); 40 print_status( status ); 41 } // if 38 print_args_usage(1, fake_argv, opts, "Test usage", true); 39 } 40 else { 41 int status = do_wait(child); 42 print_status(status); 43 } 42 44 43 45 sout | "Args with short names only:"; 44 if ( pid_t child = strict_fork(); child == 0) {46 if(pid_t child = strict_fork(); child == 0) { 45 47 int a, b, c; 46 48 array( cfa_option, 3 ) opts; … … 48 50 opts[1] = (cfa_option){'b', "", "Second arg", b }; 49 51 opts[2] = (cfa_option){'c', "", "Third arg", c }; 50 print_args_usage(1, fake_argv, opts, "Test usage", false ); 51 } else { 52 int status = do_wait( child ); 53 print_status( status ); 54 } // if 52 print_args_usage(1, fake_argv, opts, "Test usage", false); 53 } 54 else { 55 int status = do_wait(child); 56 print_status(status); 57 } 55 58 56 59 sout | "Args with long names only:"; 57 if ( pid_t child = strict_fork(); child == 0) {60 if(pid_t child = strict_fork(); child == 0) { 58 61 int a, b, c; 59 62 array( cfa_option, 3 ) opts; … … 61 64 opts[1] = (cfa_option){'\0', "BB", "Second arg", b }; 62 65 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 63 print_args_usage(1, fake_argv, opts, "Test usage", false ); 64 } else { 65 int status = do_wait( child ); 66 print_status( status ); 67 } // if 66 print_args_usage(1, fake_argv, opts, "Test usage", false); 67 } 68 else { 69 int status = do_wait(child); 70 print_status(status); 71 } 68 72 69 73 sout | "Mix of short and long args:"; 70 if ( pid_t child = strict_fork(); child == 0) {74 if(pid_t child = strict_fork(); child == 0) { 71 75 int a, b, c; 72 76 array( cfa_option, 3 ) opts; … … 74 78 opts[1] = (cfa_option){'b', "BBBB", "Second arg", b }; 75 79 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 76 print_args_usage(1, fake_argv, opts, "Test usage", false ); 77 } else { 78 int status = do_wait( child ); 79 print_status( status ); 80 } // if 80 print_args_usage(1, fake_argv, opts, "Test usage", false); 81 } 82 else { 83 int status = do_wait(child); 84 print_status(status); 85 } 81 86 82 87 sout | "Mix of short and long and some missing description:"; 83 if ( pid_t child = strict_fork(); child == 0) {88 if(pid_t child = strict_fork(); child == 0) { 84 89 int a, b, c; 85 90 array( cfa_option, 3 ) opts; … … 87 92 opts[1] = (cfa_option){'b', "BBBB", "", b }; 88 93 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 89 print_args_usage(1, fake_argv, opts, "Test usage", false ); 90 } else { 91 int status = do_wait( child ); 92 print_status( status ); 93 } // if 94 print_args_usage(1, fake_argv, opts, "Test usage", false); 95 } 96 else { 97 int status = do_wait(child); 98 print_status(status); 99 } 94 100 95 101 sout | "Mix of short and long and some long description:"; 96 if ( pid_t child = strict_fork(); child == 0) {102 if(pid_t child = strict_fork(); child == 0) { 97 103 int a, b, c; 98 104 array( cfa_option, 3 ) opts; … … 100 106 opts[1] = (cfa_option){'b', "BBBB", "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", b }; 101 107 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 102 print_args_usage(1, fake_argv, opts, "Test usage", false ); 103 } else { 104 int status = do_wait( child ); 105 print_status( status ); 106 } // if 108 print_args_usage(1, fake_argv, opts, "Test usage", false); 109 } 110 else { 111 int status = do_wait(child); 112 print_status(status); 113 } 107 114 } 108 115 109 116 // no used 110 static int true_main( const char * path, char * env[]) { return 0; }117 static int true_main(const char * path, char * env[]) { return 0; }
Note:
See TracChangeset
for help on using the changeset viewer.