Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=045dca70ac9c0f801f5c632fa0d21fda811f5d0b

commit 045dca70ac9c0f801f5c632fa0d21fda811f5d0b
Author: James Buren <[email protected]>
Date:   Sat Aug 11 13:49:01 2012 -0500

install module list loop for executing future modules in a predetermined order

diff --git a/fwsetup.c b/fwsetup.c
index df69cd0..e95eea8 100644
--- a/fwsetup.c
+++ b/fwsetup.c
@@ -1,11 +1,22 @@
#include "fwsetup.h"

+#define MODULE_COUNT (2 + 1)
+#define EMPTY_MODULE (&(struct module) { 0, 0 })
+
+static struct database db;
+
+static struct module modules[MODULE_COUNT];
+
extern int main(void)
{
-  struct database db;
+  struct module *module = &modules[1];

memzero(&db,sizeof(struct database));

+  memzero(&modules,sizeof(struct module) * MODULE_COUNT);
+
+  modules[1] = begin_module;
+
db.locale = setlocale(LC_ALL,"");

#ifdef NEWT
@@ -28,7 +39,28 @@ extern int main(void)

db.window_y = (db.screen_height - db.window_height) / 2;

-  module_begin.run(&db);
+  while(memcmp(module,EMPTY_MODULE,sizeof(struct module)) != 0)
+    switch(module->run(&db))
+    {
+      case ORDER_NONE:
+        assert_not_reached();
+        break;
+
+      case ORDER_ERROR:
+        break;
+
+      case ORDER_PREVIOUS:
+        --module;
+        break;
+
+      case ORDER_NEXT:
+        ++module;
+        break;
+
+      default:
+        assert_not_reached();
+        break;
+    }

newtFinished();
#endif
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to