Thu Jul 9 09:44:18 2015 UTC ()
Use nbcompat headers.  Fix pid_t printing.  Fixes build on at least SunOS.


(jperkin)
diff -r1.3 -r1.4 pkgsrc/misc/autocue/files/autocue.c

cvs diff -r1.3 -r1.4 pkgsrc/misc/autocue/files/autocue.c (expand / switch to unified diff)

--- pkgsrc/misc/autocue/files/autocue.c 2007/02/24 12:16:12 1.3
+++ pkgsrc/misc/autocue/files/autocue.c 2015/07/09 09:44:18 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: autocue.c,v 1.3 2007/02/24 12:16:12 agc Exp $ */ 1/* $NetBSD: autocue.c,v 1.4 2015/07/09 09:44:18 jperkin Exp $ */
2 2
3/* 3/*
4 * Copyright © 2006 Alistair Crooks. All rights reserved. 4 * Copyright © 2006 Alistair Crooks. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote 14 * 3. The name of the author may not be used to endorse or promote
@@ -17,32 +17,38 @@ @@ -17,32 +17,38 @@
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
 30
 31#if defined(HAVE_NBCOMPAT_H)
 32#include <nbcompat.h>
 33#include <nbcompat/cdefs.h>
 34#else
30#include <sys/cdefs.h> 35#include <sys/cdefs.h>
 36#endif
31 37
32#ifndef lint 38#ifndef lint
33__COPYRIGHT("@(#) Copyright © 2006 \ 39__COPYRIGHT("@(#) Copyright © 2006 \
34 The NetBSD Foundation, Inc. All rights reserved."); 40 The NetBSD Foundation, Inc. All rights reserved.");
35__RCSID("$NetBSD: autocue.c,v 1.3 2007/02/24 12:16:12 agc Exp $"); 41__RCSID("$NetBSD: autocue.c,v 1.4 2015/07/09 09:44:18 jperkin Exp $");
36#endif 42#endif
37 43
38#include <err.h> 44#include <err.h>
39#include <signal.h> 45#include <signal.h>
40#include <stdio.h> 46#include <stdio.h>
41#include <stdlib.h> 47#include <stdlib.h>
42#include <string.h> 48#include <string.h>
43#include <unistd.h> 49#include <unistd.h>
44 50
45/* symbolic constants */ 51/* symbolic constants */
46enum { 52enum {
47 MaxCutBuffers = 4, 53 MaxCutBuffers = 4,
48 54
@@ -133,26 +139,26 @@ main(int argc, char **argv) @@ -133,26 +139,26 @@ main(int argc, char **argv)
133 } 139 }
134 if (argc - optind < 1) { 140 if (argc - optind < 1) {
135 errx(EXIT_FAILURE, "Usage: %s [-S numeric-speed] [-c max cut buffers] [-s speed] file", *argv); 141 errx(EXIT_FAILURE, "Usage: %s [-S numeric-speed] [-c max cut buffers] [-s speed] file", *argv);
136 } 142 }
137 if (speed == 0) { 143 if (speed == 0) {
138 err(EXIT_FAILURE, "Speed cannot be '0'"); 144 err(EXIT_FAILURE, "Speed cannot be '0'");
139 } 145 }
140 if (maxcut == 0) { 146 if (maxcut == 0) {
141 err(EXIT_FAILURE, "Maximum cut buffers cannot be '0'"); 147 err(EXIT_FAILURE, "Maximum cut buffers cannot be '0'");
142 } 148 }
143 if ((fp = fopen(argv[optind], "r")) == NULL) { 149 if ((fp = fopen(argv[optind], "r")) == NULL) {
144 errx(EXIT_FAILURE, "can't open `%s'", argv[optind]); 150 errx(EXIT_FAILURE, "can't open `%s'", argv[optind]);
145 } 151 }
146 printf("send this process - %d - a USR1 to make the display go faster, a USR2 to make it go slower\n", getpid()); 152 printf("send this process - %ld - a USR1 to make the display go faster, a USR2 to make it go slower\n", (long)getpid());
147 for (cc = 0 ; fgets(line, sizeof(line), fp) != NULL ; ) { 153 for (cc = 0 ; fgets(line, sizeof(line), fp) != NULL ; ) {
148 if (line[0] == '\n') { 154 if (line[0] == '\n') {
149 showbuffer(buf, cc, maxcut); 155 showbuffer(buf, cc, maxcut);
150 cc = 0; 156 cc = 0;
151 continue; 157 continue;
152 } 158 }
153 c = strlen(line); 159 c = strlen(line);
154 (void) memcpy(&buf[cc], line, c); 160 (void) memcpy(&buf[cc], line, c);
155 cc += c; 161 cc += c;
156 } 162 }
157 exit(EXIT_SUCCESS); 163 exit(EXIT_SUCCESS);
158} 164}