-Wnon-const-format sweep: make format strings const char *'s, add

__printflike()/__printf0like() to function prototypes, as appropriate.

Reviewed by:	bde, -audit
This commit is contained in:
kris 2001-04-17 07:46:38 +00:00
parent 9acb56a18a
commit b6da0fca77
11 changed files with 37 additions and 36 deletions

View File

@ -279,7 +279,7 @@ int ustar_wr __P((register ARCHD *));
* tty_subs.c
*/
int tty_init __P((void));
void tty_prnt __P((char *, ...));
void tty_prnt __P((const char *, ...)) __printflike(1, 2);
int tty_read __P((char *, int));
void pax_warn __P((int, char *, ...));
void sys_warn __P((int, int, char *, ...));
void pax_warn __P((int, const char *, ...)) __printflike(2, 3);
void sys_warn __P((int, int, const char *, ...)) __printflike(3, 4);

View File

@ -106,11 +106,11 @@ tty_init()
#if __STDC__
void
tty_prnt(char *fmt, ...)
tty_prnt(const char *fmt, ...)
#else
void
tty_prnt(fmt, va_alist)
char *fmt;
const char *fmt;
va_dcl
#endif
{
@ -167,12 +167,12 @@ tty_read(str, len)
#if __STDC__
void
pax_warn(int set, char *fmt, ...)
pax_warn(int set, const char *fmt, ...)
#else
void
pax_warn(set, fmt, va_alist)
int set;
char *fmt;
const char *fmt;
va_dcl
#endif
{
@ -206,13 +206,13 @@ pax_warn(set, fmt, va_alist)
#if __STDC__
void
sys_warn(int set, int errnum, char *fmt, ...)
sys_warn(int set, int errnum, const char *fmt, ...)
#else
void
sys_warn(set, errnum, fmt, va_alist)
int set;
int errnum;
char *fmt;
const char *fmt;
va_dcl
#endif
{

View File

@ -46,6 +46,6 @@ char *colon __P((char *));
void lostconn __P((int));
void nospace __P((void));
int okname __P((char *));
void run_err __P((const char *, ...));
void run_err __P((const char *, ...)) __printflike(1, 2);
int susystem __P((char *, int));
void verifydir __P((char *));

View File

@ -106,10 +106,11 @@ char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */
#ifdef KERBEROS
int kerberos __P((char **, char *, char *, char *));
void oldw __P((const char *, ...));
void oldw __P((const char *, ...)) __printflike(1, 2);
#endif
int response __P((void));
void rsource __P((char *, struct stat *));
void run_err __P((const char *, ...)) __printflike(1, 2);
void sink __P((int, char *[]));
void source __P((int, char *[]));
void tolocal __P((int, char *[]));

View File

@ -85,7 +85,7 @@
#ifdef __STDC__
pointer stalloc(int);
void error(char *, ...);
void error(const char *, ...) __printf0like(1, 2);
#else
pointer stalloc();
void error();

View File

@ -70,7 +70,7 @@ volatile sig_atomic_t intpending;
char *commandname;
static void exverror __P((int, char *, va_list));
static void exverror __P((int, const char *, va_list)) __printf0like(2, 0);
/*
* Called to raise an exception. Since C doesn't include exceptions, we
@ -141,7 +141,7 @@ onint() {
static void
exverror(cond, msg, ap)
int cond;
char *msg;
const char *msg;
va_list ap;
{
CLEAR_PENDING_INT;
@ -166,7 +166,7 @@ exverror(cond, msg, ap)
#ifdef __STDC__
void
error(char *msg, ...)
error(const char *msg, ...)
#else
void
error(va_alist)
@ -174,7 +174,7 @@ error(va_alist)
#endif
{
#ifndef __STDC__
char *msg;
const char *msg;
#endif
va_list ap;
#ifdef __STDC__
@ -190,7 +190,7 @@ error(va_alist)
#ifdef __STDC__
void
exerror(int cond, char *msg, ...)
exerror(int cond, const char *msg, ...)
#else
void
exerror(va_alist)

View File

@ -91,8 +91,8 @@ extern volatile sig_atomic_t intpending;
void exraise __P((int));
void onint __P((void));
void error __P((char *, ...));
void exerror __P((int, char *, ...));
void error __P((const char *, ...)) __printf0like(1, 2);
void exerror __P((int, const char *, ...)) __printf0like(2, 3);
char *errmsg __P((int, int));

View File

@ -112,7 +112,7 @@ static void indent __P((int, FILE *));
static int nextfield __P((char *));
static void skipbl __P((void));
static int readline __P((void));
static void error __P((const char *, ...));
static void error __P((const char *, ...)) __printf0like(1, 2);
static char *savestr __P((const char *));
@ -451,7 +451,7 @@ error(va_alist)
#ifdef __STDC__
va_start(va, msg);
#else
char *msg;
const char *msg;
va_start(va);
msg = va_arg(va, char *);
#endif

View File

@ -221,7 +221,7 @@ freestdout() {
#ifdef __STDC__
void
outfmt(struct output *file, char *fmt, ...) {
outfmt(struct output *file, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
@ -231,7 +231,7 @@ outfmt(struct output *file, char *fmt, ...) {
void
out1fmt(char *fmt, ...) {
out1fmt(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
@ -240,7 +240,7 @@ out1fmt(char *fmt, ...) {
}
void
dprintf(char *fmt, ...) {
dprintf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
@ -250,7 +250,7 @@ dprintf(char *fmt, ...) {
}
void
fmtstr(char *outbuf, int length, char *fmt, ...) {
fmtstr(char *outbuf, int length, const char *fmt, ...) {
va_list ap;
struct output strout;
@ -273,7 +273,7 @@ outfmt(va_alist)
{
va_list ap;
struct output *file;
char *fmt;
const char *fmt;
va_start(ap);
file = va_arg(ap, struct output *);
@ -288,7 +288,7 @@ out1fmt(va_alist)
va_dcl
{
va_list ap;
char *fmt;
const char *fmt;
va_start(ap);
fmt = va_arg(ap, char *);
@ -301,7 +301,7 @@ dprintf(va_alist)
va_dcl
{
va_list ap;
char *fmt;
const char *fmt;
va_start(ap);
fmt = va_arg(ap, char *);
@ -318,7 +318,7 @@ fmtstr(va_alist)
struct output strout;
char *outbuf;
int length;
char *fmt;
const char *fmt;
va_start(ap);
outbuf = va_arg(ap, char *);
@ -357,7 +357,7 @@ static const char digit[] = "0123456789ABCDEF";
void
doformat(dest, f, ap)
struct output *dest;
char *f; /* format string */
const char *f; /* format string */
va_list ap;
{
char c;

View File

@ -68,11 +68,11 @@ void emptyoutbuf __P((struct output *));
void flushall __P((void));
void flushout __P((struct output *));
void freestdout __P((void));
void outfmt __P((struct output *, char *, ...));
void out1fmt __P((char *, ...));
void dprintf __P((char *, ...));
void fmtstr __P((char *, int, char *, ...));
void doformat __P((struct output *, char *, va_list));
void outfmt __P((struct output *, const char *, ...)) __printflike(2, 3);
void out1fmt __P((const char *, ...)) __printflike(1, 2);
void dprintf __P((const char *, ...)) __printflike(1, 2);
void fmtstr __P((char *, int, const char *, ...)) __printflike(3, 4);
void doformat __P((struct output *, const char *, va_list)) __printflike(2, 0);
int xwrite __P((int, char *, int));
int xioctl __P((int, unsigned long, char *));

View File

@ -36,7 +36,7 @@
void showtree __P((union node *));
#ifdef DEBUG
void sh_trace __P((const char *, ...));
void sh_trace __P((const char *, ...)) __printflike(1, 2);
void trargs __P((char **));
void trputc __P((int));
void trputs __P((char *));