Conditional compilation of a debug statement

This commit is contained in:
Julien Palard 2011-09-22 20:17:27 +02:00
parent 55abb46212
commit 3b8e2be53f
3 changed files with 6 additions and 1 deletions

View File

@ -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
View File

@ -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);

View File

@ -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);
}