summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authoris <is@NetBSD.org>2000-10-11 20:23:46 +0000
committeris <is@NetBSD.org>2000-10-11 20:23:46 +0000
commitd8302e2d73ac3fde74ec6f157dcba7ddbd24fed2 (patch)
tree82097652f5c91d8e45d5b43f53eb7470aa1d0392 /usr.sbin/pkg_install
parent7f3f19a0680c4d2c4b935a576fa930aac4a3d26d (diff)
More format string cleanups by sommerfeld.
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/add/perform.c14
-rw-r--r--usr.sbin/pkg_install/lib/file.c8
-rw-r--r--usr.sbin/pkg_install/lib/lib.h5
3 files changed, 13 insertions, 14 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c
index bfc81e7d133..1b07af32bcb 100644
--- a/usr.sbin/pkg_install/add/perform.c
+++ b/usr.sbin/pkg_install/add/perform.c
@@ -1,11 +1,11 @@
-/* $NetBSD: perform.c,v 1.54 2000/10/01 12:23:21 hubertf Exp $ */
+/* $NetBSD: perform.c,v 1.55 2000/10/11 20:23:54 is Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.54 2000/10/01 12:23:21 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.55 2000/10/11 20:23:54 is Exp $");
#endif
#endif
@@ -369,7 +369,6 @@ pkg_do(char *pkg)
* and we better stop right now.
*/
char *s;
- char *fmt = NULL;
int skip = -1;
/* doing this right required to parse the full version(s),
@@ -378,18 +377,17 @@ pkg_do(char *pkg)
continue; /* would remove trailing '}' else */
if ((s = strpbrk(p->name, "<>")) != NULL) {
- fmt = "%.*s-[0-9]*";
skip = 0;
} else if ((s = strrchr(p->name, '-')) != NULL) {
- fmt = "%.*s[0-9]*";
skip = 1;
}
- if (fmt != NULL) {
+ if (skip >= 0) {
char buf[FILENAME_MAX];
- (void) snprintf(buf, sizeof(buf), fmt,
- (int)(s - p->name) + skip, p->name);
+ (void) snprintf(buf, sizeof(buf),
+ skip ? "%.*s[0-9]*" : "%.*s-[0-9]*",
+ (int)(s - p->name) + skip, p->name);
if (findmatchingname(dbdir, buf, note_whats_installed, installed) > 0) {
warnx("pkg `%s' required, but `%s' found installed.",
p->name, installed);
diff --git a/usr.sbin/pkg_install/lib/file.c b/usr.sbin/pkg_install/lib/file.c
index ca106617468..b1e5f222efb 100644
--- a/usr.sbin/pkg_install/lib/file.c
+++ b/usr.sbin/pkg_install/lib/file.c
@@ -1,11 +1,11 @@
-/* $NetBSD: file.c,v 1.41 2000/10/11 11:09:20 hubertf Exp $ */
+/* $NetBSD: file.c,v 1.42 2000/10/11 20:23:55 is Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
#else
-__RCSID("$NetBSD: file.c,v 1.41 2000/10/11 11:09:20 hubertf Exp $");
+__RCSID("$NetBSD: file.c,v 1.42 2000/10/11 20:23:55 is Exp $");
#endif
#endif
@@ -599,7 +599,7 @@ copy_file(char *dir, char *fname, char *to)
(void) snprintf(cmd, sizeof(cmd), "cp -r %s %s", fname, to);
else
(void) snprintf(cmd, sizeof(cmd), "cp -r %s/%s %s", dir, fname, to);
- if (vsystem(cmd)) {
+ if (vsystem("%s", cmd)) {
cleanup(0);
errx(2, "could not perform '%s'", cmd);
}
@@ -614,7 +614,7 @@ move_file(char *dir, char *fname, char *to)
(void) snprintf(cmd, sizeof(cmd), "mv %s %s", fname, to);
else
(void) snprintf(cmd, sizeof(cmd), "mv %s/%s %s", dir, fname, to);
- if (vsystem(cmd)) {
+ if (vsystem("%s", cmd)) {
cleanup(0);
errx(2, "could not perform '%s'", cmd);
}
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h
index f07a9b10c7f..d0cd70ef386 100644
--- a/usr.sbin/pkg_install/lib/lib.h
+++ b/usr.sbin/pkg_install/lib/lib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.30 2000/08/28 21:35:14 hubertf Exp $ */
+/* $NetBSD: lib.h,v 1.31 2000/10/11 20:23:55 is Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -165,7 +165,8 @@ typedef int (*matchfn) (const char *found, char *data);
/* Prototypes */
/* Misc */
-int vsystem(const char *,...);
+int vsystem(const char *,...)
+ __attribute__((__format__(__printf__, 1, 2)));
void cleanup(int);
char *make_playpen(char *, size_t, size_t);
char *where_playpen(void);