add color-free binary build target "tionc"

This commit is contained in:
William Alexander 2022-01-29 09:58:23 +00:00
parent 95389f4dde
commit fc79fea777
3 changed files with 31 additions and 1 deletions

2
.gitignore vendored
View file

@ -1,6 +1,7 @@
*.tar.xz
src/*.o
src/tio
src/tionc
Makefile.in
Makefile
aclocal.m4
@ -22,3 +23,4 @@ src/include/stamp-h1
*.swp
/tio-*
/src/bash-completion/tio
\#*

View file

@ -1,6 +1,6 @@
AM_CPPFLAGS = -I$(srcdir)/include
AM_CFLAGS = -Wall
bin_PROGRAMS = tio
bin_PROGRAMS = tio tionc
tio_SOURCES = tty.c \
options.c \
time.c \
@ -14,8 +14,24 @@ tio_SOURCES = tty.c \
include/tio/log.h \
include/tio/error.h
tionc_SOURCES = tty.c \
options.c \
time.c \
main.c \
log.c \
error.c \
include/tio/tty.h \
include/tio/options.h \
include/tio/time.h \
include/tio/print.h \
include/tio/log.h \
include/tio/error.h
tionc_CFLAGS = -D TIO_NOCOLOR
if ADD_SETSPEED2
tio_SOURCES += setspeed2.c
tionc_SOURCES += setspeed2.c
endif
if ENABLE_BASH_COMPLETION

View file

@ -22,6 +22,17 @@
#ifndef PRINT_H
#define PRINT_H
#ifdef TIO_NOCOLOR
#define ANSI_COLOR_GRAY ""
#define ANSI_COLOR_RED ""
#define ANSI_COLOR_GREEN ""
#define ANSI_COLOR_YELLOW ""
#define ANSI_COLOR_BLUE ""
#define ANSI_COLOR_PINK ""
#define ANSI_COLOR_CYAN ""
#define ANSI_COLOR_WHITE ""
#define ANSI_COLOR_RESET ""
#else
#define ANSI_COLOR_GRAY "\x1b[1;30m"
#define ANSI_COLOR_RED "\x1b[1;31m"
#define ANSI_COLOR_GREEN "\x1b[1;32m"
@ -31,6 +42,7 @@
#define ANSI_COLOR_CYAN "\x1b[1;36m"
#define ANSI_COLOR_WHITE "\x1b[1;37m"
#define ANSI_COLOR_RESET "\x1b[0m"
#endif
#define color_printf(format, args...) \
{ \