From 7c2ed556b9e3dc5e8230b55b7f57a2955c168b7e Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 22 Aug 2016 01:31:49 +0200 Subject: [PATCH] Replace \e GNUism w/ ISO \033 for escape sequences Signed-off-by: Joachim Nilsson --- Makefile.am | 46 +++++++++++++++++++++++----------------------- conio.h | 16 ++++++++-------- tests/check.h | 4 ++-- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Makefile.am b/Makefile.am index 24dfc1b..a0cdf62 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,9 +3,9 @@ ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES = libite.la pkgincludedir = $(includedir)/lite pkginclude_HEADERS = lite.h queue.h conio.h tree.h strlite.h strdupa.h strndupa.h strnlen.h -libite_la_SOURCES = chomp.c copyfile.c dir.c fexist.c fisdir.c fmode.c fparseln.c \ - fsendfile.c ifconfig.c lfile.c makepath.c pidfile.c pidfilefn.c \ - progress.c reallocarray.c rsync.c strlcpy.c strlcat.c strtonum.c \ +libite_la_SOURCES = chomp.c copyfile.c dir.c fexist.c fisdir.c fmode.c fparseln.c \ + fsendfile.c ifconfig.c lfile.c makepath.c pidfile.c pidfilefn.c \ + progress.c reallocarray.c rsync.c strlcpy.c strlcat.c strtonum.c \ tempfile.c tree.c libite_la_CPPFLAGS = -D_GNU_SOURCE @@ -21,32 +21,32 @@ SUBDIRS = tests ## Generate MD5 checksum file MD5 = md5sum md5-dist: - @for file in $(DIST_ARCHIVES); do \ - $(MD5) $$file > $$file.md5; \ + @for file in $(DIST_ARCHIVES); do \ + $(MD5) $$file > $$file.md5; \ done ## Check if tagged in git release-hook: - if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ - echo; \ - printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ - printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ - if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ - printf "OK, aborting release.\n"; \ - exit 1; \ - fi; \ - echo; \ - else \ - echo; \ - printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \ - printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \ - echo; \ + if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ + echo; \ + printf "\033[1m\033[41mCannot find release tag $(PACKAGE_VERSION)\033[0m\n"; \ + printf "\033[1m\033[5mDo release anyway?\033[0m "; read yorn; \ + if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ + printf "OK, aborting release.\n"; \ + exit 1; \ + fi; \ + echo; \ + else \ + echo; \ + printf "\033[1m\033[42mFound GIT release tag $(PACKAGE_VERSION)\033[0m\n"; \ + printf "\033[1m\033[44m>>Remember to push tags!\033[0m\n"; \ + echo; \ fi ## Target to run when building a release release: dist release-hook md5-dist - @for file in $(DIST_ARCHIVES); do \ - printf "$$file \tDistribution tarball\n"; \ - printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \ - mv $$file* ../; \ + @for file in $(DIST_ARCHIVES); do \ + printf "$$file \tDistribution tarball\n"; \ + printf "$$file.md5\t"; cat $$file.md5 | cut -f1 -d' '; \ + mv $$file* ../; \ done diff --git a/conio.h b/conio.h index 8226f4c..2b10879 100644 --- a/conio.h +++ b/conio.h @@ -49,24 +49,24 @@ #define WHITE 0x17 /* Esc[2JEsc[1;1H - Clear screen and move cursor to 1,1 (upper left) pos. */ -#define clrscr() fputs ("\e[2J\e[1;1H", stdout) +#define clrscr() fputs ("\033[2J\033[1;1H", stdout) /* Esc[K - Erases from the current cursor position to the end of the current line. */ -#define clreol() fputs ("\e[K", stdout) +#define clreol() fputs ("\033[K", stdout) /* Esc[2K - Erases the entire current line. */ -#define delline() fputs ("\e[2K", stdout) +#define delline() fputs ("\033[2K", stdout) /* Esc[Line;ColumnH - Moves the cursor to the specified position (coordinates) */ -#define gotoxy(x,y) printf("\e[%d;%dH", y, x) +#define gotoxy(x,y) printf("\033[%d;%dH", y, x) /* Esc[?25l (lower case L) - Hide Cursor */ -#define hidecursor() fputs ("\e[?25l", stdout) +#define hidecursor() fputs ("\033[?25l", stdout) /* Esc[?25h (lower case H) - Show Cursor */ -#define showcursor() fputs ("\e[?25h", stdout) +#define showcursor() fputs ("\033[?25h", stdout) /* Esc[Value;...;Valuem - Set Graphics Mode */ #define __set_gm(attr,color,val) \ if (!color) \ - printf("\e[%dm", attr); \ + printf("\033[%dm", attr); \ else \ - printf("\e[%d;%dm", color & 0x10 ? 1 : 0, (color & 0xF) + val) + printf("\033[%d;%dm", color & 0x10 ? 1 : 0, (color & 0xF) + val) #define textattr(attr) __set_gm(attr, 0, 0) #define textcolor(color) __set_gm(RESETATTR, color, 30) #define textbackground(color) __set_gm(RESETATTR, color, 40) diff --git a/tests/check.h b/tests/check.h index 18e96ab..30c059a 100644 --- a/tests/check.h +++ b/tests/check.h @@ -25,8 +25,8 @@ static inline int test(int result, const char *fmt, ...) char buf[80]; size_t len; va_list ap; - const char success[] = " \e[1m[ OK ]\e[0m\n"; - const char failure[] = " \e[7m[FAIL]\e[0m\n"; + const char success[] = " \033[1m[ OK ]\033[0m\n"; + const char failure[] = " \033[7m[FAIL]\033[0m\n"; const char dots[] = " ....................................................................."; va_start(ap, fmt);