"Fossies" - the Fresh Open Source Software Archive  

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

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

nrctbl.c  (tin-2.4.3.tar.xz):nrctbl.c  (tin-2.4.4.tar.xz)
/* /*
* Project : tin - a Usenet reader * Project : tin - a Usenet reader
* Module : nrctbl.c * Module : nrctbl.c
* Author : Sven Paulus <sven@tin.org> * Author : Sven Paulus <sven@tin.org>
* Created : 1996-10-06 * Created : 1996-10-06
* Updated : 2009-07-17 * Updated : 2019-07-08
* Notes : This module does the NNTP server name lookup in * Notes : This module does the NNTP server name lookup in
* ~/.tin/newsrctable and returns the real hostname * ~/.tin/newsrctable and returns the real hostname
* and the name of the newsrc file for a given * and the name of the newsrc file for a given
* alias of the server. * alias of the server.
* *
* Copyright (c) 1996-2019 Sven Paulus <sven@tin.org> * Copyright (c) 1996-2020 Sven Paulus <sven@tin.org>
* 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, this list of conditions and the following disclaimer. * 1. Redistributions of source code must retain the above copyright notice,
* 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
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote *
* products derived from this software without specific prior written * 3. Neither the name of the copyright holder nor the names of its
* permission. * contributors may be used to endorse or promote products derived from
* * this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS *
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef TIN_H #ifndef TIN_H
# include "tin.h" # include "tin.h"
#endif /* !TIN_H */ #endif /* !TIN_H */
#ifndef TCURSES_H #ifndef TCURSES_H
# include "tcurses.h" # include "tcurses.h"
#endif /* !TCURSES_H */ #endif /* !TCURSES_H */
#ifndef VERSION_H #ifndef VERSION_H
# include "version.h" # include "version.h"
skipping to change at line 178 skipping to change at line 181
if (!strfpath(name_found, tmp_newsrc, sizeof(tmp_newsrc), NULL, FALSE)) { if (!strfpath(name_found, tmp_newsrc, sizeof(tmp_newsrc), NULL, FALSE)) {
my_fprintf(stderr, _("couldn't expand %s\n"), nam e_found); /* TODO: -> lang.c */ my_fprintf(stderr, _("couldn't expand %s\n"), nam e_found); /* TODO: -> lang.c */
error = 1; error = 1;
} else { } else {
if (tmp_newsrc[0] == '/') { if (tmp_newsrc[0] == '/') {
(void) strncpy(newsrc_name, tmp_newsrc, n ewsrc_name_len); (void) strncpy(newsrc_name, tmp_newsrc, n ewsrc_name_len);
newsrc_name[newsrc_name_len - 1] = '\0'; newsrc_name[newsrc_name_len - 1] = '\0';
} else } else
joinpath(newsrc_name, newsrc_name_len, ho medir, tmp_newsrc); joinpath(newsrc_name, newsrc_name_len, ho medir, tmp_newsrc);
}
STRCPY(dir, newsrc_name); STRCPY(dir, newsrc_name);
if (strchr(dir, '/')) if ((line_entry = strrchr(dir, '/'))) { /* dirnam
*strrchr(dir, '/') = (char) 0; e(newsrc_name) */
while (line_entry > &dir[0] && *line_entr
if (!error) { y == '/')
/* *line_entry-- = '\0';
* TODO: shall we create a missing dir? }
* currently something like
* ~/.tin/${NNTPSERVER-localhost}/.newsrc /*
* in newsrctable usually ends with * TODO: shall we create a missing dir?
* "No permissions to go into /home/urs/.tin/${NNTP * currently something like
SERVER}" * ~/.tin/${NNTPSERVER-localhost}/.newsrc
*/ * in newsrctable usually ends with
/* FIXME - write a global permssion check routine */ * "No permissions to go into /home/urs/.ti
n/${NNTPSERVER}"
*/
/* FIXME - write a global permssion check routine
*/
if (access(dir, X_OK)) { if (access(dir, X_OK)) {
my_fprintf(stderr, _(txt_error_no_enter_p ermission), dir); my_fprintf(stderr, _(txt_error_no_enter_p ermission), dir);
error = 1; error = 1;
} else if (access(newsrc_name, F_OK)) { } else if (access(newsrc_name, F_OK)) {
my_fprintf(stderr, _(txt_error_no_such_fi le), newsrc_name); my_fprintf(stderr, _(txt_error_no_such_fi le), newsrc_name);
error = 2; error = 2;
} else if (access(dir, R_OK)) { } else if (access(dir, R_OK)) {
my_fprintf(stderr, _(txt_error_no_read_pe rmission), dir); my_fprintf(stderr, _(txt_error_no_read_pe rmission), dir);
error = 1; error = 1;
} else if (access(newsrc_name, R_OK)) { } else if (access(newsrc_name, R_OK)) {
my_fprintf(stderr, _(txt_error_no_read_pe rmission), newsrc_name); my_fprintf(stderr, _(txt_error_no_read_pe rmission), newsrc_name);
error = 1; error = 1;
} else if (access(dir, W_OK)) { } else if (access(dir, W_OK)) {
my_fprintf(stderr, _(txt_error_no_write_p ermission), dir); my_fprintf(stderr, _(txt_error_no_write_p ermission), dir);
error = 1; error = 1;
} else if (access(newsrc_name, W_OK)) { } else if (access(newsrc_name, W_OK)) {
my_fprintf(stderr, _(txt_error_no_write_p ermission), newsrc_name); my_fprintf(stderr, _(txt_error_no_write_p ermission), newsrc_name);
error = 1; error = 1;
} }
} }
if (error) { if (error) {
char ch, default_ch = 'a'; char ch, default_ch = 'a';
do { do {
/* very ugly code, but curses is not init ialized yet */ /* very ugly code, but curses is not init ialized yet */
if (error >= 2) { if (error >= 2) {
default_ch = 'c'; default_ch = 'c';
printf("%s%c\b", _(txt_nrctbl_cre ate), default_ch); printf("%s%c\b", _(txt_nrctbl_cre ate), default_ch);
} else } else
printf("%s%c\b", _(txt_nrctbl_def ault), default_ch); printf("%s%c\b", _(txt_nrctbl_def ault), default_ch);
 End of changes. 6 change blocks. 
34 lines changed or deleted 42 lines changed or added

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