[tin-dev] [PATCH] nntplib.c: strings moved to lang.c
Dennis Preiser
dennis at d--p.de
Tue Nov 14 15:17:23 CET 2023
I've moved strings from nntplib.c to lang.c.
Dennis
-------------- next part --------------
--- a/include/extern.h
+++ b/include/extern.h
@@ -624,9 +624,28 @@ extern constext txt_conninfo_saved_news[];
extern constext txt_conninfo_subscriptions_file[];
#endif /* !NNTP_ONLY */
#ifdef NNTP_ABLE
+ extern constext txt_conninfo_compress[];
+ extern constext txt_conninfo_conn_details[];
+# ifdef USE_ZLIB
+ extern constext txt_conninfo_deflate[];
+ extern constext txt_conninfo_enabled[];
+ extern constext txt_conninfo_inactive[];
+# else
+ extern constext txt_conninfo_deflate_unsupported[];
+# endif /* USE_ZLIB */
+# if defined(HAVE_ALARM) && defined(SIGALRM)
+ extern constext txt_conninfo_disabled[];
+ extern constext txt_conninfo_timeout[];
+# endif /* HAVE_ALARM && SIGALRM */
+ extern constext txt_conninfo_implementation[];
+# if defined(MAXARTNUM) && defined(USE_LONG_ARTICLE_NUMBERS)
+ extern constext txt_conninfo_maxartnum[];
+# endif /* MAXARTNUM && USE_LONG_ARTICLE_NUMBERS */
extern constext txt_conninfo_nntp[];
+ extern constext txt_conninfo_port[];
extern constext txt_conninfo_ro[];
extern constext txt_conninfo_rw[];
+ extern constext txt_conninfo_server[];
# ifdef NNTPS_ABLE
extern constext txt_conninfo_nntps[];
extern constext txt_conninfo_trusted[];
--- a/src/lang.c
+++ b/src/lang.c
@@ -183,9 +183,28 @@ constext txt_conninfo_saved_news[] = N_("Reading saved news.\n");
constext txt_conninfo_subscriptions_file[] = "SUBSCRIPTIONS_FILE: %s\n";
#endif /* !NNTP_ONLY */
#ifdef NNTP_ABLE
+ constext txt_conninfo_compress[] = N_("COMPRESS :");
+ constext txt_conninfo_conn_details[] = N_("\nConnection details:\n-------------------\n");
+# ifdef USE_ZLIB
+ extern constext txt_conninfo_deflate[] = N_(" DEFLATE %s\n");
+ extern constext txt_conninfo_enabled[] = N_("(enabled)");
+ extern constext txt_conninfo_inactive[] = N_("(inactive)");
+# else
+ extern constext txt_conninfo_deflate_unsupported[] = N_(" DEFLATE (not supported)\n");
+# endif /* USE_ZLIB */
+# if defined(HAVE_ALARM) && defined(SIGALRM)
+ extern constext txt_conninfo_disabled[] = N_("(disabled)");
+ extern constext txt_conninfo_timeout[] = N_("NNTP TIMEOUT : %d seconds %s\n");
+# endif /* HAVE_ALARM && SIGALRM */
+ constext txt_conninfo_implementation[] = N_("IMPLEMENTATION: %s\n");
+# if defined(MAXARTNUM) && defined(USE_LONG_ARTICLE_NUMBERS)
+ constext txt_conninfo_maxartnum[] = N_("MAXARTNUM : %s\n");
+# endif /* MAXARTNUM && USE_LONG_ARTICLE_NUMBERS */
constext txt_conninfo_nntp[] = N_("Reading via NNTP (%s).\n");
+ constext txt_conninfo_port[] = N_("NNTPPORT : %u\n");
constext txt_conninfo_ro[] = N_("read only");
constext txt_conninfo_rw[] = N_("read/write");
+ constext txt_conninfo_server[] = N_("NNTPSERVER : %s\n");
# ifdef NNTPS_ABLE
constext txt_conninfo_nntps[] = N_("Reading %s via NNTPS (%s; ");
constext txt_conninfo_trusted[] = N_("trusted");
--- a/src/nntplib.c
+++ b/src/nntplib.c
@@ -2665,30 +2665,35 @@ nntp_conninfo(
{
int retval = 0;
- fprintf(stream, "\nConnection details:\n");
- fprintf(stream, "-------------------\n");
- fprintf(stream, "NNTPSERVER : %s\n", nntp_server);
- fprintf(stream, "NNTPPORT : %u\n", nntp_tcp_port);
+ fprintf(stream, "%s", _(txt_conninfo_conn_details));
+ fprintf(stream, _(txt_conninfo_server), nntp_server);
+ fprintf(stream, _(txt_conninfo_port), nntp_tcp_port);
if (nntp_caps.type == CAPABILITIES) {
if (*nntp_caps.implementation)
- fprintf(stream, "IMPLEMENTATION: %s\n", nntp_caps.implementation);
+ fprintf(stream, _(txt_conninfo_implementation), nntp_caps.implementation);
if (nntp_caps.compress) {
- fprintf(stream, "COMPRESS :");
+ fprintf(stream, "%s", _(txt_conninfo_compress));
if ((nntp_caps.compress_algorithm & COMPRESS_DEFLATE) == COMPRESS_DEFLATE)
# ifdef USE_ZLIB
- fprintf(stream, " DEFLATE %s\n", deflate_active ? "(enabled)" : "(inactive)");
+ fprintf(stream, _(txt_conninfo_deflate), deflate_active ? _(txt_conninfo_enabled) : _(txt_conninfo_inactive));
# else
- fprintf(stream, " DEFLATE (not supported)\n");
+ fprintf(stream, "%s", _(txt_conninfo_deflate_unsupported));
# endif /* USE_ZLIB */
}
# if defined(MAXARTNUM) && defined(USE_LONG_ARTICLE_NUMBERS)
- if (nntp_caps.maxartnum)
- fprintf(stream, "MAXARTNUM : %"T_ARTNUM_PFMT"\n", nntp_caps.maxartnum);
+ if (nntp_caps.maxartnum) {
+ size_t len = snprintf(NULL, 0, "%"T_ARTNUM_PFMT, nntp_caps.maxartnum) + 1;
+ char *buf = my_malloc(len);
+
+ snprintf(buf, len, "%"T_ARTNUM_PFMT, nntp_caps.maxartnum);
+ fprintf(stream, _(txt_conninfo_maxartnum), buf);
+ free(buf);
+ }
# endif /* MAXARTNUM && USE_LONG_ARTICLE_NUMBERS */
}
# if defined(HAVE_ALARM) && defined(SIGALRM)
- fprintf(stream, "NNTP TIMEOUT : %d seconds %s\n", TIN_NNTP_TIMEOUT, TIN_NNTP_TIMEOUT ? "" : "(disabled)");
+ fprintf(stream, _(txt_conninfo_timeout), TIN_NNTP_TIMEOUT, TIN_NNTP_TIMEOUT ? "" : _(txt_conninfo_disabled));
# endif /* HAVE_ALARM && SIGALRM */
# ifdef NNTPS_ABLE
More information about the tin-dev
mailing list