* [LTP] [PATCH 1/2] color: Rename file
@ 2017-02-17 0:03 Petr Vorel
2017-02-17 0:03 ` [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells Petr Vorel
0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2017-02-17 0:03 UTC (permalink / raw)
To: ltp
Use singular (to be consistent with shell).
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
include/{tst_ansi_colors.h => tst_ansi_color.h} | 8 ++++----
lib/{tst_ansi_colors.c => tst_ansi_color.c} | 2 +-
lib/tst_res.c | 2 +-
lib/tst_test.c | 2 +-
testcases/lib/tst_ansi_color.sh | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
rename include/{tst_ansi_colors.h => tst_ansi_color.h} (89%)
rename lib/{tst_ansi_colors.c => tst_ansi_color.c} (98%)
diff --git a/include/tst_ansi_colors.h b/include/tst_ansi_color.h
similarity index 89%
rename from include/tst_ansi_colors.h
rename to include/tst_ansi_color.h
index bc1cb89aa..0793b830c 100644
--- a/include/tst_ansi_colors.h
+++ b/include/tst_ansi_color.h
@@ -15,11 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef TST_ANSI_COLORS_H__
-#define TST_ANSI_COLORS_H__
+#ifndef TST_ANSI_COLOR_H__
+#define TST_ANSI_COLOR_H__
/*
* NOTE: these colors should match colors defined in tst_flag2color() in
- * testcases/lib/tst_ansi_colors.sh
+ * testcases/lib/tst_ansi_color.sh
*/
#define ANSI_COLOR_BLUE "\e[1;34m"
#define ANSI_COLOR_GREEN "\e[1;32m"
@@ -32,4 +32,4 @@
char* tst_ttype2color(int ttype);
int tst_color_enabled(int fd);
-#endif /* TST_ANSI_COLORS_H__ */
+#endif /* TST_ANSI_COLOR_H__ */
diff --git a/lib/tst_ansi_colors.c b/lib/tst_ansi_color.c
similarity index 98%
rename from lib/tst_ansi_colors.c
rename to lib/tst_ansi_color.c
index bebea84ef..f25c4d952 100644
--- a/lib/tst_ansi_colors.c
+++ b/lib/tst_ansi_color.c
@@ -20,7 +20,7 @@
#include <string.h>
#include "tst_res_flags.h"
-#include "tst_ansi_colors.h"
+#include "tst_ansi_color.h"
char* tst_ttype2color(int ttype)
{
diff --git a/lib/tst_res.c b/lib/tst_res.c
index 59209a9fa..ff0ad685f 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -50,7 +50,7 @@
#include "test.h"
#include "usctest.h"
#include "ltp_priv.h"
-#include "tst_ansi_colors.h"
+#include "tst_ansi_color.h"
long TEST_RETURN;
int TEST_ERRNO;
diff --git a/lib/tst_test.c b/lib/tst_test.c
index f19f76340..9757ee2f9 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -29,7 +29,7 @@
#include "tst_test.h"
#include "tst_device.h"
#include "lapi/futex.h"
-#include "tst_ansi_colors.h"
+#include "tst_ansi_color.h"
#include "old_resource.h"
#include "old_device.h"
diff --git a/testcases/lib/tst_ansi_color.sh b/testcases/lib/tst_ansi_color.sh
index 8a1ab26f6..987397144 100644
--- a/testcases/lib/tst_ansi_color.sh
+++ b/testcases/lib/tst_ansi_color.sh
@@ -20,7 +20,7 @@
tst_flag2color()
{
- # NOTE: these colors should match colors defined in include/tst_ansi_colors.h
+ # NOTE: these colors should match colors defined in include/tst_ansi_color.h
local ansi_color_blue='\e[1;34m'
local ansi_color_green='\e[1;32m'
local ansi_color_magenta='\e[1;35m'
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells
2017-02-17 0:03 [LTP] [PATCH 1/2] color: Rename file Petr Vorel
@ 2017-02-17 0:03 ` Petr Vorel
2017-02-28 21:28 ` Petr Vorel
2017-03-01 13:13 ` Cyril Hrubis
0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2017-02-17 0:03 UTC (permalink / raw)
To: ltp
This fixes at least for ksh and dash.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
include/tst_ansi_color.h | 12 ++++++------
testcases/lib/tst_ansi_color.sh | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/include/tst_ansi_color.h b/include/tst_ansi_color.h
index 0793b830c..fc158f2de 100644
--- a/include/tst_ansi_color.h
+++ b/include/tst_ansi_color.h
@@ -21,13 +21,13 @@
* NOTE: these colors should match colors defined in tst_flag2color() in
* testcases/lib/tst_ansi_color.sh
*/
-#define ANSI_COLOR_BLUE "\e[1;34m"
-#define ANSI_COLOR_GREEN "\e[1;32m"
-#define ANSI_COLOR_MAGENTA "\e[1;35m"
-#define ANSI_COLOR_RED "\e[1;31m"
-#define ANSI_COLOR_YELLOW "\e[1;33m"
+#define ANSI_COLOR_BLUE "\033[34;1m"
+#define ANSI_COLOR_GREEN "\033[32;1m"
+#define ANSI_COLOR_MAGENTA "\033[35;1m"
+#define ANSI_COLOR_RED "\033[31;1m"
+#define ANSI_COLOR_YELLOW "\033[33;1m"
-#define ANSI_COLOR_RESET "\e[00m"
+#define ANSI_COLOR_RESET "\033[0m"
char* tst_ttype2color(int ttype);
int tst_color_enabled(int fd);
diff --git a/testcases/lib/tst_ansi_color.sh b/testcases/lib/tst_ansi_color.sh
index 987397144..1fcd7a4c9 100644
--- a/testcases/lib/tst_ansi_color.sh
+++ b/testcases/lib/tst_ansi_color.sh
@@ -21,11 +21,11 @@
tst_flag2color()
{
# NOTE: these colors should match colors defined in include/tst_ansi_color.h
- local ansi_color_blue='\e[1;34m'
- local ansi_color_green='\e[1;32m'
- local ansi_color_magenta='\e[1;35m'
- local ansi_color_red='\e[1;31m'
- local ansi_color_yellow='\e[1;33m'
+ local ansi_color_blue='\033[34;1m'
+ local ansi_color_green='\033[32;1m'
+ local ansi_color_magenta='\033[35;1m'
+ local ansi_color_red='\033[31;1m'
+ local ansi_color_yellow='\033[33;1m'
case "$1" in
TPASS) printf $ansi_color_green;;
@@ -52,5 +52,5 @@ tst_print_colored()
[ "$color" = "1" ] && tst_flag2color "$1"
printf "$2"
- [ "$color" = "1" ] && printf '\e[00m'
+ [ "$color" = "1" ] && printf '\033[0m'
}
--
2.11.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells
2017-02-17 0:03 ` [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells Petr Vorel
@ 2017-02-28 21:28 ` Petr Vorel
2017-03-01 13:13 ` Cyril Hrubis
1 sibling, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2017-02-28 21:28 UTC (permalink / raw)
To: ltp
> This fixes at least for ksh and dash.
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> include/tst_ansi_color.h | 12 ++++++------
> testcases/lib/tst_ansi_color.sh | 12 ++++++------
> 2 files changed, 12 insertions(+), 12 deletions(-)
> diff --git a/include/tst_ansi_color.h b/include/tst_ansi_color.h
> index 0793b830c..fc158f2de 100644
> --- a/include/tst_ansi_color.h
> +++ b/include/tst_ansi_color.h
> @@ -21,13 +21,13 @@
> * NOTE: these colors should match colors defined in tst_flag2color() in
> * testcases/lib/tst_ansi_color.sh
> */
> -#define ANSI_COLOR_BLUE "\e[1;34m"
> -#define ANSI_COLOR_GREEN "\e[1;32m"
> -#define ANSI_COLOR_MAGENTA "\e[1;35m"
> -#define ANSI_COLOR_RED "\e[1;31m"
> -#define ANSI_COLOR_YELLOW "\e[1;33m"
> +#define ANSI_COLOR_BLUE "\033[34;1m"
> +#define ANSI_COLOR_GREEN "\033[32;1m"
> +#define ANSI_COLOR_MAGENTA "\033[35;1m"
> +#define ANSI_COLOR_RED "\033[31;1m"
> +#define ANSI_COLOR_YELLOW "\033[33;1m"
> -#define ANSI_COLOR_RESET "\e[00m"
> +#define ANSI_COLOR_RESET "\033[0m"
> char* tst_ttype2color(int ttype);
> int tst_color_enabled(int fd);
> diff --git a/testcases/lib/tst_ansi_color.sh b/testcases/lib/tst_ansi_color.sh
> index 987397144..1fcd7a4c9 100644
> --- a/testcases/lib/tst_ansi_color.sh
> +++ b/testcases/lib/tst_ansi_color.sh
> @@ -21,11 +21,11 @@
> tst_flag2color()
> {
> # NOTE: these colors should match colors defined in include/tst_ansi_color.h
> - local ansi_color_blue='\e[1;34m'
> - local ansi_color_green='\e[1;32m'
> - local ansi_color_magenta='\e[1;35m'
> - local ansi_color_red='\e[1;31m'
> - local ansi_color_yellow='\e[1;33m'
> + local ansi_color_blue='\033[34;1m'
> + local ansi_color_green='\033[32;1m'
> + local ansi_color_magenta='\033[35;1m'
> + local ansi_color_red='\033[31;1m'
> + local ansi_color_yellow='\033[33;1m'
> case "$1" in
> TPASS) printf $ansi_color_green;;
> @@ -52,5 +52,5 @@ tst_print_colored()
> [ "$color" = "1" ] && tst_flag2color "$1"
> printf "$2"
> - [ "$color" = "1" ] && printf '\e[00m'
> + [ "$color" = "1" ] && printf '\033[0m'
> }
Ping. This fixes output on systems with dash as default shell (at least Debian derivates).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells
2017-02-17 0:03 ` [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells Petr Vorel
2017-02-28 21:28 ` Petr Vorel
@ 2017-03-01 13:13 ` Cyril Hrubis
2017-03-01 13:36 ` Petr Vorel
1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2017-03-01 13:13 UTC (permalink / raw)
To: ltp
Hi!
> @@ -21,13 +21,13 @@
> * NOTE: these colors should match colors defined in tst_flag2color() in
> * testcases/lib/tst_ansi_color.sh
> */
> -#define ANSI_COLOR_BLUE "\e[1;34m"
> -#define ANSI_COLOR_GREEN "\e[1;32m"
> -#define ANSI_COLOR_MAGENTA "\e[1;35m"
> -#define ANSI_COLOR_RED "\e[1;31m"
> -#define ANSI_COLOR_YELLOW "\e[1;33m"
> +#define ANSI_COLOR_BLUE "\033[34;1m"
> +#define ANSI_COLOR_GREEN "\033[32;1m"
> +#define ANSI_COLOR_MAGENTA "\033[35;1m"
> +#define ANSI_COLOR_RED "\033[31;1m"
> +#define ANSI_COLOR_YELLOW "\033[33;1m"
>
> -#define ANSI_COLOR_RESET "\e[00m"
> +#define ANSI_COLOR_RESET "\033[0m"
I suppose that we are changing the C header to keep it consistent with
the shell one? I guess that's OK.
> char* tst_ttype2color(int ttype);
> int tst_color_enabled(int fd);
> diff --git a/testcases/lib/tst_ansi_color.sh b/testcases/lib/tst_ansi_color.sh
> index 987397144..1fcd7a4c9 100644
> --- a/testcases/lib/tst_ansi_color.sh
> +++ b/testcases/lib/tst_ansi_color.sh
> @@ -21,11 +21,11 @@
> tst_flag2color()
> {
> # NOTE: these colors should match colors defined in include/tst_ansi_color.h
> - local ansi_color_blue='\e[1;34m'
> - local ansi_color_green='\e[1;32m'
> - local ansi_color_magenta='\e[1;35m'
> - local ansi_color_red='\e[1;31m'
> - local ansi_color_yellow='\e[1;33m'
> + local ansi_color_blue='\033[34;1m'
> + local ansi_color_green='\033[32;1m'
> + local ansi_color_magenta='\033[35;1m'
> + local ansi_color_red='\033[31;1m'
> + local ansi_color_yellow='\033[33;1m'
I'm a bit puzzled by the change of the position of color and bold in the
escape sequence. As far as I can tell it does not matter at all, or does
it?
And the patch description does not describe this part of the change
either...
> case "$1" in
> TPASS) printf $ansi_color_green;;
> @@ -52,5 +52,5 @@ tst_print_colored()
>
> [ "$color" = "1" ] && tst_flag2color "$1"
> printf "$2"
> - [ "$color" = "1" ] && printf '\e[00m'
> + [ "$color" = "1" ] && printf '\033[0m'
> }
> --
> 2.11.0
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells
2017-03-01 13:13 ` Cyril Hrubis
@ 2017-03-01 13:36 ` Petr Vorel
2017-03-01 14:03 ` Cyril Hrubis
0 siblings, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2017-03-01 13:36 UTC (permalink / raw)
To: ltp
Hi Cyril,
> > -#define ANSI_COLOR_RESET "\e[00m"
> > +#define ANSI_COLOR_RESET "\033[0m"
> I suppose that we are changing the C header to keep it consistent with
> the shell one? I guess that's OK.
yep. I guess it's better to use the same notation, even the current notation is working in
C header.
> > # NOTE: these colors should match colors defined in include/tst_ansi_color.h
> > - local ansi_color_blue='\e[1;34m'
> > - local ansi_color_green='\e[1;32m'
> > - local ansi_color_magenta='\e[1;35m'
> > - local ansi_color_red='\e[1;31m'
> > - local ansi_color_yellow='\e[1;33m'
> > + local ansi_color_blue='\033[34;1m'
> > + local ansi_color_green='\033[32;1m'
> > + local ansi_color_magenta='\033[35;1m'
> > + local ansi_color_red='\033[31;1m'
> > + local ansi_color_yellow='\033[33;1m'
> I'm a bit puzzled by the change of the position of color and bold in the
> escape sequence. As far as I can tell it does not matter at all, or does
> it?
Sorry, my inattention, I'll generate v2.
> And the patch description does not describe this part of the change
> either...
What part exactly? The one below?
> > case "$1" in
> > TPASS) printf $ansi_color_green;;
> > @@ -52,5 +52,5 @@ tst_print_colored()
> > [ "$color" = "1" ] && tst_flag2color "$1"
> > printf "$2"
> > - [ "$color" = "1" ] && printf '\e[00m'
> > + [ "$color" = "1" ] && printf '\033[0m'
Kind regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells
2017-03-01 13:36 ` Petr Vorel
@ 2017-03-01 14:03 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2017-03-01 14:03 UTC (permalink / raw)
To: ltp
Hi!
> > > # NOTE: these colors should match colors defined in include/tst_ansi_color.h
> > > - local ansi_color_blue='\e[1;34m'
> > > - local ansi_color_green='\e[1;32m'
> > > - local ansi_color_magenta='\e[1;35m'
> > > - local ansi_color_red='\e[1;31m'
> > > - local ansi_color_yellow='\e[1;33m'
> > > + local ansi_color_blue='\033[34;1m'
> > > + local ansi_color_green='\033[32;1m'
> > > + local ansi_color_magenta='\033[35;1m'
> > > + local ansi_color_red='\033[31;1m'
> > > + local ansi_color_yellow='\033[33;1m'
>
> > I'm a bit puzzled by the change of the position of color and bold in the
> > escape sequence. As far as I can tell it does not matter at all, or does
> > it?
> Sorry, my inattention, I'll generate v2.
I'm not saying that it's wrong. Just that there is no mention of the
change in the commit description and without it it looks meaningless.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-01 14:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-17 0:03 [LTP] [PATCH 1/2] color: Rename file Petr Vorel
2017-02-17 0:03 ` [LTP] [PATCH 2/2] color: Fix backslash-escape sequences for some non-bash shells Petr Vorel
2017-02-28 21:28 ` Petr Vorel
2017-03-01 13:13 ` Cyril Hrubis
2017-03-01 13:36 ` Petr Vorel
2017-03-01 14:03 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.