if (n2 != n) {
if (n2 >= 0)
errno = 0; /* prevent bogus error message */
- bb_perror_msg(n2 >= 0 ? "short write" : "write error");
+ bb_perror_msg(n2 >= 0 ? "short write" : bb_msg_write_error);
return -1;
}
}
while (1) {
count = full_read(STDIN_FILENO, rbuf, IOBUF_SIZE);
if (count < 0) {
- bb_perror_msg("read error");
+ bb_perror_msg(bb_msg_read_error);
total = -1;
break;
}
if (rd) {
rd = safe_read(src_fd, membuf + insz, rd);
if (rd < 0) {
- bb_error_msg("read error");
+ bb_error_msg(bb_msg_read_error);
total = -1;
break;
}
bytebuffer_offset = 0;
bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count);
if ((int)bytebuffer_size < 0) {
- bb_error_msg("read error");
+ bb_error_msg(bb_msg_read_error);
return 0;
}
bytebuffer_size += count;
{ "", 0 }
};
-static const char header_fmt_str[] ALIGN1 = "\n==> %s <==\n";
+#define header_fmt_str "\n==> %s <==\n"
int head_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int head_main(int argc, char **argv)
}
if (ferror(stdout)) {
- bb_error_msg("write error");
+ bb_error_msg(bb_msg_write_error);
ioerror = 1;
}
}
return r;
}
-static const char header_fmt[] ALIGN1 = "\n==> %s <==\n";
+#define header_fmt_str "\n==> %s <==\n"
static unsigned eat_num(const char *p)
{
tailbuf = xmalloc(tailbufsize);
/* tail the files */
- fmt = header_fmt + 1; /* skip header leading newline on first output */
+ fmt = header_fmt_str + 1; /* skip header leading newline on first output */
i = 0;
do {
char *buf;
if (nfiles > header_threshhold) {
tail_xprint_header(fmt, argv[i]);
- fmt = header_fmt;
+ fmt = header_fmt_str;
}
if (!from_top) {
if (ENABLE_FEATURE_FANCY_TAIL && fd < 0)
continue;
if (nfiles > header_threshhold) {
- fmt = header_fmt;
+ fmt = header_fmt_str;
}
while ((nread = tail_read(fd, tailbuf, BUFSIZ)) > 0) {
if (fmt) {
* immediately */
eof_error = 1;
} else {
- print_statusline("read error");
+ print_statusline(bb_msg_read_error);
}
}
#if !ENABLE_FEATURE_LESS_REGEXP
/* Check if loading this module will taint the kernel. */
static void check_tainted_module(struct obj_file *f, const char *m_name)
{
- static const char tainted_file[] ALIGN1 = TAINT_FILENAME;
-
int fd, kernel_has_tainted;
const char *ptr;
kernel_has_tainted = 1;
- fd = open(tainted_file, O_RDWR);
+ fd = open(TAINT_FILENAME, O_RDWR);
if (fd < 0) {
if (errno == ENOENT)
kernel_has_tainted = 0;
else if (errno == EACCES)
kernel_has_tainted = 1;
else {
- perror(tainted_file);
+ perror(TAINT_FILENAME);
kernel_has_tainted = 0;
}
}
/* ============ Misc data */
-static const char homestr[] ALIGN1 = "HOME";
-static const char snlfmt[] ALIGN1 = "%s\n";
-static const char msg_illnum[] ALIGN1 = "Illegal number: %s";
+#define msg_illnum "Illegal number: %s"
/*
* We enclose jmp_buf in a structure so that we can declare pointers to
flags = cdopt();
dest = *argptr;
if (!dest)
- dest = bltinlookup(homestr);
+ dest = bltinlookup("HOME");
else if (LONE_DASH(dest)) {
dest = bltinlookup("OLDPWD");
flags |= CD_PRINT;
/* NOTREACHED */
out:
if (flags & CD_PRINT)
- out1fmt(snlfmt, curdir);
+ out1fmt("%s\n", curdir);
return 0;
}
setpwd(dir, 0);
dir = physdir;
}
- out1fmt(snlfmt, dir);
+ out1fmt("%s\n", dir);
return 0;
}
done:
*p = '\0';
if (*name == '\0') {
- home = lookupvar(homestr);
+ home = lookupvar("HOME");
} else {
pw = getpwnam(name);
if (pw == NULL)
}
if (!mail_var_path_changed && statb.st_mtime != *mtp) {
fprintf(
- stderr, snlfmt,
+ stderr, "%s\n",
pathopt ? pathopt : "you have mail"
);
}
unsigned char size4[4]; /* nr of sectors in partition */
} PACKED;
-static const char unable_to_open[] ALIGN1 = "can't open '%s'";
-static const char unable_to_read[] ALIGN1 = "can't read from %s";
-static const char unable_to_seek[] ALIGN1 = "can't seek on %s";
+#define unable_to_open "can't open '%s'"
+#define unable_to_read "can't read from %s"
+#define unable_to_seek "can't seek on %s"
enum label_type {
LABEL_DOS, LABEL_SUN, LABEL_SGI, LABEL_AIX, LABEL_OSF