On Fri, Aug 19, 2011 at 06:59:14PM +0300, Tadas Slotkus wrote: > > > can't we just rename cli_classic to main and get rid of the wrapper > > function? what's the purpose of it anyway? > > I find it useful for globals init code (will post some patches in a day > or few) :)
Not sure what you are referring to, but that should be easily doable in the main() too then? Updated patch attached. As discussed with dhendrix on IRC, the Google/Chromium git tree will not have a problem with this patch, they use a cli_mfg() which will get its own main() and cli_mfg.o will be linked in the Makefile respectively (instead of cli_classsic.o). > Uwe, are you going to send patches removing exit() calls? :) Maybe, yes, but feel free to send your own if you work on that, might take a while here... Uwe. -- http://hermann-uwe.de | http://sigrok.org http://randomprojects.org | http://unmaintained-free-software.org
Move the main() function from flashrom.c to cli_classic.c. The file flashrom.c is part of libflashrom and should thus not contain a main() function, that would break compilation of all frontends using libflashrom. Also, cli_classic.c is the right place anyway, as it's the main() of the CLI tool. Rename the simple wrapper cli_classic() in cli_classic.c to main(), as it's not really needed. Signed-off-by: Uwe Hermann <[email protected]> Index: flash.h =================================================================== --- flash.h (Revision 1416) +++ flash.h (Arbeitskopie) @@ -251,9 +251,6 @@ #define msg_pspew(...) print(MSG_BARF, __VA_ARGS__) /* programmer debug barf */ #define msg_cspew(...) print(MSG_BARF, __VA_ARGS__) /* chip debug barf */ -/* cli_classic.c */ -int cli_classic(int argc, char *argv[]); - /* layout.c */ int read_romlayout(char *name); int find_romentry(char *name); Index: cli_classic.c =================================================================== --- cli_classic.c (Revision 1416) +++ cli_classic.c (Arbeitskopie) @@ -96,7 +96,7 @@ exit(1); } -int cli_classic(int argc, char *argv[]) +int main(int argc, char *argv[]) { unsigned long size; /* Probe for up to three flash chips. */ Index: flashrom.c =================================================================== --- flashrom.c (Revision 1416) +++ flashrom.c (Arbeitskopie) @@ -1796,11 +1796,6 @@ } } -int main(int argc, char *argv[]) -{ - return cli_classic(argc, argv); -} - /* FIXME: This function signature needs to be improved once doit() has a better * function signature. */
_______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
