Hi, I was trying to run osd_clock, but it leads to an infinite loop hammering the cpu on my macppc machine.
On arm and ppc char is unsigned by default. It is not enough to hold the return value of getopt_long(3), that returns -1 once all arguments have been exhausted, it should be int instead. With the below diff, the runtime is then good on macppc, and still fine on amd64. Comments/feedback are welcome, Charlène. Index: Makefile =================================================================== RCS file: /cvs/ports/x11/osd_clock/Makefile,v retrieving revision 1.17 diff -u -p -u -p -r1.17 Makefile --- Makefile 26 Jan 2020 11:14:34 -0000 1.17 +++ Makefile 11 Oct 2020 14:27:27 -0000 @@ -2,7 +2,7 @@ COMMENT= xosd based clock DISTNAME= osd_clock-0.5 -REVISION= 2 +REVISION= 3 CATEGORIES= x11 MASTER_SITES= https://distfiles.sigtrap.nl/ Index: patches/patch-osd_clock_c =================================================================== RCS file: /cvs/ports/x11/osd_clock/patches/patch-osd_clock_c,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 patch-osd_clock_c --- patches/patch-osd_clock_c 1 Dec 2004 06:46:35 -0000 1.1.1.1 +++ patches/patch-osd_clock_c 11 Oct 2020 14:27:27 -0000 @@ -1,6 +1,22 @@ $OpenBSD: patch-osd_clock_c,v 1.1.1.1 2004/12/01 06:46:35 jolan Exp $ ---- osd_clock.c.orig Sat Apr 7 17:50:01 2001 -+++ osd_clock.c Wed Dec 1 00:34:21 2004 + +Hunk #1: +On arm and ppc char is unsigned by default. It is not enough to hold +the return value of getopt_long(3), that returns -1 once all arguments +have been exhausted, use the proper int type instead. + +Index: osd_clock.c +--- osd_clock.c.orig ++++ osd_clock.c +@@ -43,7 +43,7 @@ static struct option long_options[] = { + + int main (int argc, char *argv[]) + { +- char c; ++ int c; + + static const char *format; + time_t *t = NULL; @@ -109,7 +109,15 @@ int main (int argc, char *argv[]) } }