All pastes #320616 Raw Edit

Unnamed

public text v1 · immutable
#320616 ·published 2007-01-18 17:42 UTC
rendered paste body
Index: apps/plugins/disktidy.c
===================================================================
--- apps/plugins/disktidy.c	(revision 12061)
+++ apps/plugins/disktidy.c	(working copy)
@@ -340,7 +340,8 @@
 
 int tidy_lcd_menu(void)
 {
-    int loc, ret;
+    int loc, ret = 2;
+    bool menu_quit = false;
     
     static const struct menu_item items[] = 
     {
@@ -359,27 +360,32 @@
     loc = rb->menu_init(items, sizeof(items) / sizeof(*items),
                       NULL, NULL, NULL, NULL);
                       
-    while (true)
+    while (!menu_quit)
     {    
         switch(rb->menu_show(loc))
         {
          
             case 0:
-                return ret;
+                menu_quit = true;   /* start cleaning */
+                break;
                 
             case 1:
                 rb->set_option("Files to Clean", &ret, INT, system_option, 3, NULL);
-            break;
+                break;
         
             case 2:
-                return 99;
+                ret = 99;
+                menu_quit = true;
+                break;
                 
             default:
-                return 99;
+                ret = 99;    /* exit plugin */
+                menu_quit = true;
+                break;
         }
     }
-
     rb->menu_exit(loc);
+    return ret;
 }
 
 /* this is the plugin entry point */


===================================================

    loc = rb->menu_init(items, sizeof(items) / sizeof(*items),
                      NULL, NULL, NULL, NULL);
                      
    while (!menu_quit)
    {    
        switch(rb->menu_show(loc))
        {
         
            case 0:
                menu_quit = true;   /* start cleaning */
                break;
                
            case 1:
                rb->set_option("Files to Clean", &ret, INT, system_option, 3, NULL);
                break;
        
            case 2:
                ret = 99;
                menu_quit = true;
                break;
                
            default:
                ret = 99;    /* exit plugin */
                menu_quit = true;
                break;
        }
    }
    rb->menu_exit(loc);
    return ret;