comparison main.c @ 1644:492bd41f8b9a draft

Move fflush() checking to xexit() and have exit paths in main() call that.
author Rob Landley <rob@landley.net>
date Sat, 03 Jan 2015 16:25:36 -0600
parents 5fac2769a159
children 10922d83392a
comparison
equal deleted inserted replaced
1643:54c092c3ee38 1644:492bd41f8b9a
134 if (toys.recursion++ > 5) return; 134 if (toys.recursion++ > 5) return;
135 135
136 // Run command 136 // Run command
137 toy_init(which, argv); 137 toy_init(which, argv);
138 if (toys.which) toys.which->toy_main(); 138 if (toys.which) toys.which->toy_main();
139 if (fflush(NULL) || ferror(stdout)) perror_exit("write");
140 xexit(); 139 xexit();
141 } 140 }
142 141
143 // Multiplexer command, first argument is command to run, rest are args to that. 142 // Multiplexer command, first argument is command to run, rest are args to that.
144 // If first argument starts with - output list of command install paths. 143 // If first argument starts with - output list of command install paths.
187 toybox_main(); 186 toybox_main();
188 } else { 187 } else {
189 // a single toybox command built standalone with no multiplexer 188 // a single toybox command built standalone with no multiplexer
190 toy_singleinit(toy_list, argv); 189 toy_singleinit(toy_list, argv);
191 toy_list->toy_main(); 190 toy_list->toy_main();
192 if (fflush(NULL) || ferror(stdout)) perror_exit("write");
193 } 191 }
194 192
195 return toys.exitval; 193 xexit();
196 } 194 }