if (verbose > 1) {
bb_error_msg("\\[%d,%d]", start - match, length);
do {
- putc(G1.window[start++], stderr);
+ fputc(G1.window[start++], stderr);
} while (--length != 0);
}
}
if (file_header->link_target) {
printf(" -> %s", file_header->link_target);
}
- /* putchar isnt used anywhere else i dont think */
- puts("");
+ bb_putchar('\n');
}
if (!julian) {
printf("%*s%s", HEAD_SEP, "", day_headings);
}
- putchar('\n');
+ bb_putchar('\n');
for (row = 0; row < (6*7); row += 7) {
for (which_cal = 0; which_cal < 3-julian; which_cal++) {
dp = days[month + which_cal] + row;
if (c < 32) {
if (c == 10) {
if (flags & CATV_OPT_e)
- putchar('$');
+ bb_putchar('$');
} else if (flags & (c==9 ? CATV_OPT_t : CATV_OPT_v)) {
printf("^%c", c+'@');
continue;
}
}
- putchar(c);
+ bb_putchar(c);
}
}
if (ENABLE_FEATURE_CLEAN_UP && fd)
c = bb_process_escape_sequence(&arg);
}
}
- putchar(c);
+ bb_putchar(c);
}
arg = *++argv;
if (!arg)
break;
- putchar(' ');
+ bb_putchar(' ');
}
newline_ret:
if (nflag) {
- putchar('\n');
+ bb_putchar('\n');
}
ret:
return fflush(stdout);
/* Found a blank. Don't output the part after it. */
logical_end++;
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.
The areas being copied here might overlap. */
memmove(line_out, line_out + logical_end, offset_out - logical_end);
/* Print full info like GNU id */
/* bb_getpwuid(0) doesn't exit on failure (returns NULL) */
status = printf_full(uid, bb_getpwuid(NULL, 0, uid), 'u');
- putchar(' ');
+ bb_putchar(' ');
status |= printf_full(gid, bb_getgrgid(NULL, 0, gid), 'g');
#if ENABLE_SELINUX
}
#endif
- putchar('\n');
+ bb_putchar('\n');
fflush_stdout_and_exit(status);
}
for (i = 0; i < ndirs; i++) {
if (all_fmt & (DISP_DIRNAME | DISP_RECURSIVE)) {
if (!first)
- puts("");
+ bb_putchar('\n');
first = 0;
printf("%s:\n", dn[i]->fullname);
}
case '\r': fputs("\\r", stdout); break;
case '\t': fputs("\\t", stdout); break;
case '\v': fputs("\\v", stdout); break;
- default: putc(c, stdout);
+ default: bb_putchar(c);
}
}
putchar('\n');
for (; *str; str++) {
if (*str == '\\') {
str++;
- putchar(bb_process_escape_sequence((const char **)&str));
+ bb_putchar(bb_process_escape_sequence((const char **)&str));
} else {
- putchar(*str);
+ bb_putchar(*str);
}
}
direc_length = 1;
field_width = precision = -1;
if (*f == '%') {
- putchar('%');
+ bb_putchar('%');
break;
}
if (*f == 'b') {
case '\\':
if (*++f == 'c')
exit(0);
- putchar(bb_process_escape_sequence((const char **)&f));
+ bb_putchar(bb_process_escape_sequence((const char **)&f));
f--;
break;
default:
- putchar(*f);
+ bb_putchar(*f);
}
}
b = NULL;
/* fall through */
case '%':
- putchar('%');
+ bb_putchar('%');
break;
default:
print_func(dest, n_alloc, *p, filename, data USE_SELINUX(,scontext));
if (option_mask32 & OPT_SELINUX)
printf(" %lc\n", *scontext);
else
- putchar('\n');
+ bb_putchar('\n');
#endif
} else {
char *linkname = NULL;
(unsigned long) major(statbuf.st_rdev),
(unsigned long) minor(statbuf.st_rdev));
else
- putchar('\n');
+ bb_putchar('\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)),
bb_mode_string(statbuf.st_mode),
G.current_col++;
if (buf[0] != '\n') {
if (G.current_col + buflen >= max_col) {
- putchar('\n');
+ bb_putchar('\n');
G.current_col = 0;
} else
- putchar(' ');
+ bb_putchar(' ');
}
}
fputs(buf, stdout);
(unsigned long) mode->c_cflag, (unsigned long) mode->c_lflag);
for (i = 0; i < NCCS; ++i)
printf(":%x", (unsigned int) mode->c_cc[i]);
- putchar('\n');
+ bb_putchar('\n');
}
static void display_speed(const struct termios *mode, int fancy)
char **names;
char **np;
char retval;
+//TODO: make unconditional
#if ENABLE_FEATURE_TEE_USE_BLOCK_IO
ssize_t c;
# define buf bb_common_bufsiz1
/* names[0] will be filled later */
#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;
do
fwrite(buf, 1, c, *fp++);
if (toprint & 1) {
printf(((char *)(&uname_info)) + *delta);
if (toprint > 1) {
- putchar(' ');
+ bb_putchar(' ');
}
}
++delta;
} while (toprint >>= 1);
- putchar('\n');
+ bb_putchar('\n');
fflush_stdout_and_exit(EXIT_SUCCESS);
}
bb_perror_msg_and_die(bb_msg_read_error);
/* Encode the buffer we just read in */
bb_uuencode(dst_buf, src_buf, size, tbl);
- putchar('\n');
+ bb_putchar('\n');
if (tbl == bb_uuenc_tbl_std) {
- putchar(tbl[size]);
+ bb_putchar(tbl[size]);
}
fflush(stdout);
xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));
mntpt ? mntpt : device);
for (i = 0; i < argc; i++)
printf(" %s", argv[i]);
- puts("");
+ bb_putchar('\n');
}
/* Fork and execute the correct program. */
if (option_mask32 & OPT_PF_LONG) {
printf("%-28s ", name);
print_flags(stdout, fsflags, PFOPT_LONG);
- puts("");
+ bb_putchar('\n');
} else {
print_flags(stdout, fsflags, 0);
printf(" %s\n", name);
) {
printf("\n%s:\n", path);
iterate_on_dir(path, lsattr_dir_proc, NULL);
- puts("");
+ bb_putchar('\n');
}
}
else
printf(" tag: NULL\n");
}
- puts("");
+ bb_putchar('\n');
}
#endif
else
printf(" tag: NULL\n");
}
- puts("");
+ bb_putchar('\n');
}
int main(int argc, char**argv)
ch -= 128;
}
if ((ch < 32) || (ch == 0x7f)) {
- fputc('^', stdout);
+ bb_putchar('^');
ch ^= 0x40; /* ^@, ^A, ^B; ^? for DEL */
}
- fputc(ch, stdout);
+ bb_putchar(ch);
}
}
str = _(*cpp) + 1;
if (*first && islower(*str)) {
*first = 0;
- fputc(toupper(*str++), stdout);
+ bb_putchar(toupper(*str++));
}
print_e2fsck_message(ctx, str, pctx, *first);
} else
switch (ch) {
case '%':
- fputc('%', stdout);
+ bb_putchar('%');
break;
case 'b':
printf("%u", ctx->blk);
else
printf(_(" (check in %ld mounts)"), next_check);
}
- fputc('\n', stdout);
+ bb_putchar('\n');
ext2fs_close(fs);
ctx->fs = NULL;
e2fsck_free_context(ctx);
bar + (sizeof(bar) - (i+1)),
spaces + (sizeof(spaces) - (dpywidth - i + 1)));
if (fixed_percent == 1000)
- fputc('|', stdout);
+ bb_putchar('|');
else
- fputc(spinner[ctx->progress_pos & 3], stdout);
+ bb_putchar(spinner[ctx->progress_pos & 3]);
printf(" %4.1f%% ", percent);
if (dpynum)
printf("%u\r", dpynum);
mntpt ? mntpt : device);
for (i=0; i < argc; i++)
printf("%s ", argv[i]);
- puts("");
+ bb_putchar('\n');
}
/* Fork and execute the correct program. */
if (flags & OPT_PF_LONG) {
printf("%-28s ", name);
print_flags(stdout, fsflags, PFOPT_LONG);
- puts("");
+ bb_putchar('\n');
} else {
print_flags(stdout, fsflags, 0);
printf(" %s\n", name);
(de->d_name[1] != '.' && de->d_name[2] != '\0')))) {
printf("\n%s:\n", path);
iterate_on_dir(path, lsattr_dir_proc, NULL);
- puts("");
+ bb_putchar('\n');
}
}
}
s->s_blocks_per_group, s->s_frags_per_group,
s->s_inodes_per_group);
if (fs->group_desc_count == 1) {
- puts("");
+ bb_putchar('\n');
return;
}
printf(" (random)\n");
break;
default:
- puts("");
+ bb_putchar('\n');
}
if (type != 1) {
printf("Warning: not a time-based UUID, so UUID time "
ch &= 0x7f;
}
if (ch < ' ') {
- fputc('^', stdout);
+ bb_putchar('^');
ch += '@';
}
if (ch == 0x7f) {
- fputc('^', stdout);
+ bb_putchar('^');
ch = '?';
}
- fputc(ch, stdout);
+ bb_putchar(ch);
}
fputs("$\n", stdout);
if (c == '\n') {
write1("$\r");
} else if (c < ' ' || c == 127) {
- putchar('^');
+ bb_putchar('^');
if (c == 127)
c = '?';
else
c += '@';
}
- putchar(c);
+ bb_putchar(c);
if (c_is_no_print)
standout_end();
}
} else {
buf[i] = c; // save char in buffer
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++;
}
}
char *out = sp + cs;
while (nic-- > 0) {
- putchar(*out);
+ bb_putchar(*out);
out++;
}
}
struct sockaddr *from, struct sockaddr *to,
socklen_t sa_size);
-
-extern char *xstrdup(const char *s);
-extern char *xstrndup(const char *s, int n);
-extern char *safe_strncpy(char *dst, const char *src, size_t size);
-extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
+char *xstrdup(const char *s);
+char *xstrndup(const char *s, int n);
+char *safe_strncpy(char *dst, const char *src, size_t size);
+/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc.
+/* 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
// (+200 bytes compared to macro)
//static ALWAYS_INLINE
}
tcsetattr(STDIN_FILENO, TCSANOW, &old);
- putchar('\n');
+ bb_putchar('\n');
fflush(stdout);
return ret;
}
#endif
{
if (initial_settings.c_lflag & ECHO)
- putchar(c);
+ bb_putchar(c);
}
if (++cmdedit_x >= cmdedit_termw) {
/* terminal is scrolled down */
cmdedit_y++;
cmdedit_x = 0;
/* destroy "(auto)margin" */
- putchar(next_char);
- putchar('\b');
+ bb_putchar(next_char);
+ bb_putchar('\b');
}
// Huh? What if command_ps[cursor] == '\0' (we are at the end already?)
cursor++;
{
input_end();
if (cmdedit_x)
- putchar('\n');
+ bb_putchar('\n');
}
static void beep(void)
{
- putchar('\007');
+ bb_putchar('\007');
}
/* Move back one character */
{
if (y > 0) /* up to start y */
printf("\033[%dA", y);
- putchar('\r');
+ bb_putchar('\r');
put_prompt();
input_end(); /* rewrite */
printf("\033[J"); /* erase after cursor */
beep();
else {
*(command + cursor) = c;
- putchar(c);
- putchar('\b');
+ bb_putchar(c);
+ bb_putchar('\b');
}
break;
#endif /* FEATURE_COMMAND_EDITING_VI */
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
// sprintf() into that space.
char *xasprintf(const char *format, ...)
fp = fopen("/etc/nologin", "r");
if (fp) {
while ((c = getc(fp)) != EOF)
- putchar((c=='\n') ? '\r' : c);
+ bb_putchar((c=='\n') ? '\r' : c);
fflush(stdout);
fclose(fp);
} else
}
#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)
{
if (val[i]) {
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)
{
uint16_t ii;
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.
-static void identify(uint16_t *id_supplied)
+static void identify(uint16_t *val)
{
- uint16_t buf[256];
- uint16_t *val, ii, jj, kk;
+ uint16_t ii, jj, kk;
uint16_t like_std = 1, std = 0, min_std = 0xffff;
uint16_t dev = NO_DEV, eqpt = NO_DEV;
uint8_t have_mode = 0, err_dma = 0;
uint32_t ll, mm, nn, oo;
uint64_t bbbig; /* (:) */
const char *strng;
+#if BB_BIG_ENDIAN
+ uint16_t buf[256];
- // Adjust for endianness if necessary.
-
- if (BB_BIG_ENDIAN) {
- swab(id_supplied, buf, sizeof(buf));
- val = buf;
- } else
- val = id_supplied;
-
- chksum &= 0xff;
-
+ // Adjust for endianness
+ swab(val, buf, sizeof(buf));
+ val = buf;
+#endif
/* check if we recognise the device type */
- puts("");
+ bb_putchar('\n');
if (!(val[GEN_CONFIG] & NOT_ATA)) {
dev = ATA_DEV;
printf("ATA device, with ");
else if (like_std > std)
printf("& some of %u\n", like_std);
else
- puts("");
+ bb_putchar('\n');
} else {
/* TBD: do CDROM stuff more thoroughly. For now... */
kk = 0;
if (bbbig > 1000)
printf("(%"PRIu64" GB)\n", bbbig/1000);
else
- puts("");
+ bb_putchar('\n');
}
/* hw support of commands (capabilities) */
if ((like_std > 3) && ((val[CAPAB_1] & VALID) == VALID_VAL))
printf(", %s device specific minimum\n", (val[CAPAB_1] & MIN_STANDBY_TIMER) ? "with" : "no");
else
- puts("");
+ bb_putchar('\n');
}
printf("\tR/W multiple sector transfer: ");
if ((like_std < 3) && !(val[SECTOR_XFER_MAX] & SECTOR_XFER))
printf("\tOverlap support:");
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]);
- puts("");
+ bb_putchar('\n');
}
}
err_dma += mode_loop(jj, kk, 'u', &have_mode);
}
if (err_dma || !have_mode) printf("(?)");
- puts("");
+ bb_putchar('\n');
if ((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP))
printf("\t\tInterleaved DMA support\n");
printf("\t\tCycle time:");
if (val[DMA_TIME_MIN]) printf(" min=%uns", val[DMA_TIME_MIN]);
if (val[DMA_TIME_NORM]) printf(" recommended=%uns", val[DMA_TIME_NORM]);
- puts("");
+ bb_putchar('\n');
}
}
if (jj & 0x0001) printf("pio%d ", ii);
jj >>=1;
}
- puts("");
+ bb_putchar('\n');
} else if (((min_std < 5) || (eqpt == CDROM)) && (val[PIO_MODE] & MODE)) {
for (ii = 0; ii <= val[PIO_MODE]>>8; ii++)
printf("pio%d ", ii);
- puts("");
+ bb_putchar('\n');
} else
printf("unknown\n");
printf("\t\tCycle time:");
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]);
- puts("");
+ bb_putchar('\n');
}
}
printf("\t");
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 ");
- puts("");
+ bb_putchar('\n');
}
}
else
printf("off");
}
- puts("");
+ bb_putchar('\n');
if (!(id->field_valid & 1))
printf(" (maybe):");
/*------- getopt short options --------*/
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_HDIO_GETSET_DMA("d::")
#ifdef HDIO_DRIVE_CMD
while ((c = getopt(argc, argv, hdparm_options)) >= 0) {
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'));
get_geom |= (c == 'g');
if (!*argv) {
if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !isatty(STDIN_FILENO))
identify_from_stdin(); /* EXIT */
- else bb_show_usage();
+ bb_show_usage();
}
do {
* and restore it when we exit. Less does this with the
* "ti" and "te" termcap commands; can this be done with
* only termios.h? */
- putchar('\n');
+ bb_putchar('\n');
fflush_stdout_and_exit(code);
}
clear_line();
if (cur_fline && cur_fline < max_fline - max_displayed_line) {
- putchar(':');
+ bb_putchar(':');
return;
}
p = "(END)";
continue;
if (i >= width - sz - 1)
continue; /* len limit */
- putchar(c);
+ bb_putchar(c);
result[i++] = c;
result = xrealloc(result, i+1);
result[i] = '\0';
/* Get the uncompiled regular expression from the user */
clear_line();
- putchar((option_mask32 & LESS_STATE_MATCH_BACKWARDS) ? '?' : '/');
+ bb_putchar((option_mask32 & LESS_STATE_MATCH_BACKWARDS) ? '?' : '/');
uncomp_regex = less_gets(1);
if (!uncomp_regex[0]) {
free(uncomp_regex);
num_input[i] = less_getch();
if (!num_input[i] || !isdigit(num_input[i]))
break;
- putchar(num_input[i]);
+ bb_putchar(num_input[i]);
i++;
}
int keypress;
clear_line();
- putchar('-');
+ bb_putchar('-');
keypress = less_getch();
switch (keypress) {
int flag_val;
clear_line();
- putchar('_');
+ bb_putchar('_');
keypress = less_getch();
switch (keypress) {
return EXIT_SUCCESS;
} else {
if (opt & OPT_q)
- putchar('\n');
+ bb_putchar('\n');
else
bb_error_msg("%s: not a block device", arg);
}
c = fgetc(file);
if (isprint(c) || c == '\t') {
if (count > n) {
- putchar(c);
+ bb_putchar(c);
} else {
string[count] = c;
if (count == n) {
}
} else {
if (count > n) {
- putchar('\n');
+ bb_putchar('\n');
}
count = 0;
}
#endif
if (!cpu_ticks) cpu_ticks = 1; /* we divide by it, must be nonzero */
- /* putchar() != putc(stdout) in glibc! */
-
while (*fmt) {
/* Handle leading literal part */
int n = strcspn(fmt, "%\\");
/* Usually we optimize for size, but there is a limit
* for everything. With this we do a lot of 1-byte writes */
default:
- putc(*fmt, stdout);
+ bb_putchar(*fmt);
break;
#endif
/* Our format strings do not have these */
/* and we do not take format str from user */
default:
- putc('%', stdout);
+ bb_putchar('%');
/*FALLTHROUGH*/
case '%':
if (!*fmt) goto ret;
- putc(*fmt, stdout);
+ bb_putchar(*fmt);
break;
#endif
case 'C': /* The command that got timed. */
case '\\': /* Format escape. */
switch (*++fmt) {
default:
- putc('\\', stdout);
+ bb_putchar('\\');
/*FALLTHROUGH*/
case '\\':
if (!*fmt) goto ret;
- putc(*fmt, stdout);
+ bb_putchar(*fmt);
break;
case 't':
- putc('\t', stdout);
+ bb_putchar('\t');
break;
case 'n':
- putc('\n', stdout);
+ bb_putchar('\n');
break;
}
break;
++fmt;
}
/* ret: */
- putc('\n', stdout);
+ bb_putchar('\n');
}
/* Run command CMD and return statistics on it.
run_command(argv, &res);
/* Cheat. printf's are shorter :) */
+ /* (but see bb_putchar() body for additional wrinkle!) */
stdout = stderr;
dup2(2, 1); /* just in case libc does something silly :( */
summarize(output_format, argv, &res);
fmt = "%u %u" + 2; /* " %u" */
}
}
- putchar('\n');
+ bb_putchar('\n');
return 0;
}
#if !ENABLE_FEATURE_CHECK_TAINTED_MODULE
-static void check_tainted(void) { puts(""); }
+static void check_tainted(void) { bb_putchar('\n'); }
#else
#define TAINT_FILENAME "/proc/sys/kernel/tainted"
#define TAINT_PROPRIETORY_MODULE (1<<0)
}
if (count) printf("]");
- puts("");
+ bb_putchar('\n');
}
#if ENABLE_FEATURE_CLEAN_UP
}
printf(" %s", tok);
}
- puts("");
+ bb_putchar('\n');
free(line);
}
fclose(file);
printf("packet dump:\n");
for (i = 0; i < pktsize; ++i) {
printf("%2.2x ", outpack[i]);
- if (i % 20 == 19) puts("");
+ if (i % 20 == 19) bb_putchar('\n');
}
printf("\n\n");
}
while (hp->h_addr_list[0]) {
printf("%s ", inet_ntoa(*(struct in_addr *) (*hp->h_addr_list++)));
}
- puts("");
+ bb_putchar('\n');
}
}
/* Set the hostname */
iface_list = iface_list->link;
}
if (VERBOSE) {
- puts("");
+ bb_putchar('\n');
}
if (!okay && !FORCE) {
printf("(auto)");
}
#endif
- puts("");
+ bb_putchar('\n');
if (ptr->has_ip) {
printf(" %s addr:%s ", ap->name,
if (ptr->outfill || ptr->keepalive)
printf(" Outfill:%d Keepalive:%d", ptr->outfill, ptr->keepalive);
#endif
- puts("");
+ bb_putchar('\n');
/* If needed, display the interface statistics. */
}
if (ptr->map.dma)
printf("DMA chan:%x ", ptr->map.dma);
- puts("");
+ bb_putchar('\n');
}
- puts("");
+ bb_putchar('\n');
}
(p->i_key && p1.i_key != p->i_key))
continue;
print_tunnel(&p1);
- puts("");
+ bb_putchar('\n');
}
}
return -1;
print_tunnel(&p);
- puts("");
+ bb_putchar('\n');
return 0;
}
print_host(server, "Server:");
if (ENABLE_FEATURE_CLEAN_UP)
free(server);
- puts("");
+ bb_putchar('\n');
}
/* alter the global _res nameserver structure to use
printf(" *");
(void)fflush(stdout);
}
- putchar('\n');
+ bb_putchar('\n');
if (got_there ||
(unreachable > 0 && unreachable >= nprobes - 1))
break;
/* last call to progressmeter */
alarm(0);
transferred = 0;
- putc('\n', stderr);
+ fputc('\n', stderr);
} else {
if (flag == -1) {
/* first call to progressmeter */
printf("%d ", curr->pid);
curr = curr->next;
}
- puts("");
+ bb_putchar('\n');
return 1;
}
free(pidList);
optind++;
}
- putchar('\n');
+ bb_putchar('\n');
#if ENABLE_FEATURE_PIDOF_OMIT
if (ENABLE_FEATURE_CLEAN_UP)
s++;
}
/* printf(" %d", hist_iterations); */
- putchar(OPT_BATCH_MODE ? '\n' : '\r');
+ bb_putchar(OPT_BATCH_MODE ? '\n' : '\r');
fflush(stdout);
}
#undef UPSCALE
printf("\n""%.*s", scr_width, line_buf);
s++;
}
- putchar(OPT_BATCH_MODE ? '\n' : '\r');
+ bb_putchar(OPT_BATCH_MODE ? '\n' : '\r');
fflush(stdout);
#undef HDR_STR
#undef MIN_WIDTH
}
#endif /* FEATURE_USE_TERMIOS */
}
- putchar('\n');
+ bb_putchar('\n');
return EXIT_SUCCESS;
}
if (errno) {
printf(": %s", strerror(errno));
}
- puts(""); /* will also flush the output */
+ bb_putchar('\n'); /* will also flush the output */
}
#define WARN "warning: "
printf("; ");
svstatus_print("log");
}
- puts(""); /* will also flush the output */
+ bb_putchar('\n'); /* will also flush the output */
return r;
}
}
printf(OK);
svstatus_print(*service);
- puts(""); /* will also flush the output */
+ bb_putchar('\n'); /* will also flush the output */
return 1;
}
svstatus_print(*service);
++rc;
}
- puts(""); /* will also flush the output */
+ bb_putchar('\n'); /* will also flush the output */
if (kll)
control("k");
nullify_service:
printf("%s --> %s", names[i], (active ? "on" : "off"));
if (pending != active)
printf(" pending: %s", (pending ? "on" : "off"));
- putchar('\n');
+ bb_putchar('\n');
}
if (ENABLE_FEATURE_CLEAN_UP) {
if (count % 0x400 == 0) { /* every 1024 times */
count = (count % (80*0x400));
if (count == 0)
- fputc('\n', stdout);
- fputc('*', stdout);
+ bb_putchar('\n');
+ bb_putchar('*');
fflush(stdout);
}
}
insert_bg_job(pi);
} else {
/* ctrl-C. We just stop doing whatever we were doing */
- putchar('\n');
+ bb_putchar('\n');
}
rcode = 0;
goto ret;
continue;
printf("%s\t%s\n", x->cmd, x->descr);
}
- putchar('\n');
+ bb_putchar('\n');
return EXIT_SUCCESS;
}
if (!fgets(command, BUFSIZ - 2, source)) {
if (source == stdin)
- puts("");
+ bb_putchar('\n');
return 1;
}
if (vp->status & RONLY) {
xp = vp->name;
while (*xp && *xp != '=')
- putc(*xp++, stderr);
+ fputc(*xp++, stderr);
err(" is read-only");
return;
}
while (x->name) {
col += printf("%c%s", ((col == 0) ? '\t' : ' '), x->name);
if (col > 60) {
- puts("");
+ bb_putchar('\n');
col = 0;
}
x++;
while (applet->name) {
col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet->name);
if (col > 60) {
- puts("");
+ bb_putchar('\n');
col = 0;
}
applet++;
i = umask(0);
umask(i);
for (n = 3 * 4; (n -= 3) >= 0;)
- putc('0' + ((i >> n) & 07), stderr);
- putc('\n', stderr);
+ fputc('0' + ((i >> n) & 07), stderr);
+ fputc('\n', stderr);
} else {
/* huh??? '8','9' are not allowed! */
for (n = 0; *cp >= '0' && *cp <= '9'; cp++)
for (in = 0; in<len;) {
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 {
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);
next = ++done;
}
} while (done < last[0]);
- putchar('\n');
+ bb_putchar('\n');
}
#endif /* FEATURE_FDISK_WRITABLE */
printf("0x%03X:", i);
printf(" %02X", (unsigned char) pbuffer[i]);
if (l == MAX_PER_LINE - 1) {
- puts("");
+ bb_putchar('\n');
l = -1;
}
}
if (l > 0)
- puts("");
- puts("");
+ bb_putchar('\n');
+ bb_putchar('\n');
}
static void
char c;
while (1) {
- putchar('\n');
+ bb_putchar('\n');
c = tolower(read_nonempty("Expert command (m for help): "));
switch (c) {
case 'a':
break;
case 'q':
close(fd);
- puts("");
+ bb_putchar('\n');
exit(0);
case 'r':
return;
while (1) {
int c;
- putchar('\n');
+ bb_putchar('\n');
c = tolower(read_nonempty("Command (m for help): "));
switch (c) {
case 'a':
break;
case 'q':
close(fd);
- puts("");
+ bb_putchar('\n');
return 0;
case 's':
#if ENABLE_FEATURE_SUN_LABEL
#endif
while (1) {
- putchar('\n');
+ bb_putchar('\n');
switch (tolower(read_nonempty("BSD disklabel command (m for help): "))) {
case 'd':
xbsd_delete_part();
printf(" ecc");
if (lp->d_flags & BSD_D_BADSECT)
printf(" badsect");
- puts("");
+ bb_putchar('\n');
/* On various machines the fields of *lp are short/int/long */
/* In order to avoid problems, we cast them all to long. */
printf("bytes/sector: %ld\n", (long) lp->d_secsize);
printf("%22.22s", "");
break;
}
- puts("");
+ bb_putchar('\n');
}
}
}
int c;
if (!repair) {
- puts("");
+ bb_putchar('\n');
errors_uncorrected = 1;
return 0;
}
if (automatic) {
- puts("");
+ bb_putchar('\n');
if (!def)
errors_uncorrected = 1;
return def;
printf(" --");
while (optind < argc)
printf(" %s", normalize(argv[optind++]));
- puts("");
+ bb_putchar('\n');
}
return exit_code;
}
}
printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid);
}
- puts("");
+ bb_putchar('\n');
}
int ipcs_main(int argc, char **argv);
if (!(flags & (flag_shm | flag_msg | flag_sem)))
flags |= flag_msg | flag_shm | flag_sem;
- puts("");
+ bb_putchar('\n');
if (flags & flag_shm) {
do_shm();
- puts("");
+ bb_putchar('\n');
}
if (flags & flag_sem) {
do_sem();
- puts("");
+ bb_putchar('\n');
}
if (flags & flag_msg) {
do_msg();
- puts("");
+ bb_putchar('\n');
}
fflush_stdout_and_exit(0);
}
static void gotsig(int sig)
{
- putchar('\n');
+ bb_putchar('\n');
setTermSettings(cin_fileno, &initial_settings);
exit(EXIT_FAILURE);
}