123 lines
2.9 KiB
Diff
123 lines
2.9 KiB
Diff
diff -Naur inetutils-1.9.2-orig/ftp/cmds.c inetutils-1.9.2/ftp/cmds.c
|
|
--- inetutils-1.9.2-orig/ftp/cmds.c 2013-12-03 17:57:43.000000000 +0300
|
|
+++ inetutils-1.9.2/ftp/cmds.c 2014-12-12 11:55:12.135600000 +0300
|
|
@@ -102,6 +102,10 @@
|
|
# endif
|
|
#endif /* !DEFPORT */
|
|
|
|
+#ifdef __CYGWIN__
|
|
+typedef _sig_func_ptr sig_t;
|
|
+#endif
|
|
+
|
|
/* Returns true if STR is entirely lower case. */
|
|
static int
|
|
all_lower (char *str)
|
|
@@ -297,6 +301,13 @@
|
|
if (autologin)
|
|
login (host);
|
|
|
|
+#ifdef __CYGWIN__
|
|
+# ifndef unix
|
|
+# define unix
|
|
+# endif
|
|
+# define NBBY 8
|
|
+#endif /* __CYGWIN__ */
|
|
+
|
|
#if (defined unix || defined __unix || defined __unix__) && NBBY == 8
|
|
/*
|
|
* this ifdef is to keep someone form "porting" this to an incompatible
|
|
@@ -1852,7 +1863,7 @@
|
|
len += strlen (strcpy (&buf[len], argv[i]));
|
|
}
|
|
}
|
|
- if (command (buf) == PRELIM)
|
|
+ if (command ("%s", buf) == PRELIM)
|
|
{
|
|
while (getreply (0) == PRELIM)
|
|
continue;
|
|
diff -Naur inetutils-1.9.2-orig/ftp/ftp.c inetutils-1.9.2/ftp/ftp.c
|
|
--- inetutils-1.9.2-orig/ftp/ftp.c 2013-12-23 14:57:54.000000000 +0300
|
|
+++ inetutils-1.9.2/ftp/ftp.c 2014-12-12 11:55:12.135600000 +0300
|
|
@@ -90,6 +90,11 @@
|
|
#include "ftp_var.h"
|
|
#include "unused-parameter.h"
|
|
|
|
+#ifdef __CYGWIN__
|
|
+#include <io.h>
|
|
+typedef _sig_func_ptr sig_t;
|
|
+#endif
|
|
+
|
|
#if !HAVE_DECL_FCLOSE
|
|
/* Some systems don't declare fclose in <stdio.h>, so do it ourselves. */
|
|
extern int fclose (FILE *);
|
|
@@ -100,7 +105,9 @@
|
|
extern int pclose (FILE *);
|
|
#endif
|
|
|
|
+#ifndef __CYGWIN__
|
|
extern int h_errno;
|
|
+#endif
|
|
|
|
int data = -1;
|
|
int abrtflag = 0;
|
|
@@ -641,7 +648,15 @@
|
|
}
|
|
else
|
|
{
|
|
+#ifdef __CYGWIN__
|
|
+ if (curtype != TYPE_A) {
|
|
+ fin = fopen (local, "rb");
|
|
+ } else {
|
|
+ fin = fopen (local, "r");
|
|
+ }
|
|
+#else
|
|
fin = fopen (local, "r");
|
|
+#endif
|
|
if (fin == NULL)
|
|
{
|
|
error (0, errno, "local: %s", local);
|
|
@@ -685,6 +700,7 @@
|
|
break;
|
|
case TYPE_I:
|
|
case TYPE_L:
|
|
+ setmode (fileno (fin), O_BINARY);
|
|
rc = lseek (fileno (fin), restart_point, SEEK_SET);
|
|
break;
|
|
}
|
|
@@ -753,6 +769,8 @@
|
|
|
|
case TYPE_I:
|
|
case TYPE_L:
|
|
+ setmode (fileno (fin), O_BINARY);
|
|
+ setmode (fileno (dout), O_BINARY);
|
|
errno = d = 0;
|
|
while ((c = read (fileno (fin), buf, bufsize)) > 0)
|
|
{
|
|
@@ -987,7 +1005,17 @@
|
|
{
|
|
struct stat st;
|
|
|
|
+#ifdef __CYGWIN__
|
|
+ {
|
|
+ char nmode[8];
|
|
+ strcpy (nmode, lmode);
|
|
+ if (curtype != TYPE_A)
|
|
+ strcat (nmode, "b");
|
|
+ fout = fopen (local, nmode);
|
|
+ }
|
|
+#else
|
|
fout = fopen (local, lmode);
|
|
+#endif
|
|
if (fout == NULL || fstat (fileno (fout), &st) < 0)
|
|
{
|
|
error (0, errno, "local: %s", local);
|
|
@@ -1016,6 +1044,8 @@
|
|
|
|
case TYPE_I:
|
|
case TYPE_L:
|
|
+ setmode (fileno (fout), O_BINARY);
|
|
+ setmode (fileno (din), O_BINARY);
|
|
if (restart_point && lseek (fileno (fout), restart_point, SEEK_SET) < 0)
|
|
{
|
|
error (0, errno, "local: %s", local);
|