Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=ebdf1ec54c46fad4b7719506f1016410ddf59aea
commit ebdf1ec54c46fad4b7719506f1016410ddf59aea Author: James Buren <[email protected]> Date: Fri Aug 10 17:12:43 2012 -0500 more stuff diff --git a/fwsetup.c b/fwsetup.c index 86217df..f85a572 100644 --- a/fwsetup.c +++ b/fwsetup.c @@ -5,6 +5,26 @@ extern int main(void) struct database db = {0}; #ifdef NEWT + if(newtInit() != 0) + { + eprintf("Failed to initialize NEWT.\n"); + + return EXIT_FAILURE; + } + + newtCls(); + + newtGetScreenSize(&db.screen_width,&db.screen_height); + + db.window_width = (int) ((double) (db.screen_width - 2) * 0.9); + + db.window_height = (int) ((double) (db.screen_height - 2) * 0.9); + + db.window_x = (db.screen_width - db.window_width) / 2; + + db.window_y = (db.screen_height - db.window_height) / 2; + + newtFinished(); #endif return EXIT_SUCCESS; diff --git a/fwsetup.h b/fwsetup.h index 73645ac..fdc8bc4 100644 --- a/fwsetup.h +++ b/fwsetup.h @@ -28,6 +28,7 @@ struct module bool (*run) (struct database *); }; +extern void eprintf(const char *s,...) __attribute__((format(printf,1,2)));; extern int main(void); // -%- strip: yes; add-newline: yes; use-tabs: no; indent-width: 2; tab-width: 2; -%- diff --git a/utility.c b/utility.c new file mode 100644 index 0000000..42b0149 --- /dev/null +++ b/utility.c @@ -0,0 +1,16 @@ +#include "fwsetup.h" + +extern void eprintf(const char *s,...) +{ + assert(s != 0); + + va_list args; + + va_start(args,s); + + vfprintf(stderr,s,args); + + va_end(args); +} + +// -%- strip: yes; add-newline: yes; use-tabs: no; indent-width: 2; tab-width: 2; -%- _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
