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.
Этот коммит содержится в:
родитель
9d07027553
Коммит
aef88fb773
12
src/calc.c
12
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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))
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user