From: Karel Zak Date: Thu, 24 Jan 2013 18:27:12 +0000 (+0100) Subject: more: allow to compile as non-interactive test_more program X-Git-Tag: v2.23-rc1~322 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=951666e9f337974a5ffa5097b5613881a23ddd47;p=thirdparty%2Futil-linux.git more: allow to compile as non-interactive test_more program Signed-off-by: Karel Zak --- diff --git a/text-utils/Makemodule.am b/text-utils/Makemodule.am index 050343eb78..6ddec56b37 100644 --- a/text-utils/Makemodule.am +++ b/text-utils/Makemodule.am @@ -87,5 +87,11 @@ else more_LDADD += -ltermcap endif endif + +check_PROGRAMS += test_more +test_more_SOURCES = $(more_SOURCES) +test_more_CFLAGS = -DTEST_PROGRAM +test_more_LDADD = $(more_LDADD) + endif # BUILD_MORE diff --git a/text-utils/more.c b/text-utils/more.c index 41caeb1943..f0b0f67db9 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -68,6 +68,10 @@ #include +#ifdef TEST_PROGRAM +# define NON_INTERACTIVE_MORE 1 +#endif + #ifndef XTABS # define XTABS TAB3 #endif @@ -1759,7 +1763,10 @@ void initterm(void) #ifdef do_SIGTTOU retry: #endif + +#ifndef NON_INTERACTIVE_MORE no_tty = tcgetattr(fileno(stdout), &otty); +#endif if (!no_tty) { docrterase = (otty.c_cc[VERASE] != 255); docrtkill = (otty.c_cc[VKILL] != 255);