Add a gcc printf attribute to the printf functions and fix the lossage caught.

This commit is contained in:
christos 2009-11-14 23:31:37 +00:00
parent 6114d6b7fd
commit 1070653ee5
5 changed files with 27 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.2 2008/12/05 22:51:42 christos Exp $ */
/* $NetBSD: extern.h,v 1.3 2009/11/14 23:31:37 christos Exp $ */
/* Do not edit: automatically built by build/distrib. */
SCR *api_fscreen __P((int, char *));
@ -93,7 +93,8 @@ int mark_end __P((SCR *, EXF *));
int mark_get __P((SCR *, ARG_CHAR_T, MARK *, mtype_t));
int mark_set __P((SCR *, ARG_CHAR_T, MARK *, int));
int mark_insdel __P((SCR *, lnop_t, db_recno_t));
void msgq __P((SCR *, mtype_t, const char *, ...));
void msgq __P((SCR *, mtype_t, const char *, ...))
__attribute__((__format__(__printf__, 3, 4)));
void msgq_wstr __P((SCR *, mtype_t, const CHAR_T *, const char *));
void msgq_str __P((SCR *, mtype_t, const char *, const char *));
void mod_rpt __P((SCR *));
@ -158,7 +159,8 @@ int seq_save __P((SCR *, FILE *, const char *, seq_t));
int e_memcmp __P((CHAR_T *, EVENT *, size_t));
void vtrace_end __P((void));
void vtrace_init __P((char *));
void vtrace __P((const char *, ...));
void vtrace __P((const char *, ...))
__attribute__((__format__(__printf__, 1, 2)));
void *binc __P((SCR *, void *, size_t *, size_t));
int nonblank __P((SCR *, db_recno_t, size_t *));
const char *tail __P((const char *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: options.c,v 1.6 2009/08/07 16:19:53 lukem Exp $ */
/* $NetBSD: options.c,v 1.7 2009/11/14 23:31:37 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -475,8 +475,8 @@ opts_init(SCR *sp, int *oargs)
}
return (0);
err: msgq(sp, M_ERR,
"031|Unable to set default %s option", optlist[optindx].name);
err: msgq_wstr(sp, M_ERR, optlist[optindx].name,
"031|Unable to set default %s option");
return (1);
}

22
dist/nvi/ex/ex.c vendored
View File

@ -1,4 +1,4 @@
/* $NetBSD: ex.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
/* $NetBSD: ex.c,v 1.5 2009/11/14 23:31:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -583,8 +583,8 @@ skip_srch: if (ecp->cmd == &cmds[C_VISUAL_EX] && F_ISSET(sp, SC_VI))
/* Check for ex mode legality. */
if (F_ISSET(sp, SC_EX) && (F_ISSET(ecp->cmd, E_VIONLY) || newscreen)) {
msgq(sp, M_ERR,
"082|%s: command not available in ex mode", ecp->cmd->name);
msgq_wstr(sp, M_ERR, ecp->cmd->name,
"082|%s: command not available in ex mode");
goto err;
}
@ -1208,10 +1208,15 @@ arg_cnt_chk: if (*++np != 'N') { /* N */
goto usage;
}
goto addr_verify;
default:
default: {
const char *nstr;
size_t nlen;
INT2CHAR(sp, ecp->cmd->name, STRLEN(ecp->cmd->name) + 1,
nstr, nlen);
msgq(sp, M_ERR,
"085|Internal syntax table error (%s: %s)",
ecp->cmd->name, KEY_NAME(sp, *np));
nstr, KEY_NAME(sp, *np));
}
}
}
@ -2312,7 +2317,7 @@ ex_badaddr(SCR *sp, const EXCMDLIST *cp, enum badaddr ba, enum nresult nret)
if (lno != 0) {
msgq(sp, M_ERR,
"102|Illegal address: only %lu lines in the file",
lno);
(unsigned long)lno);
break;
}
/* FALLTHROUGH */
@ -2323,9 +2328,8 @@ ex_badaddr(SCR *sp, const EXCMDLIST *cp, enum badaddr ba, enum nresult nret)
abort();
/* NOTREACHED */
case A_ZERO:
msgq(sp, M_ERR,
"104|The %s command doesn't permit an address of 0",
cp->name);
msgq_wstr(sp, M_ERR, cp->name,
"104|The %s command doesn't permit an address of 0");
break;
}
return;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ex_global.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
/* $NetBSD: ex_global.c,v 1.3 2009/11/14 23:31:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -80,9 +80,8 @@ ex_g_setup(SCR *sp, EXCMD *cmdp, enum which cmd)
NEEDFILE(sp, cmdp);
if (F_ISSET(sp, SC_EX_GLOBAL)) {
msgq(sp, M_ERR,
"124|The %s command can't be used as part of a global or v command",
cmdp->cmd->name);
msgq_wstr(sp, M_ERR, cmdp->cmd->name,
"124|The %s command can't be used as part of a global or v command");
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ex_read.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
/* $NetBSD: ex_read.c,v 1.3 2009/11/14 23:31:37 christos Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@ -345,7 +345,8 @@ ex_readfp(SCR *sp, const char *name, FILE *fp, MARK *fm, db_recno_t *nlinesp, in
if (!silent) {
char *q = msg_print(sp, name, &nf);
msgq(sp, M_INFO,
"148|%s: %lu lines, %lu characters", q, lcnt, ccnt);
"148|%s: %lu lines, %lu characters", q, (unsigned long)lcnt,
(unsigned long)ccnt);
if (nf)
FREE_SPACE(sp, q, 0);
}