summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorjoerg <joerg>2007-08-13 19:13:13 +0000
committerjoerg <joerg>2007-08-13 19:13:13 +0000
commitb26d5ae346ebe356d75706d3b7783e139be5099e (patch)
tree45fb6dd65eb39f5c50f5bfe8333b92b5d3c9ac19 /pkgtools
parent9cb1eabfa4979c8c76f26e509a90572e0265310e (diff)
downloadpkgsrc-b26d5ae346ebe356d75706d3b7783e139be5099e.tar.gz
Check explictly for argc == 0 to find out if options where specified.
Don't depend on NULL termination of argv, count instead. Remove more traces of slave mode.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/add/main.c17
-rw-r--r--pkgtools/pkg_install/files/add/perform.c19
2 files changed, 12 insertions, 24 deletions
diff --git a/pkgtools/pkg_install/files/add/main.c b/pkgtools/pkg_install/files/add/main.c
index d73b2436d63..d775f8b40c8 100644
--- a/pkgtools/pkg_install/files/add/main.c
+++ b/pkgtools/pkg_install/files/add/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.11 2007/07/30 08:09:14 joerg Exp $ */
+/* $NetBSD: main.c,v 1.12 2007/08/13 19:13:13 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.11 2007/07/30 08:09:14 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.12 2007/08/13 19:13:13 joerg Exp $");
#endif
#endif
@@ -162,8 +162,14 @@ main(int argc, char **argv)
path_create(getenv("PKG_PATH"));
TAILQ_INIT(&pkgs);
+ if (argc == 0) {
+ /* If no packages, yelp */
+ warnx("missing package name(s)");
+ usage();
+ }
+
/* Get all the remaining package names, if any */
- for (ch = 0; *argv; ch++, argv++) {
+ for (; argc > 0; --argc, ++argv) {
lpkg_t *lpp;
if (IS_STDIN(*argv))
@@ -173,11 +179,6 @@ main(int argc, char **argv)
TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
}
-
- if (!ch) {
- /* If no packages, yelp */
- warnx("missing package name(s)"), usage();
- }
/* Increase # of max. open file descriptors as high as possible */
rc = getrlimit(RLIMIT_NOFILE, &rlim);
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index 34f7925cebe..fedfade7d33 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.54 2007/08/09 23:32:59 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.55 2007/08/13 19:13:14 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -14,7 +14,7 @@
#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 2007/08/09 23:32:59 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.55 2007/08/13 19:13:14 joerg Exp $");
#endif
#endif
@@ -238,20 +238,7 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
umask(DEF_UMASK);
- /* Are we coming in for a second pass, everything already extracted?
- * (Slave mode) */
- if (!pkg) {
- fgets(playpen, MaxPathSize, stdin);
- playpen[strlen(playpen) - 1] = '\0'; /* remove newline! */
- if (chdir(playpen) == FAIL) {
- warnx("add in SLAVE mode can't chdir to %s", playpen);
- return 1;
- }
- read_plist(&Plist, stdin);
- where_to = playpen;
- }
- /* Nope - do it now */
- else {
+ {
const char *tmppkg;
tmppkg = fileFindByPath(pkg);