Annotate functions using format strings.diff -r1.8 -r1.9 src/usr.bin/flock/flock.c
(joerg)
--- src/usr.bin/flock/flock.c 2013/10/29 16:02:15 1.8
+++ src/usr.bin/flock/flock.c 2014/01/07 02:07:08 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: flock.c,v 1.8 2013/10/29 16:02:15 christos Exp $ */ | 1 | /* $NetBSD: flock.c,v 1.9 2014/01/07 02:07:08 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Christos Zoulas. | 8 | * by Christos Zoulas. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -21,27 +21,27 @@ | @@ -21,27 +21,27 @@ | |||
21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 22 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __RCSID("$NetBSD: flock.c,v 1.8 2013/10/29 16:02:15 christos Exp $"); | 34 | __RCSID("$NetBSD: flock.c,v 1.9 2014/01/07 02:07:08 joerg Exp $"); | |
35 | 35 | |||
36 | #include <stdio.h> | 36 | #include <stdio.h> | |
37 | #include <string.h> | 37 | #include <string.h> | |
38 | #include <fcntl.h> | 38 | #include <fcntl.h> | |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> | |
40 | #include <signal.h> | 40 | #include <signal.h> | |
41 | #include <unistd.h> | 41 | #include <unistd.h> | |
42 | #include <err.h> | 42 | #include <err.h> | |
43 | #include <errno.h> | 43 | #include <errno.h> | |
44 | #include <getopt.h> | 44 | #include <getopt.h> | |
45 | #include <paths.h> | 45 | #include <paths.h> | |
46 | #include <time.h> | 46 | #include <time.h> | |
47 | 47 | |||
@@ -53,27 +53,27 @@ static struct option flock_longopts[] = | @@ -53,27 +53,27 @@ static struct option flock_longopts[] = | |||
53 | { "close", no_argument, 0, 'o' }, | 53 | { "close", no_argument, 0, 'o' }, | |
54 | { "shared", no_argument, 0, 's' }, | 54 | { "shared", no_argument, 0, 's' }, | |
55 | { "exclusive", no_argument, 0, 'x' }, | 55 | { "exclusive", no_argument, 0, 'x' }, | |
56 | { "unlock", no_argument, 0, 'u' }, | 56 | { "unlock", no_argument, 0, 'u' }, | |
57 | { "verbose", no_argument, 0, 'v' }, | 57 | { "verbose", no_argument, 0, 'v' }, | |
58 | { "command", required_argument, 0, 'c' }, | 58 | { "command", required_argument, 0, 'c' }, | |
59 | { "wait", required_argument, 0, 'w' }, | 59 | { "wait", required_argument, 0, 'w' }, | |
60 | { "timeout", required_argument, 0, 'w' }, | 60 | { "timeout", required_argument, 0, 'w' }, | |
61 | { NULL, 0, 0, 0 }, | 61 | { NULL, 0, 0, 0 }, | |
62 | }; | 62 | }; | |
63 | 63 | |||
64 | static sig_atomic_t timeout_expired; | 64 | static sig_atomic_t timeout_expired; | |
65 | 65 | |||
66 | static __dead void | 66 | static __dead __printflike(1, 2) void | |
67 | usage(const char *fmt, ...) | 67 | usage(const char *fmt, ...) | |
68 | { | 68 | { | |
69 | if (fmt) { | 69 | if (fmt) { | |
70 | va_list ap; | 70 | va_list ap; | |
71 | va_start(ap, fmt); | 71 | va_start(ap, fmt); | |
72 | fprintf(stderr, "%s: ", getprogname()); | 72 | fprintf(stderr, "%s: ", getprogname()); | |
73 | vfprintf(stderr, fmt, ap); | 73 | vfprintf(stderr, fmt, ap); | |
74 | fputc('\n', stderr); | 74 | fputc('\n', stderr); | |
75 | va_end(ap); | 75 | va_end(ap); | |
76 | } | 76 | } | |
77 | 77 | |||
78 | fprintf(stderr, "Usage: %s [-dnosvx] [-w timeout] lockfile|lockdir " | 78 | fprintf(stderr, "Usage: %s [-dnosvx] [-w timeout] lockfile|lockdir " | |
79 | "[-c command]|command ...\n\t%s [-dnsuvx] [-w timeout] lockfd\n", | 79 | "[-c command]|command ...\n\t%s [-dnsuvx] [-w timeout] lockfd\n", |
--- src/usr.bin/ftp/ssl.h 2012/12/21 18:07:36 1.1
+++ src/usr.bin/ftp/ssl.h 2014/01/07 02:07:08 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ssl.h,v 1.1 2012/12/21 18:07:36 christos Exp $ */ | 1 | /* $NetBSD: ssl.h,v 1.2 2014/01/07 02:07:08 joerg Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -20,27 +20,28 @@ | @@ -20,27 +20,28 @@ | |||
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | #ifdef WITH_SSL | 28 | #ifdef WITH_SSL | |
29 | 29 | |||
30 | #define FETCH struct fetch_connect | 30 | #define FETCH struct fetch_connect | |
31 | struct fetch_connect; | 31 | struct fetch_connect; | |
32 | 32 | |||
33 | int fetch_printf(struct fetch_connect *, const char *fmt, ...); | 33 | int fetch_printf(struct fetch_connect *, const char *fmt, ...) | |
34 | __printflike(2, 3); | |||
34 | int fetch_fileno(struct fetch_connect *); | 35 | int fetch_fileno(struct fetch_connect *); | |
35 | int fetch_error(struct fetch_connect *); | 36 | int fetch_error(struct fetch_connect *); | |
36 | int fetch_flush(struct fetch_connect *); | 37 | int fetch_flush(struct fetch_connect *); | |
37 | struct fetch_connect *fetch_open(const char *, const char *); | 38 | struct fetch_connect *fetch_open(const char *, const char *); | |
38 | struct fetch_connect *fetch_fdopen(int, const char *); | 39 | struct fetch_connect *fetch_fdopen(int, const char *); | |
39 | int fetch_close(struct fetch_connect *); | 40 | int fetch_close(struct fetch_connect *); | |
40 | ssize_t fetch_read(void *, size_t, size_t, struct fetch_connect *); | 41 | ssize_t fetch_read(void *, size_t, size_t, struct fetch_connect *); | |
41 | char *fetch_getln(char *, int, struct fetch_connect *); | 42 | char *fetch_getln(char *, int, struct fetch_connect *); | |
42 | int fetch_getline(struct fetch_connect *, char *, size_t, const char **); | 43 | int fetch_getline(struct fetch_connect *, char *, size_t, const char **); | |
43 | void fetch_set_ssl(struct fetch_connect *, void *); | 44 | void fetch_set_ssl(struct fetch_connect *, void *); | |
44 | void *fetch_start_ssl(int); | 45 | void *fetch_start_ssl(int); | |
45 | 46 | |||
46 | #else /* !WITH_SSL */ | 47 | #else /* !WITH_SSL */ |
--- src/usr.bin/units/units.c 2013/01/06 00:19:13 1.24
+++ src/usr.bin/units/units.c 2014/01/07 02:07:09 1.25
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: units.c,v 1.24 2013/01/06 00:19:13 wiz Exp $ */ | 1 | /* $NetBSD: units.c,v 1.25 2014/01/07 02:07:09 joerg Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * units.c Copyright (c) 1993 by Adrian Mariano (adrian@cam.cornell.edu) | 4 | * units.c Copyright (c) 1993 by Adrian Mariano (adrian@cam.cornell.edu) | |
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. The name of the author may not be used to endorse or promote products | 11 | * 2. The name of the author may not be used to endorse or promote products | |
12 | * derived from this software without specific prior written permission. | 12 | * derived from this software without specific prior written permission. | |
13 | * Disclaimer: This software is provided by the author "as is". The author | 13 | * Disclaimer: This software is provided by the author "as is". The author | |
14 | * shall not be liable for any damages caused in any way by this software. | 14 | * shall not be liable for any damages caused in any way by this software. | |
@@ -95,27 +95,27 @@ static const char *lookupunit(const char | @@ -95,27 +95,27 @@ static const char *lookupunit(const char | |||
95 | 95 | |||
96 | static char * | 96 | static char * | |
97 | dupstr(const char *str) | 97 | dupstr(const char *str) | |
98 | { | 98 | { | |
99 | char *ret; | 99 | char *ret; | |
100 | 100 | |||
101 | ret = strdup(str); | 101 | ret = strdup(str); | |
102 | if (!ret) | 102 | if (!ret) | |
103 | err(3, "Memory allocation error"); | 103 | err(3, "Memory allocation error"); | |
104 | return (ret); | 104 | return (ret); | |
105 | } | 105 | } | |
106 | 106 | |||
107 | 107 | |||
108 | static void | 108 | static __printflike(1, 2) void | |
109 | mywarnx(const char *fmt, ...) | 109 | mywarnx(const char *fmt, ...) | |
110 | { | 110 | { | |
111 | va_list args; | 111 | va_list args; | |
112 | 112 | |||
113 | va_start(args, fmt); | 113 | va_start(args, fmt); | |
114 | if (errprefix) { | 114 | if (errprefix) { | |
115 | /* warn to stdout, with errprefix prepended */ | 115 | /* warn to stdout, with errprefix prepended */ | |
116 | printf("%s", errprefix); | 116 | printf("%s", errprefix); | |
117 | vprintf(fmt, args); | 117 | vprintf(fmt, args); | |
118 | printf("%s", "\n"); | 118 | printf("%s", "\n"); | |
119 | } else { | 119 | } else { | |
120 | /* warn to stderr */ | 120 | /* warn to stderr */ | |
121 | vwarnx(fmt, args); | 121 | vwarnx(fmt, args); |