mirror of
https://github.com/sheumann/hush.git
synced 2024-06-26 17:29:42 +00:00
introduce bb_putchar(). saves ~1800 on uclibc (less on glibc).
This commit is contained in:
parent
1acdc89e99
commit
4daad9004d
|
@ -686,7 +686,7 @@ static void check_match(IPos start, IPos match, int length)
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
bb_error_msg("\\[%d,%d]", start - match, length);
|
bb_error_msg("\\[%d,%d]", start - match, length);
|
||||||
do {
|
do {
|
||||||
putc(G1.window[start++], stderr);
|
fputc(G1.window[start++], stderr);
|
||||||
} while (--length != 0);
|
} while (--length != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,5 @@ void header_verbose_list(const file_header_t *file_header)
|
||||||
if (file_header->link_target) {
|
if (file_header->link_target) {
|
||||||
printf(" -> %s", file_header->link_target);
|
printf(" -> %s", file_header->link_target);
|
||||||
}
|
}
|
||||||
/* putchar isnt used anywhere else i dont think */
|
bb_putchar('\n');
|
||||||
puts("");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ int cal_main(int argc, char **argv)
|
||||||
if (!julian) {
|
if (!julian) {
|
||||||
printf("%*s%s", HEAD_SEP, "", day_headings);
|
printf("%*s%s", HEAD_SEP, "", day_headings);
|
||||||
}
|
}
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
for (row = 0; row < (6*7); row += 7) {
|
for (row = 0; row < (6*7); row += 7) {
|
||||||
for (which_cal = 0; which_cal < 3-julian; which_cal++) {
|
for (which_cal = 0; which_cal < 3-julian; which_cal++) {
|
||||||
dp = days[month + which_cal] + row;
|
dp = days[month + which_cal] + row;
|
||||||
|
|
|
@ -62,13 +62,13 @@ int catv_main(int argc, char **argv)
|
||||||
if (c < 32) {
|
if (c < 32) {
|
||||||
if (c == 10) {
|
if (c == 10) {
|
||||||
if (flags & CATV_OPT_e)
|
if (flags & CATV_OPT_e)
|
||||||
putchar('$');
|
bb_putchar('$');
|
||||||
} else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) {
|
} else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) {
|
||||||
printf("^%c", c+'@');
|
printf("^%c", c+'@');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_CLEAN_UP && fd)
|
if (ENABLE_FEATURE_CLEAN_UP && fd)
|
||||||
|
|
|
@ -100,18 +100,18 @@ int bb_echo(char **argv)
|
||||||
c = bb_process_escape_sequence(&arg);
|
c = bb_process_escape_sequence(&arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = *++argv;
|
arg = *++argv;
|
||||||
if (!arg)
|
if (!arg)
|
||||||
break;
|
break;
|
||||||
putchar(' ');
|
bb_putchar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
newline_ret:
|
newline_ret:
|
||||||
if (nflag) {
|
if (nflag) {
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
ret:
|
ret:
|
||||||
return fflush(stdout);
|
return fflush(stdout);
|
||||||
|
|
|
@ -115,7 +115,7 @@ int fold_main(int argc, char **argv)
|
||||||
/* Found a blank. Don't output the part after it. */
|
/* Found a blank. Don't output the part after it. */
|
||||||
logical_end++;
|
logical_end++;
|
||||||
fwrite(line_out, sizeof(char), (size_t) logical_end, stdout);
|
fwrite(line_out, sizeof(char), (size_t) logical_end, stdout);
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
/* Move the remainder to the beginning of the next line.
|
/* Move the remainder to the beginning of the next line.
|
||||||
The areas being copied here might overlap. */
|
The areas being copied here might overlap. */
|
||||||
memmove(line_out, line_out + logical_end, offset_out - logical_end);
|
memmove(line_out, line_out + logical_end, offset_out - logical_end);
|
||||||
|
|
|
@ -102,7 +102,7 @@ int id_main(int argc, char **argv)
|
||||||
/* Print full info like GNU id */
|
/* Print full info like GNU id */
|
||||||
/* bb_getpwuid(0) doesn't exit on failure (returns NULL) */
|
/* bb_getpwuid(0) doesn't exit on failure (returns NULL) */
|
||||||
status = printf_full(uid, bb_getpwuid(NULL, 0, uid), 'u');
|
status = printf_full(uid, bb_getpwuid(NULL, 0, uid), 'u');
|
||||||
putchar(' ');
|
bb_putchar(' ');
|
||||||
status |= printf_full(gid, bb_getgrgid(NULL, 0, gid), 'g');
|
status |= printf_full(gid, bb_getgrgid(NULL, 0, gid), 'g');
|
||||||
|
|
||||||
#if ENABLE_SELINUX
|
#if ENABLE_SELINUX
|
||||||
|
@ -121,6 +121,6 @@ int id_main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
fflush_stdout_and_exit(status);
|
fflush_stdout_and_exit(status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,7 +451,7 @@ static void showdirs(struct dnode **dn, int ndirs, int first)
|
||||||
for (i = 0; i < ndirs; i++) {
|
for (i = 0; i < ndirs; i++) {
|
||||||
if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) {
|
if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) {
|
||||||
if (!first)
|
if (!first)
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
first = 0;
|
first = 0;
|
||||||
printf("%s:\n", dn[i]->fullname);
|
printf("%s:\n", dn[i]->fullname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1183,7 +1183,7 @@ dump_strings(void)
|
||||||
case '\r': fputs("\\r", stdout); break;
|
case '\r': fputs("\\r", stdout); break;
|
||||||
case '\t': fputs("\\t", stdout); break;
|
case '\t': fputs("\\t", stdout); break;
|
||||||
case '\v': fputs("\\v", stdout); break;
|
case '\v': fputs("\\v", stdout); break;
|
||||||
default: putc(c, stdout);
|
default: bb_putchar(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|
|
@ -99,9 +99,9 @@ static void print_esc_string(char *str)
|
||||||
for (; *str; str++) {
|
for (; *str; str++) {
|
||||||
if (*str == '\\') {
|
if (*str == '\\') {
|
||||||
str++;
|
str++;
|
||||||
putchar(bb_process_escape_sequence((const char **)&str));
|
bb_putchar(bb_process_escape_sequence((const char **)&str));
|
||||||
} else {
|
} else {
|
||||||
putchar(*str);
|
bb_putchar(*str);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ static int print_formatted(char *format, int argc, char **argv)
|
||||||
direc_length = 1;
|
direc_length = 1;
|
||||||
field_width = precision = -1;
|
field_width = precision = -1;
|
||||||
if (*f == '%') {
|
if (*f == '%') {
|
||||||
putchar('%');
|
bb_putchar('%');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (*f == 'b') {
|
if (*f == 'b') {
|
||||||
|
@ -274,11 +274,11 @@ static int print_formatted(char *format, int argc, char **argv)
|
||||||
case '\\':
|
case '\\':
|
||||||
if (*++f == 'c')
|
if (*++f == 'c')
|
||||||
exit(0);
|
exit(0);
|
||||||
putchar(bb_process_escape_sequence((const char **)&f));
|
bb_putchar(bb_process_escape_sequence((const char **)&f));
|
||||||
f--;
|
f--;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
putchar(*f);
|
bb_putchar(*f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ static void print_it(char const *masterformat, char const *filename,
|
||||||
b = NULL;
|
b = NULL;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case '%':
|
case '%':
|
||||||
putchar('%');
|
bb_putchar('%');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
print_func(dest, n_alloc, *p, filename, data USE_SELINUX(,scontext));
|
print_func(dest, n_alloc, *p, filename, data USE_SELINUX(,scontext));
|
||||||
|
@ -552,7 +552,7 @@ static bool do_stat(char const *filename, char const *format)
|
||||||
if (option_mask32 & OPT_SELINUX)
|
if (option_mask32 & OPT_SELINUX)
|
||||||
printf(" %lc\n", *scontext);
|
printf(" %lc\n", *scontext);
|
||||||
else
|
else
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
char *linkname = NULL;
|
char *linkname = NULL;
|
||||||
|
@ -586,7 +586,7 @@ static bool do_stat(char const *filename, char const *format)
|
||||||
(unsigned long) major(statbuf.st_rdev),
|
(unsigned long) major(statbuf.st_rdev),
|
||||||
(unsigned long) minor(statbuf.st_rdev));
|
(unsigned long) minor(statbuf.st_rdev));
|
||||||
else
|
else
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n",
|
printf("Access: (%04lo/%10.10s) Uid: (%5lu/%8s) Gid: (%5lu/%8s)\n",
|
||||||
(unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
|
(unsigned long) (statbuf.st_mode & (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)),
|
||||||
bb_mode_string(statbuf.st_mode),
|
bb_mode_string(statbuf.st_mode),
|
||||||
|
|
|
@ -475,10 +475,10 @@ static void wrapf(const char *message, ...)
|
||||||
G.current_col++;
|
G.current_col++;
|
||||||
if (buf[0] != '\n') {
|
if (buf[0] != '\n') {
|
||||||
if (G.current_col + buflen >= max_col) {
|
if (G.current_col + buflen >= max_col) {
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
G.current_col = 0;
|
G.current_col = 0;
|
||||||
} else
|
} else
|
||||||
putchar(' ');
|
bb_putchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputs(buf, stdout);
|
fputs(buf, stdout);
|
||||||
|
@ -618,7 +618,7 @@ static void display_recoverable(const struct termios *mode,
|
||||||
(unsigned long) mode->c_cflag, (unsigned long) mode->c_lflag);
|
(unsigned long) mode->c_cflag, (unsigned long) mode->c_lflag);
|
||||||
for (i = 0; i < NCCS; ++i)
|
for (i = 0; i < NCCS; ++i)
|
||||||
printf(":%x", (unsigned int) mode->c_cc[i]);
|
printf(":%x", (unsigned int) mode->c_cc[i]);
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_speed(const struct termios *mode, int fancy)
|
static void display_speed(const struct termios *mode, int fancy)
|
||||||
|
|
|
@ -22,6 +22,7 @@ int tee_main(int argc, char **argv)
|
||||||
char **names;
|
char **names;
|
||||||
char **np;
|
char **np;
|
||||||
char retval;
|
char retval;
|
||||||
|
//TODO: make unconditional
|
||||||
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
|
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
|
||||||
ssize_t c;
|
ssize_t c;
|
||||||
# define buf bb_common_bufsiz1
|
# define buf bb_common_bufsiz1
|
||||||
|
@ -62,7 +63,7 @@ int tee_main(int argc, char **argv)
|
||||||
/* names[0] will be filled later */
|
/* names[0] will be filled later */
|
||||||
|
|
||||||
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
|
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
|
||||||
while ((c = safe_read(STDIN_FILENO, buf, BUFSIZ)) > 0) {
|
while ((c = safe_read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
|
||||||
fp = files;
|
fp = files;
|
||||||
do
|
do
|
||||||
fwrite(buf, 1, c, *fp++);
|
fwrite(buf, 1, c, *fp++);
|
||||||
|
|
|
@ -91,12 +91,12 @@ int uname_main(int argc, char **argv)
|
||||||
if (toprint & 1) {
|
if (toprint & 1) {
|
||||||
printf(((char *)(&uname_info)) + *delta);
|
printf(((char *)(&uname_info)) + *delta);
|
||||||
if (toprint > 1) {
|
if (toprint > 1) {
|
||||||
putchar(' ');
|
bb_putchar(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++delta;
|
++delta;
|
||||||
} while (toprint >>= 1);
|
} while (toprint >>= 1);
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
|
|
||||||
fflush_stdout_and_exit(EXIT_SUCCESS);
|
fflush_stdout_and_exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,9 @@ int uuencode_main(int argc, char **argv)
|
||||||
bb_perror_msg_and_die(bb_msg_read_error);
|
bb_perror_msg_and_die(bb_msg_read_error);
|
||||||
/* Encode the buffer we just read in */
|
/* Encode the buffer we just read in */
|
||||||
bb_uuencode(dst_buf, src_buf, size, tbl);
|
bb_uuencode(dst_buf, src_buf, size, tbl);
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
if (tbl == bb_uuenc_tbl_std) {
|
if (tbl == bb_uuenc_tbl_std) {
|
||||||
putchar(tbl[size]);
|
bb_putchar(tbl[size]);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));
|
xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));
|
||||||
|
|
|
@ -651,7 +651,7 @@ static void execute(const char *type, const char *device, const char *mntpt,
|
||||||
mntpt ? mntpt : device);
|
mntpt ? mntpt : device);
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
printf(" %s", argv[i]);
|
printf(" %s", argv[i]);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fork and execute the correct program. */
|
/* Fork and execute the correct program. */
|
||||||
|
|
|
@ -46,7 +46,7 @@ static void list_attributes(const char *name)
|
||||||
if (option_mask32 & OPT_PF_LONG) {
|
if (option_mask32 & OPT_PF_LONG) {
|
||||||
printf("%-28s ", name);
|
printf("%-28s ", name);
|
||||||
print_flags(stdout, fsflags, PFOPT_LONG);
|
print_flags(stdout, fsflags, PFOPT_LONG);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
print_flags(stdout, fsflags, 0);
|
print_flags(stdout, fsflags, 0);
|
||||||
printf(" %s\n", name);
|
printf(" %s\n", name);
|
||||||
|
@ -74,7 +74,7 @@ static int lsattr_dir_proc(const char *dir_name, struct dirent *de,
|
||||||
) {
|
) {
|
||||||
printf("\n%s:\n", path);
|
printf("\n%s:\n", path);
|
||||||
iterate_on_dir(path, lsattr_dir_proc, NULL);
|
iterate_on_dir(path, lsattr_dir_proc, NULL);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ void blkid_debug_dump_dev(blkid_dev dev)
|
||||||
else
|
else
|
||||||
printf(" tag: NULL\n");
|
printf(" tag: NULL\n");
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ static void debug_dump_dev(blkid_dev dev)
|
||||||
else
|
else
|
||||||
printf(" tag: NULL\n");
|
printf(" tag: NULL\n");
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char**argv)
|
int main(int argc, char**argv)
|
||||||
|
|
|
@ -2443,10 +2443,10 @@ static void safe_print(const char *cp, int len)
|
||||||
ch -= 128;
|
ch -= 128;
|
||||||
}
|
}
|
||||||
if ((ch < 32) || (ch == 0x7f)) {
|
if ((ch < 32) || (ch == 0x7f)) {
|
||||||
fputc('^', stdout);
|
bb_putchar('^');
|
||||||
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
|
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
|
||||||
}
|
}
|
||||||
fputc(ch, stdout);
|
bb_putchar(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2497,7 +2497,7 @@ static void expand_at_expression(e2fsck_t ctx, char ch,
|
||||||
str = _(*cpp) + 1;
|
str = _(*cpp) + 1;
|
||||||
if (*first && islower(*str)) {
|
if (*first && islower(*str)) {
|
||||||
*first = 0;
|
*first = 0;
|
||||||
fputc(toupper(*str++), stdout);
|
bb_putchar(toupper(*str++));
|
||||||
}
|
}
|
||||||
print_e2fsck_message(ctx, str, pctx, *first);
|
print_e2fsck_message(ctx, str, pctx, *first);
|
||||||
} else
|
} else
|
||||||
|
@ -2630,7 +2630,7 @@ static void expand_percent_expression(ext2_filsys fs, char ch,
|
||||||
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '%':
|
case '%':
|
||||||
fputc('%', stdout);
|
bb_putchar('%');
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
printf("%u", ctx->blk);
|
printf("%u", ctx->blk);
|
||||||
|
@ -12767,7 +12767,7 @@ static void check_if_skip(e2fsck_t ctx)
|
||||||
else
|
else
|
||||||
printf(_(" (check in %ld mounts)"), next_check);
|
printf(_(" (check in %ld mounts)"), next_check);
|
||||||
}
|
}
|
||||||
fputc('\n', stdout);
|
bb_putchar('\n');
|
||||||
ext2fs_close(fs);
|
ext2fs_close(fs);
|
||||||
ctx->fs = NULL;
|
ctx->fs = NULL;
|
||||||
e2fsck_free_context(ctx);
|
e2fsck_free_context(ctx);
|
||||||
|
@ -12864,9 +12864,9 @@ int e2fsck_simple_progress(e2fsck_t ctx, const char *label, float percent,
|
||||||
bar + (sizeof(bar) - (i+1)),
|
bar + (sizeof(bar) - (i+1)),
|
||||||
spaces + (sizeof(spaces) - (dpywidth - i + 1)));
|
spaces + (sizeof(spaces) - (dpywidth - i + 1)));
|
||||||
if (fixed_percent == 1000)
|
if (fixed_percent == 1000)
|
||||||
fputc('|', stdout);
|
bb_putchar('|');
|
||||||
else
|
else
|
||||||
fputc(spinner[ctx->progress_pos & 3], stdout);
|
bb_putchar(spinner[ctx->progress_pos & 3]);
|
||||||
printf(" %4.1f%% ", percent);
|
printf(" %4.1f%% ", percent);
|
||||||
if (dpynum)
|
if (dpynum)
|
||||||
printf("%u\r", dpynum);
|
printf("%u\r", dpynum);
|
||||||
|
|
|
@ -613,7 +613,7 @@ static int execute(const char *type, const char *device, const char *mntpt,
|
||||||
mntpt ? mntpt : device);
|
mntpt ? mntpt : device);
|
||||||
for (i=0; i < argc; i++)
|
for (i=0; i < argc; i++)
|
||||||
printf("%s ", argv[i]);
|
printf("%s ", argv[i]);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fork and execute the correct program. */
|
/* Fork and execute the correct program. */
|
||||||
|
|
|
@ -57,7 +57,7 @@ static void list_attributes(const char *name)
|
||||||
if (flags & OPT_PF_LONG) {
|
if (flags & OPT_PF_LONG) {
|
||||||
printf("%-28s ", name);
|
printf("%-28s ", name);
|
||||||
print_flags(stdout, fsflags, PFOPT_LONG);
|
print_flags(stdout, fsflags, PFOPT_LONG);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
print_flags(stdout, fsflags, 0);
|
print_flags(stdout, fsflags, 0);
|
||||||
printf(" %s\n", name);
|
printf(" %s\n", name);
|
||||||
|
@ -102,7 +102,7 @@ static int lsattr_dir_proc(const char *dir_name, struct dirent *de,
|
||||||
(de->d_name[1] != '.' && de->d_name[2] != '\0')))) {
|
(de->d_name[1] != '.' && de->d_name[2] != '\0')))) {
|
||||||
printf("\n%s:\n", path);
|
printf("\n%s:\n", path);
|
||||||
iterate_on_dir(path, lsattr_dir_proc, NULL);
|
iterate_on_dir(path, lsattr_dir_proc, NULL);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,7 +641,7 @@ static void show_stats(ext2_filsys fs)
|
||||||
s->s_blocks_per_group, s->s_frags_per_group,
|
s->s_blocks_per_group, s->s_frags_per_group,
|
||||||
s->s_inodes_per_group);
|
s->s_inodes_per_group);
|
||||||
if (fs->group_desc_count == 1) {
|
if (fs->group_desc_count == 1) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ main(int argc, char **argv)
|
||||||
printf(" (random)\n");
|
printf(" (random)\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
if (type != 1) {
|
if (type != 1) {
|
||||||
printf("Warning: not a time-based UUID, so UUID time "
|
printf("Warning: not a time-based UUID, so UUID time "
|
||||||
|
|
|
@ -853,14 +853,14 @@ static int printLines(int num1, int num2, int expandFlag)
|
||||||
ch &= 0x7f;
|
ch &= 0x7f;
|
||||||
}
|
}
|
||||||
if (ch < ' ') {
|
if (ch < ' ') {
|
||||||
fputc('^', stdout);
|
bb_putchar('^');
|
||||||
ch += '@';
|
ch += '@';
|
||||||
}
|
}
|
||||||
if (ch == 0x7f) {
|
if (ch == 0x7f) {
|
||||||
fputc('^', stdout);
|
bb_putchar('^');
|
||||||
ch = '?';
|
ch = '?';
|
||||||
}
|
}
|
||||||
fputc(ch, stdout);
|
bb_putchar(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
fputs("$\n", stdout);
|
fputs("$\n", stdout);
|
||||||
|
|
|
@ -868,13 +868,13 @@ static void colon(char * buf)
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
write1("$\r");
|
write1("$\r");
|
||||||
} else if (c < ' ' || c == 127) {
|
} else if (c < ' ' || c == 127) {
|
||||||
putchar('^');
|
bb_putchar('^');
|
||||||
if (c == 127)
|
if (c == 127)
|
||||||
c = '?';
|
c = '?';
|
||||||
else
|
else
|
||||||
c += '@';
|
c += '@';
|
||||||
}
|
}
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
if (c_is_no_print)
|
if (c_is_no_print)
|
||||||
standout_end();
|
standout_end();
|
||||||
}
|
}
|
||||||
|
@ -2337,7 +2337,7 @@ static char *get_input_line(const char * prompt) // get input line- use "status
|
||||||
} else {
|
} else {
|
||||||
buf[i] = c; // save char in buffer
|
buf[i] = c; // save char in buffer
|
||||||
buf[i + 1] = '\0'; // make sure buffer is null terminated
|
buf[i + 1] = '\0'; // make sure buffer is null terminated
|
||||||
putchar(c); // echo the char back to user
|
bb_putchar(c); // echo the char back to user
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2860,7 +2860,7 @@ static void refresh(int full_screen)
|
||||||
char *out = sp + cs;
|
char *out = sp + cs;
|
||||||
|
|
||||||
while (nic-- > 0) {
|
while (nic-- > 0) {
|
||||||
putchar(*out);
|
bb_putchar(*out);
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,11 +391,13 @@ ssize_t recv_from_to(int fd, void *buf, size_t len, int flags,
|
||||||
struct sockaddr *from, struct sockaddr *to,
|
struct sockaddr *from, struct sockaddr *to,
|
||||||
socklen_t sa_size);
|
socklen_t sa_size);
|
||||||
|
|
||||||
|
char *xstrdup(const char *s);
|
||||||
extern char *xstrdup(const char *s);
|
char *xstrndup(const char *s, int n);
|
||||||
extern char *xstrndup(const char *s, int n);
|
char *safe_strncpy(char *dst, const char *src, size_t size);
|
||||||
extern char *safe_strncpy(char *dst, const char *src, size_t size);
|
/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc.
|
||||||
extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
/* But potentially slow, don't use in one-billion-times loops */
|
||||||
|
int bb_putchar(int ch);
|
||||||
|
char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
// gcc-4.1.1 still isn't good enough at optimizing it
|
// gcc-4.1.1 still isn't good enough at optimizing it
|
||||||
// (+200 bytes compared to macro)
|
// (+200 bytes compared to macro)
|
||||||
//static ALWAYS_INLINE
|
//static ALWAYS_INLINE
|
||||||
|
|
|
@ -69,7 +69,7 @@ char *bb_askpass(int timeout, const char * prompt)
|
||||||
}
|
}
|
||||||
|
|
||||||
tcsetattr(STDIN_FILENO, TCSANOW, &old);
|
tcsetattr(STDIN_FILENO, TCSANOW, &old);
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,15 +111,15 @@ static void cmdedit_set_out_char(int next_char)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (initial_settings.c_lflag & ECHO)
|
if (initial_settings.c_lflag & ECHO)
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
}
|
}
|
||||||
if (++cmdedit_x >= cmdedit_termw) {
|
if (++cmdedit_x >= cmdedit_termw) {
|
||||||
/* terminal is scrolled down */
|
/* terminal is scrolled down */
|
||||||
cmdedit_y++;
|
cmdedit_y++;
|
||||||
cmdedit_x = 0;
|
cmdedit_x = 0;
|
||||||
/* destroy "(auto)margin" */
|
/* destroy "(auto)margin" */
|
||||||
putchar(next_char);
|
bb_putchar(next_char);
|
||||||
putchar('\b');
|
bb_putchar('\b');
|
||||||
}
|
}
|
||||||
// Huh? What if command_ps[cursor] == '\0' (we are at the end already?)
|
// Huh? What if command_ps[cursor] == '\0' (we are at the end already?)
|
||||||
cursor++;
|
cursor++;
|
||||||
|
@ -137,7 +137,7 @@ static void goto_new_line(void)
|
||||||
{
|
{
|
||||||
input_end();
|
input_end();
|
||||||
if (cmdedit_x)
|
if (cmdedit_x)
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ static void out1str(const char *s)
|
||||||
|
|
||||||
static void beep(void)
|
static void beep(void)
|
||||||
{
|
{
|
||||||
putchar('\007');
|
bb_putchar('\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move back one character */
|
/* Move back one character */
|
||||||
|
@ -197,7 +197,7 @@ static void redraw(int y, int back_cursor)
|
||||||
{
|
{
|
||||||
if (y > 0) /* up to start y */
|
if (y > 0) /* up to start y */
|
||||||
printf("\033[%dA", y);
|
printf("\033[%dA", y);
|
||||||
putchar('\r');
|
bb_putchar('\r');
|
||||||
put_prompt();
|
put_prompt();
|
||||||
input_end(); /* rewrite */
|
input_end(); /* rewrite */
|
||||||
printf("\033[J"); /* erase after cursor */
|
printf("\033[J"); /* erase after cursor */
|
||||||
|
@ -1585,8 +1585,8 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t
|
||||||
beep();
|
beep();
|
||||||
else {
|
else {
|
||||||
*(command + cursor) = c;
|
*(command + cursor) = c;
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
putchar('\b');
|
bb_putchar('\b');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* FEATURE_COMMAND_EDITING_VI */
|
#endif /* FEATURE_COMMAND_EDITING_VI */
|
||||||
|
|
|
@ -456,6 +456,14 @@ off_t fdlength(int fd)
|
||||||
return pos + 1;
|
return pos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bb_putchar(int ch)
|
||||||
|
{
|
||||||
|
/* time.c needs putc(ch, stdout), not putchar(ch).
|
||||||
|
* it does "stdout = stderr;", but then glibc's putchar()
|
||||||
|
* doesn't work as expected. bad glibc, bad */
|
||||||
|
return putc(ch, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
// Die with an error message if we can't malloc() enough space and do an
|
// Die with an error message if we can't malloc() enough space and do an
|
||||||
// sprintf() into that space.
|
// sprintf() into that space.
|
||||||
char *xasprintf(const char *format, ...)
|
char *xasprintf(const char *format, ...)
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void die_if_nologin_and_non_root(int amroot)
|
||||||
fp = fopen("/etc/nologin", "r");
|
fp = fopen("/etc/nologin", "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
while ((c = getc(fp)) != EOF)
|
while ((c = getc(fp)) != EOF)
|
||||||
putchar((c=='\n') ? '\r' : c);
|
bb_putchar((c=='\n') ? '\r' : c);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -482,19 +482,43 @@ static void print_value_on_off(const char *str, unsigned long argp)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
|
#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
|
||||||
static void print_ascii(uint16_t *p, uint8_t length);
|
static void print_ascii(const char *p, int length)
|
||||||
|
{
|
||||||
|
#if BB_BIG_ENDIAN
|
||||||
|
#define LE_ONLY(x)
|
||||||
|
enum { ofs = 0 };
|
||||||
|
#else
|
||||||
|
#define LE_ONLY(x) x
|
||||||
|
/* every 16bit word is big-endian (i.e. inverted) */
|
||||||
|
/* accessing bytes in 1,0, 3,2, 5,4... sequence */
|
||||||
|
int ofs = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
length *= 2;
|
||||||
|
/* find first non-space & print it */
|
||||||
|
while (length && p[ofs] != ' ') {
|
||||||
|
p++;
|
||||||
|
LE_ONLY(ofs = -ofs;)
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
while (length && p[ofs]) {
|
||||||
|
bb_putchar(p[ofs]);
|
||||||
|
p++;
|
||||||
|
LE_ONLY(ofs = -ofs;)
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
bb_putchar('\n');
|
||||||
|
#undef LE_ONLY
|
||||||
|
}
|
||||||
|
|
||||||
static void xprint_ascii(uint16_t *val, int i, const char *string, int n)
|
static void xprint_ascii(uint16_t *val, int i, const char *string, int n)
|
||||||
{
|
{
|
||||||
if (val[i]) {
|
if (val[i]) {
|
||||||
printf("\t%-20s", string);
|
printf("\t%-20s", string);
|
||||||
print_ascii(&val[i], n);
|
print_ascii((void*)&val[i], n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* end of busybox specific stuff */
|
|
||||||
|
|
||||||
#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
|
|
||||||
static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode)
|
static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *have_mode)
|
||||||
{
|
{
|
||||||
uint16_t ii;
|
uint16_t ii;
|
||||||
|
@ -515,41 +539,11 @@ static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t *
|
||||||
return err_dma;
|
return err_dma;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_ascii(uint16_t *p, uint8_t length)
|
|
||||||
{
|
|
||||||
uint8_t ii;
|
|
||||||
char cl;
|
|
||||||
|
|
||||||
/* find first non-space & print it */
|
|
||||||
for (ii = 0; ii < length; ii++) {
|
|
||||||
if ((char)((*p)>>8) != ' ')
|
|
||||||
break;
|
|
||||||
cl = (char)(*p);
|
|
||||||
if (cl != ' ') {
|
|
||||||
if (cl != '\0')
|
|
||||||
printf("%c", cl);
|
|
||||||
p++;
|
|
||||||
ii++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
/* print the rest */
|
|
||||||
for (; ii< length; ii++) {
|
|
||||||
if (!(*p))
|
|
||||||
break; /* some older devices have NULLs */
|
|
||||||
printf("%c%c", (char)((*p)>>8), (char)(*p));
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
puts("");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse 512 byte disk identification block and print much crap.
|
// Parse 512 byte disk identification block and print much crap.
|
||||||
|
|
||||||
static void identify(uint16_t *id_supplied)
|
static void identify(uint16_t *val)
|
||||||
{
|
{
|
||||||
uint16_t buf[256];
|
uint16_t ii, jj, kk;
|
||||||
uint16_t *val, ii, jj, kk;
|
|
||||||
uint16_t like_std = 1, std = 0, min_std = 0xffff;
|
uint16_t like_std = 1, std = 0, min_std = 0xffff;
|
||||||
uint16_t dev = NO_DEV, eqpt = NO_DEV;
|
uint16_t dev = NO_DEV, eqpt = NO_DEV;
|
||||||
uint8_t have_mode = 0, err_dma = 0;
|
uint8_t have_mode = 0, err_dma = 0;
|
||||||
|
@ -557,19 +551,15 @@ static void identify(uint16_t *id_supplied)
|
||||||
uint32_t ll, mm, nn, oo;
|
uint32_t ll, mm, nn, oo;
|
||||||
uint64_t bbbig; /* (:) */
|
uint64_t bbbig; /* (:) */
|
||||||
const char *strng;
|
const char *strng;
|
||||||
|
#if BB_BIG_ENDIAN
|
||||||
|
uint16_t buf[256];
|
||||||
|
|
||||||
// Adjust for endianness if necessary.
|
// Adjust for endianness
|
||||||
|
swab(val, buf, sizeof(buf));
|
||||||
if (BB_BIG_ENDIAN) {
|
|
||||||
swab(id_supplied, buf, sizeof(buf));
|
|
||||||
val = buf;
|
val = buf;
|
||||||
} else
|
#endif
|
||||||
val = id_supplied;
|
|
||||||
|
|
||||||
chksum &= 0xff;
|
|
||||||
|
|
||||||
/* check if we recognise the device type */
|
/* check if we recognise the device type */
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
if (!(val[GEN_CONFIG] & NOT_ATA)) {
|
if (!(val[GEN_CONFIG] & NOT_ATA)) {
|
||||||
dev = ATA_DEV;
|
dev = ATA_DEV;
|
||||||
printf("ATA device, with ");
|
printf("ATA device, with ");
|
||||||
|
@ -686,7 +676,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
else if (like_std > std)
|
else if (like_std > std)
|
||||||
printf("& some of %u\n", like_std);
|
printf("& some of %u\n", like_std);
|
||||||
else
|
else
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
/* TBD: do CDROM stuff more thoroughly. For now... */
|
/* TBD: do CDROM stuff more thoroughly. For now... */
|
||||||
kk = 0;
|
kk = 0;
|
||||||
|
@ -786,7 +776,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
if (bbbig > 1000)
|
if (bbbig > 1000)
|
||||||
printf("(%"PRIu64" GB)\n", bbbig/1000);
|
printf("(%"PRIu64" GB)\n", bbbig/1000);
|
||||||
else
|
else
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hw support of commands (capabilities) */
|
/* hw support of commands (capabilities) */
|
||||||
|
@ -829,7 +819,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
if ((like_std > 3) && ((val[CAPAB_1] & VALID) == VALID_VAL))
|
if ((like_std > 3) && ((val[CAPAB_1] & VALID) == VALID_VAL))
|
||||||
printf(", %s device specific minimum\n", (val[CAPAB_1] & MIN_STANDBY_TIMER) ? "with" : "no");
|
printf(", %s device specific minimum\n", (val[CAPAB_1] & MIN_STANDBY_TIMER) ? "with" : "no");
|
||||||
else
|
else
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
printf("\tR/W multiple sector transfer: ");
|
printf("\tR/W multiple sector transfer: ");
|
||||||
if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER))
|
if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER))
|
||||||
|
@ -866,7 +856,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
printf("\tOverlap support:");
|
printf("\tOverlap support:");
|
||||||
if (val[PKT_REL]) printf(" %uus to release bus.", val[PKT_REL]);
|
if (val[PKT_REL]) printf(" %uus to release bus.", val[PKT_REL]);
|
||||||
if (val[SVC_NBSY]) printf(" %uus to clear BSY after SERVICE cmd.", val[SVC_NBSY]);
|
if (val[SVC_NBSY]) printf(" %uus to clear BSY after SERVICE cmd.", val[SVC_NBSY]);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +883,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
err_dma += mode_loop(jj, kk, 'u', &have_mode);
|
err_dma += mode_loop(jj, kk, 'u', &have_mode);
|
||||||
}
|
}
|
||||||
if (err_dma || !have_mode) printf("(?)");
|
if (err_dma || !have_mode) printf("(?)");
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
|
|
||||||
if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP))
|
if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP))
|
||||||
printf("\t\tInterleaved DMA support\n");
|
printf("\t\tInterleaved DMA support\n");
|
||||||
|
@ -904,7 +894,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
printf("\t\tCycle time:");
|
printf("\t\tCycle time:");
|
||||||
if (val[DMA_TIME_MIN]) printf(" min=%uns", val[DMA_TIME_MIN]);
|
if (val[DMA_TIME_MIN]) printf(" min=%uns", val[DMA_TIME_MIN]);
|
||||||
if (val[DMA_TIME_NORM]) printf(" recommended=%uns", val[DMA_TIME_NORM]);
|
if (val[DMA_TIME_NORM]) printf(" recommended=%uns", val[DMA_TIME_NORM]);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,11 +908,11 @@ static void identify(uint16_t *id_supplied)
|
||||||
if (jj & 0x0001) printf("pio%d ", ii);
|
if (jj & 0x0001) printf("pio%d ", ii);
|
||||||
jj >>=1;
|
jj >>=1;
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
} else if (((min_std < 5) || (eqpt == CDROM)) && (val[PIO_MODE] & MODE)) {
|
} else if (((min_std < 5) || (eqpt == CDROM)) && (val[PIO_MODE] & MODE)) {
|
||||||
for (ii = 0; ii <= val[PIO_MODE]>>8; ii++)
|
for (ii = 0; ii <= val[PIO_MODE]>>8; ii++)
|
||||||
printf("pio%d ", ii);
|
printf("pio%d ", ii);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
} else
|
} else
|
||||||
printf("unknown\n");
|
printf("unknown\n");
|
||||||
|
|
||||||
|
@ -931,7 +921,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
printf("\t\tCycle time:");
|
printf("\t\tCycle time:");
|
||||||
if (val[PIO_NO_FLOW]) printf(" no flow control=%uns", val[PIO_NO_FLOW]);
|
if (val[PIO_NO_FLOW]) printf(" no flow control=%uns", val[PIO_NO_FLOW]);
|
||||||
if (val[PIO_FLOW]) printf(" IORDY flow control=%uns", val[PIO_FLOW]);
|
if (val[PIO_FLOW]) printf(" IORDY flow control=%uns", val[PIO_FLOW]);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,7 +972,7 @@ static void identify(uint16_t *id_supplied)
|
||||||
printf("\t");
|
printf("\t");
|
||||||
if (jj) printf("%umin for %sSECURITY ERASE UNIT. ", jj==ERASE_BITS ? 508 : jj<<1, "");
|
if (jj) printf("%umin for %sSECURITY ERASE UNIT. ", jj==ERASE_BITS ? 508 : jj<<1, "");
|
||||||
if (kk) printf("%umin for %sSECURITY ERASE UNIT. ", kk==ERASE_BITS ? 508 : kk<<1, "ENHANCED ");
|
if (kk) printf("%umin for %sSECURITY ERASE UNIT. ", kk==ERASE_BITS ? 508 : kk<<1, "ENHANCED ");
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1134,7 +1124,7 @@ static void dump_identity(const struct hd_driveid *id)
|
||||||
else
|
else
|
||||||
printf("off");
|
printf("off");
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
|
|
||||||
if (!(id->field_valid & 1))
|
if (!(id->field_valid & 1))
|
||||||
printf(" (maybe):");
|
printf(" (maybe):");
|
||||||
|
@ -1905,7 +1895,7 @@ static void parse_xfermode(int flag, smallint *get, smallint *set, int *value)
|
||||||
|
|
||||||
/*------- getopt short options --------*/
|
/*------- getopt short options --------*/
|
||||||
static const char hdparm_options[] ALIGN1 =
|
static const char hdparm_options[] ALIGN1 =
|
||||||
"gfu::n::p:r::m::c::k::a::B:tTh"
|
"gfu::n::p:r::m::c::k::a::B:tT"
|
||||||
USE_FEATURE_HDPARM_GET_IDENTITY("iI")
|
USE_FEATURE_HDPARM_GET_IDENTITY("iI")
|
||||||
USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
|
USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
|
||||||
#ifdef HDIO_DRIVE_CMD
|
#ifdef HDIO_DRIVE_CMD
|
||||||
|
@ -1933,7 +1923,6 @@ int hdparm_main(int argc, char **argv)
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, hdparm_options)) >= 0) {
|
while ((c = getopt(argc, argv, hdparm_options)) >= 0) {
|
||||||
flagcount++;
|
flagcount++;
|
||||||
if (c == 'h') bb_show_usage(); /* EXIT */
|
|
||||||
USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity |= (c == 'I'));
|
USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity |= (c == 'I'));
|
||||||
USE_FEATURE_HDPARM_GET_IDENTITY(get_identity |= (c == 'i'));
|
USE_FEATURE_HDPARM_GET_IDENTITY(get_identity |= (c == 'i'));
|
||||||
get_geom |= (c == 'g');
|
get_geom |= (c == 'g');
|
||||||
|
@ -1999,7 +1988,7 @@ int hdparm_main(int argc, char **argv)
|
||||||
if (!*argv) {
|
if (!*argv) {
|
||||||
if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !isatty(STDIN_FILENO))
|
if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !isatty(STDIN_FILENO))
|
||||||
identify_from_stdin(); /* EXIT */
|
identify_from_stdin(); /* EXIT */
|
||||||
else bb_show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -173,7 +173,7 @@ static void less_exit(int code)
|
||||||
* and restore it when we exit. Less does this with the
|
* and restore it when we exit. Less does this with the
|
||||||
* "ti" and "te" termcap commands; can this be done with
|
* "ti" and "te" termcap commands; can this be done with
|
||||||
* only termios.h? */
|
* only termios.h? */
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
fflush_stdout_and_exit(code);
|
fflush_stdout_and_exit(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ static void status_print(void)
|
||||||
|
|
||||||
clear_line();
|
clear_line();
|
||||||
if (cur_fline && cur_fline < max_fline - max_displayed_line) {
|
if (cur_fline && cur_fline < max_fline - max_displayed_line) {
|
||||||
putchar(':');
|
bb_putchar(':');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = "(END)";
|
p = "(END)";
|
||||||
|
@ -755,7 +755,7 @@ static char* less_gets(int sz)
|
||||||
continue;
|
continue;
|
||||||
if (i >= width - sz - 1)
|
if (i >= width - sz - 1)
|
||||||
continue; /* len limit */
|
continue; /* len limit */
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
result[i++] = c;
|
result[i++] = c;
|
||||||
result = xrealloc(result, i+1);
|
result = xrealloc(result, i+1);
|
||||||
result[i] = '\0';
|
result[i] = '\0';
|
||||||
|
@ -916,7 +916,7 @@ static void regex_process(void)
|
||||||
|
|
||||||
/* Get the uncompiled regular expression from the user */
|
/* Get the uncompiled regular expression from the user */
|
||||||
clear_line();
|
clear_line();
|
||||||
putchar((option_mask32 & LESS_STATE_MATCH_BACKWARDS) ? '?' : '/');
|
bb_putchar((option_mask32 & LESS_STATE_MATCH_BACKWARDS) ? '?' : '/');
|
||||||
uncomp_regex = less_gets(1);
|
uncomp_regex = less_gets(1);
|
||||||
if (!uncomp_regex[0]) {
|
if (!uncomp_regex[0]) {
|
||||||
free(uncomp_regex);
|
free(uncomp_regex);
|
||||||
|
@ -969,7 +969,7 @@ static void number_process(int first_digit)
|
||||||
num_input[i] = less_getch();
|
num_input[i] = less_getch();
|
||||||
if (!num_input[i] || !isdigit(num_input[i]))
|
if (!num_input[i] || !isdigit(num_input[i]))
|
||||||
break;
|
break;
|
||||||
putchar(num_input[i]);
|
bb_putchar(num_input[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1024,7 +1024,7 @@ static void flag_change(void)
|
||||||
int keypress;
|
int keypress;
|
||||||
|
|
||||||
clear_line();
|
clear_line();
|
||||||
putchar('-');
|
bb_putchar('-');
|
||||||
keypress = less_getch();
|
keypress = less_getch();
|
||||||
|
|
||||||
switch (keypress) {
|
switch (keypress) {
|
||||||
|
@ -1049,7 +1049,7 @@ static void show_flag_status(void)
|
||||||
int flag_val;
|
int flag_val;
|
||||||
|
|
||||||
clear_line();
|
clear_line();
|
||||||
putchar('_');
|
bb_putchar('_');
|
||||||
keypress = less_getch();
|
keypress = less_getch();
|
||||||
|
|
||||||
switch (keypress) {
|
switch (keypress) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ int mountpoint_main(int argc, char **argv)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
if (opt & OPT_q)
|
if (opt & OPT_q)
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
else
|
else
|
||||||
bb_error_msg("%s: not a block device", arg);
|
bb_error_msg("%s: not a block device", arg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ int strings_main(int argc, char **argv)
|
||||||
c = fgetc(file);
|
c = fgetc(file);
|
||||||
if (isprint(c) || c == '\t') {
|
if (isprint(c) || c == '\t') {
|
||||||
if (count > n) {
|
if (count > n) {
|
||||||
putchar(c);
|
bb_putchar(c);
|
||||||
} else {
|
} else {
|
||||||
string[count] = c;
|
string[count] = c;
|
||||||
if (count == n) {
|
if (count == n) {
|
||||||
|
@ -72,7 +72,7 @@ int strings_main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (count > n) {
|
if (count > n) {
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,8 +188,6 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
|
||||||
#endif
|
#endif
|
||||||
if (!cpu_ticks) cpu_ticks = 1; /* we divide by it, must be nonzero */
|
if (!cpu_ticks) cpu_ticks = 1; /* we divide by it, must be nonzero */
|
||||||
|
|
||||||
/* putchar() != putc(stdout) in glibc! */
|
|
||||||
|
|
||||||
while (*fmt) {
|
while (*fmt) {
|
||||||
/* Handle leading literal part */
|
/* Handle leading literal part */
|
||||||
int n = strcspn(fmt, "%\\");
|
int n = strcspn(fmt, "%\\");
|
||||||
|
@ -205,7 +203,7 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
|
||||||
/* Usually we optimize for size, but there is a limit
|
/* Usually we optimize for size, but there is a limit
|
||||||
* for everything. With this we do a lot of 1-byte writes */
|
* for everything. With this we do a lot of 1-byte writes */
|
||||||
default:
|
default:
|
||||||
putc(*fmt, stdout);
|
bb_putchar(*fmt);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -215,11 +213,11 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
|
||||||
/* Our format strings do not have these */
|
/* Our format strings do not have these */
|
||||||
/* and we do not take format str from user */
|
/* and we do not take format str from user */
|
||||||
default:
|
default:
|
||||||
putc('%', stdout);
|
bb_putchar('%');
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case '%':
|
case '%':
|
||||||
if (!*fmt) goto ret;
|
if (!*fmt) goto ret;
|
||||||
putc(*fmt, stdout);
|
bb_putchar(*fmt);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'C': /* The command that got timed. */
|
case 'C': /* The command that got timed. */
|
||||||
|
@ -351,17 +349,17 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
|
||||||
case '\\': /* Format escape. */
|
case '\\': /* Format escape. */
|
||||||
switch (*++fmt) {
|
switch (*++fmt) {
|
||||||
default:
|
default:
|
||||||
putc('\\', stdout);
|
bb_putchar('\\');
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case '\\':
|
case '\\':
|
||||||
if (!*fmt) goto ret;
|
if (!*fmt) goto ret;
|
||||||
putc(*fmt, stdout);
|
bb_putchar(*fmt);
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
putc('\t', stdout);
|
bb_putchar('\t');
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
putc('\n', stdout);
|
bb_putchar('\n');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -370,7 +368,7 @@ static void summarize(const char *fmt, char **command, resource_t * resp)
|
||||||
++fmt;
|
++fmt;
|
||||||
}
|
}
|
||||||
/* ret: */
|
/* ret: */
|
||||||
putc('\n', stdout);
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run command CMD and return statistics on it.
|
/* Run command CMD and return statistics on it.
|
||||||
|
@ -437,6 +435,7 @@ int time_main(int argc, char **argv)
|
||||||
run_command(argv, &res);
|
run_command(argv, &res);
|
||||||
|
|
||||||
/* Cheat. printf's are shorter :) */
|
/* Cheat. printf's are shorter :) */
|
||||||
|
/* (but see bb_putchar() body for additional wrinkle!) */
|
||||||
stdout = stderr;
|
stdout = stderr;
|
||||||
dup2(2, 1); /* just in case libc does something silly :( */
|
dup2(2, 1); /* just in case libc does something silly :( */
|
||||||
summarize(output_format, argv, &res);
|
summarize(output_format, argv, &res);
|
||||||
|
|
|
@ -39,6 +39,6 @@ int ttysize_main(int argc, char **argv)
|
||||||
fmt = "%u %u" + 2; /* " %u" */
|
fmt = "%u %u" + 2; /* " %u" */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
#if !ENABLE_FEATURE_CHECK_TAINTED_MODULE
|
#if !ENABLE_FEATURE_CHECK_TAINTED_MODULE
|
||||||
static void check_tainted(void) { puts(""); }
|
static void check_tainted(void) { bb_putchar('\n'); }
|
||||||
#else
|
#else
|
||||||
#define TAINT_FILENAME "/proc/sys/kernel/tainted"
|
#define TAINT_FILENAME "/proc/sys/kernel/tainted"
|
||||||
#define TAINT_PROPRIETORY_MODULE (1<<0)
|
#define TAINT_PROPRIETORY_MODULE (1<<0)
|
||||||
|
@ -128,7 +128,7 @@ int lsmod_main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
if (count) printf("]");
|
if (count) printf("]");
|
||||||
|
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_FEATURE_CLEAN_UP
|
#if ENABLE_FEATURE_CLEAN_UP
|
||||||
|
@ -178,7 +178,7 @@ int lsmod_main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
printf(" %s", tok);
|
printf(" %s", tok);
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
|
@ -92,7 +92,7 @@ void bb_debug_dump_packet(unsigned char *outpack, int pktsize)
|
||||||
printf("packet dump:\n");
|
printf("packet dump:\n");
|
||||||
for (i = 0; i < pktsize; ++i) {
|
for (i = 0; i < pktsize; ++i) {
|
||||||
printf("%2.2x ", outpack[i]);
|
printf("%2.2x ", outpack[i]);
|
||||||
if (i % 20 == 19) puts("");
|
if (i % 20 == 19) bb_putchar('\n');
|
||||||
}
|
}
|
||||||
printf("\n\n");
|
printf("\n\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ int hostname_main(int argc, char **argv)
|
||||||
while (hp->h_addr_list[0]) {
|
while (hp->h_addr_list[0]) {
|
||||||
printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++)));
|
printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++)));
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Set the hostname */
|
/* Set the hostname */
|
||||||
|
|
|
@ -1259,7 +1259,7 @@ int ifupdown_main(int argc, char **argv)
|
||||||
iface_list = iface_list->link;
|
iface_list = iface_list->link;
|
||||||
}
|
}
|
||||||
if (VERBOSE) {
|
if (VERBOSE) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!okay && !FORCE) {
|
if (!okay && !FORCE) {
|
||||||
|
|
|
@ -937,7 +937,7 @@ static void ife_print(struct interface *ptr)
|
||||||
printf("(auto)");
|
printf("(auto)");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
|
|
||||||
if (ptr->has_ip) {
|
if (ptr->has_ip) {
|
||||||
printf(" %s addr:%s ", ap->name,
|
printf(" %s addr:%s ", ap->name,
|
||||||
|
@ -1073,7 +1073,7 @@ static void ife_print(struct interface *ptr)
|
||||||
if (ptr->outfill || ptr->keepalive)
|
if (ptr->outfill || ptr->keepalive)
|
||||||
printf(" Outfill:%d Keepalive:%d", ptr->outfill, ptr->keepalive);
|
printf(" Outfill:%d Keepalive:%d", ptr->outfill, ptr->keepalive);
|
||||||
#endif
|
#endif
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
|
|
||||||
/* If needed, display the interface statistics. */
|
/* If needed, display the interface statistics. */
|
||||||
|
|
||||||
|
@ -1122,9 +1122,9 @@ static void ife_print(struct interface *ptr)
|
||||||
}
|
}
|
||||||
if (ptr->map.dma)
|
if (ptr->map.dma)
|
||||||
printf("DMA chan:%x ", ptr->map.dma);
|
printf("DMA chan:%x ", ptr->map.dma);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -482,7 +482,7 @@ static void do_tunnels_list(struct ip_tunnel_parm *p)
|
||||||
(p->i_key && p1.i_key != p->i_key))
|
(p->i_key && p1.i_key != p->i_key))
|
||||||
continue;
|
continue;
|
||||||
print_tunnel(&p1);
|
print_tunnel(&p1);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ static int do_show(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
print_tunnel(&p);
|
print_tunnel(&p);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ static void server_print(void)
|
||||||
print_host(server, "Server:");
|
print_host(server, "Server:");
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
free(server);
|
free(server);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* alter the global _res nameserver structure to use
|
/* alter the global _res nameserver structure to use
|
||||||
|
|
|
@ -1322,7 +1322,7 @@ int traceroute_main(int argc, char **argv)
|
||||||
printf(" *");
|
printf(" *");
|
||||||
(void)fflush(stdout);
|
(void)fflush(stdout);
|
||||||
}
|
}
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
if (got_there ||
|
if (got_there ||
|
||||||
(unreachable > 0 && unreachable >= nprobes - 1))
|
(unreachable > 0 && unreachable >= nprobes - 1))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -142,7 +142,7 @@ static void progressmeter(int flag)
|
||||||
/* last call to progressmeter */
|
/* last call to progressmeter */
|
||||||
alarm(0);
|
alarm(0);
|
||||||
transferred = 0;
|
transferred = 0;
|
||||||
putc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
} else {
|
} else {
|
||||||
if (flag == -1) {
|
if (flag == -1) {
|
||||||
/* first call to progressmeter */
|
/* first call to progressmeter */
|
||||||
|
|
|
@ -292,7 +292,7 @@ static int fuser_print_pid_list(pid_list *plist)
|
||||||
printf("%d ", curr->pid);
|
printf("%d ", curr->pid);
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ int pidof_main(int argc, char **argv)
|
||||||
free(pidList);
|
free(pidList);
|
||||||
optind++;
|
optind++;
|
||||||
}
|
}
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
|
|
||||||
#if ENABLE_FEATURE_PIDOF_OMIT
|
#if ENABLE_FEATURE_PIDOF_OMIT
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
|
|
|
@ -482,7 +482,7 @@ static NOINLINE void display_process_list(int count, int scr_width)
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
/* printf(" %d", hist_iterations); */
|
/* printf(" %d", hist_iterations); */
|
||||||
putchar(OPT_BATCH_MODE ? '\n' : '\r');
|
bb_putchar(OPT_BATCH_MODE ? '\n' : '\r');
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
#undef UPSCALE
|
#undef UPSCALE
|
||||||
|
@ -752,7 +752,7 @@ static NOINLINE void display_topmem_process_list(int count, int scr_width)
|
||||||
printf("\n""%.*s", scr_width, line_buf);
|
printf("\n""%.*s", scr_width, line_buf);
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
putchar(OPT_BATCH_MODE ? '\n' : '\r');
|
bb_putchar(OPT_BATCH_MODE ? '\n' : '\r');
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#undef HDR_STR
|
#undef HDR_STR
|
||||||
#undef MIN_WIDTH
|
#undef MIN_WIDTH
|
||||||
|
@ -972,6 +972,6 @@ int top_main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif /* FEATURE_USE_TERMIOS */
|
#endif /* FEATURE_USE_TERMIOS */
|
||||||
}
|
}
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ static void out(const char *p, const char *m1)
|
||||||
if (errno) {
|
if (errno) {
|
||||||
printf(": %s", strerror(errno));
|
printf(": %s", strerror(errno));
|
||||||
}
|
}
|
||||||
puts(""); /* will also flush the output */
|
bb_putchar('\n'); /* will also flush the output */
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WARN "warning: "
|
#define WARN "warning: "
|
||||||
|
@ -300,7 +300,7 @@ static int status(const char *unused)
|
||||||
printf("; ");
|
printf("; ");
|
||||||
svstatus_print("log");
|
svstatus_print("log");
|
||||||
}
|
}
|
||||||
puts(""); /* will also flush the output */
|
bb_putchar('\n'); /* will also flush the output */
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ static int check(const char *a)
|
||||||
}
|
}
|
||||||
printf(OK);
|
printf(OK);
|
||||||
svstatus_print(*service);
|
svstatus_print(*service);
|
||||||
puts(""); /* will also flush the output */
|
bb_putchar('\n'); /* will also flush the output */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ int sv_main(int argc, char **argv)
|
||||||
svstatus_print(*service);
|
svstatus_print(*service);
|
||||||
++rc;
|
++rc;
|
||||||
}
|
}
|
||||||
puts(""); /* will also flush the output */
|
bb_putchar('\n'); /* will also flush the output */
|
||||||
if (kll)
|
if (kll)
|
||||||
control("k");
|
control("k");
|
||||||
nullify_service:
|
nullify_service:
|
||||||
|
|
|
@ -53,7 +53,7 @@ int getsebool_main(int argc, char **argv)
|
||||||
printf("%s --> %s", names[i], (active ? "on" : "off"));
|
printf("%s --> %s", names[i], (active ? "on" : "off"));
|
||||||
if (pending != active)
|
if (pending != active)
|
||||||
printf(" pending: %s", (pending ? "on" : "off"));
|
printf(" pending: %s", (pending ? "on" : "off"));
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
if (ENABLE_FEATURE_CLEAN_UP) {
|
||||||
|
|
|
@ -284,8 +284,8 @@ static int restore(const char *file)
|
||||||
if (count % 0x400 == 0) { /* every 1024 times */
|
if (count % 0x400 == 0) { /* every 1024 times */
|
||||||
count = (count % (80*0x400));
|
count = (count % (80*0x400));
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
fputc('\n', stdout);
|
bb_putchar('\n');
|
||||||
fputc('*', stdout);
|
bb_putchar('*');
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2004,7 +2004,7 @@ static int run_list_real(struct pipe *pi)
|
||||||
insert_bg_job(pi);
|
insert_bg_job(pi);
|
||||||
} else {
|
} else {
|
||||||
/* ctrl-C. We just stop doing whatever we were doing */
|
/* ctrl-C. We just stop doing whatever we were doing */
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
rcode = 0;
|
rcode = 0;
|
||||||
goto ret;
|
goto ret;
|
||||||
|
|
|
@ -319,7 +319,7 @@ static int builtin_help(struct child_prog ATTRIBUTE_UNUSED *dummy)
|
||||||
continue;
|
continue;
|
||||||
printf("%s\t%s\n", x->cmd, x->descr);
|
printf("%s\t%s\n", x->cmd, x->descr);
|
||||||
}
|
}
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ static int get_command_bufsiz(FILE * source, char *command)
|
||||||
|
|
||||||
if (!fgets(command, BUFSIZ - 2, source)) {
|
if (!fgets(command, BUFSIZ - 2, source)) {
|
||||||
if (source == stdin)
|
if (source == stdin)
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
shell/msh.c
10
shell/msh.c
|
@ -1137,7 +1137,7 @@ static void nameval(struct var *vp, const char *val, const char *name)
|
||||||
if (vp->status & RONLY) {
|
if (vp->status & RONLY) {
|
||||||
xp = vp->name;
|
xp = vp->name;
|
||||||
while (*xp && *xp != '=')
|
while (*xp && *xp != '=')
|
||||||
putc(*xp++, stderr);
|
fputc(*xp++, stderr);
|
||||||
err(" is read-only");
|
err(" is read-only");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3181,7 +3181,7 @@ static int dohelp(struct op *t)
|
||||||
while (x->name) {
|
while (x->name) {
|
||||||
col += printf("%c%s", ((col == 0) ? '\t' : ' '), x->name);
|
col += printf("%c%s", ((col == 0) ? '\t' : ' '), x->name);
|
||||||
if (col > 60) {
|
if (col > 60) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
col = 0;
|
col = 0;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
|
@ -3193,7 +3193,7 @@ static int dohelp(struct op *t)
|
||||||
while (applet->name) {
|
while (applet->name) {
|
||||||
col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet->name);
|
col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet->name);
|
||||||
if (col > 60) {
|
if (col > 60) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
col = 0;
|
col = 0;
|
||||||
}
|
}
|
||||||
applet++;
|
applet++;
|
||||||
|
@ -3274,8 +3274,8 @@ static int doumask(struct op *t)
|
||||||
i = umask(0);
|
i = umask(0);
|
||||||
umask(i);
|
umask(i);
|
||||||
for (n = 3 * 4; (n -= 3) >= 0;)
|
for (n = 3 * 4; (n -= 3) >= 0;)
|
||||||
putc('0' + ((i >> n) & 07), stderr);
|
fputc('0' + ((i >> n) & 07), stderr);
|
||||||
putc('\n', stderr);
|
fputc('\n', stderr);
|
||||||
} else {
|
} else {
|
||||||
/* huh??? '8','9' are not allowed! */
|
/* huh??? '8','9' are not allowed! */
|
||||||
for (n = 0; *cp >= '0' && *cp <= '9'; cp++)
|
for (n = 0; *cp >= '0' && *cp <= '9'; cp++)
|
||||||
|
|
|
@ -38,12 +38,12 @@ int dmesg_main(int argc, char **argv)
|
||||||
|
|
||||||
for (in = 0; in<len;) {
|
for (in = 0; in<len;) {
|
||||||
if (last == '\n' && buf[in] == '<') in += 3;
|
if (last == '\n' && buf[in] == '<') in += 3;
|
||||||
else putchar(last = buf[in++]);
|
else bb_putchar(last = buf[in++]);
|
||||||
}
|
}
|
||||||
if (last != '\n') putchar('\n');
|
if (last != '\n') bb_putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
write(1,buf,len);
|
write(1,buf,len);
|
||||||
if (len && buf[len-1]!='\n') putchar('\n');
|
if (len && buf[len-1]!='\n') bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) free(buf);
|
if (ENABLE_FEATURE_CLEAN_UP) free(buf);
|
||||||
|
|
|
@ -892,7 +892,7 @@ list_types(const char *const *sys)
|
||||||
next = ++done;
|
next = ++done;
|
||||||
}
|
}
|
||||||
} while (done < last[0]);
|
} while (done < last[0]);
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
#endif /* FEATURE_FDISK_WRITABLE */
|
#endif /* FEATURE_FDISK_WRITABLE */
|
||||||
|
|
||||||
|
@ -2473,13 +2473,13 @@ print_buffer(char *pbuffer)
|
||||||
printf("0x%03X:", i);
|
printf("0x%03X:", i);
|
||||||
printf(" %02X", (unsigned char) pbuffer[i]);
|
printf(" %02X", (unsigned char) pbuffer[i]);
|
||||||
if (l == MAX_PER_LINE - 1) {
|
if (l == MAX_PER_LINE - 1) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
l = -1;
|
l = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2527,7 +2527,7 @@ xselect(void)
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
c = tolower(read_nonempty("Expert command (m for help): "));
|
c = tolower(read_nonempty("Expert command (m for help): "));
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -2588,7 +2588,7 @@ xselect(void)
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
close(fd);
|
close(fd);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
exit(0);
|
exit(0);
|
||||||
case 'r':
|
case 'r':
|
||||||
return;
|
return;
|
||||||
|
@ -2867,7 +2867,7 @@ int fdisk_main(int argc, char **argv)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c;
|
int c;
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
c = tolower(read_nonempty("Command (m for help): "));
|
c = tolower(read_nonempty("Command (m for help): "));
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
|
@ -2947,7 +2947,7 @@ int fdisk_main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
close(fd);
|
close(fd);
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
return 0;
|
return 0;
|
||||||
case 's':
|
case 's':
|
||||||
#if ENABLE_FEATURE_SUN_LABEL
|
#if ENABLE_FEATURE_SUN_LABEL
|
||||||
|
|
|
@ -394,7 +394,7 @@ bsd_select(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) {
|
switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) {
|
||||||
case 'd':
|
case 'd':
|
||||||
xbsd_delete_part();
|
xbsd_delete_part();
|
||||||
|
@ -521,7 +521,7 @@ xbsd_print_disklabel(int show_all)
|
||||||
printf(" ecc");
|
printf(" ecc");
|
||||||
if (lp->d_flags & BSD_D_BADSECT)
|
if (lp->d_flags & BSD_D_BADSECT)
|
||||||
printf(" badsect");
|
printf(" badsect");
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
/* On various machines the fields of *lp are short/int/long */
|
/* On various machines the fields of *lp are short/int/long */
|
||||||
/* In order to avoid problems, we cast them all to long. */
|
/* In order to avoid problems, we cast them all to long. */
|
||||||
printf("bytes/sector: %ld\n", (long) lp->d_secsize);
|
printf("bytes/sector: %ld\n", (long) lp->d_secsize);
|
||||||
|
@ -588,7 +588,7 @@ xbsd_print_disklabel(int show_all)
|
||||||
printf("%22.22s", "");
|
printf("%22.22s", "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,12 +307,12 @@ static int ask(const char *string, int def)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (!repair) {
|
if (!repair) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
errors_uncorrected = 1;
|
errors_uncorrected = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (automatic) {
|
if (automatic) {
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
if (!def)
|
if (!def)
|
||||||
errors_uncorrected = 1;
|
errors_uncorrected = 1;
|
||||||
return def;
|
return def;
|
||||||
|
|
|
@ -195,7 +195,7 @@ static int generate_output(char **argv, int argc, const char *optstr, const stru
|
||||||
printf(" --");
|
printf(" --");
|
||||||
while (optind < argc)
|
while (optind < argc)
|
||||||
printf(" %s", normalize(argv[optind++]));
|
printf(" %s", normalize(argv[optind++]));
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
return exit_code;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,7 @@ static void print_sem(int semid)
|
||||||
}
|
}
|
||||||
printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
|
printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
|
||||||
}
|
}
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
int ipcs_main(int argc, char **argv);
|
int ipcs_main(int argc, char **argv);
|
||||||
|
@ -603,19 +603,19 @@ int ipcs_main(int argc, char **argv)
|
||||||
|
|
||||||
if (!(flags & (flag_shm | flag_msg | flag_sem)))
|
if (!(flags & (flag_shm | flag_msg | flag_sem)))
|
||||||
flags |= flag_msg | flag_shm | flag_sem;
|
flags |= flag_msg | flag_shm | flag_sem;
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
|
|
||||||
if (flags & flag_shm) {
|
if (flags & flag_shm) {
|
||||||
do_shm();
|
do_shm();
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
if (flags & flag_sem) {
|
if (flags & flag_sem) {
|
||||||
do_sem();
|
do_sem();
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
if (flags & flag_msg) {
|
if (flags & flag_msg) {
|
||||||
do_msg();
|
do_msg();
|
||||||
puts("");
|
bb_putchar('\n');
|
||||||
}
|
}
|
||||||
fflush_stdout_and_exit(0);
|
fflush_stdout_and_exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct globals {
|
||||||
|
|
||||||
static void gotsig(int sig)
|
static void gotsig(int sig)
|
||||||
{
|
{
|
||||||
putchar('\n');
|
bb_putchar('\n');
|
||||||
setTermSettings(cin_fileno, &initial_settings);
|
setTermSettings(cin_fileno, &initial_settings);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user