diff options
-rw-r--r-- | src/calc.c | 12 | ||||
-rw-r--r-- | src/calc.h | 2 | ||||
-rw-r--r-- | src/global.h | 1 | ||||
-rw-r--r-- | src/main.c | 6 |
4 files changed, 12 insertions, 9 deletions
@@ -300,7 +300,7 @@ int calc_key(int ch) { } -void calc_process() { +int calc_process() { char *path, *name; struct stat fs; struct dir *t; @@ -414,7 +414,7 @@ void calc_process() { link_del(root); browse_init(root->sub); - return; + return 0; } /* something went wrong... */ @@ -422,8 +422,12 @@ void calc_process() { calc_fail: while(failed && !input_handle(0)) ; - pstate = orig ? ST_BROWSE : ST_QUIT; - return; + if(orig == NULL) + return 1; + else { + browse_init(NULL); + return 0; + } } @@ -30,7 +30,7 @@ extern char calc_smfs; /* stay on the same filesystem */ -void calc_process(void); +int calc_process(void); int calc_key(int); void calc_draw(void); void calc_init(char *, struct dir *); diff --git a/src/global.h b/src/global.h index 43bbb3f..3d5295f 100644 --- a/src/global.h +++ b/src/global.h @@ -47,7 +47,6 @@ #define ST_BROWSE 1 #define ST_DEL 2 #define ST_HELP 3 -#define ST_QUIT 4 /* structure representing a file or directory */ @@ -159,9 +159,9 @@ int main(int argc, char **argv) { if(ncresize(min_rows, min_cols)) min_rows = min_cols = 0; - while(pstate != ST_QUIT) { - if(pstate == ST_CALC) - calc_process(); + while(1) { + if(pstate == ST_CALC && calc_process()) + break; else if(pstate == ST_DEL) delete_process(); else if(input_handle(0)) |