tint: upgrade the outdated tint payload from 0.03b to 0.04+nmu1

Fixes two buffer overflows and opens a road to further improvements.
All the previous adjustments to libpayload_tint.patch (including the
latest "use the current time as random seed") have been preserved.

Change-Id: I22e65d18a0b1551f7049c4afe7f95868f584cf9b
Signed-off-by: Mike Banon <mikebdp2@gmail.com>
Reviewed-on: https://review.coreboot.org/23852
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Mike Banon 2018-02-23 19:14:06 +03:00 committed by Patrick Georgi
parent f6d14773b2
commit a16cffe480
2 changed files with 116 additions and 634 deletions

View File

@ -1,5 +1,5 @@
project_url=http://snapshot.debian.org/archive/debian-archive/20110127T084257Z/debian/pool/main/t/tint/tint_0.03b.tar.gz project_url=http://http.debian.net/debian/pool/main/t/tint/tint_0.04+nmu1.tar.gz
archive_name=tint_0.03b.tar.gz archive_name=tint_0.04+nmu1.tar.gz
unexport KCONFIG_AUTOHEADER unexport KCONFIG_AUTOHEADER
unexport KCONFIG_AUTOCONFIG unexport KCONFIG_AUTOCONFIG
@ -16,13 +16,17 @@ tint: patch
patch: download patch: download
cd tint; \ cd tint; \
if [ -e debian ]; then patch -l -p1 < ../libpayload_tint.patch; fi if [ -e debian ]; then \
rm -rf debian typedefs.h Makefile; \
touch Makefile; \
patch -l -p1 < ../libpayload_tint.patch; \
fi
download: download:
test -d tint || { wget $(project_url); \ test -d tint || { wget $(project_url); \
tar -xvf $(archive_name); \ tar -xvf $(archive_name); \
rm $(archive_name); \ rm $(archive_name); \
mv tint-0.03b tint; } mv tint-0.04+nmu1 tint; }
clean: clean:
test -d tint && $(MAKE) -C tint clean || exit 0 test -d tint && $(MAKE) -C tint clean || exit 0

View File

@ -1,6 +1,6 @@
diff -rupN tint-0.03b/config.h tint/config.h diff -rupN tint-0.04+nmu1/config.h tint/config.h
--- tint-0.03b/config.h 2001-12-08 00:03:24.000000000 +0100 --- tint-0.04+nmu1/config.h 2001-12-08 00:03:24.000000000 +0100
+++ tint/config.h 2016-05-27 14:47:15.797402090 +0200 +++ tint/config.h 2018-02-23 12:00:00.000000000 +0200
@@ -29,7 +29,15 @@ @@ -29,7 +29,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -17,439 +17,9 @@ diff -rupN tint-0.03b/config.h tint/config.h
+#endif +#endif
#endif /* #ifndef CONFIG_H */ #endif /* #ifndef CONFIG_H */
diff -rupN tint-0.03b/debian/changelog tint/debian/changelog diff -rupN tint-0.04+nmu1/engine.c tint/engine.c
--- tint-0.03b/debian/changelog 2005-07-17 13:32:20.000000000 +0200 --- tint-0.04+nmu1/engine.c 2005-07-17 13:26:22.000000000 +0200
+++ tint/debian/changelog 1970-01-01 01:00:00.000000000 +0100 +++ tint/engine.c 2018-02-23 12:00:00.000000000 +0200
@@ -1,53 +0,0 @@
-tint (0.03b) unstable; urgency=low
-
- * Added breaks at end of switch statements to keep gcc 3+ happy
- (Closes: #316022)
- * Added missing includes to engine.c
- * Fixed spelling mistake in NOTES
- * Updated debian policy version
-
- -- Abraham van der Merwe <abz@debian.org> Sun, 17 Jul 2005 13:32:17 +0200
-
-tint (0.03a) unstable; urgency=low
-
- * Applied patch with some minor tweaks from Marcello Mamino which
- adds a dotted background.
- * Applied patches from Robert Lemmen which add support for user logins as
- default name and an interactive mode for specifying the start level.
- * Show player statistics.
-
- -- Abraham van der Merwe <abz@debian.org> Mon, 16 Jun 2003 23:07:37 +0200
-
-tint (0.02d) unstable; urgency=low
-
- * Install man page in correct directory (Closes: #128923)
- * Created a postinst program that checks for old score files
- before installing the default score file (Closes: #136466)
- * Added a menu control file (Closes: #128924)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tint (0.02c) unstable; urgency=low
-
- * Removed common-sense suggests from control file *g* (Closes: #123204)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tint (0.02b) unstable; urgency=low
-
- * Changed the name from tclassic to tint (as in TINT Is Not Tetris(tm))
- * Added a build dependancy on libncurses5-dev (Closes: #124241)
- * Changed the location for the score file to /var/games (Closes: #124236)
- * Made score file sgid games (Closes: #123595)
-
- -- Abraham van der Merwe <abz@debian.org> Wed, 19 Dec 2001 18:03:34 +0200
-
-tclassic (0.02a) unstable; urgency=low
-
- * Initial Release. (Closes: #122839)
-
- -- Abraham van der Merwe <abz@debian.org> Fri, 7 Dec 2001 17:59:25 +0200
-
-Local variables:
-mode: debian-changelog
-End:
diff -rupN tint-0.03b/debian/control tint/debian/control
--- tint-0.03b/debian/control 2005-07-17 13:31:13.000000000 +0200
+++ tint/debian/control 1970-01-01 01:00:00.000000000 +0100
@@ -1,19 +0,0 @@
-Source: tint
-Section: games
-Priority: optional
-Maintainer: Abraham van der Merwe <abz@debian.org>
-Build-Depends: debhelper (>> 3.0.0), libncurses5-dev
-Standards-Version: 3.6.1
-
-Package: tint
-Architecture: any
-Depends: ${shlibs:Depends}
-Replaces: tclassic
-Conflicts: tclassic
-Description: TINT Is Not Tetris(tm) ...at least the name isn't
- As the title suggests, this is a clone of the original tetris game
- written by Alexey Pajitnov, Dmitry Pavlovsky, and Vadim Gerasimov.
- .
- I've tried to keep the game as close to the original as possible, but
- there is a few differences. Nevertheless, it's probably the closest to
- the original that you'll ever find in the UNIX world...
diff -rupN tint-0.03b/debian/copyright tint/debian/copyright
--- tint-0.03b/debian/copyright 2001-12-19 17:08:42.000000000 +0100
+++ tint/debian/copyright 1970-01-01 01:00:00.000000000 +0100
@@ -1,39 +0,0 @@
-This is the Debian GNU/Linux prepackaged version of tint. These
-files were written and packaged by Abraham van der Merwe <abz@debian.org>
-
-The games is released under a derivative of the BSD license. For more
-information see http://www.opensource.org/licenses/bsd-license.html
-
-The original source can be found at: http://oasis.frogfoot.net
-
-Copyright:
-
- Copyright (c) Abraham vd Merwe <abz@blio.net>
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 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
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- 3. Neither the name of the author nor the names of other contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff -rupN tint-0.03b/debian/.depends tint/debian/.depends
--- tint-0.03b/debian/.depends 2002-03-16 17:26:42.000000000 +0100
+++ tint/debian/.depends 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-tint.postinst.o: tint.postinst.c
diff -rupN tint-0.03b/debian/dirs tint/debian/dirs
--- tint-0.03b/debian/dirs 2002-03-16 17:58:42.000000000 +0100
+++ tint/debian/dirs 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-usr/games
-usr/share/man/man6
diff -rupN tint-0.03b/debian/docs tint/debian/docs
--- tint-0.03b/debian/docs 2001-12-07 17:25:17.000000000 +0100
+++ tint/debian/docs 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-NOTES
-CREDITS
diff -rupN tint-0.03b/debian/Makefile tint/debian/Makefile
--- tint-0.03b/debian/Makefile 2002-03-16 18:41:18.000000000 +0100
+++ tint/debian/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-
-# -*- sh -*-
-
-# Written by Abraham van der Merwe <abz@blio.net>
-# Last updated: 2002-03-26
-
-CC = gcc
-CFLAGS = -Wall -Os -pipe
-LDFLAGS = -s
-
-STRIP = strip
-STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
-
-OBJ =
-SRC = $(OBJ:%.o=%.c)
-PRG =
-
-all: #$(PRG)
-
-$(PRG): $(OBJ)
- $(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
-
-clean:
- rm -rf tint
- rm -f *~ $(OBJ) $(PRG) *.substvars *.debhelper
-
-.PHONY: all clean
-
diff -rupN tint-0.03b/debian/menu tint/debian/menu
--- tint-0.03b/debian/menu 2002-03-16 18:31:13.000000000 +0100
+++ tint/debian/menu 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-?package(tint):needs="text" section="Games/Tetris-like" \
- title="TINT Is Not Tetris(tm)" \
- command="sh -c '/usr/games/tint -l 5;echo;echo PRESS ENTER;read line'" \
- hints="Text"
diff -rupN tint-0.03b/debian/postinst tint/debian/postinst
--- tint-0.03b/debian/postinst 2002-03-16 18:44:34.000000000 +0100
+++ tint/debian/postinst 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-#!/bin/sh -e
-
-scorefile="/var/games/tint.scores"
-
-if [ ! -e $scorefile ]
-then
- touch $scorefile
- chmod 0664 $scorefile
- chown root:games $scorefile
-fi
-
-#DEBHELPER#
-
diff -rupN tint-0.03b/debian/postinst.c tint/debian/postinst.c
--- tint-0.03b/debian/postinst.c 2002-03-16 18:15:32.000000000 +0100
+++ tint/debian/postinst.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,143 +0,0 @@
-
-/*
- * Hacked up postinst program to install the default score file. We have to do it this
- * way, since the old score file is overwritten if the score file already exists in the
- * package - abz
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <grp.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-/* location of score file */
-static const char filename[] = "/var/games/tint.scores";
-
-/* user name of default score file */
-static const char user[] = "root";
-
-/* group name of default score file */
-static const char group[] = "games";
-
-/* contents of default score file */
-static const uint8_t contents[] =
-{
- 0x54, 0x69, 0x6e, 0x74, 0x20, 0x30, 0x2e, 0x30,
- 0x32, 0x62, 0x20, 0x28, 0x63, 0x29, 0x20, 0x41,
- 0x62, 0x72, 0x61, 0x68, 0x61, 0x6d, 0x20, 0x76,
- 0x64, 0x20, 0x4d, 0x65, 0x72, 0x77, 0x65, 0x20,
- 0x2d, 0x20, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73,
- 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
- 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
- 0x74, 0x00, 0x10, 0x5f, 0x00, 0x00, 0xb7, 0xc8,
- 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00, 0x80, 0x3a,
- 0x00, 0x00, 0x94, 0xc5, 0x20, 0x3c, 0x52, 0x69,
- 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65,
- 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68, 0x74, 0x00,
- 0x66, 0x21, 0x00, 0x00, 0x31, 0xc9, 0x20, 0x3c,
- 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
- 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
- 0x74, 0x00, 0xdc, 0x1a, 0x00, 0x00, 0x79, 0xc6,
- 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20,
- 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65,
- 0x63, 0x68, 0x74, 0x00, 0x2f, 0x16, 0x00, 0x00,
- 0xf9, 0xc5, 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61,
- 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62,
- 0x72, 0x65, 0x63, 0x68, 0x74, 0x00, 0x8b, 0x11,
- 0x00, 0x00, 0x82, 0xc7, 0x20, 0x3c, 0x41, 0x62,
- 0x7a, 0x00, 0x23, 0x10, 0x00, 0x00, 0xa9, 0xc9,
- 0x20, 0x3c, 0x44, 0x6f, 0x70, 0x70, 0x65, 0x6c,
- 0x67, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x00, 0x13,
- 0x0b, 0x00, 0x00, 0x21, 0xc7, 0x20, 0x3c, 0x4a,
- 0x6f, 0x68, 0x61, 0x6e, 0x6e, 0x20, 0x42, 0x6f,
- 0x74, 0x68, 0x61, 0x00, 0x5a, 0x09, 0x00, 0x00,
- 0xef, 0xc6, 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00,
- 0xd7, 0x07, 0x00, 0x00, 0xad, 0xc6, 0x20, 0x3c
-};
-
-static void debhelper_stuff()
-{
- /* dh_installdocs */
- system ("if [ -d /usr/doc -a ! -e /usr/doc/tint -a -d /usr/share/doc/tint ]; then\n"
- " ln -sf ../share/doc/tint /usr/doc/tint\n"
- "fi\n");
-
- /* dh_installmenu */
- system ("if [ -x /usr/bin/update-menus ]; then update-menus ; fi");
-}
-
-int main (int argc,char *argv[])
-{
- struct stat sb;
-
- /* we only do something if we're called as <program> configure ... */
- if (argc < 2 || strcmp (argv[1],"configure")) exit (EXIT_SUCCESS);
-
- /* if the score file doesn't exist, create it */
- if (stat (filename,&sb) < 0)
- {
- int fd,result;
- struct passwd *u;
- struct group *g;
- uid_t uid;
- gid_t gid;
-
- /* get uid */
- if ((u = getpwnam (user)) == NULL)
- {
- fprintf (stderr,"Couldn't obtain uid for %s: %m\n",user);
- exit (EXIT_FAILURE);
- }
- uid = u->pw_uid;
-
- /* get gid */
- if ((g = getgrnam (group)) == NULL)
- {
- fprintf (stderr,"Couldn't obtain gid for %s: %m\n",group);
- exit (EXIT_FAILURE);
- }
- gid = g->gr_gid;
-
- /* create default score file */
- if ((fd = creat (filename,0664)) < 0)
- {
- fprintf (stderr,"Couldn't create score file %s: %m\n",filename);
- exit (EXIT_FAILURE);
- }
- result = write (fd,contents,sizeof (contents));
- if (result < 0)
- {
- fprintf (stderr,"Unable to write to %s: %m\n",filename);
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- if (result < sizeof (contents))
- {
- fprintf (stderr,"Short write count. %d/%d bytes written to %s\n",result,sizeof (contents),filename);
- close (fd);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- close (fd);
-
- /* change ownership of score file */
- if (chown (filename,uid,gid) < 0)
- {
- fprintf (stderr,"Couldn't change ownership of %s to %s:%s: %m\n",filename,user,group);
- unlink (filename);
- exit (EXIT_FAILURE);
- }
- }
-
- debhelper_stuff ();
-
- exit (EXIT_SUCCESS);
-}
-
diff -rupN tint-0.03b/debian/rules tint/debian/rules
--- tint-0.03b/debian/rules 2002-03-16 18:00:11.000000000 +0100
+++ tint/debian/rules 1970-01-01 01:00:00.000000000 +0100
@@ -1,82 +0,0 @@
-#!/usr/bin/make -f
-
-# -*- sh -*-
-
-# Uncomment this to turn on verbose mode.
-export DH_VERBOSE=1
-
-# This is the debhelper compatability version to use.
-export DH_COMPAT=3
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- # Add here commands to configure the package.
-
-
- touch configure-stamp
-
-build: configure-stamp build-stamp
-build-stamp:
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
-
- # Add here commands to clean up after the build process.
- -$(MAKE) clean
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/tint.
- $(MAKE) install DESTDIR=$(CURDIR)/debian/tint
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
-# dh_installdebconf
- dh_installdocs
-# dh_installexamples
- dh_installmenu
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_installinit
-# dh_installcron
- dh_installman
-# dh_installinfo
-# dh_undocumented
- dh_installchangelogs
- dh_link
- dh_strip
- dh_compress
-# dh_fixperms --exclude /usr/games/tint
-# dh_makeshlibs
- dh_installdeb
-# dh_perl
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
diff -rupN tint-0.03b/engine.c tint/engine.c
--- tint-0.03b/engine.c 2005-07-17 13:26:22.000000000 +0200
+++ tint/engine.c 2016-05-27 19:05:21.681035752 +0200
@@ -27,10 +27,13 @@ @@ -27,10 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -465,9 +35,9 @@ diff -rupN tint-0.03b/engine.c tint/engine.c
#include "utils.h" #include "utils.h"
#include "io.h" #include "io.h"
#include "engine.h" #include "engine.h"
diff -rupN tint-0.03b/engine.h tint/engine.h diff -rupN tint-0.04+nmu1/engine.h tint/engine.h
--- tint-0.03b/engine.h 2001-12-07 16:48:08.000000000 +0100 --- tint-0.04+nmu1/engine.h 2001-12-07 16:48:08.000000000 +0100
+++ tint/engine.h 2016-05-27 19:04:32.456828081 +0200 +++ tint/engine.h 2018-02-23 12:00:00.000000000 +0200
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -477,9 +47,9 @@ diff -rupN tint-0.03b/engine.h tint/engine.h
/* /*
* Macros * Macros
diff -rupN tint-0.03b/io.c tint/io.c diff -rupN tint-0.04+nmu1/io.c tint/io.c
--- tint-0.03b/io.c 2001-12-07 16:48:20.000000000 +0100 --- tint-0.04+nmu1/io.c 2010-06-23 15:05:12.000000000 +0100
+++ tint/io.c 2016-05-27 14:47:15.798402053 +0200 +++ tint/io.c 2018-02-23 12:00:00.000000000 +0200
@@ -27,9 +27,13 @@ @@ -27,9 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -492,9 +62,9 @@ diff -rupN tint-0.03b/io.c tint/io.c
#include <unistd.h> /* gettimeofday() */ #include <unistd.h> /* gettimeofday() */
+#endif +#endif
#include <curses.h> #include "io.h"
@@ -70,7 +74,11 @@ static int in_timeleft; @@ -68,7 +72,11 @@ static int in_timeleft;
/* Initialize screen */ /* Initialize screen */
void io_init () void io_init ()
{ {
@ -506,7 +76,7 @@ diff -rupN tint-0.03b/io.c tint/io.c
start_color (); start_color ();
curs_set (CURSOR_INVISIBLE); curs_set (CURSOR_INVISIBLE);
out_attr = A_NORMAL; out_attr = A_NORMAL;
@@ -176,11 +184,17 @@ void out_beep () @@ -177,11 +185,17 @@ void out_beep ()
/* Read a character. Please note that you MUST call in_timeout() before in_getch() */ /* Read a character. Please note that you MUST call in_timeout() before in_getch() */
int in_getch () int in_getch ()
{ {
@ -524,7 +94,7 @@ diff -rupN tint-0.03b/io.c tint/io.c
gettimeofday (&endtv,NULL); gettimeofday (&endtv,NULL);
/* Timeout? */ /* Timeout? */
if (ch == ERR) if (ch == ERR)
@@ -198,6 +212,7 @@ int in_getch () @@ -199,6 +213,7 @@ int in_getch ()
in_timeleft -= endtv.tv_usec; in_timeleft -= endtv.tv_usec;
if (in_timeleft <= 0) in_timeleft = in_timetotal; if (in_timeleft <= 0) in_timeleft = in_timetotal;
} }
@ -532,26 +102,55 @@ diff -rupN tint-0.03b/io.c tint/io.c
return ch; return ch;
} }
diff -rupN tint-0.03b/Makefile tint/Makefile diff -rupN tint-0.04+nmu1/io.h tint/io.h
--- tint-0.03b/Makefile 2005-07-17 13:30:54.000000000 +0200 --- tint-0.04+nmu1/io.h 2010-06-23 14:55:03.000000000 +0100
+++ tint/Makefile 2016-05-27 21:04:02.374391088 +0200 +++ tint/io.h 2018-02-23 12:00:00.000000000 +0200
@@ -28,85 +28,79 @@ @@ -29,9 +29,8 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
-#CROSS = arm-linux-
- -
-bindir = $(DESTDIR)/usr/games +
-mandir = $(DESTDIR)/usr/share/man #include <curses.h>
-localstatedir = $(DESTDIR)/var/games -#include <wchar.h>
- -
-ifeq ($(CC),) +
-CC = gcc /*
-else * Colors
-ifeq ($(CC),colorgcc) */
- ifneq ($(CROSS),) diff -rupN tint-0.04+nmu1/Makefile tint/Makefile
- CC = gcc --- tint-0.04+nmu1/Makefile 2010-06-23 15:06:11.000000000 +0200
- endif +++ tint/Makefile 2018-02-23 12:00:00.000000000 +0200
@@ -1,0 +1,106 @@
+
+# -*- sh -*-
+
+# Copyright (c) Abraham vd Merwe <abz@blio.net>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 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
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the author nor the names of other contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# in addition to the dependency below, create the file if it doesn't exist +# in addition to the dependency below, create the file if it doesn't exist
+# to silence warnings about a file that would be generated anyway. +# to silence warnings about a file that would be generated anyway.
+$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile))) +$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
@ -588,32 +187,8 @@ diff -rupN tint-0.03b/Makefile tint/Makefile
+# Make is silent per default, but 'make V=1' will show all compiler calls. +# Make is silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1) +ifneq ($(V),1)
+Q := @ +Q := @
endif +endif
-endif +
-
-CFLAGS = -Wall -Os -pipe
-CPPFLAGS = -DSCOREFILE=\"$(localstatedir)/$(PRG).scores\" #-DUSE_RAND
-LDFLAGS = -s
-LDLIBS = -lncurses
-
-STRIP = strip
-STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
-
-INSTALL = install
-
-OBJ = engine.o utils.o io.o tint.o
-SRC = $(OBJ:%.o=%.c)
-PRG = tint
-
- ########### NOTHING TO EDIT BELOW THIS ###########
-
-.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
-
-all: do-it-all postinst
-ifeq (.depends,$(wildcard .depends))
-include .depends
-do-it-all: with-depends
+all: $(TARGET).elf +all: $(TARGET).elf
+# printf" CC $(CC)\n" +# printf" CC $(CC)\n"
+ +
@ -635,63 +210,26 @@ diff -rupN tint-0.03b/Makefile tint/Makefile
+ifneq ($(strip $(HAVE_LIBPAYLOAD)),) +ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
+libpayload: +libpayload:
+ $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n" + $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
else +else
-do-it-all: without-depends
-endif
-
-without-depends: depend with-depends
-
-depend:
- rm -f .depends
- set -e; for F in $(SRC); do $(CC) -MM $(CFLAGS) $(CPPFLAGS) $$F >> .depends; done
-
-with-depends: $(PRG)
-
-$(PRG): $(OBJ)
- $(CROSS)$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
- $(CROSS)$(STRIP) $(STRIPFLAGS) $@
-
-ifneq ($(DESTDIR),)
-install: $(PRG)
- $(INSTALL) -d $(bindir) $(mandir) $(localstatedir)
- $(INSTALL) -s -g games -o root -m 2755 $(PRG) $(bindir)
- $(INSTALL) -g games -o root -m 0644 $(PRG).6 $(mandir)/man6
-# cp tint.scores $(localstatedir)/$(PRG).scores
-# chown root.games $(localstatedir)/$(PRG).scores
-# chmod 0664 $(localstatedir)/$(PRG).scores
-
-uninstall:
- rm -f $(bindir)/$(PRG) $(mandir)/man6/$(PRG).6 $(localstatedir)/$(PRG).scores
+libpayload: +libpayload:
+ $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n" + $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
+ $(Q)make -C $(LIBCONFIG_PATH) distclean + $(Q)make -C $(LIBCONFIG_PATH) distclean
+ $(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG) + $(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG)
+ $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install + $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install
endif +endif
+
-postinst: +clean:
- $(MAKE) -C debian
-
-debian:
- dpkg-buildpackage -rfakeroot -k2B555AEE
-
clean:
- rm -f .depends *~ $(OBJ) $(PRG) {configure,build}-stamp gmon.out a.out
- rm -rf debian/$(PRG)
- rm -f debian/*.{debhelper,substvars} debian/files debian/*~
+ $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o + $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o
+ $(Q)rm .xcompile + $(Q)rm .xcompile
+
distclean: clean +distclean: clean
- $(MAKE) -C debian clean
+ $(Q)rm -rf $(tint_obj) + $(Q)rm -rf $(tint_obj)
+
+ +
+.PHONY: all clean do-it-all depend with-depends without-depends debian postinst +.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
Binary files tint-0.03b/.Makefile.swp and tint/.Makefile.swp differ diff -rupN tint-0.04+nmu1/tint.c tint/tint.c
diff -rupN tint-0.03b/tint.c tint/tint.c --- tint-0.04+nmu1/tint.c 2010-08-08 19:42:50.000000000 +0200
--- tint-0.03b/tint.c 2005-07-17 13:26:43.000000000 +0200 +++ tint/tint.c 2018-02-23 12:00:00.000000000 +0200
+++ tint/tint.c 2016-05-27 18:59:53.838346317 +0200
@@ -1,4 +1,3 @@ @@ -1,4 +1,3 @@
- -
/* /*
@ -715,7 +253,14 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
#include "utils.h" #include "utils.h"
#include "io.h" #include "io.h"
#include "config.h" #include "config.h"
@@ -321,6 +321,7 @@ typedef struct @@ -306,4 +306,4 @@
/* Header for scorefile */
-#define SCORE_HEADER "Tint 0.02b (c) Abraham vd Merwe - Scores"
+#define SCORE_HEADER "Tint 0.04+nmu1 (c) Abraham vd Merwe - Scores"
-
+
/* Header for score title */
@@ -322,6 +322,7 @@ typedef struct
time_t timestamp; time_t timestamp;
} score_t; } score_t;
@ -723,7 +268,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
static void getname (char *name) static void getname (char *name)
{ {
struct passwd *pw = getpwuid (geteuid ()); struct passwd *pw = getpwuid (geteuid ());
@@ -337,7 +338,9 @@ static void getname (char *name) @@ -338,7 +339,9 @@ static void getname (char *name)
name[NAMELEN - 1] = '\0'; name[NAMELEN - 1] = '\0';
} }
} }
@ -733,7 +278,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
static void err1 () static void err1 ()
{ {
fprintf (stderr,"Error creating %s\n",scorefile); fprintf (stderr,"Error creating %s\n",scorefile);
@@ -349,10 +352,11 @@ static void err2 () @@ -350,10 +353,11 @@ static void err2 ()
fprintf (stderr,"Error writing to %s\n",scorefile); fprintf (stderr,"Error writing to %s\n",scorefile);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@ -746,7 +291,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
"\n\t PLAYER STATISTICS\n\n\t" "\n\t PLAYER STATISTICS\n\n\t"
"Score %11d\n\t" "Score %11d\n\t"
"Efficiency %11d\n\t" "Efficiency %11d\n\t"
@@ -360,6 +364,7 @@ void showplayerstats (engine_t *engine) @@ -361,6 +365,7 @@ void showplayerstats (engine_t *engine)
GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ()); GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
} }
@ -754,7 +299,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
static void createscores (int score) static void createscores (int score)
{ {
FILE *handle; FILE *handle;
@@ -394,7 +399,9 @@ static void createscores (int score) @@ -395,7 +400,9 @@ static void createscores (int score)
fprintf (stderr,"%s",scoretitle); fprintf (stderr,"%s",scoretitle);
fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name); fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name);
} }
@ -764,7 +309,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
static int cmpscores (const void *a,const void *b) static int cmpscores (const void *a,const void *b)
{ {
int result; int result;
@@ -412,7 +419,9 @@ static int cmpscores (const void *a,cons @@ -413,7 +420,9 @@ static int cmpscores (const void *a,cons
/* timestamps is equal */ /* timestamps is equal */
return 0; return 0;
} }
@ -774,7 +319,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
static void savescores (int score) static void savescores (int score)
{ {
FILE *handle; FILE *handle;
@@ -490,11 +499,13 @@ static void savescores (int score) @@ -491,11 +500,13 @@ static void savescores (int score)
} }
fprintf (stderr,"\n"); fprintf (stderr,"\n");
} }
@ -787,9 +332,9 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
+#if 0 +#if 0
static void showhelp () static void showhelp ()
{ {
fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n"); fprintf (stderr,"USAGE: tint [-h] [-l level] [-n] [-d] [-b char]\n");
@@ -504,9 +515,11 @@ static void showhelp () @@ -506,9 +517,11 @@ static void showhelp ()
fprintf (stderr," -d Draw vertical dotted lines\n"); fprintf (stderr," -b <char> Use this character to draw blocks instead of spaces\n");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
+#endif +#endif
@ -800,7 +345,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
int i = 1; int i = 1;
while (i < argc) while (i < argc)
{ {
@@ -536,10 +549,12 @@ static void parse_options (int argc,char @@ -544,10 +557,12 @@ static void parse_options (int argc,char
} }
i++; i++;
} }
@ -813,7 +358,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
char buf[NAMELEN]; char buf[NAMELEN];
do do
@@ -549,6 +564,8 @@ static void choose_level () @@ -557,6 +572,8 @@ static void choose_level ()
buf[strlen (buf) - 1] = '\0'; buf[strlen (buf) - 1] = '\0';
} }
while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL); while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
@ -822,7 +367,7 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
} }
/***************************************************************************/ /***************************************************************************/
@@ -561,6 +578,8 @@ int main (int argc,char *argv[]) @@ -569,6 +586,8 @@ int main (int argc,char *argv[])
int ch; int ch;
engine_t engine; engine_t engine;
/* Initialize */ /* Initialize */
@ -831,14 +376,19 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
rand_init (); /* must be called before engine_init () */ rand_init (); /* must be called before engine_init () */
engine_init (&engine,score_function); /* must be called before using engine.curshape */ engine_init (&engine,score_function); /* must be called before using engine.curshape */
finished = shownext = FALSE; finished = shownext = FALSE;
@@ -663,8 +682,15 @@ @@ -673,11 +692,20 @@ int main (int argc,char *argv[])
/* Restore console settings and exit */
io_close ();
+#if 0
/* Don't bother the player if he want's to quit */
if (ch != 'q') if (ch != 'q')
{ {
+#endif
showplayerstats (&engine); showplayerstats (&engine);
+#if 0 +#if 0
savescores (GETSCORE (engine.score)); savescores (GETSCORE (engine.score));
+#endif
} }
+#endif
+ printf("Bye.\n"); + printf("Bye.\n");
+ refresh(); + refresh();
+ for(;;); //halt(); + for(;;); //halt();
@ -847,81 +397,9 @@ diff -rupN tint-0.03b/tint.c tint/tint.c
+#endif +#endif
} }
diff -rupN tint-0.03b/typedefs.h tint/typedefs.h diff -rupN tint-0.04+nmu1/utils.c tint/utils.c
--- tint-0.03b/typedefs.h 2001-12-07 16:49:06.000000000 +0100 --- tint-0.04+nmu1/utils.c 2001-12-07 16:49:19.000000000 +0100
+++ tint/typedefs.h 1970-01-01 01:00:00.000000000 +0100 +++ tint/utils.c 2018-02-23 12:00:00.000000000 +0200
@@ -1,68 +0,0 @@
-#ifndef TYPEDEFS_H
-#define TYPEDEFS_H
-
-/*
- * Copyright (c) Abraham vd Merwe <abz@blio.net>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 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
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of other contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Boolean definitions
- */
-
-#ifndef bool
-#define bool int
-#endif
-
-#if !defined(false) || (false != 0)
-#define false 0
-#endif
-
-#if !defined(true) || (true != 0)
-#define true 1
-#endif
-
-#if !defined(FALSE) || (FALSE != false)
-#define FALSE false
-#endif
-
-#if !defined(TRUE) || (TRUE != true)
-#define TRUE true
-#endif
-
-/*
- * Error flags
- */
-
-#if !defined(ERR) || (ERR != -1)
-#define ERR -1
-#endif
-
-#if !defined(OK) || (OK != 0)
-#define OK 0
-#endif
-
-#endif /* #ifndef TYPEDEFS_H */
diff -rupN tint-0.03b/utils.c tint/utils.c
--- tint-0.03b/utils.c 2001-12-07 16:49:19.000000000 +0100
+++ tint/utils.c 2016-05-27 19:05:40.313351887 +0200
@@ -27,11 +27,13 @@ @@ -27,11 +27,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -951,9 +429,9 @@ diff -rupN tint-0.03b/utils.c tint/utils.c
} }
+#endif +#endif
diff -rupN tint-0.03b/utils.h tint/utils.h diff -rupN tint-0.04+nmu1/utils.h tint/utils.h
--- tint-0.03b/utils.h 2001-12-07 16:49:35.000000000 +0100 --- tint-0.04+nmu1/utils.h 2001-12-07 16:49:35.000000000 +0100
+++ tint/utils.h 2016-05-27 19:00:34.120754123 +0200 +++ tint/utils.h 2018-02-23 12:00:00.000000000 +0200
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */