From 42af2e52e771dd7bf8be6fd1119520d492bb4b3f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 22 Feb 2019 19:37:24 -0800 Subject: Bumper typo cleanup. Inspired by some of the small patches that have gone by recently. Limited to only things found in `generated/help.h`, plus a wider cleanup for the more common "milisecond" typo. --- lib/lib.c | 6 +++--- lib/lib.h | 6 +++--- lib/net.c | 2 +- lib/tty.c | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/lib.c b/lib/lib.c index 9d5c5f4b..76d5765c 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -542,12 +542,12 @@ char *readfile(char *name, char *ibuf, off_t len) } // Sleep for this many thousandths of a second -void msleep(long miliseconds) +void msleep(long milliseconds) { struct timespec ts; - ts.tv_sec = miliseconds/1000; - ts.tv_nsec = (miliseconds%1000)*1000000; + ts.tv_sec = milliseconds/1000; + ts.tv_nsec = (milliseconds%1000)*1000000; nanosleep(&ts, &ts); } diff --git a/lib/lib.h b/lib/lib.h index b36d7a75..bdabd4a2 100644 --- a/lib/lib.h +++ b/lib/lib.h @@ -204,7 +204,7 @@ int mkpath(char *dir); struct string_list **splitpath(char *path, struct string_list **list); char *readfileat(int dirfd, char *name, char *buf, off_t *len); char *readfile(char *name, char *buf, off_t len); -void msleep(long miliseconds); +void msleep(long milliseconds); void nanomove(struct timespec *ts, long long offset); long long nanodiff(struct timespec *old, struct timespec *new); int highest_bit(unsigned long l); @@ -292,10 +292,10 @@ int draw_trim(char *str, int padto, int width); int tty_fd(void); int terminal_size(unsigned *xx, unsigned *yy); int terminal_probesize(unsigned *xx, unsigned *yy); -int scan_key_getsize(char *scratch, int miliwait, unsigned *xx, unsigned *yy); +int scan_key_getsize(char *scratch, int timeout_ms, unsigned *xx, unsigned *yy); int set_terminal(int fd, int raw, int speed, struct termios *old); void xset_terminal(int fd, int raw, int speed, struct termios *old); -int scan_key(char *scratch, int miliwait); +int scan_key(char *scratch, int timeout_ms); void tty_esc(char *s); void tty_jump(int x, int y); void tty_reset(void); diff --git a/lib/net.c b/lib/net.c index 1837c07e..2bb720a4 100644 --- a/lib/net.c +++ b/lib/net.c @@ -84,7 +84,7 @@ int xpoll(struct pollfd *fds, int nfds, int timeout) } // Loop forwarding data from in1 to out1 and in2 to out2, handling -// half-connection shutdown. timeouts return if no data for X miliseconds. +// half-connection shutdown. timeouts return if no data for X ms. // Returns 0: both closed, 1 shutdown_timeout, 2 timeout int pollinate(int in1, int in2, int out1, int out2, int timeout, int shutdown_timeout) { diff --git a/lib/tty.c b/lib/tty.c index a1aa2b67..cb613adc 100644 --- a/lib/tty.c +++ b/lib/tty.c @@ -63,11 +63,11 @@ int terminal_probesize(unsigned *xx, unsigned *yy) // Wrapper that parses results from ANSI probe to update screensize. // Otherwise acts like scan_key() -int scan_key_getsize(char *scratch, int miliwait, unsigned *xx, unsigned *yy) +int scan_key_getsize(char *scratch, int timeout_ms, unsigned *xx, unsigned *yy) { int key; - if (512&(key = scan_key(scratch, miliwait))) { + if (512&(key = scan_key(scratch, timeout_ms))) { if (key>0) { if (xx) *xx = (key>>10)&1023; if (yy) *yy = (key>>20)&1023; @@ -157,13 +157,13 @@ struct scan_key_list { ); // Scan stdin for a keypress, parsing known escape sequences -// Blocks for miliwait miliseconds, none 0, forever if -1 +// Blocks for timeout_ms milliseconds, none 0, forever if -1 // Returns: 0-255=literal, -1=EOF, -2=TIMEOUT, 256-...=index into scan_key_list // >512 is x<<9+y<<21 // scratch space is necessary because last char of !seq could start new seq // Zero out first byte of scratch before first call to scan_key // block=0 allows fetching multiple characters before updating display -int scan_key(char *scratch, int miliwait) +int scan_key(char *scratch, int timeout_ms) { struct pollfd pfd; int maybe, i, j; @@ -210,9 +210,9 @@ int scan_key(char *scratch, int miliwait) // Need more data to decide - // 30 miliseconds is about the gap between characters at 300 baud - if (maybe || miliwait != -1) - if (!xpoll(&pfd, 1, maybe ? 30 : miliwait)) break; + // 30ms is about the gap between characters at 300 baud + if (maybe || timeout_ms != -1) + if (!xpoll(&pfd, 1, maybe ? 30 : timeout_ms)) break; // Read 1 byte so we don't overshoot sequence match. (We can deviate // and fail to match, but match consumes entire buffer.) -- cgit v1.2.3