diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-09-29 02:07:50 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-09-29 02:07:50 +0000 |
commit | 68eb93e531c311f1c1a1c036d65026529a234efe (patch) | |
tree | 5c6ef9441e8fbd04342114d2d8b3966a8372c4df /usr.bin | |
parent | 221d803eec07d29e901837eee6eed241539b5c67 (diff) |
Mark eread(), veread(), and eformat() as printf-like and
Convert eread(buf, a2, a3, a4) to eread("%s", a2, a3, a4, buf)
ok millert@ lum@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/mg/cscope.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/def.h | 5 | ||||
-rw-r--r-- | usr.bin/mg/echo.c | 10 | ||||
-rw-r--r-- | usr.bin/mg/extend.c | 4 | ||||
-rw-r--r-- | usr.bin/mg/line.c | 4 |
5 files changed, 13 insertions, 14 deletions
diff --git a/usr.bin/mg/cscope.c b/usr.bin/mg/cscope.c index 6b1db8d81eb..3a28835744e 100644 --- a/usr.bin/mg/cscope.c +++ b/usr.bin/mg/cscope.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cscope.c,v 1.10 2015/09/26 21:51:58 jasper Exp $ */ +/* $OpenBSD: cscope.c,v 1.11 2015/09/29 02:07:49 guenther Exp $ */ /* * This file is in the public domain. @@ -408,7 +408,7 @@ do_cscope(int i) if (curtoken(0, 1, pattern) == FALSE) return (FALSE); - p = eread(csprompt[i], pattern, MAX_TOKEN, EFNEW | EFCR | EFDEF); + p = eread("%s", pattern, MAX_TOKEN, EFNEW | EFCR | EFDEF, csprompt[i]); if (p == NULL) return (ABORT); else if (p[0] == '\0') diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h index e8f466fd716..1ec5c97d561 100644 --- a/usr.bin/mg/def.h +++ b/usr.bin/mg/def.h @@ -1,4 +1,4 @@ -/* $OpenBSD: def.h,v 1.149 2015/09/26 15:03:15 lum Exp $ */ +/* $OpenBSD: def.h,v 1.150 2015/09/29 02:07:49 guenther Exp $ */ /* This file is in the public domain. */ @@ -451,7 +451,8 @@ int eyorn(const char *); int eynorr(const char *); int eyesno(const char *); void ewprintf(const char *fmt, ...); -char *eread(const char *, char *, size_t, int, ...); +char *eread(const char *, char *, size_t, int, ...) + __attribute__((__format__ (printf, 1, 5))); int getxtra(struct list *, struct list *, int, int); void free_file_list(struct list *); diff --git a/usr.bin/mg/echo.c b/usr.bin/mg/echo.c index e71dd64fa7b..510efec6549 100644 --- a/usr.bin/mg/echo.c +++ b/usr.bin/mg/echo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: echo.c,v 1.59 2015/05/08 12:35:08 bcallah Exp $ */ +/* $OpenBSD: echo.c,v 1.60 2015/09/29 02:07:49 guenther Exp $ */ /* This file is in the public domain. */ @@ -22,10 +22,12 @@ #include "key.h" #include "macro.h" -static char *veread(const char *, char *, size_t, int, va_list); +static char *veread(const char *, char *, size_t, int, va_list) + __attribute__((__format__ (printf, 1, 0))); static int complt(int, int, char *, size_t, int, int *); static int complt_list(int, char *, int); -static void eformat(const char *, va_list); +static void eformat(const char *, va_list) + __attribute__((__format__ (printf, 1, 0)));; static void eputi(int, int); static void eputl(long, int); static void eputs(const char *); @@ -154,7 +156,6 @@ eyesno(const char *sp) * XXX: When checking for an empty return value, always check rep, *not* buf * as buf may be freed in pathological cases. */ -/* VARARGS */ char * eread(const char *fmt, char *buf, size_t nbuf, int flag, ...) { @@ -801,7 +802,6 @@ getxtra(struct list *lp1, struct list *lp2, int cpos, int wflag) * line. The formatting is done by a call to the standard formatting * routine. */ -/* VARARGS */ void ewprintf(const char *fmt, ...) { diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c index 083ea30eda9..a306256d7d5 100644 --- a/usr.bin/mg/extend.c +++ b/usr.bin/mg/extend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: extend.c,v 1.62 2015/04/12 21:42:18 florian Exp $ */ +/* $OpenBSD: extend.c,v 1.63 2015/09/29 02:07:49 guenther Exp $ */ /* This file is in the public domain. */ @@ -507,7 +507,7 @@ redefine_key(int f, int n) KEYMAP *mp; (void)strlcpy(buf, "Define key map: ", sizeof(buf)); - if ((bufp = eread(buf, tmp, sizeof(tmp), EFNEW)) == NULL) + if ((bufp = eread("%s", tmp, sizeof(tmp), EFNEW, buf)) == NULL) return (ABORT); else if (bufp[0] == '\0') return (FALSE); diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c index 998bd859cc9..50395aa164a 100644 --- a/usr.bin/mg/line.c +++ b/usr.bin/mg/line.c @@ -1,4 +1,4 @@ -/* $OpenBSD: line.c,v 1.56 2015/06/03 23:40:01 bcallah Exp $ */ +/* $OpenBSD: line.c,v 1.57 2015/09/29 02:07:49 guenther Exp $ */ /* This file is in the public domain. */ @@ -395,13 +395,11 @@ ldelete(RSIZE n, int kflag) dotp->l_used -= (int)chunk; for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_dotp == dotp && wp->w_doto >= doto) { - /* NOSTRICT */ wp->w_doto -= chunk; if (wp->w_doto < doto) wp->w_doto = doto; } if (wp->w_markp == dotp && wp->w_marko >= doto) { - /* NOSTRICT */ wp->w_marko -= chunk; if (wp->w_marko < doto) wp->w_marko = doto; |