Changes in tests/configs/parsebools.cfa [9e042d8:0b6089f]
- File:
-
- 1 edited
-
tests/configs/parsebools.cfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/configs/parsebools.cfa
r9e042d8 r0b6089f 10 10 // Author : Thierry Delisle 11 11 // Created On : Wed Oct 12 15:28:01 2022 12 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Feb 11 09:26:13 2024 14 // Update Count : 2 15 15 // 16 16 17 17 #include <fstream.hfa> 18 19 18 #include "../meta/fork+exec.hfa" 20 19 … … 22 21 #include <parseargs.hfa> 23 22 24 int main( int argc, char * argv[]) {23 int main( int argc, char * argv[] ) { 25 24 check_main(argv[0]); 26 25 … … 41 40 42 41 char **left; 43 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left );42 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left ); 44 43 45 44 sout | "yes/no :" | YN; … … 51 50 } 52 51 53 int true_main( const char * path, char * env[]) {54 printf( "no arg:\n");55 if (pid_t child = strict_fork(); child == 0) {56 int ret = execle( path, "parsebools", (const char*)0p, env);57 if (ret < 0) {58 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));59 exit( 1);52 int true_main( const char * path, char * env[] ) { 53 printf( "no arg:\n" ); 54 if ( pid_t child = strict_fork(); child == 0 ) { 55 int ret = execle( path, "parsebools", (const char*)0p, env ); 56 if ( ret < 0 ) { 57 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 58 exit( 1 ); 60 59 } 61 } 62 else { 63 int status = do_wait(child); 64 print_status(status); 65 } 60 } else { 61 int status = do_wait( child ); 62 print_status( status ); 63 } // if 66 64 67 printf("all true/set arg:\n"); 68 if(pid_t child = strict_fork(); child == 0) { 69 int ret = execle(path, "parsebools", "-e=yes", "-y=Y", "-n=y", "-t=true", "-s", "-u", (const char*)0p, env); 70 if(ret < 0) { 71 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 72 exit(1); 73 } 74 } 75 else { 76 int status = do_wait(child); 77 print_status(status); 78 } 65 printf( "all true/set arg:\n" ); 66 if ( pid_t child = strict_fork(); child == 0 ) { 67 int ret = execle( path, "parsebools", "-e=yes", "-y=Y", "-n=y", "-t=true", "-s", "-u", (const char*)0p, env ); 68 if ( ret < 0 ) { 69 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 70 exit( 1 ); 71 } // if 72 } else { 73 int status = do_wait( child ); 74 print_status( status ); 75 } // if 79 76 80 printf("all false/unset arg:\n"); 81 if(pid_t child = strict_fork(); child == 0) { 82 int ret = execle(path, "parsebools", "-e=no", "-y=N", "-n=n", "-t=false", (const char*)0p, env); 83 if(ret < 0) { 84 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 85 exit(1); 86 } 87 } 88 else { 89 int status = do_wait(child); 90 print_status(status); 91 } 77 printf( "all false/unset arg:\n" ); 78 if ( pid_t child = strict_fork(); child == 0 ) { 79 int ret = execle( path, "parsebools", "-e=no", "-y=N", "-n=n", "-t=false", (const char*)0p, env ); 80 if ( ret < 0 ) { 81 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 82 exit( 1 ); 83 } // if 84 } else { 85 int status = do_wait( child ); 86 print_status( status ); 87 } // if 92 88 93 printf("gibberish arg 1:\n"); 94 if(pid_t child = strict_fork(); child == 0) { 95 int ret = execle(path, "parsebools", "-y=true", (const char*)0p, env); 96 if(ret < 0) { 97 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 98 exit(1); 99 } 100 } 101 else { 102 int status = do_wait(child); 103 print_status(status); 104 } 89 printf( "gibberish arg 1:\n" ); 90 if ( pid_t child = strict_fork(); child == 0 ) { 91 int ret = execle( path, "parsebools", "-y=true", (const char*)0p, env ); 92 if ( ret < 0 ) { 93 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 94 exit( 1 ); 95 } // if 96 } else { 97 int status = do_wait( child ); 98 print_status( status ); 99 } // if 105 100 106 printf("gibberish arg 2:\n"); 107 if(pid_t child = strict_fork(); child == 0) { 108 int ret = execle(path, "parsebools", "-t=yes", (const char*)0p, env); 109 if(ret < 0) { 110 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 111 exit(1); 112 } 113 } 114 else { 115 int status = do_wait(child); 116 print_status(status); 117 } 101 printf( "gibberish arg 2:\n" ); 102 if ( pid_t child = strict_fork(); child == 0 ) { 103 int ret = execle( path, "parsebools", "-t=yes", (const char*)0p, env ); 104 if ( ret < 0 ) { 105 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 106 exit( 1 ); 107 } // if 108 } else { 109 int status = do_wait( child ); 110 print_status( status ); 111 } // if 118 112 119 printf("gibberish arg 3:\n"); 120 if(pid_t child = strict_fork(); child == 0) { 121 int ret = execle(path, "parsebools", "-s=yes", (const char*)0p, env); 122 if(ret < 0) { 123 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 124 exit(1); 125 } 126 } 127 else { 128 int status = do_wait(child); 129 print_status(status); 130 } 113 printf( "gibberish arg 3:\n" ); 114 if ( pid_t child = strict_fork(); child == 0 ) { 115 int ret = execle( path, "parsebools", "-s=yes", (const char*)0p, env ); 116 if ( ret < 0 ) { 117 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 118 exit( 1 ); 119 } // if 120 } else { 121 int status = do_wait( child ); 122 print_status( status ); 123 } // if 131 124 132 printf("gibberish arg 4:\n"); 133 if(pid_t child = strict_fork(); child == 0) { 134 int ret = execle(path, "parsebools", "-u=yes", (const char*)0p, env); 135 if(ret < 0) { 136 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 137 exit(1); 138 } 139 } 140 else { 141 int status = do_wait(child); 142 print_status(status); 143 } 125 printf( "gibberish arg 4:\n" ); 126 if ( pid_t child = strict_fork(); child == 0 ) { 127 int ret = execle( path, "parsebools", "-u=yes", ( const char*)0p, env ); 128 if ( ret < 0 ) { 129 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 130 exit( 1 ); 131 } // if 132 } else { 133 int status = do_wait( child ); 134 print_status( status ); 135 } // if 144 136 145 printf( "All Done!\n");137 printf( "All Done!\n" ); 146 138 147 139 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.