pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/add Check explictly for arg...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e3a006e99c43
branches: trunk
changeset: 532206:e3a006e99c43
user: joerg <joerg%pkgsrc.org@localhost>
date: Mon Aug 13 19:13:13 2007 +0000
description:
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:
pkgtools/pkg_install/files/add/main.c | 17 +++++++++--------
pkgtools/pkg_install/files/add/perform.c | 19 +++----------------
2 files changed, 12 insertions(+), 24 deletions(-)
diffs (86 lines):
diff -r bb47c4d58145 -r e3a006e99c43 pkgtools/pkg_install/files/add/main.c
--- a/pkgtools/pkg_install/files/add/main.c Mon Aug 13 18:25:41 2007 +0000
+++ b/pkgtools/pkg_install/files/add/main.c Mon Aug 13 19:13:13 2007 +0000
@@ -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 @@
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 @@
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 -r bb47c4d58145 -r e3a006e99c43 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c Mon Aug 13 18:25:41 2007 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c Mon Aug 13 19:13:13 2007 +0000
@@ -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 @@
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);
Home |
Main Index |
Thread Index |
Old Index