commit:     08669acd9eac3a9ea64fb177c0c8cf706843c1c0
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 21 12:58:52 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Apr 21 12:59:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08669acd

app-admin/pwgen-2.08-r2: fix c2x errors

Closes: https://bugs.gentoo.org/881965
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 app-admin/pwgen/files/pwgen-2.08-c2x.patch | 62 ++++++++++++++++++++++++++++++
 app-admin/pwgen/pwgen-2.08-r2.ebuild       | 27 +++++++++++++
 2 files changed, 89 insertions(+)

diff --git a/app-admin/pwgen/files/pwgen-2.08-c2x.patch 
b/app-admin/pwgen/files/pwgen-2.08-c2x.patch
new file mode 100644
index 000000000000..d6cc05734d3c
--- /dev/null
+++ b/app-admin/pwgen/files/pwgen-2.08-c2x.patch
@@ -0,0 +1,62 @@
+replace antiquated C syntax constructs for function declarations
+
+Signed-off-by: Fabian Groffen <grob...@gentoo.org>
+
+--- pwgen-2.08/randnum.c       2017-08-07 06:36:54.000000000 +0200
++++ pwgen-2.08/randnum.c       2023-04-20 14:46:50.107904416 +0200
+@@ -43,8 +43,7 @@
+  * Generate a random number n, where 0 <= n < max_num, using
+  * /dev/urandom if possible.
+  */
+-int pw_random_number(max_num)
+-      int max_num;
++int pw_random_number(int max_num)
+ {
+       unsigned int rand_num;
+       int i, fd = get_random_fd();
+--- pwgen-2.08/sha1.c  2007-07-04 23:39:35.000000000 +0200
++++ pwgen-2.08/sha1.c  2023-04-20 14:48:25.048635027 +0200
+@@ -42,8 +42,7 @@
+     (b)[(i) + 3] = (uint8) ( (n)       );       \
+ }
+ 
+-void sha1_starts(ctx)
+-      sha1_context *ctx;
++void sha1_starts(sha1_context *ctx)
+ {
+     ctx->total[0] = 0;
+     ctx->total[1] = 0;
+@@ -55,9 +54,7 @@
+     ctx->state[4] = 0xC3D2E1F0;
+ }
+ 
+-void sha1_process(ctx, data)
+-      sha1_context *ctx;
+-      uint8 data[64];
++void sha1_process(sha1_context *ctx, uint8 data[64])
+ {
+     uint32 temp, W[16], A, B, C, D, E;
+ 
+@@ -213,10 +210,7 @@
+     ctx->state[4] += E;
+ }
+ 
+-void sha1_update(ctx, input, length )
+-      sha1_context *ctx;
+-      uint8 *input;
+-      uint32 length;
++void sha1_update(sha1_context *ctx, uint8 *input, uint32 length)
+ {
+     uint32 left, fill;
+ 
+@@ -263,9 +257,7 @@
+     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+ 
+-void sha1_finish( ctx, digest )
+-      sha1_context *ctx;
+-      uint8 digest[20];
++void sha1_finish(sha1_context *ctx, uint8 digest[20])
+ {
+     uint32 last, padn;
+     uint32 high, low;

diff --git a/app-admin/pwgen/pwgen-2.08-r2.ebuild 
b/app-admin/pwgen/pwgen-2.08-r2.ebuild
new file mode 100644
index 000000000000..d263bb50e841
--- /dev/null
+++ b/app-admin/pwgen/pwgen-2.08-r2.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Password Generator"
+HOMEPAGE="https://sourceforge.net/projects/pwgen/";
+SRC_URI="mirror://sourceforge/pwgen/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris 
~x64-solaris ~x86-solaris"
+IUSE="livecd"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-c2x.patch
+)
+
+src_configure() {
+       econf --sysconfdir="${EPREFIX}"/etc/pwgen
+}
+
+src_install() {
+       default
+
+       use livecd && newinitd "${FILESDIR}"/pwgen.rc pwgen
+}

Reply via email to