Date: Sun, 4 May 1997 18:19:32 +0300 (IDT) From: Nadav Eiron <nadav@barcode.co.il> To: hackers@freebsd.org Subject: /usr/include/ftpio.h is not C++ safe Message-ID: <Pine.BSF.3.91.970504174746.26341A-200000@gatekeeper.barcode.co.il>
index | next in thread | raw e-mail
[-- Attachment #1 --]
Hi,
This is a second try on this, following some comments from Chuck Robey.
/usr/include/ftpio.h (the same as src/lib/libftpio/ftpio.h) does not work
with C++ files. It compiles, but missing extern "C" on all externs, it
does not link correctly. I know most of FreeBSD is not C++, but I think
having files from /usr/include work correctly is worth the effort
(anyhow, I needed ftp access from a C++ program, and libftpio seems to do
the job right).
Well, here is the diff for the changes (it should also make it compile
under K&R). The diff is against 2.1.7, but it's the same for 2.2.1
(sorry, I don't run -current here).
comments?
[-- Attachment #2 --]
*** /usr/src/lib/libftpio/ftpio.h.orig Fri Feb 7 04:51:33 1997
--- /usr/src/lib/libftpio/ftpio.h Fri May 2 10:02:36 1997
***************
*** 2,7 ****
--- 2,8 ----
#define _FTP_H_INCLUDE
#include <sys/types.h>
+ #include <sys/cdefs.h>
#include <stdio.h>
#include <time.h>
***************
*** 42,64 ****
const int num;
const char *string;
};
extern struct ftperr ftpErrList[];
extern int const ftpErrListLength;
/* Exported routines - deal only with FILE* type */
! extern FILE *ftpLogin(char *host, char *user, char *passwd, int port, int verbose, int *retcode);
! extern int ftpChdir(FILE *fp, char *dir);
! extern int ftpErrno(FILE *fp);
! extern off_t ftpGetSize(FILE *fp, char *file);
! extern FILE *ftpGet(FILE *fp, char *file, off_t *seekto);
! extern FILE *ftpPut(FILE *fp, char *file);
! extern int ftpAscii(FILE *fp);
! extern int ftpBinary(FILE *fp);
! extern int ftpPassive(FILE *fp, int status);
! extern void ftpVerbose(FILE *fp, int status);
! extern FILE *ftpGetURL(char *url, char *user, char *passwd, int *retcode);
! extern FILE *ftpPutURL(char *url, char *user, char *passwd, int *retcode);
! extern time_t ftpGetModtime(FILE *fp, char *s);
! extern const char *ftpErrString(int errno);
#endif /* _FTP_H_INCLUDE */
--- 43,68 ----
const int num;
const char *string;
};
+
+ __BEGIN_DECLS
extern struct ftperr ftpErrList[];
extern int const ftpErrListLength;
/* Exported routines - deal only with FILE* type */
! extern FILE *ftpLogin __P((char *host, char *user, char *passwd, int port, int verbose, int *retcode));
! extern int ftpChdir __P((FILE *fp, char *dir));
! extern int ftpErrno __P((FILE *fp));
! extern off_t ftpGetSize __P((FILE *fp, char *file));
! extern FILE *ftpGet __P((FILE *fp, char *file, off_t *seekto));
! extern FILE *ftpPut __P((FILE *fp, char *file));
! extern int ftpAscii __P((FILE *fp));
! extern int ftpBinary __P((FILE *fp));
! extern int ftpPassive __P((FILE *fp, int status));
! extern void ftpVerbose __P((FILE *fp, int status));
! extern FILE *ftpGetURL __P((char *url, char *user, char *passwd, int *retcode));
! extern FILE *ftpPutURL __P((char *url, char *user, char *passwd, int *retcode));
! extern time_t ftpGetModtime __P((FILE *fp, char *s));
! extern const char *ftpErrString __P((int errno));
! __END_DECLS
#endif /* _FTP_H_INCLUDE */
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970504174746.26341A-200000>
