app-misc/dvorak7min: Fix call to undeclared library function index

Closes: https://bugs.gentoo.org/894546
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/32160
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
This commit is contained in:
Brahmajit Das
2023-08-19 15:51:08 +03:00
committed by Joonas Niilola
parent a0fdcd3490
commit 6373daa40e
2 changed files with 67 additions and 0 deletions
@@ -0,0 +1,38 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit toolchain-funcs
DESCRIPTION="Simple ncurses-based typing tutor for learning the Dvorak keyboard layout"
HOMEPAGE="http://www.linalco.com/comunidad.html"
SRC_URI="http://www.linalco.com/ragnar/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
BDEPEND="virtual/pkgconfig"
DEPEND="sys-libs/ncurses:="
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}"/${PN}-1.6.1-debian-changes.patch
"${FILESDIR}"/${PN}-1.6.1-makefile-flags.patch
"${FILESDIR}"/${PN}-1.6.1-ncurses-pkg-config.patch
"${FILESDIR}"/${PN}-1.6.1-clang16-build-fix.patch
)
src_compile() {
tc-export PKG_CONFIG
emake \
CC="$(tc-getCC)" \
PROF="${CFLAGS}" \
LDFLAGS="${LDFLAGS}"
}
src_install() {
dobin ${PN}
dodoc ChangeLog README
}
@@ -0,0 +1,29 @@
Bug: https://bugs.gentoo.org/894546
--- a/dvorak7min.c
+++ b/dvorak7min.c
@@ -41,6 +41,7 @@
*
*/
+#define _GNU_SOURCE
#include <strings.h>
#include <string.h>
#include <stdlib.h>
@@ -435,7 +436,7 @@ void do_text (char * const text)
timeCurrent = time(0);
speed = calcSpeed (timeStart, timeCurrent, hits + misses);
// Use WPS/WPM as better standards
- mvprintw (LINES - 1, 0, "WPS %.2f WPM %.2f Hits: %d Misses: %d Seconds: %d Ratio: %.2f%%", speed, speed * 60, hits, misses, time(0) - timeStart, ratio);
+ mvprintw (LINES - 1, 0, "WPS %.2f WPM %.2f Hits: %d Misses: %d Seconds: %ld Ratio: %.2f%%", speed, speed * 60, hits, misses, time(0) - timeStart, ratio);
clrtoeol();
}
} while (ch == ERR);
@@ -521,7 +522,7 @@ void do_text (char * const text)
} else {
float ratio = hits - misses;
ratio = (ratio < 0) ? 0 : (100.0 * ratio / hits);
- mvprintw (0, 0, "Elapsed time: %d seconds", timeFinish - timeStart);
+ mvprintw (0, 0, "Elapsed time: %ld seconds", timeFinish - timeStart);
mvprintw (1, 0, "Total: %d Misses: %d Ratio: %.2f%%",
hits + misses, misses,
(float)100*(hits) / (hits + misses));