[tin-dev] [PATCH] active-file if reading from local spool

Urs Janßen urs at tin.org
Tue Nov 14 20:26:23 CET 2023


- don't prepend libdir to $TIN_ACTIVEFILE if it starts with '/'
- give detailed erro if open fails

=== modified file 'src/active.c'
--- old/src/active.c	2023-11-06 12:03:47 +0000
+++ new/src/active.c	2023-11-14 18:30:49 +0000
@@ -621,17 +621,20 @@
 		wait_message(0, _(txt_reading_news_active_file));
 
 	if ((fp = open_news_active_fp()) == NULL) {
-		if (cmd_line && !batch_mode)
+		if ((cmd_line && !batch_mode) || verbose)
 			my_fputc('\n', stderr);
 
 #ifdef NNTP_ABLE
 		if (read_news_via_nntp)
 			tin_done(EXIT_FAILURE, _(txt_cannot_retrieve), ACTIVE_FILE);
 #	ifndef NNTP_ONLY
-		else
+		else {
+			perror_message("%s", news_active_file);
 			tin_done(EXIT_FAILURE, _(txt_cannot_open_active_file), news_active_file, tin_progname);
+		}
 #	endif /* !NNTP_ONLY */
 #else
+		perror_message("%s", news_active_file);
 		tin_done(EXIT_FAILURE, _(txt_cannot_open), news_active_file);
 #endif /* NNTP_ABLE */
 	}

=== modified file 'src/init.c'
--- old/src/init.c	2023-11-12 18:48:49 +0000
+++ new/src/init.c	2023-11-14 17:55:19 +0000
@@ -826,8 +826,15 @@
 	 * TODO: do we really want that read_site_config() overwrites
 	 * values given in env-vars? ($MM_CHARSET, $TIN_ACTIVEFILE)
 	 */
-	if (!*news_active_file) /* TODO: really prepend libdir here in case of $TIN_ACTIVEFILE is set? */
-		joinpath(news_active_file, sizeof(news_active_file), libdir, get_val("TIN_ACTIVEFILE", ACTIVE_FILE));
+	if (!*news_active_file) {
+		const char *p;
+
+		p = get_val("TIN_ACTIVEFILE", ACTIVE_FILE);
+		if (*p != '/')
+			joinpath(news_active_file, sizeof(news_active_file), libdir, p);
+		else
+			my_strncpy(news_active_file, p, sizeof(news_active_file) - 1);
+	}
 	if (!*active_times_file)
 		joinpath(active_times_file, sizeof(active_times_file), libdir, ACTIVE_TIMES_FILE);
 	if (!*newsgroups_file)




More information about the tin-dev mailing list