summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-09-27 10:08:12 +0100
committerRon Yorston <rmy@pobox.com>2017-09-27 10:11:19 +0100
commitd9383e984da8de72e61e5094a3cf6404c5707ddc (patch)
treedd42825854fc42aea40d4f7a95548d53721d1733 /coreutils
parent166b3e4e82799f87d3b002c7177891111eff079e (diff)
parent0c4dbd481aedb5d22c1048e7f7eb547a3b5e50a5 (diff)
downloadbusybox-w32-d9383e984da8de72e61e5094a3cf6404c5707ddc.tar.gz
busybox-w32-d9383e984da8de72e61e5094a3cf6404c5707ddc.tar.bz2
busybox-w32-d9383e984da8de72e61e5094a3cf6404c5707ddc.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c10
-rw-r--r--coreutils/printf.c1
-rw-r--r--coreutils/shuf.c4
-rw-r--r--coreutils/stty.c22
4 files changed, 28 insertions, 9 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 9f0462936..22286d713 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -347,6 +347,8 @@ struct globals {
347 IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \ 347 IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \
348} while (0) 348} while (0)
349 349
350#define ESC "\033"
351
350 352
351/*** Output code ***/ 353/*** Output code ***/
352 354
@@ -586,12 +588,12 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
586 if (!mode) 588 if (!mode)
587 if (lstat(dn->fullname, &statbuf) == 0) 589 if (lstat(dn->fullname, &statbuf) == 0)
588 mode = statbuf.st_mode; 590 mode = statbuf.st_mode;
589 printf("\033[%u;%um", bold(mode), fgcolor(mode)); 591 printf(ESC"[%u;%um", bold(mode), fgcolor(mode));
590 } 592 }
591#endif 593#endif
592 column += print_name(dn->name); 594 column += print_name(dn->name);
593 if (G_show_color) { 595 if (G_show_color) {
594 printf("\033[0m"); 596 printf(ESC"[m");
595 } 597 }
596 598
597 if (lpath) { 599 if (lpath) {
@@ -609,7 +611,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
609# endif 611# endif
610# if ENABLE_FEATURE_LS_COLOR 612# if ENABLE_FEATURE_LS_COLOR
611 if (G_show_color) { 613 if (G_show_color) {
612 printf("\033[%u;%um", bold(mode), fgcolor(mode)); 614 printf(ESC"[%u;%um", bold(mode), fgcolor(mode));
613 } 615 }
614# endif 616# endif
615 } 617 }
@@ -617,7 +619,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
617 column += print_name(lpath) + 4; 619 column += print_name(lpath) + 4;
618 free(lpath); 620 free(lpath);
619 if (G_show_color) { 621 if (G_show_color) {
620 printf("\033[0m"); 622 printf(ESC"[m");
621 } 623 }
622 } 624 }
623#if ENABLE_FEATURE_LS_FILETYPES 625#if ENABLE_FEATURE_LS_FILETYPES
diff --git a/coreutils/printf.c b/coreutils/printf.c
index d1ff183d0..353cfc608 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -48,7 +48,6 @@
48//applet:IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf)) 48//applet:IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
49 49
50//kbuild:lib-$(CONFIG_PRINTF) += printf.o 50//kbuild:lib-$(CONFIG_PRINTF) += printf.o
51
52//kbuild:lib-$(CONFIG_ASH_PRINTF) += printf.o 51//kbuild:lib-$(CONFIG_ASH_PRINTF) += printf.o
53//kbuild:lib-$(CONFIG_HUSH_PRINTF) += printf.o 52//kbuild:lib-$(CONFIG_HUSH_PRINTF) += printf.o
54 53
diff --git a/coreutils/shuf.c b/coreutils/shuf.c
index d0caaa2ce..fdbd3e9b2 100644
--- a/coreutils/shuf.c
+++ b/coreutils/shuf.c
@@ -6,16 +6,16 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//config:config SHUF 9//config:config SHUF
11//config: bool "shuf (5.4 kb)" 10//config: bool "shuf (5.4 kb)"
12//config: default y 11//config: default y
13//config: help 12//config: help
14//config: Generate random permutations 13//config: Generate random permutations
15 14
16//kbuild:lib-$(CONFIG_SHUF) += shuf.o
17//applet:IF_SHUF(APPLET_NOEXEC(shuf, shuf, BB_DIR_USR_BIN, BB_SUID_DROP, shuf)) 15//applet:IF_SHUF(APPLET_NOEXEC(shuf, shuf, BB_DIR_USR_BIN, BB_SUID_DROP, shuf))
18 16
17//kbuild:lib-$(CONFIG_SHUF) += shuf.o
18
19//usage:#define shuf_trivial_usage 19//usage:#define shuf_trivial_usage
20//usage: "[-e|-i L-H] [-n NUM] [-o FILE] [-z] [FILE|ARG...]" 20//usage: "[-e|-i L-H] [-n NUM] [-o FILE] [-z] [FILE|ARG...]"
21//usage:#define shuf_full_usage "\n\n" 21//usage:#define shuf_full_usage "\n\n"
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 57e2cc30d..b6e836364 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -148,6 +148,9 @@
148#ifndef CRDLY 148#ifndef CRDLY
149# define CRDLY 0 149# define CRDLY 0
150#endif 150#endif
151#ifndef CMSPAR
152# define CMSPAR 0
153#endif
151#ifndef CRTSCTS 154#ifndef CRTSCTS
152# define CRTSCTS 0 155# define CRTSCTS 0
153#endif 156#endif
@@ -352,6 +355,9 @@ static const char mode_name[] ALIGN1 =
352#endif 355#endif
353 MI_ENTRY("parenb", control, REV, PARENB, 0 ) 356 MI_ENTRY("parenb", control, REV, PARENB, 0 )
354 MI_ENTRY("parodd", control, REV, PARODD, 0 ) 357 MI_ENTRY("parodd", control, REV, PARODD, 0 )
358#if CMSPAR
359 MI_ENTRY("cmspar", control, REV, CMSPAR, 0 )
360#endif
355 MI_ENTRY("cs5", control, 0, CS5, CSIZE) 361 MI_ENTRY("cs5", control, 0, CS5, CSIZE)
356 MI_ENTRY("cs6", control, 0, CS6, CSIZE) 362 MI_ENTRY("cs6", control, 0, CS6, CSIZE)
357 MI_ENTRY("cs7", control, 0, CS7, CSIZE) 363 MI_ENTRY("cs7", control, 0, CS7, CSIZE)
@@ -477,6 +483,10 @@ static const char mode_name[] ALIGN1 =
477 MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 ) 483 MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 )
478 MI_ENTRY("crtkill", local, OMIT | REV, ECHOKE, 0 ) 484 MI_ENTRY("crtkill", local, OMIT | REV, ECHOKE, 0 )
479#endif 485#endif
486 MI_ENTRY("flusho", local, SANE_UNSET | REV, FLUSHO, 0 )
487#ifdef EXTPROC
488 MI_ENTRY("extproc", local, SANE_UNSET | REV, EXTPROC, 0 )
489#endif
480 ; 490 ;
481 491
482#undef MI_ENTRY 492#undef MI_ENTRY
@@ -509,6 +519,9 @@ static const struct mode_info mode_info[] = {
509#endif 519#endif
510 MI_ENTRY("parenb", control, REV, PARENB, 0 ) 520 MI_ENTRY("parenb", control, REV, PARENB, 0 )
511 MI_ENTRY("parodd", control, REV, PARODD, 0 ) 521 MI_ENTRY("parodd", control, REV, PARODD, 0 )
522#if CMSPAR
523 MI_ENTRY("cmspar", control, REV, CMSPAR, 0 )
524#endif
512 MI_ENTRY("cs5", control, 0, CS5, CSIZE) 525 MI_ENTRY("cs5", control, 0, CS5, CSIZE)
513 MI_ENTRY("cs6", control, 0, CS6, CSIZE) 526 MI_ENTRY("cs6", control, 0, CS6, CSIZE)
514 MI_ENTRY("cs7", control, 0, CS7, CSIZE) 527 MI_ENTRY("cs7", control, 0, CS7, CSIZE)
@@ -634,6 +647,10 @@ static const struct mode_info mode_info[] = {
634 MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 ) 647 MI_ENTRY("echoke", local, SANE_SET | REV, ECHOKE, 0 )
635 MI_ENTRY("crtkill", local, OMIT | REV, ECHOKE, 0 ) 648 MI_ENTRY("crtkill", local, OMIT | REV, ECHOKE, 0 )
636#endif 649#endif
650 MI_ENTRY("flusho", local, SANE_UNSET | REV, FLUSHO, 0 )
651#ifdef EXTPROC
652 MI_ENTRY("extproc", local, SANE_UNSET | REV, EXTPROC, 0 )
653#endif
637}; 654};
638 655
639enum { 656enum {
@@ -836,10 +853,11 @@ static void wrapf(const char *message, ...)
836 G.current_col++; 853 G.current_col++;
837 if (buf[0] != '\n') { 854 if (buf[0] != '\n') {
838 if (G.current_col + buflen >= G.max_col) { 855 if (G.current_col + buflen >= G.max_col) {
839 bb_putchar('\n');
840 G.current_col = 0; 856 G.current_col = 0;
841 } else 857 bb_putchar('\n');
858 } else {
842 bb_putchar(' '); 859 bb_putchar(' ');
860 }
843 } 861 }
844 } 862 }
845 fputs(buf, stdout); 863 fputs(buf, stdout);