"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/page.c" between
tin-2.4.4.tar.xz and tin-2.4.5.tar.xz

About: TIN is a threaded NNTP and spool based UseNet newsreader.

page.c  (tin-2.4.4.tar.xz):page.c  (tin-2.4.5.tar.xz)
/* /*
* Project : tin - a Usenet reader * Project : tin - a Usenet reader
* Module : page.c * Module : page.c
* Author : I. Lea & R. Skrenta * Author : I. Lea & R. Skrenta
* Created : 1991-04-01 * Created : 1991-04-01
* Updated : 2019-07-10 * Updated : 2019-07-10
* Notes : * Notes :
* *
* Copyright (c) 1991-2020 Iain Lea <iain@bricbrac.de>, Rich Skrenta <skrenta@pb m.com> * Copyright (c) 1991-2021 Iain Lea <iain@bricbrac.de>, Rich Skrenta <skrenta@pb m.com>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
skipping to change at line 1287 skipping to change at line 1287
{ {
rewind(fp); rewind(fp);
while (fgets(buf, (int) sizeof(buf), fp) != NULL) while (fgets(buf, (int) sizeof(buf), fp) != NULL)
fputs(buf, mime_fp); fputs(buf, mime_fp);
fflush(mime_fp); fflush(mime_fp);
/* This is needed if we are viewing the raw art */ /* This is needed if we are viewing the raw art */
fseek(fp, offset, SEEK_SET); /* goto old position */ fseek(fp, offset, SEEK_SET); /* goto old position */
#ifdef DONT_HAVE_PIPING #ifdef DONT_HAVE_PIPING
snprintf(buf, sizeof(buf) -1, "%s %s", tinrc.metamail_prog, mimef ile); snprintf(buf, sizeof(buf) - 1, "%s %s", tinrc.metamail_prog, mime file);
invoke_cmd(buf); invoke_cmd(buf);
fclose(mime_fp); fclose(mime_fp);
unlink(mimefile); unlink(mimefile);
#else #else
pclose(mime_fp); pclose(mime_fp);
#endif /* DONT_HAVE_PIPING */ #endif /* DONT_HAVE_PIPING */
} else } else
perror_message(_(txt_command_failed), ptr); perror_message(_(txt_command_failed), ptr);
#ifdef USE_CURSES #ifdef USE_CURSES
skipping to change at line 1364 skipping to change at line 1364
right_len = 0; right_len = 0;
FreeIfNeeded(fmt_thread); FreeIfNeeded(fmt_thread);
FreeIfNeeded(fmt_resp); FreeIfNeeded(fmt_resp);
/* /*
* limit right_len to cCOLS / 3 * limit right_len to cCOLS / 3
*/ */
if (right_len > cCOLS / 3 + 1) if (right_len > cCOLS / 3 + 1)
right_len = cCOLS / 3 + 1; right_len = cCOLS / 3 + 1;
# ifdef HAVE_COLOR
fcol(tinrc.col_head);
# endif /* HAVE_COLOR */
/* /*
* first line * first line
*/ */
cur_pos = 0; cur_pos = 0;
# ifdef HAVE_COLOR
fcol(tinrc.col_head);
# endif /* HAVE_COLOR */
/* date */ /* date */
if ((wtmp = char2wchar_t(buf)) != NULL) { if ((wtmp = char2wchar_t(buf)) != NULL) {
my_fputws(wtmp, stdout); my_fputws(wtmp, stdout);
cur_pos += wcswidth(wtmp, wcslen(wtmp)); cur_pos += wcswidth(wtmp, wcslen(wtmp));
free(wtmp); free(wtmp);
} }
/* /*
* determine max len for centered group name * determine max len for centered group name
* allow one space before and after group name * allow one space before and after group name
skipping to change at line 1432 skipping to change at line 1432
# if 0 # if 0
/* display a ruler for layout checking purposes */ /* display a ruler for layout checking purposes */
my_fputs("....|....3....|....2....|....1....|....0....|....1....|....2... .|....3....|....\n", stdout); my_fputs("....|....3....|....2....|....1....|....0....|....1....|....2... .|....3....|....\n", stdout);
# endif /* 0 */ # endif /* 0 */
/* /*
* second line * second line
*/ */
cur_pos = 0; cur_pos = 0;
# ifdef HAVE_COLOR
fcol(tinrc.col_head);
# endif /* HAVE_COLOR */
/* line count */ /* line count */
if (arts[this_resp].line_count < 0) if (arts[this_resp].line_count < 0)
strcpy(buf, "?"); strcpy(buf, "?");
else else
snprintf(buf, line_len, "%-4d", arts[this_resp].line_count); snprintf(buf, line_len, "%-4d", arts[this_resp].line_count);
{ {
wchar_t *fmt; wchar_t *fmt;
if ((wtmp = char2wchar_t(_(txt_lines))) != NULL) { if ((wtmp = char2wchar_t(_(txt_lines))) != NULL) {
skipping to change at line 1478 skipping to change at line 1474
free(wtmp); free(wtmp);
free(wtmp2); free(wtmp2);
} }
} }
/* subject */ /* subject */
/* /*
* TODO: why do we fall back to arts[this_resp].subject if !note_h->subj? * TODO: why do we fall back to arts[this_resp].subject if !note_h->subj?
* if !note_h->subj then the article just has no subject, no matter * if !note_h->subj then the article just has no subject, no matter
* what the overview says. * what the overview says.
*
* add BiDi handling
*/ */
strncpy(buf, (note_h->subj ? note_h->subj : arts[this_resp].subject), lin e_len); strncpy(buf, (note_h->subj ? note_h->subj : arts[this_resp].subject), lin e_len);
buf[line_len - 1] = '\0'; buf[line_len - 1] = '\0';
if ((wtmp = char2wchar_t(buf)) != NULL) { if ((wtmp = char2wchar_t(buf)) != NULL) {
wbuf = wexpand_tab(wtmp, tabwidth); wbuf = wexpand_tab(wtmp, tabwidth);
wtmp2 = wstrunc(wbuf, cCOLS - 2 * right_len - 3); wtmp2 = wstrunc(wbuf, cCOLS - 2 * right_len - 3);
center_pos = (cCOLS - wcswidth(wtmp2, wcslen(wtmp2))) / 2; center_pos = (cCOLS - wcswidth(wtmp2, wcslen(wtmp2))) / 2;
/* pad out to left */ /* pad out to left */
for (; cur_pos < center_pos; cur_pos++) for (; cur_pos < center_pos; cur_pos++)
skipping to change at line 1540 skipping to change at line 1538
cur_pos = 0; cur_pos = 0;
# ifdef HAVE_COLOR # ifdef HAVE_COLOR
fcol(tinrc.col_from); fcol(tinrc.col_from);
# endif /* HAVE_COLOR */ # endif /* HAVE_COLOR */
/* from */ /* from */
/* /*
* TODO: don't use arts[this_resp].name/arts[this_resp].from * TODO: don't use arts[this_resp].name/arts[this_resp].from
* split up note_h->from and use that instead as it might * split up note_h->from and use that instead as it might
* be different _if_ the overviews are broken * be different _if_ the overviews are broken
*
* add BiDi handling
*/ */
{ {
char *p = idna_decode(arts[this_resp].from); char *p = idna_decode(arts[this_resp].from);
if (arts[this_resp].name) if (arts[this_resp].name)
snprintf(buf, line_len, "%s <%s>", arts[this_resp].name, p); snprintf(buf, line_len, "%s <%s>", arts[this_resp].name, p);
else { else {
strncpy(buf, p, line_len); strncpy(buf, p, line_len);
buf[line_len - 1] = '\0'; buf[line_len - 1] = '\0';
} }
skipping to change at line 1566 skipping to change at line 1566
cur_pos += wcswidth(wtmp2, wcslen(wtmp2)); cur_pos += wcswidth(wtmp2, wcslen(wtmp2));
free(wtmp2); free(wtmp2);
free(wtmp); free(wtmp);
} }
/* /*
* Organization * Organization
* *
* TODO: IDNA decoding, see also comment in * TODO: IDNA decoding, see also comment in
* cook.c:cook_article() * cook.c:cook_article()
* add BiDi handling
*/ */
if (note_h->org) { if (note_h->org) {
snprintf(buf, line_len, _(txt_at_s), note_h->org); snprintf(buf, line_len, _(txt_at_s), note_h->org);
if ((wtmp = char2wchar_t(buf)) != NULL) { if ((wtmp = char2wchar_t(buf)) != NULL) {
wbuf = wexpand_tab(wtmp, tabwidth); wbuf = wexpand_tab(wtmp, tabwidth);
wtmp2 = wstrunc(wbuf, cCOLS - cur_pos - 1); wtmp2 = wstrunc(wbuf, cCOLS - cur_pos - 1);
i = cCOLS - wcswidth(wtmp2, wcslen(wtmp2)) - 1; i = cCOLS - wcswidth(wtmp2, wcslen(wtmp2)) - 1;
for (; cur_pos < i; cur_pos++) for (; cur_pos < i; cur_pos++)
skipping to change at line 1596 skipping to change at line 1597
my_fputs(cCRLF, stdout); my_fputs(cCRLF, stdout);
#else /* !MULTIBYTE_ABLE || NO_LOCALE */ #else /* !MULTIBYTE_ABLE || NO_LOCALE */
/* /*
* determine the needed space for the text at the right hand margin * determine the needed space for the text at the right hand margin
* the formatting info (%4s) needs 3 positions but we need 4 positions * the formatting info (%4s) needs 3 positions but we need 4 positions
* on the screen for each counter * on the screen for each counter
*/ */
right_len = MAX((strlen(_(txt_thread_x_of_n)) - 6 + 8), (strlen(_(txt_art _x_of_n)) - 6 + 8)); right_len = MAX((strlen(_(txt_thread_x_of_n)) - 6 + 8), (strlen(_(txt_art _x_of_n)) - 6 + 8));
# ifdef HAVE_COLOR
fcol(tinrc.col_head);
# endif /* HAVE_COLOR */
/* /*
* first line * first line
*/ */
cur_pos = 0; cur_pos = 0;
# ifdef HAVE_COLOR
fcol(tinrc.col_head);
# endif /* HAVE_COLOR */
/* date */ /* date */
my_fputs(buf, stdout); my_fputs(buf, stdout);
cur_pos += strlen(buf); cur_pos += strlen(buf);
/* /*
* determine max len for centered group name * determine max len for centered group name
* allow one space before and after group name * allow one space before and after group name
*/ */
len = cCOLS - 2 * MAX(cur_pos, right_len) - 3; len = cCOLS - 2 * MAX(cur_pos, right_len) - 3;
skipping to change at line 1655 skipping to change at line 1656
# if 0 # if 0
/* display a ruler for layout checking purposes */ /* display a ruler for layout checking purposes */
my_fputs("....|....3....|....2....|....1....|....0....|....1....|....2... .|....3....|....\n", stdout); my_fputs("....|....3....|....2....|....1....|....0....|....1....|....2... .|....3....|....\n", stdout);
# endif /* 0 */ # endif /* 0 */
/* /*
* second line * second line
*/ */
cur_pos = 0; cur_pos = 0;
# ifdef HAVE_COLOR
fcol(tinrc.col_head);
# endif /* HAVE_COLOR */
/* line count */ /* line count */
/* an accurate line count will appear in the footer anymay */ /* an accurate line count will appear in the footer anymay */
if (arts[this_resp].line_count < 0) if (arts[this_resp].line_count < 0)
strcpy(buf, "?"); strcpy(buf, "?");
else else
snprintf(buf, line_len, "%-4d", arts[this_resp].line_count); snprintf(buf, line_len, "%-4d", arts[this_resp].line_count);
tmp = my_malloc(line_len); tmp = my_malloc(line_len);
snprintf(tmp, line_len, _(txt_lines), buf); snprintf(tmp, line_len, _(txt_lines), buf);
my_fputs(tmp, stdout); my_fputs(tmp, stdout);
 End of changes. 11 change blocks. 
18 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)