summaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-05-17 16:37:22 +0000
committerDenis Vlasenko2007-05-17 16:37:22 +0000
commitcd5c7866e328b502d946485ad1886ce26cffabfa (patch)
treeb0d636908765bba8b8d9bd26d0dd289299d17311 /editors/vi.c
parentc8be5ee325a374525f503d11eccb5da3ee35a509 (diff)
downloadbusybox-cd5c7866e328b502d946485ad1886ce26cffabfa.zip
busybox-cd5c7866e328b502d946485ad1886ce26cffabfa.tar.gz
vi: remove two globals
awk: some 'lineno' vars were shorts, made them ints (code got smaller) awk: rename global t to global ttt. still an awful name, but at least you can grep for it now. function old new delta ttt - 28 +28 mysleep 104 120 +16 readit 408 418 +10 lineno 2 4 +2 parse_program 338 339 +1 evaluate 6446 6445 -1 syntax_error 25 23 -2 next_token 917 915 -2 new_node 26 24 -2 tv 16 8 -8 skip_spaces 68 53 -15 t 28 - -28 rfds 128 - -128 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 4/6 up/down: 57/-186) Total: -129 bytes
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/editors/vi.c b/editors/vi.c
index a103776..66b01e2 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -111,8 +111,6 @@ static int last_file_modified = -1;
static int fn_start; // index of first cmd line file name
static int save_argc; // how many file names on cmd line
static int cmdcnt; // repetition count
-static fd_set rfds; // use select() for small sleeps
-static struct timeval tv; // use select() for small sleeps
static int rows, columns; // the terminal screen is this size
static int crow, ccol, offset; // cursor is on Crow x Ccol with Horz Ofset
static char *status_buffer; // mesages to the user
@@ -279,7 +277,7 @@ int vi_main(int argc, char **argv)
#if ENABLE_FEATURE_VI_YANKMARK
int i;
#endif
-#if defined(CONFIG_FEATURE_VI_USE_SIGNALS) || defined(CONFIG_FEATURE_VI_CRASHME)
+#if ENABLE_FEATURE_VI_USE_SIGNALS || ENABLE_FEATURE_VI_CRASHME
my_pid = getpid();
#endif
#if ENABLE_FEATURE_VI_CRASHME
@@ -2142,6 +2140,9 @@ static void catch_sig(int sig)
static int mysleep(int hund) // sleep for 'h' 1/100 seconds
{
+ fd_set rfds;
+ struct timeval tv;
+
// Don't hang- Wait 5/100 seconds- 1 Sec= 1000000
fflush(stdout);
FD_ZERO(&rfds);
@@ -2228,6 +2229,9 @@ static char readit(void) // read (maybe cursor) key from stdin
if (n <= 0)
return 0; // error
if (readbuffer[0] == 27) {
+ fd_set rfds;
+ struct timeval tv;
+
// This is an ESC char. Is this Esc sequence?
// Could be bare Esc key. See if there are any
// more chars to read after the ESC. This would