]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
more: allow to compile as non-interactive test_more program
authorKarel Zak <kzak@redhat.com>
Thu, 24 Jan 2013 18:27:12 +0000 (19:27 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 24 Jan 2013 18:27:12 +0000 (19:27 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
text-utils/Makemodule.am
text-utils/more.c

index 050343eb7828288bc712dd2c071f7f7b2a34d598..6ddec56b37d4a446d2b6cddbd18d7601fe1f1cd5 100644 (file)
@@ -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
 
index 41caeb1943908d71a8ef423421d1c74727c3de90..f0b0f67db928a1b646bdba7f987aa77cbd2b372f 100644 (file)
 
 #include <regex.h>
 
+#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);