summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-04-17 07:46:38 +0000
committerkris <kris@FreeBSD.org>2001-04-17 07:46:38 +0000
commitb6da0fca774d229c4776e41d019373d1ec0df7ab (patch)
tree90405fcc57a8301012105d9d0facc3ded561a0f6 /bin/sh
parent9acb56a18a243e153f49b5fc26f3b3050492b013 (diff)
downloadFreeBSD-src-b6da0fca774d229c4776e41d019373d1ec0df7ab.zip
FreeBSD-src-b6da0fca774d229c4776e41d019373d1ec0df7ab.tar.gz
-Wnon-const-format sweep: make format strings const char *'s, add
__printflike()/__printf0like() to function prototypes, as appropriate. Reviewed by: bde, -audit
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/bltin/bltin.h2
-rw-r--r--bin/sh/error.c10
-rw-r--r--bin/sh/error.h4
-rw-r--r--bin/sh/mknodes.c4
-rw-r--r--bin/sh/output.c18
-rw-r--r--bin/sh/output.h10
-rw-r--r--bin/sh/show.h2
7 files changed, 25 insertions, 25 deletions
diff --git a/bin/sh/bltin/bltin.h b/bin/sh/bltin/bltin.h
index a96c476..5d2b02a 100644
--- a/bin/sh/bltin/bltin.h
+++ b/bin/sh/bltin/bltin.h
@@ -85,7 +85,7 @@
#ifdef __STDC__
pointer stalloc(int);
-void error(char *, ...);
+void error(const char *, ...) __printf0like(1, 2);
#else
pointer stalloc();
void error();
diff --git a/bin/sh/error.c b/bin/sh/error.c
index e079699..0407bac 100644
--- a/bin/sh/error.c
+++ b/bin/sh/error.c
@@ -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)
diff --git a/bin/sh/error.h b/bin/sh/error.h
index b86e177..938ef91 100644
--- a/bin/sh/error.h
+++ b/bin/sh/error.h
@@ -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));
diff --git a/bin/sh/mknodes.c b/bin/sh/mknodes.c
index 007cb32..6fea8ec 100644
--- a/bin/sh/mknodes.c
+++ b/bin/sh/mknodes.c
@@ -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
diff --git a/bin/sh/output.c b/bin/sh/output.c
index 82ae380..2989c9a 100644
--- a/bin/sh/output.c
+++ b/bin/sh/output.c
@@ -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;
diff --git a/bin/sh/output.h b/bin/sh/output.h
index f99db6b..425b49f 100644
--- a/bin/sh/output.h
+++ b/bin/sh/output.h
@@ -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 *));
diff --git a/bin/sh/show.h b/bin/sh/show.h
index 837d21c..98ec398 100644
--- a/bin/sh/show.h
+++ b/bin/sh/show.h
@@ -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 *));
OpenPOWER on IntegriCloud