Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.sbin/pkg_install/lib Pull up to netbsd-1-5 branch, ...
details: https://anonhg.NetBSD.org/src/rev/1324ae28e14d
branches: netbsd-1-5
changeset: 489300:1324ae28e14d
user: hubertf <hubertf%NetBSD.org@localhost>
date: Tue Aug 29 01:44:26 2000 +0000
description:
Pull up to netbsd-1-5 branch, OK'd by thorpej:
Revisions:
> cvs rdiff -r1.21 -r1.22 basesrc/usr.sbin/pkg_install/lib/ftpio.c
> cvs rdiff -r1.29 -r1.30 basesrc/usr.sbin/pkg_install/lib/lib.h
Log message:
> * Make a few functions public so this code can be used by other programs
> * Comment a workaround for a certain lukem ftp behaviour
> * Fix a bug where a invalid initial dir was not caught early enough
diffstat:
usr.sbin/pkg_install/lib/ftpio.c | 17 ++++++++++++-----
usr.sbin/pkg_install/lib/lib.h | 4 +++-
2 files changed, 15 insertions(+), 6 deletions(-)
diffs (77 lines):
diff -r e477c7e02f6b -r 1324ae28e14d usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c Tue Aug 29 01:30:49 2000 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c Tue Aug 29 01:44:26 2000 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: ftpio.c,v 1.20.2.1 2000/07/13 03:17:59 hubertf Exp $ */
+/* $NetBSD: ftpio.c,v 1.20.2.2 2000/08/29 01:44:26 hubertf Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.20.2.1 2000/07/13 03:17:59 hubertf Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.20.2.2 2000/08/29 01:44:26 hubertf Exp $");
#endif
/*
@@ -193,7 +193,7 @@
* "expectstr" to be returned. Return numeric FTP return code or -1
* in case of an error (usually expect() timeout)
*/
-static int
+int
ftp_cmd(const char *cmd, const char *expectstr)
{
int rc=0, verbose_ftp=0;
@@ -351,7 +351,7 @@
* If the requested host/dir is different than the one that the
* coprocess is currently at, close first.
*/
-static int
+int
ftp_start(char *base)
{
char *tmp1, *tmp2;
@@ -397,18 +397,25 @@
needclose=1;
signal(SIGPIPE, sigpipe_handler);
-
+
if ((expect(ftpio.answer, "\n(221|250|221|550).*\n", &rc) != 0)
|| rc != 250) {
warnx("expect1 failed, rc=%d", rc);
return -1;
}
+ /* lukemftp now issues a CWD for each part of the path
+ * and will return a code for each of them. No idea how to
+ * deal with that other than to issue a 'prompt off' to
+ * get something that we can wait for and that does NOT
+ * look like a CWD command's output */
rc = ftp_cmd("prompt off\n", "\n(Interactive mode off|221).*\n");
if ((rc == 221) || (rc == -1)) {
/* something is wrong */
ftp_started=1; /* not really, but for ftp_stop() */
ftp_stop();
+ warnx("prompt failed - wrong dir?");
+ return -1;
}
ftp_started=1;
diff -r e477c7e02f6b -r 1324ae28e14d usr.sbin/pkg_install/lib/lib.h
--- a/usr.sbin/pkg_install/lib/lib.h Tue Aug 29 01:30:49 2000 +0000
+++ b/usr.sbin/pkg_install/lib/lib.h Tue Aug 29 01:44:26 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.29 2000/01/19 23:28:33 hubertf Exp $ */
+/* $NetBSD: lib.h,v 1.29.4.1 2000/08/29 01:44:27 hubertf Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -211,6 +211,8 @@
/* ftpio.c: FTP handling */
int expandURL(char *expandedurl, const char *wildcardurl);
int unpackURL(const char *url, const char *dir);
+int ftp_cmd(const char *cmd, const char *expectstr);
+int ftp_start(char *base);
void ftp_stop(void);
/* Packing list */
Home |
Main Index |
Thread Index |
Old Index