Fix transfer summary
[reactos.git] / reactos / apps / utils / net / ftp / fake.c
index baedf7f..f8d0c8c 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <time.h>
 #include <winsock.h>
+#include "fake.h"
 #include "prototypes.h"
 
 #define MAX_ASCII 100
@@ -34,12 +35,11 @@ void blkfree(char **av0)
                free(*av++);
 }
 
-char *glob(register char *v)
+char **glob(register char *v)
 {
    return NULL;
 }
 
-
 int sleep(int time)
 {
    return time;
@@ -49,8 +49,8 @@ int herror(char *string)
 {
    return 0;
 }
-#if 0
 
+#if 0
 int gettimeofday(struct timeval *timenow,
                                 struct timezone *zone)
 {
@@ -92,14 +92,14 @@ int fgetcSocket(int s)
 {
    static int index = 0;
    static int total = 0;
-   static unsigned char buffer[4096];
+   static char buffer[4096];
 
    if (index == total)
      {
        index = 0;
        total = recv(s, buffer, sizeof(buffer), 0);
 
-       if (total == INVALID_SOCKET)
+       if (total == SOCKET_ERROR)
         {
           total = 0;
           return ERROR;
@@ -113,7 +113,7 @@ int fgetcSocket(int s)
 
 #endif
 
-char *fprintfSocket(int s, char *format, ...)
+const char *fprintfSocket(int s, const char *format, ...)
 {
    va_list argptr;
    char buffer[10009];
@@ -127,7 +127,7 @@ char *fprintfSocket(int s, char *format, ...)
    return NULL;
 }
 
-char *fputsSocket(char *format, int s)
+const char *fputsSocket(const char *format, int s)
 {
    send(s, format, strlen(format), 0);
 
@@ -142,7 +142,7 @@ int fputcSocket(int s, char putChar)
    buffer[1] = '\0';
 
    if(SOCKET_ERROR==send(s, buffer, 1, 0)) {
-          int iret=WSAGetLastError (); 
+          int iret=WSAGetLastError ();
           fprintf(stdout,"fputcSocket: %d\n",iret);
           return 0;
    }
@@ -154,9 +154,9 @@ int fputSocket(int s, char *buffer, int len)
 {
        int iret;
        while(len) {
-               if(SOCKET_ERROR==(iret=send(s, buffer, len, 0))) 
+               if(SOCKET_ERROR==(iret=send(s, buffer, len, 0)))
                {
-                       iret=WSAGetLastError (); 
+                       iret=WSAGetLastError ();
                        fprintf(stdout,"fputcSocket: %d\n",iret);
                        return 0;
                }
@@ -187,7 +187,7 @@ char *fgetsSocket(int s, char *string)
       if (count == 1)
       {
         string[i] = buffer[0];
-        
+
         if (i == MAX_ASCII - 3)
         {
            count = 0;
@@ -293,11 +293,13 @@ char *getpass (const char * prompt)
   return NULL;
 }
 
+#if 0
 // Stubbed out here. Should be changed in Source code...
 int access(const char *filename, int accessmethod)
 {
    return 0;
 }
+#endif
 
 #ifndef __GNUC__
 #define EPOCHFILETIME (116444736000000000i64)
@@ -305,12 +307,7 @@ int access(const char *filename, int accessmethod)
 #define EPOCHFILETIME (116444736000000000LL)
 #endif
 
-struct timezone {
-    int tz_minuteswest; /* minutes W of Greenwich */
-    int tz_dsttime;     /* type of dst correction */
-};
-
-__inline int gettimeofday(struct timeval *tv, struct timezone *tz)
+int gettimeofday(struct timeval *tv, struct timezone *tz)
 {
     FILETIME        ft;
     LARGE_INTEGER   li;
@@ -320,8 +317,8 @@ __inline int gettimeofday(struct timeval *tv, struct timezone *tz)
     if (tv)
     {
         GetSystemTimeAsFileTime(&ft);
-        //li.LowPart  = ft.dwLowDateTime;
-        //li.HighPart = ft.dwHighDateTime;
+        li.LowPart  = ft.dwLowDateTime;
+        li.HighPart = ft.dwHighDateTime;
         t  = li.QuadPart;       /* In 100-nanosecond intervals */
         t -= EPOCHFILETIME;     /* Offset to the Epoch time */
         t /= 10;                /* In microseconds */