Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From 93b9b1e521748665423964c660c9b6fd259cbf6f Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Sun, 21 Feb 2021 16:02:07 +0000A
>Subject: [PATCH] db.c: add "keep_active_file" and "only_newsrc_groups" and use
> them

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 db.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/db.c b/db.c
index cfe979d..4278dda 100644
--- a/db.c
+++ b/db.c
@@ -98,6 +98,8 @@ extern char
                *master_directory, *db_directory, *db_data_directory, 
*news_directory, *news_lib_directory;
 extern int      db_data_subdirs, new_group_action;
 
+int             keep_active_file = 0;
+
 master_header   master;
 
 #ifdef MALLOC_64K_LIMITATION
@@ -533,6 +535,9 @@ make_master_copy(int force_copy)
 /*
  *     Init the groups data from active file.
  */
+
+int             only_newsrc_groups = 0;
+
 void
 open_master(int mode)
 {
@@ -543,7 +548,11 @@ open_master(int mode)
     active_groups = NULL;
     sorted_groups = NULL;
 
-    readactfile();             /* Read in the active file - count groups */
+    if (only_newsrc_groups)
+       readpartactfile();
+    else
+       readactfile();          /* Read in the active file - count groups */
+
     readtimfile();             /* Read the newsgroup creation time file */
 
     db_expand_master();                /* uses count from readact() call! */
@@ -1007,6 +1016,7 @@ readactfile(void)
     int             i;
     FILE           *actfp;
     stlist_t       *sthead, *stp = NULL;
+    extern int      keep_active_file;
 
     if (actlist != NULL)
        return;
@@ -1028,6 +1038,19 @@ readactfile(void)
      * groups we can use for internal tables.
      */
     sthead = NULL;
+    gotoxy(0, 3);
+    tprintf("Reading active file ... ");
+    fflush(stdout);
+
+    if (nntp_debug || keep_active_file) {
+       if (f_user == NULL) {
+           f_user = open_file(relative(active_directory, "ACTIVE"), 
OPEN_CREATE);
+           if (f_user == NULL) {
+               msg("Could not open file in the %s directoy for writing the 
active file, %s%s%d\n",
+                    active_directory, __FILE__, ":", __LINE__);
+           }
+        }
+    }
 
 #ifdef NNTP
     while (use_nntp ? nntp_fgets(actline, sizeof actline)
@@ -1037,6 +1060,9 @@ readactfile(void)
 #endif                         /* NNTP */
 
     {
+       if ( (nntp_debug || keep_active_file) && (f_user != NULL))
+           fprintf(f_user, "%s\n", actline);
+
        stlist_t       *stnew = (stlist_t *) strkeep(actline, 
sizeof(stlisthdr_t), POOL_ACT);
        if (stnew == NULL) {
            nn_exitmsg(1, "out of mem for active file (at line %d)\n", count + 
1);
-- 
2.30.0



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to