#include <rpmlib.h>
#include <rpmio.h>
-/*@access FD_t@*/
-
#if !defined(HAVE_INET_ATON)
int inet_aton(const char *cp, struct in_addr *inp);
#endif
# endif
#endif
-static int ftpDebug = 0;
+static int ftp_debug = 0;
+#define DBG(_f, _x) if ((ftp_debug | (_f))) fprintf _x
+
static int ftpTimeoutSecs = TIMEOUT_SECS;
static int httpTimeoutSecs = TIMEOUT_SECS;
}
} while (doesContinue && !rc);
-if (ftpDebug)
-fprintf(stderr, "<- %s\n", buf);
+ DBG(0, (stderr, "<- %s\n", buf));
if (str) *str = buf;
if (ecp) *ecp = atoi(errorCode);
buf[len - 1] = '\n';
buf[len] = '\0';
-if (ftpDebug)
-fprintf(stderr, "-> %s", buf);
- if (write(u->ftpControl, buf, len) != len) {
+ DBG(0, (stderr, "-> %s", buf));
+ if (write(u->ftpControl, buf, len) != len)
return FTPERR_SERVER_IO_ERROR;
- }
return ftpCheckResponse(u, NULL);
}
return rc;
}
-if (ftpDebug)
-fprintf(stderr,"++ connect %s:%d on fd %d\n", /*@-unrecog@*/ inet_ntoa(sin.sin_addr) /*@=unrecog@*/ , ntohs(sin.sin_port), sock);
+ DBG(0, (stderr,"++ connect %s:%d on fd %d\n",
+ /*@-unrecog@*/ inet_ntoa(sin.sin_addr) /*@=unrecog@*/ ,
+ ntohs(sin.sin_port), sock));
return sock;
}
return FTPERR_SERVER_IO_ERROR;
}
-if (ftpDebug)
-fprintf(stderr, "-> %s", buf);
+ DBG(0, (stderr, "-> %s", buf));
{ int ec = 0;
int rc;
}
}
-if (ftpDebug)
-fprintf(stderr, "++ copied %d bytes: %s\n", bytesCopied, ftpStrerror(rc));
+ DBG(fdDebug(sfd), (stderr, "++ copied %d bytes: %s\n", bytesCopied,
+ ftpStrerror(rc)));
if (urlNotify) {
(void)(*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE,
}
int ftpAbort(FD_t fd) {
- urlinfo *u = (urlinfo *)fd->fd_url;
+ urlinfo *u = ufdGetUrlinfo(fd);
char buf[BUFFER_SIZE];
int rc;
int tosecs = ftpTimeoutSecs;
-if (ftpDebug)
-fprintf(stderr, "-> ABOR\n");
+ DBG(fdDebug(fd), (stderr, "-> ABOR\n"));
sprintf(buf, "%c%c%c", (char)IAC, (char)IP, (char)IAC);
(void)send(u->ftpControl, buf, 3, MSG_OOB);
int ftpGetFileDesc(FD_t fd)
{
- urlinfo *u;
+ urlinfo * u = ufdGetUrlinfo(fd);
const char *remotename;
struct sockaddr_in dataAddress;
int i, j;
char * retrCommand;
int rc;
- u = (urlinfo *)fd->fd_url;
remotename = u->path;
/*
if (u->ftpGetFileDoneNeeded)
rc = ftpGetFileDone(u);
-if (ftpDebug)
-fprintf(stderr, "-> PASV\n");
+ DBG(fdDebug(fd), (stderr, "-> PASV\n"));
if (write(u->ftpControl, "PASV\r\n", 6) != 6)
return FTPERR_SERVER_IO_ERROR;
if (!inet_aton(passReply, &dataAddress.sin_addr))
return FTPERR_PASSIVE_ERROR;
- fd->fd_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
+ ufdSetFd(fd, socket(AF_INET, SOCK_STREAM, IPPROTO_IP));
if (Fileno(fd) < 0)
return FTPERR_FAILED_CONNECT;
return FTPERR_FAILED_DATA_CONNECT;
}
-if (ftpDebug)
-fprintf(stderr, "-> %s", retrCommand);
+ DBG(fdDebug(fd), (stderr, "-> %s", retrCommand));
if (write(u->ftpControl, retrCommand, i) != i) {
return FTPERR_SERVER_IO_ERROR;
}
int ftpGetFile(FD_t sfd, FD_t tfd)
{
- urlinfo *u;
- int rc;
-
/* XXX sfd will be freed by copyData -- grab sfd->fd_url now */
- u = (urlinfo *)sfd->fd_url;
+ urlinfo * sfu = ufdGetUrlinfo(sfd);
+ int rc;
/* XXX normally sfd = ufdOpen(...) and this code does not execute */
if (Fileno(sfd) < 0 && (rc = ftpGetFileDesc(sfd)) < 0) {
if (rc < 0)
return rc;
- return ftpGetFileDone(u);
+ return ftpGetFileDone(sfu);
}
int ftpClose(FD_t fd) {
- int fdno = ((urlinfo *)fd->fd_url)->ftpControl;
+ urlinfo * u = ufdGetUrlinfo(fd);
+ int fdno = u->ftpControl;
if (fdno >= 0)
close(fdno);
return 0;
extern /*@only@*/ /*@null@*/ FD_t fdDup(int fdno);
extern /*@dependent@*/ /*@null@*/ FILE *fdFdopen( /*@only@*/ FD_t fd, const char * mode);
-/*@observer@*/ const cookie_io_functions_t * fdGetIoCookie(FD_t fd);
+/*@observer@*/ /*@null@*/ const cookie_io_functions_t * fdGetIoCookie(FD_t fd);
void fdSetIoCookie(FD_t fd, cookie_io_functions_t * io);
-void fdSetDebugOn(FD_t fd);
-void fdSetDebugOff(FD_t fd);
+int fdDebug(FD_t fd);
+void fdDebugOn(FD_t fd);
+void fdDebugOff(FD_t fd);
extern cookie_io_functions_t fdio;
*/
/*@only@*/ FD_t ufdOpen(const char * pathname, int flags, mode_t mode);
/*@dependent@*/ void * ufdGetUrlinfo(FD_t fd);
+void ufdSetFd(FD_t fd, int fdno);
/*@observer@*/ const char * urlStrerror(const char * url);
extern cookie_io_functions_t ufdio;
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-10-31 16:21-0500\n"
+"POT-Creation-Date: 1999-11-01 08:40-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgid "file %s is on an unknown device"
msgstr ""
-#: lib/ftp.c:665
+#: lib/ftp.c:657
msgid "Success"
msgstr ""
-#: lib/ftp.c:668
+#: lib/ftp.c:660
msgid "Bad server response"
msgstr ""
-#: lib/ftp.c:671
+#: lib/ftp.c:663
msgid "Server IO error"
msgstr ""
-#: lib/ftp.c:674
+#: lib/ftp.c:666
msgid "Server timeout"
msgstr ""
-#: lib/ftp.c:677
+#: lib/ftp.c:669
msgid "Unable to lookup server host address"
msgstr ""
-#: lib/ftp.c:680
+#: lib/ftp.c:672
msgid "Unable to lookup server host name"
msgstr ""
-#: lib/ftp.c:683
+#: lib/ftp.c:675
msgid "Failed to connect to server"
msgstr ""
-#: lib/ftp.c:686
+#: lib/ftp.c:678
msgid "Failed to establish data connection to server"
msgstr ""
-#: lib/ftp.c:689
+#: lib/ftp.c:681
msgid "IO error to local file"
msgstr ""
-#: lib/ftp.c:692
+#: lib/ftp.c:684
msgid "Error setting remote server to passive mode"
msgstr ""
-#: lib/ftp.c:695
+#: lib/ftp.c:687
msgid "File not found on server"
msgstr ""
-#: lib/ftp.c:698
+#: lib/ftp.c:690
msgid "Abort in progress"
msgstr ""
-#: lib/ftp.c:702
+#: lib/ftp.c:694
msgid "Unknown or unexpected error"
msgstr ""
msgstr ""
#. XXX PARANOIA
-#: lib/rpmio.c:159
+#: lib/rpmio.c:170
#, c-format
msgid "logging into %s as %s, pw %s\n"
msgstr ""