Shorten source filenames

This commit is contained in:
Mike Sharov 2021-04-11 13:12:53 -04:00
parent c8df7b657d
commit 5604d30c00
20 changed files with 100 additions and 133 deletions

View File

@ -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.

View File

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -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>

View File

@ -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
View File

@ -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>

View File

@ -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)

View File

@ -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;
}

View File

@ -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);

View File

@ -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 --------------------------------------------------

View File

@ -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.

View File

@ -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

View File

View File

@ -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.