Merge support.c into about.c. This fixes #17.

Remove check for santa_hunta file.
Add 'S' hotkey in about screen instead.
This commit is contained in:
Mike Sharov 2018-04-30 10:00:21 -04:00
parent 5359416458
commit d90b962ba3
12 changed files with 16 additions and 61 deletions

19
about.c
View File

@ -14,10 +14,10 @@
// 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 "support.h"
#include "about.h"
#include <ncurses.h>
#include <sys/time.h>
#include <sys/stat.h>
//----------------------------------------------------------------------
@ -332,9 +332,8 @@ void UIAbout (void) {
getch();
return;
}
if (easterEgg())
santaHunta();
else { // 80 COLS logo
int key = 'S';
if (!easterEgg()) {
unsigned xpos = COLS/2u - 40;
erase();
@ -357,6 +356,14 @@ void UIAbout (void) {
mvaddstr (22, COLS/2-26, "Douglas Campos, Ray Iwata, Piotr Ozarowski, Yang Huan");
mvaddstr (23, COLS/2-15, "Ihar Hrachyshka, Mats Berglund");
getch();
key = getch();
}
if (key == 'S')
santaHunta();
}
bool easterEgg (void) {
time_t tunix = time(NULL);
struct tm* t = localtime(&tunix);
return t->tm_mon == 11 && t->tm_mday >= 24 && t->tm_mday <= 26;
}

View File

@ -15,5 +15,7 @@
// along with Snownews. If not, see http://www.gnu.org/licenses/.
#pragma once
#include "config.h"
void UIAbout (void);
bool easterEgg (void);

View File

@ -44,6 +44,7 @@
#include <limits.h>
#include <assert.h>
#include <stdio.h>
#include <time.h>
enum netio_error {
NET_ERR_OK,

View File

@ -27,7 +27,6 @@
#include "setup.h"
#include "ui-support.h"
#include <iconv.h>
#include <time.h>
#include <libxml/HTMLparser.h>
#include <langinfo.h>
#include <openssl/evp.h>

View File

@ -21,7 +21,6 @@
#include "config.h"
#include "ui-support.h"
#include <time.h>
static void CookieCutter (struct feed* cur_ptr, FILE* cookies) {
int len = 0;

View File

@ -24,7 +24,6 @@
#include "main.h"
#include "netio.h"
#include "os-support.h"
#include "support.h"
#include "ui-support.h"
#include "xmlparse.h"
#include <ncurses.h>

View File

@ -26,7 +26,6 @@
#include <errno.h>
#include <ncurses.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <libxml/parser.h>

1
main.c
View File

@ -26,7 +26,6 @@
#include <signal.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
extern struct feed *first_bak; // For use with the signal handler.

View File

@ -16,7 +16,6 @@
#include "config.h"
#include <ctype.h>
#include <time.h>
//-----------------------------------------------------------------------------
// This is a replacement for strsep which is not portable (missing on Solaris).

View File

@ -1,29 +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 <sys/stat.h>
#include <time.h>
bool easterEgg (void) {
time_t tunix = time(NULL);
struct tm* t = localtime(&tunix);
char file[256];
snprintf (file, sizeof(file), "%s/.snownews/santa_hunta", getenv("HOME"));
struct stat filetest;
return 0 == stat (file, &filetest) || (t->tm_mon == 11 && t->tm_mday >= 24 && t->tm_mday <= 26);
}

View File

@ -1,19 +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
bool easterEgg (void);

View File

@ -17,7 +17,6 @@
#include "updatecheck.h"
#include "netio.h"
#include "io-internal.h"
#include <time.h>
void AutoVersionCheck (void) {
// We check once a week.