From 128768ae8030a8d7226b51ddfd6a066a313e1476 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Mon, 19 Aug 2024 15:44:04 +0200
Subject: fix make install

The DVI documentation needs not be made, it isn't installed anyway by default.
If needed, it is available in texlive_binextra_doc.

Also install the other man pages.

diff --git a/Makefile.in b/Makefile.in
index a0f81db..d1a5506 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -161,7 +161,7 @@ check: chktex $(srcdir)/$(TestOutFile) chktexrc
 chktex: $(OBJS)
 	$(CC) $(LDFLAGS) -o chktex $(OBJS) $(LIBS)
 
-install: chktex ChkTeX.dvi
+install: chktex
 	$(MKDIR_P) $(DESTDIR)$(bindir)
 	for program in chktex $(BUILT_SCRIPTS); do \
 		$(INSTALL_PROGRAM) $$program $(DESTDIR)$(bindir); \
@@ -173,6 +173,8 @@ install: chktex ChkTeX.dvi
 	$(INSTALL_DATA) $(srcdir)/chktexrc $(DESTDIR)$(sysconfdir)
 	if (eval echo "$(BUILT_SCRIPTS)") | egrep deweb >/dev/null 2>&1; then \
 		$(MKDIR_P) $(DESTDIR)$(mandir)/man1; \
+                cp $(srcdir)/chktex.1 $(DESTDIR)$(mandir)/man1; \
+                cp $(srcdir)/chkweb.1 $(DESTDIR)$(mandir)/man1; \
                 cp $(srcdir)/deweb.1 $(DESTDIR)$(mandir)/man1; \
 	fi
 
-- 
2.52.0


From e62933e1bc5a694dd66b37b13241bfbf03faa645 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Mon, 19 Aug 2024 17:23:59 +0200
Subject: gcc2 fixes


diff --git a/FindErrs.c b/FindErrs.c
index 21f8c5c..75aee92 100644
--- a/FindErrs.c
+++ b/FindErrs.c
@@ -351,6 +351,7 @@ static char *PreProcess(void)
 
                 EscapePtr = TmpPtr; /* Save it for later */
                 while ((TmpPtr = strstr(TmpPtr, FileSuppDelim))) {
+                    uint64_t errbit;
                     TmpPtr += STRLEN(FileSuppDelim);
                     error = atoi(TmpPtr);
 
@@ -358,7 +359,7 @@ static char *PreProcess(void)
                     {
                         PrintPrgErr(pmSuppTooHigh, error, MaxSuppressionBits);
                     }
-                    uint64_t errbit = ((uint64_t)1 << abs(error));
+                    errbit = ((uint64_t)1 << abs(error));
                     if (error > 0)
                     {
                         *(uint64_t *)StkTop(&FileSuppStack) |= errbit;
@@ -1140,19 +1141,19 @@ static void CheckDash(void)
                  * this on the first dash */
                 if (*TmpPtr != '-')
                 {
+                    struct WordList *el = &DashExcpt;
+
                     /* PrePtr now points to the beginning of the hyphenated phrase */
                     PrePtr = ++TmpPtr;
 
-                    struct WordList *el = &DashExcpt;
-
                     FORWL(i, *el)
                     {
                         char *e = el->Stack.Data[i];
+                        int FoundHyphenDiff = FALSE;
                         TmpPtr = PrePtr;
 
                         /* Walk through the strings until we find a
                          * mismatch.  */
-                        int FoundHyphenDiff = FALSE;
                         while (*e && *TmpPtr && *e == *TmpPtr)
                         {
                             /* Skip past characters that are the same */
diff --git a/OpSys.c b/OpSys.c
index 67e2bea..4645966 100644
--- a/OpSys.c
+++ b/OpSys.c
@@ -484,6 +484,8 @@ static int HasFile(char *Dir, const char *Filename, const char *App)
 
 void AddDirectoryFromRelativeFile(const char * Filename, struct WordList *TeXInputs)
 {
+    char buf[BUFFER_SIZE];
+    char * end;
     if ( ! Filename )
         return;
 
@@ -492,7 +494,6 @@ void AddDirectoryFromRelativeFile(const char * Filename, struct WordList *TeXInp
         return;
 
 
-    char buf[BUFFER_SIZE];
     if ( strchr(DIRCHARS,Filename[0]) ) {
         strcpy(buf,Filename);
     } else {
@@ -501,7 +502,7 @@ void AddDirectoryFromRelativeFile(const char * Filename, struct WordList *TeXInp
     }
 
     /* Keep up to the final SLASH -- that will be the directory. */
-    char * end = strrchr(buf,SLASH);
+    end = strrchr(buf,SLASH);
     *end = '\0';
     InsertWord(buf,TeXInputs);
 }
-- 
2.52.0


From 1d70263b2d74779720c013c6f1c309750ad71c20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Thu, 2 Apr 2026 19:38:43 +0200
Subject: fix build, using and linking ncurses properly for termcap


diff --git a/OpSys.c b/OpSys.c
index 4645966..b8c65aa 100644
--- a/OpSys.c
+++ b/OpSys.c
@@ -73,7 +73,7 @@
 #  define USE_RECURSE 0
 #endif
 
-#if defined(HAVE_LIBTERMCAP) || defined(HAVE_LIBTERMLIB)
+#if defined(HAVE_TERMCAP_H) || defined(HAVE_TERMLIB_H)
 #  define USE_TERMCAP 1
 #endif
 
diff --git a/configure.ac b/configure.ac
index bedb46b..c1996f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,7 +123,7 @@ AC_PATH_PROG(LYNX, lynx)
 AC_PATH_PROG(LATEX2HTML, latex2html)
 
 dnl Checks for libraries.
-AC_SEARCH_LIBS(tgetent, [termcap termlib], [], [AC_MSG_ERROR([termcap library not found])])
+AC_SEARCH_LIBS(tgetent, [termcap termlib ncursesw], [], [AC_MSG_ERROR([termcap library not found])])
 
 AC_HEADER_DIRENT
 AC_CHECK_HEADERS(limits.h stat.h strings.h stdarg.h dnl
@@ -151,7 +151,7 @@ if test "$enable_pcre" = "yes"; then
   if test "$WITH_PCRE" = "yes"; then
     AC_DEFINE(HAVE_PCRE, 1, Whether PCRE can be used for user warnings.)
     CFLAGS="${CFLAGS} $(pcre-config --cflags-posix)"
-    LIBS="$(pcre-config --libs-posix)"
+    LIBS+="$(pcre-config --libs-posix)"
   else
     AC_DEFINE(HAVE_PCRE, 0)
     AC_MSG_WARN(PCRE library not found.)
-- 
2.52.0


From 1e7372836d0f6ba36792f9bcac724d491c44fa52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
Date: Thu, 2 Apr 2026 19:57:58 +0200
Subject: fix broken test


diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 8d0b4aa..95a1da2 100755
--- a/tests/run-tests.sh
+++ b/tests/run-tests.sh
@@ -132,6 +132,6 @@ echo ">>> OK!"
 # Command line options
 echo "Checking command line RC settings..."
 (${builddir}/chktex -d 4 -STabSize=7 </dev/null 2>&1 \
-     | grep -A1 TabSize | grep -E '\t7$' >/dev/null) \
+     | grep -A1 TabSize | grep -E '	7$' >/dev/null) \
     || (echo Setting TabSize from command line failed; exit 1)
 echo ">>> OK!"
-- 
2.52.0

