Shorten source filenames
This commit is contained in:
parent
c8df7b657d
commit
5604d30c00
|
@ -15,7 +15,7 @@
|
|||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "main.h"
|
||||
#include "categories.h"
|
||||
#include "cat.h"
|
||||
|
||||
// Compare global category list with string categoryname and return 1 if a
|
||||
// matching category was found.
|
|
@ -68,7 +68,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "os-support.h"
|
||||
#ifdef LOCALEPATH
|
||||
#include <libintl.h>
|
||||
#define _(String) gettext (String)
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "main.h"
|
||||
#include "conversions.h"
|
||||
#include "ui-support.h"
|
||||
#include "conv.h"
|
||||
#include "uiutil.h"
|
||||
#include <ctype.h>
|
||||
#include <iconv.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
#include <langinfo.h>
|
||||
|
@ -31,6 +32,68 @@ static int calcAgeInDays (const struct tm* t);
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// This is a replacement for strsep which is not portable (missing on Solaris).
|
||||
//
|
||||
// http://www.winehq.com/hypermail/wine-patches/2001/11/0024.html
|
||||
//
|
||||
// The following function was written by Francois Gouget.
|
||||
#ifdef SUN
|
||||
char* strsep (char** str, const char* delims)
|
||||
{
|
||||
if (!*str) // No more tokens
|
||||
return NULL;
|
||||
char* token = *str;
|
||||
while (**str) {
|
||||
if (strchr (delims, **str)) {
|
||||
*(*str)++ = '\0';
|
||||
return token;
|
||||
}
|
||||
++(*str);
|
||||
}
|
||||
// There is no other token
|
||||
*str = NULL;
|
||||
return token;
|
||||
}
|
||||
|
||||
// timegm() is not available on Solaris
|
||||
static time_t timegm (struct tm* t)
|
||||
{
|
||||
time_t tl = mktime (t);
|
||||
if (tl == -1) {
|
||||
--t->tm_hour;
|
||||
tl = mktime (t);
|
||||
if (tl == -1)
|
||||
return -1; // can't deal with output from strptime
|
||||
tl += 3600;
|
||||
}
|
||||
struct tm* tg = gmtime (&tl);
|
||||
tg->tm_isdst = 0;
|
||||
time_t tb = mktime (tg);
|
||||
if (tb == -1) {
|
||||
--tg->tm_hour;
|
||||
tb = mktime (tg);
|
||||
if (tb == -1)
|
||||
return -1; // can't deal with output from gmtime
|
||||
tb += 3600;
|
||||
}
|
||||
return tl - (tb - tl);
|
||||
}
|
||||
#endif
|
||||
|
||||
// strcasestr stolen from: http://www.unixpapa.com/incnote/string.html
|
||||
const char* s_strcasestr (const char* a, const char* b)
|
||||
{
|
||||
const size_t lena = strlen (a), lenb = strlen (b);
|
||||
char f[3];
|
||||
snprintf (f, sizeof (f), "%c%c", tolower (*b), toupper (*b));
|
||||
for (size_t l = strcspn (a, f); l != lena; l += strcspn (a + l + 1, f) + 1)
|
||||
if (strncasecmp (a + l, b, lenb) == 0)
|
||||
return a + l;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
char* iconvert (const char* inbuf)
|
||||
{
|
||||
iconv_t cd; // Iconvs conversion descriptor.
|
|
@ -17,6 +17,7 @@
|
|||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#pragma once
|
||||
#include "config.h"
|
||||
|
||||
char* iconvert (const char* inbuf);
|
||||
char* UIDejunk (const char* feed_description);
|
||||
|
@ -27,3 +28,7 @@ char* genItemHash (const char* const* hashitems, unsigned items);
|
|||
time_t ISODateToUnix (const char* ISODate);
|
||||
time_t pubDateToUnix (const char* pubDate);
|
||||
char* unixToPostDateString (time_t unixDate);
|
||||
const char* s_strcasestr (const char* a, const char* b);
|
||||
#ifdef SUN
|
||||
char* strsep (char** str, const char* delims);
|
||||
#endif
|
11
dialog.c
11
dialog.c
|
@ -1,6 +1,7 @@
|
|||
// This file is part of Snownews - A lightweight console RSS newsreader
|
||||
//
|
||||
// Copyright (c) 2003-2004 Oliver Feiler <kiza@kcore.de>
|
||||
// Copyright (c) 2021 Mike Sharov <msharov@users.sourceforge.net>
|
||||
//
|
||||
// Snownews is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 3
|
||||
|
@ -16,12 +17,12 @@
|
|||
|
||||
#include "dialog.h"
|
||||
#include "main.h"
|
||||
#include "categories.h"
|
||||
#include "conversions.h"
|
||||
#include "cat.h"
|
||||
#include "conv.h"
|
||||
#include "filters.h"
|
||||
#include "io-internal.h"
|
||||
#include "ui-support.h"
|
||||
#include "parsefeed.h"
|
||||
#include "feedio.h"
|
||||
#include "uiutil.h"
|
||||
#include "parse.h"
|
||||
#include <ncurses.h>
|
||||
|
||||
char* UIOneLineEntryField (int x, int y)
|
||||
|
|
|
@ -15,13 +15,12 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "io-internal.h"
|
||||
#include "conversions.h"
|
||||
#include "feedio.h"
|
||||
#include "conv.h"
|
||||
#include "filters.h"
|
||||
#include "io-internal.h"
|
||||
#include "netio.h"
|
||||
#include "ui-support.h"
|
||||
#include "parsefeed.h"
|
||||
#include "uiutil.h"
|
||||
#include "parse.h"
|
||||
#include <ncurses.h>
|
||||
#include <libxml/parser.h>
|
||||
|
|
@ -15,7 +15,8 @@
|
|||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "filters.h"
|
||||
#include "ui-support.h"
|
||||
#include "uiutil.h"
|
||||
#include "conv.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
|
6
main.c
6
main.c
|
@ -16,10 +16,10 @@
|
|||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "main.h"
|
||||
#include "interface.h"
|
||||
#include "io-internal.h"
|
||||
#include "ui.h"
|
||||
#include "feedio.h"
|
||||
#include "setup.h"
|
||||
#include "ui-support.h"
|
||||
#include "uiutil.h"
|
||||
#include <ncurses.h>
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
|
|
2
netio.c
2
netio.c
|
@ -16,7 +16,7 @@
|
|||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "netio.h"
|
||||
#include "ui-support.h"
|
||||
#include "uiutil.h"
|
||||
#include <curl/curl.h>
|
||||
|
||||
static size_t FeedReceiver (void* buffer, size_t msz, size_t nm, void* vpfeed)
|
||||
|
|
79
os-support.c
79
os-support.c
|
@ -1,79 +0,0 @@
|
|||
// This file is part of Snownews - A lightweight console RSS newsreader
|
||||
//
|
||||
// Copyright (c) 2003-2004 Oliver Feiler <kiza@kcore.de>
|
||||
//
|
||||
// Snownews is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 3
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// Snownews is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "config.h"
|
||||
#include <ctype.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// This is a replacement for strsep which is not portable (missing on Solaris).
|
||||
//
|
||||
// http://www.winehq.com/hypermail/wine-patches/2001/11/0024.html
|
||||
//
|
||||
// The following function was written by Francois Gouget.
|
||||
#ifdef SUN
|
||||
char* strsep (char** str, const char* delims)
|
||||
{
|
||||
if (!*str) // No more tokens
|
||||
return NULL;
|
||||
char* token = *str;
|
||||
while (**str) {
|
||||
if (strchr (delims, **str)) {
|
||||
*(*str)++ = '\0';
|
||||
return token;
|
||||
}
|
||||
++(*str);
|
||||
}
|
||||
// There is no other token
|
||||
*str = NULL;
|
||||
return token;
|
||||
}
|
||||
|
||||
// timegm() is not available on Solaris
|
||||
time_t timegm (struct tm* t)
|
||||
{
|
||||
time_t tl = mktime (t);
|
||||
if (tl == -1) {
|
||||
--t->tm_hour;
|
||||
tl = mktime (t);
|
||||
if (tl == -1)
|
||||
return -1; // can't deal with output from strptime
|
||||
tl += 3600;
|
||||
}
|
||||
struct tm* tg = gmtime (&tl);
|
||||
tg->tm_isdst = 0;
|
||||
time_t tb = mktime (tg);
|
||||
if (tb == -1) {
|
||||
--tg->tm_hour;
|
||||
tb = mktime (tg);
|
||||
if (tb == -1)
|
||||
return -1; // can't deal with output from gmtime
|
||||
tb += 3600;
|
||||
}
|
||||
return tl - (tb - tl);
|
||||
}
|
||||
#endif
|
||||
|
||||
// strcasestr stolen from: http://www.unixpapa.com/incnote/string.html
|
||||
const char* s_strcasestr (const char* a, const char* b)
|
||||
{
|
||||
const size_t lena = strlen (a), lenb = strlen (b);
|
||||
char f[3];
|
||||
snprintf (f, sizeof (f), "%c%c", tolower (*b), toupper (*b));
|
||||
for (size_t l = strcspn (a, f); l != lena; l += strcspn (a + l + 1, f) + 1)
|
||||
if (strncasecmp (a + l, b, lenb) == 0)
|
||||
return a + l;
|
||||
return NULL;
|
||||
}
|
24
os-support.h
24
os-support.h
|
@ -1,24 +0,0 @@
|
|||
// This file is part of Snownews - A lightweight console RSS newsreader
|
||||
//
|
||||
// Copyright (c) 2003-2004 Oliver Feiler <kiza@kcore.de>
|
||||
//
|
||||
// Snownews is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 3
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// Snownews is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
// See the GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef SUN
|
||||
char* strsep (char** str, const char* delims);
|
||||
time_t timegm (struct tm* t);
|
||||
#endif
|
||||
|
||||
const char* s_strcasestr (const char* a, const char* b);
|
|
@ -16,8 +16,8 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "parsefeed.h"
|
||||
#include "conversions.h"
|
||||
#include "parse.h"
|
||||
#include "conv.h"
|
||||
#include <libxml/parser.h>
|
||||
|
||||
//{{{ Local variables --------------------------------------------------
|
8
setup.c
8
setup.c
|
@ -1,6 +1,7 @@
|
|||
// This file is part of Snownews - A lightweight console RSS newsreader
|
||||
//
|
||||
// Copyright (c) 2003-2004 Oliver Feiler <kiza@kcore.de>
|
||||
// Copyright (c) 2021 Mike Sharov <msharov@users.sourceforge.net>
|
||||
//
|
||||
// Snownews is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 3
|
||||
|
@ -16,9 +17,10 @@
|
|||
|
||||
#include "setup.h"
|
||||
#include "main.h"
|
||||
#include "categories.h"
|
||||
#include "io-internal.h"
|
||||
#include "ui-support.h"
|
||||
#include "cat.h"
|
||||
#include "feedio.h"
|
||||
#include "uiutil.h"
|
||||
#include "conv.h"
|
||||
#include <ncurses.h>
|
||||
|
||||
// Load browser command from ~./snownews/browser.
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "interface.h"
|
||||
#include "ui.h"
|
||||
#include "main.h"
|
||||
#include "about.h"
|
||||
#include "categories.h"
|
||||
#include "conversions.h"
|
||||
#include "cat.h"
|
||||
#include "conv.h"
|
||||
#include "dialog.h"
|
||||
#include "io-internal.h"
|
||||
#include "feedio.h"
|
||||
#include "setup.h"
|
||||
#include "ui-support.h"
|
||||
#include "uiutil.h"
|
||||
#include <ncurses.h>
|
||||
#include <libxml/parser.h>
|
||||
#ifdef UTF_8
|
|
@ -15,7 +15,7 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Snownews. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
#include "ui-support.h"
|
||||
#include "uiutil.h"
|
||||
#include <ncurses.h>
|
||||
|
||||
// Init the ncurses library.
|
Loading…
Reference in New Issue