Conditional compilation of a debug statement
This commit is contained in:
parent
55abb46212
commit
3b8e2be53f
2
Makefile
2
Makefile
|
@ -11,7 +11,7 @@ OBJ = $(SRC:.c=.o)
|
|||
CC = gcc
|
||||
INCLUDE = .
|
||||
DEFINE = _GNU_SOURCE
|
||||
CFLAGS = -DNDEBUG -g3 -Wextra -Wstrict-prototypes -Wall -ansi -pedantic -I$(INCLUDE)
|
||||
CFLAGS = -g3 -Wextra -Wstrict-prototypes -Wall -ansi -pedantic -I$(INCLUDE)
|
||||
LIB = -lutil
|
||||
RM = rm -f
|
||||
|
||||
|
|
1
test.c
1
test.c
|
@ -13,6 +13,7 @@ void disp(struct vt100_headless *vt100)
|
|||
const char **lines;
|
||||
|
||||
lines = vt100_dump(vt100->term);
|
||||
write(1, "\n", 1);
|
||||
for (y = 0; y < vt100->term->height; ++y)
|
||||
{
|
||||
write(1, lines[y], vt100->term->width);
|
||||
|
|
|
@ -45,6 +45,7 @@ static void restore_termios(struct vt100_headless *this, int fd)
|
|||
/* fprintf(stderr, "\n"); */
|
||||
/* } */
|
||||
|
||||
#ifndef NDEBUG
|
||||
static void strdump(char *str)
|
||||
{
|
||||
while (*str != '\0')
|
||||
|
@ -57,6 +58,7 @@ static void strdump(char *str)
|
|||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
static int main_loop(struct vt100_headless *this)
|
||||
{
|
||||
|
@ -95,7 +97,9 @@ static int main_loop(struct vt100_headless *this)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
buffer[read_size] = '\0';
|
||||
#ifndef NDEBUG
|
||||
strdump(buffer);
|
||||
#endif
|
||||
terminal_read_str(this->term->terminal, buffer);
|
||||
this->changed(this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue