summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-12 18:48:30 +0200
committerYorhel <git@yorhel.nl>2009-05-12 19:06:15 +0200
commitaef88fb773a5f8e70447c3fc6c00c59e17248015 (patch)
treebe62015025ae826c30426a0cf944d52b2d970676
parent9d07027553aeb5241a81196bcdbba2ee8f881035 (diff)
Removed the ST_QUIT state
There shouldn't be a need for such a state when there's a central place where the program execution keeps returning to.
-rw-r--r--src/calc.c12
-rw-r--r--src/calc.h2
-rw-r--r--src/global.h1
-rw-r--r--src/main.c6
4 files changed, 12 insertions, 9 deletions
diff --git a/src/calc.c b/src/calc.c
index 97f1c48..23f142a 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -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;
+ }
}
diff --git a/src/calc.h b/src/calc.h
index e2f11ad..b3d4cb6 100644
--- a/src/calc.h
+++ b/src/calc.h
@@ -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 */
diff --git a/src/main.c b/src/main.c
index cc735c8..d3f22d6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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))