Moved and renamed sdelay in ncdu.h to calc_delay in calc.h
Because that's where it's supposed to be. (geez, the current code is still a mess)
Этот коммит содержится в:
родитель
05756ad567
Коммит
2a25bfdc7a
@ -61,6 +61,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
int calc_delay;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char err; /* 1/0, error or not */
|
char err; /* 1/0, error or not */
|
||||||
char cur[PATH_MAX]; /* current dir/item */
|
char cur[PATH_MAX]; /* current dir/item */
|
||||||
@ -336,7 +338,7 @@ void calc_draw_progress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* animation - but only if the screen refreshes more than or once every second */
|
/* animation - but only if the screen refreshes more than or once every second */
|
||||||
if(sdelay <= 1000) {
|
if(calc_delay <= 1000) {
|
||||||
if(++stcalc.anpos == 28)
|
if(++stcalc.anpos == 28)
|
||||||
stcalc.anpos = 0;
|
stcalc.anpos = 0;
|
||||||
strcpy(ani, " ");
|
strcpy(ani, " ");
|
||||||
@ -375,7 +377,7 @@ int calc_draw() {
|
|||||||
|
|
||||||
/* should we really draw the screen again? */
|
/* should we really draw the screen again? */
|
||||||
gettimeofday(&tv, (void *)NULL);
|
gettimeofday(&tv, (void *)NULL);
|
||||||
tv.tv_usec = (1000*(tv.tv_sec % 1000) + (tv.tv_usec / 1000)) / sdelay;
|
tv.tv_usec = (1000*(tv.tv_sec % 1000) + (tv.tv_usec / 1000)) / calc_delay;
|
||||||
if(stcalc.lastupdate != tv.tv_usec) {
|
if(stcalc.lastupdate != tv.tv_usec) {
|
||||||
calc_draw_progress();
|
calc_draw_progress();
|
||||||
stcalc.lastupdate = tv.tv_usec;
|
stcalc.lastupdate = tv.tv_usec;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#include "ncdu.h"
|
#include "ncdu.h"
|
||||||
|
|
||||||
|
extern int calc_delay; /* minimum screen update interval when calculating, in ms */
|
||||||
|
|
||||||
void calc_process(void);
|
void calc_process(void);
|
||||||
int calc_key(int);
|
int calc_key(int);
|
||||||
int calc_draw(void);
|
int calc_draw(void);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int sflags, sdelay;
|
int sflags;
|
||||||
int pstate;
|
int pstate;
|
||||||
|
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ void argv_parse(int argc, char **argv, char *dir) {
|
|||||||
memset(dir, 0, PATH_MAX);
|
memset(dir, 0, PATH_MAX);
|
||||||
getcwd(dir, PATH_MAX);
|
getcwd(dir, PATH_MAX);
|
||||||
sflags = 0;
|
sflags = 0;
|
||||||
sdelay = 100;
|
calc_delay = 100;
|
||||||
|
|
||||||
/* read from commandline */
|
/* read from commandline */
|
||||||
for(i=1; i<argc; i++) {
|
for(i=1; i<argc; i++) {
|
||||||
@ -105,7 +105,7 @@ void argv_parse(int argc, char **argv, char *dir) {
|
|||||||
for(j=1; j<len; j++)
|
for(j=1; j<len; j++)
|
||||||
switch(argv[i][j]) {
|
switch(argv[i][j]) {
|
||||||
case 'x': sflags |= SF_SMFS; break;
|
case 'x': sflags |= SF_SMFS; break;
|
||||||
case 'q': sdelay = 2000; break;
|
case 'q': calc_delay = 2000; break;
|
||||||
case '?':
|
case '?':
|
||||||
case 'h':
|
case 'h':
|
||||||
printf("ncdu [-hqvx] [--exclude PATTERN] [-X FILE] directory\n\n");
|
printf("ncdu [-hqvx] [--exclude PATTERN] [-X FILE] directory\n\n");
|
||||||
|
@ -83,7 +83,7 @@ struct dir {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* global settings */
|
/* global settings */
|
||||||
extern int sflags, sdelay;
|
extern int sflags;
|
||||||
|
|
||||||
/* program state */
|
/* program state */
|
||||||
extern int pstate;
|
extern int pstate;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user