summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/chat.c1
-rw-r--r--miscutils/conspy.c6
-rw-r--r--miscutils/crond.c3
-rw-r--r--miscutils/dc.c3
-rw-r--r--miscutils/fbsplash.c6
-rw-r--r--miscutils/hdparm.c3
-rw-r--r--miscutils/i2c_tools.c1
-rw-r--r--miscutils/inotifyd.c6
-rw-r--r--miscutils/less.c6
-rw-r--r--miscutils/microcom.c6
10 files changed, 28 insertions, 13 deletions
diff --git a/miscutils/chat.c b/miscutils/chat.c
index bd2abc2..25850dd 100644
--- a/miscutils/chat.c
+++ b/miscutils/chat.c
@@ -17,6 +17,7 @@
//usage: "chat '' ATZ OK ATD123456 CONNECT '' ogin: pppuser word: ppppass '~'"
#include "libbb.h"
+#include "common_bufsiz.h"
// default timeout: 45 sec
#define DEFAULT_CHAT_TIMEOUT 45*1000
diff --git a/miscutils/conspy.c b/miscutils/conspy.c
index 1a46a43..0d96a5f 100644
--- a/miscutils/conspy.c
+++ b/miscutils/conspy.c
@@ -42,6 +42,7 @@
//usage: "\n -y LINE Starting line"
#include "libbb.h"
+#include "common_bufsiz.h"
#include <sys/kd.h>
#define ESC "\033"
@@ -363,7 +364,8 @@ int conspy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int conspy_main(int argc UNUSED_PARAM, char **argv)
{
char tty_name[sizeof(DEV_TTY "NN")];
-#define keybuf bb_common_bufsiz1
+#define keybuf bb_common_bufsiz1
+#define sizeof_keybuf COMMON_BUFSIZE
struct termios termbuf;
unsigned opts;
unsigned ttynum;
@@ -513,7 +515,7 @@ int conspy_main(int argc UNUSED_PARAM, char **argv)
default:
// Read the keys pressed
k = keybuf + G.key_count;
- bytes_read = read(G.kbd_fd, k, sizeof(keybuf) - G.key_count);
+ bytes_read = read(G.kbd_fd, k, sizeof_keybuf - G.key_count);
if (bytes_read < 0)
goto abort;
diff --git a/miscutils/crond.c b/miscutils/crond.c
index eb327f8..8536d43 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -60,6 +60,7 @@
//usage: "\n -c DIR Cron dir. Default:"CONFIG_FEATURE_CROND_DIR"/crontabs"
#include "libbb.h"
+#include "common_bufsiz.h"
#include <syslog.h>
/* glibc frees previous setenv'ed value when we do next setenv()
@@ -140,7 +141,7 @@ struct globals {
char *env_var_logname;
#endif
} FIX_ALIASING;
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define INIT_G() do { \
G.log_level = 8; \
G.crontab_dir_name = CRONTABS; \
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 9c74172..3fbb89f 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -4,6 +4,7 @@
*/
#include "libbb.h"
+#include "common_bufsiz.h"
#include <math.h>
//usage:#define dc_trivial_usage
@@ -47,7 +48,7 @@ struct globals {
double stack[1];
} FIX_ALIASING;
enum { STACK_SIZE = (COMMON_BUFSIZE - offsetof(struct globals, stack)) / sizeof(double) };
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define pointer (G.pointer )
#define base (G.base )
#define stack (G.stack )
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index 9557c41..b26ad2c 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -34,6 +34,7 @@
//usage: "\n commands: 'NN' (% for progress bar) or 'exit'"
#include "libbb.h"
+#include "common_bufsiz.h"
#include <linux/fb.h>
/* If you want logging messages on /tmp/fbsplash.log... */
@@ -372,11 +373,12 @@ static void fb_drawimage(void)
* - A raster of Width * Height pixels in triplets of rgb
* in pure binary by 1 or 2 bytes. (we support only 1 byte)
*/
-#define concat_buf bb_common_bufsiz1
+#define concat_buf bb_common_bufsiz1
+#define sizeof_concat_buf COMMON_BUFSIZE
read_ptr = concat_buf;
while (1) {
int w, h, max_color_val;
- int rem = concat_buf + sizeof(concat_buf) - read_ptr;
+ int rem = concat_buf + sizeof_concat_buf - read_ptr;
if (rem < 2
|| fgets(read_ptr, rem, theme_file) == NULL
) {
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 8e201ac..9e141de 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -63,6 +63,7 @@
//usage: "\n -z Reread partition table"
#include "libbb.h"
+#include "common_bufsiz.h"
/* must be _after_ libbb.h: */
#include <linux/hdreg.h>
#include <sys/mount.h>
@@ -367,7 +368,7 @@ struct globals {
unsigned char flushcache[4] = { WIN_FLUSHCACHE, 0, 0, 0 };
#endif
} FIX_ALIASING;
-#define G (*(struct globals*)&bb_common_bufsiz1)
+#define G (*(struct globals*)bb_common_bufsiz1)
#define get_identity (G.get_identity )
#define get_geom (G.get_geom )
#define do_flush (G.do_flush )
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index aa1c7c5..57bb72a 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -60,6 +60,7 @@
*/
#include "libbb.h"
+#include "common_bufsiz.h"
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index 908d657..1d28e8f 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -56,6 +56,7 @@
//usage: "\nWhen x event happens for all FILEs, inotifyd exits."
#include "libbb.h"
+#include "common_bufsiz.h"
#include <sys/inotify.h>
static const char mask_names[] ALIGN1 =
@@ -162,8 +163,9 @@ int inotifyd_main(int argc, char **argv)
// read out all pending events
// (NB: len must be int, not ssize_t or long!)
xioctl(pfd.fd, FIONREAD, &len);
-#define eventbuf bb_common_bufsiz1
- ie = buf = (len <= sizeof(eventbuf)) ? eventbuf : xmalloc(len);
+#define eventbuf bb_common_bufsiz1
+#define sizeof_eventbuf COMMON_BUFSIZE
+ ie = buf = (len <= sizeof_eventbuf) ? eventbuf : xmalloc(len);
len = full_read(pfd.fd, buf, len);
// process events. N.B. events may vary in length
while (len > 0) {
diff --git a/miscutils/less.c b/miscutils/less.c
index ccdb15f..94ecf16 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -127,6 +127,7 @@
#include <sched.h> /* sched_yield() */
#include "libbb.h"
+#include "common_bufsiz.h"
#if ENABLE_FEATURE_LESS_REGEXP
#include "xregex.h"
#endif
@@ -439,7 +440,8 @@ static int at_end(void)
*/
static void read_lines(void)
{
-#define readbuf bb_common_bufsiz1
+#define readbuf bb_common_bufsiz1
+#define sizeof_readbuf COMMON_BUFSIZE
char *current_line, *p;
int w = width;
char last_terminated = terminated;
@@ -480,7 +482,7 @@ static void read_lines(void)
time_t t;
errno = 0;
- eof_error = safe_read(STDIN_FILENO, readbuf, sizeof(readbuf));
+ eof_error = safe_read(STDIN_FILENO, readbuf, sizeof_readbuf);
if (errno != EAGAIN)
break;
t = time(NULL);
diff --git a/miscutils/microcom.c b/miscutils/microcom.c
index 5e29a1a..5eb2e67 100644
--- a/miscutils/microcom.c
+++ b/miscutils/microcom.c
@@ -19,6 +19,7 @@
//usage: "\n -X Disable special meaning of NUL and Ctrl-X from stdin"
#include "libbb.h"
+#include "common_bufsiz.h"
// set raw tty mode
static void xget1(int fd, struct termios *t, struct termios *oldt)
@@ -155,10 +156,11 @@ int microcom_main(int argc UNUSED_PARAM, char **argv)
skip_write: ;
}
if (pfd[0].revents) {
-#define iobuf bb_common_bufsiz1
+#define iobuf bb_common_bufsiz1
+#define sizeof_iobuf COMMON_BUFSIZE
ssize_t len;
// read from device -> write to stdout
- len = safe_read(sfd, iobuf, sizeof(iobuf));
+ len = safe_read(sfd, iobuf, sizeof_iobuf);
if (len > 0)
full_write(STDOUT_FILENO, iobuf, len);
else {