Skip to content
Snippets Groups Projects
Commit aef88fb7 authored by Yorhel's avatar Yorhel
Browse files

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.
parent 9d070275
No related branches found
No related tags found
No related merge requests found
......@@ -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 *);
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment