head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.6 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.4 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.2 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q3:1.3.0.2 pkgsrc-2011Q3-base:1.3 pkgsrc-2011Q2:1.2.0.2 pkgsrc-2011Q2-base:1.2 pkgsrc-2011Q1:1.1.0.24 pkgsrc-2011Q1-base:1.1 pkgsrc-2010Q4:1.1.0.22 pkgsrc-2010Q4-base:1.1 pkgsrc-2010Q3:1.1.0.20 pkgsrc-2010Q3-base:1.1 pkgsrc-2010Q2:1.1.0.18 pkgsrc-2010Q2-base:1.1 pkgsrc-2010Q1:1.1.0.16 pkgsrc-2010Q1-base:1.1 pkgsrc-2009Q4:1.1.0.14 pkgsrc-2009Q4-base:1.1 pkgsrc-2009Q3:1.1.0.12 pkgsrc-2009Q3-base:1.1 pkgsrc-2009Q2:1.1.0.10 pkgsrc-2009Q2-base:1.1 pkgsrc-2009Q1:1.1.0.8 pkgsrc-2009Q1-base:1.1 pkgsrc-2008Q4:1.1.0.6 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.4 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.2 cube-native-xorg-base:1.1; locks; strict; comment @# @; 1.4 date 2011.10.06.15.50.39; author dholland; state dead; branches; next 1.3; 1.3 date 2011.09.19.07.15.52; author dholland; state Exp; branches; next 1.2; 1.2 date 2011.07.03.20.16.00; author dholland; state Exp; branches; next 1.1; 1.1 date 2008.08.31.06.52.29; author dholland; state Exp; branches; next ; desc @@ 1.4 log @Roll all the pkgsrc patches (of which there were far too many, and none pkgsrc-specific) into a distfile jumbo patch. Sort the PLIST. While this is not supposed to change the resulting package, bump the PKGREVISION as a precaution and to make sure the build with the patch gets tested properly. @ text @$NetBSD: patch-ef,v 1.3 2011/09/19 07:15:52 dholland Exp $ - use modern C - use stdarg.h for printf wrappers instead of ancient-style fake varargs - declare printf functions as such for format checking - mark functions not returning values as void; otherwise clang belches - remove uses of implicit int to avoid warning noise - silence warnings about assignment within an if conditional --- clients/xmxinit/xmxinit.c.orig 1995-04-20 03:05:04.000000000 +0000 +++ clients/xmxinit/xmxinit.c @@@@ -24,13 +24,13 @@@@ Modified from X11R6 MIT source for xinit #include #include #include +#include #include #include #ifndef SYSV #include #endif #include -extern int sys_nerr; #include #ifndef X_NOT_STDC_ENV @@@@ -41,6 +41,12 @@@@ extern char *getenv(); extern char **environ; char **newenviron = NULL; +#if defined(__GNUC__) || defined(__CLANG__) +#define PF(a, b) __attribute__((__format__(__printf__, a, b))) +#else +#define PF(a, b) +#endif + #ifndef SHELL #define SHELL "sh" #endif @@@@ -59,6 +65,15 @@@@ char **newenviron = NULL; #define setpgrp setpgid #endif +static void shutdown(void); +int processTimeout(int timeout, char *string); +void set_environment(void); +void Fatal(const char *fmt, ...) PF(1, 2); +void Error(const char *fmt, ...) PF(1, 2); +void vError(const char *fmt, va_list ap) PF(1, 0); +int startServer(char *server[]); +pid_t startClient(char *client[]); + char *bindir = BINDIR; #ifndef XMXINITRC @@@@ -86,8 +101,8 @@@@ char **client = clientargv + 2; /* make char *displayNum; char *program; Display *xd; /* server connection */ -#ifndef SYSV -#if defined(SVR4) || defined(_POSIX_SOURCE) +#if 1 /*ndef SYSV*/ +#if 1 /*defined(SVR4) || defined(_POSIX_SOURCE)*/ int status; #else union wait status; @@@@ -95,9 +110,6 @@@@ union wait status; #endif /* SYSV */ int serverpid = -1; int clientpid = -1; -extern int errno; - -static shutdown(); #ifdef SIGNALRETURNSINT #define SIGVAL int @@@@ -146,6 +158,7 @@@@ static Execute (vec) return; } +int main(argc, argv) int argc; register char **argv; @@@@ -197,7 +210,7 @@@@ register char **argv; */ if (argc == 0 || (**argv != '/' && **argv != '.')) { - if (*sptr = getenv("XMX")) + if ((*sptr = getenv("XMX")) != NULL) sptr++; else *sptr++ = default_server; @@@@ -312,13 +325,14 @@@@ register char **argv; * waitforserver - wait for X server to start up */ -waitforserver() +int +waitforserver(void) { int ncycles = 120; /* # of cycles to wait */ int cycles; /* Wait cycle count */ for (cycles = 0; cycles < ncycles; cycles++) { - if (xd = XOpenDisplay(displayNum)) { + if ((xd = XOpenDisplay(displayNum)) != NULL) { return(TRUE); } else { @@@@ -336,6 +350,7 @@@@ waitforserver() /* * return TRUE if we timeout waiting for pid to exit, FALSE otherwise. */ +int processTimeout(timeout, string) int timeout; char *string; @@@@ -350,7 +365,7 @@@@ processTimeout(timeout, string) break; alarm(0); #else /* SYSV */ -#if defined(SVR4) || defined(_POSIX_SOURCE) +#if 1 /*defined(SVR4) || defined(_POSIX_SOURCE)*/ if ((pidfound = waitpid(serverpid, &status, WNOHANG)) == serverpid) break; #else @@@@ -375,6 +390,7 @@@@ processTimeout(timeout, string) return( serverpid != pidfound ); } +int startServer(server) char *server[]; { @@@@ -457,6 +473,7 @@@@ startServer(server) return(serverpid); } +pid_t startClient(client) char *client[]; { @@@@ -490,8 +507,8 @@@@ static int ignorexio (dpy) /*NOTREACHED*/ } -static -shutdown() +static void +shutdown(void) { /* have kept display opened, so close it now */ if (clientpid > 0) { @@@@ -544,7 +561,8 @@@@ shutdown() * make a new copy of environment that has room for DISPLAY */ -set_environment () +void +set_environment(void) { int nenvvars; char **newPtr, **oldPtr; @@@@ -578,20 +596,32 @@@@ set_environment () return; } -Fatal(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9) - char *fmt; +void +Fatal(const char *fmt, ...) { - Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); + va_list ap; + + va_start(ap, fmt); + vError(fmt, ap); + va_end(ap); exit(ERR_EXIT); } -Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9) - char *fmt; +void +Error(const char *fmt, ...) { - extern char *sys_errlist[]; + va_list ap; + va_start(ap, fmt); + vError(fmt, ap); + va_end(ap); +} + +void +vError(const char *fmt, va_list ap) +{ fprintf(stderr, "%s: ", program); if (errno > 0 && errno < sys_nerr) - fprintf (stderr, "%s (errno %d): ", sys_errlist[errno], errno); - fprintf(stderr, fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); + fprintf (stderr, "%s (errno %d): ", strerror(errno), errno); + vfprintf(stderr, fmt, ap); } @ 1.3 log @Fix up a bunch of clang warnings and errors. This includes some bug fixes, because clang found a couple things that were decidedly wrong/broken; therefore PKGREVISION -> 3. This package has too many patches (it only looks like a moderate number compared to xview) and many/most of them should be rolled into a jumbo patch and posted as a distfile. One of these years... @ text @d1 1 a1 1 $NetBSD: patch-ef,v 1.2 2011/07/03 20:16:00 dholland Exp $ @ 1.2 log @add patch comments @ text @d1 1 a1 1 $NetBSD: patch-ef,v 1.1 2008/08/31 06:52:29 dholland Exp $ d4 5 d10 10 a19 3 --- clients/xmxinit/xmxinit.c~ 1995-04-19 23:05:04.000000000 -0400 +++ clients/xmxinit/xmxinit.c 2008-08-31 02:38:46.000000000 -0400 @@@@ -30,7 +30,6 @@@@ Modified from X11R6 MIT source for xinit d27 30 a56 1 @@@@ -86,8 +85,8 @@@@ char **client = clientargv + 2; /* make d67 53 a119 1 @@@@ -350,7 +349,7 @@@@ processTimeout(timeout, string) d128 59 a186 3 @@@@ -588,10 +587,8 @@@@ Fatal(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9 Error(fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9) char *fmt; d189 10 a198 1 - d202 1 d204 1 a204 1 fprintf(stderr, fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); @ 1.1 log @Fix the "minor PLIST problems" and unmark this as only for SunOS. Add proper deps. Add destdir support. And, finally, make it build properly. (82 (small) patches later...) @ text @d1 3 a3 1 $NetBSD$ @