diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2009-01-02 00:11:02 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2009-01-02 00:11:02 +0000 |
commit | 4c9910069af6ea42d7a3955a3d3302bc9a7376f4 (patch) | |
tree | 9124844a6063cb72dc79f2f3f4b31f392a89b80f /usr.bin | |
parent | 547ebde69dd25f8156f6693c677d3007b77ec5f8 (diff) |
Add format attributes to functions that use variable arguments and
make the code -Wformat=2 clean. ok joris@ xsa@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/add.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/import.c | 5 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 21 | ||||
-rw-r--r-- | usr.bin/cvs/remote.h | 8 |
4 files changed, 19 insertions, 21 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c index 697f1f5d312..7a35b25c979 100644 --- a/usr.bin/cvs/add.c +++ b/usr.bin/cvs/add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: add.c,v 1.105 2008/06/15 04:38:52 tobias Exp $ */ +/* $OpenBSD: add.c,v 1.106 2009/01/02 00:11:01 canacar Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -558,8 +558,8 @@ add_entry(struct cvs_file *cf) if (cvs_server_active) { cvs_server_send_response("Checked-in %s/", cf->file_wd); - cvs_server_send_response(cf->file_path); - cvs_server_send_response(entry); + cvs_server_send_response("%s", cf->file_path); + cvs_server_send_response("%s", entry); } else { entlist = cvs_ent_open(cf->file_wd); cvs_ent_add(entlist, entry); diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c index 87e139e61ac..aa4779d6dd1 100644 --- a/usr.bin/cvs/import.c +++ b/usr.bin/cvs/import.c @@ -1,4 +1,4 @@ -/* $OpenBSD: import.c,v 1.97 2008/06/15 04:21:26 joris Exp $ */ +/* $OpenBSD: import.c,v 1.98 2009/01/02 00:11:01 canacar Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -30,7 +30,8 @@ void cvs_import_local(struct cvs_file *); static void import_loginfo(char *); static void import_new(struct cvs_file *); -static void import_printf(const char *, ...); +static void import_printf(const char *, ...) + __attribute__((format(printf, 1, 2))); static void import_update(struct cvs_file *); static void import_tag(struct cvs_file *, RCSNUM *, RCSNUM *); static BUF *import_get_rcsdiff(struct cvs_file *, RCSNUM *); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index afc7c25cafb..a341ed5fe30 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.282 2008/11/09 08:51:43 tobias Exp $ */ +/* $OpenBSD: rcs.c,v 1.283 2009/01/02 00:11:01 canacar Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -3179,7 +3179,6 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines, const u_char *c, *start, *fin, *end; char *kwstr; char expbuf[256], buf[256]; - char *fmt; size_t clen, kwlen, len, tlen; kwtype = 0; @@ -3314,9 +3313,8 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines, } if (kwtype & RCS_KW_DATE) { - fmt = "%Y/%m/%d %H:%M:%S "; - - if (strftime(buf, sizeof(buf), fmt, + if (strftime(buf, sizeof(buf), + "%Y/%m/%d %H:%M:%S ", &rdp->rd_date) == 0) fatal("rcs_kwexp_line: strftime " "failure"); @@ -3332,12 +3330,9 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines, * digit, %e would do so and there is * no better format for strftime(). */ - if (rdp->rd_date.tm_mday < 10) - fmt = "%B%e %Y "; - else - fmt = "%B %e %Y "; - - if (strftime(buf, sizeof(buf), fmt, + if (strftime(buf, sizeof(buf), + (rdp->rd_date.tm_mday < 10) ? + "%B%e %Y " : "%B %e %Y", &rdp->rd_date) == 0) fatal("rcs_kwexp_line: strftime " "failure"); @@ -3411,8 +3406,8 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_lines *lines, if (strlcat(linebuf, buf, sizeof(linebuf)) >= sizeof(buf)) fatal("rcs_kwexp_line: truncated"); - fmt = " %Y/%m/%d %H:%M:%S "; - if (strftime(buf, sizeof(buf), fmt, + if (strftime(buf, sizeof(buf), + " %Y/%m/%d %H:%M:%S ", &rdp->rd_date) == 0) fatal("rcs_kwexp_line: strftime " "failure"); diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index bc7a1a6cd56..4b598419f97 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.34 2008/07/08 12:54:50 joris Exp $ */ +/* $OpenBSD: remote.h,v 1.35 2009/01/02 00:11:01 canacar Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -50,7 +50,8 @@ extern int server_response; void cvs_client_connect_to_server(void); void cvs_client_disconnect(void); void cvs_client_send_logmsg(char *); -void cvs_client_send_request(char *, ...); +void cvs_client_send_request(char *, ...) + __attribute__((format(printf, 1, 2))); void cvs_client_read_response(void); void cvs_client_get_responses(void); @@ -74,7 +75,8 @@ void cvs_client_sendfile(struct cvs_file *); void cvs_client_send_files(char **, int); void cvs_server_root(char *); -void cvs_server_send_response(char *, ...); +void cvs_server_send_response(char *, ...) + __attribute__((format(printf, 1, 2))); void cvs_server_validresp(char *); void cvs_server_validreq(char *); void cvs_server_globalopt(char *); |